5 #define PERLIO_NOT_STDIO 1
8 #ifdef PERL_OBJECT /* XXX _very_ temporary hacks */
11 # define open PerlLIO_open3
13 # define TAINT_PROPER(a)
16 #ifdef I_DIRENT /* XXX maybe better to just rely on perl.h? */
38 /* XXX This comment is just to make I_TERMIO and I_SGTTY visible to
39 metaconfig for future extension writers. We don't use them in POSIX.
40 (This is really sneaky :-) --AD
42 #if defined(I_TERMIOS)
50 #include <sys/types.h>
57 #if defined(__VMS) && !defined(__POSIX_SOURCE)
58 # include <libdef.h> /* LIB$_INVARG constant */
59 # include <lib$routines.h> /* prototype for lib$ediv() */
60 # include <starlet.h> /* prototype for sys$gettim() */
61 # if DECC_VERSION < 50000000
62 # define pid_t int /* old versions of DECC miss this in types.h */
65 # undef mkfifo /* #defined in perl.h */
66 # define mkfifo(a,b) (not_here("mkfifo"),-1)
67 # define tzset() not_here("tzset")
69 #if ((__VMS_VER >= 70000000) && (__DECC_VER >= 50200000)) || (__CRTL_VER >= 70000000)
70 # define HAS_TZNAME /* shows up in VMS 7.0 or Dec C 5.6 */
72 # endif /* __VMS_VER >= 70000000 or Dec C 5.6 */
74 /* The POSIX notion of ttyname() is better served by getname() under VMS */
75 static char ttnambuf[64];
76 # define ttyname(fd) (isatty(fd) > 0 ? getname(fd,ttnambuf,0) : NULL)
78 /* The non-POSIX CRTL times() has void return type, so we just get the
79 current time directly */
80 clock_t vms_times(struct tms *bufptr) {
82 /* Get wall time and convert to 10 ms intervals to
83 * produce the return value that the POSIX standard expects */
84 # if defined(__DECC) && defined (__ALPHA)
87 _ckvmssts(sys$gettim(&vmstime));
89 retval = vmstime & 0x7fffffff;
91 /* (Older hw or ccs don't have an atomic 64-bit type, so we
92 * juggle 32-bit ints (and a float) to produce a time_t result
93 * with minimal loss of information.) */
94 long int vmstime[2],remainder,divisor = 100000;
95 _ckvmssts(sys$gettim((unsigned long int *)vmstime));
96 vmstime[1] &= 0x7fff; /* prevent overflow in EDIV */
97 _ckvmssts(lib$ediv(&divisor,vmstime,(long int *)&retval,&remainder));
99 /* Fill in the struct tms using the CRTL routine . . .*/
100 times((tbuffer_t *)bufptr);
101 return (clock_t) retval;
103 # define times(t) vms_times(t)
106 # undef mkfifo /* #defined in perl.h */
107 # define mkfifo(a,b) not_here("mkfifo")
108 # define ttyname(a) (char*)not_here("ttyname")
109 # define sigset_t long
112 # define tzname _tzname
115 # define mode_t short
118 # define mode_t short
120 # define tzset() not_here("tzset")
122 # ifndef _POSIX_OPEN_MAX
123 # define _POSIX_OPEN_MAX FOPEN_MAX /* XXX bogus ? */
126 # define sigaction(a,b,c) not_here("sigaction")
127 # define sigpending(a) not_here("sigpending")
128 # define sigprocmask(a,b,c) not_here("sigprocmask")
129 # define sigsuspend(a) not_here("sigsuspend")
130 # define sigemptyset(a) not_here("sigemptyset")
131 # define sigaddset(a,b) not_here("sigaddset")
132 # define sigdelset(a,b) not_here("sigdelset")
133 # define sigfillset(a) not_here("sigfillset")
134 # define sigismember(a,b) not_here("sigismember")
137 # include <sys/times.h>
139 # include <sys/utsname.h>
141 # include <sys/wait.h>
149 typedef long SysRetLong;
150 typedef sigset_t* POSIX__SigSet;
151 typedef HV* POSIX__SigAction;
153 typedef struct termios* POSIX__Termios;
154 #else /* Define termios types to int, and call not_here for the functions.*/
155 #define POSIX__Termios int
159 #define cfgetispeed(x) not_here("cfgetispeed")
160 #define cfgetospeed(x) not_here("cfgetospeed")
161 #define tcdrain(x) not_here("tcdrain")
162 #define tcflush(x,y) not_here("tcflush")
163 #define tcsendbreak(x,y) not_here("tcsendbreak")
164 #define cfsetispeed(x,y) not_here("cfsetispeed")
165 #define cfsetospeed(x,y) not_here("cfsetospeed")
166 #define ctermid(x) (char *) not_here("ctermid")
167 #define tcflow(x,y) not_here("tcflow")
168 #define tcgetattr(x,y) not_here("tcgetattr")
169 #define tcsetattr(x,y,z) not_here("tcsetattr")
172 /* Possibly needed prototypes */
173 char *cuserid _((char *));
174 double strtod _((const char *, char **));
175 long strtol _((const char *, char **, int));
176 unsigned long strtoul _((const char *, char **, int));
179 #define cuserid(a) (char *) not_here("cuserid")
183 #define difftime(a,b) not_here("difftime")
186 #ifndef HAS_FPATHCONF
187 #define fpathconf(f,n) (SysRetLong) not_here("fpathconf")
190 #define mktime(a) not_here("mktime")
193 #define nice(a) not_here("nice")
196 #define pathconf(f,n) (SysRetLong) not_here("pathconf")
199 #define sysconf(n) (SysRetLong) not_here("sysconf")
202 #define readlink(a,b,c) not_here("readlink")
205 #define setpgid(a,b) not_here("setpgid")
208 #define setsid() not_here("setsid")
211 #define strcoll(s1,s2) not_here("strcoll")
214 #define strtod(s1,s2) not_here("strtod")
217 #define strtol(s1,s2,b) not_here("strtol")
220 #define strtoul(s1,s2,b) not_here("strtoul")
223 #define strxfrm(s1,s2,n) not_here("strxfrm")
225 #ifndef HAS_TCGETPGRP
226 #define tcgetpgrp(a) not_here("tcgetpgrp")
228 #ifndef HAS_TCSETPGRP
229 #define tcsetpgrp(a,b) not_here("tcsetpgrp")
232 #define times(a) not_here("times")
235 #define uname(a) not_here("uname")
238 #define waitpid(a,b,c) not_here("waitpid")
243 #define mblen(a,b) not_here("mblen")
247 #define mbstowcs(s, pwcs, n) not_here("mbstowcs")
250 #define mbtowc(pwc, s, n) not_here("mbtowc")
253 #define wcstombs(s, pwcs, n) not_here("wcstombs")
256 #define wctomb(s, wchar) not_here("wcstombs")
258 #if !defined(HAS_MBLEN) && !defined(HAS_MBSTOWCS) && !defined(HAS_MBTOWC) && !defined(HAS_WCSTOMBS) && !defined(HAS_WCTOMB)
259 /* If we don't have these functions, then we wouldn't have gotten a typedef
260 for wchar_t, the wide character type. Defining wchar_t allows the
261 functions referencing it to compile. Its actual type is then meaningless,
262 since without the above functions, all sections using it end up calling
263 not_here() and croak. --Kaveh Ghazi (ghazi@noc.rutgers.edu) 9/18/94. */
269 #ifndef HAS_LOCALECONV
270 #define localeconv() not_here("localeconv")
275 extern char *tzname[];
278 #if !defined(WIN32) || (defined(__MINGW32__) && !defined(tzname))
279 char *tzname[] = { "" , "" };
283 /* XXX struct tm on some systems (SunOS4/BSD) contains extra (non POSIX)
284 * fields for which we don't have Configure support yet:
285 * char *tm_zone; -- abbreviation of timezone name
286 * long tm_gmtoff; -- offset from GMT in seconds
287 * To workaround core dumps from the uninitialised tm_zone we get the
288 * system to give us a reasonable struct to copy. This fix means that
289 * strftime uses the tm_zone and tm_gmtoff values returned by
290 * localtime(time()). That should give the desired result most of the
291 * time. But probably not always!
293 * This is a temporary workaround to be removed once Configure
294 * support is added and NETaa14816 is considered in full.
295 * It does not address tzname aspects of NETaa14816.
298 # ifndef STRUCT_TM_HASZONE
299 # define STRUCT_TM_HAS_ZONE
303 #ifdef STRUCT_TM_HASZONE
305 init_tm(ptm) /* see mktime, strftime and asctime */
310 Copy(localtime(&now), ptm, 1, struct tm);
314 # define init_tm(ptm)
318 #ifdef HAS_LONG_DOUBLE
319 # if LONG_DOUBLESIZE > DOUBLESIZE
320 # undef HAS_LONG_DOUBLE /* XXX until we figure out how to use them */
324 #ifndef HAS_LONG_DOUBLE
339 croak("POSIX::%s not implemented on this architecture", s);
344 #ifdef HAS_LONG_DOUBLE
349 constant(char *name, int arg)
354 if (strEQ(name, "ARG_MAX"))
362 if (strEQ(name, "BUFSIZ"))
368 if (strEQ(name, "BRKINT"))
374 if (strEQ(name, "B9600"))
380 if (strEQ(name, "B19200"))
386 if (strEQ(name, "B38400"))
392 if (strEQ(name, "B0"))
398 if (strEQ(name, "B110"))
404 if (strEQ(name, "B1200"))
410 if (strEQ(name, "B134"))
416 if (strEQ(name, "B150"))
422 if (strEQ(name, "B1800"))
428 if (strEQ(name, "B200"))
434 if (strEQ(name, "B2400"))
440 if (strEQ(name, "B300"))
446 if (strEQ(name, "B4800"))
452 if (strEQ(name, "B50"))
458 if (strEQ(name, "B600"))
464 if (strEQ(name, "B75"))
472 if (strEQ(name, "CHAR_BIT"))
478 if (strEQ(name, "CHAR_MAX"))
484 if (strEQ(name, "CHAR_MIN"))
490 if (strEQ(name, "CHILD_MAX"))
496 if (strEQ(name, "CLK_TCK"))
502 if (strEQ(name, "CLOCAL"))
508 if (strEQ(name, "CLOCKS_PER_SEC"))
509 #ifdef CLOCKS_PER_SEC
510 return CLOCKS_PER_SEC;
514 if (strEQ(name, "CREAD"))
520 if (strEQ(name, "CS5"))
526 if (strEQ(name, "CS6"))
532 if (strEQ(name, "CS7"))
538 if (strEQ(name, "CS8"))
544 if (strEQ(name, "CSIZE"))
550 if (strEQ(name, "CSTOPB"))
558 if (strEQ(name, "DBL_MAX"))
564 if (strEQ(name, "DBL_MIN"))
570 if (strEQ(name, "DBL_DIG"))
576 if (strEQ(name, "DBL_EPSILON"))
582 if (strEQ(name, "DBL_MANT_DIG"))
588 if (strEQ(name, "DBL_MAX_10_EXP"))
589 #ifdef DBL_MAX_10_EXP
590 return DBL_MAX_10_EXP;
594 if (strEQ(name, "DBL_MAX_EXP"))
600 if (strEQ(name, "DBL_MIN_10_EXP"))
601 #ifdef DBL_MIN_10_EXP
602 return DBL_MIN_10_EXP;
606 if (strEQ(name, "DBL_MIN_EXP"))
616 if (strEQ(name, "EACCES"))
622 if (strEQ(name, "EADDRINUSE"))
628 if (strEQ(name, "EADDRNOTAVAIL"))
630 return EADDRNOTAVAIL;
634 if (strEQ(name, "EAFNOSUPPORT"))
640 if (strEQ(name, "EAGAIN"))
646 if (strEQ(name, "EALREADY"))
654 if (strEQ(name, "EBADF"))
660 if (strEQ(name, "EBUSY"))
668 if (strEQ(name, "ECHILD"))
674 if (strEQ(name, "ECHO"))
680 if (strEQ(name, "ECHOE"))
686 if (strEQ(name, "ECHOK"))
692 if (strEQ(name, "ECHONL"))
698 if (strEQ(name, "ECONNABORTED"))
704 if (strEQ(name, "ECONNREFUSED"))
710 if (strEQ(name, "ECONNRESET"))
718 if (strEQ(name, "EDEADLK"))
724 if (strEQ(name, "EDESTADDRREQ"))
730 if (strEQ(name, "EDOM"))
736 if (strEQ(name, "EDQUOT"))
744 if (strEQ(name, "EEXIST"))
752 if (strEQ(name, "EFAULT"))
758 if (strEQ(name, "EFBIG"))
766 if (strEQ(name, "EHOSTDOWN"))
772 if (strEQ(name, "EHOSTUNREACH"))
780 if (strEQ(name, "EINPROGRESS"))
786 if (strEQ(name, "EINTR"))
792 if (strEQ(name, "EINVAL"))
798 if (strEQ(name, "EIO"))
804 if (strEQ(name, "EISCONN"))
810 if (strEQ(name, "EISDIR"))
816 if (strEQ(name, "ELOOP"))
824 if (strEQ(name, "EMFILE"))
830 if (strEQ(name, "EMLINK"))
836 if (strEQ(name, "EMSGSIZE"))
844 if (strEQ(name, "ENETDOWN"))
850 if (strEQ(name, "ENETRESET"))
856 if (strEQ(name, "ENETUNREACH"))
862 if (strEQ(name, "ENOBUFS"))
868 if (strEQ(name, "ENOEXEC"))
874 if (strEQ(name, "ENOMEM"))
880 if (strEQ(name, "ENOPROTOOPT"))
886 if (strEQ(name, "ENOSPC"))
892 if (strEQ(name, "ENOTBLK"))
898 if (strEQ(name, "ENOTCONN"))
904 if (strEQ(name, "ENOTDIR"))
910 if (strEQ(name, "ENOTEMPTY"))
916 if (strEQ(name, "ENOTSOCK"))
922 if (strEQ(name, "ENOTTY"))
928 if (strEQ(name, "ENFILE"))
934 if (strEQ(name, "ENODEV"))
940 if (strEQ(name, "ENOENT"))
946 if (strEQ(name, "ENOLCK"))
952 if (strEQ(name, "ENOSYS"))
958 if (strEQ(name, "ENXIO"))
964 if (strEQ(name, "ENAMETOOLONG"))
972 if (strEQ(name, "EOF"))
978 if (strEQ(name, "EOPNOTSUPP"))
986 if (strEQ(name, "EPERM"))
992 if (strEQ(name, "EPFNOSUPPORT"))
998 if (strEQ(name, "EPIPE"))
1004 if (strEQ(name, "EPROCLIM"))
1010 if (strEQ(name, "EPROTONOSUPPORT"))
1011 #ifdef EPROTONOSUPPORT
1012 return EPROTONOSUPPORT;
1016 if (strEQ(name, "EPROTOTYPE"))
1024 if (strEQ(name, "ERANGE"))
1030 if (strEQ(name, "EREMOTE"))
1036 if (strEQ(name, "ERESTART"))
1042 if (strEQ(name, "EROFS"))
1050 if (strEQ(name, "ESHUTDOWN"))
1056 if (strEQ(name, "ESOCKTNOSUPPORT"))
1057 #ifdef ESOCKTNOSUPPORT
1058 return ESOCKTNOSUPPORT;
1062 if (strEQ(name, "ESPIPE"))
1068 if (strEQ(name, "ESRCH"))
1074 if (strEQ(name, "ESTALE"))
1082 if (strEQ(name, "ETIMEDOUT"))
1088 if (strEQ(name, "ETOOMANYREFS"))
1090 return ETOOMANYREFS;
1094 if (strEQ(name, "ETXTBSY"))
1102 if (strEQ(name, "EUSERS"))
1110 if (strEQ(name, "EWOULDBLOCK"))
1118 if (strEQ(name, "EXIT_FAILURE"))
1120 return EXIT_FAILURE;
1124 if (strEQ(name, "EXIT_SUCCESS"))
1126 return EXIT_SUCCESS;
1130 if (strEQ(name, "EXDEV"))
1138 if (strEQ(name, "E2BIG"))
1146 if (strnEQ(name, "FLT_", 4)) {
1147 if (strEQ(name, "FLT_MAX"))
1153 if (strEQ(name, "FLT_MIN"))
1159 if (strEQ(name, "FLT_ROUNDS"))
1165 if (strEQ(name, "FLT_DIG"))
1171 if (strEQ(name, "FLT_EPSILON"))
1177 if (strEQ(name, "FLT_MANT_DIG"))
1179 return FLT_MANT_DIG;
1183 if (strEQ(name, "FLT_MAX_10_EXP"))
1184 #ifdef FLT_MAX_10_EXP
1185 return FLT_MAX_10_EXP;
1189 if (strEQ(name, "FLT_MAX_EXP"))
1195 if (strEQ(name, "FLT_MIN_10_EXP"))
1196 #ifdef FLT_MIN_10_EXP
1197 return FLT_MIN_10_EXP;
1201 if (strEQ(name, "FLT_MIN_EXP"))
1207 if (strEQ(name, "FLT_RADIX"))
1215 if (strnEQ(name, "F_", 2)) {
1216 if (strEQ(name, "F_DUPFD"))
1222 if (strEQ(name, "F_GETFD"))
1228 if (strEQ(name, "F_GETFL"))
1234 if (strEQ(name, "F_GETLK"))
1240 if (strEQ(name, "F_OK"))
1246 if (strEQ(name, "F_RDLCK"))
1252 if (strEQ(name, "F_SETFD"))
1258 if (strEQ(name, "F_SETFL"))
1264 if (strEQ(name, "F_SETLK"))
1270 if (strEQ(name, "F_SETLKW"))
1276 if (strEQ(name, "F_UNLCK"))
1282 if (strEQ(name, "F_WRLCK"))
1290 if (strEQ(name, "FD_CLOEXEC"))
1296 if (strEQ(name, "FILENAME_MAX"))
1298 return FILENAME_MAX;
1304 if (strEQ(name, "HUGE_VAL"))
1310 if (strEQ(name, "HUPCL"))
1318 if (strEQ(name, "INT_MAX"))
1324 if (strEQ(name, "INT_MIN"))
1330 if (strEQ(name, "ICANON"))
1336 if (strEQ(name, "ICRNL"))
1342 if (strEQ(name, "IEXTEN"))
1348 if (strEQ(name, "IGNBRK"))
1354 if (strEQ(name, "IGNCR"))
1360 if (strEQ(name, "IGNPAR"))
1366 if (strEQ(name, "INLCR"))
1372 if (strEQ(name, "INPCK"))
1378 if (strEQ(name, "ISIG"))
1384 if (strEQ(name, "ISTRIP"))
1390 if (strEQ(name, "IXOFF"))
1396 if (strEQ(name, "IXON"))
1404 if (strnEQ(name, "LC_", 3)) {
1405 if (strEQ(name, "LC_ALL"))
1411 if (strEQ(name, "LC_COLLATE"))
1417 if (strEQ(name, "LC_CTYPE"))
1423 if (strEQ(name, "LC_MONETARY"))
1429 if (strEQ(name, "LC_NUMERIC"))
1435 if (strEQ(name, "LC_TIME"))
1443 if (strnEQ(name, "LDBL_", 5)) {
1444 if (strEQ(name, "LDBL_MAX"))
1450 if (strEQ(name, "LDBL_MIN"))
1456 if (strEQ(name, "LDBL_DIG"))
1462 if (strEQ(name, "LDBL_EPSILON"))
1464 return LDBL_EPSILON;
1468 if (strEQ(name, "LDBL_MANT_DIG"))
1469 #ifdef LDBL_MANT_DIG
1470 return LDBL_MANT_DIG;
1474 if (strEQ(name, "LDBL_MAX_10_EXP"))
1475 #ifdef LDBL_MAX_10_EXP
1476 return LDBL_MAX_10_EXP;
1480 if (strEQ(name, "LDBL_MAX_EXP"))
1482 return LDBL_MAX_EXP;
1486 if (strEQ(name, "LDBL_MIN_10_EXP"))
1487 #ifdef LDBL_MIN_10_EXP
1488 return LDBL_MIN_10_EXP;
1492 if (strEQ(name, "LDBL_MIN_EXP"))
1494 return LDBL_MIN_EXP;
1500 if (strnEQ(name, "L_", 2)) {
1501 if (strEQ(name, "L_ctermid"))
1507 if (strEQ(name, "L_cuserid"))
1513 if (strEQ(name, "L_tmpname"))
1521 if (strEQ(name, "LONG_MAX"))
1527 if (strEQ(name, "LONG_MIN"))
1533 if (strEQ(name, "LINK_MAX"))
1541 if (strEQ(name, "MAX_CANON"))
1547 if (strEQ(name, "MAX_INPUT"))
1553 if (strEQ(name, "MB_CUR_MAX"))
1559 if (strEQ(name, "MB_LEN_MAX"))
1567 if (strEQ(name, "NULL")) return 0;
1568 if (strEQ(name, "NAME_MAX"))
1574 if (strEQ(name, "NCCS"))
1580 if (strEQ(name, "NGROUPS_MAX"))
1586 if (strEQ(name, "NOFLSH"))
1594 if (strnEQ(name, "O_", 2)) {
1595 if (strEQ(name, "O_APPEND"))
1601 if (strEQ(name, "O_CREAT"))
1607 if (strEQ(name, "O_TRUNC"))
1613 if (strEQ(name, "O_RDONLY"))
1619 if (strEQ(name, "O_RDWR"))
1625 if (strEQ(name, "O_WRONLY"))
1631 if (strEQ(name, "O_EXCL"))
1637 if (strEQ(name, "O_NOCTTY"))
1643 if (strEQ(name, "O_NONBLOCK"))
1649 if (strEQ(name, "O_ACCMODE"))
1657 if (strEQ(name, "OPEN_MAX"))
1663 if (strEQ(name, "OPOST"))
1671 if (strEQ(name, "PATH_MAX"))
1677 if (strEQ(name, "PARENB"))
1683 if (strEQ(name, "PARMRK"))
1689 if (strEQ(name, "PARODD"))
1695 if (strEQ(name, "PIPE_BUF"))
1703 if (strEQ(name, "RAND_MAX"))
1709 if (strEQ(name, "R_OK"))
1717 if (strnEQ(name, "SIG", 3)) {
1718 if (name[3] == '_') {
1719 if (strEQ(name, "SIG_BLOCK"))
1726 if (strEQ(name, "SIG_DFL")) return (IV)SIG_DFL;
1729 if (strEQ(name, "SIG_ERR")) return (IV)SIG_ERR;
1732 if (strEQ(name, "SIG_IGN")) return (IV)SIG_IGN;
1734 if (strEQ(name, "SIG_SETMASK"))
1740 if (strEQ(name, "SIG_UNBLOCK"))
1748 if (strEQ(name, "SIGABRT"))
1754 if (strEQ(name, "SIGALRM"))
1760 if (strEQ(name, "SIGCHLD"))
1766 if (strEQ(name, "SIGCONT"))
1772 if (strEQ(name, "SIGFPE"))
1778 if (strEQ(name, "SIGHUP"))
1784 if (strEQ(name, "SIGILL"))
1790 if (strEQ(name, "SIGINT"))
1796 if (strEQ(name, "SIGKILL"))
1802 if (strEQ(name, "SIGPIPE"))
1808 if (strEQ(name, "SIGQUIT"))
1814 if (strEQ(name, "SIGSEGV"))
1820 if (strEQ(name, "SIGSTOP"))
1826 if (strEQ(name, "SIGTERM"))
1832 if (strEQ(name, "SIGTSTP"))
1838 if (strEQ(name, "SIGTTIN"))
1844 if (strEQ(name, "SIGTTOU"))
1850 if (strEQ(name, "SIGUSR1"))
1856 if (strEQ(name, "SIGUSR2"))
1864 if (name[1] == '_') {
1865 if (strEQ(name, "S_ISGID"))
1871 if (strEQ(name, "S_ISUID"))
1877 if (strEQ(name, "S_IRGRP"))
1883 if (strEQ(name, "S_IROTH"))
1889 if (strEQ(name, "S_IRUSR"))
1895 if (strEQ(name, "S_IRWXG"))
1901 if (strEQ(name, "S_IRWXO"))
1907 if (strEQ(name, "S_IRWXU"))
1913 if (strEQ(name, "S_IWGRP"))
1919 if (strEQ(name, "S_IWOTH"))
1925 if (strEQ(name, "S_IWUSR"))
1931 if (strEQ(name, "S_IXGRP"))
1937 if (strEQ(name, "S_IXOTH"))
1943 if (strEQ(name, "S_IXUSR"))
1949 errno = EAGAIN; /* the following aren't constants */
1951 if (strEQ(name, "S_ISBLK")) return S_ISBLK(arg);
1954 if (strEQ(name, "S_ISCHR")) return S_ISCHR(arg);
1957 if (strEQ(name, "S_ISDIR")) return S_ISDIR(arg);
1960 if (strEQ(name, "S_ISFIFO")) return S_ISFIFO(arg);
1963 if (strEQ(name, "S_ISREG")) return S_ISREG(arg);
1967 if (strEQ(name, "SEEK_CUR"))
1973 if (strEQ(name, "SEEK_END"))
1979 if (strEQ(name, "SEEK_SET"))
1985 if (strEQ(name, "STREAM_MAX"))
1991 if (strEQ(name, "SHRT_MAX"))
1997 if (strEQ(name, "SHRT_MIN"))
2003 if (strnEQ(name, "SA_", 3)) {
2004 if (strEQ(name, "SA_NOCLDSTOP"))
2006 return SA_NOCLDSTOP;
2010 if (strEQ(name, "SA_NOCLDWAIT"))
2012 return SA_NOCLDWAIT;
2016 if (strEQ(name, "SA_NODEFER"))
2022 if (strEQ(name, "SA_ONSTACK"))
2028 if (strEQ(name, "SA_RESETHAND"))
2030 return SA_RESETHAND;
2034 if (strEQ(name, "SA_RESTART"))
2040 if (strEQ(name, "SA_SIGINFO"))
2048 if (strEQ(name, "SCHAR_MAX"))
2054 if (strEQ(name, "SCHAR_MIN"))
2060 if (strEQ(name, "SSIZE_MAX"))
2066 if (strEQ(name, "STDIN_FILENO"))
2068 return STDIN_FILENO;
2072 if (strEQ(name, "STDOUT_FILENO"))
2073 #ifdef STDOUT_FILENO
2074 return STDOUT_FILENO;
2078 if (strEQ(name, "STRERR_FILENO"))
2079 #ifdef STRERR_FILENO
2080 return STRERR_FILENO;
2086 if (strEQ(name, "TCIFLUSH"))
2092 if (strEQ(name, "TCIOFF"))
2098 if (strEQ(name, "TCIOFLUSH"))
2104 if (strEQ(name, "TCION"))
2110 if (strEQ(name, "TCOFLUSH"))
2116 if (strEQ(name, "TCOOFF"))
2122 if (strEQ(name, "TCOON"))
2128 if (strEQ(name, "TCSADRAIN"))
2134 if (strEQ(name, "TCSAFLUSH"))
2140 if (strEQ(name, "TCSANOW"))
2146 if (strEQ(name, "TMP_MAX"))
2152 if (strEQ(name, "TOSTOP"))
2158 if (strEQ(name, "TZNAME_MAX"))
2166 if (strEQ(name, "UCHAR_MAX"))
2172 if (strEQ(name, "UINT_MAX"))
2178 if (strEQ(name, "ULONG_MAX"))
2184 if (strEQ(name, "USHRT_MAX"))
2192 if (strEQ(name, "VEOF"))
2198 if (strEQ(name, "VEOL"))
2204 if (strEQ(name, "VERASE"))
2210 if (strEQ(name, "VINTR"))
2216 if (strEQ(name, "VKILL"))
2222 if (strEQ(name, "VMIN"))
2228 if (strEQ(name, "VQUIT"))
2234 if (strEQ(name, "VSTART"))
2240 if (strEQ(name, "VSTOP"))
2246 if (strEQ(name, "VSUSP"))
2252 if (strEQ(name, "VTIME"))
2260 if (strEQ(name, "W_OK"))
2266 if (strEQ(name, "WNOHANG"))
2272 if (strEQ(name, "WUNTRACED"))
2278 errno = EAGAIN; /* the following aren't constants */
2280 if (strEQ(name, "WEXITSTATUS")) return WEXITSTATUS(arg);
2283 if (strEQ(name, "WIFEXITED")) return WIFEXITED(arg);
2286 if (strEQ(name, "WIFSIGNALED")) return WIFSIGNALED(arg);
2289 if (strEQ(name, "WIFSTOPPED")) return WIFSTOPPED(arg);
2292 if (strEQ(name, "WSTOPSIG")) return WSTOPSIG(arg);
2295 if (strEQ(name, "WTERMSIG")) return WTERMSIG(arg);
2299 if (strEQ(name, "X_OK"))
2307 if (strnEQ(name, "_PC_", 4)) {
2308 if (strEQ(name, "_PC_CHOWN_RESTRICTED"))
2309 #if defined(_PC_CHOWN_RESTRICTED) || HINT_SC_EXIST
2310 return _PC_CHOWN_RESTRICTED;
2314 if (strEQ(name, "_PC_LINK_MAX"))
2315 #if defined(_PC_LINK_MAX) || HINT_SC_EXIST
2316 return _PC_LINK_MAX;
2320 if (strEQ(name, "_PC_MAX_CANON"))
2321 #if defined(_PC_MAX_CANON) || HINT_SC_EXIST
2322 return _PC_MAX_CANON;
2326 if (strEQ(name, "_PC_MAX_INPUT"))
2327 #if defined(_PC_MAX_INPUT) || HINT_SC_EXIST
2328 return _PC_MAX_INPUT;
2332 if (strEQ(name, "_PC_NAME_MAX"))
2333 #if defined(_PC_NAME_MAX) || HINT_SC_EXIST
2334 return _PC_NAME_MAX;
2338 if (strEQ(name, "_PC_NO_TRUNC"))
2339 #if defined(_PC_NO_TRUNC) || HINT_SC_EXIST
2340 return _PC_NO_TRUNC;
2344 if (strEQ(name, "_PC_PATH_MAX"))
2345 #if defined(_PC_PATH_MAX) || HINT_SC_EXIST
2346 return _PC_PATH_MAX;
2350 if (strEQ(name, "_PC_PIPE_BUF"))
2351 #if defined(_PC_PIPE_BUF) || HINT_SC_EXIST
2352 return _PC_PIPE_BUF;
2356 if (strEQ(name, "_PC_VDISABLE"))
2357 #if defined(_PC_VDISABLE) || HINT_SC_EXIST
2358 return _PC_VDISABLE;
2364 if (strnEQ(name, "_POSIX_", 7)) {
2365 if (strEQ(name, "_POSIX_ARG_MAX"))
2366 #ifdef _POSIX_ARG_MAX
2367 return _POSIX_ARG_MAX;
2371 if (strEQ(name, "_POSIX_CHILD_MAX"))
2372 #ifdef _POSIX_CHILD_MAX
2373 return _POSIX_CHILD_MAX;
2377 if (strEQ(name, "_POSIX_CHOWN_RESTRICTED"))
2378 #ifdef _POSIX_CHOWN_RESTRICTED
2379 return _POSIX_CHOWN_RESTRICTED;
2383 if (strEQ(name, "_POSIX_JOB_CONTROL"))
2384 #ifdef _POSIX_JOB_CONTROL
2385 return _POSIX_JOB_CONTROL;
2389 if (strEQ(name, "_POSIX_LINK_MAX"))
2390 #ifdef _POSIX_LINK_MAX
2391 return _POSIX_LINK_MAX;
2395 if (strEQ(name, "_POSIX_MAX_CANON"))
2396 #ifdef _POSIX_MAX_CANON
2397 return _POSIX_MAX_CANON;
2401 if (strEQ(name, "_POSIX_MAX_INPUT"))
2402 #ifdef _POSIX_MAX_INPUT
2403 return _POSIX_MAX_INPUT;
2407 if (strEQ(name, "_POSIX_NAME_MAX"))
2408 #ifdef _POSIX_NAME_MAX
2409 return _POSIX_NAME_MAX;
2413 if (strEQ(name, "_POSIX_NGROUPS_MAX"))
2414 #ifdef _POSIX_NGROUPS_MAX
2415 return _POSIX_NGROUPS_MAX;
2419 if (strEQ(name, "_POSIX_NO_TRUNC"))
2420 #ifdef _POSIX_NO_TRUNC
2421 return _POSIX_NO_TRUNC;
2425 if (strEQ(name, "_POSIX_OPEN_MAX"))
2426 #ifdef _POSIX_OPEN_MAX
2427 return _POSIX_OPEN_MAX;
2431 if (strEQ(name, "_POSIX_PATH_MAX"))
2432 #ifdef _POSIX_PATH_MAX
2433 return _POSIX_PATH_MAX;
2437 if (strEQ(name, "_POSIX_PIPE_BUF"))
2438 #ifdef _POSIX_PIPE_BUF
2439 return _POSIX_PIPE_BUF;
2443 if (strEQ(name, "_POSIX_SAVED_IDS"))
2444 #ifdef _POSIX_SAVED_IDS
2445 return _POSIX_SAVED_IDS;
2449 if (strEQ(name, "_POSIX_SSIZE_MAX"))
2450 #ifdef _POSIX_SSIZE_MAX
2451 return _POSIX_SSIZE_MAX;
2455 if (strEQ(name, "_POSIX_STREAM_MAX"))
2456 #ifdef _POSIX_STREAM_MAX
2457 return _POSIX_STREAM_MAX;
2461 if (strEQ(name, "_POSIX_TZNAME_MAX"))
2462 #ifdef _POSIX_TZNAME_MAX
2463 return _POSIX_TZNAME_MAX;
2467 if (strEQ(name, "_POSIX_VDISABLE"))
2468 #ifdef _POSIX_VDISABLE
2469 return _POSIX_VDISABLE;
2473 if (strEQ(name, "_POSIX_VERSION"))
2474 #ifdef _POSIX_VERSION
2475 return _POSIX_VERSION;
2481 if (strnEQ(name, "_SC_", 4)) {
2482 if (strEQ(name, "_SC_ARG_MAX"))
2483 #if defined(_SC_ARG_MAX) || HINT_SC_EXIST
2488 if (strEQ(name, "_SC_CHILD_MAX"))
2489 #if defined(_SC_CHILD_MAX) || HINT_SC_EXIST
2490 return _SC_CHILD_MAX;
2494 if (strEQ(name, "_SC_CLK_TCK"))
2495 #if defined(_SC_CLK_TCK) || HINT_SC_EXIST
2500 if (strEQ(name, "_SC_JOB_CONTROL"))
2501 #if defined(_SC_JOB_CONTROL) || HINT_SC_EXIST
2502 return _SC_JOB_CONTROL;
2506 if (strEQ(name, "_SC_NGROUPS_MAX"))
2507 #if defined(_SC_NGROUPS_MAX) || HINT_SC_EXIST
2508 return _SC_NGROUPS_MAX;
2512 if (strEQ(name, "_SC_OPEN_MAX"))
2513 #if defined(_SC_OPEN_MAX) || HINT_SC_EXIST
2514 return _SC_OPEN_MAX;
2518 if (strEQ(name, "_SC_SAVED_IDS"))
2519 #if defined(_SC_SAVED_IDS) || HINT_SC_EXIST
2520 return _SC_SAVED_IDS;
2524 if (strEQ(name, "_SC_STREAM_MAX"))
2525 #if defined(_SC_STREAM_MAX) || HINT_SC_EXIST
2526 return _SC_STREAM_MAX;
2530 if (strEQ(name, "_SC_TZNAME_MAX"))
2531 #if defined(_SC_TZNAME_MAX) || HINT_SC_EXIST
2532 return _SC_TZNAME_MAX;
2536 if (strEQ(name, "_SC_VERSION"))
2537 #if defined(_SC_VERSION) || HINT_SC_EXIST
2553 MODULE = SigSet PACKAGE = POSIX::SigSet PREFIX = sig
2556 new(packname = "POSIX::SigSet", ...)
2561 RETVAL = (sigset_t*)safemalloc(sizeof(sigset_t));
2562 sigemptyset(RETVAL);
2563 for (i = 1; i < items; i++)
2564 sigaddset(RETVAL, SvIV(ST(i)));
2571 POSIX::SigSet sigset
2573 safefree((char *)sigset);
2576 sigaddset(sigset, sig)
2577 POSIX::SigSet sigset
2581 sigdelset(sigset, sig)
2582 POSIX::SigSet sigset
2587 POSIX::SigSet sigset
2591 POSIX::SigSet sigset
2594 sigismember(sigset, sig)
2595 POSIX::SigSet sigset
2599 MODULE = Termios PACKAGE = POSIX::Termios PREFIX = cf
2602 new(packname = "POSIX::Termios", ...)
2607 RETVAL = (struct termios*)safemalloc(sizeof(struct termios));
2609 not_here("termios");
2617 DESTROY(termios_ref)
2618 POSIX::Termios termios_ref
2621 safefree((char *)termios_ref);
2623 not_here("termios");
2627 getattr(termios_ref, fd = 0)
2628 POSIX::Termios termios_ref
2631 RETVAL = tcgetattr(fd, termios_ref);
2636 setattr(termios_ref, fd = 0, optional_actions = 0)
2637 POSIX::Termios termios_ref
2639 int optional_actions
2641 RETVAL = tcsetattr(fd, optional_actions, termios_ref);
2646 cfgetispeed(termios_ref)
2647 POSIX::Termios termios_ref
2650 cfgetospeed(termios_ref)
2651 POSIX::Termios termios_ref
2654 getiflag(termios_ref)
2655 POSIX::Termios termios_ref
2657 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2658 RETVAL = termios_ref->c_iflag;
2660 not_here("getiflag");
2667 getoflag(termios_ref)
2668 POSIX::Termios termios_ref
2670 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2671 RETVAL = termios_ref->c_oflag;
2673 not_here("getoflag");
2680 getcflag(termios_ref)
2681 POSIX::Termios termios_ref
2683 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2684 RETVAL = termios_ref->c_cflag;
2686 not_here("getcflag");
2693 getlflag(termios_ref)
2694 POSIX::Termios termios_ref
2696 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2697 RETVAL = termios_ref->c_lflag;
2699 not_here("getlflag");
2706 getcc(termios_ref, ccix)
2707 POSIX::Termios termios_ref
2710 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2712 croak("Bad getcc subscript");
2713 RETVAL = termios_ref->c_cc[ccix];
2722 cfsetispeed(termios_ref, speed)
2723 POSIX::Termios termios_ref
2727 cfsetospeed(termios_ref, speed)
2728 POSIX::Termios termios_ref
2732 setiflag(termios_ref, iflag)
2733 POSIX::Termios termios_ref
2736 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2737 termios_ref->c_iflag = iflag;
2739 not_here("setiflag");
2743 setoflag(termios_ref, oflag)
2744 POSIX::Termios termios_ref
2747 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2748 termios_ref->c_oflag = oflag;
2750 not_here("setoflag");
2754 setcflag(termios_ref, cflag)
2755 POSIX::Termios termios_ref
2758 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2759 termios_ref->c_cflag = cflag;
2761 not_here("setcflag");
2765 setlflag(termios_ref, lflag)
2766 POSIX::Termios termios_ref
2769 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2770 termios_ref->c_lflag = lflag;
2772 not_here("setlflag");
2776 setcc(termios_ref, ccix, cc)
2777 POSIX::Termios termios_ref
2781 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2783 croak("Bad setcc subscript");
2784 termios_ref->c_cc[ccix] = cc;
2790 MODULE = POSIX PACKAGE = POSIX
2799 unsigned char * charstring
2801 unsigned char *s = charstring;
2802 unsigned char *e = s + na; /* "na" set by typemap side effect */
2803 for (RETVAL = 1; RETVAL && s < e; s++)
2811 unsigned char * charstring
2813 unsigned char *s = charstring;
2814 unsigned char *e = s + na; /* "na" set by typemap side effect */
2815 for (RETVAL = 1; RETVAL && s < e; s++)
2823 unsigned char * charstring
2825 unsigned char *s = charstring;
2826 unsigned char *e = s + na; /* "na" set by typemap side effect */
2827 for (RETVAL = 1; RETVAL && s < e; s++)
2835 unsigned char * charstring
2837 unsigned char *s = charstring;
2838 unsigned char *e = s + na; /* "na" set by typemap side effect */
2839 for (RETVAL = 1; RETVAL && s < e; s++)
2847 unsigned char * charstring
2849 unsigned char *s = charstring;
2850 unsigned char *e = s + na; /* "na" set by typemap side effect */
2851 for (RETVAL = 1; RETVAL && s < e; s++)
2859 unsigned char * charstring
2861 unsigned char *s = charstring;
2862 unsigned char *e = s + na; /* "na" set by typemap side effect */
2863 for (RETVAL = 1; RETVAL && s < e; s++)
2871 unsigned char * charstring
2873 unsigned char *s = charstring;
2874 unsigned char *e = s + na; /* "na" set by typemap side effect */
2875 for (RETVAL = 1; RETVAL && s < e; s++)
2883 unsigned char * charstring
2885 unsigned char *s = charstring;
2886 unsigned char *e = s + na; /* "na" set by typemap side effect */
2887 for (RETVAL = 1; RETVAL && s < e; s++)
2895 unsigned char * charstring
2897 unsigned char *s = charstring;
2898 unsigned char *e = s + na; /* "na" set by typemap side effect */
2899 for (RETVAL = 1; RETVAL && s < e; s++)
2907 unsigned char * charstring
2909 unsigned char *s = charstring;
2910 unsigned char *e = s + na; /* "na" set by typemap side effect */
2911 for (RETVAL = 1; RETVAL && s < e; s++)
2918 isxdigit(charstring)
2919 unsigned char * charstring
2921 unsigned char *s = charstring;
2922 unsigned char *e = s + na; /* "na" set by typemap side effect */
2923 for (RETVAL = 1; RETVAL && s < e; s++)
2930 open(filename, flags = O_RDONLY, mode = 0666)
2935 if (flags & (O_APPEND|O_CREAT|O_TRUNC|O_RDWR|O_WRONLY|O_EXCL))
2936 TAINT_PROPER("open");
2937 RETVAL = open(filename, flags, mode);
2945 #ifdef HAS_LOCALECONV
2946 struct lconv *lcbuf;
2948 SET_NUMERIC_LOCAL();
2949 if (lcbuf = localeconv()) {
2951 if (lcbuf->decimal_point && *lcbuf->decimal_point)
2952 hv_store(RETVAL, "decimal_point", 13,
2953 newSVpv(lcbuf->decimal_point, 0), 0);
2954 if (lcbuf->thousands_sep && *lcbuf->thousands_sep)
2955 hv_store(RETVAL, "thousands_sep", 13,
2956 newSVpv(lcbuf->thousands_sep, 0), 0);
2957 if (lcbuf->grouping && *lcbuf->grouping)
2958 hv_store(RETVAL, "grouping", 8,
2959 newSVpv(lcbuf->grouping, 0), 0);
2960 if (lcbuf->int_curr_symbol && *lcbuf->int_curr_symbol)
2961 hv_store(RETVAL, "int_curr_symbol", 15,
2962 newSVpv(lcbuf->int_curr_symbol, 0), 0);
2963 if (lcbuf->currency_symbol && *lcbuf->currency_symbol)
2964 hv_store(RETVAL, "currency_symbol", 15,
2965 newSVpv(lcbuf->currency_symbol, 0), 0);
2966 if (lcbuf->mon_decimal_point && *lcbuf->mon_decimal_point)
2967 hv_store(RETVAL, "mon_decimal_point", 17,
2968 newSVpv(lcbuf->mon_decimal_point, 0), 0);
2969 #ifndef NO_LOCALECONV_MON_THOUSANDS_SEP
2970 if (lcbuf->mon_thousands_sep && *lcbuf->mon_thousands_sep)
2971 hv_store(RETVAL, "mon_thousands_sep", 17,
2972 newSVpv(lcbuf->mon_thousands_sep, 0), 0);
2974 if (lcbuf->mon_grouping && *lcbuf->mon_grouping)
2975 hv_store(RETVAL, "mon_grouping", 12,
2976 newSVpv(lcbuf->mon_grouping, 0), 0);
2977 if (lcbuf->positive_sign && *lcbuf->positive_sign)
2978 hv_store(RETVAL, "positive_sign", 13,
2979 newSVpv(lcbuf->positive_sign, 0), 0);
2980 if (lcbuf->negative_sign && *lcbuf->negative_sign)
2981 hv_store(RETVAL, "negative_sign", 13,
2982 newSVpv(lcbuf->negative_sign, 0), 0);
2984 if (lcbuf->int_frac_digits != CHAR_MAX)
2985 hv_store(RETVAL, "int_frac_digits", 15,
2986 newSViv(lcbuf->int_frac_digits), 0);
2987 if (lcbuf->frac_digits != CHAR_MAX)
2988 hv_store(RETVAL, "frac_digits", 11,
2989 newSViv(lcbuf->frac_digits), 0);
2990 if (lcbuf->p_cs_precedes != CHAR_MAX)
2991 hv_store(RETVAL, "p_cs_precedes", 13,
2992 newSViv(lcbuf->p_cs_precedes), 0);
2993 if (lcbuf->p_sep_by_space != CHAR_MAX)
2994 hv_store(RETVAL, "p_sep_by_space", 14,
2995 newSViv(lcbuf->p_sep_by_space), 0);
2996 if (lcbuf->n_cs_precedes != CHAR_MAX)
2997 hv_store(RETVAL, "n_cs_precedes", 13,
2998 newSViv(lcbuf->n_cs_precedes), 0);
2999 if (lcbuf->n_sep_by_space != CHAR_MAX)
3000 hv_store(RETVAL, "n_sep_by_space", 14,
3001 newSViv(lcbuf->n_sep_by_space), 0);
3002 if (lcbuf->p_sign_posn != CHAR_MAX)
3003 hv_store(RETVAL, "p_sign_posn", 11,
3004 newSViv(lcbuf->p_sign_posn), 0);
3005 if (lcbuf->n_sign_posn != CHAR_MAX)
3006 hv_store(RETVAL, "n_sign_posn", 11,
3007 newSViv(lcbuf->n_sign_posn), 0);
3010 localeconv(); /* A stub to call not_here(). */
3016 setlocale(category, locale = 0)
3020 RETVAL = setlocale(category, locale);
3022 #ifdef USE_LOCALE_CTYPE
3023 if (category == LC_CTYPE
3025 || category == LC_ALL
3031 if (category == LC_ALL)
3032 newctype = setlocale(LC_CTYPE, NULL);
3036 perl_new_ctype(newctype);
3038 #endif /* USE_LOCALE_CTYPE */
3039 #ifdef USE_LOCALE_COLLATE
3040 if (category == LC_COLLATE
3042 || category == LC_ALL
3048 if (category == LC_ALL)
3049 newcoll = setlocale(LC_COLLATE, NULL);
3053 perl_new_collate(newcoll);
3055 #endif /* USE_LOCALE_COLLATE */
3056 #ifdef USE_LOCALE_NUMERIC
3057 if (category == LC_NUMERIC
3059 || category == LC_ALL
3065 if (category == LC_ALL)
3066 newnum = setlocale(LC_NUMERIC, NULL);
3070 perl_new_numeric(newnum);
3072 #endif /* USE_LOCALE_NUMERIC */
3112 /* (We already know stack is long enough.) */
3113 PUSHs(sv_2mortal(newSVnv(frexp(x,&expvar))));
3114 PUSHs(sv_2mortal(newSViv(expvar)));
3130 /* (We already know stack is long enough.) */
3131 PUSHs(sv_2mortal(newSVnv(modf(x,&intvar))));
3132 PUSHs(sv_2mortal(newSVnv(intvar)));
3147 sigaction(sig, action, oldaction = 0)
3149 POSIX::SigAction action
3150 POSIX::SigAction oldaction
3153 RETVAL = not_here("sigaction");
3155 # This code is really grody because we're trying to make the signal
3156 # interface look beautiful, which is hard.
3159 gv_fetchpv("SIG", TRUE, SVt_PVHV);
3162 struct sigaction act;
3163 struct sigaction oact;
3164 POSIX__SigSet sigset;
3166 SV** sigsvp = hv_fetch(GvHVn(siggv),
3168 strlen(sig_name[sig]),
3171 /* Remember old handler name if desired. */
3173 char *hand = SvPVx(*sigsvp, na);
3174 svp = hv_fetch(oldaction, "HANDLER", 7, TRUE);
3175 sv_setpv(*svp, *hand ? hand : "DEFAULT");
3179 /* Vector new handler through %SIG. (We always use sighandler
3180 for the C signal handler, which reads %SIG to dispatch.) */
3181 svp = hv_fetch(action, "HANDLER", 7, FALSE);
3183 croak("Can't supply an action without a HANDLER");
3184 sv_setpv(*sigsvp, SvPV(*svp, na));
3185 mg_set(*sigsvp); /* handles DEFAULT and IGNORE */
3186 act.sa_handler = sighandler;
3188 /* Set up any desired mask. */
3189 svp = hv_fetch(action, "MASK", 4, FALSE);
3190 if (svp && sv_isa(*svp, "POSIX::SigSet")) {
3192 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3193 sigset = (sigset_t*) tmp;
3194 act.sa_mask = *sigset;
3197 sigemptyset(& act.sa_mask);
3199 /* Set up any desired flags. */
3200 svp = hv_fetch(action, "FLAGS", 5, FALSE);
3201 act.sa_flags = svp ? SvIV(*svp) : 0;
3204 /* Now work around sigaction oddities */
3205 if (action && oldaction)
3206 RETVAL = sigaction(sig, & act, & oact);
3208 RETVAL = sigaction(sig, & act, (struct sigaction *)0);
3210 RETVAL = sigaction(sig, (struct sigaction *)0, & oact);
3215 /* Get back the mask. */
3216 svp = hv_fetch(oldaction, "MASK", 4, TRUE);
3217 if (sv_isa(*svp, "POSIX::SigSet")) {
3219 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3220 sigset = (sigset_t*) tmp;
3223 sigset = (sigset_t*)safemalloc(sizeof(sigset_t));
3224 sv_setptrobj(*svp, sigset, "POSIX::SigSet");
3226 *sigset = oact.sa_mask;
3228 /* Get back the flags. */
3229 svp = hv_fetch(oldaction, "FLAGS", 5, TRUE);
3230 sv_setiv(*svp, oact.sa_flags);
3239 POSIX::SigSet sigset
3242 sigprocmask(how, sigset, oldsigset = 0)
3244 POSIX::SigSet sigset
3245 POSIX::SigSet oldsigset
3248 sigsuspend(signal_mask)
3249 POSIX::SigSet signal_mask
3269 lseek(fd, offset, whence)
3282 if (pipe(fds) != -1) {
3284 PUSHs(sv_2mortal(newSViv(fds[0])));
3285 PUSHs(sv_2mortal(newSViv(fds[1])));
3289 read(fd, buffer, nbytes)
3291 SV *sv_buffer = SvROK(ST(1)) ? SvRV(ST(1)) : ST(1);
3295 char * buffer = sv_grow( sv_buffer, nbytes+1 );
3298 SvCUR(sv_buffer) = RETVAL;
3299 SvPOK_only(sv_buffer);
3300 *SvEND(sv_buffer) = '\0';
3301 SvTAINTED_on(sv_buffer);
3317 tcsetpgrp(fd, pgrp_id)
3326 if (uname(&buf) >= 0) {
3328 PUSHs(sv_2mortal(newSVpv(buf.sysname, 0)));
3329 PUSHs(sv_2mortal(newSVpv(buf.nodename, 0)));
3330 PUSHs(sv_2mortal(newSVpv(buf.release, 0)));
3331 PUSHs(sv_2mortal(newSVpv(buf.version, 0)));
3332 PUSHs(sv_2mortal(newSVpv(buf.machine, 0)));
3335 uname((char *) 0); /* A stub to call not_here(). */
3339 write(fd, buffer, nbytes)
3357 mbstowcs(s, pwcs, n)
3369 wcstombs(s, pwcs, n)
3391 SET_NUMERIC_LOCAL();
3392 num = strtod(str, &unparsed);
3393 PUSHs(sv_2mortal(newSVnv(num)));
3394 if (GIMME == G_ARRAY) {
3397 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3403 strtol(str, base = 0)
3410 num = strtol(str, &unparsed, base);
3411 if (num >= IV_MIN && num <= IV_MAX)
3412 PUSHs(sv_2mortal(newSViv((IV)num)));
3414 PUSHs(sv_2mortal(newSVnv((double)num)));
3415 if (GIMME == G_ARRAY) {
3418 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3424 strtoul(str, base = 0)
3431 num = strtoul(str, &unparsed, base);
3433 PUSHs(sv_2mortal(newSViv((IV)num)));
3435 PUSHs(sv_2mortal(newSVnv((double)num)));
3436 if (GIMME == G_ARRAY) {
3439 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3451 char *p = SvPV(src,srclen);
3453 ST(0) = sv_2mortal(NEWSV(800,srclen));
3454 dstlen = strxfrm(SvPVX(ST(0)), p, (size_t)srclen);
3455 if (dstlen > srclen) {
3457 SvGROW(ST(0), dstlen);
3458 strxfrm(SvPVX(ST(0)), p, (size_t)dstlen);
3461 SvCUR(ST(0)) = dstlen;
3466 mkfifo(filename, mode)
3470 TAINT_PROPER("mkfifo");
3471 RETVAL = mkfifo(filename, mode);
3487 tcflush(fd, queue_selector)
3492 tcsendbreak(fd, duration)
3497 asctime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3510 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3513 mytm.tm_hour = hour;
3514 mytm.tm_mday = mday;
3516 mytm.tm_year = year;
3517 mytm.tm_wday = wday;
3518 mytm.tm_yday = yday;
3519 mytm.tm_isdst = isdst;
3520 RETVAL = asctime(&mytm);
3537 realtime = times( &tms );
3539 PUSHs( sv_2mortal( newSViv( (IV) realtime ) ) );
3540 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_utime ) ) );
3541 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_stime ) ) );
3542 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cutime ) ) );
3543 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cstime ) ) );
3546 difftime(time1, time2)
3551 mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3564 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3567 mytm.tm_hour = hour;
3568 mytm.tm_mday = mday;
3570 mytm.tm_year = year;
3571 mytm.tm_wday = wday;
3572 mytm.tm_yday = yday;
3573 mytm.tm_isdst = isdst;
3574 RETVAL = mktime(&mytm);
3580 strftime(fmt, sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3596 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3599 mytm.tm_hour = hour;
3600 mytm.tm_mday = mday;
3602 mytm.tm_year = year;
3603 mytm.tm_wday = wday;
3604 mytm.tm_yday = yday;
3605 mytm.tm_isdst = isdst;
3606 len = strftime(tmpbuf, sizeof tmpbuf, fmt, &mytm);
3607 ST(0) = sv_2mortal(newSVpv(tmpbuf, len));
3617 PUSHs(sv_2mortal(newSVpv(tzname[0],strlen(tzname[0]))));
3618 PUSHs(sv_2mortal(newSVpv(tzname[1],strlen(tzname[1]))));
3621 access(filename, mode)
3639 pathconf(filename, name)