5 #ifdef I_DIRENT /* XXX maybe better to just rely on perl.h? */
30 /* XXX This comment is just to make I_TERMIO and I_SGTTY visible to
31 metaconfig for future extension writers. We don't use them in POSIX.
32 (This is really sneaky :-) --AD
34 #if defined(I_TERMIOS)
43 #include <sys/times.h>
44 #include <sys/types.h>
46 #include <sys/utsname.h>
56 typedef long SysRetLong;
57 typedef sigset_t* POSIX__SigSet;
58 typedef HV* POSIX__SigAction;
60 typedef struct termios* POSIX__Termios;
61 #else /* Define termios types to int, and call not_here for the functions.*/
62 #define POSIX__Termios int
66 #define cfgetispeed(x) not_here("cfgetispeed")
67 #define cfgetospeed(x) not_here("cfgetospeed")
68 #define tcdrain(x) not_here("tcdrain")
69 #define tcflush(x,y) not_here("tcflush")
70 #define tcsendbreak(x,y) not_here("tcsendbreak")
71 #define cfsetispeed(x,y) not_here("cfsetispeed")
72 #define cfsetospeed(x,y) not_here("cfsetospeed")
73 #define ctermid(x) (char *) not_here("ctermid")
74 #define tcflow(x,y) not_here("tcflow")
75 #define tcgetattr(x,y) not_here("tcgetattr")
76 #define tcsetattr(x,y,z) not_here("tcsetattr")
79 /* Possibly needed prototypes */
80 char *cuserid _((char *));
83 #define cuserid(a) (char *) not_here("cuserid")
87 #define difftime(a,b) not_here("difftime")
91 #define fpathconf(f,n) (SysRetLong) not_here("fpathconf")
94 #define mktime(a) not_here("mktime")
97 #define nice(a) not_here("nice")
100 #define pathconf(f,n) (SysRetLong) not_here("pathconf")
103 #define sysconf(n) (SysRetLong) not_here("sysconf")
106 #define readlink(a,b,c) not_here("readlink")
109 #define setpgid(a,b) not_here("setpgid")
112 #define setsid() not_here("setsid")
115 #define strcoll(s1,s2) not_here("strcoll")
118 #define strxfrm(s1,s2,n) not_here("strxfrm")
120 #ifndef HAS_TCGETPGRP
121 #define tcgetpgrp(a) not_here("tcgetpgrp")
123 #ifndef HAS_TCSETPGRP
124 #define tcsetpgrp(a,b) not_here("tcsetpgrp")
127 #define times(a) not_here("times")
130 #define uname(a) not_here("uname")
133 #define waitpid(a,b,c) not_here("waitpid")
137 #define fgetpos(a,b) not_here("fgetpos")
140 #define fsetpos(a,b) not_here("fsetpos")
145 #define mblen(a,b) not_here("mblen")
149 #define mbstowcs(s, pwcs, n) not_here("mbstowcs")
152 #define mbtowc(pwc, s, n) not_here("mbtowc")
155 #define wcstombs(s, pwcs, n) not_here("wcstombs")
158 #define wctomb(s, wchar) not_here("wcstombs")
160 #if !defined(HAS_MBLEN) && !defined(HAS_MBSTOWCS) && !defined(HAS_MBTOWC) && !defined(HAS_WCSTOMBS) && !defined(HAS_WCTOMB)
161 /* If we don't have these functions, then we wouldn't have gotten a typedef
162 for wchar_t, the wide character type. Defining wchar_t allows the
163 functions referencing it to compile. Its actual type is then meaningless,
164 since without the above functions, all sections using it end up calling
165 not_here() and croak. --Kaveh Ghazi (ghazi@noc.rutgers.edu) 9/18/94. */
171 #ifndef HAS_LOCALECONV
172 #define localeconv() not_here("localeconv")
176 extern char *tzname[];
178 char *tzname[] = { "" , "" };
181 #ifndef HAS_LONG_DOUBLE /* XXX What to do about long doubles? */
197 croak("POSIX::%s not implemented on this architecture", s);
209 if (strEQ(name, "ARG_MAX"))
217 if (strEQ(name, "BUFSIZ"))
223 if (strEQ(name, "BRKINT"))
229 if (strEQ(name, "B9600"))
235 if (strEQ(name, "B19200"))
241 if (strEQ(name, "B38400"))
247 if (strEQ(name, "B0"))
253 if (strEQ(name, "B110"))
259 if (strEQ(name, "B1200"))
265 if (strEQ(name, "B134"))
271 if (strEQ(name, "B150"))
277 if (strEQ(name, "B1800"))
283 if (strEQ(name, "B200"))
289 if (strEQ(name, "B2400"))
295 if (strEQ(name, "B300"))
301 if (strEQ(name, "B4800"))
307 if (strEQ(name, "B50"))
313 if (strEQ(name, "B600"))
319 if (strEQ(name, "B75"))
327 if (strEQ(name, "CHAR_BIT"))
333 if (strEQ(name, "CHAR_MAX"))
339 if (strEQ(name, "CHAR_MIN"))
345 if (strEQ(name, "CHILD_MAX"))
351 if (strEQ(name, "CLK_TCK"))
357 if (strEQ(name, "CLOCAL"))
363 if (strEQ(name, "CLOCKS_PER_SEC"))
364 #ifdef CLOCKS_PER_SEC
365 return CLOCKS_PER_SEC;
369 if (strEQ(name, "CREAD"))
375 if (strEQ(name, "CS5"))
381 if (strEQ(name, "CS6"))
387 if (strEQ(name, "CS7"))
393 if (strEQ(name, "CS8"))
399 if (strEQ(name, "CSIZE"))
405 if (strEQ(name, "CSTOPB"))
413 if (strEQ(name, "DBL_MAX"))
419 if (strEQ(name, "DBL_MIN"))
425 if (strEQ(name, "DBL_DIG"))
431 if (strEQ(name, "DBL_EPSILON"))
437 if (strEQ(name, "DBL_MANT_DIG"))
443 if (strEQ(name, "DBL_MAX_10_EXP"))
444 #ifdef DBL_MAX_10_EXP
445 return DBL_MAX_10_EXP;
449 if (strEQ(name, "DBL_MAX_EXP"))
455 if (strEQ(name, "DBL_MIN_10_EXP"))
456 #ifdef DBL_MIN_10_EXP
457 return DBL_MIN_10_EXP;
461 if (strEQ(name, "DBL_MIN_EXP"))
471 if (strEQ(name, "EACCES"))
477 if (strEQ(name, "EAGAIN"))
485 if (strEQ(name, "EBADF"))
491 if (strEQ(name, "EBUSY"))
499 if (strEQ(name, "ECHILD"))
505 if (strEQ(name, "ECHO"))
511 if (strEQ(name, "ECHOE"))
517 if (strEQ(name, "ECHOK"))
523 if (strEQ(name, "ECHONL"))
531 if (strEQ(name, "EDEADLK"))
537 if (strEQ(name, "EDOM"))
545 if (strEQ(name, "EEXIST"))
553 if (strEQ(name, "EFAULT"))
559 if (strEQ(name, "EFBIG"))
567 if (strEQ(name, "EINTR"))
573 if (strEQ(name, "EINVAL"))
579 if (strEQ(name, "EIO"))
585 if (strEQ(name, "EISDIR"))
593 if (strEQ(name, "EMFILE"))
599 if (strEQ(name, "EMLINK"))
607 if (strEQ(name, "ENOMEM"))
613 if (strEQ(name, "ENOSPC"))
619 if (strEQ(name, "ENOEXEC"))
625 if (strEQ(name, "ENOTTY"))
631 if (strEQ(name, "ENOTDIR"))
637 if (strEQ(name, "ENOTEMPTY"))
643 if (strEQ(name, "ENFILE"))
649 if (strEQ(name, "ENODEV"))
655 if (strEQ(name, "ENOENT"))
661 if (strEQ(name, "ENOLCK"))
667 if (strEQ(name, "ENOSYS"))
673 if (strEQ(name, "ENXIO"))
679 if (strEQ(name, "ENAMETOOLONG"))
687 if (strEQ(name, "EOF"))
695 if (strEQ(name, "EPERM"))
701 if (strEQ(name, "EPIPE"))
709 if (strEQ(name, "ERANGE"))
715 if (strEQ(name, "EROFS"))
723 if (strEQ(name, "ESPIPE"))
729 if (strEQ(name, "ESRCH"))
737 if (strEQ(name, "EXIT_FAILURE"))
743 if (strEQ(name, "EXIT_SUCCESS"))
749 if (strEQ(name, "EXDEV"))
757 if (strEQ(name, "E2BIG"))
765 if (strnEQ(name, "FLT_", 4)) {
766 if (strEQ(name, "FLT_MAX"))
772 if (strEQ(name, "FLT_MIN"))
778 if (strEQ(name, "FLT_ROUNDS"))
784 if (strEQ(name, "FLT_DIG"))
790 if (strEQ(name, "FLT_EPSILON"))
796 if (strEQ(name, "FLT_MANT_DIG"))
802 if (strEQ(name, "FLT_MAX_10_EXP"))
803 #ifdef FLT_MAX_10_EXP
804 return FLT_MAX_10_EXP;
808 if (strEQ(name, "FLT_MAX_EXP"))
814 if (strEQ(name, "FLT_MIN_10_EXP"))
815 #ifdef FLT_MIN_10_EXP
816 return FLT_MIN_10_EXP;
820 if (strEQ(name, "FLT_MIN_EXP"))
826 if (strEQ(name, "FLT_RADIX"))
834 if (strnEQ(name, "F_", 2)) {
835 if (strEQ(name, "F_DUPFD"))
841 if (strEQ(name, "F_GETFD"))
847 if (strEQ(name, "F_GETFL"))
853 if (strEQ(name, "F_GETLK"))
859 if (strEQ(name, "F_OK"))
865 if (strEQ(name, "F_RDLCK"))
871 if (strEQ(name, "F_SETFD"))
877 if (strEQ(name, "F_SETFL"))
883 if (strEQ(name, "F_SETLK"))
889 if (strEQ(name, "F_SETLKW"))
895 if (strEQ(name, "F_UNLCK"))
901 if (strEQ(name, "F_WRLCK"))
909 if (strEQ(name, "FD_CLOEXEC"))
915 if (strEQ(name, "FILENAME_MAX"))
923 if (strEQ(name, "HUGE_VAL"))
929 if (strEQ(name, "HUPCL"))
937 if (strEQ(name, "INT_MAX"))
943 if (strEQ(name, "INT_MIN"))
949 if (strEQ(name, "ICANON"))
955 if (strEQ(name, "ICRNL"))
961 if (strEQ(name, "IEXTEN"))
967 if (strEQ(name, "IGNBRK"))
973 if (strEQ(name, "IGNCR"))
979 if (strEQ(name, "IGNPAR"))
985 if (strEQ(name, "INLCR"))
991 if (strEQ(name, "INPCK"))
997 if (strEQ(name, "ISIG"))
1003 if (strEQ(name, "ISTRIP"))
1009 if (strEQ(name, "IXOFF"))
1015 if (strEQ(name, "IXON"))
1023 if (strnEQ(name, "LC_", 3)) {
1024 if (strEQ(name, "LC_ALL"))
1030 if (strEQ(name, "LC_COLLATE"))
1036 if (strEQ(name, "LC_CTYPE"))
1042 if (strEQ(name, "LC_MONETARY"))
1048 if (strEQ(name, "LC_NUMERIC"))
1054 if (strEQ(name, "LC_TIME"))
1062 if (strnEQ(name, "LDBL_", 5)) {
1063 if (strEQ(name, "LDBL_MAX"))
1069 if (strEQ(name, "LDBL_MIN"))
1075 if (strEQ(name, "LDBL_DIG"))
1081 if (strEQ(name, "LDBL_EPSILON"))
1083 return LDBL_EPSILON;
1087 if (strEQ(name, "LDBL_MANT_DIG"))
1088 #ifdef LDBL_MANT_DIG
1089 return LDBL_MANT_DIG;
1093 if (strEQ(name, "LDBL_MAX_10_EXP"))
1094 #ifdef LDBL_MAX_10_EXP
1095 return LDBL_MAX_10_EXP;
1099 if (strEQ(name, "LDBL_MAX_EXP"))
1101 return LDBL_MAX_EXP;
1105 if (strEQ(name, "LDBL_MIN_10_EXP"))
1106 #ifdef LDBL_MIN_10_EXP
1107 return LDBL_MIN_10_EXP;
1111 if (strEQ(name, "LDBL_MIN_EXP"))
1113 return LDBL_MIN_EXP;
1119 if (strnEQ(name, "L_", 2)) {
1120 if (strEQ(name, "L_ctermid"))
1126 if (strEQ(name, "L_cuserid"))
1132 if (strEQ(name, "L_tmpname"))
1140 if (strEQ(name, "LONG_MAX"))
1146 if (strEQ(name, "LONG_MIN"))
1152 if (strEQ(name, "LINK_MAX"))
1160 if (strEQ(name, "MAX_CANON"))
1166 if (strEQ(name, "MAX_INPUT"))
1172 if (strEQ(name, "MB_CUR_MAX"))
1178 if (strEQ(name, "MB_LEN_MAX"))
1186 if (strEQ(name, "NULL")) return 0;
1187 if (strEQ(name, "NAME_MAX"))
1193 if (strEQ(name, "NCCS"))
1199 if (strEQ(name, "NGROUPS_MAX"))
1205 if (strEQ(name, "NOFLSH"))
1213 if (strnEQ(name, "O_", 2)) {
1214 if (strEQ(name, "O_APPEND"))
1220 if (strEQ(name, "O_CREAT"))
1226 if (strEQ(name, "O_TRUNC"))
1232 if (strEQ(name, "O_RDONLY"))
1238 if (strEQ(name, "O_RDWR"))
1244 if (strEQ(name, "O_WRONLY"))
1250 if (strEQ(name, "O_EXCL"))
1256 if (strEQ(name, "O_NOCTTY"))
1262 if (strEQ(name, "O_NONBLOCK"))
1268 if (strEQ(name, "O_ACCMODE"))
1276 if (strEQ(name, "OPEN_MAX"))
1282 if (strEQ(name, "OPOST"))
1290 if (strEQ(name, "PATH_MAX"))
1296 if (strEQ(name, "PARENB"))
1302 if (strEQ(name, "PARMRK"))
1308 if (strEQ(name, "PARODD"))
1314 if (strEQ(name, "PIPE_BUF"))
1322 if (strEQ(name, "RAND_MAX"))
1328 if (strEQ(name, "R_OK"))
1336 if (strnEQ(name, "SIG", 3)) {
1337 if (name[3] == '_') {
1338 if (strEQ(name, "SIG_BLOCK"))
1345 if (strEQ(name, "SIG_DFL")) return (int)SIG_DFL;
1348 if (strEQ(name, "SIG_ERR")) return (int)SIG_ERR;
1351 if (strEQ(name, "SIG_IGN")) return (int)SIG_IGN;
1353 if (strEQ(name, "SIG_SETMASK"))
1359 if (strEQ(name, "SIG_UNBLOCK"))
1367 if (strEQ(name, "SIGABRT"))
1373 if (strEQ(name, "SIGALRM"))
1379 if (strEQ(name, "SIGCHLD"))
1385 if (strEQ(name, "SIGCONT"))
1391 if (strEQ(name, "SIGFPE"))
1397 if (strEQ(name, "SIGHUP"))
1403 if (strEQ(name, "SIGILL"))
1409 if (strEQ(name, "SIGINT"))
1415 if (strEQ(name, "SIGKILL"))
1421 if (strEQ(name, "SIGPIPE"))
1427 if (strEQ(name, "SIGQUIT"))
1433 if (strEQ(name, "SIGSEGV"))
1439 if (strEQ(name, "SIGSTOP"))
1445 if (strEQ(name, "SIGTERM"))
1451 if (strEQ(name, "SIGTSTP"))
1457 if (strEQ(name, "SIGTTIN"))
1463 if (strEQ(name, "SIGTTOU"))
1469 if (strEQ(name, "SIGUSR1"))
1475 if (strEQ(name, "SIGUSR2"))
1483 if (name[1] == '_') {
1484 if (strEQ(name, "S_ISGID"))
1490 if (strEQ(name, "S_ISUID"))
1496 if (strEQ(name, "S_IRGRP"))
1502 if (strEQ(name, "S_IROTH"))
1508 if (strEQ(name, "S_IRUSR"))
1514 if (strEQ(name, "S_IRWXG"))
1520 if (strEQ(name, "S_IRWXO"))
1526 if (strEQ(name, "S_IRWXU"))
1532 if (strEQ(name, "S_IWGRP"))
1538 if (strEQ(name, "S_IWOTH"))
1544 if (strEQ(name, "S_IWUSR"))
1550 if (strEQ(name, "S_IXGRP"))
1556 if (strEQ(name, "S_IXOTH"))
1562 if (strEQ(name, "S_IXUSR"))
1568 errno = EAGAIN; /* the following aren't constants */
1570 if (strEQ(name, "S_ISBLK")) return S_ISBLK(arg);
1573 if (strEQ(name, "S_ISCHR")) return S_ISCHR(arg);
1576 if (strEQ(name, "S_ISDIR")) return S_ISDIR(arg);
1579 if (strEQ(name, "S_ISFIFO")) return S_ISFIFO(arg);
1582 if (strEQ(name, "S_ISREG")) return S_ISREG(arg);
1586 if (strEQ(name, "SEEK_CUR"))
1592 if (strEQ(name, "SEEK_END"))
1598 if (strEQ(name, "SEEK_SET"))
1604 if (strEQ(name, "STREAM_MAX"))
1610 if (strEQ(name, "SHRT_MAX"))
1616 if (strEQ(name, "SHRT_MIN"))
1622 if (strEQ(name, "SA_NOCLDSTOP"))
1624 return SA_NOCLDSTOP;
1628 if (strEQ(name, "SCHAR_MAX"))
1634 if (strEQ(name, "SCHAR_MIN"))
1640 if (strEQ(name, "SSIZE_MAX"))
1646 if (strEQ(name, "STDIN_FILENO"))
1648 return STDIN_FILENO;
1652 if (strEQ(name, "STDOUT_FILENO"))
1653 #ifdef STDOUT_FILENO
1654 return STDOUT_FILENO;
1658 if (strEQ(name, "STRERR_FILENO"))
1659 #ifdef STRERR_FILENO
1660 return STRERR_FILENO;
1666 if (strEQ(name, "TCIFLUSH"))
1672 if (strEQ(name, "TCIOFF"))
1678 if (strEQ(name, "TCIOFLUSH"))
1684 if (strEQ(name, "TCION"))
1690 if (strEQ(name, "TCOFLUSH"))
1696 if (strEQ(name, "TCOOFF"))
1702 if (strEQ(name, "TCOON"))
1708 if (strEQ(name, "TCSADRAIN"))
1714 if (strEQ(name, "TCSAFLUSH"))
1720 if (strEQ(name, "TCSANOW"))
1726 if (strEQ(name, "TMP_MAX"))
1732 if (strEQ(name, "TOSTOP"))
1738 if (strEQ(name, "TZNAME_MAX"))
1746 if (strEQ(name, "UCHAR_MAX"))
1752 if (strEQ(name, "UINT_MAX"))
1758 if (strEQ(name, "ULONG_MAX"))
1764 if (strEQ(name, "USHRT_MAX"))
1772 if (strEQ(name, "VEOF"))
1778 if (strEQ(name, "VEOL"))
1784 if (strEQ(name, "VERASE"))
1790 if (strEQ(name, "VINTR"))
1796 if (strEQ(name, "VKILL"))
1802 if (strEQ(name, "VMIN"))
1808 if (strEQ(name, "VQUIT"))
1814 if (strEQ(name, "VSTART"))
1820 if (strEQ(name, "VSTOP"))
1826 if (strEQ(name, "VSUSP"))
1832 if (strEQ(name, "VTIME"))
1840 if (strEQ(name, "W_OK"))
1846 if (strEQ(name, "WNOHANG"))
1852 if (strEQ(name, "WUNTRACED"))
1858 errno = EAGAIN; /* the following aren't constants */
1860 if (strEQ(name, "WEXITSTATUS")) return WEXITSTATUS(arg);
1863 if (strEQ(name, "WIFEXITED")) return WIFEXITED(arg);
1866 if (strEQ(name, "WIFSIGNALED")) return WIFSIGNALED(arg);
1869 if (strEQ(name, "WIFSTOPPED")) return WIFSTOPPED(arg);
1872 if (strEQ(name, "WSTOPSIG")) return WSTOPSIG(arg);
1875 if (strEQ(name, "WTERMSIG")) return WTERMSIG(arg);
1879 if (strEQ(name, "X_OK"))
1887 if (strnEQ(name, "_PC_", 4)) {
1888 if (strEQ(name, "_PC_CHOWN_RESTRICTED"))
1889 #ifdef _PC_CHOWN_RESTRICTED
1890 return _PC_CHOWN_RESTRICTED;
1894 if (strEQ(name, "_PC_LINK_MAX"))
1896 return _PC_LINK_MAX;
1900 if (strEQ(name, "_PC_MAX_CANON"))
1901 #ifdef _PC_MAX_CANON
1902 return _PC_MAX_CANON;
1906 if (strEQ(name, "_PC_MAX_INPUT"))
1907 #ifdef _PC_MAX_INPUT
1908 return _PC_MAX_INPUT;
1912 if (strEQ(name, "_PC_NAME_MAX"))
1914 return _PC_NAME_MAX;
1918 if (strEQ(name, "_PC_NO_TRUNC"))
1920 return _PC_NO_TRUNC;
1924 if (strEQ(name, "_PC_PATH_MAX"))
1926 return _PC_PATH_MAX;
1930 if (strEQ(name, "_PC_PIPE_BUF"))
1932 return _PC_PIPE_BUF;
1936 if (strEQ(name, "_PC_VDISABLE"))
1938 return _PC_VDISABLE;
1944 if (strnEQ(name, "_POSIX_", 7)) {
1945 if (strEQ(name, "_POSIX_ARG_MAX"))
1946 #ifdef _POSIX_ARG_MAX
1947 return _POSIX_ARG_MAX;
1951 if (strEQ(name, "_POSIX_CHILD_MAX"))
1952 #ifdef _POSIX_CHILD_MAX
1953 return _POSIX_CHILD_MAX;
1957 if (strEQ(name, "_POSIX_CHOWN_RESTRICTED"))
1958 #ifdef _POSIX_CHOWN_RESTRICTED
1959 return _POSIX_CHOWN_RESTRICTED;
1963 if (strEQ(name, "_POSIX_JOB_CONTROL"))
1964 #ifdef _POSIX_JOB_CONTROL
1965 return _POSIX_JOB_CONTROL;
1969 if (strEQ(name, "_POSIX_LINK_MAX"))
1970 #ifdef _POSIX_LINK_MAX
1971 return _POSIX_LINK_MAX;
1975 if (strEQ(name, "_POSIX_MAX_CANON"))
1976 #ifdef _POSIX_MAX_CANON
1977 return _POSIX_MAX_CANON;
1981 if (strEQ(name, "_POSIX_MAX_INPUT"))
1982 #ifdef _POSIX_MAX_INPUT
1983 return _POSIX_MAX_INPUT;
1987 if (strEQ(name, "_POSIX_NAME_MAX"))
1988 #ifdef _POSIX_NAME_MAX
1989 return _POSIX_NAME_MAX;
1993 if (strEQ(name, "_POSIX_NGROUPS_MAX"))
1994 #ifdef _POSIX_NGROUPS_MAX
1995 return _POSIX_NGROUPS_MAX;
1999 if (strEQ(name, "_POSIX_NO_TRUNC"))
2000 #ifdef _POSIX_NO_TRUNC
2001 return _POSIX_NO_TRUNC;
2005 if (strEQ(name, "_POSIX_OPEN_MAX"))
2006 #ifdef _POSIX_OPEN_MAX
2007 return _POSIX_OPEN_MAX;
2011 if (strEQ(name, "_POSIX_PATH_MAX"))
2012 #ifdef _POSIX_PATH_MAX
2013 return _POSIX_PATH_MAX;
2017 if (strEQ(name, "_POSIX_PIPE_BUF"))
2018 #ifdef _POSIX_PIPE_BUF
2019 return _POSIX_PIPE_BUF;
2023 if (strEQ(name, "_POSIX_SAVED_IDS"))
2024 #ifdef _POSIX_SAVED_IDS
2025 return _POSIX_SAVED_IDS;
2029 if (strEQ(name, "_POSIX_SSIZE_MAX"))
2030 #ifdef _POSIX_SSIZE_MAX
2031 return _POSIX_SSIZE_MAX;
2035 if (strEQ(name, "_POSIX_STREAM_MAX"))
2036 #ifdef _POSIX_STREAM_MAX
2037 return _POSIX_STREAM_MAX;
2041 if (strEQ(name, "_POSIX_TZNAME_MAX"))
2042 #ifdef _POSIX_TZNAME_MAX
2043 return _POSIX_TZNAME_MAX;
2047 if (strEQ(name, "_POSIX_VDISABLE"))
2048 #ifdef _POSIX_VDISABLE
2049 return _POSIX_VDISABLE;
2053 if (strEQ(name, "_POSIX_VERSION"))
2054 #ifdef _POSIX_VERSION
2055 return _POSIX_VERSION;
2061 if (strnEQ(name, "_SC_", 4)) {
2062 if (strEQ(name, "_SC_ARG_MAX"))
2068 if (strEQ(name, "_SC_CHILD_MAX"))
2069 #ifdef _SC_CHILD_MAX
2070 return _SC_CHILD_MAX;
2074 if (strEQ(name, "_SC_CLK_TCK"))
2080 if (strEQ(name, "_SC_JOB_CONTROL"))
2081 #ifdef _SC_JOB_CONTROL
2082 return _SC_JOB_CONTROL;
2086 if (strEQ(name, "_SC_NGROUPS_MAX"))
2087 #ifdef _SC_NGROUPS_MAX
2088 return _SC_NGROUPS_MAX;
2092 if (strEQ(name, "_SC_OPEN_MAX"))
2094 return _SC_OPEN_MAX;
2098 if (strEQ(name, "_SC_SAVED_IDS"))
2099 #ifdef _SC_SAVED_IDS
2100 return _SC_SAVED_IDS;
2104 if (strEQ(name, "_SC_STREAM_MAX"))
2105 #ifdef _SC_STREAM_MAX
2106 return _SC_STREAM_MAX;
2110 if (strEQ(name, "_SC_TZNAME_MAX"))
2111 #ifdef _SC_TZNAME_MAX
2112 return _SC_TZNAME_MAX;
2116 if (strEQ(name, "_SC_VERSION"))
2133 MODULE = SigSet PACKAGE = POSIX::SigSet PREFIX = sig
2136 new(packname = "POSIX::SigSet", ...)
2141 RETVAL = (sigset_t*)safemalloc(sizeof(sigset_t));
2142 sigemptyset(RETVAL);
2143 for (i = 1; i < items; i++)
2144 sigaddset(RETVAL, SvIV(ST(i)));
2151 POSIX::SigSet sigset
2153 safefree((char *)sigset);
2156 sigaddset(sigset, sig)
2157 POSIX::SigSet sigset
2161 sigdelset(sigset, sig)
2162 POSIX::SigSet sigset
2167 POSIX::SigSet sigset
2171 POSIX::SigSet sigset
2174 sigismember(sigset, sig)
2175 POSIX::SigSet sigset
2179 MODULE = Termios PACKAGE = POSIX::Termios PREFIX = cf
2182 new(packname = "POSIX::Termios", ...)
2187 RETVAL = (struct termios*)safemalloc(sizeof(struct termios));
2189 not_here("termios");
2196 DESTROY(termios_ref)
2197 POSIX::Termios termios_ref
2200 safefree((char *)termios_ref);
2202 not_here("termios");
2206 getattr(termios_ref, fd = 0)
2207 POSIX::Termios termios_ref
2210 RETVAL = tcgetattr(fd, termios_ref);
2215 setattr(termios_ref, fd = 0, optional_actions = 0)
2216 POSIX::Termios termios_ref
2218 int optional_actions
2220 RETVAL = tcsetattr(fd, optional_actions, termios_ref);
2225 cfgetispeed(termios_ref)
2226 POSIX::Termios termios_ref
2229 cfgetospeed(termios_ref)
2230 POSIX::Termios termios_ref
2233 getiflag(termios_ref)
2234 POSIX::Termios termios_ref
2236 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2237 RETVAL = termios_ref->c_iflag;
2239 not_here("getiflag");
2245 getoflag(termios_ref)
2246 POSIX::Termios termios_ref
2248 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2249 RETVAL = termios_ref->c_oflag;
2251 not_here("getoflag");
2257 getcflag(termios_ref)
2258 POSIX::Termios termios_ref
2260 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2261 RETVAL = termios_ref->c_cflag;
2263 not_here("getcflag");
2269 getlflag(termios_ref)
2270 POSIX::Termios termios_ref
2272 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2273 RETVAL = termios_ref->c_lflag;
2275 not_here("getlflag");
2281 getcc(termios_ref, ccix)
2282 POSIX::Termios termios_ref
2285 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2287 croak("Bad getcc subscript");
2288 RETVAL = termios_ref->c_cc[ccix];
2296 cfsetispeed(termios_ref, speed)
2297 POSIX::Termios termios_ref
2301 cfsetospeed(termios_ref, speed)
2302 POSIX::Termios termios_ref
2306 setiflag(termios_ref, iflag)
2307 POSIX::Termios termios_ref
2310 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2311 termios_ref->c_iflag = iflag;
2313 not_here("setiflag");
2317 setoflag(termios_ref, oflag)
2318 POSIX::Termios termios_ref
2321 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2322 termios_ref->c_oflag = oflag;
2324 not_here("setoflag");
2328 setcflag(termios_ref, cflag)
2329 POSIX::Termios termios_ref
2332 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2333 termios_ref->c_cflag = cflag;
2335 not_here("setcflag");
2339 setlflag(termios_ref, lflag)
2340 POSIX::Termios termios_ref
2343 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2344 termios_ref->c_lflag = lflag;
2346 not_here("setlflag");
2350 setcc(termios_ref, ccix, cc)
2351 POSIX::Termios termios_ref
2355 #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
2357 croak("Bad setcc subscript");
2358 termios_ref->c_cc[ccix] = cc;
2364 MODULE = POSIX PACKAGE = POSIX
2377 for (s = charstring; *s && RETVAL; s++)
2389 for (s = charstring; *s && RETVAL; s++)
2401 for (s = charstring; *s && RETVAL; s++)
2413 for (s = charstring; *s && RETVAL; s++)
2425 for (s = charstring; *s && RETVAL; s++)
2437 for (s = charstring; *s && RETVAL; s++)
2449 for (s = charstring; *s && RETVAL; s++)
2461 for (s = charstring; *s && RETVAL; s++)
2473 for (s = charstring; *s && RETVAL; s++)
2485 for (s = charstring; *s && RETVAL; s++)
2492 isxdigit(charstring)
2497 for (s = charstring; *s && RETVAL; s++)
2504 open(filename, flags = O_RDONLY, mode = 0666)
2509 if (flags & (O_APPEND|O_CREAT|O_TRUNC|O_RDWR|O_WRONLY|O_EXCL))
2510 TAINT_PROPER("open");
2511 RETVAL = open(filename, flags, mode);
2519 #ifdef HAS_LOCALECONV
2520 struct lconv *lcbuf;
2522 if (lcbuf = localeconv()) {
2524 if (lcbuf->decimal_point && *lcbuf->decimal_point)
2525 hv_store(RETVAL, "decimal_point", 13,
2526 newSVpv(lcbuf->decimal_point, 0), 0);
2527 if (lcbuf->thousands_sep && *lcbuf->thousands_sep)
2528 hv_store(RETVAL, "thousands_sep", 13,
2529 newSVpv(lcbuf->thousands_sep, 0), 0);
2530 if (lcbuf->grouping && *lcbuf->grouping)
2531 hv_store(RETVAL, "grouping", 8,
2532 newSVpv(lcbuf->grouping, 0), 0);
2533 if (lcbuf->int_curr_symbol && *lcbuf->int_curr_symbol)
2534 hv_store(RETVAL, "int_curr_symbol", 15,
2535 newSVpv(lcbuf->int_curr_symbol, 0), 0);
2536 if (lcbuf->currency_symbol && *lcbuf->currency_symbol)
2537 hv_store(RETVAL, "currency_symbol", 15,
2538 newSVpv(lcbuf->currency_symbol, 0), 0);
2539 if (lcbuf->mon_decimal_point && *lcbuf->mon_decimal_point)
2540 hv_store(RETVAL, "mon_decimal_point", 17,
2541 newSVpv(lcbuf->mon_decimal_point, 0), 0);
2542 if (lcbuf->mon_thousands_sep && *lcbuf->mon_thousands_sep)
2543 hv_store(RETVAL, "mon_thousands_sep", 17,
2544 newSVpv(lcbuf->mon_thousands_sep, 0), 0);
2545 if (lcbuf->mon_grouping && *lcbuf->mon_grouping)
2546 hv_store(RETVAL, "mon_grouping", 12,
2547 newSVpv(lcbuf->mon_grouping, 0), 0);
2548 if (lcbuf->positive_sign && *lcbuf->positive_sign)
2549 hv_store(RETVAL, "positive_sign", 13,
2550 newSVpv(lcbuf->positive_sign, 0), 0);
2551 if (lcbuf->negative_sign && *lcbuf->negative_sign)
2552 hv_store(RETVAL, "negative_sign", 13,
2553 newSVpv(lcbuf->negative_sign, 0), 0);
2555 if (lcbuf->int_frac_digits != CHAR_MAX)
2556 hv_store(RETVAL, "int_frac_digits", 15,
2557 newSViv(lcbuf->int_frac_digits), 0);
2558 if (lcbuf->frac_digits != CHAR_MAX)
2559 hv_store(RETVAL, "frac_digits", 11,
2560 newSViv(lcbuf->frac_digits), 0);
2561 if (lcbuf->p_cs_precedes != CHAR_MAX)
2562 hv_store(RETVAL, "p_cs_precedes", 13,
2563 newSViv(lcbuf->p_cs_precedes), 0);
2564 if (lcbuf->p_sep_by_space != CHAR_MAX)
2565 hv_store(RETVAL, "p_sep_by_space", 14,
2566 newSViv(lcbuf->p_sep_by_space), 0);
2567 if (lcbuf->n_cs_precedes != CHAR_MAX)
2568 hv_store(RETVAL, "n_cs_precedes", 13,
2569 newSViv(lcbuf->n_cs_precedes), 0);
2570 if (lcbuf->n_sep_by_space != CHAR_MAX)
2571 hv_store(RETVAL, "n_sep_by_space", 14,
2572 newSViv(lcbuf->n_sep_by_space), 0);
2573 if (lcbuf->p_sign_posn != CHAR_MAX)
2574 hv_store(RETVAL, "p_sign_posn", 11,
2575 newSViv(lcbuf->p_sign_posn), 0);
2576 if (lcbuf->n_sign_posn != CHAR_MAX)
2577 hv_store(RETVAL, "n_sign_posn", 11,
2578 newSViv(lcbuf->n_sign_posn), 0);
2581 localeconv(); /* A stub to call not_here(). */
2587 setlocale(category, locale)
2625 /* (We already know stack is long enough.) */
2626 PUSHs(sv_2mortal(newSVnv(frexp(x,&expvar))));
2627 PUSHs(sv_2mortal(newSViv(expvar)));
2643 /* (We already know stack is long enough.) */
2644 PUSHs(sv_2mortal(newSVnv(modf(x,&intvar))));
2645 PUSHs(sv_2mortal(newSVnv(intvar)));
2660 sigaction(sig, action, oldaction = 0)
2662 POSIX::SigAction action
2663 POSIX::SigAction oldaction
2666 # This code is really grody because we're trying to make the signal
2667 # interface look beautiful, which is hard.
2670 gv_fetchpv("SIG", TRUE, SVt_PVHV);
2673 struct sigaction act;
2674 struct sigaction oact;
2675 POSIX__SigSet sigset;
2677 SV** sigsvp = hv_fetch(GvHVn(siggv),
2679 strlen(sig_name[sig]),
2682 /* Remember old handler name if desired. */
2684 char *hand = SvPVx(*sigsvp, na);
2685 svp = hv_fetch(oldaction, "HANDLER", 7, TRUE);
2686 sv_setpv(*svp, *hand ? hand : "DEFAULT");
2690 /* Vector new handler through %SIG. (We always use sighandler
2691 for the C signal handler, which reads %SIG to dispatch.) */
2692 svp = hv_fetch(action, "HANDLER", 7, FALSE);
2694 croak("Can't supply an action without a HANDLER");
2695 sv_setpv(*sigsvp, SvPV(*svp, na));
2696 mg_set(*sigsvp); /* handles DEFAULT and IGNORE */
2697 act.sa_handler = sighandler;
2699 /* Set up any desired mask. */
2700 svp = hv_fetch(action, "MASK", 4, FALSE);
2701 if (svp && sv_isa(*svp, "POSIX::SigSet")) {
2703 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
2704 sigset = (sigset_t*) tmp;
2705 act.sa_mask = *sigset;
2708 sigemptyset(& act.sa_mask);
2710 /* Set up any desired flags. */
2711 svp = hv_fetch(action, "FLAGS", 5, FALSE);
2712 act.sa_flags = svp ? SvIV(*svp) : 0;
2715 /* Now work around sigaction oddities */
2716 if (action && oldaction)
2717 RETVAL = sigaction(sig, & act, & oact);
2719 RETVAL = sigaction(sig, & act, (struct sigaction*)0);
2721 RETVAL = sigaction(sig, (struct sigaction*)0, & oact);
2726 /* Get back the mask. */
2727 svp = hv_fetch(oldaction, "MASK", 4, TRUE);
2728 if (sv_isa(*svp, "POSIX::SigSet")) {
2730 tmp = (unsigned long)SvNV((SV*)SvRV(*svp));
2731 sigset = (sigset_t*) tmp;
2734 sigset = (sigset_t*)safemalloc(sizeof(sigset_t));
2735 sv_setptrobj(*svp, sigset, "POSIX::SigSet");
2737 *sigset = oact.sa_mask;
2739 /* Get back the flags. */
2740 svp = hv_fetch(oldaction, "FLAGS", 5, TRUE);
2741 sv_setiv(*svp, oact.sa_flags);
2749 POSIX::SigSet sigset
2752 sigprocmask(how, sigset, oldsigset = 0)
2754 POSIX::SigSet sigset
2755 POSIX::SigSet oldsigset
2758 sigsuspend(signal_mask)
2759 POSIX::SigSet signal_mask
2779 lseek(fd, offset, whence)
2792 if (pipe(fds) != -1) {
2794 PUSHs(sv_2mortal(newSViv(fds[0])));
2795 PUSHs(sv_2mortal(newSViv(fds[1])));
2799 read(fd, buffer, nbytes)
2801 char * buffer = sv_grow(ST(1),SvIV(ST(2))+1);
2805 SvCUR(ST(1)) = RETVAL;
2807 *SvEND(ST(1)) = '\0';
2809 sv_magic(ST(1), 0, 't', 0, 0);
2825 tcsetpgrp(fd, pgrp_id)
2834 if (uname(&buf) >= 0) {
2836 PUSHs(sv_2mortal(newSVpv(buf.sysname, 0)));
2837 PUSHs(sv_2mortal(newSVpv(buf.nodename, 0)));
2838 PUSHs(sv_2mortal(newSVpv(buf.release, 0)));
2839 PUSHs(sv_2mortal(newSVpv(buf.version, 0)));
2840 PUSHs(sv_2mortal(newSVpv(buf.machine, 0)));
2843 uname((char *) 0); /* A stub to call not_here(). */
2847 write(fd, buffer, nbytes)
2865 mbstowcs(s, pwcs, n)
2877 wcstombs(s, pwcs, n)
2899 char *p = SvPV(src,srclen);
2901 ST(0) = sv_2mortal(NEWSV(800,srclen));
2902 dstlen = strxfrm(SvPVX(ST(0)), p, (size_t)srclen);
2903 if (dstlen > srclen) {
2905 SvGROW(ST(0), dstlen);
2906 strxfrm(SvPVX(ST(0)), p, (size_t)dstlen);
2909 SvCUR(ST(0)) = dstlen;
2914 mkfifo(filename, mode)
2918 TAINT_PROPER("mkfifo");
2919 RETVAL = mkfifo(filename, mode);
2935 tcflush(fd, queue_selector)
2940 tcsendbreak(fd, duration)
2945 asctime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
2960 mytm.tm_hour = hour;
2961 mytm.tm_mday = mday;
2963 mytm.tm_year = year;
2964 mytm.tm_wday = wday;
2965 mytm.tm_yday = yday;
2966 mytm.tm_isdst = isdst;
2967 RETVAL = asctime(&mytm);
2984 realtime = times( &tms );
2986 PUSHs( sv_2mortal( newSVnv( realtime ) ) );
2987 PUSHs( sv_2mortal( newSVnv( tms.tms_utime ) ) );
2988 PUSHs( sv_2mortal( newSVnv( tms.tms_stime ) ) );
2989 PUSHs( sv_2mortal( newSVnv( tms.tms_cutime ) ) );
2990 PUSHs( sv_2mortal( newSVnv( tms.tms_cstime ) ) );
2993 difftime(time1, time2)
2998 mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3013 mytm.tm_hour = hour;
3014 mytm.tm_mday = mday;
3016 mytm.tm_year = year;
3017 mytm.tm_wday = wday;
3018 mytm.tm_yday = yday;
3019 mytm.tm_isdst = isdst;
3020 RETVAL = mktime(&mytm);
3026 strftime(fmt, sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
3044 mytm.tm_hour = hour;
3045 mytm.tm_mday = mday;
3047 mytm.tm_year = year;
3048 mytm.tm_wday = wday;
3049 mytm.tm_yday = yday;
3050 mytm.tm_isdst = isdst;
3051 len = strftime(tmpbuf, sizeof tmpbuf, fmt, &mytm);
3052 ST(0) = sv_2mortal(newSVpv(tmpbuf, len));
3062 PUSHs(sv_2mortal(newSVpv(tzname[0],strlen(tzname[0]))));
3063 PUSHs(sv_2mortal(newSVpv(tzname[1],strlen(tzname[1]))));
3066 access(filename, mode)
3084 pathconf(filename, name)