~ubuntu-branches/ubuntu/lucid/libevent/lucid

« back to all changes in this revision

Viewing changes to signal.c

  • Committer: Bazaar Package Importer
  • Author(s): Simon Law
  • Date: 2005-06-27 21:05:46 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050627210546-ltxijf9i7ttholzh
Tags: 1.1a-1
* New upstream release.
* Acknowledge NMUs.  (Closes: Bug#288282, Bug#288404, Bug#290385, Bug#291096)
* Update README.Debian.  (Closes: Bug#310634)
* libevent.so uses a different library naming scheme now.  We will
  preserve backwards compatiblity with Debian's, but also provide symlinks
  for the official libevent-1.1a.so name.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
#include <string.h>
43
43
#include <unistd.h>
44
44
#include <errno.h>
45
 
#include <err.h>
46
45
#ifdef HAVE_FCNTL_H
47
46
#include <fcntl.h>
48
47
#endif
49
48
 
50
 
#ifdef USE_LOG
51
 
#include "log.h"
52
 
#else
53
 
#define LOG_DBG(x)
54
 
#define log_error(x)    perror(x)
55
 
#endif
56
 
 
57
49
#include "event.h"
58
50
#include "evsignal.h"
 
51
#include "log.h"
59
52
 
60
53
extern struct event_list signalqueue;
61
54
 
63
56
static int needrecalc;
64
57
volatile sig_atomic_t evsignal_caught = 0;
65
58
 
66
 
void evsignal_process(void);
67
 
int evsignal_recalc(sigset_t *);
68
 
int evsignal_deliver(sigset_t *);
69
 
 
70
59
static struct event ev_signal;
71
60
static int ev_signal_pair[2];
72
61
static int ev_signal_added;
80
69
 
81
70
        n = read(fd, signals, sizeof(signals));
82
71
        if (n == -1)
83
 
                err(1, "%s: read", __func__);
 
72
                event_err(1, "%s: read", __func__);
84
73
        event_add(ev, NULL);
85
74
}
86
75
 
87
76
#ifdef HAVE_SETFD
88
77
#define FD_CLOSEONEXEC(x) do { \
89
78
        if (fcntl(x, F_SETFD, 1) == -1) \
90
 
                warn("fcntl(%d, F_SETFD)", x); \
 
79
                event_warn("fcntl(%d, F_SETFD)", x); \
91
80
} while (0)
92
81
#else
93
82
#define FD_CLOSEONEXEC(x)
104
93
         * signals that got delivered.
105
94
         */
106
95
        if (socketpair(AF_UNIX, SOCK_STREAM, 0, ev_signal_pair) == -1)
107
 
                err(1, "%s: socketpair", __func__);
 
96
                event_err(1, "%s: socketpair", __func__);
108
97
 
109
98
        FD_CLOSEONEXEC(ev_signal_pair[0]);
110
99
        FD_CLOSEONEXEC(ev_signal_pair[1]);
120
109
        int evsignal;
121
110
        
122
111
        if (ev->ev_events & (EV_READ|EV_WRITE))
123
 
                errx(1, "%s: EV_SIGNAL incompatible use", __func__);
 
112
                event_errx(1, "%s: EV_SIGNAL incompatible use", __func__);
124
113
        evsignal = EVENT_SIGNAL(ev);
125
114
        sigaddset(evsigmask, evsignal);
126
115