Debian Codegraph @

share/libc/sys/uio.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_UIO
24 #define FC_UIO
25
26 #include "../features.h"
27 __PUSH_FC_STDLIB
28 #include "../__fc_define_ssize_t.h"
29 #include "../__fc_define_size_t.h"
30 #include "../__fc_define_iovec.h"
31 #include "../__fc_define_fds.h"
32 #include "../limits.h"
33
34 __BEGIN_DECLS
35
36
37
38 /*@
39 requires valid_fd: 0 <= fd < __FC_MAX_OPEN_FILES;
40 requires initialization:initialized_inputs:
41 \forall integer i; 0 <= i < iovcnt ==>
42 \initialized(&iov[i].iov_base) && \initialized(&iov[i].iov_len);
43 requires valid_iov: \forall integer i; 0 <= i < iovcnt ==>
44 \valid( ((char*)&iov[i].iov_base)+(0 .. iov[i].iov_len-1));
45 requires bounded_iovcnt: 0 <= iovcnt <= IOV_MAX;
46 assigns { ((char*)iov[i].iov_base)[j] |
47 integer i, j; 0 <= i < iovcnt && 0 <= j < iov[i].iov_len }
48 \from indirect:fd, indirect:iovcnt, indirect:__fc_fds[fd];
49 assigns \result \from indirect:fd, indirect:__fc_fds[fd], indirect:iov[0 ..],
50 indirect:iovcnt;
51 ensures result_error_or_read_bytes: \result == -1 ||
52 0 <= \result <= \sum(0,iovcnt-1, \lambda integer k; iov[k].iov_len);
53 */
54 extern ssize_t readv(int fd, const struct iovec *iov, int iovcnt);
55
56 /*@
57 requires valid_fd: 0 <= fd < __FC_MAX_OPEN_FILES;
58 requires initialization:initialized_inputs:
59 \forall integer i; 0 <= i < iovcnt ==>
60 \initialized(&iov[i].iov_base) && \initialized(&iov[i].iov_len);
61 requires valid_read_iov: \valid_read(&iov[0 .. iovcnt-1]);
62 requires valid_read_iov_bases:
63 \forall integer i; 0 <= i < iovcnt ==>
64 \valid_read(((char*)iov[i].iov_base) + (0 .. iov[i].iov_len-1));
65 requires bounded_iovcnt: 0 <= iovcnt <= IOV_MAX;
66 requires bounded_lengths:
67 \sum(0, iovcnt-1, \lambda integer k; iov[k].iov_len) <= SSIZE_MAX;
68 assigns \result \from indirect:fd, indirect:__fc_fds[fd], indirect:iov[0 ..],
69 indirect:iovcnt;
70 assigns __fc_fds[fd] \from indirect:iov[0 ..], indirect:iovcnt;
71 ensures result_error_or_written_bytes: \result == -1 ||
72 0 <= \result <= \sum(0, iovcnt-1, \lambda integer k; iov[k].iov_len);
73 */
74 extern ssize_t writev(int fd, const struct iovec *iov, int iovcnt);
75
76 __END_DECLS
77 __POP_FC_STDLIB
78 #endif