diff options
author | Stefan Metzmacher <metze@samba.org> | 2009-12-20 13:59:03 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2009-12-20 14:21:50 +0100 |
commit | 4b7a6b1f8ff9ffe984612e1a303473d7a0865c0c (patch) | |
tree | dfccea9c952fd1acb385aa99eb4cf4575cc2f6cc | |
parent | 590f7c262df9517f64c6faf35e6b7ed7664a0002 (diff) | |
download | samba-4b7a6b1f8ff9ffe984612e1a303473d7a0865c0c.tar.gz samba-4b7a6b1f8ff9ffe984612e1a303473d7a0865c0c.tar.bz2 samba-4b7a6b1f8ff9ffe984612e1a303473d7a0865c0c.zip |
tevent: prefix types and defined with tevent_ and TEVENT_
This fixes the build warnings on some build-farm hosts.
metze
-rw-r--r-- | lib/tevent/tevent_signal.c | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c index ab170a66cf..0f3d83e877 100644 --- a/lib/tevent/tevent_signal.c +++ b/lib/tevent/tevent_signal.c @@ -30,23 +30,23 @@ #include "tevent_internal.h" #include "tevent_util.h" -#define NUM_SIGNALS 64 +#define TEVENT_NUM_SIGNALS 64 /* maximum number of SA_SIGINFO signals to hold in the queue. NB. This *MUST* be a power of 2, in order for the ring buffer wrap to work correctly. Thanks to Petr Vandrovec <petr@vandrovec.name> for this. */ -#define SA_INFO_QUEUE_COUNT 64 +#define TEVENT_SA_INFO_QUEUE_COUNT 64 -struct sigcounter { +struct tevent_sigcounter { uint32_t count; uint32_t seen; }; -#define SIG_INCREMENT(s) (s).count++ -#define SIG_SEEN(s, n) (s).seen += (n) -#define SIG_PENDING(s) ((s).seen != (s).count) +#define TEVENT_SIG_INCREMENT(s) (s).count++ +#define TEVENT_SIG_SEEN(s, n) (s).seen += (n) +#define TEVENT_SIG_PENDING(s) ((s).seen != (s).count) struct tevent_common_signal_list { struct tevent_common_signal_list *prev, *next; @@ -56,22 +56,22 @@ struct tevent_common_signal_list { /* the poor design of signals means that this table must be static global */ -static struct sig_state { - struct tevent_common_signal_list *sig_handlers[NUM_SIGNALS+1]; - struct sigaction *oldact[NUM_SIGNALS+1]; - struct sigcounter signal_count[NUM_SIGNALS+1]; - struct sigcounter got_signal; +static struct tevent_sig_state { + struct tevent_common_signal_list *sig_handlers[TEVENT_NUM_SIGNALS+1]; + struct sigaction *oldact[TEVENT_NUM_SIGNALS+1]; + struct tevent_sigcounter signal_count[TEVENT_NUM_SIGNALS+1]; + struct tevent_sigcounter got_signal; #ifdef SA_SIGINFO /* with SA_SIGINFO we get quite a lot of info per signal */ - siginfo_t *sig_info[NUM_SIGNALS+1]; - struct sigcounter sig_blocked[NUM_SIGNALS+1]; + siginfo_t *sig_info[TEVENT_NUM_SIGNALS+1]; + struct tevent_sigcounter sig_blocked[TEVENT_NUM_SIGNALS+1]; #endif } *sig_state; /* return number of sigcounter events not processed yet */ -static uint32_t sig_count(struct sigcounter s) +static uint32_t tevent_sig_count(struct tevent_sigcounter s) { return s.count - s.seen; } @@ -87,8 +87,8 @@ static void tevent_common_signal_handler(int signum) struct tevent_context *ev = NULL; int saved_errno = errno; - SIG_INCREMENT(sig_state->signal_count[signum]); - SIG_INCREMENT(sig_state->got_signal); + TEVENT_SIG_INCREMENT(sig_state->signal_count[signum]); + TEVENT_SIG_INCREMENT(sig_state->got_signal); /* Write to each unique event context. */ for (sl = sig_state->sig_handlers[signum]; sl; sl = sl->next) { @@ -109,24 +109,24 @@ static void tevent_common_signal_handler(int signum) static void tevent_common_signal_handler_info(int signum, siginfo_t *info, void *uctx) { - uint32_t count = sig_count(sig_state->signal_count[signum]); - /* sig_state->signal_count[signum].seen % SA_INFO_QUEUE_COUNT + uint32_t count = tevent_sig_count(sig_state->signal_count[signum]); + /* sig_state->signal_count[signum].seen % TEVENT_SA_INFO_QUEUE_COUNT * is the base of the unprocessed signals in the ringbuffer. */ uint32_t ofs = (sig_state->signal_count[signum].seen + count) % - SA_INFO_QUEUE_COUNT; + TEVENT_SA_INFO_QUEUE_COUNT; sig_state->sig_info[signum][ofs] = *info; tevent_common_signal_handler(signum); /* handle SA_SIGINFO */ - if (count+1 == SA_INFO_QUEUE_COUNT) { + if (count+1 == TEVENT_SA_INFO_QUEUE_COUNT) { /* we've filled the info array - block this signal until these ones are delivered */ sigset_t set; sigemptyset(&set); sigaddset(&set, signum); sigprocmask(SIG_BLOCK, &set, NULL); - SIG_INCREMENT(sig_state->sig_blocked[signum]); + TEVENT_SIG_INCREMENT(sig_state->sig_blocked[signum]); } } #endif @@ -196,7 +196,7 @@ struct tevent_signal *tevent_common_add_signal(struct tevent_context *ev, struct tevent_common_signal_list *sl; sigset_t set, oldset; - if (signum >= NUM_SIGNALS) { + if (signum >= TEVENT_NUM_SIGNALS) { errno = EINVAL; return NULL; } @@ -204,7 +204,7 @@ struct tevent_signal *tevent_common_add_signal(struct tevent_context *ev, /* the sig_state needs to be on a global context as it can last across multiple event contexts */ if (sig_state == NULL) { - sig_state = talloc_zero(talloc_autofree_context(), struct sig_state); + sig_state = talloc_zero(talloc_autofree_context(), struct tevent_sig_state); if (sig_state == NULL) { return NULL; } @@ -267,7 +267,9 @@ struct tevent_signal *tevent_common_add_signal(struct tevent_context *ev, act.sa_handler = NULL; act.sa_sigaction = tevent_common_signal_handler_info; if (sig_state->sig_info[signum] == NULL) { - sig_state->sig_info[signum] = talloc_zero_array(sig_state, siginfo_t, SA_INFO_QUEUE_COUNT); + sig_state->sig_info[signum] = + talloc_zero_array(sig_state, siginfo_t, + TEVENT_SA_INFO_QUEUE_COUNT); if (sig_state->sig_info[signum] == NULL) { talloc_free(se); return NULL; @@ -310,14 +312,14 @@ int tevent_common_check_signal(struct tevent_context *ev) { int i; - if (!sig_state || !SIG_PENDING(sig_state->got_signal)) { + if (!sig_state || !TEVENT_SIG_PENDING(sig_state->got_signal)) { return 0; } - for (i=0;i<NUM_SIGNALS+1;i++) { + for (i=0;i<TEVENT_NUM_SIGNALS+1;i++) { struct tevent_common_signal_list *sl, *next; - struct sigcounter counter = sig_state->signal_count[i]; - uint32_t count = sig_count(counter); + struct tevent_sigcounter counter = sig_state->signal_count[i]; + uint32_t count = tevent_sig_count(counter); #ifdef SA_SIGINFO /* Ensure we null out any stored siginfo_t entries * after processing for debugging purposes. */ @@ -338,11 +340,11 @@ int tevent_common_check_signal(struct tevent_context *ev) for (j=0;j<count;j++) { /* sig_state->signal_count[i].seen - * % SA_INFO_QUEUE_COUNT is + * % TEVENT_SA_INFO_QUEUE_COUNT is * the base position of the unprocessed * signals in the ringbuffer. */ uint32_t ofs = (counter.seen + j) - % SA_INFO_QUEUE_COUNT; + % TEVENT_SA_INFO_QUEUE_COUNT; se->handler(ev, se, i, 1, (void*)&sig_state->sig_info[i][ofs], se->private_data); @@ -364,7 +366,7 @@ int tevent_common_check_signal(struct tevent_context *ev) uint32_t j; for (j=0;j<count;j++) { uint32_t ofs = (counter.seen + j) - % SA_INFO_QUEUE_COUNT; + % TEVENT_SA_INFO_QUEUE_COUNT; memset((void*)&sig_state->sig_info[i][ofs], '\0', sizeof(siginfo_t)); @@ -372,23 +374,23 @@ int tevent_common_check_signal(struct tevent_context *ev) } #endif - SIG_SEEN(sig_state->signal_count[i], count); - SIG_SEEN(sig_state->got_signal, count); + TEVENT_SIG_SEEN(sig_state->signal_count[i], count); + TEVENT_SIG_SEEN(sig_state->got_signal, count); #ifdef SA_SIGINFO - if (SIG_PENDING(sig_state->sig_blocked[i])) { + if (TEVENT_SIG_PENDING(sig_state->sig_blocked[i])) { /* We'd filled the queue, unblock the signal now the queue is empty again. Note we MUST do this after the - SIG_SEEN(sig_state->signal_count[i], count) + TEVENT_SIG_SEEN(sig_state->signal_count[i], count) call to prevent a new signal running out of room in the sig_state->sig_info[i][] ring buffer. */ sigset_t set; sigemptyset(&set); sigaddset(&set, i); - SIG_SEEN(sig_state->sig_blocked[i], - sig_count(sig_state->sig_blocked[i])); + TEVENT_SIG_SEEN(sig_state->sig_blocked[i], + tevent_sig_count(sig_state->sig_blocked[i])); sigprocmask(SIG_UNBLOCK, &set, NULL); } #endif |