Debian Codegraph @

share/libc/poll.h

raw
1 /**************************************************************************/
2 /* */
3 /* This file is part of Frama-C. */
4 /* */
5 /* Copyright (C) 2007-2022 */
6 /* CEA (Commissariat à l'énergie atomique et aux énergies */
7 /* alternatives) */
8 /* */
9 /* you can redistribute it and/or modify it under the terms of the GNU */
10 /* Lesser General Public License as published by the Free Software */
11 /* Foundation, version 2.1. */
12 /* */
13 /* It is distributed in the hope that it will be useful, */
14 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
15 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
16 /* GNU Lesser General Public License for more details. */
17 /* */
18 /* See the GNU Lesser General Public License version 2.1 */
19 /* for more details (enclosed in the file licenses/LGPLv2.1). */
20 /* */
21 /**************************************************************************/
22
23 #ifndef __FC_POLL
24 #define __FC_POLL
25 #include "features.h"
26 __PUSH_FC_STDLIB
27
28 __BEGIN_DECLS
29
30 struct pollfd {
31 int fd; // input parameter in poll()
32 short events; // input parameter in poll()
33 short revents; // output parameter in poll()
34 };
35
36 typedef unsigned long nfds_t;
37
38 extern volatile int Frama_C_entropy_source;
39
40 // The values used below are based on Linux.
41 #define POLLIN 0x001
42 #define POLLPRI 0x002
43 #define POLLOUT 0x004
44 #define POLLERR 0x008
45 #define POLLHUP 0x010
46 #define POLLNVAL 0x020
47 #define POLLRDNORM 0x040
48 #define POLLRDBAND 0x080
49 #define POLLWRNORM 0x100
50 #define POLLWRBAND 0x200
51
52 /*@
53 requires valid_file_descriptors: \valid(fds+(0 .. nfds-1));
54 assigns fds[0 .. nfds-1].revents \from indirect:fds[0 .. nfds-1].fd,
55 fds[0 .. nfds-1].events,
56 indirect:nfds, indirect:timeout,
57 indirect:Frama_C_entropy_source;
58 assigns \result \from indirect:fds[0 .. nfds-1].fd,
59 indirect:fds[0 .. nfds-1].events,
60 indirect:nfds, indirect:timeout,
61 indirect:Frama_C_entropy_source;
62 ensures error_timeout_or_bounded:
63 \result == -1 || \result == 0 || 1 <= \result <= nfds;
64 ensures initialization:revents: \initialized(&fds[0 .. nfds-1].revents);
65 */
66 extern int poll (struct pollfd *fds, nfds_t nfds, int timeout);
67
68 __END_DECLS
69
70 __POP_FC_STDLIB
71 #endif