Commit | Line | Data |
---|---|---|
463ee0b2 LW |
1 | #include "EXTERN.h" |
2 | #include "perl.h" | |
3 | #include "XSUB.h" | |
8990e307 LW |
4 | #include <sys/utsname.h> |
5 | ||
6 | #define HAS_UNAME | |
7 | ||
8 | #ifndef HAS_GETPGRP | |
9 | #define getpgrp(a,b) not_here("getpgrp") | |
10 | #endif | |
11 | #ifndef HAS_NICE | |
12 | #define nice(a) not_here("nice") | |
13 | #endif | |
14 | #ifndef HAS_READLINK | |
15 | #define readlink(a,b,c) not_here("readlink") | |
16 | #endif | |
17 | #ifndef HAS_SETPGID | |
18 | #define setpgid(a,b) not_here("setpgid") | |
19 | #endif | |
20 | #ifndef HAS_SETPGRP | |
21 | #define setpgrp(a,b) not_here("setpgrp") | |
22 | #endif | |
23 | #ifndef HAS_SETSID | |
24 | #define setsid() not_here("setsid") | |
25 | #endif | |
26 | #ifndef HAS_SYMLINK | |
27 | #define symlink(a,b) not_here("symlink") | |
28 | #endif | |
29 | #ifndef HAS_TCGETPGRP | |
30 | #define tcgetpgrp(a) not_here("tcgetpgrp") | |
31 | #endif | |
32 | #ifndef HAS_TCSETPGRP | |
33 | #define tcsetpgrp(a,b) not_here("tcsetpgrp") | |
34 | #endif | |
35 | #ifndef HAS_TIMES | |
36 | #define times(a) not_here("times") | |
37 | #endif | |
38 | #ifndef HAS_UNAME | |
39 | #define uname(a) not_here("uname") | |
40 | #endif | |
41 | #ifndef HAS_WAITPID | |
42 | #define waitpid(a,b,c) not_here("waitpid") | |
43 | #endif | |
44 | ||
45 | static int | |
46 | not_here(s) | |
47 | char *s; | |
48 | { | |
49 | croak("POSIX::%s not implemented on this architecture", s); | |
50 | return -1; | |
51 | } | |
463ee0b2 LW |
52 | |
53 | MODULE = POSIX PACKAGE = POSIX | |
54 | ||
8990e307 LW |
55 | void |
56 | _exit(status) | |
57 | int status | |
58 | ||
59 | int | |
60 | chdir(path) | |
61 | char * path | |
62 | ||
63 | int | |
64 | chmod(path, mode) | |
65 | char * path | |
66 | mode_t mode | |
67 | ||
68 | int | |
69 | close(fd) | |
70 | int fd | |
71 | ||
72 | int | |
73 | dup(fd) | |
74 | int fd | |
75 | ||
76 | int | |
77 | dup2(fd1, fd2) | |
78 | int fd1 | |
79 | int fd2 | |
80 | ||
463ee0b2 | 81 | FILE * |
8990e307 LW |
82 | fdopen(fd, type) |
83 | int fd | |
463ee0b2 | 84 | char * type |
8990e307 LW |
85 | |
86 | int | |
87 | fstat(fd, buf) | |
88 | int fd | |
89 | struct stat * buf = (struct stat*)sv_grow(ST(2),sizeof(struct stat)); | |
90 | CLEANUP: | |
91 | SvCUR(ST(2)) = sizeof(struct stat); | |
92 | ||
93 | int | |
94 | getpgrp(pid) | |
95 | int pid | |
96 | ||
97 | int | |
98 | link() | |
99 | ||
100 | int | |
101 | lseek() | |
102 | ||
103 | int | |
104 | lstat() | |
105 | ||
106 | int | |
107 | mkdir() | |
108 | ||
109 | int | |
110 | nice(incr) | |
111 | int incr | |
112 | ||
113 | int | |
114 | open() | |
115 | ||
116 | int | |
117 | pipe() | |
118 | ||
119 | int | |
120 | read() | |
121 | ||
122 | int | |
123 | readlink(path, buf, bufsiz) | |
124 | char * path | |
125 | char * buf = sv_grow(ST(2), SvIV(ST(3))); | |
126 | int bufsiz | |
127 | ||
128 | int | |
129 | rename() | |
130 | ||
131 | int | |
132 | rmdir() | |
133 | ||
134 | int | |
135 | setgid() | |
136 | ||
137 | int | |
138 | setpgid(pid, pgid) | |
139 | pid_t pid | |
140 | pid_t pgid | |
141 | ||
142 | int | |
143 | setpgrp(pid, pgrp) | |
144 | int pid | |
145 | int pgrp | |
146 | ||
147 | pid_t | |
148 | setsid() | |
149 | ||
150 | int | |
151 | setuid() | |
152 | ||
153 | int | |
154 | stat() | |
155 | ||
156 | int | |
157 | symlink() | |
158 | ||
159 | int | |
160 | system() | |
161 | ||
162 | pid_t | |
163 | tcgetpgrp(fd) | |
164 | int fd | |
165 | ||
166 | int | |
167 | tcsetpgrp(fd, pgrp_id) | |
168 | int fd | |
169 | pid_t pgrp_id | |
170 | ||
171 | int | |
172 | times(tms) | |
173 | struct tms * tms = (struct tms*)sv_grow(ST(1), sizeof(struct tms)); | |
174 | CLEANUP: | |
175 | SvCUR(ST(1)) = sizeof(struct tms); | |
176 | ||
177 | int | |
178 | umask() | |
179 | ||
180 | int | |
181 | uname() | |
182 | CODE: | |
183 | dSP; | |
184 | struct utsname utsname; | |
185 | sp--; | |
186 | if (uname(&utsname) >= 0) { | |
187 | EXTEND(sp, 5); | |
188 | PUSHs(sv_2mortal(newSVpv(utsname.sysname, 0))); | |
189 | PUSHs(sv_2mortal(newSVpv(utsname.nodename, 0))); | |
190 | PUSHs(sv_2mortal(newSVpv(utsname.release, 0))); | |
191 | PUSHs(sv_2mortal(newSVpv(utsname.version, 0))); | |
192 | PUSHs(sv_2mortal(newSVpv(utsname.machine, 0))); | |
193 | } | |
194 | return sp - stack_base; | |
195 | ||
196 | int | |
197 | unlink() | |
198 | ||
199 | int | |
200 | utime() | |
201 | ||
202 | int | |
203 | wait() | |
204 | ||
205 | int | |
206 | waitpid(pid, statusp, options) | |
207 | int pid | |
208 | int &statusp | |
209 | int options | |
210 | OUTPUT: | |
211 | statusp | |
212 | ||
213 | int | |
214 | write() | |
215 |