event.c (212049) | event.c (225787) |
---|---|
1/*- 2 * Copyright (c) 2010 Pawel Jakub Dawidek <pjd@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2010 Pawel Jakub Dawidek <pjd@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sbin/hastd/event.c 212049 2010-08-31 09:38:43Z pjd $"); | 28__FBSDID("$FreeBSD: head/sbin/hastd/event.c 225787 2011-09-27 08:50:37Z pjd $"); |
29 | 29 |
30#include <assert.h> | |
31#include <errno.h> 32 33#include "hast.h" 34#include "hast_proto.h" 35#include "hooks.h" 36#include "nv.h" 37#include "pjdlog.h" 38#include "proto.h" 39#include "subr.h" 40 41#include "event.h" 42 43void 44event_send(const struct hast_resource *res, int event) 45{ 46 struct nv *nvin, *nvout; 47 int error; 48 | 30#include <errno.h> 31 32#include "hast.h" 33#include "hast_proto.h" 34#include "hooks.h" 35#include "nv.h" 36#include "pjdlog.h" 37#include "proto.h" 38#include "subr.h" 39 40#include "event.h" 41 42void 43event_send(const struct hast_resource *res, int event) 44{ 45 struct nv *nvin, *nvout; 46 int error; 47 |
49 assert(res != NULL); 50 assert(event >= EVENT_MIN && event <= EVENT_MAX); | 48 PJDLOG_ASSERT(res != NULL); 49 PJDLOG_ASSERT(event >= EVENT_MIN && event <= EVENT_MAX); |
51 52 nvin = nvout = NULL; 53 54 /* 55 * Prepare and send event to parent process. 56 */ 57 nvout = nv_alloc(); 58 nv_add_uint8(nvout, (uint8_t)event, "event"); --- 25 unchanged lines hidden (view full) --- 84int 85event_recv(const struct hast_resource *res) 86{ 87 struct nv *nvin, *nvout; 88 const char *evstr; 89 uint8_t event; 90 int error; 91 | 50 51 nvin = nvout = NULL; 52 53 /* 54 * Prepare and send event to parent process. 55 */ 56 nvout = nv_alloc(); 57 nv_add_uint8(nvout, (uint8_t)event, "event"); --- 25 unchanged lines hidden (view full) --- 83int 84event_recv(const struct hast_resource *res) 85{ 86 struct nv *nvin, *nvout; 87 const char *evstr; 88 uint8_t event; 89 int error; 90 |
92 assert(res != NULL); | 91 PJDLOG_ASSERT(res != NULL); |
93 94 nvin = nvout = NULL; 95 96 if (hast_proto_recv_hdr(res->hr_event, &nvin) < 0) { 97 /* 98 * First error log as debug. This is because worker process 99 * most likely exited. 100 */ --- 62 unchanged lines hidden --- | 92 93 nvin = nvout = NULL; 94 95 if (hast_proto_recv_hdr(res->hr_event, &nvin) < 0) { 96 /* 97 * First error log as debug. This is because worker process 98 * most likely exited. 99 */ --- 62 unchanged lines hidden --- |