secondary.c (213007) | secondary.c (213009) |
---|---|
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> | 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 213007 2010-09-22 19:03:11Z pjd $"); | 32__FBSDID("$FreeBSD: head/sbin/hastd/secondary.c 213009 2010-09-22 19:08:11Z pjd $"); |
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 <assert.h> 41#include <err.h> 42#include <errno.h> 43#include <fcntl.h> 44#include <libgeom.h> 45#include <pthread.h> | 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 <assert.h> 41#include <err.h> 42#include <errno.h> 43#include <fcntl.h> 44#include <libgeom.h> 45#include <pthread.h> |
46#include <signal.h> |
|
46#include <stdint.h> 47#include <stdio.h> 48#include <string.h> 49#include <sysexits.h> 50#include <unistd.h> 51 52#include <activemap.h> 53#include <nv.h> --- 275 unchanged lines hidden (view full) --- 329 event_send(res, EVENT_SPLITBRAIN); 330 exit(EX_CONFIG); 331 } 332} 333 334void 335hastd_secondary(struct hast_resource *res, struct nv *nvin) 336{ | 47#include <stdint.h> 48#include <stdio.h> 49#include <string.h> 50#include <sysexits.h> 51#include <unistd.h> 52 53#include <activemap.h> 54#include <nv.h> --- 275 unchanged lines hidden (view full) --- 330 event_send(res, EVENT_SPLITBRAIN); 331 exit(EX_CONFIG); 332 } 333} 334 335void 336hastd_secondary(struct hast_resource *res, struct nv *nvin) 337{ |
338 sigset_t mask; |
|
337 pthread_t td; 338 pid_t pid; 339 int error; 340 341 /* 342 * Create communication channel between parent and child. 343 */ 344 if (proto_client("socketpair://", &res->hr_ctrl) < 0) { --- 30 unchanged lines hidden (view full) --- 375 376 gres = res; 377 378 (void)pidfile_close(pfh); 379 hook_fini(); 380 381 setproctitle("%s (secondary)", res->hr_name); 382 | 339 pthread_t td; 340 pid_t pid; 341 int error; 342 343 /* 344 * Create communication channel between parent and child. 345 */ 346 if (proto_client("socketpair://", &res->hr_ctrl) < 0) { --- 30 unchanged lines hidden (view full) --- 377 378 gres = res; 379 380 (void)pidfile_close(pfh); 381 hook_fini(); 382 383 setproctitle("%s (secondary)", res->hr_name); 384 |
383 signal(SIGHUP, SIG_DFL); 384 signal(SIGCHLD, SIG_DFL); | 385 PJDLOG_VERIFY(sigemptyset(&mask) == 0); 386 PJDLOG_VERIFY(sigprocmask(SIG_SETMASK, &mask, NULL) == 0); |
385 386 /* Declare that we are sender. */ 387 proto_send(res->hr_event, NULL, 0); 388 389 /* Error in setting timeout is not critical, but why should it fail? */ 390 if (proto_timeout(res->hr_remotein, 0) < 0) 391 pjdlog_errno(LOG_WARNING, "Unable to set connection timeout"); 392 if (proto_timeout(res->hr_remoteout, res->hr_timeout) < 0) --- 356 unchanged lines hidden --- | 387 388 /* Declare that we are sender. */ 389 proto_send(res->hr_event, NULL, 0); 390 391 /* Error in setting timeout is not critical, but why should it fail? */ 392 if (proto_timeout(res->hr_remotein, 0) < 0) 393 pjdlog_errno(LOG_WARNING, "Unable to set connection timeout"); 394 if (proto_timeout(res->hr_remoteout, res->hr_timeout) < 0) --- 356 unchanged lines hidden --- |