1/*-
2 * Copyright (c) 2009-2010 The FreeBSD Foundation
3 * Copyright (c) 2010 Pawel Jakub Dawidek <pjd@FreeBSD.org>
4 * All rights reserved.
5 *
6 * This software was developed by Pawel Jakub Dawidek under sponsorship from
7 * the FreeBSD Foundation.
8 *
--- 15 unchanged lines hidden (view full) ---
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sbin/hastd/secondary.c 219721 2011-03-17 21:02:14Z trociny $");
33
34#include <sys/param.h>
35#include <sys/time.h>
36#include <sys/bio.h>
37#include <sys/disk.h>
38#include <sys/stat.h>
39
40#include <err.h>
--- 305 unchanged lines hidden (view full) ---
346 sigset_t mask;
347 pthread_t td;
348 pid_t pid;
349 int error, mode, debuglevel;
350
351 /*
352 * Create communication channel between parent and child.
353 */
354 if (proto_client("socketpair://", &res->hr_ctrl) < 0) {
355 KEEP_ERRNO((void)pidfile_remove(pfh));
356 pjdlog_exit(EX_OSERR,
357 "Unable to create control sockets between parent and child");
358 }
359 /*
360 * Create communication channel between child and parent.
361 */
362 if (proto_client("socketpair://", &res->hr_event) < 0) {
363 KEEP_ERRNO((void)pidfile_remove(pfh));
364 pjdlog_exit(EX_OSERR,
365 "Unable to create event sockets between child and parent");
366 }
367 /*
368 * Create communication channel for sending connection requests from
369 * parent to child.
370 */
371 if (proto_client("socketpair://", &res->hr_conn) < 0) {
372 /* TODO: There's no need for this to be fatal error. */
373 KEEP_ERRNO((void)pidfile_remove(pfh));
374 pjdlog_exit(EX_OSERR,
375 "Unable to create connection sockets between parent and child");
376 }
377
378 pid = fork();
379 if (pid < 0) {
--- 404 unchanged lines hidden ---
2 * Copyright (c) 2009-2010 The FreeBSD Foundation
3 * Copyright (c) 2010 Pawel Jakub Dawidek <pjd@FreeBSD.org>
4 * All rights reserved.
5 *
6 * This software was developed by Pawel Jakub Dawidek under sponsorship from
7 * the FreeBSD Foundation.
8 *
--- 15 unchanged lines hidden (view full) ---
24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sbin/hastd/secondary.c 219721 2011-03-17 21:02:14Z trociny $");
33
34#include <sys/param.h>
35#include <sys/time.h>
36#include <sys/bio.h>
37#include <sys/disk.h>
38#include <sys/stat.h>
39
40#include <err.h>
--- 305 unchanged lines hidden (view full) ---
346 sigset_t mask;
347 pthread_t td;
348 pid_t pid;
349 int error, mode, debuglevel;
350
351 /*
352 * Create communication channel between parent and child.
353 */
354 if (proto_client("socketpair://", &res->hr_ctrl) < 0) {
355 KEEP_ERRNO((void)pidfile_remove(pfh));
356 pjdlog_exit(EX_OSERR,
357 "Unable to create control sockets between parent and child");
358 }
359 /*
360 * Create communication channel between child and parent.
361 */
362 if (proto_client("socketpair://", &res->hr_event) < 0) {
363 KEEP_ERRNO((void)pidfile_remove(pfh));
364 pjdlog_exit(EX_OSERR,
365 "Unable to create event sockets between child and parent");
366 }
367 /*
368 * Create communication channel for sending connection requests from
369 * parent to child.
370 */
371 if (proto_client("socketpair://", &res->hr_conn) < 0) {
372 /* TODO: There's no need for this to be fatal error. */
373 KEEP_ERRNO((void)pidfile_remove(pfh));
374 pjdlog_exit(EX_OSERR,
375 "Unable to create connection sockets between parent and child");
376 }
377
378 pid = fork();
379 if (pid < 0) {
--- 404 unchanged lines hidden ---