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 */
61 # endif /* __VMS_VER >= 70000000 or Dec C 5.6 */
63 /* The POSIX notion of ttyname() is better served by getname() under VMS */
64 static char ttnambuf[64];
65 # define ttyname(fd) (isatty(fd) > 0 ? getname(fd,ttnambuf,0) : NULL)
67 /* The non-POSIX CRTL times() has void return type, so we just get the
68 current time directly */
69 clock_t vms_times(struct tms *bufptr) {
71 /* Get wall time and convert to 10 ms intervals to
72 * produce the return value that the POSIX standard expects */
73 # if defined(__DECC) && defined (__ALPHA)
76 _ckvmssts(sys$gettim(&vmstime));
78 retval = vmstime & 0x7fffffff;
80 /* (Older hw or ccs don't have an atomic 64-bit type, so we
81 * juggle 32-bit ints (and a float) to produce a time_t result
82 * with minimal loss of information.) */
83 long int vmstime[2],remainder,divisor = 100000;
84 _ckvmssts(sys$gettim((unsigned long int *)vmstime));
85 vmstime[1] &= 0x7fff; /* prevent overflow in EDIV */
86 _ckvmssts(lib$ediv(&divisor,vmstime,(long int *)&retval,&remainder));
88 /* Fill in the struct tms using the CRTL routine . . .*/
89 times((tbuffer_t *)bufptr);
90 return (clock_t) retval;
92 # define times(t) vms_times(t)
95 # include <sys/times.h>
97 # include <sys/utsname.h>
99 # include <sys/wait.h>
106 typedef long SysRetLong;
107 typedef sigset_t* POSIX__SigSet;
108 typedef HV* POSIX__SigAction;
110 typedef struct termios* POSIX__Termios;
111 #else /* Define termios types to int, and call not_here for the functions.*/
112 #define POSIX__Termios int
116 #define cfgetispeed(x) not_here("cfgetispeed")
117 #define cfgetospeed(x) not_here("cfgetospeed")
118 #define tcdrain(x) not_here("tcdrain")
119 #define tcflush(x,y) not_here("tcflush")
120 #define tcsendbreak(x,y) not_here("tcsendbreak")
121 #define cfsetispeed(x,y) not_here("cfsetispeed")
122 #define cfsetospeed(x,y) not_here("cfsetospeed")
123 #define ctermid(x) (char *) not_here("ctermid")
124 #define tcflow(x,y) not_here("tcflow")
125 #define tcgetattr(x,y) not_here("tcgetattr")
126 #define tcsetattr(x,y,z) not_here("tcsetattr")
129 /* Possibly needed prototypes */
130 char *cuserid _((char *));
131 double strtod _((const char *, char **));
132 long strtol _((const char *, char **, int));
133 unsigned long strtoul _((const char *, char **, int));
136 #define cuserid(a) (char *) not_here("cuserid")
140 #define difftime(a,b) not_here("difftime")
143 #ifndef HAS_FPATHCONF
144 #define fpathconf(f,n) (SysRetLong) not_here("fpathconf")
147 #define mktime(a) not_here("mktime")
150 #define nice(a) not_here("nice")
153 #define pathconf(f,n) (SysRetLong) not_here("pathconf")
156 #define sysconf(n) (SysRetLong) not_here("sysconf")
159 #define readlink(a,b,c) not_here("readlink")
162 #define setpgid(a,b) not_here("setpgid")
165 #define setsid() not_here("setsid")
168 #define strcoll(s1,s2) not_here("strcoll")
171 #define strtod(s1,s2) not_here("strtod")
174 #define strtol(s1,s2,b) not_here("strtol")
177 #define strtoul(s1,s2,b) not_here("strtoul")
180 #define strxfrm(s1,s2,n) not_here("strxfrm")
182 #ifndef HAS_TCGETPGRP
183 #define tcgetpgrp(a) not_here("tcgetpgrp")
185 #ifndef HAS_TCSETPGRP
186 #define tcsetpgrp(a,b) not_here("tcsetpgrp")
189 #define times(a) not_here("times")
192 #define uname(a) not_here("uname")
195 #define waitpid(a,b,c) not_here("waitpid")
200 #define mblen(a,b) not_here("mblen")
204 #define mbstowcs(s, pwcs, n) not_here("mbstowcs")
207 #define mbtowc(pwc, s, n) not_here("mbtowc")
210 #define wcstombs(s, pwcs, n) not_here("wcstombs")
213 #define wctomb(s, wchar) not_here("wcstombs")
215 #if !defined(HAS_MBLEN) && !defined(HAS_MBSTOWCS) && !defined(HAS_MBTOWC) && !defined(HAS_WCSTOMBS) && !defined(HAS_WCTOMB)
216 /* If we don't have these functions, then we wouldn't have gotten a typedef
217 for wchar_t, the wide character type. Defining wchar_t allows the
218 functions referencing it to compile. Its actual type is then meaningless,
219 since without the above functions, all sections using it end up calling
220 not_here() and croak. --Kaveh Ghazi (ghazi@noc.rutgers.edu) 9/18/94. */
226 #ifndef HAS_LOCALECONV
227 #define localeconv() not_here("localeconv")
231 extern char *tzname[];
233 char *tzname[] = { "" , "" };
236 /* XXX struct tm on some systems (SunOS4/BSD) contains extra (non POSIX)
237 * fields for which we don't have Configure support yet:
238 * char *tm_zone; -- abbreviation of timezone name
239 * long tm_gmtoff; -- offset from GMT in seconds
240 * To workaround core dumps from the uninitialised tm_zone we get the
241 * system to give us a reasonable struct to copy. This fix means that
242 * strftime uses the tm_zone and tm_gmtoff values returned by
243 * localtime(time()). That should give the desired result most of the
244 * time. But probably not always!
246 * This is a temporary workaround to be removed once Configure
247 * support is added and NETaa14816 is considered in full.
248 * It does not address tzname aspects of NETaa14816.
250 #ifdef STRUCT_TM_HASZONE
252 init_tm(ptm) /* see mktime, strftime and asctime */
257 Copy(localtime(&now), ptm, 1, struct tm);
261 # define init_tm(ptm)
265 #ifndef HAS_LONG_DOUBLE /* XXX What to do about long doubles? */
280 croak("POSIX::%s not implemented on this architecture", s);
285 constant(char *name, int arg)
290 if (strEQ(name, "ARG_MAX"))
298 if (strEQ(name, "BUFSIZ"))
304 if (strEQ(name, "BRKINT"))
310 if (strEQ(name, "B9600"))
316 if (strEQ(name, "B19200"))
322 if (strEQ(name, "B38400"))
328 if (strEQ(name, "B0"))
334 if (strEQ(name, "B110"))
340 if (strEQ(name, "B1200"))
346 if (strEQ(name, "B134"))
352 if (strEQ(name, "B150"))
358 if (strEQ(name, "B1800"))
364 if (strEQ(name, "B200"))
370 if (strEQ(name, "B2400"))
376 if (strEQ(name, "B300"))
382 if (strEQ(name, "B4800"))
388 if (strEQ(name, "B50"))
394 if (strEQ(name, "B600"))
400 if (strEQ(name, "B75"))
408 if (strEQ(name, "CHAR_BIT"))
414 if (strEQ(name, "CHAR_MAX"))
420 if (strEQ(name, "CHAR_MIN"))
426 if (strEQ(name, "CHILD_MAX"))
432 if (strEQ(name, "CLK_TCK"))
438 if (strEQ(name, "CLOCAL"))
444 if (strEQ(name, "CLOCKS_PER_SEC"))
445 #ifdef CLOCKS_PER_SEC
446 return CLOCKS_PER_SEC;
450 if (strEQ(name, "CREAD"))
456 if (strEQ(name, "CS5"))
462 if (strEQ(name, "CS6"))
468 if (strEQ(name, "CS7"))
474 if (strEQ(name, "CS8"))
480 if (strEQ(name, "CSIZE"))
486 if (strEQ(name, "CSTOPB"))
494 if (strEQ(name, "DBL_MAX"))
500 if (strEQ(name, "DBL_MIN"))
506 if (strEQ(name, "DBL_DIG"))
512 if (strEQ(name, "DBL_EPSILON"))
518 if (strEQ(name, "DBL_MANT_DIG"))
524 if (strEQ(name, "DBL_MAX_10_EXP"))
525 #ifdef DBL_MAX_10_EXP
526 return DBL_MAX_10_EXP;
530 if (strEQ(name, "DBL_MAX_EXP"))
536 if (strEQ(name, "DBL_MIN_10_EXP"))
537 #ifdef DBL_MIN_10_EXP
538 return DBL_MIN_10_EXP;
542 if (strEQ(name, "DBL_MIN_EXP"))
552 if (strEQ(name, "EACCES"))
558 if (strEQ(name, "EADDRINUSE"))
564 if (strEQ(name, "EADDRNOTAVAIL"))
566 return EADDRNOTAVAIL;
570 if (strEQ(name, "EAFNOSUPPORT"))
576 if (strEQ(name, "EAGAIN"))
582 if (strEQ(name, "EALREADY"))
590 if (strEQ(name, "EBADF"))
596 if (strEQ(name, "EBUSY"))
604 if (strEQ(name, "ECHILD"))
610 if (strEQ(name, "ECHO"))
616 if (strEQ(name, "ECHOE"))
622 if (strEQ(name, "ECHOK"))
628 if (strEQ(name, "ECHONL"))
634 if (strEQ(name, "ECONNABORTED"))
640 if (strEQ(name, "ECONNREFUSED"))
646 if (strEQ(name, "ECONNRESET"))
654 if (strEQ(name, "EDEADLK"))
660 if (strEQ(name, "EDESTADDRREQ"))
666 if (strEQ(name, "EDOM"))
672 if (strEQ(name, "EDQUOT"))
680 if (strEQ(name, "EEXIST"))
688 if (strEQ(name, "EFAULT"))
694 if (strEQ(name, "EFBIG"))
702 if (strEQ(name, "EHOSTDOWN"))
708 if (strEQ(name, "EHOSTUNREACH"))
716 if (strEQ(name, "EINPROGRESS"))
722 if (strEQ(name, "EINTR"))
728 if (strEQ(name, "EINVAL"))
734 if (strEQ(name, "EIO"))
740 if (strEQ(name, "EISCONN"))
746 if (strEQ(name, "EISDIR"))
752 if (strEQ(name, "ELOOP"))
760 if (strEQ(name, "EMFILE"))
766 if (strEQ(name, "EMLINK"))
772 if (strEQ(name, "EMSGSIZE"))
780 if (strEQ(name, "ENETDOWN"))
786 if (strEQ(name, "ENETRESET"))
792 if (strEQ(name, "ENETUNREACH"))
798 if (strEQ(name, "ENOBUFS"))
804 if (strEQ(name, "ENOEXEC"))
810 if (strEQ(name, "ENOMEM"))
816 if (strEQ(name, "ENOPROTOOPT"))
822 if (strEQ(name, "ENOSPC"))
828 if (strEQ(name, "ENOTBLK"))
834 if (strEQ(name, "ENOTCONN"))
840 if (strEQ(name, "ENOTDIR"))
846 if (strEQ(name, "ENOTEMPTY"))
852 if (strEQ(name, "ENOTSOCK"))
858 if (strEQ(name, "ENOTTY"))
864 if (strEQ(name, "ENFILE"))
870 if (strEQ(name, "ENODEV"))
876 if (strEQ(name, "ENOENT"))
882 if (strEQ(name, "ENOLCK"))
888 if (strEQ(name, "ENOSYS"))
894 if (strEQ(name, "ENXIO"))
900 if (strEQ(name, "ENAMETOOLONG"))
908 if (strEQ(name, "EOF"))
914 if (strEQ(name, "EOPNOTSUPP"))
922 if (strEQ(name, "EPERM"))
928 if (strEQ(name, "EPFNOSUPPORT"))
934 if (strEQ(name, "EPIPE"))
940 if (strEQ(name, "EPROCLIM"))
946 if (strEQ(name, "EPROTONOSUPPORT"))
947 #ifdef EPROTONOSUPPORT
948 return EPROTONOSUPPORT;
952 if (strEQ(name, "EPROTOTYPE"))
960 if (strEQ(name, "ERANGE"))
966 if (strEQ(name, "EREMOTE"))
972 if (strEQ(name, "ERESTART"))
978 if (strEQ(name, "EROFS"))
986 if (strEQ(name, "ESHUTDOWN"))
992 if (strEQ(name, "ESOCKTNOSUPPORT"))
993 #ifdef ESOCKTNOSUPPORT
994 return ESOCKTNOSUPPORT;
998 if (strEQ(name, "ESPIPE"))
1004 if (strEQ(name, "ESRCH"))
1010 if (strEQ(name, "ESTALE"))
1018 if (strEQ(name, "ETIMEDOUT"))
1024 if (strEQ(name, "ETOOMANYREFS"))
1026 return ETOOMANYREFS;
1030 if (strEQ(name, "ETXTBSY"))
1038 if (strEQ(name, "EUSERS"))
1046 if (strEQ(name, "EWOULDBLOCK"))
1054 if (strEQ(name, "EXIT_FAILURE"))
1056 return EXIT_FAILURE;
1060 if (strEQ(name, "EXIT_SUCCESS"))
1062 return EXIT_SUCCESS;
1066 if (strEQ(name, "EXDEV"))
1074 if (strEQ(name, "E2BIG"))
1082 if (strnEQ(name, "FLT_", 4)) {
1083 if (strEQ(name, "FLT_MAX"))
1089 if (strEQ(name, "FLT_MIN"))
1095 if (strEQ(name, "FLT_ROUNDS"))
1101 if (strEQ(name, "FLT_DIG"))
1107 if (strEQ(name, "FLT_EPSILON"))
1113 if (strEQ(name, "FLT_MANT_DIG"))
1115 return FLT_MANT_DIG;
1119 if (strEQ(name, "FLT_MAX_10_EXP"))
1120 #ifdef FLT_MAX_10_EXP
1121 return FLT_MAX_10_EXP;
1125 if (strEQ(name, "FLT_MAX_EXP"))
1131 if (strEQ(name, "FLT_MIN_10_EXP"))
1132 #ifdef FLT_MIN_10_EXP
1133 return FLT_MIN_10_EXP;
1137 if (strEQ(name, "FLT_MIN_EXP"))
1143 if (strEQ(name, "FLT_RADIX"))
1151 if (strnEQ(name, "F_", 2)) {
1152 if (strEQ(name, "F_DUPFD"))
1158 if (strEQ(name, "F_GETFD"))
1164 if (strEQ(name, "F_GETFL"))
1170 if (strEQ(name, "F_GETLK"))
1176 if (strEQ(name, "F_OK"))
1182 if (strEQ(name, "F_RDLCK"))
1188 if (strEQ(name, "F_SETFD"))
1194 if (strEQ(name, "F_SETFL"))
1200 if (strEQ(name, "F_SETLK"))
1206 if (strEQ(name, "F_SETLKW"))
1212 if (strEQ(name, "F_UNLCK"))
1218 if (strEQ(name, "F_WRLCK"))
1226 if (strEQ(name, "FD_CLOEXEC"))
1232 if (strEQ(name, "FILENAME_MAX"))
1234 return FILENAME_MAX;
1240 if (strEQ(name, "HUGE_VAL"))
1246 if (strEQ(name, "HUPCL"))
1254 if (strEQ(name, "INT_MAX"))
1260 if (strEQ(name, "INT_MIN"))
1266 if (strEQ(name, "ICANON"))
1272 if (strEQ(name, "ICRNL"))
1278 if (strEQ(name, "IEXTEN"))
1284 if (strEQ(name, "IGNBRK"))
1290 if (strEQ(name, "IGNCR"))
1296 if (strEQ(name, "IGNPAR"))
1302 if (strEQ(name, "INLCR"))
1308 if (strEQ(name, "INPCK"))
1314 if (strEQ(name, "ISIG"))
1320 if (strEQ(name, "ISTRIP"))
1326 if (strEQ(name, "IXOFF"))
1332 if (strEQ(name, "IXON"))
1340 if (strnEQ(name, "LC_", 3)) {
1341 if (strEQ(name, "LC_ALL"))
1347 if (strEQ(name, "LC_COLLATE"))
1353 if (strEQ(name, "LC_CTYPE"))
1359 if (strEQ(name, "LC_MONETARY"))
1365 if (strEQ(name, "LC_NUMERIC"))
1371 if (strEQ(name, "LC_TIME"))
1379 if (strnEQ(name, "LDBL_", 5)) {
1380 if (strEQ(name, "LDBL_MAX"))
1386 if (strEQ(name, "LDBL_MIN"))
1392 if (strEQ(name, "LDBL_DIG"))
1398 if (strEQ(name, "LDBL_EPSILON"))
1400 return LDBL_EPSILON;
1404 if (strEQ(name, "LDBL_MANT_DIG"))
1405 #ifdef LDBL_MANT_DIG
1406 return LDBL_MANT_DIG;
1410 if (strEQ(name, "LDBL_MAX_10_EXP"))
1411 #ifdef LDBL_MAX_10_EXP
1412 return LDBL_MAX_10_EXP;
1416 if (strEQ(name, "LDBL_MAX_EXP"))
1418 return LDBL_MAX_EXP;
1422 if (strEQ(name, "LDBL_MIN_10_EXP"))
1423 #ifdef LDBL_MIN_10_EXP
1424 return LDBL_MIN_10_EXP;
1428 if (strEQ(name, "LDBL_MIN_EXP"))
1430 return LDBL_MIN_EXP;
1436 if (strnEQ(name, "L_", 2)) {
1437 if (strEQ(name, "L_ctermid"))
1443 if (strEQ(name, "L_cuserid"))
1449 if (strEQ(name, "L_tmpname"))
1457 if (strEQ(name, "LONG_MAX"))
1463 if (strEQ(name, "LONG_MIN"))
1469 if (strEQ(name, "LINK_MAX"))
1477 if (strEQ(name, "MAX_CANON"))
1483 if (strEQ(name, "MAX_INPUT"))
1489 if (strEQ(name, "MB_CUR_MAX"))
1495 if (strEQ(name, "MB_LEN_MAX"))
1503 if (strEQ(name, "NULL")) return 0;
1504 if (strEQ(name, "NAME_MAX"))
1510 if (strEQ(name, "NCCS"))
1516 if (strEQ(name, "NGROUPS_MAX"))
1522 if (strEQ(name, "NOFLSH"))
1530 if (strnEQ(name, "O_", 2)) {
1531 if (strEQ(name, "O_APPEND"))
1537 if (strEQ(name, "O_CREAT"))
1543 if (strEQ(name, "O_TRUNC"))
1549 if (strEQ(name, "O_RDONLY"))
1555 if (strEQ(name, "O_RDWR"))
1561 if (strEQ(name, "O_WRONLY"))
1567 if (strEQ(name, "O_EXCL"))
1573 if (strEQ(name, "O_NOCTTY"))
1579 if (strEQ(name, "O_NONBLOCK"))
1585 if (strEQ(name, "O_ACCMODE"))
1593 if (strEQ(name, "OPEN_MAX"))
1599 if (strEQ(name, "OPOST"))
1607 if (strEQ(name, "PATH_MAX"))
1613 if (strEQ(name, "PARENB"))
1619 if (strEQ(name, "PARMRK"))
1625 if (strEQ(name, "PARODD"))
1631 if (strEQ(name, "PIPE_BUF"))
1639 if (strEQ(name, "RAND_MAX"))
1645 if (strEQ(name, "R_OK"))
1653 if (strnEQ(name, "SIG", 3)) {
1654 if (name[3] == '_') {
1655 if (strEQ(name, "SIG_BLOCK"))
1662 if (strEQ(name, "SIG_DFL")) return (IV)SIG_DFL;
1665 if (strEQ(name, "SIG_ERR")) return (IV)SIG_ERR;
1668 if (strEQ(name, "SIG_IGN")) return (IV)SIG_IGN;
1670 if (strEQ(name, "SIG_SETMASK"))
1676 if (strEQ(name, "SIG_UNBLOCK"))
1684 if (strEQ(name, "SIGABRT"))
1690 if (strEQ(name, "SIGALRM"))
1696 if (strEQ(name, "SIGCHLD"))
1702 if (strEQ(name, "SIGCONT"))
1708 if (strEQ(name, "SIGFPE"))
1714 if (strEQ(name, "SIGHUP"))
1720 if (strEQ(name, "SIGILL"))
1726 if (strEQ(name, "SIGINT"))
1732 if (strEQ(name, "SIGKILL"))
1738 if (strEQ(name, "SIGPIPE"))
1744 if (strEQ(name, "SIGQUIT"))
1750 if (strEQ(name, "SIGSEGV"))
1756 if (strEQ(name, "SIGSTOP"))
1762 if (strEQ(name, "SIGTERM"))
1768 if (strEQ(name, "SIGTSTP"))
1774 if (strEQ(name, "SIGTTIN"))
1780 if (strEQ(name, "SIGTTOU"))
1786 if (strEQ(name, "SIGUSR1"))
1792 if (strEQ(name, "SIGUSR2"))
1800 if (name[1] == '_') {
1801 if (strEQ(name, "S_ISGID"))
1807 if (strEQ(name, "S_ISUID"))
1813 if (strEQ(name, "S_IRGRP"))
1819 if (strEQ(name, "S_IROTH"))
1825 if (strEQ(name, "S_IRUSR"))
1831 if (strEQ(name, "S_IRWXG"))
1837 if (strEQ(name, "S_IRWXO"))
1843 if (strEQ(name, "S_IRWXU"))
1849 if (strEQ(name, "S_IWGRP"))
1855 if (strEQ(name, "S_IWOTH"))
1861 if (strEQ(name, "S_IWUSR"))
1867 if (strEQ(name, "S_IXGRP"))
1873 if (strEQ(name, "S_IXOTH"))
1879 if (strEQ(name, "S_IXUSR"))
1885 errno = EAGAIN; /* the following aren't constants */
1887 if (strEQ(name, "S_ISBLK")) return S_ISBLK(arg);
1890 if (strEQ(name, "S_ISCHR")) return S_ISCHR(arg);
1893 if (strEQ(name, "S_ISDIR")) return S_ISDIR(arg);
1896 if (strEQ(name, "S_ISFIFO")) return S_ISFIFO(arg);
1899 if (strEQ(name, "S_ISREG")) return S_ISREG(arg);
1903 if (strEQ(name, "SEEK_CUR"))
1909 if (strEQ(name, "SEEK_END"))
1915 if (strEQ(name, "SEEK_SET"))
1921 if (strEQ(name, "STREAM_MAX"))
1927 if (strEQ(name, "SHRT_MAX"))
1933 if (strEQ(name, "SHRT_MIN"))
1939 if (strnEQ(name, "SA_", 3)) {
1940 if (strEQ(name, "SA_NOCLDSTOP"))
1942 return SA_NOCLDSTOP;
1946 if (strEQ(name, "SA_NOCLDWAIT"))
1948 return SA_NOCLDWAIT;
1952 if (strEQ(name, "SA_NODEFER"))
1958 if (strEQ(name, "SA_ONSTACK"))
1964 if (strEQ(name, "SA_RESETHAND"))
1966 return SA_RESETHAND;
1970 if (strEQ(name, "SA_RESTART"))
1976 if (strEQ(name, "SA_SIGINFO"))
1984 if (strEQ(name, "SCHAR_MAX"))
1990 if (strEQ(name, "SCHAR_MIN"))
1996 if (strEQ(name, "SSIZE_MAX"))
2002 if (strEQ(name, "STDIN_FILENO"))
2004 return STDIN_FILENO;
2008 if (strEQ(name, "STDOUT_FILENO"))
2009 #ifdef STDOUT_FILENO
2010 return STDOUT_FILENO;
2014 if (strEQ(name, "STRERR_FILENO"))
2015 #ifdef STRERR_FILENO
2016 return STRERR_FILENO;
2022 if (strEQ(name, "TCIFLUSH"))
2028 if (strEQ(name, "TCIOFF"))
2034 if (strEQ(name, "TCIOFLUSH"))
2040 if (strEQ(name, "TCION"))
2046 if (strEQ(name, "TCOFLUSH"))
2052 if (strEQ(name, "TCOOFF"))
2058 if (strEQ(name, "TCOON"))
2064 if (strEQ(name, "TCSADRAIN"))
2070 if (strEQ(name, "TCSAFLUSH"))
2076 if (strEQ(name, "TCSANOW"))
2082 if (strEQ(name, "TMP_MAX"))
2088 if (strEQ(name, "TOSTOP"))
2094 if (strEQ(name, "TZNAME_MAX"))
2102 if (strEQ(name, "UCHAR_MAX"))
2108 if (strEQ(name, "UINT_MAX"))
2114 if (strEQ(name, "ULONG_MAX"))
2120 if (strEQ(name, "USHRT_MAX"))
2128 if (strEQ(name, "VEOF"))
2134 if (strEQ(name, "VEOL"))
2140 if (strEQ(name, "VERASE"))
2146 if (strEQ(name, "VINTR"))
2152 if (strEQ(name, "VKILL"))
2158 if (strEQ(name, "VMIN"))
2164 if (strEQ(name, "VQUIT"))
2170 if (strEQ(name, "VSTART"))
2176 if (strEQ(name, "VSTOP"))
2182 if (strEQ(name, "VSUSP"))
2188 if (strEQ(name, "VTIME"))
2196 if (strEQ(name, "W_OK"))
2202 if (strEQ(name, "WNOHANG"))
2208 if (strEQ(name, "WUNTRACED"))
2214 errno = EAGAIN; /* the following aren't constants */
2216 if (strEQ(name, "WEXITSTATUS")) return WEXITSTATUS(arg);
2219 if (strEQ(name, "WIFEXITED")) return WIFEXITED(arg);
2222 if (strEQ(name, "WIFSIGNALED")) return WIFSIGNALED(arg);
2225 if (strEQ(name, "WIFSTOPPED")) return WIFSTOPPED(arg);
2228 if (strEQ(name, "WSTOPSIG")) return WSTOPSIG(arg);
2231 if (strEQ(name, "WTERMSIG")) return WTERMSIG(arg);
2235 if (strEQ(name, "X_OK"))
2243 if (strnEQ(name, "_PC_", 4)) {
2244 if (strEQ(name, "_PC_CHOWN_RESTRICTED"))
2245 #ifdef _PC_CHOWN_RESTRICTED
2246 return _PC_CHOWN_RESTRICTED;
2250 if (strEQ(name, "_PC_LINK_MAX"))
2252 return _PC_LINK_MAX;
2256 if (strEQ(name, "_PC_MAX_CANON"))
2257 #ifdef _PC_MAX_CANON
2258 return _PC_MAX_CANON;
2262 if (strEQ(name, "_PC_MAX_INPUT"))
2263 #ifdef _PC_MAX_INPUT
2264 return _PC_MAX_INPUT;
2268 if (strEQ(name, "_PC_NAME_MAX"))
2270 return _PC_NAME_MAX;
2274 if (strEQ(name, "_PC_NO_TRUNC"))
2276 return _PC_NO_TRUNC;
2280 if (strEQ(name, "_PC_PATH_MAX"))
2282 return _PC_PATH_MAX;
2286 if (strEQ(name, "_PC_PIPE_BUF"))
2288 return _PC_PIPE_BUF;
2292 if (strEQ(name, "_PC_VDISABLE"))
2294 return _PC_VDISABLE;
2300 if (strnEQ(name, "_POSIX_", 7)) {
2301 if (strEQ(name, "_POSIX_ARG_MAX"))
2302 #ifdef _POSIX_ARG_MAX
2303 return _POSIX_ARG_MAX;
2307 if (strEQ(name, "_POSIX_CHILD_MAX"))
2308 #ifdef _POSIX_CHILD_MAX
2309 return _POSIX_CHILD_MAX;
2313 if (strEQ(name, "_POSIX_CHOWN_RESTRICTED"))
2314 #ifdef _POSIX_CHOWN_RESTRICTED
2315 return _POSIX_CHOWN_RESTRICTED;
2319 if (strEQ(name, "_POSIX_JOB_CONTROL"))
2320 #ifdef _POSIX_JOB_CONTROL
2321 return _POSIX_JOB_CONTROL;
2325 if (strEQ(name, "_POSIX_LINK_MAX"))
2326 #ifdef _POSIX_LINK_MAX
2327 return _POSIX_LINK_MAX;
2331 if (strEQ(name, "_POSIX_MAX_CANON"))
2332 #ifdef _POSIX_MAX_CANON
2333 return _POSIX_MAX_CANON;
2337 if (strEQ(name, "_POSIX_MAX_INPUT"))
2338 #ifdef _POSIX_MAX_INPUT
2339 return _POSIX_MAX_INPUT;
2343 if (strEQ(name, "_POSIX_NAME_MAX"))
2344 #ifdef _POSIX_NAME_MAX
2345 return _POSIX_NAME_MAX;
2349 if (strEQ(name, "_POSIX_NGROUPS_MAX"))
2350 #ifdef _POSIX_NGROUPS_MAX
2351 return _POSIX_NGROUPS_MAX;
2355 if (strEQ(name, "_POSIX_NO_TRUNC"))
2356 #ifdef _POSIX_NO_TRUNC
2357 return _POSIX_NO_TRUNC;
2361 if (strEQ(name, "_POSIX_OPEN_MAX"))
2362 #ifdef _POSIX_OPEN_MAX
2363 return _POSIX_OPEN_MAX;
2367 if (strEQ(name, "_POSIX_PATH_MAX"))
2368 #ifdef _POSIX_PATH_MAX
2369 return _POSIX_PATH_MAX;
2373 if (strEQ(name, "_POSIX_PIPE_BUF"))
2374 #ifdef _POSIX_PIPE_BUF
2375 return _POSIX_PIPE_BUF;
2379 if (strEQ(name, "_POSIX_SAVED_IDS"))
2380 #ifdef _POSIX_SAVED_IDS
2381 return _POSIX_SAVED_IDS;
2385 if (strEQ(name, "_POSIX_SSIZE_MAX"))
2386 #ifdef _POSIX_SSIZE_MAX
2387 return _POSIX_SSIZE_MAX;
2391 if (strEQ(name, "_POSIX_STREAM_MAX"))
2392 #ifdef _POSIX_STREAM_MAX
2393 return _POSIX_STREAM_MAX;
2397 if (strEQ(name, "_POSIX_TZNAME_MAX"))
2398 #ifdef _POSIX_TZNAME_MAX
2399 return _POSIX_TZNAME_MAX;
2403 if (strEQ(name, "_POSIX_VDISABLE"))
2404 #ifdef _POSIX_VDISABLE
2405 return _POSIX_VDISABLE;
2409 if (strEQ(name, "_POSIX_VERSION"))
2410 #ifdef _POSIX_VERSION
2411 return _POSIX_VERSION;
2417 if (strnEQ(name, "_SC_", 4)) {
2418 if (strEQ(name, "_SC_ARG_MAX"))
2424 if (strEQ(name, "_SC_CHILD_MAX"))
2425 #ifdef _SC_CHILD_MAX
2426 return _SC_CHILD_MAX;
2430 if (strEQ(name, "_SC_CLK_TCK"))
2436 if (strEQ(name, "_SC_JOB_CONTROL"))
2437 #ifdef _SC_JOB_CONTROL
2438 return _SC_JOB_CONTROL;
2442 if (strEQ(name, "_SC_NGROUPS_MAX"))
2443 #ifdef _SC_NGROUPS_MAX
2444 return _SC_NGROUPS_MAX;
2448 if (strEQ(name, "_SC_OPEN_MAX"))
2450 return _SC_OPEN_MAX;
2454 if (strEQ(name, "_SC_SAVED_IDS"))
2455 #ifdef _SC_SAVED_IDS
2456 return _SC_SAVED_IDS;
2460 if (strEQ(name, "_SC_STREAM_MAX"))
2461 #ifdef _SC_STREAM_MAX
2462 return _SC_STREAM_MAX;
2466 if (strEQ(name, "_SC_TZNAME_MAX"))
2467 #ifdef _SC_TZNAME_MAX
2468 return _SC_TZNAME_MAX;
2472 if (strEQ(name, "_SC_VERSION"))
2489 MODULE = SigSet PACKAGE = POSIX::SigSet PREFIX = sig
2492 new(packname = "POSIX::SigSet", ...)
2497 RETVAL = (sigset_t*)safemalloc(sizeof(sigset_t));
2498 sigemptyset(RETVAL);
2499 for (i = 1; i < items; i++)
2500 sigaddset(RETVAL, SvIV(ST(i)));
2507 POSIX::SigSet sigset
2509 safefree((char *)sigset);
2512 sigaddset(sigset, sig)
2513 POSIX::SigSet sigset
2517 sigdelset(sigset, sig)
2518 POSIX::SigSet sigset
2523 POSIX::SigSet sigset
2527 POSIX::SigSet sigset
2530 sigismember(sigset, sig)
2531 POSIX::SigSet sigset
2535 MODULE = Termios PACKAGE = POSIX::Termios PREFIX = cf
2538 new(packname = "POSIX::Termios", ...)
2543 RETVAL = (struct termios*)safemalloc(sizeof(struct termios));
2545 not_here("termios");
2552 DESTROY(termios_ref)
2553 POSIX::Termios termios_ref
2556 safefree((char *)termios_ref);
2558 not_here("termios");
2562 getattr(termios_ref, fd = 0)
2563 POSIX::Termios termios_ref
2566 RETVAL = tcgetattr(fd, termios_ref);
2571 setattr(termios_ref, fd = 0, optional_actions = 0)
2572 POSIX::Termios termios_ref
2574 int optional_actions
2576 RETVAL = tcsetattr(fd, optional_actions, termios_ref);
2581 cfgetispeed(termios_ref)
2582 POSIX::Termios termios_ref
2585 cfgetospeed(termios_ref)
2586 POSIX::Termios termios_ref
2589 getiflag(termios_ref)
2590 POSIX::Termios termios_ref
2592 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2593 RETVAL = termios_ref->c_iflag;
2595 not_here("getiflag");
2601 getoflag(termios_ref)
2602 POSIX::Termios termios_ref
2604 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2605 RETVAL = termios_ref->c_oflag;
2607 not_here("getoflag");
2613 getcflag(termios_ref)
2614 POSIX::Termios termios_ref
2616 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2617 RETVAL = termios_ref->c_cflag;
2619 not_here("getcflag");
2625 getlflag(termios_ref)
2626 POSIX::Termios termios_ref
2628 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2629 RETVAL = termios_ref->c_lflag;
2631 not_here("getlflag");
2637 getcc(termios_ref, ccix)
2638 POSIX::Termios termios_ref
2641 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2643 croak("Bad getcc subscript");
2644 RETVAL = termios_ref->c_cc[ccix];
2652 cfsetispeed(termios_ref, speed)
2653 POSIX::Termios termios_ref
2657 cfsetospeed(termios_ref, speed)
2658 POSIX::Termios termios_ref
2662 setiflag(termios_ref, iflag)
2663 POSIX::Termios termios_ref
2666 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2667 termios_ref->c_iflag = iflag;
2669 not_here("setiflag");
2673 setoflag(termios_ref, oflag)
2674 POSIX::Termios termios_ref
2677 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2678 termios_ref->c_oflag = oflag;
2680 not_here("setoflag");
2684 setcflag(termios_ref, cflag)
2685 POSIX::Termios termios_ref
2688 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2689 termios_ref->c_cflag = cflag;
2691 not_here("setcflag");
2695 setlflag(termios_ref, lflag)
2696 POSIX::Termios termios_ref
2699 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2700 termios_ref->c_lflag = lflag;
2702 not_here("setlflag");
2706 setcc(termios_ref, ccix, cc)
2707 POSIX::Termios termios_ref
2711 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2713 croak("Bad setcc subscript");
2714 termios_ref->c_cc[ccix] = cc;
2720 MODULE = POSIX PACKAGE = POSIX
2729 unsigned char * charstring
2731 unsigned char *s = charstring;
2732 unsigned char *e = s + na; /* "na" set by typemap side effect */
2733 for (RETVAL = 1; RETVAL && s < e; s++)
2741 unsigned char * charstring
2743 unsigned char *s = charstring;
2744 unsigned char *e = s + na; /* "na" set by typemap side effect */
2745 for (RETVAL = 1; RETVAL && s < e; s++)
2753 unsigned char * charstring
2755 unsigned char *s = charstring;
2756 unsigned char *e = s + na; /* "na" set by typemap side effect */
2757 for (RETVAL = 1; RETVAL && s < e; s++)
2765 unsigned char * charstring
2767 unsigned char *s = charstring;
2768 unsigned char *e = s + na; /* "na" set by typemap side effect */
2769 for (RETVAL = 1; RETVAL && s < e; s++)
2777 unsigned char * charstring
2779 unsigned char *s = charstring;
2780 unsigned char *e = s + na; /* "na" set by typemap side effect */
2781 for (RETVAL = 1; RETVAL && s < e; s++)
2789 unsigned char * charstring
2791 unsigned char *s = charstring;
2792 unsigned char *e = s + na; /* "na" set by typemap side effect */
2793 for (RETVAL = 1; RETVAL && s < e; s++)
2801 unsigned char * charstring
2803 unsigned char *s = charstring;
2804 unsigned char *e = s + na; /* "na" set by typemap side effect */
2805 for (RETVAL = 1; RETVAL && s < e; s++)
2813 unsigned char * charstring
2815 unsigned char *s = charstring;
2816 unsigned char *e = s + na; /* "na" set by typemap side effect */
2817 for (RETVAL = 1; RETVAL && s < e; s++)
2825 unsigned char * charstring
2827 unsigned char *s = charstring;
2828 unsigned char *e = s + na; /* "na" set by typemap side effect */
2829 for (RETVAL = 1; RETVAL && s < e; s++)
2837 unsigned char * charstring
2839 unsigned char *s = charstring;
2840 unsigned char *e = s + na; /* "na" set by typemap side effect */
2841 for (RETVAL = 1; RETVAL && s < e; s++)
2848 isxdigit(charstring)
2849 unsigned char * charstring
2851 unsigned char *s = charstring;
2852 unsigned char *e = s + na; /* "na" set by typemap side effect */
2853 for (RETVAL = 1; RETVAL && s < e; s++)
2860 open(filename, flags = O_RDONLY, mode = 0666)
2865 if (flags & (O_APPEND|O_CREAT|O_TRUNC|O_RDWR|O_WRONLY|O_EXCL))
2866 TAINT_PROPER("open");
2867 RETVAL = open(filename, flags, mode);
2875 #ifdef HAS_LOCALECONV
2876 struct lconv *lcbuf;
2878 SET_NUMERIC_LOCAL();
2879 if (lcbuf = localeconv()) {
2881 if (lcbuf->decimal_point && *lcbuf->decimal_point)
2882 hv_store(RETVAL, "decimal_point", 13,
2883 newSVpv(lcbuf->decimal_point, 0), 0);
2884 if (lcbuf->thousands_sep && *lcbuf->thousands_sep)
2885 hv_store(RETVAL, "thousands_sep", 13,
2886 newSVpv(lcbuf->thousands_sep, 0), 0);
2887 if (lcbuf->grouping && *lcbuf->grouping)
2888 hv_store(RETVAL, "grouping", 8,
2889 newSVpv(lcbuf->grouping, 0), 0);
2890 if (lcbuf->int_curr_symbol && *lcbuf->int_curr_symbol)
2891 hv_store(RETVAL, "int_curr_symbol", 15,
2892 newSVpv(lcbuf->int_curr_symbol, 0), 0);
2893 if (lcbuf->currency_symbol && *lcbuf->currency_symbol)
2894 hv_store(RETVAL, "currency_symbol", 15,
2895 newSVpv(lcbuf->currency_symbol, 0), 0);
2896 if (lcbuf->mon_decimal_point && *lcbuf->mon_decimal_point)
2897 hv_store(RETVAL, "mon_decimal_point", 17,
2898 newSVpv(lcbuf->mon_decimal_point, 0), 0);
2899 if (lcbuf->mon_thousands_sep && *lcbuf->mon_thousands_sep)
2900 hv_store(RETVAL, "mon_thousands_sep", 17,
2901 newSVpv(lcbuf->mon_thousands_sep, 0), 0);
2902 if (lcbuf->mon_grouping && *lcbuf->mon_grouping)
2903 hv_store(RETVAL, "mon_grouping", 12,
2904 newSVpv(lcbuf->mon_grouping, 0), 0);
2905 if (lcbuf->positive_sign && *lcbuf->positive_sign)
2906 hv_store(RETVAL, "positive_sign", 13,
2907 newSVpv(lcbuf->positive_sign, 0), 0);
2908 if (lcbuf->negative_sign && *lcbuf->negative_sign)
2909 hv_store(RETVAL, "negative_sign", 13,
2910 newSVpv(lcbuf->negative_sign, 0), 0);
2912 if (lcbuf->int_frac_digits != CHAR_MAX)
2913 hv_store(RETVAL, "int_frac_digits", 15,
2914 newSViv(lcbuf->int_frac_digits), 0);
2915 if (lcbuf->frac_digits != CHAR_MAX)
2916 hv_store(RETVAL, "frac_digits", 11,
2917 newSViv(lcbuf->frac_digits), 0);
2918 if (lcbuf->p_cs_precedes != CHAR_MAX)
2919 hv_store(RETVAL, "p_cs_precedes", 13,
2920 newSViv(lcbuf->p_cs_precedes), 0);
2921 if (lcbuf->p_sep_by_space != CHAR_MAX)
2922 hv_store(RETVAL, "p_sep_by_space", 14,
2923 newSViv(lcbuf->p_sep_by_space), 0);
2924 if (lcbuf->n_cs_precedes != CHAR_MAX)
2925 hv_store(RETVAL, "n_cs_precedes", 13,
2926 newSViv(lcbuf->n_cs_precedes), 0);
2927 if (lcbuf->n_sep_by_space != CHAR_MAX)
2928 hv_store(RETVAL, "n_sep_by_space", 14,
2929 newSViv(lcbuf->n_sep_by_space), 0);
2930 if (lcbuf->p_sign_posn != CHAR_MAX)
2931 hv_store(RETVAL, "p_sign_posn", 11,
2932 newSViv(lcbuf->p_sign_posn), 0);
2933 if (lcbuf->n_sign_posn != CHAR_MAX)
2934 hv_store(RETVAL, "n_sign_posn", 11,
2935 newSViv(lcbuf->n_sign_posn), 0);
2938 localeconv(); /* A stub to call not_here(). */
2944 setlocale(category, locale = 0)
2948 RETVAL = setlocale(category, locale);
2950 #ifdef USE_LOCALE_CTYPE
2951 if (category == LC_CTYPE
2953 || category == LC_ALL
2959 if (category == LC_ALL)
2960 newctype = setlocale(LC_CTYPE, NULL);
2964 perl_new_ctype(newctype);
2966 #endif /* USE_LOCALE_CTYPE */
2967 #ifdef USE_LOCALE_COLLATE
2968 if (category == LC_COLLATE
2970 || category == LC_ALL
2976 if (category == LC_ALL)
2977 newcoll = setlocale(LC_COLLATE, NULL);
2981 perl_new_collate(newcoll);
2983 #endif /* USE_LOCALE_COLLATE */
2984 #ifdef USE_LOCALE_NUMERIC
2985 if (category == LC_NUMERIC
2987 || category == LC_ALL
2993 if (category == LC_ALL)
2994 newnum = setlocale(LC_NUMERIC, NULL);
2998 perl_new_numeric(newnum);
3000 #endif /* USE_LOCALE_NUMERIC */
3040 /* (We already know stack is long enough.) */
3041 PUSHs(sv_2mortal(newSVnv(frexp(x,&expvar))));
3042 PUSHs(sv_2mortal(newSViv(expvar)));
3058 /* (We already know stack is long enough.) */
3059 PUSHs(sv_2mortal(newSVnv(modf(x,&intvar))));
3060 PUSHs(sv_2mortal(newSVnv(intvar)));
3075 sigaction(sig, action, oldaction = 0)
3077 POSIX::SigAction action
3078 POSIX::SigAction oldaction
3081 # This code is really grody because we're trying to make the signal
3082 # interface look beautiful, which is hard.
3085 gv_fetchpv("SIG", TRUE, SVt_PVHV);
3088 struct sigaction act;
3089 struct sigaction oact;
3090 POSIX__SigSet sigset;
3092 SV** sigsvp = hv_fetch(GvHVn(siggv),
3094 strlen(sig_name[sig]),
3097 /* Remember old handler name if desired. */
3099 char *hand = SvPVx(*sigsvp, na);
3100 svp = hv_fetch(oldaction, "HANDLER", 7, TRUE);
3101 sv_setpv(*svp, *hand ? hand : "DEFAULT");
3105 /* Vector new handler through %SIG. (We always use sighandler
3106 for the C signal handler, which reads %SIG to dispatch.) */
3107 svp = hv_fetch(action, "HANDLER", 7, FALSE);
3109 croak("Can't supply an action without a HANDLER");
3110 sv_setpv(*sigsvp, SvPV(*svp, na));
3111 mg_set(*sigsvp); /* handles DEFAULT and IGNORE */
3112 act.sa_handler = sighandler;
3114 /* Set up any desired mask. */
3115 svp = hv_fetch(action, "MASK", 4, FALSE);
3116 if (svp && sv_isa(*svp, "POSIX::SigSet")) {
3118 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3119 sigset = (sigset_t*) tmp;
3120 act.sa_mask = *sigset;
3123 sigemptyset(& act.sa_mask);
3125 /* Set up any desired flags. */
3126 svp = hv_fetch(action, "FLAGS", 5, FALSE);
3127 act.sa_flags = svp ? SvIV(*svp) : 0;
3130 /* Now work around sigaction oddities */
3131 if (action && oldaction)
3132 RETVAL = sigaction(sig, & act, & oact);
3134 RETVAL = sigaction(sig, & act, (struct sigaction *)0);
3136 RETVAL = sigaction(sig, (struct sigaction *)0, & oact);
3141 /* Get back the mask. */
3142 svp = hv_fetch(oldaction, "MASK", 4, TRUE);
3143 if (sv_isa(*svp, "POSIX::SigSet")) {
3145 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
3146 sigset = (sigset_t*) tmp;
3149 sigset = (sigset_t*)safemalloc(sizeof(sigset_t));
3150 sv_setptrobj(*svp, sigset, "POSIX::SigSet");
3152 *sigset = oact.sa_mask;
3154 /* Get back the flags. */
3155 svp = hv_fetch(oldaction, "FLAGS", 5, TRUE);
3156 sv_setiv(*svp, oact.sa_flags);
3164 POSIX::SigSet sigset
3167 sigprocmask(how, sigset, oldsigset = 0)
3169 POSIX::SigSet sigset
3170 POSIX::SigSet oldsigset
3173 sigsuspend(signal_mask)
3174 POSIX::SigSet signal_mask
3194 lseek(fd, offset, whence)
3207 if (pipe(fds) != -1) {
3209 PUSHs(sv_2mortal(newSViv(fds[0])));
3210 PUSHs(sv_2mortal(newSViv(fds[1])));
3214 read(fd, buffer, nbytes)
3216 SV *sv_buffer = SvROK(ST(1)) ? SvRV(ST(1)) : ST(1);
3220 char * buffer = sv_grow( sv_buffer, nbytes+1 );
3223 SvCUR(sv_buffer) = RETVAL;
3224 SvPOK_only(sv_buffer);
3225 *SvEND(sv_buffer) = '\0';
3226 SvTAINTED_on(sv_buffer);
3242 tcsetpgrp(fd, pgrp_id)
3251 if (uname(&buf) >= 0) {
3253 PUSHs(sv_2mortal(newSVpv(buf.sysname, 0)));
3254 PUSHs(sv_2mortal(newSVpv(buf.nodename, 0)));
3255 PUSHs(sv_2mortal(newSVpv(buf.release, 0)));
3256 PUSHs(sv_2mortal(newSVpv(buf.version, 0)));
3257 PUSHs(sv_2mortal(newSVpv(buf.machine, 0)));
3260 uname((char *) 0); /* A stub to call not_here(). */
3264 write(fd, buffer, nbytes)
3282 mbstowcs(s, pwcs, n)
3294 wcstombs(s, pwcs, n)
3316 SET_NUMERIC_LOCAL();
3317 num = strtod(str, &unparsed);
3318 PUSHs(sv_2mortal(newSVnv(num)));
3319 if (GIMME == G_ARRAY) {
3322 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3328 strtol(str, base = 0)
3335 num = strtol(str, &unparsed, base);
3336 if (num >= IV_MIN && num <= IV_MAX)
3337 PUSHs(sv_2mortal(newSViv((IV)num)));
3339 PUSHs(sv_2mortal(newSVnv((double)num)));
3340 if (GIMME == G_ARRAY) {
3343 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3349 strtoul(str, base = 0)
3356 num = strtoul(str, &unparsed, base);
3358 PUSHs(sv_2mortal(newSViv((IV)num)));
3360 PUSHs(sv_2mortal(newSVnv((double)num)));
3361 if (GIMME == G_ARRAY) {
3364 PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
3376 char *p = SvPV(src,srclen);
3378 ST(0) = sv_2mortal(NEWSV(800,srclen));
3379 dstlen = strxfrm(SvPVX(ST(0)), p, (size_t)srclen);
3380 if (dstlen > srclen) {
3382 SvGROW(ST(0), dstlen);
3383 strxfrm(SvPVX(ST(0)), p, (size_t)dstlen);
3386 SvCUR(ST(0)) = dstlen;
3391 mkfifo(filename, mode)
3395 TAINT_PROPER("mkfifo");
3396 RETVAL = mkfifo(filename, mode);
3412 tcflush(fd, queue_selector)
3417 tcsendbreak(fd, duration)
3422 asctime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3435 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3438 mytm.tm_hour = hour;
3439 mytm.tm_mday = mday;
3441 mytm.tm_year = year;
3442 mytm.tm_wday = wday;
3443 mytm.tm_yday = yday;
3444 mytm.tm_isdst = isdst;
3445 RETVAL = asctime(&mytm);
3462 realtime = times( &tms );
3464 PUSHs( sv_2mortal( newSViv( (IV) realtime ) ) );
3465 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_utime ) ) );
3466 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_stime ) ) );
3467 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cutime ) ) );
3468 PUSHs( sv_2mortal( newSViv( (IV) tms.tms_cstime ) ) );
3471 difftime(time1, time2)
3476 mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3489 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3492 mytm.tm_hour = hour;
3493 mytm.tm_mday = mday;
3495 mytm.tm_year = year;
3496 mytm.tm_wday = wday;
3497 mytm.tm_yday = yday;
3498 mytm.tm_isdst = isdst;
3499 RETVAL = mktime(&mytm);
3505 strftime(fmt, sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3521 init_tm(&mytm); /* XXX workaround - see init_tm() above */
3524 mytm.tm_hour = hour;
3525 mytm.tm_mday = mday;
3527 mytm.tm_year = year;
3528 mytm.tm_wday = wday;
3529 mytm.tm_yday = yday;
3530 mytm.tm_isdst = isdst;
3531 len = strftime(tmpbuf, sizeof tmpbuf, fmt, &mytm);
3532 ST(0) = sv_2mortal(newSVpv(tmpbuf, len));
3542 PUSHs(sv_2mortal(newSVpv(tzname[0],strlen(tzname[0]))));
3543 PUSHs(sv_2mortal(newSVpv(tzname[1],strlen(tzname[1]))));
3546 access(filename, mode)
3564 pathconf(filename, name)