2 * include/linux/eventfd.h
4 * Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org>
8 #ifndef _LINUX_EVENTFD_H
9 #define _LINUX_EVENTFD_H
13 /* For O_CLOEXEC and O_NONBLOCK */
14 #include <linux/fcntl.h>
17 * CAREFUL: Check include/asm-generic/fcntl.h when defining
18 * new flags, since they might collide with O_* ones. We want
19 * to re-use O_* flags that couldn't possibly have a meaning
20 * from eventfd, in order to leave a free define-space for
23 #define EFD_SEMAPHORE (1 << 0)
24 #define EFD_CLOEXEC O_CLOEXEC
25 #define EFD_NONBLOCK O_NONBLOCK
27 #define EFD_SHARED_FCNTL_FLAGS (O_CLOEXEC | O_NONBLOCK)
28 #define EFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS | EFD_SEMAPHORE)
30 struct file
*eventfd_fget(int fd
);
31 int eventfd_signal(struct file
*file
, int n
);
33 #else /* CONFIG_EVENTFD */
35 #define eventfd_fget(fd) ERR_PTR(-ENOSYS)
36 static inline int eventfd_signal(struct file
*file
, int n
)
39 #endif /* CONFIG_EVENTFD */
41 #endif /* _LINUX_EVENTFD_H */