2 #define PERLIO_NOT_STDIO 1
6 #ifdef I_DIRENT /* XXX maybe better to just rely on perl.h? */
29 /* XXX This comment is just to make I_TERMIO and I_SGTTY visible to
30 metaconfig for future extension writers. We don't use them in POSIX.
31 (This is really sneaky :-) --AD
33 #if defined(I_TERMIOS)
41 #include <sys/types.h>
43 #include <unistd.h> /* see hints/sunos_4_1.sh */
46 #if defined(__VMS) && !defined(__POSIX_SOURCE)
47 # include <libdef.h> /* LIB$_INVARG constant */
48 # include <lib$routines.h> /* prototype for lib$ediv() */
49 # include <starlet.h> /* prototype for sys$gettim() */
50 # if DECC_VERSION < 50000000
51 # define pid_t int /* old versions of DECC miss this in types.h */
54 # undef mkfifo /* #defined in perl.h */
55 # define mkfifo(a,b) (not_here("mkfifo"),-1)
56 # define tzset() not_here("tzset")
58 #if ((__VMS_VER >= 70000000) && (__DECC_VER >= 50200000)) || (__CRTL_VER >= 70000000)
59 # define HAS_TZNAME /* shows up in VMS 7.0 or Dec C 5.6 */
62 /* The default VMS emulation of Unix signals isn't very POSIXish */
64 # define sigpending(a) (not_here("sigpending"),0)
66 /* sigset_t is atomic under VMS, so these routines are easy */
67 int sigemptyset(sigset_t *set) {
68 if (!set) { SETERRNO(EFAULT,SS$_ACCVIO); return -1; }
71 int sigfillset(sigset_t *set) {
73 if (!set) { SETERRNO(EFAULT,SS$_ACCVIO); return -1; }
74 for (i = 0; i < NSIG; i++) *set |= (1 << i);
77 int sigaddset(sigset_t *set, int sig) {
78 if (!set) { SETERRNO(EFAULT,SS$_ACCVIO); return -1; }
79 if (sig > NSIG) { SETERRNO(EINVAL,LIB$_INVARG); return -1; }
80 *set |= (1 << (sig - 1));
83 int sigdelset(sigset_t *set, int sig) {
84 if (!set) { SETERRNO(EFAULT,SS$_ACCVIO); return -1; }
85 if (sig > NSIG) { SETERRNO(EINVAL,LIB$_INVARG); return -1; }
86 *set &= ~(1 << (sig - 1));
89 int sigismember(sigset_t *set, int sig) {
90 if (!set) { SETERRNO(EFAULT,SS$_ACCVIO); return -1; }
91 if (sig > NSIG) { SETERRNO(EINVAL,LIB$_INVARG); return -1; }
92 *set & (1 << (sig - 1));
94 /* The tools for sigprocmask() are there, just not the routine itself */
96 # define SIG_UNBLOCK 1
102 # define SIG_SETMASK 3
104 int sigprocmask(int how, sigset_t *set, sigset_t *oset) {
106 set_errno(EFAULT); set_vaxc_errno(SS$_ACCVIO);
111 *oset = sigsetmask(*set);
114 *oset = sigblock(*set);
118 sigsetmask(*oset & ~*set);
121 set_errno(EINVAL); set_vaxc_errno(LIB$_INVARG);
126 # define sigaction sigvec
127 # define sa_flags sv_onstack
128 # define sa_handler sv_handler
129 # define sa_mask sv_mask
130 # define sigsuspend(set) sigpause(*set)
131 # endif /* __VMS_VER >= 70000000 or Dec C 5.6 */
133 /* The POSIX notion of ttyname() is better served by getname() under VMS */
134 static char ttnambuf[64];
135 # define ttyname(fd) (isatty(fd) > 0 ? getname(fd,ttnambuf,0) : NULL)
137 /* The non-POSIX CRTL times() has void return type, so we just get the
138 current time directly */
139 clock_t vms_times(struct tms *bufptr) {
141 /* Get wall time and convert to 10 ms intervals to
142 * produce the return value that the POSIX standard expects */
143 # if defined(__DECC) && defined (__ALPHA)
146 _ckvmssts(sys$gettim(&vmstime));
148 retval = vmstime & 0x7fffffff;
150 /* (Older hw or ccs don't have an atomic 64-bit type, so we
151 * juggle 32-bit ints (and a float) to produce a time_t result
152 * with minimal loss of information.) */
153 long int vmstime[2],remainder,divisor = 100000;
154 _ckvmssts(sys$gettim((unsigned long int *)vmstime));
155 vmstime[1] &= 0x7fff; /* prevent overflow in EDIV */
156 _ckvmssts(lib$ediv(&divisor,vmstime,(long int *)&retval,&remainder));
158 /* Fill in the struct tms using the CRTL routine . . .*/
159 times((tbuffer_t *)bufptr);
160 return (clock_t) retval;
162 # define times(t) vms_times(t)
165 # include <sys/times.h>
167 # include <sys/utsname.h>
169 # include <sys/wait.h>
176 typedef long SysRetLong;
177 typedef sigset_t* POSIX__SigSet;
178 typedef HV* POSIX__SigAction;
180 typedef struct termios* POSIX__Termios;
181 #else /* Define termios types to int, and call not_here for the functions.*/
182 #define POSIX__Termios int
186 #define cfgetispeed(x) not_here("cfgetispeed")
187 #define cfgetospeed(x) not_here("cfgetospeed")
188 #define tcdrain(x) not_here("tcdrain")
189 #define tcflush(x,y) not_here("tcflush")
190 #define tcsendbreak(x,y) not_here("tcsendbreak")
191 #define cfsetispeed(x,y) not_here("cfsetispeed")
192 #define cfsetospeed(x,y) not_here("cfsetospeed")
193 #define ctermid(x) (char *) not_here("ctermid")
194 #define tcflow(x,y) not_here("tcflow")
195 #define tcgetattr(x,y) not_here("tcgetattr")
196 #define tcsetattr(x,y,z) not_here("tcsetattr")
199 /* Possibly needed prototypes */
200 char *cuserid _((char *));
201 double strtod _((const char *, char **));
202 long strtol _((const char *, char **, int));
203 unsigned long strtoul _((const char *, char **, int));
206 #define cuserid(a) (char *) not_here("cuserid")
210 #define difftime(a,b) not_here("difftime")
213 #ifndef HAS_FPATHCONF
214 #define fpathconf(f,n) (SysRetLong) not_here("fpathconf")
217 #define mktime(a) not_here("mktime")
220 #define nice(a) not_here("nice")
223 #define pathconf(f,n) (SysRetLong) not_here("pathconf")
226 #define sysconf(n) (SysRetLong) not_here("sysconf")
229 #define readlink(a,b,c) not_here("readlink")
232 #define setpgid(a,b) not_here("setpgid")
235 #define setsid() not_here("setsid")
238 #define strcoll(s1,s2) not_here("strcoll")
241 #define strtod(s1,s2) not_here("strtod")
244 #define strtol(s1,s2,b) not_here("strtol")
247 #define strtoul(s1,s2,b) not_here("strtoul")
250 #define strxfrm(s1,s2,n) not_here("strxfrm")
252 #ifndef HAS_TCGETPGRP
253 #define tcgetpgrp(a) not_here("tcgetpgrp")
255 #ifndef HAS_TCSETPGRP
256 #define tcsetpgrp(a,b) not_here("tcsetpgrp")
259 #define times(a) not_here("times")
262 #define uname(a) not_here("uname")
265 #define waitpid(a,b,c) not_here("waitpid")
270 #define mblen(a,b) not_here("mblen")
274 #define mbstowcs(s, pwcs, n) not_here("mbstowcs")
277 #define mbtowc(pwc, s, n) not_here("mbtowc")
280 #define wcstombs(s, pwcs, n) not_here("wcstombs")
283 #define wctomb(s, wchar) not_here("wcstombs")
285 #if !defined(HAS_MBLEN) && !defined(HAS_MBSTOWCS) && !defined(HAS_MBTOWC) && !defined(HAS_WCSTOMBS) && !defined(HAS_WCTOMB)
286 /* If we don't have these functions, then we wouldn't have gotten a typedef
287 for wchar_t, the wide character type. Defining wchar_t allows the
288 functions referencing it to compile. Its actual type is then meaningless,
289 since without the above functions, all sections using it end up calling
290 not_here() and croak. --Kaveh Ghazi (ghazi@noc.rutgers.edu) 9/18/94. */
296 #ifndef HAS_LOCALECONV
297 #define localeconv() not_here("localeconv")
301 extern char *tzname[];
303 char *tzname[] = { "" , "" };
306 /* XXX struct tm on some systems (SunOS4/BSD) contains extra (non POSIX)
307 * fields for which we don't have Configure support yet:
308 * char *tm_zone; -- abbreviation of timezone name
309 * long tm_gmtoff; -- offset from GMT in seconds
310 * To workaround core dumps from the uninitialised tm_zone we get the
311 * system to give us a reasonable struct to copy. This fix means that
312 * strftime uses the tm_zone and tm_gmtoff values returned by
313 * localtime(time()). That should give the desired result most of the
314 * time. But probably not always!
316 * This is a temporary workaround to be removed once Configure
317 * support is added and NETaa14816 is considered in full.
318 * It does not address tzname aspects of NETaa14816.
320 #ifdef STRUCT_TM_HASZONE
322 init_tm(ptm) /* see mktime, strftime and asctime */
327 Copy(localtime(&now), ptm, 1, struct tm);
331 # define init_tm(ptm)
335 #ifndef HAS_LONG_DOUBLE /* XXX What to do about long doubles? */
351 croak("POSIX::%s not implemented on this architecture", s);
363 if (strEQ(name, "ARG_MAX"))
371 if (strEQ(name, "BUFSIZ"))
377 if (strEQ(name, "BRKINT"))
383 if (strEQ(name, "B9600"))
389 if (strEQ(name, "B19200"))
395 if (strEQ(name, "B38400"))
401 if (strEQ(name, "B0"))
407 if (strEQ(name, "B110"))
413 if (strEQ(name, "B1200"))
419 if (strEQ(name, "B134"))
425 if (strEQ(name, "B150"))
431 if (strEQ(name, "B1800"))
437 if (strEQ(name, "B200"))
443 if (strEQ(name, "B2400"))
449 if (strEQ(name, "B300"))
455 if (strEQ(name, "B4800"))
461 if (strEQ(name, "B50"))
467 if (strEQ(name, "B600"))
473 if (strEQ(name, "B75"))
481 if (strEQ(name, "CHAR_BIT"))
487 if (strEQ(name, "CHAR_MAX"))
493 if (strEQ(name, "CHAR_MIN"))
499 if (strEQ(name, "CHILD_MAX"))
505 if (strEQ(name, "CLK_TCK"))
511 if (strEQ(name, "CLOCAL"))
517 if (strEQ(name, "CLOCKS_PER_SEC"))
518 #ifdef CLOCKS_PER_SEC
519 return CLOCKS_PER_SEC;
523 if (strEQ(name, "CREAD"))
529 if (strEQ(name, "CS5"))
535 if (strEQ(name, "CS6"))
541 if (strEQ(name, "CS7"))
547 if (strEQ(name, "CS8"))
553 if (strEQ(name, "CSIZE"))
559 if (strEQ(name, "CSTOPB"))
567 if (strEQ(name, "DBL_MAX"))
573 if (strEQ(name, "DBL_MIN"))
579 if (strEQ(name, "DBL_DIG"))
585 if (strEQ(name, "DBL_EPSILON"))
591 if (strEQ(name, "DBL_MANT_DIG"))
597 if (strEQ(name, "DBL_MAX_10_EXP"))
598 #ifdef DBL_MAX_10_EXP
599 return DBL_MAX_10_EXP;
603 if (strEQ(name, "DBL_MAX_EXP"))
609 if (strEQ(name, "DBL_MIN_10_EXP"))
610 #ifdef DBL_MIN_10_EXP
611 return DBL_MIN_10_EXP;
615 if (strEQ(name, "DBL_MIN_EXP"))
625 if (strEQ(name, "EACCES"))
631 if (strEQ(name, "EADDRINUSE"))
637 if (strEQ(name, "EADDRNOTAVAIL"))
639 return EADDRNOTAVAIL;
643 if (strEQ(name, "EAFNOSUPPORT"))
649 if (strEQ(name, "EAGAIN"))
655 if (strEQ(name, "EALREADY"))
663 if (strEQ(name, "EBADF"))
669 if (strEQ(name, "EBUSY"))
677 if (strEQ(name, "ECHILD"))
683 if (strEQ(name, "ECHO"))
689 if (strEQ(name, "ECHOE"))
695 if (strEQ(name, "ECHOK"))
701 if (strEQ(name, "ECHONL"))
707 if (strEQ(name, "ECONNABORTED"))
713 if (strEQ(name, "ECONNREFUSED"))
719 if (strEQ(name, "ECONNRESET"))
727 if (strEQ(name, "EDEADLK"))
733 if (strEQ(name, "EDESTADDRREQ"))
739 if (strEQ(name, "EDOM"))
745 if (strEQ(name, "EDQUOT"))
753 if (strEQ(name, "EEXIST"))
761 if (strEQ(name, "EFAULT"))
767 if (strEQ(name, "EFBIG"))
775 if (strEQ(name, "EHOSTDOWN"))
781 if (strEQ(name, "EHOSTUNREACH"))
789 if (strEQ(name, "EINPROGRESS"))
795 if (strEQ(name, "EINTR"))
801 if (strEQ(name, "EINVAL"))
807 if (strEQ(name, "EIO"))
813 if (strEQ(name, "EISCONN"))
819 if (strEQ(name, "EISDIR"))
825 if (strEQ(name, "ELOOP"))
833 if (strEQ(name, "EMFILE"))
839 if (strEQ(name, "EMLINK"))
845 if (strEQ(name, "EMSGSIZE"))
853 if (strEQ(name, "ENETDOWN"))
859 if (strEQ(name, "ENETRESET"))
865 if (strEQ(name, "ENETUNREACH"))
871 if (strEQ(name, "ENOBUFS"))
877 if (strEQ(name, "ENOEXEC"))
883 if (strEQ(name, "ENOMEM"))
889 if (strEQ(name, "ENOPROTOOPT"))
895 if (strEQ(name, "ENOSPC"))
901 if (strEQ(name, "ENOTBLK"))
907 if (strEQ(name, "ENOTCONN"))
913 if (strEQ(name, "ENOTDIR"))
919 if (strEQ(name, "ENOTEMPTY"))
925 if (strEQ(name, "ENOTSOCK"))
931 if (strEQ(name, "ENOTTY"))
937 if (strEQ(name, "ENFILE"))
943 if (strEQ(name, "ENODEV"))
949 if (strEQ(name, "ENOENT"))
955 if (strEQ(name, "ENOLCK"))
961 if (strEQ(name, "ENOSYS"))
967 if (strEQ(name, "ENXIO"))
973 if (strEQ(name, "ENAMETOOLONG"))
981 if (strEQ(name, "EOF"))
987 if (strEQ(name, "EOPNOTSUPP"))
995 if (strEQ(name, "EPERM"))
1001 if (strEQ(name, "EPFNOSUPPORT"))
1003 return EPFNOSUPPORT;
1007 if (strEQ(name, "EPIPE"))
1013 if (strEQ(name, "EPROCLIM"))
1019 if (strEQ(name, "EPROTONOSUPPORT"))
1020 #ifdef EPROTONOSUPPORT
1021 return EPROTONOSUPPORT;
1025 if (strEQ(name, "EPROTOTYPE"))
1033 if (strEQ(name, "ERANGE"))
1039 if (strEQ(name, "EREMOTE"))
1045 if (strEQ(name, "ERESTART"))
1051 if (strEQ(name, "EROFS"))
1059 if (strEQ(name, "ESHUTDOWN"))
1065 if (strEQ(name, "ESOCKTNOSUPPORT"))
1066 #ifdef ESOCKTNOSUPPORT
1067 return ESOCKTNOSUPPORT;
1071 if (strEQ(name, "ESPIPE"))
1077 if (strEQ(name, "ESRCH"))
1083 if (strEQ(name, "ESTALE"))
1091 if (strEQ(name, "ETIMEDOUT"))
1097 if (strEQ(name, "ETOOMANYREFS"))
1099 return ETOOMANYREFS;
1103 if (strEQ(name, "ETXTBSY"))
1111 if (strEQ(name, "EUSERS"))
1119 if (strEQ(name, "EWOULDBLOCK"))
1127 if (strEQ(name, "EXIT_FAILURE"))
1129 return EXIT_FAILURE;
1133 if (strEQ(name, "EXIT_SUCCESS"))
1135 return EXIT_SUCCESS;
1139 if (strEQ(name, "EXDEV"))
1147 if (strEQ(name, "E2BIG"))
1155 if (strnEQ(name, "FLT_", 4)) {
1156 if (strEQ(name, "FLT_MAX"))
1162 if (strEQ(name, "FLT_MIN"))
1168 if (strEQ(name, "FLT_ROUNDS"))
1174 if (strEQ(name, "FLT_DIG"))
1180 if (strEQ(name, "FLT_EPSILON"))
1186 if (strEQ(name, "FLT_MANT_DIG"))
1188 return FLT_MANT_DIG;
1192 if (strEQ(name, "FLT_MAX_10_EXP"))
1193 #ifdef FLT_MAX_10_EXP
1194 return FLT_MAX_10_EXP;
1198 if (strEQ(name, "FLT_MAX_EXP"))
1204 if (strEQ(name, "FLT_MIN_10_EXP"))
1205 #ifdef FLT_MIN_10_EXP
1206 return FLT_MIN_10_EXP;
1210 if (strEQ(name, "FLT_MIN_EXP"))
1216 if (strEQ(name, "FLT_RADIX"))
1224 if (strnEQ(name, "F_", 2)) {
1225 if (strEQ(name, "F_DUPFD"))
1231 if (strEQ(name, "F_GETFD"))
1237 if (strEQ(name, "F_GETFL"))
1243 if (strEQ(name, "F_GETLK"))
1249 if (strEQ(name, "F_OK"))
1255 if (strEQ(name, "F_RDLCK"))
1261 if (strEQ(name, "F_SETFD"))
1267 if (strEQ(name, "F_SETFL"))
1273 if (strEQ(name, "F_SETLK"))
1279 if (strEQ(name, "F_SETLKW"))
1285 if (strEQ(name, "F_UNLCK"))
1291 if (strEQ(name, "F_WRLCK"))
1299 if (strEQ(name, "FD_CLOEXEC"))
1305 if (strEQ(name, "FILENAME_MAX"))
1307 return FILENAME_MAX;
1313 if (strEQ(name, "HUGE_VAL"))
1319 if (strEQ(name, "HUPCL"))
1327 if (strEQ(name, "INT_MAX"))
1333 if (strEQ(name, "INT_MIN"))
1339 if (strEQ(name, "ICANON"))
1345 if (strEQ(name, "ICRNL"))
1351 if (strEQ(name, "IEXTEN"))
1357 if (strEQ(name, "IGNBRK"))
1363 if (strEQ(name, "IGNCR"))
1369 if (strEQ(name, "IGNPAR"))
1375 if (strEQ(name, "INLCR"))
1381 if (strEQ(name, "INPCK"))
1387 if (strEQ(name, "ISIG"))
1393 if (strEQ(name, "ISTRIP"))
1399 if (strEQ(name, "IXOFF"))
1405 if (strEQ(name, "IXON"))
1413 if (strnEQ(name, "LC_", 3)) {
1414 if (strEQ(name, "LC_ALL"))
1420 if (strEQ(name, "LC_COLLATE"))
1426 if (strEQ(name, "LC_CTYPE"))
1432 if (strEQ(name, "LC_MONETARY"))
1438 if (strEQ(name, "LC_NUMERIC"))
1444 if (strEQ(name, "LC_TIME"))
1452 if (strnEQ(name, "LDBL_", 5)) {
1453 if (strEQ(name, "LDBL_MAX"))
1459 if (strEQ(name, "LDBL_MIN"))
1465 if (strEQ(name, "LDBL_DIG"))
1471 if (strEQ(name, "LDBL_EPSILON"))
1473 return LDBL_EPSILON;
1477 if (strEQ(name, "LDBL_MANT_DIG"))
1478 #ifdef LDBL_MANT_DIG
1479 return LDBL_MANT_DIG;
1483 if (strEQ(name, "LDBL_MAX_10_EXP"))
1484 #ifdef LDBL_MAX_10_EXP
1485 return LDBL_MAX_10_EXP;
1489 if (strEQ(name, "LDBL_MAX_EXP"))
1491 return LDBL_MAX_EXP;
1495 if (strEQ(name, "LDBL_MIN_10_EXP"))
1496 #ifdef LDBL_MIN_10_EXP
1497 return LDBL_MIN_10_EXP;
1501 if (strEQ(name, "LDBL_MIN_EXP"))
1503 return LDBL_MIN_EXP;
1509 if (strnEQ(name, "L_", 2)) {
1510 if (strEQ(name, "L_ctermid"))
1516 if (strEQ(name, "L_cuserid"))
1522 if (strEQ(name, "L_tmpname"))
1530 if (strEQ(name, "LONG_MAX"))
1536 if (strEQ(name, "LONG_MIN"))
1542 if (strEQ(name, "LINK_MAX"))
1550 if (strEQ(name, "MAX_CANON"))
1556 if (strEQ(name, "MAX_INPUT"))
1562 if (strEQ(name, "MB_CUR_MAX"))
1568 if (strEQ(name, "MB_LEN_MAX"))
1576 if (strEQ(name, "NULL")) return 0;
1577 if (strEQ(name, "NAME_MAX"))
1583 if (strEQ(name, "NCCS"))
1589 if (strEQ(name, "NGROUPS_MAX"))
1595 if (strEQ(name, "NOFLSH"))
1603 if (strnEQ(name, "O_", 2)) {
1604 if (strEQ(name, "O_APPEND"))
1610 if (strEQ(name, "O_CREAT"))
1616 if (strEQ(name, "O_TRUNC"))
1622 if (strEQ(name, "O_RDONLY"))
1628 if (strEQ(name, "O_RDWR"))
1634 if (strEQ(name, "O_WRONLY"))
1640 if (strEQ(name, "O_EXCL"))
1646 if (strEQ(name, "O_NOCTTY"))
1652 if (strEQ(name, "O_NONBLOCK"))
1658 if (strEQ(name, "O_ACCMODE"))
1666 if (strEQ(name, "OPEN_MAX"))
1672 if (strEQ(name, "OPOST"))
1680 if (strEQ(name, "PATH_MAX"))
1686 if (strEQ(name, "PARENB"))
1692 if (strEQ(name, "PARMRK"))
1698 if (strEQ(name, "PARODD"))
1704 if (strEQ(name, "PIPE_BUF"))
1712 if (strEQ(name, "RAND_MAX"))
1718 if (strEQ(name, "R_OK"))
1726 if (strnEQ(name, "SIG", 3)) {
1727 if (name[3] == '_') {
1728 if (strEQ(name, "SIG_BLOCK"))
1735 if (strEQ(name, "SIG_DFL")) return (IV)SIG_DFL;
1738 if (strEQ(name, "SIG_ERR")) return (IV)SIG_ERR;
1741 if (strEQ(name, "SIG_IGN")) return (IV)SIG_IGN;
1743 if (strEQ(name, "SIG_SETMASK"))
1749 if (strEQ(name, "SIG_UNBLOCK"))
1757 if (strEQ(name, "SIGABRT"))
1763 if (strEQ(name, "SIGALRM"))
1769 if (strEQ(name, "SIGCHLD"))
1775 if (strEQ(name, "SIGCONT"))
1781 if (strEQ(name, "SIGFPE"))
1787 if (strEQ(name, "SIGHUP"))
1793 if (strEQ(name, "SIGILL"))
1799 if (strEQ(name, "SIGINT"))
1805 if (strEQ(name, "SIGKILL"))
1811 if (strEQ(name, "SIGPIPE"))
1817 if (strEQ(name, "SIGQUIT"))
1823 if (strEQ(name, "SIGSEGV"))
1829 if (strEQ(name, "SIGSTOP"))
1835 if (strEQ(name, "SIGTERM"))
1841 if (strEQ(name, "SIGTSTP"))
1847 if (strEQ(name, "SIGTTIN"))
1853 if (strEQ(name, "SIGTTOU"))
1859 if (strEQ(name, "SIGUSR1"))
1865 if (strEQ(name, "SIGUSR2"))
1873 if (name[1] == '_') {
1874 if (strEQ(name, "S_ISGID"))
1880 if (strEQ(name, "S_ISUID"))
1886 if (strEQ(name, "S_IRGRP"))
1892 if (strEQ(name, "S_IROTH"))
1898 if (strEQ(name, "S_IRUSR"))
1904 if (strEQ(name, "S_IRWXG"))
1910 if (strEQ(name, "S_IRWXO"))
1916 if (strEQ(name, "S_IRWXU"))
1922 if (strEQ(name, "S_IWGRP"))
1928 if (strEQ(name, "S_IWOTH"))
1934 if (strEQ(name, "S_IWUSR"))
1940 if (strEQ(name, "S_IXGRP"))
1946 if (strEQ(name, "S_IXOTH"))
1952 if (strEQ(name, "S_IXUSR"))
1958 errno = EAGAIN; /* the following aren't constants */
1960 if (strEQ(name, "S_ISBLK")) return S_ISBLK(arg);
1963 if (strEQ(name, "S_ISCHR")) return S_ISCHR(arg);
1966 if (strEQ(name, "S_ISDIR")) return S_ISDIR(arg);
1969 if (strEQ(name, "S_ISFIFO")) return S_ISFIFO(arg);
1972 if (strEQ(name, "S_ISREG")) return S_ISREG(arg);
1976 if (strEQ(name, "SEEK_CUR"))
1982 if (strEQ(name, "SEEK_END"))
1988 if (strEQ(name, "SEEK_SET"))
1994 if (strEQ(name, "STREAM_MAX"))
2000 if (strEQ(name, "SHRT_MAX"))
2006 if (strEQ(name, "SHRT_MIN"))
2012 if (strnEQ(name, "SA_", 3)) {
2013 if (strEQ(name, "SA_NOCLDSTOP"))
2015 return SA_NOCLDSTOP;
2019 if (strEQ(name, "SA_NOCLDWAIT"))
2021 return SA_NOCLDWAIT;
2025 if (strEQ(name, "SA_NODEFER"))
2031 if (strEQ(name, "SA_ONSTACK"))
2037 if (strEQ(name, "SA_RESETHAND"))
2039 return SA_RESETHAND;
2043 if (strEQ(name, "SA_RESTART"))
2049 if (strEQ(name, "SA_SIGINFO"))
2057 if (strEQ(name, "SCHAR_MAX"))
2063 if (strEQ(name, "SCHAR_MIN"))
2069 if (strEQ(name, "SSIZE_MAX"))
2075 if (strEQ(name, "STDIN_FILENO"))
2077 return STDIN_FILENO;
2081 if (strEQ(name, "STDOUT_FILENO"))
2082 #ifdef STDOUT_FILENO
2083 return STDOUT_FILENO;
2087 if (strEQ(name, "STRERR_FILENO"))
2088 #ifdef STRERR_FILENO
2089 return STRERR_FILENO;
2095 if (strEQ(name, "TCIFLUSH"))
2101 if (strEQ(name, "TCIOFF"))
2107 if (strEQ(name, "TCIOFLUSH"))
2113 if (strEQ(name, "TCION"))
2119 if (strEQ(name, "TCOFLUSH"))
2125 if (strEQ(name, "TCOOFF"))
2131 if (strEQ(name, "TCOON"))
2137 if (strEQ(name, "TCSADRAIN"))
2143 if (strEQ(name, "TCSAFLUSH"))
2149 if (strEQ(name, "TCSANOW"))
2155 if (strEQ(name, "TMP_MAX"))
2161 if (strEQ(name, "TOSTOP"))
2167 if (strEQ(name, "TZNAME_MAX"))
2175 if (strEQ(name, "UCHAR_MAX"))
2181 if (strEQ(name, "UINT_MAX"))
2187 if (strEQ(name, "ULONG_MAX"))
2193 if (strEQ(name, "USHRT_MAX"))
2201 if (strEQ(name, "VEOF"))
2207 if (strEQ(name, "VEOL"))
2213 if (strEQ(name, "VERASE"))
2219 if (strEQ(name, "VINTR"))
2225 if (strEQ(name, "VKILL"))
2231 if (strEQ(name, "VMIN"))
2237 if (strEQ(name, "VQUIT"))
2243 if (strEQ(name, "VSTART"))
2249 if (strEQ(name, "VSTOP"))
2255 if (strEQ(name, "VSUSP"))
2261 if (strEQ(name, "VTIME"))
2269 if (strEQ(name, "W_OK"))
2275 if (strEQ(name, "WNOHANG"))
2281 if (strEQ(name, "WUNTRACED"))
2287 errno = EAGAIN; /* the following aren't constants */
2289 if (strEQ(name, "WEXITSTATUS")) return WEXITSTATUS(arg);
2292 if (strEQ(name, "WIFEXITED")) return WIFEXITED(arg);
2295 if (strEQ(name, "WIFSIGNALED")) return WIFSIGNALED(arg);
2298 if (strEQ(name, "WIFSTOPPED")) return WIFSTOPPED(arg);
2301 if (strEQ(name, "WSTOPSIG")) return WSTOPSIG(arg);
2304 if (strEQ(name, "WTERMSIG")) return WTERMSIG(arg);
2308 if (strEQ(name, "X_OK"))
2316 if (strnEQ(name, "_PC_", 4)) {
2317 if (strEQ(name, "_PC_CHOWN_RESTRICTED"))
2318 #ifdef _PC_CHOWN_RESTRICTED
2319 return _PC_CHOWN_RESTRICTED;
2323 if (strEQ(name, "_PC_LINK_MAX"))
2325 return _PC_LINK_MAX;
2329 if (strEQ(name, "_PC_MAX_CANON"))
2330 #ifdef _PC_MAX_CANON
2331 return _PC_MAX_CANON;
2335 if (strEQ(name, "_PC_MAX_INPUT"))
2336 #ifdef _PC_MAX_INPUT
2337 return _PC_MAX_INPUT;
2341 if (strEQ(name, "_PC_NAME_MAX"))
2343 return _PC_NAME_MAX;
2347 if (strEQ(name, "_PC_NO_TRUNC"))
2349 return _PC_NO_TRUNC;
2353 if (strEQ(name, "_PC_PATH_MAX"))
2355 return _PC_PATH_MAX;
2359 if (strEQ(name, "_PC_PIPE_BUF"))
2361 return _PC_PIPE_BUF;
2365 if (strEQ(name, "_PC_VDISABLE"))
2367 return _PC_VDISABLE;
2373 if (strnEQ(name, "_POSIX_", 7)) {
2374 if (strEQ(name, "_POSIX_ARG_MAX"))
2375 #ifdef _POSIX_ARG_MAX
2376 return _POSIX_ARG_MAX;
2380 if (strEQ(name, "_POSIX_CHILD_MAX"))
2381 #ifdef _POSIX_CHILD_MAX
2382 return _POSIX_CHILD_MAX;
2386 if (strEQ(name, "_POSIX_CHOWN_RESTRICTED"))
2387 #ifdef _POSIX_CHOWN_RESTRICTED
2388 return _POSIX_CHOWN_RESTRICTED;
2392 if (strEQ(name, "_POSIX_JOB_CONTROL"))
2393 #ifdef _POSIX_JOB_CONTROL
2394 return _POSIX_JOB_CONTROL;
2398 if (strEQ(name, "_POSIX_LINK_MAX"))
2399 #ifdef _POSIX_LINK_MAX
2400 return _POSIX_LINK_MAX;
2404 if (strEQ(name, "_POSIX_MAX_CANON"))
2405 #ifdef _POSIX_MAX_CANON
2406 return _POSIX_MAX_CANON;
2410 if (strEQ(name, "_POSIX_MAX_INPUT"))
2411 #ifdef _POSIX_MAX_INPUT
2412 return _POSIX_MAX_INPUT;
2416 if (strEQ(name, "_POSIX_NAME_MAX"))
2417 #ifdef _POSIX_NAME_MAX
2418 return _POSIX_NAME_MAX;
2422 if (strEQ(name, "_POSIX_NGROUPS_MAX"))
2423 #ifdef _POSIX_NGROUPS_MAX
2424 return _POSIX_NGROUPS_MAX;
2428 if (strEQ(name, "_POSIX_NO_TRUNC"))
2429 #ifdef _POSIX_NO_TRUNC
2430 return _POSIX_NO_TRUNC;
2434 if (strEQ(name, "_POSIX_OPEN_MAX"))
2435 #ifdef _POSIX_OPEN_MAX
2436 return _POSIX_OPEN_MAX;
2440 if (strEQ(name, "_POSIX_PATH_MAX"))
2441 #ifdef _POSIX_PATH_MAX
2442 return _POSIX_PATH_MAX;
2446 if (strEQ(name, "_POSIX_PIPE_BUF"))
2447 #ifdef _POSIX_PIPE_BUF
2448 return _POSIX_PIPE_BUF;
2452 if (strEQ(name, "_POSIX_SAVED_IDS"))
2453 #ifdef _POSIX_SAVED_IDS
2454 return _POSIX_SAVED_IDS;
2458 if (strEQ(name, "_POSIX_SSIZE_MAX"))
2459 #ifdef _POSIX_SSIZE_MAX
2460 return _POSIX_SSIZE_MAX;
2464 if (strEQ(name, "_POSIX_STREAM_MAX"))
2465 #ifdef _POSIX_STREAM_MAX
2466 return _POSIX_STREAM_MAX;
2470 if (strEQ(name, "_POSIX_TZNAME_MAX"))
2471 #ifdef _POSIX_TZNAME_MAX
2472 return _POSIX_TZNAME_MAX;
2476 if (strEQ(name, "_POSIX_VDISABLE"))
2477 #ifdef _POSIX_VDISABLE
2478 return _POSIX_VDISABLE;
2482 if (strEQ(name, "_POSIX_VERSION"))
2483 #ifdef _POSIX_VERSION
2484 return _POSIX_VERSION;
2490 if (strnEQ(name, "_SC_", 4)) {
2491 if (strEQ(name, "_SC_ARG_MAX"))
2497 if (strEQ(name, "_SC_CHILD_MAX"))
2498 #ifdef _SC_CHILD_MAX
2499 return _SC_CHILD_MAX;
2503 if (strEQ(name, "_SC_CLK_TCK"))
2509 if (strEQ(name, "_SC_JOB_CONTROL"))
2510 #ifdef _SC_JOB_CONTROL
2511 return _SC_JOB_CONTROL;
2515 if (strEQ(name, "_SC_NGROUPS_MAX"))
2516 #ifdef _SC_NGROUPS_MAX
2517 return _SC_NGROUPS_MAX;
2521 if (strEQ(name, "_SC_OPEN_MAX"))
2523 return _SC_OPEN_MAX;
2527 if (strEQ(name, "_SC_SAVED_IDS"))
2528 #ifdef _SC_SAVED_IDS
2529 return _SC_SAVED_IDS;
2533 if (strEQ(name, "_SC_STREAM_MAX"))
2534 #ifdef _SC_STREAM_MAX
2535 return _SC_STREAM_MAX;
2539 if (strEQ(name, "_SC_TZNAME_MAX"))
2540 #ifdef _SC_TZNAME_MAX
2541 return _SC_TZNAME_MAX;
2545 if (strEQ(name, "_SC_VERSION"))
2562 MODULE = SigSet PACKAGE = POSIX::SigSet PREFIX = sig
2565 new(packname = "POSIX::SigSet", ...)
2570 RETVAL = (sigset_t*)safemalloc(sizeof(sigset_t));
2571 sigemptyset(RETVAL);
2572 for (i = 1; i < items; i++)
2573 sigaddset(RETVAL, SvIV(ST(i)));
2580 POSIX::SigSet sigset
2582 safefree((char *)sigset);
2585 sigaddset(sigset, sig)
2586 POSIX::SigSet sigset
2590 sigdelset(sigset, sig)
2591 POSIX::SigSet sigset
2596 POSIX::SigSet sigset
2600 POSIX::SigSet sigset
2603 sigismember(sigset, sig)
2604 POSIX::SigSet sigset
2608 MODULE = Termios PACKAGE = POSIX::Termios PREFIX = cf
2611 new(packname = "POSIX::Termios", ...)
2616 RETVAL = (struct termios*)safemalloc(sizeof(struct termios));
2618 not_here("termios");
2625 DESTROY(termios_ref)
2626 POSIX::Termios termios_ref
2629 safefree((char *)termios_ref);
2631 not_here("termios");
2635 getattr(termios_ref, fd = 0)
2636 POSIX::Termios termios_ref
2639 RETVAL = tcgetattr(fd, termios_ref);
2644 setattr(termios_ref, fd = 0, optional_actions = 0)
2645 POSIX::Termios termios_ref
2647 int optional_actions
2649 RETVAL = tcsetattr(fd, optional_actions, termios_ref);
2654 cfgetispeed(termios_ref)
2655 POSIX::Termios termios_ref
2658 cfgetospeed(termios_ref)
2659 POSIX::Termios termios_ref
2662 getiflag(termios_ref)
2663 POSIX::Termios termios_ref
2665 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2666 RETVAL = termios_ref->c_iflag;
2668 not_here("getiflag");
2674 getoflag(termios_ref)
2675 POSIX::Termios termios_ref
2677 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2678 RETVAL = termios_ref->c_oflag;
2680 not_here("getoflag");
2686 getcflag(termios_ref)
2687 POSIX::Termios termios_ref
2689 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2690 RETVAL = termios_ref->c_cflag;
2692 not_here("getcflag");
2698 getlflag(termios_ref)
2699 POSIX::Termios termios_ref
2701 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2702 RETVAL = termios_ref->c_lflag;
2704 not_here("getlflag");
2710 getcc(termios_ref, ccix)
2711 POSIX::Termios termios_ref
2714 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2716 croak("Bad getcc subscript");
2717 RETVAL = termios_ref->c_cc[ccix];
2725 cfsetispeed(termios_ref, speed)
2726 POSIX::Termios termios_ref
2730 cfsetospeed(termios_ref, speed)
2731 POSIX::Termios termios_ref
2735 setiflag(termios_ref, iflag)
2736 POSIX::Termios termios_ref
2739 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2740 termios_ref->c_iflag = iflag;
2742 not_here("setiflag");
2746 setoflag(termios_ref, oflag)
2747 POSIX::Termios termios_ref
2750 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2751 termios_ref->c_oflag = oflag;
2753 not_here("setoflag");
2757 setcflag(termios_ref, cflag)
2758 POSIX::Termios termios_ref
2761 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2762 termios_ref->c_cflag = cflag;
2764 not_here("setcflag");
2768 setlflag(termios_ref, lflag)
2769 POSIX::Termios termios_ref
2772 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2773 termios_ref->c_lflag = lflag;
2775 not_here("setlflag");
2779 setcc(termios_ref, ccix, cc)
2780 POSIX::Termios termios_ref
2784 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2786 croak("Bad setcc subscript");
2787 termios_ref->c_cc[ccix] = cc;
2793 MODULE = POSIX PACKAGE = POSIX
2802 unsigned char * charstring
2804 unsigned char *s = charstring;
2805 unsigned char *e = s + na; /* "na" set by typemap side effect */
2806 for (RETVAL = 1; RETVAL && s < e; s++)
2814 unsigned char * charstring
2816 unsigned char *s = charstring;
2817 unsigned char *e = s + na; /* "na" set by typemap side effect */
2818 for (RETVAL = 1; RETVAL && s < e; s++)
2826 unsigned char * charstring
2828 unsigned char *s = charstring;
2829 unsigned char *e = s + na; /* "na" set by typemap side effect */
2830 for (RETVAL = 1; RETVAL && s < e; s++)
2838 unsigned char * charstring
2840 unsigned char *s = charstring;
2841 unsigned char *e = s + na; /* "na" set by typemap side effect */
2842 for (RETVAL = 1; RETVAL && s < e; s++)
2850 unsigned char * charstring
2852 unsigned char *s = charstring;
2853 unsigned char *e = s + na; /* "na" set by typemap side effect */
2854 for (RETVAL = 1; RETVAL && s < e; s++)
2862 unsigned char * charstring
2864 unsigned char *s = charstring;
2865 unsigned char *e = s + na; /* "na" set by typemap side effect */
2866 for (RETVAL = 1; RETVAL && s < e; s++)
2874 unsigned char * charstring
2876 unsigned char *s = charstring;
2877 unsigned char *e = s + na; /* "na" set by typemap side effect */
2878 for (RETVAL = 1; RETVAL && s < e; s++)
2886 unsigned char * charstring
2888 unsigned char *s = charstring;
2889 unsigned char *e = s + na; /* "na" set by typemap side effect */
2890 for (RETVAL = 1; RETVAL && s < e; s++)
2898 unsigned char * charstring
2900 unsigned char *s = charstring;
2901 unsigned char *e = s + na; /* "na" set by typemap side effect */
2902 for (RETVAL = 1; RETVAL && s < e; s++)
2910 unsigned char * charstring
2912 unsigned char *s = charstring;
2913 unsigned char *e = s + na; /* "na" set by typemap side effect */
2914 for (RETVAL = 1; RETVAL && s < e; s++)
2921 isxdigit(charstring)
2922 unsigned char * charstring
2924 unsigned char *s = charstring;
2925 unsigned char *e = s + na; /* "na" set by typemap side effect */
2926 for (RETVAL = 1; RETVAL && s < e; s++)
2933 open(filename, flags = O_RDONLY, mode = 0666)
2938 if (flags & (O_APPEND|O_CREAT|O_TRUNC|O_RDWR|O_WRONLY|O_EXCL))
2939 TAINT_PROPER("open");
2940 RETVAL = open(filename, flags, mode);
2948 #ifdef HAS_LOCALECONV
2949 struct lconv *lcbuf;
2951 SET_NUMERIC_LOCAL();
2952 if (lcbuf = localeconv()) {
2954 if (lcbuf->decimal_point && *lcbuf->decimal_point)
2955 hv_store(RETVAL, "decimal_point", 13,
2956 newSVpv(lcbuf->decimal_point, 0), 0);
2957 if (lcbuf->thousands_sep && *lcbuf->thousands_sep)
2958 hv_store(RETVAL, "thousands_sep", 13,
2959 newSVpv(lcbuf->thousands_sep, 0), 0);
2960 if (lcbuf->grouping && *lcbuf->grouping)
2961 hv_store(RETVAL, "grouping", 8,
2962 newSVpv(lcbuf->grouping, 0), 0);
2963 if (lcbuf->int_curr_symbol && *lcbuf->int_curr_symbol)
2964 hv_store(RETVAL, "int_curr_symbol", 15,
2965 newSVpv(lcbuf->int_curr_symbol, 0), 0);
2966 if (lcbuf->currency_symbol && *lcbuf->currency_symbol)
2967 hv_store(RETVAL, "currency_symbol", 15,
2968 newSVpv(lcbuf->currency_symbol, 0), 0);
2969 if (lcbuf->mon_decimal_point && *lcbuf->mon_decimal_point)
2970 hv_store(RETVAL, "mon_decimal_point", 17,
2971 newSVpv(lcbuf->mon_decimal_point, 0), 0);
2972 if (lcbuf->mon_thousands_sep && *lcbuf->mon_thousands_sep)
2973 hv_store(RETVAL, "mon_thousands_sep", 17,
2974 newSVpv(lcbuf->mon_thousands_sep, 0), 0);
2975 if (lcbuf->mon_grouping && *lcbuf->mon_grouping)
2976 hv_store(RETVAL, "mon_grouping", 12,
2977 newSVpv(lcbuf->mon_grouping, 0), 0);
2978 if (lcbuf->positive_sign && *lcbuf->positive_sign)
2979 hv_store(RETVAL, "positive_sign", 13,
2980 newSVpv(lcbuf->positive_sign, 0), 0);
2981 if (lcbuf->negative_sign && *lcbuf->negative_sign)
2982 hv_store(RETVAL, "negative_sign", 13,
2983 newSVpv(lcbuf->negative_sign, 0), 0);
2985 if (lcbuf->int_frac_digits != CHAR_MAX)
2986 hv_store(RETVAL, "int_frac_digits", 15,
2987 newSViv(lcbuf->int_frac_digits), 0);
2988 if (lcbuf->frac_digits != CHAR_MAX)
2989 hv_store(RETVAL, "frac_digits", 11,
2990 newSViv(lcbuf->frac_digits), 0);
2991 if (lcbuf->p_cs_precedes != CHAR_MAX)
2992 hv_store(RETVAL, "p_cs_precedes", 13,
2993 newSViv(lcbuf->p_cs_precedes), 0);
2994 if (lcbuf->p_sep_by_space != CHAR_MAX)
2995 hv_store(RETVAL, "p_sep_by_space", 14,
2996 newSViv(lcbuf->p_sep_by_space), 0);
2997 if (lcbuf->n_cs_precedes != CHAR_MAX)
2998 hv_store(RETVAL, "n_cs_precedes", 13,
2999 newSViv(lcbuf->n_cs_precedes), 0);
3000 if (lcbuf->n_sep_by_space != CHAR_MAX)
3001 hv_store(RETVAL, "n_sep_by_space", 14,
3002 newSViv(lcbuf->n_sep_by_space), 0);
3003 if (lcbuf->p_sign_posn != CHAR_MAX)
3004 hv_store(RETVAL, "p_sign_posn", 11,
3005 newSViv(lcbuf->p_sign_posn), 0);
3006 if (lcbuf->n_sign_posn != CHAR_MAX)
3007 hv_store(RETVAL, "n_sign_posn", 11,
3008 newSViv(lcbuf->n_sign_posn), 0);
3011 localeconv(); /* A stub to call not_here(). */
3017 setlocale(category, locale = 0)
3021 RETVAL = setlocale(category, locale);
3023 #ifdef USE_LOCALE_CTYPE
3024 if (category == LC_CTYPE
3026 || category == LC_ALL
3032 if (category == LC_ALL)
3033 newctype = setlocale(LC_CTYPE, NULL);
3037 perl_new_ctype(newctype);
3039 #endif /* USE_LOCALE_CTYPE */
3040 #ifdef USE_LOCALE_COLLATE
3041 if (category == LC_COLLATE
3043 || category == LC_ALL
3049 if (category == LC_ALL)
3050 newcoll = setlocale(LC_COLLATE, NULL);
3054 perl_new_collate(newcoll);
3056 #endif /* USE_LOCALE_COLLATE */
3057 #ifdef USE_LOCALE_NUMERIC
3058 if (category == LC_NUMERIC
3060 || category == LC_ALL
3066 if (category == LC_ALL)
3067 newnum = setlocale(LC_NUMERIC, NULL);
3071 perl_new_numeric(newnum);
3073 #endif /* USE_LOCALE_NUMERIC */
3113 /* (We already know stack is long enough.) */
3114 PUSHs(sv_2mortal(newSVnv(frexp(x,&expvar))));
3115 PUSHs(sv_2mortal(newSViv(expvar)));
3131 /* (We already know stack is long enough.) */
3132 PUSHs(sv_2mortal(newSVnv(modf(x,&intvar))));
3133 PUSHs(sv_2mortal(newSVnv(intvar)));
3148 sigaction(sig, action, oldaction = 0)
3150 POSIX::SigAction action
3151 POSIX::SigAction oldaction
3154 # This code is really grody because we're trying to make the signal
3155 # interface look beautiful, which is hard.
3158 gv_fetchpv("SIG", TRUE, SVt_PVHV);
3161 struct sigaction act;
3162 struct sigaction oact;
3163 POSIX__SigSet sigset;
3165 SV** sigsvp = hv_fetch(GvHVn(siggv),
3167 strlen(sig_name[sig]),
3170 /* Remember old handler name if desired. */
3172 char *hand = SvPVx(*sigsvp, na);
3173 svp = hv_fetch(oldaction, "HANDLER", 7, TRUE);
3174 sv_setpv(*svp, *hand ? hand : "DEFAULT");
3178 /* Vector new handler through %SIG. (We always use sighandler
3179 for the C signal handler, which reads %SIG to dispatch.) */
3180 svp = hv_fetch(action, "HANDLER", 7, FALSE);
3182 croak("Can't supply an action without a HANDLER");
3183 sv_setpv(*sigsvp, SvPV(*svp, na));
3184 mg_set(*sigsvp); /* handles DEFAULT and IGNORE */
3185 act.sa_handler = sighandler;
3187 /* Set up any desired mask. */
3188 svp = hv_fetch(action, "MASK", 4, FALSE);
3189 if (svp && sv_isa(*svp, "POSIX::SigSet")) {
3191 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3192 sigset = (sigset_t*) tmp;
3193 act.sa_mask = *sigset;
3196 sigemptyset(& act.sa_mask);
3198 /* Set up any desired flags. */
3199 svp = hv_fetch(action, "FLAGS", 5, FALSE);
3200 act.sa_flags = svp ? SvIV(*svp) : 0;
3203 /* Now work around sigaction oddities */
3204 if (action && oldaction)
3205 RETVAL = sigaction(sig, & act, & oact);
3207 RETVAL = sigaction(sig, & act, (struct sigaction *)0);
3209 RETVAL = sigaction(sig, (struct sigaction *)0, & oact);
3214 /* Get back the mask. */
3215 svp = hv_fetch(oldaction, "MASK", 4, TRUE);
3216 if (sv_isa(*svp, "POSIX::SigSet")) {
3218 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3219 sigset = (sigset_t*) tmp;
3222 sigset = (sigset_t*)safemalloc(sizeof(sigset_t));
3223 sv_setptrobj(*svp, sigset, "POSIX::SigSet");
3225 *sigset = oact.sa_mask;
3227 /* Get back the flags. */
3228 svp = hv_fetch(oldaction, "FLAGS", 5, TRUE);
3229 sv_setiv(*svp, oact.sa_flags);
3237 POSIX::SigSet sigset
3240 sigprocmask(how, sigset, oldsigset = 0)
3242 POSIX::SigSet sigset
3243 POSIX::SigSet oldsigset
3246 sigsuspend(signal_mask)
3247 POSIX::SigSet signal_mask
3267 lseek(fd, offset, whence)
3280 if (pipe(fds) != -1) {
3282 PUSHs(sv_2mortal(newSViv(fds[0])));
3283 PUSHs(sv_2mortal(newSViv(fds[1])));
3287 read(fd, buffer, nbytes)
3289 SV *sv_buffer = SvROK(ST(1)) ? SvRV(ST(1)) : ST(1);
3293 char * buffer = sv_grow( sv_buffer, nbytes+1 );
3296 SvCUR(sv_buffer) = RETVAL;
3297 SvPOK_only(sv_buffer);
3298 *SvEND(sv_buffer) = '\0';
3299 SvTAINTED_on(sv_buffer);
3315 tcsetpgrp(fd, pgrp_id)
3324 if (uname(&buf) >= 0) {
3326 PUSHs(sv_2mortal(newSVpv(buf.sysname, 0)));
3327 PUSHs(sv_2mortal(newSVpv(buf.nodename, 0)));
3328 PUSHs(sv_2mortal(newSVpv(buf.release, 0)));
3329 PUSHs(sv_2mortal(newSVpv(buf.version, 0)));
3330 PUSHs(sv_2mortal(newSVpv(buf.machine, 0)));
3333 uname((char *) 0); /* A stub to call not_here(). */
3337 write(fd, buffer, nbytes)
3355 mbstowcs(s, pwcs, n)
3367 wcstombs(s, pwcs, n)
3389 SET_NUMERIC_LOCAL();
3390 num = strtod(str, &unparsed);
3391 PUSHs(sv_2mortal(newSVnv(num)));
3392 if (GIMME == G_ARRAY) {
3395 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3401 strtol(str, base = 0)
3408 num = strtol(str, &unparsed, base);
3409 if (num >= IV_MIN && num <= IV_MAX)
3410 PUSHs(sv_2mortal(newSViv((IV)num)));
3412 PUSHs(sv_2mortal(newSVnv((double)num)));
3413 if (GIMME == G_ARRAY) {
3416 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3422 strtoul(str, base = 0)
3429 num = strtoul(str, &unparsed, base);
3431 PUSHs(sv_2mortal(newSViv((IV)num)));
3433 PUSHs(sv_2mortal(newSVnv((double)num)));
3434 if (GIMME == G_ARRAY) {
3437 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3449 char *p = SvPV(src,srclen);
3451 ST(0) = sv_2mortal(NEWSV(800,srclen));
3452 dstlen = strxfrm(SvPVX(ST(0)), p, (size_t)srclen);
3453 if (dstlen > srclen) {
3455 SvGROW(ST(0), dstlen);
3456 strxfrm(SvPVX(ST(0)), p, (size_t)dstlen);
3459 SvCUR(ST(0)) = dstlen;
3464 mkfifo(filename, mode)
3468 TAINT_PROPER("mkfifo");
3469 RETVAL = mkfifo(filename, mode);
3485 tcflush(fd, queue_selector)
3490 tcsendbreak(fd, duration)
3495 asctime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3508 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3511 mytm.tm_hour = hour;
3512 mytm.tm_mday = mday;
3514 mytm.tm_year = year;
3515 mytm.tm_wday = wday;
3516 mytm.tm_yday = yday;
3517 mytm.tm_isdst = isdst;
3518 RETVAL = asctime(&mytm);
3535 realtime = times( &tms );
3537 PUSHs( sv_2mortal( newSViv( (IV) realtime ) ) );
3538 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_utime ) ) );
3539 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_stime ) ) );
3540 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cutime ) ) );
3541 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cstime ) ) );
3544 difftime(time1, time2)
3549 mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3562 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3565 mytm.tm_hour = hour;
3566 mytm.tm_mday = mday;
3568 mytm.tm_year = year;
3569 mytm.tm_wday = wday;
3570 mytm.tm_yday = yday;
3571 mytm.tm_isdst = isdst;
3572 RETVAL = mktime(&mytm);
3578 strftime(fmt, sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3594 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3597 mytm.tm_hour = hour;
3598 mytm.tm_mday = mday;
3600 mytm.tm_year = year;
3601 mytm.tm_wday = wday;
3602 mytm.tm_yday = yday;
3603 mytm.tm_isdst = isdst;
3604 len = strftime(tmpbuf, sizeof tmpbuf, fmt, &mytm);
3605 ST(0) = sv_2mortal(newSVpv(tmpbuf, len));
3615 PUSHs(sv_2mortal(newSVpv(tzname[0],strlen(tzname[0]))));
3616 PUSHs(sv_2mortal(newSVpv(tzname[1],strlen(tzname[1]))));
3619 access(filename, mode)
3637 pathconf(filename, name)