| 1 |
|
| #define PERL_EXT_POSIX_1003 |
| 2 |
|
| |
| 3 |
|
| #include "EXTERN.h" |
| 4 |
|
| |
| 5 |
|
| /* We need our hands on the pure config, because CORE/perl.h makes |
| 6 |
|
| some "smart" changes :( |
| 7 |
|
| |
| 8 |
|
| For now, we believe CORE/config.h for the following variables: |
| 9 |
|
| I_UNISTD |
| 10 |
|
| I_FCNTL |
| 11 |
|
| I_POLL |
| 12 |
|
| I_SYS_POLL |
| 13 |
|
| I_SYS_RESOURCE |
| 14 |
|
| I_ULIMIT |
| 15 |
|
| I_SOCKET |
| 16 |
|
| |
| 17 |
|
| HAS_FCNTL |
| 18 |
|
| HAS_SETEUID |
| 19 |
|
| HAS_SETREUID |
| 20 |
|
| HAS_SETREGID |
| 21 |
|
| HAS_SETRESGID |
| 22 |
|
| HAS_SETRESUID |
| 23 |
|
| HAS_GETGROUPS |
| 24 |
|
| HAS_SETGROUPS |
| 25 |
|
| HAS_POLL |
| 26 |
|
| HAS_STRERROR |
| 27 |
|
| */ |
| 28 |
|
| |
| 29 |
|
| #ifdef PERL_MICRO |
| 30 |
|
| # include "uconfig.h" |
| 31 |
|
| #elif USE_CROSS_COMPILE |
| 32 |
|
| # include "xconfig.h" |
| 33 |
|
| #else |
| 34 |
|
| # include "config.h" |
| 35 |
|
| #endif |
| 36 |
|
| |
| 37 |
|
| /* Get Perl's smartness |
| 38 |
|
| |
| 39 |
|
| We like only to provide setre[ug]id when it is pure, not a rewrite |
| 40 |
|
| to getres[ug]id. There are too many system dependencies/bug etc |
| 41 |
|
| in these library functions to cover it up. |
| 42 |
|
| */ |
| 43 |
|
| |
| 44 |
|
| #ifdef HAS_SETREUID |
| 45 |
|
| #define _HAS_SETREUID |
| 46 |
|
| #endif |
| 47 |
|
| |
| 48 |
|
| #ifdef HAS_SETREGID |
| 49 |
|
| #define _HAS_SETREGID |
| 50 |
|
| #endif |
| 51 |
|
| |
| 52 |
|
| #include "perl.h" |
| 53 |
|
| |
| 54 |
|
| #ifdef _HAS_SETREUID |
| 55 |
|
| #undef _HAS_SETREUID |
| 56 |
|
| #undef HAS_SETREUID |
| 57 |
|
| #endif |
| 58 |
|
| |
| 59 |
|
| #ifdef _HAS_SETREGID |
| 60 |
|
| #undef _HAS_SETREGID |
| 61 |
|
| #undef HAS_SETREGID |
| 62 |
|
| #endif |
| 63 |
|
| |
| 64 |
|
| /* Now some Perl-guts |
| 65 |
|
| */ |
| 66 |
|
| |
| 67 |
|
| #include "XSUB.h" |
| 68 |
|
| |
| 69 |
|
| /* My own extensions |
| 70 |
|
| Overrule via files in the "system" sub-directory of this distribution. |
| 71 |
|
| */ |
| 72 |
|
| |
| 73 |
|
| #include <sys/types.h> |
| 74 |
|
| |
| 75 |
|
| #ifndef HAS_CONFSTR |
| 76 |
|
| #define HAS_CONFSTR |
| 77 |
|
| #endif |
| 78 |
|
| |
| 79 |
|
| #ifndef HAS_ULIMIT |
| 80 |
|
| #define HAS_ULIMIT |
| 81 |
|
| #endif |
| 82 |
|
| |
| 83 |
|
| #ifndef HAS_RLIMIT |
| 84 |
|
| #define HAS_RLIMIT |
| 85 |
|
| #endif |
| 86 |
|
| |
| 87 |
|
| #ifndef HAS_MKNOD |
| 88 |
|
| #define HAS_MKNOD |
| 89 |
|
| #endif |
| 90 |
|
| |
| 91 |
|
| #ifndef HAS_STRSIGNAL |
| 92 |
|
| #define HAS_STRSIGNAL |
| 93 |
|
| #endif |
| 94 |
|
| |
| 95 |
|
| #ifndef HAS_SETUID |
| 96 |
|
| #define HAS_SETUID |
| 97 |
|
| #endif |
| 98 |
|
| |
| 99 |
|
| #ifndef CACHE_UID |
| 100 |
|
| #if PERL_VERSION < 15 || PERL_VERSION == 15 && PERL_SUBVERSION < 8 |
| 101 |
|
| #define CACHE_UID |
| 102 |
|
| #endif |
| 103 |
|
| #endif |
| 104 |
|
| |
| 105 |
|
| #ifdef HAS_FCNTL |
| 106 |
|
| # ifndef HAS_FCNTL_OWN_EX |
| 107 |
|
| # define HAS_FCNTL_OWN_EX |
| 108 |
|
| # endif |
| 109 |
|
| #endif |
| 110 |
|
| |
| 111 |
|
| #ifndef HAS_FLOCK |
| 112 |
|
| #define HAS_FLOCK |
| 113 |
|
| #endif |
| 114 |
|
| |
| 115 |
|
| #ifndef HAS_LOCKF |
| 116 |
|
| #define HAS_LOCKF |
| 117 |
|
| #endif |
| 118 |
|
| |
| 119 |
|
| #ifndef HAS_FTRUNCATE |
| 120 |
|
| #define HAS_FTRUNCATE |
| 121 |
|
| #endif |
| 122 |
|
| |
| 123 |
|
| #ifndef HAS_GLOB |
| 124 |
|
| #define HAS_GLOB |
| 125 |
|
| #endif |
| 126 |
|
| |
| 127 |
|
| #ifndef HAS_WORDEXP |
| 128 |
|
| #define HAS_WORDEXP |
| 129 |
|
| #endif |
| 130 |
|
| |
| 131 |
|
| #ifndef HAS_FNMATCH |
| 132 |
|
| #define HAS_FNMATCH |
| 133 |
|
| #endif |
| 134 |
|
| |
| 135 |
|
| #ifndef I_SYS_WAIT |
| 136 |
|
| #define I_SYS_WAIT |
| 137 |
|
| #endif |
| 138 |
|
| |
| 139 |
|
| #ifdef I_UNISTD |
| 140 |
|
| # ifndef HAS_GETPID |
| 141 |
|
| # define HAS_GETPID |
| 142 |
|
| # endif |
| 143 |
|
| |
| 144 |
|
| # ifndef HAS_GETPPID |
| 145 |
|
| # define HAS_GETPPID |
| 146 |
|
| # endif |
| 147 |
|
| #endif |
| 148 |
|
| |
| 149 |
|
| #ifdef I_TIME |
| 150 |
|
| |
| 151 |
|
| # ifndef HAS_STRPTIME |
| 152 |
|
| # define HAS_STRPTIME |
| 153 |
|
| # endif |
| 154 |
|
| |
| 155 |
|
| # ifndef HAS_MKTIME |
| 156 |
|
| # define HAS_MKTIME |
| 157 |
|
| # endif |
| 158 |
|
| |
| 159 |
|
| #endif |
| 160 |
|
| |
| 161 |
|
| #define I_TIME |
| 162 |
|
| #define I_RESOURCE |
| 163 |
|
| #define I_SYS_RESOURCE |
| 164 |
|
| #define I_GRP |
| 165 |
|
| |
| 166 |
|
| /* |
| 167 |
|
| * work-arounds for various operating systems |
| 168 |
|
| */ |
| 169 |
|
| |
| 170 |
|
| #include "system.c" |
| 171 |
|
| |
| 172 |
|
| #ifdef I_UNISTD |
| 173 |
|
| #include <unistd.h> |
| 174 |
|
| #endif |
| 175 |
|
| |
| 176 |
|
| #ifdef I_FCNTL |
| 177 |
|
| #include <fcntl.h> |
| 178 |
|
| #endif |
| 179 |
|
| |
| 180 |
|
| #ifdef I_SOCKET |
| 181 |
|
| #include <fcntl.h> |
| 182 |
|
| #endif |
| 183 |
|
| |
| 184 |
|
| #ifdef HAS_ULIMIT |
| 185 |
|
| # ifndef I_ULIMIT |
| 186 |
|
| # define I_ULIMIT |
| 187 |
|
| # endif |
| 188 |
|
| # include <ulimit.h> |
| 189 |
|
| #endif |
| 190 |
|
| |
| 191 |
|
| #ifdef I_SYS_RESOURCE |
| 192 |
|
| #include <sys/resource.h> |
| 193 |
|
| #endif |
| 194 |
|
| |
| 195 |
|
| #ifdef I_POLL |
| 196 |
|
| #include <poll.h> |
| 197 |
|
| #else |
| 198 |
|
| #ifdef I_SYS_POLL |
| 199 |
|
| #include <sys/poll.h> |
| 200 |
|
| #endif |
| 201 |
|
| #endif |
| 202 |
|
| |
| 203 |
|
| #ifdef I_SYS_WAIT |
| 204 |
|
| #include <sys/wait.h> |
| 205 |
|
| #endif |
| 206 |
|
| |
| 207 |
|
| #ifdef I_TIME |
| 208 |
|
| #include <time.h> |
| 209 |
|
| #endif |
| 210 |
|
| |
| 211 |
|
| #ifdef I_GRP |
| 212 |
|
| #include <grp.h> |
| 213 |
|
| #endif |
| 214 |
|
| |
| 215 |
|
| #ifdef HAS_GLOB |
| 216 |
|
| #include <glob.h> |
| 217 |
|
| |
| 218 |
|
| /*!!! NOT thread safe... no closures in C :-( */ |
| 219 |
|
| static SV * _glob_call; |
| 220 |
|
| |
| 221 |
1 |
| static int _glob_on_error(epath, eerrno) |
| 222 |
|
| const char * epath; |
| 223 |
|
| int eerrno; |
| 224 |
|
| { // See man perlcall |
| 225 |
1 |
| dSP; |
| 226 |
1 |
| int stop = 0; |
| 227 |
|
| int count; |
| 228 |
|
| |
| 229 |
1 |
| ENTER; |
| 230 |
1 |
| SAVETMPS; |
| 231 |
|
| |
| 232 |
1 |
▶ | PUSHMARK(SP); |
Branch: 1 branch
| Branch | True | False | Total |
| PUSHMARK(SP); |
0 |
1 |
1 |
|
| 233 |
1 |
▶ | XPUSHs(sv_2mortal(newSVpv(epath, 0))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVpv(epath, 0))); |
0 |
1 |
1 |
|
| 234 |
1 |
▶ | XPUSHs(sv_2mortal(newSViv(eerrno))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSViv(eerrno))); |
0 |
1 |
1 |
|
| 235 |
1 |
| PUTBACK; |
| 236 |
|
| |
| 237 |
1 |
| count = call_sv(_glob_call, G_SCALAR); |
| 238 |
|
| |
| 239 |
1 |
| SPAGAIN; |
| 240 |
|
| |
| 241 |
1 |
▶ | if(count) stop = POPi; |
Branch: 1 branch
| Branch | True | False | Total |
| if(count) stop = POPi; |
1 |
0 |
1 |
|
| 242 |
|
| |
| 243 |
1 |
| PUTBACK; |
| 244 |
1 |
▶ | FREETMPS; |
Branch: 1 branch
| Branch | True | False | Total |
| FREETMPS; |
1 |
0 |
1 |
|
| 245 |
1 |
| LEAVE; |
| 246 |
|
| |
| 247 |
1 |
| return stop; |
| 248 |
|
| } |
| 249 |
|
| |
| 250 |
|
| #endif |
| 251 |
|
| |
| 252 |
|
| #define I_SIGNAL |
| 253 |
|
| #ifdef I_SIGNAL |
| 254 |
|
| #include <signal.h> |
| 255 |
|
| #endif |
| 256 |
|
| |
| 257 |
|
| #ifdef HAS_FNMATCH |
| 258 |
|
| #include <fnmatch.h> |
| 259 |
|
| #endif |
| 260 |
|
| |
| 261 |
|
| /* |
| 262 |
|
| * For missing |
| 263 |
|
| */ |
| 264 |
|
| |
| 265 |
|
| #ifndef __COMPAR_FN_T |
| 266 |
|
| # define __COMPAR_FN_T |
| 267 |
|
| typedef int (*__compar_fn_t) (__const void *, __const void *); |
| 268 |
|
| #endif |
| 269 |
|
| |
| 270 |
|
| char * missing[10000]; |
| 271 |
|
| unsigned int nr_missing = 0; |
| 272 |
|
| bool missing_is_sorted = 0; |
| 273 |
|
| |
| 274 |
|
| static int |
| 275 |
16260 |
| strptr_cmp(const void *p1, const void *p2) |
| 276 |
|
| { /* passed in are char **'s */ |
| 277 |
16260 |
| return strcmp(* (char * const *) p1, * (char * const *) p2); |
| 278 |
|
| } |
| 279 |
|
| |
| 280 |
|
| static int |
| 281 |
2606 |
| strptr2_cmp(const void *p1, const void *p2) |
| 282 |
|
| { /* only second passed in are char **'s */ |
| 283 |
2606 |
| return strcmp(p1, * (char * const *) p2); |
| 284 |
|
| } |
| 285 |
|
| |
| 286 |
|
| /* MO: openbsd has no limits, but I am lazy */ |
| 287 |
|
| #ifdef NGROUPS_MAX |
| 288 |
|
| # define _NGROUPS NGROUPS_MAX |
| 289 |
|
| #else |
| 290 |
|
| # define _NGROUPS 2048 |
| 291 |
|
| #endif |
| 292 |
|
| |
| 293 |
|
| /* |
| 294 |
|
| * Fill tables |
| 295 |
|
| */ |
| 296 |
|
| |
| 297 |
|
| HV * sc_table = NULL; |
| 298 |
|
| HV * |
| 299 |
5 |
| fill_sysconf() |
| 300 |
5 |
▶ | { if(sc_table) return sc_table; |
Branch: 1 branch
| Branch | True | False | Total |
| { if(sc_table) return sc_table; |
0 |
5 |
5 |
|
| 301 |
|
| |
| 302 |
5 |
| sc_table = newHV(); |
| 303 |
|
| #include "sysconf.c" |
| 304 |
5 |
| return sc_table; |
| 305 |
|
| } |
| 306 |
|
| |
| 307 |
|
| HV * cs_table = NULL; |
| 308 |
|
| HV * |
| 309 |
5 |
| fill_confstr() |
| 310 |
5 |
▶ | { if(cs_table) return cs_table; |
Branch: 1 branch
| Branch | True | False | Total |
| { if(cs_table) return cs_table; |
0 |
5 |
5 |
|
| 311 |
|
| |
| 312 |
5 |
| cs_table = newHV(); |
| 313 |
|
| #include "confstr.c" |
| 314 |
5 |
| return cs_table; |
| 315 |
|
| } |
| 316 |
|
| |
| 317 |
|
| HV * pc_table = NULL; |
| 318 |
|
| HV * |
| 319 |
5 |
| fill_pathconf() |
| 320 |
5 |
▶ | { if(pc_table) return pc_table; |
Branch: 1 branch
| Branch | True | False | Total |
| { if(pc_table) return pc_table; |
0 |
5 |
5 |
|
| 321 |
|
| |
| 322 |
5 |
| pc_table = newHV(); |
| 323 |
|
| #include "pathconf.c" |
| 324 |
5 |
| return pc_table; |
| 325 |
|
| } |
| 326 |
|
| |
| 327 |
|
| HV * sig_table = NULL; |
| 328 |
|
| HV * |
| 329 |
6 |
| fill_signals() |
| 330 |
6 |
▶ | { if(sig_table) return sig_table; |
Branch: 1 branch
| Branch | True | False | Total |
| { if(sig_table) return sig_table; |
0 |
6 |
6 |
|
| 331 |
|
| |
| 332 |
6 |
| sig_table = newHV(); |
| 333 |
|
| #include "signals.c" |
| 334 |
6 |
| return sig_table; |
| 335 |
|
| } |
| 336 |
|
| |
| 337 |
|
| HV * pr_table = NULL; |
| 338 |
|
| HV * |
| 339 |
5 |
| fill_properties() |
| 340 |
5 |
▶ | { if(pr_table) return pr_table; |
Branch: 1 branch
| Branch | True | False | Total |
| { if(pr_table) return pr_table; |
0 |
5 |
5 |
|
| 341 |
|
| |
| 342 |
5 |
| pr_table = newHV(); |
| 343 |
|
| #include "properties.c" |
| 344 |
5 |
| return pr_table; |
| 345 |
|
| } |
| 346 |
|
| |
| 347 |
|
| HV * fdio_table = NULL; |
| 348 |
|
| HV * |
| 349 |
8 |
| fill_fdio() |
| 350 |
8 |
▶ | { if(fdio_table) return fdio_table; |
Branch: 1 branch
| Branch | True | False | Total |
| { if(fdio_table) return fdio_table; |
0 |
8 |
8 |
|
| 351 |
|
| |
| 352 |
8 |
| fdio_table = newHV(); |
| 353 |
|
| #include "fdio.c" |
| 354 |
8 |
| return fdio_table; |
| 355 |
|
| } |
| 356 |
|
| |
| 357 |
|
| HV * fcntl_table = NULL; |
| 358 |
|
| HV * |
| 359 |
6 |
| fill_fcntl() |
| 360 |
6 |
▶ | { if(fcntl_table) return fcntl_table; |
Branch: 1 branch
| Branch | True | False | Total |
| { if(fcntl_table) return fcntl_table; |
0 |
6 |
6 |
|
| 361 |
|
| |
| 362 |
6 |
| fcntl_table = newHV(); |
| 363 |
|
| #include "fcntl.c" |
| 364 |
6 |
| return fcntl_table; |
| 365 |
|
| } |
| 366 |
|
| |
| 367 |
|
| HV * fsys_table = NULL; |
| 368 |
|
| HV * |
| 369 |
7 |
| fill_fsys() |
| 370 |
7 |
▶ | { if(fsys_table) return fsys_table; |
Branch: 1 branch
| Branch | True | False | Total |
| { if(fsys_table) return fsys_table; |
0 |
7 |
7 |
|
| 371 |
|
| |
| 372 |
7 |
| fsys_table = newHV(); |
| 373 |
|
| #include "fsys.c" |
| 374 |
7 |
| return fsys_table; |
| 375 |
|
| } |
| 376 |
|
| |
| 377 |
|
| HV * ul_table = NULL; |
| 378 |
|
| HV * |
| 379 |
6 |
| fill_ulimit() |
| 380 |
6 |
▶ | { if(ul_table) return ul_table; |
Branch: 1 branch
| Branch | True | False | Total |
| { if(ul_table) return ul_table; |
0 |
6 |
6 |
|
| 381 |
|
| |
| 382 |
6 |
| ul_table = newHV(); |
| 383 |
|
| #include "ulimit.c" |
| 384 |
6 |
| return ul_table; |
| 385 |
|
| } |
| 386 |
|
| |
| 387 |
|
| HV * rl_table = NULL; |
| 388 |
|
| HV * |
| 389 |
6 |
| fill_rlimit() |
| 390 |
6 |
▶ | { if(rl_table) return rl_table; |
Branch: 1 branch
| Branch | True | False | Total |
| { if(rl_table) return rl_table; |
0 |
6 |
6 |
|
| 391 |
|
| |
| 392 |
6 |
| rl_table = newHV(); |
| 393 |
|
| #include "rlimit.c" |
| 394 |
6 |
| return rl_table; |
| 395 |
|
| } |
| 396 |
|
| |
| 397 |
|
| HV * events_table = NULL; |
| 398 |
|
| HV * |
| 399 |
3 |
| fill_events() |
| 400 |
3 |
▶ | { if(events_table) return events_table; |
Branch: 1 branch
| Branch | True | False | Total |
| { if(events_table) return events_table; |
0 |
3 |
3 |
|
| 401 |
|
| |
| 402 |
3 |
| events_table = newHV(); |
| 403 |
|
| #include "events.c" |
| 404 |
3 |
| return events_table; |
| 405 |
|
| } |
| 406 |
|
| |
| 407 |
|
| HV * errno_table = NULL; |
| 408 |
|
| HV * |
| 409 |
8 |
| fill_errno() |
| 410 |
8 |
▶ | { if(errno_table) return errno_table; |
Branch: 1 branch
| Branch | True | False | Total |
| { if(errno_table) return errno_table; |
0 |
8 |
8 |
|
| 411 |
|
| |
| 412 |
8 |
| errno_table = newHV(); |
| 413 |
|
| #include "errno.c" |
| 414 |
8 |
| return errno_table; |
| 415 |
|
| } |
| 416 |
|
| |
| 417 |
|
| HV * socket_table = NULL; |
| 418 |
|
| HV * |
| 419 |
4 |
| fill_socket() |
| 420 |
4 |
▶ | { if(socket_table) return socket_table; |
Branch: 1 branch
| Branch | True | False | Total |
| { if(socket_table) return socket_table; |
0 |
4 |
4 |
|
| 421 |
|
| |
| 422 |
4 |
| socket_table = newHV(); |
| 423 |
|
| #include "socket.c" |
| 424 |
4 |
| return socket_table; |
| 425 |
|
| } |
| 426 |
|
| |
| 427 |
|
| |
| 428 |
|
| #include "float.h" |
| 429 |
|
| #include "math.h" |
| 430 |
|
| HV * math_table = NULL; |
| 431 |
|
| HV * |
| 432 |
5 |
| fill_math() |
| 433 |
5 |
▶ | { if(math_table) return math_table; |
Branch: 1 branch
| Branch | True | False | Total |
| { if(math_table) return math_table; |
0 |
5 |
5 |
|
| 434 |
|
| |
| 435 |
|
| /* buffer to be able to convert float constants into float strings */ |
| 436 |
|
| char float_string[1024]; |
| 437 |
|
| |
| 438 |
5 |
| math_table = newHV(); |
| 439 |
|
| #include "math.c" |
| 440 |
5 |
| return math_table; |
| 441 |
|
| } |
| 442 |
|
| |
| 443 |
|
| HV * locale_table = NULL; |
| 444 |
|
| HV * |
| 445 |
6 |
| fill_locale() |
| 446 |
6 |
▶ | { if(locale_table) return locale_table; |
Branch: 1 branch
| Branch | True | False | Total |
| { if(locale_table) return locale_table; |
0 |
6 |
6 |
|
| 447 |
|
| |
| 448 |
6 |
| locale_table = newHV(); |
| 449 |
|
| #include "locale.c" |
| 450 |
6 |
| return locale_table; |
| 451 |
|
| } |
| 452 |
|
| |
| 453 |
|
| HV * os_table = NULL; |
| 454 |
|
| HV * |
| 455 |
5 |
| fill_os() |
| 456 |
5 |
▶ | { if(os_table) return os_table; |
Branch: 1 branch
| Branch | True | False | Total |
| { if(os_table) return os_table; |
0 |
5 |
5 |
|
| 457 |
|
| |
| 458 |
5 |
| os_table = newHV(); |
| 459 |
|
| #include "osconsts.c" |
| 460 |
5 |
| return os_table; |
| 461 |
|
| } |
| 462 |
|
| |
| 463 |
|
| HV * proc_table = NULL; |
| 464 |
|
| HV * |
| 465 |
5 |
| fill_proc() |
| 466 |
5 |
▶ | { if(proc_table) return proc_table; |
Branch: 1 branch
| Branch | True | False | Total |
| { if(proc_table) return proc_table; |
0 |
5 |
5 |
|
| 467 |
|
| |
| 468 |
5 |
| proc_table = newHV(); |
| 469 |
|
| #include "proc.c" |
| 470 |
5 |
| return proc_table; |
| 471 |
|
| } |
| 472 |
|
| |
| 473 |
|
| HV * time_table = NULL; |
| 474 |
|
| HV * |
| 475 |
5 |
| fill_time() |
| 476 |
5 |
▶ | { if(time_table) return time_table; |
Branch: 1 branch
| Branch | True | False | Total |
| { if(time_table) return time_table; |
0 |
5 |
5 |
|
| 477 |
|
| |
| 478 |
5 |
| time_table = newHV(); |
| 479 |
|
| #include "time.c" |
| 480 |
5 |
| return time_table; |
| 481 |
|
| } |
| 482 |
|
| |
| 483 |
|
| HV * user_table = NULL; |
| 484 |
|
| HV * |
| 485 |
5 |
| fill_user() |
| 486 |
5 |
▶ | { if(user_table) return user_table; |
Branch: 1 branch
| Branch | True | False | Total |
| { if(user_table) return user_table; |
0 |
5 |
5 |
|
| 487 |
|
| |
| 488 |
5 |
| user_table = newHV(); |
| 489 |
|
| #include "user.c" |
| 490 |
5 |
| return user_table; |
| 491 |
|
| } |
| 492 |
|
| |
| 493 |
|
| MODULE = POSIX::1003 PACKAGE = POSIX::1003::Sysconf |
| 494 |
|
| |
| 495 |
|
| HV * |
| 496 |
|
| sysconf_table() |
| 497 |
|
| PROTOTYPE: |
| 498 |
|
| CODE: |
| 499 |
5 |
| RETVAL = fill_sysconf(); |
| 500 |
|
| OUTPUT: |
| 501 |
|
| RETVAL |
| 502 |
|
| |
| 503 |
|
| MODULE = POSIX::1003 PACKAGE = POSIX::1003::Signals |
| 504 |
|
| |
| 505 |
|
| HV * |
| 506 |
|
| signals_table() |
| 507 |
|
| PROTOTYPE: |
| 508 |
|
| CODE: |
| 509 |
6 |
| RETVAL = fill_signals(); |
| 510 |
|
| OUTPUT: |
| 511 |
|
| RETVAL |
| 512 |
|
| |
| 513 |
|
| SV * |
| 514 |
|
| _strsignal(signr) |
| 515 |
|
| int signr; |
| 516 |
|
| PROTOTYPE: $ |
| 517 |
|
| PREINIT: |
| 518 |
|
| char * buf; |
| 519 |
|
| CODE: |
| 520 |
|
| #ifdef HAS_STRSIGNAL |
| 521 |
1 |
| buf = strsignal(signr); |
| 522 |
1 |
▶ | RETVAL = buf==NULL ? &PL_sv_undef : newSVpv(buf, 0); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = buf==NULL ? &PL_sv_undef : newSVpv(buf, 0); |
1 |
0 |
1 |
|
| 523 |
|
| #else |
| 524 |
|
| errno = ENOSYS; |
| 525 |
|
| RETVAL = &PL_sv_undef; |
| 526 |
|
| #endif |
| 527 |
|
| OUTPUT: |
| 528 |
|
| RETVAL |
| 529 |
|
| |
| 530 |
|
| MODULE = POSIX::1003 PACKAGE = POSIX::1003::Module |
| 531 |
|
| |
| 532 |
|
| SV * |
| 533 |
|
| is_missing(name) |
| 534 |
|
| char * name; |
| 535 |
|
| PROTOTYPE: $ |
| 536 |
|
| PREINIT: |
| 537 |
|
| char * found; |
| 538 |
|
| CODE: |
| 539 |
711 |
▶ | if(!missing_is_sorted) |
Branch: 1 branch
| Branch | True | False | Total |
| if(!missing_is_sorted) |
41 |
670 |
711 |
|
| 540 |
41 |
| { qsort(missing, nr_missing, sizeof(char *), strptr_cmp); |
| 541 |
41 |
| missing_is_sorted = 1; |
| 542 |
|
| } |
| 543 |
|
| |
| 544 |
711 |
| found = bsearch(name, missing, nr_missing, sizeof(char *),strptr2_cmp); |
| 545 |
711 |
▶ | RETVAL = (found == NULL ? &PL_sv_no : &PL_sv_yes); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = (found == NULL ? &PL_sv_no : &PL_sv_yes); |
711 |
0 |
711 |
|
| 546 |
|
| OUTPUT: |
| 547 |
|
| RETVAL |
| 548 |
|
| |
| 549 |
|
| |
| 550 |
|
| MODULE = POSIX::1003 PACKAGE = POSIX::1003::Confstr |
| 551 |
|
| |
| 552 |
|
| HV * |
| 553 |
|
| confstr_table() |
| 554 |
|
| PROTOTYPE: |
| 555 |
|
| CODE: |
| 556 |
5 |
| RETVAL = fill_confstr(); |
| 557 |
|
| OUTPUT: |
| 558 |
|
| RETVAL |
| 559 |
|
| |
| 560 |
|
| SV * |
| 561 |
|
| _confstr(name) |
| 562 |
|
| int name; |
| 563 |
|
| PROTOTYPE: $ |
| 564 |
|
| PREINIT: |
| 565 |
|
| char buf[4096]; |
| 566 |
|
| STRLEN len; |
| 567 |
|
| CODE: |
| 568 |
|
| #ifdef HAS_CONFSTR |
| 569 |
68 |
| len = confstr(name, buf, sizeof(buf)); |
| 570 |
68 |
▶ | RETVAL = len==0 ? &PL_sv_undef : newSVpv(buf, len-1); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = len==0 ? &PL_sv_undef : newSVpv(buf, len-1); |
68 |
0 |
68 |
|
| 571 |
|
| #else |
| 572 |
|
| errno = ENOSYS; |
| 573 |
|
| RETVAL = &PL_sv_undef; |
| 574 |
|
| #endif |
| 575 |
|
| OUTPUT: |
| 576 |
|
| RETVAL |
| 577 |
|
| |
| 578 |
|
| MODULE = POSIX::1003 PACKAGE = POSIX::1003::Pathconf |
| 579 |
|
| |
| 580 |
|
| HV * |
| 581 |
|
| pathconf_table() |
| 582 |
|
| PROTOTYPE: |
| 583 |
|
| CODE: |
| 584 |
5 |
| RETVAL = fill_pathconf(); |
| 585 |
|
| OUTPUT: |
| 586 |
|
| RETVAL |
| 587 |
|
| |
| 588 |
|
| MODULE = POSIX::1003 PACKAGE = POSIX::1003::FdIO |
| 589 |
|
| |
| 590 |
|
| HV * |
| 591 |
|
| fdio_table() |
| 592 |
|
| PROTOTYPE: |
| 593 |
|
| CODE: |
| 594 |
8 |
| RETVAL = fill_fdio(); |
| 595 |
|
| OUTPUT: |
| 596 |
|
| RETVAL |
| 597 |
|
| |
| 598 |
|
| SV * |
| 599 |
|
| truncfd(fd, l = 0) |
| 600 |
|
| int fd; |
| 601 |
|
| off_t l; |
| 602 |
|
| PROTOTYPE: $;$ |
| 603 |
|
| PREINIT: |
| 604 |
|
| long result; |
| 605 |
|
| CODE: |
| 606 |
|
| #ifdef HAS_FTRUNCATE |
| 607 |
0 |
| result = ftruncate(fd, l); |
| 608 |
0 |
▶ | RETVAL = result==-1 ? &PL_sv_undef : newSViv(result); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = result==-1 ? &PL_sv_undef : newSViv(result); |
0 |
0 |
0 |
|
| 609 |
|
| #else |
| 610 |
|
| errno = ENOSYS; |
| 611 |
|
| RETVAL = &PL_sv_undef; |
| 612 |
|
| #endif |
| 613 |
|
| OUTPUT: |
| 614 |
|
| RETVAL |
| 615 |
|
| |
| 616 |
|
| MODULE = POSIX::1003 PACKAGE = POSIX::1003::FS |
| 617 |
|
| |
| 618 |
|
| HV * |
| 619 |
|
| fsys_table() |
| 620 |
|
| PROTOTYPE: |
| 621 |
|
| CODE: |
| 622 |
7 |
| RETVAL = fill_fsys(); |
| 623 |
|
| OUTPUT: |
| 624 |
|
| RETVAL |
| 625 |
|
| |
| 626 |
|
| SV * |
| 627 |
|
| _glob(filenames, pattern, flags, errfun) |
| 628 |
|
| AV * filenames; |
| 629 |
|
| char * pattern; |
| 630 |
|
| int flags; |
| 631 |
|
| SV * errfun; |
| 632 |
|
| PROTOTYPE: \@$$$ |
| 633 |
|
| PREINIT: |
| 634 |
|
| #ifdef HAS_GLOB |
| 635 |
|
| glob_t globbuf; |
| 636 |
|
| char ** pathv; |
| 637 |
|
| #endif |
| 638 |
|
| int rc; |
| 639 |
|
| CODE: |
| 640 |
|
| #ifdef HAS_GLOB |
| 641 |
|
| /* clear flags which are handled in Perl */ |
| 642 |
5 |
| flags &= ~(GLOB_DOOFFS|GLOB_APPEND); |
| 643 |
5 |
| globbuf.gl_offs = 0; |
| 644 |
|
| |
| 645 |
|
| /* sorting raw characters is useless */ |
| 646 |
5 |
| flags |= GLOB_NOSORT; |
| 647 |
|
| |
| 648 |
5 |
▶ | if(SvOK(errfun)) |
Branch: 1 branch
| Branch | True | False | Total |
| if(SvOK(errfun)) |
5 |
0 |
5 |
|
| 649 |
5 |
| { _glob_call = errfun; |
| 650 |
5 |
| rc = glob(pattern, flags, _glob_on_error, &globbuf); |
| 651 |
|
| } |
| 652 |
|
| else |
| 653 |
0 |
| { rc = glob(pattern, flags, NULL, &globbuf); |
| 654 |
|
| } |
| 655 |
|
| |
| 656 |
5 |
▶ | if(rc==0) |
Branch: 1 branch
| Branch | True | False | Total |
| if(rc==0) |
3 |
2 |
5 |
|
| 657 |
6 |
▶ | { for(pathv = &globbuf.gl_pathv[0]; *pathv; pathv++) |
Branch: 1 branch
| Branch | True | False | Total |
| { for(pathv = &globbuf.gl_pathv[0]; *pathv; pathv++) |
3 |
3 |
6 |
|
| 658 |
3 |
| { av_push(filenames, newSVpv(*pathv, 0)); |
| 659 |
|
| } |
| 660 |
3 |
| globfree(&globbuf); |
| 661 |
|
| } |
| 662 |
5 |
| RETVAL = newSViv(rc); |
| 663 |
|
| #else |
| 664 |
|
| errno = ENOSYS; |
| 665 |
|
| RETVAL = &PL_sv_undef; |
| 666 |
|
| #endif |
| 667 |
|
| |
| 668 |
|
| OUTPUT: |
| 669 |
|
| RETVAL |
| 670 |
|
| |
| 671 |
|
| int |
| 672 |
|
| _fnmatch(pattern, name, flags) |
| 673 |
|
| char * pattern; |
| 674 |
|
| char * name; |
| 675 |
|
| int flags; |
| 676 |
|
| PROTOTYPE: $$$ |
| 677 |
|
| PREINIT: |
| 678 |
|
| CODE: |
| 679 |
|
| #ifdef HAS_FNMATCH |
| 680 |
2 |
| RETVAL = fnmatch(pattern, name, flags); |
| 681 |
|
| #else |
| 682 |
|
| errno = ENOSYS; |
| 683 |
|
| RETVAL = &PL_sv_undef; |
| 684 |
|
| #endif |
| 685 |
|
| |
| 686 |
|
| OUTPUT: |
| 687 |
|
| RETVAL |
| 688 |
|
| |
| 689 |
|
| |
| 690 |
|
| MODULE = POSIX::1003 PACKAGE = POSIX::1003::Properties |
| 691 |
|
| |
| 692 |
|
| HV * |
| 693 |
|
| property_table() |
| 694 |
|
| PROTOTYPE: |
| 695 |
|
| CODE: |
| 696 |
5 |
| RETVAL = fill_properties(); |
| 697 |
|
| OUTPUT: |
| 698 |
|
| RETVAL |
| 699 |
|
| |
| 700 |
|
| MODULE = POSIX::1003 PACKAGE = POSIX::1003::Limit |
| 701 |
|
| |
| 702 |
|
| HV * |
| 703 |
|
| ulimit_table() |
| 704 |
|
| PROTOTYPE: |
| 705 |
|
| CODE: |
| 706 |
6 |
| RETVAL = fill_ulimit(); |
| 707 |
|
| OUTPUT: |
| 708 |
|
| RETVAL |
| 709 |
|
| |
| 710 |
|
| HV * |
| 711 |
|
| rlimit_table() |
| 712 |
|
| PROTOTYPE: |
| 713 |
|
| CODE: |
| 714 |
6 |
| RETVAL = fill_rlimit(); |
| 715 |
|
| OUTPUT: |
| 716 |
|
| RETVAL |
| 717 |
|
| |
| 718 |
|
| SV * |
| 719 |
|
| _ulimit(cmd, value) |
| 720 |
|
| int cmd; |
| 721 |
|
| long value; |
| 722 |
|
| PROTOTYPE: $$ |
| 723 |
|
| PREINIT: |
| 724 |
|
| long result; |
| 725 |
|
| CODE: |
| 726 |
|
| #ifdef HAS_ULIMIT |
| 727 |
7 |
| result = ulimit(cmd, value); |
| 728 |
7 |
▶ | RETVAL = result==-1 ? &PL_sv_undef : newSViv(result); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = result==-1 ? &PL_sv_undef : newSViv(result); |
5 |
2 |
7 |
|
| 729 |
|
| #else |
| 730 |
|
| errno = ENOSYS; |
| 731 |
|
| RETVAL = &PL_sv_undef; |
| 732 |
|
| #endif |
| 733 |
|
| OUTPUT: |
| 734 |
|
| RETVAL |
| 735 |
|
| |
| 736 |
|
| #ifdef HAS_RLIMIT |
| 737 |
|
| #ifdef HAS_RLIMIT_64 |
| 738 |
|
| |
| 739 |
|
| void |
| 740 |
|
| _getrlimit(resource) |
| 741 |
|
| int resource; |
| 742 |
|
| PROTOTYPE: $ |
| 743 |
|
| PREINIT: |
| 744 |
|
| struct rlimit64 rlim; |
| 745 |
|
| int result; |
| 746 |
|
| PPCODE: |
| 747 |
|
| /* on linux, rlim64_t is a __UQUAD_TYPE */ |
| 748 |
22 |
| result = getrlimit64(resource, &rlim); |
| 749 |
22 |
▶ | XPUSHs(sv_2mortal(newSVuv(rlim.rlim_cur))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVuv(rlim.rlim_cur))); |
0 |
22 |
22 |
|
| 750 |
22 |
▶ | XPUSHs(sv_2mortal(newSVuv(rlim.rlim_max))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVuv(rlim.rlim_max))); |
0 |
22 |
22 |
|
| 751 |
22 |
▶ | XPUSHs(result==-1 ? &PL_sv_no : &PL_sv_yes); |
Branch: 2 branches
| Branch | True | False | Total |
| XPUSHs(result==-1 ? &PL_sv_no : &PL_sv_yes); |
0 |
22 |
22 |
| XPUSHs(result==-1 ? &PL_sv_no : &PL_sv_yes); |
1 |
21 |
22 |
|
| 752 |
|
| |
| 753 |
|
| SV * |
| 754 |
|
| _setrlimit(resource, cur, max) |
| 755 |
|
| int resource; |
| 756 |
|
| unsigned long cur; |
| 757 |
|
| unsigned long max; |
| 758 |
|
| PROTOTYPE: $$$ |
| 759 |
|
| PREINIT: |
| 760 |
|
| struct rlimit64 rlim; |
| 761 |
|
| int result; |
| 762 |
|
| CODE: |
| 763 |
1 |
| rlim.rlim_cur = cur; |
| 764 |
1 |
| rlim.rlim_max = max; |
| 765 |
1 |
| result = setrlimit64(resource, &rlim); |
| 766 |
1 |
▶ | RETVAL = result==-1 ? &PL_sv_no : &PL_sv_yes; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = result==-1 ? &PL_sv_no : &PL_sv_yes; |
0 |
1 |
1 |
|
| 767 |
|
| OUTPUT: |
| 768 |
|
| RETVAL |
| 769 |
|
| |
| 770 |
|
| #else /* HAS_RLIMIT_64 */ |
| 771 |
|
| |
| 772 |
|
| |
| 773 |
|
| void |
| 774 |
|
| _getrlimit(resource) |
| 775 |
|
| int resource; |
| 776 |
|
| PROTOTYPE: $ |
| 777 |
|
| PREINIT: |
| 778 |
|
| struct rlimit rlim; |
| 779 |
|
| int result; |
| 780 |
|
| PPCODE: |
| 781 |
|
| /* on linux, rlim64_t is a __ULONGWORD_TYPE */ |
| 782 |
|
| result = getrlimit(resource, &rlim); |
| 783 |
|
| XPUSHs(sv_2mortal(newSVuv(rlim.rlim_cur))); |
| 784 |
|
| XPUSHs(sv_2mortal(newSVuv(rlim.rlim_max))); |
| 785 |
|
| XPUSHs(result==-1 ? &PL_sv_no : &PL_sv_yes); |
| 786 |
|
| |
| 787 |
|
| SV * |
| 788 |
|
| _setrlimit(resource, cur, max) |
| 789 |
|
| int resource; |
| 790 |
|
| unsigned long cur; |
| 791 |
|
| unsigned long max; |
| 792 |
|
| PROTOTYPE: $$$ |
| 793 |
|
| PREINIT: |
| 794 |
|
| struct rlimit rlim; |
| 795 |
|
| int result; |
| 796 |
|
| CODE: |
| 797 |
|
| rlim.rlim_cur = cur; |
| 798 |
|
| rlim.rlim_max = max; |
| 799 |
|
| result = setrlimit(resource, &rlim); |
| 800 |
|
| RETVAL = result==-1 ? &PL_sv_no : &PL_sv_yes; |
| 801 |
|
| OUTPUT: |
| 802 |
|
| RETVAL |
| 803 |
|
| |
| 804 |
|
| #endif /* HAS_RLIMIT_64 */ |
| 805 |
|
| #else /* HAS_RLIMIT */ |
| 806 |
|
| |
| 807 |
|
| void |
| 808 |
|
| _getrlimit(resource) |
| 809 |
|
| int resource; |
| 810 |
|
| PROTOTYPE: $ |
| 811 |
|
| PPCODE: |
| 812 |
|
| XPUSHs(&PL_sv_undef); |
| 813 |
|
| XPUSHs(&PL_sv_undef); |
| 814 |
|
| XPUSHs(&PL_sv_no); |
| 815 |
|
| |
| 816 |
|
| SV * |
| 817 |
|
| _setrlimit(resource, cur, max) |
| 818 |
|
| int resource; |
| 819 |
|
| unsigned long cur; |
| 820 |
|
| unsigned long max; |
| 821 |
|
| PROTOTYPE: $$$ |
| 822 |
|
| CODE: |
| 823 |
|
| RETVAL = &PL_sv_no; |
| 824 |
|
| OUTPUT: |
| 825 |
|
| RETVAL |
| 826 |
|
| |
| 827 |
|
| #endif /* HAS_RLIMIT */ |
| 828 |
|
| |
| 829 |
|
| |
| 830 |
|
| MODULE = POSIX::1003 PACKAGE = POSIX::1003::FS |
| 831 |
|
| |
| 832 |
|
| #ifdef HAS_SYSMKDEV |
| 833 |
|
| #include <sys/mkdev.h> |
| 834 |
|
| #endif |
| 835 |
|
| |
| 836 |
|
| #ifdef __GNU_LIBRARY__ |
| 837 |
|
| #include <sys/sysmacros.h> |
| 838 |
|
| #endif |
| 839 |
|
| |
| 840 |
|
| SV * |
| 841 |
|
| makedev(dev_t major, dev_t minor) |
| 842 |
|
| PROTOTYPE: $$ |
| 843 |
|
| CODE: |
| 844 |
|
| #ifdef HAS_SYSMKDEV |
| 845 |
|
| RETVAL = newSViv(makedev(major, minor)); |
| 846 |
|
| #else |
| 847 |
0 |
| errno = ENOSYS; |
| 848 |
0 |
| RETVAL = &PL_sv_undef; |
| 849 |
|
| #endif |
| 850 |
|
| OUTPUT: |
| 851 |
|
| RETVAL |
| 852 |
|
| |
| 853 |
|
| SV * |
| 854 |
|
| major(dev_t dev) |
| 855 |
|
| PROTOTYPE: $ |
| 856 |
|
| CODE: |
| 857 |
|
| #ifdef HAS_SYSMKDEV |
| 858 |
|
| RETVAL = newSVuv(major(dev)); |
| 859 |
|
| #else |
| 860 |
0 |
| errno = ENOSYS; |
| 861 |
0 |
| RETVAL = &PL_sv_undef; |
| 862 |
|
| #endif |
| 863 |
|
| OUTPUT: |
| 864 |
|
| RETVAL |
| 865 |
|
| |
| 866 |
|
| SV * |
| 867 |
|
| minor(dev_t dev) |
| 868 |
|
| PROTOTYPE: $ |
| 869 |
|
| CODE: |
| 870 |
|
| #ifdef HAS_SYSMKDEV |
| 871 |
|
| RETVAL = newSVuv(minor(dev)); |
| 872 |
|
| #else |
| 873 |
0 |
| errno = ENOSYS; |
| 874 |
0 |
| RETVAL = &PL_sv_undef; |
| 875 |
|
| #endif |
| 876 |
|
| OUTPUT: |
| 877 |
|
| RETVAL |
| 878 |
|
| |
| 879 |
|
| int |
| 880 |
|
| mknod(filename, mode, dev) |
| 881 |
|
| char * filename |
| 882 |
|
| mode_t mode |
| 883 |
|
| dev_t dev |
| 884 |
|
| CODE: |
| 885 |
|
| #ifdef HAS_MKNOD |
| 886 |
0 |
| RETVAL = mknod(filename, mode, dev); |
| 887 |
|
| #else |
| 888 |
|
| errno = ENOSYS; |
| 889 |
|
| RETVAL = &PL_sv_undef; |
| 890 |
|
| #endif |
| 891 |
|
| OUTPUT: |
| 892 |
|
| RETVAL |
| 893 |
|
| |
| 894 |
|
| |
| 895 |
|
| MODULE = POSIX::1003 PACKAGE = POSIX::1003::Events |
| 896 |
|
| |
| 897 |
|
| HV * |
| 898 |
|
| events_table() |
| 899 |
|
| PROTOTYPE: |
| 900 |
|
| CODE: |
| 901 |
3 |
| RETVAL = fill_events(); |
| 902 |
|
| OUTPUT: |
| 903 |
|
| RETVAL |
| 904 |
|
| |
| 905 |
|
| |
| 906 |
|
| HV * |
| 907 |
|
| _poll(handles, timeout) |
| 908 |
|
| HV * handles; |
| 909 |
|
| int timeout; |
| 910 |
|
| PREINIT: |
| 911 |
|
| struct pollfd * fds; |
| 912 |
|
| HV * ret; |
| 913 |
|
| char * key; |
| 914 |
|
| char key_str[16]; |
| 915 |
|
| int rc; |
| 916 |
|
| HE * entry; |
| 917 |
|
| I32 len; |
| 918 |
|
| int j; |
| 919 |
|
| int nfd; |
| 920 |
|
| PPCODE: |
| 921 |
|
| #ifdef HAS_POLL |
| 922 |
0 |
| nfd = hv_iterinit(handles); |
| 923 |
0 |
| Newx(fds, nfd, struct pollfd); |
| 924 |
0 |
▶ | for(j=0; j < nfd; j++) |
Branch: 1 branch
| Branch | True | False | Total |
| for(j=0; j < nfd; j++) |
0 |
0 |
0 |
|
| 925 |
|
| { /* Get hash key into 'C' space */ |
| 926 |
0 |
| entry = hv_iternext(handles); |
| 927 |
0 |
| key = hv_iterkey(entry, &len); |
| 928 |
0 |
▶ | if(len > 15) len = 15; /* fd-num is always small */ |
Branch: 1 branch
| Branch | True | False | Total |
| if(len > 15) len = 15; /* fd-num is always small */ |
0 |
0 |
0 |
|
| 929 |
0 |
| strncpy(key_str, key, len); |
| 930 |
0 |
| key_str[len] = 0; |
| 931 |
0 |
| fds[j].fd = strtoul(key_str, NULL, 10); |
| 932 |
|
| |
| 933 |
0 |
| fds[j].events = SvUV(hv_iterval(handles, entry)); |
| 934 |
0 |
| fds[j].revents = 0; /* returned events */ |
| 935 |
|
| } |
| 936 |
0 |
| rc = poll(fds, nfd, timeout); |
| 937 |
0 |
▶ | if(rc==-1) |
Branch: 1 branch
| Branch | True | False | Total |
| if(rc==-1) |
0 |
0 |
0 |
|
| 938 |
0 |
▶ | { XPUSHs(&PL_sv_undef); |
Branch: 1 branch
| Branch | True | False | Total |
| { XPUSHs(&PL_sv_undef); |
0 |
0 |
0 |
|
| 939 |
|
| } |
| 940 |
0 |
▶ | else if(rc==0) |
Branch: 1 branch
| Branch | True | False | Total |
| else if(rc==0) |
0 |
0 |
0 |
|
| 941 |
0 |
| { ret = newHV(); |
| 942 |
0 |
▶ | XPUSHs(sv_2mortal((SV*)ret)); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal((SV*)ret)); |
0 |
0 |
0 |
|
| 943 |
|
| } |
| 944 |
|
| else |
| 945 |
0 |
| { ret = newHV(); |
| 946 |
0 |
▶ | for(j=0; j < nfd; j++) |
Branch: 1 branch
| Branch | True | False | Total |
| for(j=0; j < nfd; j++) |
0 |
0 |
0 |
|
| 947 |
0 |
▶ | { if(fds[j].revents) |
Branch: 1 branch
| Branch | True | False | Total |
| { if(fds[j].revents) |
0 |
0 |
0 |
|
| 948 |
0 |
| { sprintf((char *)key_str, "%15d", fds[j].fd); |
| 949 |
0 |
| (void)hv_store(ret, key_str, strlen(key_str), newSVuv(fds[j].revents), 0); |
| 950 |
|
| } |
| 951 |
|
| } |
| 952 |
0 |
▶ | XPUSHs(sv_2mortal((SV*)ret)); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal((SV*)ret)); |
0 |
0 |
0 |
|
| 953 |
|
| } |
| 954 |
0 |
| Safefree(fds); |
| 955 |
0 |
| XSRETURN(1); |
| 956 |
|
| #else |
| 957 |
|
| errno = ENOSYS; |
| 958 |
|
| XPUSHs(&PL_sv_undef); |
| 959 |
|
| #endif |
| 960 |
|
| |
| 961 |
|
| MODULE = POSIX::1003 PACKAGE = POSIX::1003::User |
| 962 |
|
| |
| 963 |
|
| HV * |
| 964 |
|
| user_table() |
| 965 |
|
| PROTOTYPE: |
| 966 |
|
| CODE: |
| 967 |
5 |
| RETVAL = fill_user(); |
| 968 |
|
| OUTPUT: |
| 969 |
|
| RETVAL |
| 970 |
|
| |
| 971 |
|
| void |
| 972 |
|
| setuid(uid) |
| 973 |
|
| uid_t uid |
| 974 |
|
| PROTOTYPE: $ |
| 975 |
|
| INIT: |
| 976 |
|
| int result; |
| 977 |
|
| PPCODE: |
| 978 |
|
| #ifdef HAS_SETUID |
| 979 |
1 |
| result = setuid(uid); |
| 980 |
|
| #ifdef CACHE_UID |
| 981 |
|
| PL_uid = getuid(); |
| 982 |
|
| PL_euid = geteuid(); |
| 983 |
|
| #endif |
| 984 |
|
| #else |
| 985 |
|
| errno = ENOSYS; |
| 986 |
|
| result = -1; |
| 987 |
|
| #endif |
| 988 |
1 |
▶ | XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
Branch: 2 branches
| Branch | True | False | Total |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
1 |
1 |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
1 |
1 |
|
| 989 |
|
| |
| 990 |
|
| uid_t |
| 991 |
|
| getuid() |
| 992 |
|
| PROTOTYPE: |
| 993 |
|
| INIT: |
| 994 |
|
| int result; |
| 995 |
|
| PPCODE: |
| 996 |
|
| #ifdef HAS_SETUID |
| 997 |
1 |
| result = getuid(); |
| 998 |
|
| #else |
| 999 |
|
| errno = ENOSYS; |
| 1000 |
|
| result = -1; |
| 1001 |
|
| #endif |
| 1002 |
1 |
▶ | XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
Branch: 2 branches
| Branch | True | False | Total |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
1 |
1 |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
1 |
0 |
1 |
|
| 1003 |
|
| |
| 1004 |
|
| int |
| 1005 |
|
| setgid(gid) |
| 1006 |
|
| gid_t gid |
| 1007 |
|
| PROTOTYPE: $ |
| 1008 |
|
| INIT: |
| 1009 |
|
| int result; |
| 1010 |
|
| PPCODE: |
| 1011 |
|
| #ifdef HAS_SETUID |
| 1012 |
0 |
| result = setgid(gid); |
| 1013 |
|
| #else |
| 1014 |
|
| errno = ENOSYS; |
| 1015 |
|
| result = -1; |
| 1016 |
|
| #endif |
| 1017 |
0 |
▶ | XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
Branch: 2 branches
| Branch | True | False | Total |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
0 |
0 |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
0 |
0 |
|
| 1018 |
|
| |
| 1019 |
|
| gid_t |
| 1020 |
|
| getgid() |
| 1021 |
|
| PROTOTYPE: |
| 1022 |
|
| INIT: |
| 1023 |
|
| int result; |
| 1024 |
|
| PPCODE: |
| 1025 |
|
| #ifdef HAS_SETUID |
| 1026 |
0 |
| result = getgid(); |
| 1027 |
|
| #ifdef CACHE_UID |
| 1028 |
|
| PL_gid = getgid(); |
| 1029 |
|
| PL_egid = getegid(); |
| 1030 |
|
| #endif |
| 1031 |
|
| #else |
| 1032 |
|
| errno = ENOSYS; |
| 1033 |
|
| result = -1; |
| 1034 |
|
| #endif |
| 1035 |
0 |
▶ | XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
Branch: 2 branches
| Branch | True | False | Total |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
0 |
0 |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
0 |
0 |
|
| 1036 |
|
| |
| 1037 |
|
| |
| 1038 |
|
| int |
| 1039 |
|
| seteuid(euid) |
| 1040 |
|
| uid_t euid |
| 1041 |
|
| PROTOTYPE: $ |
| 1042 |
|
| INIT: |
| 1043 |
|
| int result; |
| 1044 |
|
| PPCODE: |
| 1045 |
|
| #ifdef HAS_SETEUID |
| 1046 |
0 |
| result = seteuid(euid); |
| 1047 |
|
| #ifdef CACHE_UID |
| 1048 |
|
| PL_euid = geteuid(); |
| 1049 |
|
| #endif |
| 1050 |
|
| #else |
| 1051 |
|
| errno = ENOSYS; |
| 1052 |
|
| result = -1; |
| 1053 |
|
| #endif |
| 1054 |
0 |
▶ | XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
Branch: 2 branches
| Branch | True | False | Total |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
0 |
0 |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
0 |
0 |
|
| 1055 |
|
| |
| 1056 |
|
| uid_t |
| 1057 |
|
| geteuid() |
| 1058 |
|
| PROTOTYPE: |
| 1059 |
|
| INIT: |
| 1060 |
|
| int result; |
| 1061 |
|
| PPCODE: |
| 1062 |
|
| #ifdef HAS_SETEUID |
| 1063 |
0 |
| result = geteuid(); |
| 1064 |
|
| #ifdef CACHE_UID |
| 1065 |
|
| PL_egid = getegid(); |
| 1066 |
|
| #endif |
| 1067 |
|
| #else |
| 1068 |
|
| errno = ENOSYS; |
| 1069 |
|
| result = -1; |
| 1070 |
|
| #endif |
| 1071 |
0 |
▶ | XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
Branch: 2 branches
| Branch | True | False | Total |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
0 |
0 |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
0 |
0 |
|
| 1072 |
|
| |
| 1073 |
|
| |
| 1074 |
|
| int |
| 1075 |
|
| setegid(egid) |
| 1076 |
|
| gid_t egid |
| 1077 |
|
| PROTOTYPE: $ |
| 1078 |
|
| INIT: |
| 1079 |
|
| int result; |
| 1080 |
|
| PPCODE: |
| 1081 |
|
| #ifdef HAS_SETEUID |
| 1082 |
0 |
| result = setegid(egid); |
| 1083 |
|
| #else |
| 1084 |
|
| errno = ENOSYS; |
| 1085 |
|
| result = -1; |
| 1086 |
|
| #endif |
| 1087 |
0 |
▶ | XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
Branch: 2 branches
| Branch | True | False | Total |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
0 |
0 |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
0 |
0 |
|
| 1088 |
|
| |
| 1089 |
|
| gid_t |
| 1090 |
|
| getegid() |
| 1091 |
|
| PROTOTYPE: |
| 1092 |
|
| INIT: |
| 1093 |
|
| int result; |
| 1094 |
|
| PPCODE: |
| 1095 |
|
| #ifdef HAS_SETEUID |
| 1096 |
0 |
| result = getegid(); |
| 1097 |
|
| #else |
| 1098 |
|
| errno = ENOSYS; |
| 1099 |
|
| result = -1; |
| 1100 |
|
| #endif |
| 1101 |
0 |
▶ | XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
Branch: 2 branches
| Branch | True | False | Total |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
0 |
0 |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
0 |
0 |
|
| 1102 |
|
| |
| 1103 |
|
| |
| 1104 |
|
| int |
| 1105 |
|
| setreuid(ruid, euid) |
| 1106 |
|
| uid_t ruid |
| 1107 |
|
| uid_t euid |
| 1108 |
|
| PROTOTYPE: $$ |
| 1109 |
|
| INIT: |
| 1110 |
|
| int result; |
| 1111 |
|
| PPCODE: |
| 1112 |
|
| #ifdef HAS_SETREUID |
| 1113 |
|
| result = setreuid(ruid, euid); |
| 1114 |
|
| #ifdef CACHE_UID |
| 1115 |
|
| PL_uid = getuid(); |
| 1116 |
|
| PL_euid = geteuid(); |
| 1117 |
|
| #endif |
| 1118 |
|
| #else |
| 1119 |
0 |
| errno = ENOSYS; |
| 1120 |
0 |
| result = -1; |
| 1121 |
|
| #endif |
| 1122 |
0 |
▶ | XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
Branch: 2 branches
| Branch | True | False | Total |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
0 |
0 |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
0 |
0 |
|
| 1123 |
|
| |
| 1124 |
|
| int |
| 1125 |
|
| setregid(rgid, egid) |
| 1126 |
|
| gid_t rgid |
| 1127 |
|
| gid_t egid |
| 1128 |
|
| PROTOTYPE: $$ |
| 1129 |
|
| INIT: |
| 1130 |
|
| int result; |
| 1131 |
|
| PPCODE: |
| 1132 |
|
| #ifdef HAS_SETREGID |
| 1133 |
|
| result = setregid(rgid, egid); |
| 1134 |
|
| #ifdef CACHE_UID |
| 1135 |
|
| PL_gid = getgid(); |
| 1136 |
|
| PL_egid = getegid(); |
| 1137 |
|
| #endif |
| 1138 |
|
| #else |
| 1139 |
0 |
| errno = ENOSYS; |
| 1140 |
0 |
| result = -1; |
| 1141 |
|
| #endif |
| 1142 |
0 |
▶ | XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
Branch: 2 branches
| Branch | True | False | Total |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
0 |
0 |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
0 |
0 |
|
| 1143 |
|
| |
| 1144 |
|
| |
| 1145 |
|
| int |
| 1146 |
|
| setresuid(ruid, euid, suid) |
| 1147 |
|
| uid_t ruid |
| 1148 |
|
| uid_t euid |
| 1149 |
|
| uid_t suid |
| 1150 |
|
| PROTOTYPE: $$$ |
| 1151 |
|
| INIT: |
| 1152 |
|
| int result; |
| 1153 |
|
| PPCODE: |
| 1154 |
|
| #ifdef HAS_SETRESUID |
| 1155 |
0 |
| result = setresuid(ruid, euid, suid); |
| 1156 |
|
| #ifdef CACHE_UID |
| 1157 |
|
| PL_uid = getuid(); |
| 1158 |
|
| PL_euid = geteuid(); |
| 1159 |
|
| #endif |
| 1160 |
|
| #else |
| 1161 |
|
| errno = ENOSYS; |
| 1162 |
|
| result = -1; |
| 1163 |
|
| #endif |
| 1164 |
0 |
▶ | XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
Branch: 2 branches
| Branch | True | False | Total |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
0 |
0 |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
0 |
0 |
|
| 1165 |
|
| |
| 1166 |
|
| void |
| 1167 |
|
| getresuid() |
| 1168 |
|
| PROTOTYPE: |
| 1169 |
|
| INIT: |
| 1170 |
|
| uid_t ruid; |
| 1171 |
|
| uid_t euid; |
| 1172 |
|
| uid_t suid; |
| 1173 |
|
| int result; |
| 1174 |
|
| PPCODE: |
| 1175 |
|
| #ifdef HAS_SETRESUID |
| 1176 |
0 |
| result = getresuid(&ruid, &euid, &suid); |
| 1177 |
0 |
▶ | if(result==0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if(result==0) { |
0 |
0 |
0 |
|
| 1178 |
0 |
▶ | XPUSHs(sv_2mortal(newSVuv(ruid))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVuv(ruid))); |
0 |
0 |
0 |
|
| 1179 |
0 |
▶ | XPUSHs(sv_2mortal(newSVuv(euid))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVuv(euid))); |
0 |
0 |
0 |
|
| 1180 |
0 |
▶ | XPUSHs(sv_2mortal(newSVuv(suid))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVuv(suid))); |
0 |
0 |
0 |
|
| 1181 |
|
| } |
| 1182 |
|
| #else |
| 1183 |
|
| errno = ENOSYS; |
| 1184 |
|
| #endif |
| 1185 |
|
| |
| 1186 |
|
| |
| 1187 |
|
| int |
| 1188 |
|
| setresgid(rgid, egid, sgid) |
| 1189 |
|
| gid_t rgid |
| 1190 |
|
| gid_t egid |
| 1191 |
|
| gid_t sgid |
| 1192 |
|
| PROTOTYPE: $$$ |
| 1193 |
|
| INIT: |
| 1194 |
|
| int result; |
| 1195 |
|
| PPCODE: |
| 1196 |
|
| #ifdef HAS_SETRESGID |
| 1197 |
0 |
| result = setresgid(rgid, egid, sgid); |
| 1198 |
|
| #ifdef CACHE_UID |
| 1199 |
|
| PL_gid = getgid(); |
| 1200 |
|
| PL_egid = getegid(); |
| 1201 |
|
| #endif |
| 1202 |
|
| #else |
| 1203 |
|
| errno = ENOSYS; |
| 1204 |
|
| result = -1; |
| 1205 |
|
| #endif |
| 1206 |
0 |
▶ | XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
Branch: 2 branches
| Branch | True | False | Total |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
0 |
0 |
| XPUSHs(result==-1 ? &PL_sv_undef : sv_2mortal(newSViv(result))); |
0 |
0 |
0 |
|
| 1207 |
|
| |
| 1208 |
|
| void |
| 1209 |
|
| getresgid() |
| 1210 |
|
| PROTOTYPE: |
| 1211 |
|
| INIT: |
| 1212 |
|
| gid_t rgid; |
| 1213 |
|
| gid_t egid; |
| 1214 |
|
| gid_t sgid; |
| 1215 |
|
| int result; |
| 1216 |
|
| PPCODE: |
| 1217 |
|
| #ifdef HAS_SETRESUID |
| 1218 |
0 |
| result = getresgid(&rgid, &egid, &sgid); |
| 1219 |
0 |
▶ | if(result==0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if(result==0) { |
0 |
0 |
0 |
|
| 1220 |
0 |
▶ | XPUSHs(sv_2mortal(newSVuv(rgid))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVuv(rgid))); |
0 |
0 |
0 |
|
| 1221 |
0 |
▶ | XPUSHs(sv_2mortal(newSVuv(egid))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVuv(egid))); |
0 |
0 |
0 |
|
| 1222 |
0 |
▶ | XPUSHs(sv_2mortal(newSVuv(sgid))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVuv(sgid))); |
0 |
0 |
0 |
|
| 1223 |
|
| } |
| 1224 |
|
| #else |
| 1225 |
|
| errno = ENOSYS; |
| 1226 |
|
| #endif |
| 1227 |
|
| |
| 1228 |
|
| void |
| 1229 |
|
| getgroups() |
| 1230 |
|
| PROTOTYPE: |
| 1231 |
|
| INIT: |
| 1232 |
|
| gid_t grouplist[_NGROUPS]; |
| 1233 |
|
| int nr_groups; |
| 1234 |
|
| PPCODE: |
| 1235 |
|
| #ifdef HAS_GETGROUPS |
| 1236 |
1 |
| nr_groups = getgroups(_NGROUPS, grouplist); |
| 1237 |
1 |
▶ | if(nr_groups >= 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if(nr_groups >= 0) { |
1 |
0 |
1 |
|
| 1238 |
|
| int nr; |
| 1239 |
2 |
▶ | for(nr = 0; nr < nr_groups; nr++) |
Branch: 1 branch
| Branch | True | False | Total |
| for(nr = 0; nr < nr_groups; nr++) |
1 |
1 |
2 |
|
| 1240 |
1 |
▶ | XPUSHs(sv_2mortal(newSVuv(grouplist[nr]))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVuv(grouplist[nr]))); |
0 |
1 |
1 |
|
| 1241 |
|
| } |
| 1242 |
|
| #else |
| 1243 |
|
| errno = ENOSYS; |
| 1244 |
|
| #endif |
| 1245 |
|
| |
| 1246 |
|
| void |
| 1247 |
|
| setgroups(...) |
| 1248 |
|
| PROTOTYPE: @ |
| 1249 |
|
| INIT: |
| 1250 |
|
| int index; |
| 1251 |
|
| gid_t groups[_NGROUPS]; |
| 1252 |
|
| int result; |
| 1253 |
|
| CODE: |
| 1254 |
|
| #ifdef HAS_SETGROUPS |
| 1255 |
0 |
▶ | for(index = 0; index < items && index < _NGROUPS; index++) |
Branch: 2 branches
| Branch | True | False | Total |
| for(index = 0; index < items && index < _NGROUPS; index++) |
0 |
0 |
0 |
| for(index = 0; index < items && index < _NGROUPS; index++) |
0 |
0 |
0 |
|
| 1256 |
0 |
| { groups[index] = (gid_t)SvUV(ST(index)); |
| 1257 |
|
| } |
| 1258 |
0 |
| result = setgroups(index, groups); |
| 1259 |
0 |
▶ | XPUSHs(result==-1 ? &PL_sv_no : &PL_sv_yes); |
Branch: 2 branches
| Branch | True | False | Total |
| XPUSHs(result==-1 ? &PL_sv_no : &PL_sv_yes); |
0 |
0 |
0 |
| XPUSHs(result==-1 ? &PL_sv_no : &PL_sv_yes); |
0 |
0 |
0 |
|
| 1260 |
|
| #else |
| 1261 |
|
| errno = ENOSYS; |
| 1262 |
|
| #endif |
| 1263 |
|
| |
| 1264 |
|
| |
| 1265 |
|
| MODULE = POSIX::1003 PACKAGE = POSIX::1003::Errno |
| 1266 |
|
| |
| 1267 |
|
| HV * |
| 1268 |
|
| errno_table() |
| 1269 |
|
| PROTOTYPE: |
| 1270 |
|
| CODE: |
| 1271 |
8 |
| RETVAL = fill_errno(); |
| 1272 |
|
| OUTPUT: |
| 1273 |
|
| RETVAL |
| 1274 |
|
| |
| 1275 |
|
| SV * |
| 1276 |
|
| _strerror(int errnr) |
| 1277 |
|
| PROTOTYPE: $ |
| 1278 |
|
| INIT: |
| 1279 |
|
| char * buf; |
| 1280 |
|
| CODE: |
| 1281 |
|
| #ifdef HAS_STRERROR |
| 1282 |
|
| buf = strerror(errnr); |
| 1283 |
|
| RETVAL = buf==NULL ? &PL_sv_undef : newSVpv(buf, 0); |
| 1284 |
|
| #else |
| 1285 |
134 |
| errno = ENOSYS; |
| 1286 |
134 |
| RETVAL = &PL_sv_undef; |
| 1287 |
|
| #endif |
| 1288 |
|
| OUTPUT: |
| 1289 |
|
| RETVAL |
| 1290 |
|
| |
| 1291 |
|
| MODULE = POSIX::1003 PACKAGE = POSIX::1003::Math |
| 1292 |
|
| |
| 1293 |
|
| HV * |
| 1294 |
|
| math_table() |
| 1295 |
|
| PROTOTYPE: |
| 1296 |
|
| CODE: |
| 1297 |
5 |
| RETVAL = fill_math(); |
| 1298 |
|
| OUTPUT: |
| 1299 |
|
| RETVAL |
| 1300 |
|
| |
| 1301 |
|
| MODULE = POSIX::1003 PACKAGE = POSIX::1003::Locale |
| 1302 |
|
| |
| 1303 |
|
| HV * |
| 1304 |
|
| locale_table() |
| 1305 |
|
| PROTOTYPE: |
| 1306 |
|
| CODE: |
| 1307 |
6 |
| RETVAL = fill_locale(); |
| 1308 |
|
| OUTPUT: |
| 1309 |
|
| RETVAL |
| 1310 |
|
| |
| 1311 |
|
| MODULE = POSIX::1003 PACKAGE = POSIX::1003::OS |
| 1312 |
|
| |
| 1313 |
|
| HV * |
| 1314 |
|
| osconsts_table() |
| 1315 |
|
| PROTOTYPE: |
| 1316 |
|
| CODE: |
| 1317 |
5 |
| RETVAL = fill_os(); |
| 1318 |
|
| OUTPUT: |
| 1319 |
|
| RETVAL |
| 1320 |
|
| |
| 1321 |
|
| MODULE = POSIX::1003 PACKAGE = POSIX::1003::Proc |
| 1322 |
|
| |
| 1323 |
|
| HV * |
| 1324 |
|
| proc_table() |
| 1325 |
|
| PROTOTYPE: |
| 1326 |
|
| CODE: |
| 1327 |
5 |
| RETVAL = fill_proc(); |
| 1328 |
|
| OUTPUT: |
| 1329 |
|
| RETVAL |
| 1330 |
|
| |
| 1331 |
|
| int |
| 1332 |
|
| getpid() |
| 1333 |
|
| PROTOTYPE: |
| 1334 |
|
| CODE: |
| 1335 |
|
| #ifdef HAS_GETPID |
| 1336 |
0 |
| RETVAL = getpid(); |
| 1337 |
|
| #else |
| 1338 |
|
| errno = ENOSYS; |
| 1339 |
|
| RETVAL = &PL_sv_undef; |
| 1340 |
|
| #endif |
| 1341 |
|
| OUTPUT: |
| 1342 |
|
| RETVAL |
| 1343 |
|
| |
| 1344 |
|
| int |
| 1345 |
|
| getppid() |
| 1346 |
|
| PROTOTYPE: |
| 1347 |
|
| CODE: |
| 1348 |
|
| #ifdef HAS_GETPPID |
| 1349 |
0 |
| RETVAL = getpid(); |
| 1350 |
|
| #else |
| 1351 |
|
| errno = ENOSYS; |
| 1352 |
|
| RETVAL = &PL_sv_undef; |
| 1353 |
|
| #endif |
| 1354 |
|
| OUTPUT: |
| 1355 |
|
| RETVAL |
| 1356 |
|
| |
| 1357 |
|
| MODULE = POSIX::1003 PACKAGE = POSIX::1003::Time |
| 1358 |
|
| |
| 1359 |
|
| |
| 1360 |
|
| MODULE = POSIX::1003 PACKAGE = POSIX::1003::Time |
| 1361 |
|
| |
| 1362 |
|
| HV * |
| 1363 |
|
| time_table() |
| 1364 |
|
| PROTOTYPE: |
| 1365 |
|
| CODE: |
| 1366 |
5 |
| RETVAL = fill_time(); |
| 1367 |
|
| OUTPUT: |
| 1368 |
|
| RETVAL |
| 1369 |
|
| |
| 1370 |
|
| void |
| 1371 |
|
| _strptime(input, format) |
| 1372 |
|
| const char *input |
| 1373 |
|
| const char *format |
| 1374 |
|
| PREINIT: |
| 1375 |
|
| #ifdef I_TIME |
| 1376 |
2 |
| struct tm t = { -1,-1,-1,-1,-1,-1,-1,-1 }; |
| 1377 |
|
| #endif |
| 1378 |
|
| PPCODE: |
| 1379 |
|
| #ifdef HAS_STRPTIME |
| 1380 |
2 |
| strptime(input, format, &t); |
| 1381 |
2 |
▶ | if(t.tm_sec == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_sec); |
Branch: 3 branches
| Branch | True | False | Total |
| if(t.tm_sec == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_sec); |
0 |
2 |
2 |
| if(t.tm_sec == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_sec); |
0 |
0 |
0 |
| if(t.tm_sec == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_sec); |
0 |
2 |
2 |
|
| 1382 |
2 |
▶ | if(t.tm_min == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_min); |
Branch: 3 branches
| Branch | True | False | Total |
| if(t.tm_min == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_min); |
0 |
2 |
2 |
| if(t.tm_min == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_min); |
0 |
0 |
0 |
| if(t.tm_min == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_min); |
0 |
2 |
2 |
|
| 1383 |
2 |
▶ | if(t.tm_hour == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_hour); |
Branch: 3 branches
| Branch | True | False | Total |
| if(t.tm_hour == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_hour); |
0 |
2 |
2 |
| if(t.tm_hour == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_hour); |
0 |
0 |
0 |
| if(t.tm_hour == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_hour); |
0 |
2 |
2 |
|
| 1384 |
2 |
▶ | if(t.tm_mday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_mday); |
Branch: 3 branches
| Branch | True | False | Total |
| if(t.tm_mday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_mday); |
0 |
2 |
2 |
| if(t.tm_mday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_mday); |
0 |
0 |
0 |
| if(t.tm_mday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_mday); |
0 |
2 |
2 |
|
| 1385 |
2 |
▶ | if(t.tm_mon == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_mon); |
Branch: 3 branches
| Branch | True | False | Total |
| if(t.tm_mon == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_mon); |
0 |
2 |
2 |
| if(t.tm_mon == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_mon); |
0 |
0 |
0 |
| if(t.tm_mon == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_mon); |
0 |
2 |
2 |
|
| 1386 |
2 |
▶ | if(t.tm_year == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_year); |
Branch: 3 branches
| Branch | True | False | Total |
| if(t.tm_year == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_year); |
0 |
2 |
2 |
| if(t.tm_year == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_year); |
0 |
0 |
0 |
| if(t.tm_year == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_year); |
0 |
2 |
2 |
|
| 1387 |
2 |
▶ | if(t.tm_wday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_wday); |
Branch: 3 branches
| Branch | True | False | Total |
| if(t.tm_wday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_wday); |
0 |
2 |
2 |
| if(t.tm_wday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_wday); |
0 |
0 |
0 |
| if(t.tm_wday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_wday); |
0 |
2 |
2 |
|
| 1388 |
2 |
▶ | if(t.tm_yday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_yday); |
Branch: 3 branches
| Branch | True | False | Total |
| if(t.tm_yday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_yday); |
0 |
2 |
2 |
| if(t.tm_yday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_yday); |
0 |
0 |
0 |
| if(t.tm_yday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_yday); |
0 |
2 |
2 |
|
| 1389 |
2 |
▶ | if(t.tm_isdst== -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_isdst); |
Branch: 3 branches
| Branch | True | False | Total |
| if(t.tm_isdst== -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_isdst); |
0 |
2 |
2 |
| if(t.tm_isdst== -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_isdst); |
0 |
0 |
0 |
| if(t.tm_isdst== -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_isdst); |
0 |
2 |
2 |
|
| 1390 |
|
| #else |
| 1391 |
|
| errno = ENOSYS; |
| 1392 |
|
| #endif |
| 1393 |
|
| |
| 1394 |
|
| void |
| 1395 |
|
| _mktime(sec, min, hour, mday, mon, year, wday, yday, isdst) |
| 1396 |
|
| int sec |
| 1397 |
|
| int min |
| 1398 |
|
| int hour |
| 1399 |
|
| int mday |
| 1400 |
|
| int mon |
| 1401 |
|
| int year |
| 1402 |
|
| int wday |
| 1403 |
|
| int yday |
| 1404 |
|
| int isdst |
| 1405 |
|
| PREINIT: |
| 1406 |
|
| #ifdef I_TIME |
| 1407 |
|
| struct tm t; |
| 1408 |
|
| time_t ts; |
| 1409 |
|
| #endif |
| 1410 |
|
| PPCODE: |
| 1411 |
|
| #ifdef HAS_MKTIME |
| 1412 |
0 |
| t.tm_sec = sec; |
| 1413 |
0 |
| t.tm_min = min; |
| 1414 |
0 |
| t.tm_hour = hour; |
| 1415 |
0 |
| t.tm_mday = mday; |
| 1416 |
0 |
| t.tm_mon = mon; |
| 1417 |
0 |
| t.tm_year = year; |
| 1418 |
0 |
| t.tm_wday = wday; |
| 1419 |
0 |
| t.tm_yday = yday; |
| 1420 |
0 |
| t.tm_isdst = isdst; |
| 1421 |
0 |
| ts = mktime(&t); |
| 1422 |
0 |
▶ | if(ts != -1) |
Branch: 1 branch
| Branch | True | False | Total |
| if(ts != -1) |
0 |
0 |
0 |
|
| 1423 |
0 |
▶ | { mXPUSHi(ts); |
Branch: 1 branch
| Branch | True | False | Total |
| { mXPUSHi(ts); |
0 |
0 |
0 |
|
| 1424 |
0 |
▶ | if(t.tm_sec == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_sec); |
Branch: 3 branches
| Branch | True | False | Total |
| if(t.tm_sec == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_sec); |
0 |
0 |
0 |
| if(t.tm_sec == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_sec); |
0 |
0 |
0 |
| if(t.tm_sec == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_sec); |
0 |
0 |
0 |
|
| 1425 |
0 |
▶ | if(t.tm_min == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_min); |
Branch: 3 branches
| Branch | True | False | Total |
| if(t.tm_min == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_min); |
0 |
0 |
0 |
| if(t.tm_min == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_min); |
0 |
0 |
0 |
| if(t.tm_min == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_min); |
0 |
0 |
0 |
|
| 1426 |
0 |
▶ | if(t.tm_hour == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_hour); |
Branch: 3 branches
| Branch | True | False | Total |
| if(t.tm_hour == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_hour); |
0 |
0 |
0 |
| if(t.tm_hour == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_hour); |
0 |
0 |
0 |
| if(t.tm_hour == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_hour); |
0 |
0 |
0 |
|
| 1427 |
0 |
▶ | if(t.tm_mday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_mday); |
Branch: 3 branches
| Branch | True | False | Total |
| if(t.tm_mday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_mday); |
0 |
0 |
0 |
| if(t.tm_mday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_mday); |
0 |
0 |
0 |
| if(t.tm_mday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_mday); |
0 |
0 |
0 |
|
| 1428 |
0 |
▶ | if(t.tm_mon == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_mon); |
Branch: 3 branches
| Branch | True | False | Total |
| if(t.tm_mon == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_mon); |
0 |
0 |
0 |
| if(t.tm_mon == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_mon); |
0 |
0 |
0 |
| if(t.tm_mon == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_mon); |
0 |
0 |
0 |
|
| 1429 |
0 |
▶ | if(t.tm_year == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_year); |
Branch: 3 branches
| Branch | True | False | Total |
| if(t.tm_year == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_year); |
0 |
0 |
0 |
| if(t.tm_year == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_year); |
0 |
0 |
0 |
| if(t.tm_year == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_year); |
0 |
0 |
0 |
|
| 1430 |
0 |
▶ | if(t.tm_wday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_wday); |
Branch: 3 branches
| Branch | True | False | Total |
| if(t.tm_wday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_wday); |
0 |
0 |
0 |
| if(t.tm_wday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_wday); |
0 |
0 |
0 |
| if(t.tm_wday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_wday); |
0 |
0 |
0 |
|
| 1431 |
0 |
▶ | if(t.tm_yday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_yday); |
Branch: 3 branches
| Branch | True | False | Total |
| if(t.tm_yday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_yday); |
0 |
0 |
0 |
| if(t.tm_yday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_yday); |
0 |
0 |
0 |
| if(t.tm_yday == -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_yday); |
0 |
0 |
0 |
|
| 1432 |
0 |
▶ | if(t.tm_isdst== -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_isdst); |
Branch: 3 branches
| Branch | True | False | Total |
| if(t.tm_isdst== -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_isdst); |
0 |
0 |
0 |
| if(t.tm_isdst== -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_isdst); |
0 |
0 |
0 |
| if(t.tm_isdst== -1) XPUSHs(&PL_sv_undef); else mXPUSHi(t.tm_isdst); |
0 |
0 |
0 |
|
| 1433 |
|
| } |
| 1434 |
|
| #else |
| 1435 |
|
| errno = ENOSYS; |
| 1436 |
|
| #endif |
| 1437 |
|
| |
| 1438 |
|
| SV * |
| 1439 |
|
| _strftime(fmt, sec, min, hour, mday, mon, year, wday= -1, yday= -1, isdst= -1) |
| 1440 |
|
| char *fmt |
| 1441 |
|
| int sec |
| 1442 |
|
| int min |
| 1443 |
|
| int hour |
| 1444 |
|
| int mday |
| 1445 |
|
| int mon |
| 1446 |
|
| int year |
| 1447 |
|
| int wday |
| 1448 |
|
| int yday |
| 1449 |
|
| int isdst |
| 1450 |
|
| INIT: |
| 1451 |
|
| char buf[1024]; |
| 1452 |
|
| struct tm t; |
| 1453 |
|
| CODE: |
| 1454 |
|
| #ifdef HAS_STRFTIME |
| 1455 |
1 |
| t.tm_sec = sec; |
| 1456 |
1 |
| t.tm_min = min; |
| 1457 |
1 |
| t.tm_hour = hour; |
| 1458 |
1 |
| t.tm_mday = mday; |
| 1459 |
1 |
| t.tm_mon = mon; |
| 1460 |
1 |
| t.tm_year = year; |
| 1461 |
1 |
| t.tm_wday = wday; |
| 1462 |
1 |
| t.tm_yday = yday; |
| 1463 |
1 |
| t.tm_isdst = isdst; |
| 1464 |
1 |
| buf[1023] = '\0'; |
| 1465 |
1 |
| RETVAL = strftime(buf, 1024, fmt, &t)==0 ? &PL_sv_undef |
| 1466 |
1 |
▶ | : newSVpv(buf, 0); |
Branch: 1 branch
| Branch | True | False | Total |
| : newSVpv(buf, 0); |
1 |
0 |
1 |
|
| 1467 |
|
| #else |
| 1468 |
|
| errno = ENOSYS; |
| 1469 |
|
| RETVAL = &PL_sv_undef; |
| 1470 |
|
| #endif |
| 1471 |
|
| OUTPUT: |
| 1472 |
|
| RETVAL |
| 1473 |
|
| |
| 1474 |
|
| MODULE = POSIX::1003 PACKAGE = POSIX::1003::Socket |
| 1475 |
|
| |
| 1476 |
|
| HV * |
| 1477 |
|
| socket_table() |
| 1478 |
|
| PROTOTYPE: |
| 1479 |
|
| CODE: |
| 1480 |
4 |
| RETVAL = fill_socket(); |
| 1481 |
|
| OUTPUT: |
| 1482 |
|
| RETVAL |
| 1483 |
|
| |
| 1484 |
|
| |
| 1485 |
|
| MODULE = POSIX::1003 PACKAGE = POSIX::1003::Fcntl |
| 1486 |
|
| |
| 1487 |
|
| HV * |
| 1488 |
|
| fcntl_table() |
| 1489 |
|
| PROTOTYPE: |
| 1490 |
|
| CODE: |
| 1491 |
6 |
| RETVAL = fill_fcntl(); |
| 1492 |
|
| OUTPUT: |
| 1493 |
|
| RETVAL |
| 1494 |
|
| |
| 1495 |
|
| SV * |
| 1496 |
|
| _fcntl(fd, function, value) |
| 1497 |
|
| int fd |
| 1498 |
|
| SV * function |
| 1499 |
|
| int value |
| 1500 |
|
| PROTOTYPE: $$$ |
| 1501 |
|
| INIT: |
| 1502 |
|
| int ret; |
| 1503 |
|
| CODE: |
| 1504 |
|
| #ifdef HAS_FCNTL |
| 1505 |
4 |
▶ | if(SvOK(function)) |
Branch: 1 branch
| Branch | True | False | Total |
| if(SvOK(function)) |
4 |
0 |
4 |
|
| 1506 |
4 |
| { ret = fcntl(fd, SvIV(function), value); |
| 1507 |
4 |
▶ | RETVAL = ret==-1 ? &PL_sv_undef : newSVuv(ret); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = ret==-1 ? &PL_sv_undef : newSVuv(ret); |
4 |
0 |
4 |
|
| 1508 |
|
| } |
| 1509 |
|
| else |
| 1510 |
|
| { /* catch-all for all unsupported functions */ |
| 1511 |
0 |
| errno = ENOSYS; |
| 1512 |
0 |
| RETVAL = &PL_sv_undef; |
| 1513 |
|
| } |
| 1514 |
|
| #else |
| 1515 |
|
| errno = ENOSYS; |
| 1516 |
|
| RETVAL = &PL_sv_undef; |
| 1517 |
|
| #endif |
| 1518 |
|
| OUTPUT: |
| 1519 |
|
| RETVAL |
| 1520 |
|
| |
| 1521 |
|
| SV * |
| 1522 |
|
| _lock(fd, function, param) |
| 1523 |
|
| int fd |
| 1524 |
|
| int function |
| 1525 |
|
| SV * param |
| 1526 |
|
| PROTOTYPE: $$$ |
| 1527 |
|
| INIT: |
| 1528 |
|
| #ifdef HAS_FCNTL |
| 1529 |
|
| struct flock locker; |
| 1530 |
|
| SV **type, **whence, **start, **len; |
| 1531 |
|
| HV *fl, *fs; |
| 1532 |
|
| #endif |
| 1533 |
|
| CODE: |
| 1534 |
|
| #ifdef HAS_FCNTL |
| 1535 |
4 |
| fs = (HV *)SvRV(param); |
| 1536 |
4 |
| type = hv_fetch(fs, "type", 4, 0); |
| 1537 |
4 |
| whence = hv_fetch(fs, "whence", 6, 0); |
| 1538 |
4 |
| start = hv_fetch(fs, "start", 5, 0); |
| 1539 |
4 |
| len = hv_fetch(fs, "len", 3, 0); |
| 1540 |
|
| |
| 1541 |
4 |
| locker.l_type = SvIV(*type ); |
| 1542 |
4 |
| locker.l_whence = SvIV(*whence); |
| 1543 |
4 |
| locker.l_start = SvIV(*start ); |
| 1544 |
4 |
| locker.l_len = SvIV(*len ); |
| 1545 |
4 |
| locker.l_pid = 0; |
| 1546 |
|
| |
| 1547 |
4 |
▶ | if(fcntl(fd, function, &locker)==-1) |
Branch: 1 branch
| Branch | True | False | Total |
| if(fcntl(fd, function, &locker)==-1) |
0 |
4 |
4 |
|
| 1548 |
0 |
| XSRETURN_UNDEF; |
| 1549 |
|
| |
| 1550 |
4 |
| fl = newHV(); |
| 1551 |
4 |
| (void)hv_store(fl, "type", 4, newSViv(locker.l_type ), 0); |
| 1552 |
4 |
| (void)hv_store(fl, "whence", 6, newSViv(locker.l_whence), 0); |
| 1553 |
4 |
| (void)hv_store(fl, "start", 5, newSViv(locker.l_start ), 0); |
| 1554 |
4 |
| (void)hv_store(fl, "len", 3, newSViv(locker.l_len ), 0); |
| 1555 |
|
| |
| 1556 |
4 |
▶ | if(function==F_GETLK) |
Branch: 1 branch
| Branch | True | False | Total |
| if(function==F_GETLK) |
2 |
2 |
4 |
|
| 1557 |
2 |
| (void)hv_store(fl, "pid",3, newSViv(locker.l_pid ), 0); |
| 1558 |
|
| |
| 1559 |
4 |
| RETVAL = newRV_noinc((SV *)fl); |
| 1560 |
|
| #else |
| 1561 |
|
| errno = ENOSYS; |
| 1562 |
|
| RETVAL = &PL_sv_undef; |
| 1563 |
|
| #endif |
| 1564 |
|
| OUTPUT: |
| 1565 |
|
| RETVAL |
| 1566 |
|
| |
| 1567 |
|
| void |
| 1568 |
|
| _own_ex(function, fd, pid, type) |
| 1569 |
|
| int function |
| 1570 |
|
| int fd |
| 1571 |
|
| pid_t pid |
| 1572 |
|
| int type |
| 1573 |
|
| PROTOTYPE: $$$$ |
| 1574 |
|
| INIT: |
| 1575 |
|
| PPCODE: |
| 1576 |
|
| #ifdef HAS_FCNTL_OWN_EX |
| 1577 |
|
| { struct f_owner_ex ex; |
| 1578 |
0 |
| ex.type = type; |
| 1579 |
0 |
| ex.pid = pid; |
| 1580 |
|
| |
| 1581 |
0 |
▶ | if(fcntl(fd, function, &ex)==-1) |
Branch: 1 branch
| Branch | True | False | Total |
| if(fcntl(fd, function, &ex)==-1) |
0 |
0 |
0 |
|
| 1582 |
0 |
| return; |
| 1583 |
|
| |
| 1584 |
0 |
▶ | XPUSHs(sv_2mortal(newSVuv(ex.type))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVuv(ex.type))); |
0 |
0 |
0 |
|
| 1585 |
0 |
▶ | XPUSHs(sv_2mortal(newSVuv(ex.pid))); |
Branch: 1 branch
| Branch | True | False | Total |
| XPUSHs(sv_2mortal(newSVuv(ex.pid))); |
0 |
0 |
0 |
|
| 1586 |
|
| } |
| 1587 |
|
| #else |
| 1588 |
|
| errno = ENOSYS; |
| 1589 |
|
| #endif |
| 1590 |
|
| |
| 1591 |
|
| SV * |
| 1592 |
|
| _flock(fd, function) |
| 1593 |
|
| int fd |
| 1594 |
|
| int function |
| 1595 |
|
| PROTOTYPE: $$ |
| 1596 |
|
| INIT: |
| 1597 |
|
| int ret; |
| 1598 |
|
| CODE: |
| 1599 |
|
| #ifdef HAS_FLOCK |
| 1600 |
0 |
| ret = flock(fd, function); |
| 1601 |
0 |
▶ | RETVAL = ret==-1 ? &PL_sv_undef : newSVuv(ret); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = ret==-1 ? &PL_sv_undef : newSVuv(ret); |
0 |
0 |
0 |
|
| 1602 |
|
| #else |
| 1603 |
|
| errno = ENOSYS; |
| 1604 |
|
| RETVAL = &PL_sv_undef; |
| 1605 |
|
| #endif |
| 1606 |
|
| OUTPUT: |
| 1607 |
|
| RETVAL |
| 1608 |
|
| |
| 1609 |
|
| SV * |
| 1610 |
|
| _lockf(fd, function, len) |
| 1611 |
|
| int fd |
| 1612 |
|
| int function |
| 1613 |
|
| off_t len |
| 1614 |
|
| PROTOTYPE: $$$ |
| 1615 |
|
| INIT: |
| 1616 |
|
| int ret; |
| 1617 |
|
| CODE: |
| 1618 |
|
| #ifdef HAS_LOCKF |
| 1619 |
0 |
| ret = lockf(fd, function, len); |
| 1620 |
0 |
▶ | RETVAL = ret==-1 ? &PL_sv_undef : newSVuv(ret); |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = ret==-1 ? &PL_sv_undef : newSVuv(ret); |
0 |
0 |
0 |
|
| 1621 |
|
| #else |
| 1622 |
|
| errno = ENOSYS; |
| 1623 |
|
| RETVAL = &PL_sv_undef; |
| 1624 |
|
| #endif |
| 1625 |
|
| OUTPUT: |
| 1626 |
|
| RETVAL |
| 1627 |
|
| |
| 1628 |
|
| |