32 # include <sys/eventfd.h> 42 int fd = eventfd(0, EFD_NONBLOCK | EFD_SEMAPHORE);
44 alert_pipe[0] = alert_pipe[1] = fd;
48 ast_log(
LOG_WARNING,
"Failed to create alert pipe with eventfd(), falling back to pipe(): %s\n",
56 if (pipe2(alert_pipe, O_NONBLOCK)) {
63 if (pipe(alert_pipe)) {
83 if (alert_pipe[0] == alert_pipe[1]) {
84 if (alert_pipe[0] > -1) {
93 if (alert_pipe[0] > -1) {
96 if (alert_pipe[1] > -1) {
110 if (read(alert_pipe[0], &tmp,
sizeof(tmp)) < 0) {
131 return write(alert_pipe[1], &tmp,
sizeof(tmp)) !=
sizeof(
tmp);
145 bytes_read = read(alert_pipe[0], tmp,
sizeof(tmp));
146 if (bytes_read < 0) {
147 if (
errno == EINTR) {
150 if (
errno == EAGAIN ||
errno == EWOULDBLOCK) {
Asterisk main include file. File version handling, generic pbx functions.
void ast_alertpipe_close(int alert_pipe[2])
Close an alert pipe.
int ast_alertpipe_readable(int alert_pipe[2])
Determine if the alert pipe is readable.
void ast_alertpipe_clear(int alert_pipe[2])
Sets the alert pipe file descriptors to default values.
#define ast_fd_set_flags(fd, flags)
Set flags on the given file descriptor.
int ast_alertpipe_writable(int alert_pipe[2])
Determine if the alert pipe is writable.
ast_alert_status_t ast_alertpipe_read(int alert_pipe[2])
Read an event from an alert pipe.
int ast_alertpipe_init(int alert_pipe[2])
Initialize an alert pipe.
Support for logging to various files, console and syslog Configuration in file logger.conf.
ast_alert_status_t ast_alertpipe_flush(int alert_pipe[2])
Consume all alerts written to the alert pipe.
ssize_t ast_alertpipe_write(int alert_pipe[2])
Write an event to an alert pipe.