| 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_SELECT__ |
| 24 |
#define __FC_SELECT__ |
| 25 |
#include "features.h" |
| 26 |
__PUSH_FC_STDLIB |
| 27 |
#include "__fc_define_fd_set_t.h" |
| 28 |
#include "__fc_define_sigset_t.h" |
| 29 |
#include "__fc_define_suseconds_t.h" |
| 30 |
#include "__fc_define_timeval.h" |
| 31 |
#include "__fc_define_timespec.h" |
| 32 |
__BEGIN_DECLS |
| 33 |
|
| 34 |
/* assigns \result \from nfds, *readfds, *writefds,*errorfds,*timeout,*sigmask; |
| 35 |
*/ |
| 36 |
extern int pselect(int nfds, fd_set * readfds, |
| 37 |
fd_set * writefds, fd_set * errorfds, |
| 38 |
const struct timespec * timeout, |
| 39 |
const sigset_t * sigmask); |
| 40 |
|
| 41 |
// __fc_fds_state is a very coarse model for the state of all |
| 42 |
// file descriptor sets; it is sound, but very imprecise. |
| 43 |
//@ ghost volatile int __fc_fds_state; |
| 44 |
|
| 45 |
/*@ |
| 46 |
requires nfds: nfds >= 0; |
| 47 |
requires readfs: readfds == \null || \valid(readfds); |
| 48 |
requires writefds: writefds == \null || \valid(writefds); |
| 49 |
requires errorfds: errorfds == \null || \valid(errorfds); |
| 50 |
requires timeout: timeout == \null || \valid(timeout); |
| 51 |
assigns __fc_fds_state \from __fc_fds_state; |
| 52 |
assigns *readfds, *writefds, *errorfds, *timeout, \result |
| 53 |
\from indirect:nfds, |
| 54 |
indirect:readfds, indirect:*readfds, |
| 55 |
indirect:writefds, indirect:*writefds, |
| 56 |
indirect:errorfds, indirect:*errorfds, |
| 57 |
indirect:timeout, indirect:*timeout, |
| 58 |
__fc_fds_state; |
| 59 |
behavior read_notnull: |
| 60 |
assumes readfds_is_not_null: readfds != \null; |
| 61 |
ensures initialization:readfds: \initialized(readfds); |
| 62 |
behavior write_notnull: |
| 63 |
assumes writefds_is_not_null: writefds != \null; |
| 64 |
ensures initialization:writefds: \initialized(writefds); |
| 65 |
behavior error_notnull: |
| 66 |
assumes errorfds_is_not_null: errorfds != \null; |
| 67 |
ensures initialization:errorfds: \initialized(errorfds); |
| 68 |
behavior timeout_notnull: |
| 69 |
assumes timeout_is_not_null: timeout != \null; |
| 70 |
ensures initialization:timeout: \initialized(timeout); |
| 71 |
*/ |
| 72 |
extern int select(int nfds, fd_set * readfds, |
| 73 |
fd_set * writefds, fd_set * errorfds, |
| 74 |
struct timeval * timeout); |
| 75 |
|
| 76 |
__END_DECLS |
| 77 |
|
| 78 |
__POP_FC_STDLIB |
| 79 |
#endif |