| 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_STROPTS_H__ |
| 24 |
#define __FC_STROPTS_H__ |
| 25 |
#include "features.h" |
| 26 |
__PUSH_FC_STDLIB |
| 27 |
__BEGIN_DECLS |
| 28 |
|
| 29 |
#include "__fc_define_uid_and_gid.h" |
| 30 |
#include "__fc_machdep.h" |
| 31 |
|
| 32 |
typedef __INT32_T t_scalar_t; |
| 33 |
typedef __UINT32_T t_uscalar_t; |
| 34 |
|
| 35 |
struct bandinfo { |
| 36 |
int bi_flag; |
| 37 |
unsigned char bi_pri; |
| 38 |
}; |
| 39 |
|
| 40 |
struct strbuf { |
| 41 |
char *buf; |
| 42 |
int len; |
| 43 |
int maxlen; |
| 44 |
}; |
| 45 |
|
| 46 |
struct strpeek { |
| 47 |
struct strbuf ctlbuf; |
| 48 |
struct strbuf databuf; |
| 49 |
t_uscalar_t flags; |
| 50 |
}; |
| 51 |
|
| 52 |
struct strfdinsert { |
| 53 |
struct strbuf ctlbuf; |
| 54 |
struct strbuf databuf; |
| 55 |
int fildes; |
| 56 |
t_uscalar_t flags; |
| 57 |
int offset; |
| 58 |
}; |
| 59 |
|
| 60 |
struct strioctl { |
| 61 |
int ic_cmd; |
| 62 |
char *ic_dp; |
| 63 |
int ic_len; |
| 64 |
int ic_timout; |
| 65 |
}; |
| 66 |
|
| 67 |
struct strrecvfd { |
| 68 |
int fd; |
| 69 |
gid_t gid; |
| 70 |
uid_t uid; |
| 71 |
}; |
| 72 |
|
| 73 |
#define FMNAMESZ 8 |
| 74 |
|
| 75 |
struct str_mlist { |
| 76 |
char l_name[FMNAMESZ+1]; |
| 77 |
}; |
| 78 |
|
| 79 |
struct str_list { |
| 80 |
struct str_mlist *sl_modlist; |
| 81 |
int sl_nmods; |
| 82 |
}; |
| 83 |
|
| 84 |
// The values for the constants below are based on those of the glibc, |
| 85 |
// declared in the order given by POSIX.1-2008. |
| 86 |
|
| 87 |
#define I_ATMARK (__SID |31) |
| 88 |
#define I_CANPUT (__SID |34) |
| 89 |
#define I_CKBAND (__SID |29) |
| 90 |
#define I_FDINSERT (__SID |16) |
| 91 |
#define I_FIND (__SID |11) |
| 92 |
#define I_FLUSH (__SID | 5) |
| 93 |
#define I_FLUSHBAND (__SID |28) |
| 94 |
#define I_FLUSHBAND (__SID |28) |
| 95 |
#define I_GETBAND (__SID |30) |
| 96 |
#define I_GETCLTIME (__SID |33) |
| 97 |
#define I_GETSIG (__SID |10) |
| 98 |
#define I_GRDOPT (__SID | 7) |
| 99 |
#define I_GWROPT (__SID |20) |
| 100 |
#define I_LINK (__SID |12) |
| 101 |
#define I_LIST (__SID |21) |
| 102 |
#define I_LOOK (__SID | 4) |
| 103 |
#define I_NREAD (__SID | 1) |
| 104 |
#define I_PEEK (__SID |15) |
| 105 |
#define I_PLINK (__SID |22) |
| 106 |
#define I_POP (__SID | 3) |
| 107 |
#define I_PUNLINK (__SID |23) |
| 108 |
#define I_PUSH (__SID | 2) |
| 109 |
#define I_RECVFD (__SID |14) |
| 110 |
#define I_SENDFD (__SID |17) |
| 111 |
#define I_SETCLTIME (__SID |32) |
| 112 |
#define I_SETSIG (__SID | 9) |
| 113 |
#define I_SRDOPT (__SID | 6) |
| 114 |
#define I_STR (__SID | 8) |
| 115 |
#define I_SWROPT (__SID |19) |
| 116 |
#define I_UNLINK (__SID |13) |
| 117 |
|
| 118 |
#define FLUSHR 0x01 |
| 119 |
#define FLUSHRW 0x03 |
| 120 |
#define FLUSHRW 0x03 |
| 121 |
#define FLUSHW 0x02 |
| 122 |
|
| 123 |
#define S_BANDURG 0x0200 |
| 124 |
#define S_ERROR 0x0010 |
| 125 |
#define S_HANGUP 0x0020 |
| 126 |
#define S_HIPRI 0x0002 |
| 127 |
#define S_INPUT 0x0001 |
| 128 |
#define S_MSG 0x0008 |
| 129 |
#define S_OUTPUT 0x0004 |
| 130 |
#define S_RDBAND 0x0080 |
| 131 |
#define S_RDNORM 0x0040 |
| 132 |
#define S_WRBAND 0x0100 |
| 133 |
#define S_WRNORM S_OUTPUT |
| 134 |
|
| 135 |
#define RS_HIPRI 0x01 |
| 136 |
|
| 137 |
#define RMSGD 0x0001 |
| 138 |
#define RMSGN 0x0002 |
| 139 |
#define RNORM 0x0000 |
| 140 |
#define RPROTDAT 0x0004 |
| 141 |
#define RPROTDIS 0x0008 |
| 142 |
#define RPROTNORM 0x0010 |
| 143 |
|
| 144 |
#define SNDZERO 0x001 |
| 145 |
|
| 146 |
#define ANYMARK 0x01 |
| 147 |
#define LASTMARK 0x02 |
| 148 |
|
| 149 |
#define MUXID_ALL (-1) |
| 150 |
|
| 151 |
#define MORECTL 1 |
| 152 |
#define MOREDATA 2 |
| 153 |
#define MSG_ANY 0x02 |
| 154 |
#define MSG_BAND 0x04 |
| 155 |
#define MSG_HIPRI 0x01 |
| 156 |
|
| 157 |
extern int fattach(int, const char *); |
| 158 |
extern int fdetach(const char *); |
| 159 |
extern int getmsg(int, struct strbuf *restrict, struct strbuf *restrict, |
| 160 |
int *restrict); |
| 161 |
extern int getpmsg(int, struct strbuf *restrict, struct strbuf *restrict, |
| 162 |
int *restrict, int *restrict); |
| 163 |
|
| 164 |
extern int ioctl(int, int, ...); |
| 165 |
|
| 166 |
// for Variadic |
| 167 |
/*@ assigns \result \from indirect:fd, indirect:request; */ |
| 168 |
extern int __va_ioctl_void(int fd, int request); |
| 169 |
|
| 170 |
/*@ assigns \result \from indirect:fd, indirect:request, indirect:arg; */ |
| 171 |
extern int __va_ioctl_int(int fd, int request, int arg); |
| 172 |
|
| 173 |
/*@ assigns \result \from indirect:fd, indirect:request, |
| 174 |
indirect:((char*)argp)[0..]; |
| 175 |
assigns ((char*)argp)[0..] \from |
| 176 |
indirect:fd, indirect:request, ((char*)argp)[0..]; */ |
| 177 |
extern int __va_ioctl_ptr(int fd, int request, void* argp); |
| 178 |
|
| 179 |
extern int isastream(int); |
| 180 |
extern int putmsg(int, const struct strbuf *, const struct strbuf *, int); |
| 181 |
extern int putpmsg(int, const struct strbuf *, const struct strbuf *, int, |
| 182 |
int); |
| 183 |
|
| 184 |
__END_DECLS |
| 185 |
__POP_FC_STDLIB |
| 186 |
#endif |