summaryrefslogtreecommitdiffstats
path: root/trigger.c
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2013-02-04 00:08:53 +0100
committermanuel <manuel@mausz.at>2013-02-04 00:08:53 +0100
commit69aec538b456402170dc723af417ba5c05389c32 (patch)
treee6f34c543f17c6392447ea337b2e2868212424d1 /trigger.c
downloadqmail-69aec538b456402170dc723af417ba5c05389c32.tar.gz
qmail-69aec538b456402170dc723af417ba5c05389c32.tar.bz2
qmail-69aec538b456402170dc723af417ba5c05389c32.zip
qmail 1.03 import
Diffstat (limited to 'trigger.c')
-rw-r--r--trigger.c41
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
6static int fd = -1;
7#ifdef HASNAMEDPIPEBUG1
8static int fdw = -1;
9#endif
10
11void 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
25void trigger_selprep(nfds,rfds)
26int *nfds;
27fd_set *rfds;
28{
29 if (fd != -1)
30 {
31 FD_SET(fd,rfds);
32 if (*nfds < fd + 1) *nfds = fd + 1;
33 }
34}
35
36int trigger_pulled(rfds)
37fd_set *rfds;
38{
39 if (fd != -1) if (FD_ISSET(fd,rfds)) return 1;
40 return 0;
41}