Deleted Added
full compact
primary.c (213007) primary.c (213009)
1/*-
2 * Copyright (c) 2009 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 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/primary.c 213007 2010-09-22 19:03:11Z pjd $");
32__FBSDID("$FreeBSD: head/sbin/hastd/primary.c 213009 2010-09-22 19:08:11Z pjd $");
33
34#include <sys/types.h>
35#include <sys/time.h>
36#include <sys/bio.h>
37#include <sys/disk.h>
38#include <sys/refcount.h>
39#include <sys/stat.h>
40

--- 267 unchanged lines hidden (view full) ---

308 return (strcmp(res->hr_remoteaddr, "none") != 0);
309}
310
311static void
312init_environment(struct hast_resource *res __unused)
313{
314 struct hio *hio;
315 unsigned int ii, ncomps;
33
34#include <sys/types.h>
35#include <sys/time.h>
36#include <sys/bio.h>
37#include <sys/disk.h>
38#include <sys/refcount.h>
39#include <sys/stat.h>
40

--- 267 unchanged lines hidden (view full) ---

308 return (strcmp(res->hr_remoteaddr, "none") != 0);
309}
310
311static void
312init_environment(struct hast_resource *res __unused)
313{
314 struct hio *hio;
315 unsigned int ii, ncomps;
316 sigset_t mask;
317
318 /*
319 * In the future it might be per-resource value.
320 */
321 ncomps = HAST_NCOMPONENTS;
322
323 /*
324 * Allocate memory needed by lists.

--- 90 unchanged lines hidden (view full) ---

415 primary_exitx(EX_TEMPFAIL,
416 "Unable to allocate %zu bytes of memory for gctl_data.",
417 MAXPHYS);
418 }
419 hio->hio_ggio.gctl_length = MAXPHYS;
420 hio->hio_ggio.gctl_error = 0;
421 TAILQ_INSERT_HEAD(&hio_free_list, hio, hio_free_next);
422 }
316
317 /*
318 * In the future it might be per-resource value.
319 */
320 ncomps = HAST_NCOMPONENTS;
321
322 /*
323 * Allocate memory needed by lists.

--- 90 unchanged lines hidden (view full) ---

414 primary_exitx(EX_TEMPFAIL,
415 "Unable to allocate %zu bytes of memory for gctl_data.",
416 MAXPHYS);
417 }
418 hio->hio_ggio.gctl_length = MAXPHYS;
419 hio->hio_ggio.gctl_error = 0;
420 TAILQ_INSERT_HEAD(&hio_free_list, hio, hio_free_next);
421 }
423
424 /*
425 * Turn on signals handling.
426 */
427 PJDLOG_VERIFY(sigemptyset(&mask) == 0);
428 PJDLOG_VERIFY(sigaddset(&mask, SIGHUP) == 0);
429 PJDLOG_VERIFY(sigaddset(&mask, SIGINT) == 0);
430 PJDLOG_VERIFY(sigaddset(&mask, SIGTERM) == 0);
431 PJDLOG_VERIFY(sigprocmask(SIG_SETMASK, &mask, NULL) == 0);
432}
433
434static void
435init_local(struct hast_resource *res)
436{
437 unsigned char *buf;
438 size_t mapsize;
439

--- 355 unchanged lines hidden (view full) ---

795
796 gres = res;
797
798 (void)pidfile_close(pfh);
799 hook_fini();
800
801 setproctitle("%s (primary)", res->hr_name);
802
422}
423
424static void
425init_local(struct hast_resource *res)
426{
427 unsigned char *buf;
428 size_t mapsize;
429

--- 355 unchanged lines hidden (view full) ---

785
786 gres = res;
787
788 (void)pidfile_close(pfh);
789 hook_fini();
790
791 setproctitle("%s (primary)", res->hr_name);
792
803 signal(SIGHUP, SIG_DFL);
804 signal(SIGCHLD, SIG_DFL);
805
806 /* Declare that we are sender. */
807 proto_send(res->hr_event, NULL, 0);
808
809 init_local(res);
810 init_ggate(res);
811 init_environment(res);
812 /*
813 * Create the control thread before sending any event to the parent,

--- 1185 unchanged lines hidden ---
793 /* Declare that we are sender. */
794 proto_send(res->hr_event, NULL, 0);
795
796 init_local(res);
797 init_ggate(res);
798 init_environment(res);
799 /*
800 * Create the control thread before sending any event to the parent,

--- 1185 unchanged lines hidden ---