This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 5.0 alpha 6
[perl5.git] / ext / posix / POSIX.xs
CommitLineData
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
45static int
46not_here(s)
47char *s;
48{
49 croak("POSIX::%s not implemented on this architecture", s);
50 return -1;
51}
463ee0b2
LW
52
53MODULE = POSIX PACKAGE = POSIX
54
8990e307
LW
55void
56_exit(status)
57 int status
58
59int
60chdir(path)
61 char * path
62
63int
64chmod(path, mode)
65 char * path
66 mode_t mode
67
68int
69close(fd)
70 int fd
71
72int
73dup(fd)
74 int fd
75
76int
77dup2(fd1, fd2)
78 int fd1
79 int fd2
80
463ee0b2 81FILE *
8990e307
LW
82fdopen(fd, type)
83 int fd
463ee0b2 84 char * type
8990e307
LW
85
86int
87fstat(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
93int
94getpgrp(pid)
95 int pid
96
97int
98link()
99
100int
101lseek()
102
103int
104lstat()
105
106int
107mkdir()
108
109int
110nice(incr)
111 int incr
112
113int
114open()
115
116int
117pipe()
118
119int
120read()
121
122int
123readlink(path, buf, bufsiz)
124 char * path
125 char * buf = sv_grow(ST(2), SvIV(ST(3)));
126 int bufsiz
127
128int
129rename()
130
131int
132rmdir()
133
134int
135setgid()
136
137int
138setpgid(pid, pgid)
139 pid_t pid
140 pid_t pgid
141
142int
143setpgrp(pid, pgrp)
144 int pid
145 int pgrp
146
147pid_t
148setsid()
149
150int
151setuid()
152
153int
154stat()
155
156int
157symlink()
158
159int
160system()
161
162pid_t
163tcgetpgrp(fd)
164 int fd
165
166int
167tcsetpgrp(fd, pgrp_id)
168 int fd
169 pid_t pgrp_id
170
171int
172times(tms)
173 struct tms * tms = (struct tms*)sv_grow(ST(1), sizeof(struct tms));
174 CLEANUP:
175 SvCUR(ST(1)) = sizeof(struct tms);
176
177int
178umask()
179
180int
181uname()
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
196int
197unlink()
198
199int
200utime()
201
202int
203wait()
204
205int
206waitpid(pid, statusp, options)
207 int pid
208 int &statusp
209 int options
210 OUTPUT:
211 statusp
212
213int
214write()
215