Blame view

include/linux/eventfd.h 2.05 KB
e1ad7468c   Davide Libenzi   signal/timer/even...
1
2
3
4
5
6
7
8
9
  /*
   *  include/linux/eventfd.h
   *
   *  Copyright (C) 2007  Davide Libenzi <davidel@xmailserver.org>
   *
   */
  
  #ifndef _LINUX_EVENTFD_H
  #define _LINUX_EVENTFD_H
b087498eb   Ulrich Drepper   flag parameters: ...
10
  #include <linux/fcntl.h>
133890103   Davide Libenzi   eventfd: revised ...
11
  #include <linux/file.h>
cb289d624   Davide Libenzi   eventfd - allow a...
12
  #include <linux/wait.h>
b087498eb   Ulrich Drepper   flag parameters: ...
13

bcd0b235b   Davide Libenzi   eventfd: improve ...
14
15
16
17
18
19
20
21
  /*
   * CAREFUL: Check include/asm-generic/fcntl.h when defining
   * new flags, since they might collide with O_* ones. We want
   * to re-use O_* flags that couldn't possibly have a meaning
   * from eventfd, in order to leave a free define-space for
   * shared O_* flags.
   */
  #define EFD_SEMAPHORE (1 << 0)
b087498eb   Ulrich Drepper   flag parameters: ...
22
  #define EFD_CLOEXEC O_CLOEXEC
e7d476dfd   Ulrich Drepper   flag parameters: ...
23
  #define EFD_NONBLOCK O_NONBLOCK
b087498eb   Ulrich Drepper   flag parameters: ...
24

bcd0b235b   Davide Libenzi   eventfd: improve ...
25
26
  #define EFD_SHARED_FCNTL_FLAGS (O_CLOEXEC | O_NONBLOCK)
  #define EFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS | EFD_SEMAPHORE)
133890103   Davide Libenzi   eventfd: revised ...
27
  #ifdef CONFIG_EVENTFD
562787a5c   Davide Libenzi   anonfd: split int...
28
  struct file *eventfd_file_create(unsigned int count, int flags);
133890103   Davide Libenzi   eventfd: revised ...
29
30
  struct eventfd_ctx *eventfd_ctx_get(struct eventfd_ctx *ctx);
  void eventfd_ctx_put(struct eventfd_ctx *ctx);
e1ad7468c   Davide Libenzi   signal/timer/even...
31
  struct file *eventfd_fget(int fd);
133890103   Davide Libenzi   eventfd: revised ...
32
33
34
  struct eventfd_ctx *eventfd_ctx_fdget(int fd);
  struct eventfd_ctx *eventfd_ctx_fileget(struct file *file);
  int eventfd_signal(struct eventfd_ctx *ctx, int n);
cb289d624   Davide Libenzi   eventfd - allow a...
35
36
37
  ssize_t eventfd_ctx_read(struct eventfd_ctx *ctx, int no_wait, __u64 *cnt);
  int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_t *wait,
  				  __u64 *cnt);
e1ad7468c   Davide Libenzi   signal/timer/even...
38
39
  
  #else /* CONFIG_EVENTFD */
133890103   Davide Libenzi   eventfd: revised ...
40
41
42
43
  /*
   * Ugly ugly ugly error layer to support modules that uses eventfd but
   * pretend to work in !CONFIG_EVENTFD configurations. Namely, AIO.
   */
562787a5c   Davide Libenzi   anonfd: split int...
44
45
46
47
  static inline struct file *eventfd_file_create(unsigned int count, int flags)
  {
  	return ERR_PTR(-ENOSYS);
  }
133890103   Davide Libenzi   eventfd: revised ...
48
49
50
51
52
53
54
55
56
57
58
59
60
61
  static inline struct eventfd_ctx *eventfd_ctx_fdget(int fd)
  {
  	return ERR_PTR(-ENOSYS);
  }
  
  static inline int eventfd_signal(struct eventfd_ctx *ctx, int n)
  {
  	return -ENOSYS;
  }
  
  static inline void eventfd_ctx_put(struct eventfd_ctx *ctx)
  {
  
  }
e1ad7468c   Davide Libenzi   signal/timer/even...
62

cb289d624   Davide Libenzi   eventfd - allow a...
63
64
65
66
67
68
69
70
71
72
73
  static inline ssize_t eventfd_ctx_read(struct eventfd_ctx *ctx, int no_wait,
  				       __u64 *cnt)
  {
  	return -ENOSYS;
  }
  
  static inline int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx,
  						wait_queue_t *wait, __u64 *cnt)
  {
  	return -ENOSYS;
  }
133890103   Davide Libenzi   eventfd: revised ...
74
  #endif
e1ad7468c   Davide Libenzi   signal/timer/even...
75

e1ad7468c   Davide Libenzi   signal/timer/even...
76
  #endif /* _LINUX_EVENTFD_H */