This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
POSIX: Check fds against negatives.
[perl5.git] / ext / POSIX / typemap
CommitLineData
a0d0e21e 1Mode_t T_NV
86200d5c 2pid_t T_NV
a0d0e21e
LW
3Uid_t T_NV
4Time_t T_NV
5Gid_t T_NV
a043a685 6Uid_t T_NV
a0d0e21e 7Off_t T_NV
14a3f258 8Dev_t T_NV
e1ca407b 9NV T_NV
a0d0e21e
LW
10fd T_IV
11speed_t T_IV
12tcflag_t T_IV
13cc_t T_IV
92b39396 14POSIX::SigSet T_OPAQUEPTROBJ
11a39fe4 15POSIX::Termios T_OPAQUEPTROBJ
a0d0e21e 16POSIX::SigAction T_HVREF
69b5fd06 17POSIX::SigNo T_SIGNO
ddc7c5c7 18POSIX::Fd T_FD
11a39fe4
NC
19
20INPUT
21T_OPAQUEPTROBJ
42c07143
DD
22 {
23 SV * sv = $arg;
24 if (SvROK(sv) && sv_derived_from(sv, \"${ntype}\"))
25 $var = ($type)SvPV_nolen(SvRV(sv));
26 else
27 croak(\"%s: %s is not of type %s\",
28 ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
29 \"$var\", \"$ntype\");
11a39fe4 30 }
11a39fe4 31
69b5fd06
JH
32T_SIGNO
33 if ((sig = SvIV($arg)) < 0) {
34 croak(\"%s: Negative signals are not allowed %d\",
35 ${$ALIAS?\q[GvNAME(CvGV(cv))]:\qq[\"$pname\"]},
36 sig);
37 }
38
ddc7c5c7
JH
39T_FD
40 if ((fd = (int)SvIV($arg)) < 0) {
41 SETERRNO(EBADF, RMS_IFI);
42 XSRETURN_IV(-1);
43 }
44
11a39fe4
NC
45OUTPUT
46T_OPAQUEPTROBJ
47 sv_setref_pvn($arg, \"${ntype}\", (const char*)$var, sizeof(*$var));