diff options
| author | manuel <manuel@mausz.at> | 2013-02-04 00:08:53 +0100 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2013-02-04 00:08:53 +0100 |
| commit | 69aec538b456402170dc723af417ba5c05389c32 (patch) | |
| tree | e6f34c543f17c6392447ea337b2e2868212424d1 /trigger.c | |
| download | qmail-69aec538b456402170dc723af417ba5c05389c32.tar.gz qmail-69aec538b456402170dc723af417ba5c05389c32.tar.bz2 qmail-69aec538b456402170dc723af417ba5c05389c32.zip | |
qmail 1.03 import
Diffstat (limited to 'trigger.c')
| -rw-r--r-- | trigger.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/trigger.c b/trigger.c new file mode 100644 index 0000000..39f81b8 --- /dev/null +++ b/trigger.c | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | #include "select.h" | ||
| 2 | #include "open.h" | ||
| 3 | #include "trigger.h" | ||
| 4 | #include "hasnpbg1.h" | ||
| 5 | |||
| 6 | static int fd = -1; | ||
| 7 | #ifdef HASNAMEDPIPEBUG1 | ||
| 8 | static int fdw = -1; | ||
| 9 | #endif | ||
| 10 | |||
| 11 | void trigger_set() | ||
| 12 | { | ||
| 13 | if (fd != -1) | ||
| 14 | close(fd); | ||
| 15 | #ifdef HASNAMEDPIPEBUG1 | ||
| 16 | if (fdw != -1) | ||
| 17 | close(fdw); | ||
| 18 | #endif | ||
| 19 | fd = open_read("lock/trigger"); | ||
| 20 | #ifdef HASNAMEDPIPEBUG1 | ||
| 21 | fdw = open_write("lock/trigger"); | ||
| 22 | #endif | ||
| 23 | } | ||
| 24 | |||
| 25 | void trigger_selprep(nfds,rfds) | ||
| 26 | int *nfds; | ||
| 27 | fd_set *rfds; | ||
| 28 | { | ||
| 29 | if (fd != -1) | ||
| 30 | { | ||
| 31 | FD_SET(fd,rfds); | ||
| 32 | if (*nfds < fd + 1) *nfds = fd + 1; | ||
| 33 | } | ||
| 34 | } | ||
| 35 | |||
| 36 | int trigger_pulled(rfds) | ||
| 37 | fd_set *rfds; | ||
| 38 | { | ||
| 39 | if (fd != -1) if (FD_ISSET(fd,rfds)) return 1; | ||
| 40 | return 0; | ||
| 41 | } | ||
