Profile of /usr/local/lib/perl5/5.10.1/darwin-2level/POSIX.pm

← Index
NYTProf Performance Profile «block view•line view•sub view»
For 05.Domain_and_Item.t
Run on Tue May 4 17:21:41 2010
Reported on Tue May 4 17:22:20 2010

File | /usr/local/lib/perl5/5.10.1/darwin-2level/POSIX.pm
Statements Executed | 57
Statement Execution Time | 1.79ms

Subroutines — ordered by exclusive time
Calls | P | F | Exclusive Time | Inclusive Time | Subroutine
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 629µs | 758µs | POSIX::SigRt::::BEGIN@64 POSIX::SigRt::BEGIN@64
1 | 1 | 1 | 512µs | 512µs | POSIX::::load_imports POSIX::load_imports
1 | 1 | 1 | 74µs | 3.90ms | POSIX::::import POSIX::import
1 | 1 | 1 | 14µs | 16µs | POSIX::::BEGIN@2 POSIX::BEGIN@2
1 | 1 | 1 | 11µs | 16µs | POSIX::::BEGIN@39 POSIX::BEGIN@39
1 | 1 | 1 | 11µs | 619µs | POSIX::::BEGIN@9 POSIX::BEGIN@9
1 | 1 | 1 | 10µs | 165µs | POSIX::::BEGIN@13 POSIX::BEGIN@13
1 | 1 | 1 | 9µs | 12µs | POSIX::::AUTOLOAD POSIX::AUTOLOAD
1 | 1 | 1 | 8µs | 24µs | POSIX::::BEGIN@40 POSIX::BEGIN@40
1 | 1 | 1 | 8µs | 66µs | POSIX::SigRt::::BEGIN@66 POSIX::SigRt::BEGIN@66
1 | 1 | 1 | 7µs | 34µs | POSIX::SigAction::::BEGIN@58POSIX::SigAction::BEGIN@58
1 | 1 | 1 | 7µs | 16µs | POSIX::::BEGIN@3 POSIX::BEGIN@3
1 | 1 | 1 | 6µs | 19µs | POSIX::SigRt::::BEGIN@62 POSIX::SigRt::BEGIN@62
1 | 1 | 1 | 5µs | 5µs | POSIX::::BEGIN@11 POSIX::BEGIN@11
1 | 1 | 2 | 3µs | 3µs | POSIX::::CORE:match POSIX::CORE:match (opcode)
0 | 0 | 0 | 0s | 0s | POSIX::SigRt::::DESTROY POSIX::SigRt::DESTROY
0 | 0 | 0 | 0s | 0s | POSIX::::__ANON__[:51] POSIX::__ANON__[:51]
0 | 0 | 0 | 0s | 0s | POSIX::::croak POSIX::croak

Call graph for these subroutines as a Graphviz dot language file.

Line | State ments | Time on line | Calls | Time in subs | Code
--- | --- | --- | --- | --- | ---
1 |  |  |  |  | package POSIX;
2 | 3 | 20µs | 2 | 20µs | # spent 16µs (14+3) within POSIX::BEGIN@2 which was called # once (14µs+3µs) by UUID::Tiny::BEGIN@10 at line 2 use strict; # spent 16µs making 1 call to POSIX::BEGIN@2 # spent 3µs making 1 call to strict::import
3 | 3 | 51µs | 2 | 25µs | # spent 16µs (7+9) within POSIX::BEGIN@3 which was called # once (7µs+9µs) by UUID::Tiny::BEGIN@10 at line 3 use warnings; # spent 16µs making 1 call to POSIX::BEGIN@3 # spent 9µs making 1 call to warnings::import
4 |  |  |  |  |
5 | 1 | 3µs |  |  | our(@ISA, %EXPORT_TAGS, @EXPORT_OK, @EXPORT, $AUTOLOAD, %SIGRT) = ();
6 |  |  |  |  |
7 | 1 | 300ns |  |  | our $VERSION = "1.17";
8 |  |  |  |  |
9 | 3 | 27µs | 2 | 1.23ms | # spent 619µs (11+609) within POSIX::BEGIN@9 which was called # once (11µs+609µs) by UUID::Tiny::BEGIN@10 at line 9 use AutoLoader; # spent 619µs making 1 call to POSIX::BEGIN@9 # spent 608µs making 1 call to AutoLoader::import
10 |  |  |  |  |
11 | 3 | 37µs | 1 | 5µs | # spent 5µs within POSIX::BEGIN@11 which was called # once (5µs+0s) by UUID::Tiny::BEGIN@10 at line 11 use XSLoader (); # spent 5µs making 1 call to POSIX::BEGIN@11
12 |  |  |  |  |
13 |  |  |  |  | # spent 165µs (10+154) within POSIX::BEGIN@13 which was called # once (10µs+154µs) by UUID::Tiny::BEGIN@10 at line 19 use Fcntl qw(FD_CLOEXEC F_DUPFD F_GETFD F_GETFL F_GETLK F_RDLCK F_SETFD # spent 154µs making 1 call to Exporter::import
14 |  |  |  |  | F_SETFL F_SETLK F_SETLKW F_UNLCK F_WRLCK O_ACCMODE O_APPEND
15 |  |  |  |  | O_CREAT O_EXCL O_NOCTTY O_NONBLOCK O_RDONLY O_RDWR O_TRUNC
16 |  |  |  |  | O_WRONLY SEEK_CUR SEEK_END SEEK_SET
17 |  |  |  |  | S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISREG
18 |  |  |  |  | S_IRGRP S_IROTH S_IRUSR S_IRWXG S_IRWXO S_IRWXU S_ISGID S_ISUID
19 | 3 | 149µs | 1 | 165µs | S_IWGRP S_IWOTH S_IWUSR S_IXGRP S_IXOTH S_IXUSR); # spent 165µs making 1 call to POSIX::BEGIN@13
20 |  |  |  |  |
21 |  |  |  |  | # Grandfather old foo_h form to new :foo_h form
22 | 1 | 100ns |  |  | my $loaded;
23 |  |  |  |  |
24 |  |  |  |  | # spent 3.90ms (74µs+3.82) within POSIX::import which was called # once (74µs+3.82ms) by UUID::Tiny::BEGIN@10 at line 10 of UUID/Tiny.pm sub import {
25 | 5 | 10µs | 1 | 12µs | load_imports() unless $loaded++; # spent 12µs making 1 call to POSIX::AUTOLOAD
26 |  |  |  |  | my $this = shift;
27 |  |  |  |  | my @list = map { m/^\w+_h$/ ? ":$_" : $_ } @_;
28 |  |  |  |  | local $Exporter::ExportLevel = 1;
29 |  |  |  |  | Exporter::import($this,@list); # spent 2.75ms making 1 call to Exporter::import
30 |  |  |  |  | }
31 |  |  |  |  |
32 |  |  |  |  | sub croak { require Carp; goto &Carp::croak }
33 |  |  |  |  | # declare usage to assist AutoLoad
34 |  |  |  |  | sub usage;
35 |  |  |  |  |
36 | 1 | 533µs | 1 | 528µs | XSLoader::load 'POSIX', $VERSION; # spent 528µs making 1 call to XSLoader::load
37 |  |  |  |  |
38 |  |  |  |  | # spent 12µs (9+3) within POSIX::AUTOLOAD which was called # once (9µs+3µs) by POSIX::import at line 25 sub AUTOLOAD {
39 | 3 | 23µs | 2 | 20µs | # spent 16µs (11+5) within POSIX::BEGIN@39 which was called # once (11µs+5µs) by UUID::Tiny::BEGIN@10 at line 39 no strict; # spent 16µs making 1 call to POSIX::BEGIN@39 # spent 5µs making 1 call to strict::unimport
40 | 3 | 134µs | 2 | 41µs | # spent 24µs (8+16) within POSIX::BEGIN@40 which was called # once (8µs+16µs) by UUID::Tiny::BEGIN@10 at line 40 no warnings 'uninitialized'; # spent 24µs making 1 call to POSIX::BEGIN@40 # spent 16µs making 1 call to warnings::unimport
41 | 3 | 14µs | 1 | 3µs | if ($AUTOLOAD =~ /::(_?[a-z])/) { # spent 3µs making 1 call to POSIX::CORE:match
42 |  |  |  |  | # require AutoLoader;
43 |  |  |  |  | $AutoLoader::AUTOLOAD = $AUTOLOAD;
44 |  |  |  |  | goto &AutoLoader::AUTOLOAD # spent 549µs making 1 call to AutoLoader::AUTOLOAD
45 |  |  |  |  | }
46 |  |  |  |  | local $! = 0;
47 |  |  |  |  | my $constname = $AUTOLOAD;
48 |  |  |  |  | $constname =~ s/.*:://;
49 |  |  |  |  | my ($error, $val) = constant($constname);
50 |  |  |  |  | croak $error if $error;
51 |  |  |  |  | *$AUTOLOAD = sub { $val };
52 |  |  |  |  |
53 |  |  |  |  | goto &$AUTOLOAD;
54 |  |  |  |  | }
55 |  |  |  |  |
56 |  |  |  |  | package POSIX::SigAction;
57 |  |  |  |  |
58 | 3 | 27µs | 2 | 61µs | # spent 34µs (7+27) within POSIX::SigAction::BEGIN@58 which was called # once (7µs+27µs) by UUID::Tiny::BEGIN@10 at line 58 use AutoLoader 'AUTOLOAD'; # spent 34µs making 1 call to POSIX::SigAction::BEGIN@58 # spent 27µs making 1 call to AutoLoader::import
59 |  |  |  |  |
60 |  |  |  |  | package POSIX::SigRt;
61 |  |  |  |  |
62 | 3 | 20µs | 2 | 32µs | # spent 19µs (6+13) within POSIX::SigRt::BEGIN@62 which was called # once (6µs+13µs) by UUID::Tiny::BEGIN@10 at line 62 use AutoLoader 'AUTOLOAD'; # spent 19µs making 1 call to POSIX::SigRt::BEGIN@62 # spent 13µs making 1 call to AutoLoader::import
63 |  |  |  |  |
64 | 3 | 143µs | 1 | 758µs | # spent 758µs (629+129) within POSIX::SigRt::BEGIN@64 which was called # once (629µs+129µs) by UUID::Tiny::BEGIN@10 at line 64 use Tie::Hash; # spent 758µs making 1 call to POSIX::SigRt::BEGIN@64
65 |  |  |  |  |
66 | 3 | 59µs | 2 | 124µs | # spent 66µs (8+58) within POSIX::SigRt::BEGIN@66 which was called # once (8µs+58µs) by UUID::Tiny::BEGIN@10 at line 66 use vars qw($SIGACTION_FLAGS $_SIGRTMIN $_SIGRTMAX $_sigrtn @ISA); # spent 66µs making 1 call to POSIX::SigRt::BEGIN@66 # spent 58µs making 1 call to vars::import
67 | 1 | 8µs |  |  | @POSIX::SigRt::ISA = qw(Tie::StdHash);
68 |  |  |  |  |
69 | 1 | 200ns |  |  | $SIGACTION_FLAGS = 0;
70 |  |  |  |  |
71 | 1 | 4µs | 1 | 4µs | tie %POSIX::SIGRT, 'POSIX::SigRt'; # spent 4µs making 1 call to Tie::StdHash::TIEHASH
72 |  |  |  |  |
73 |  |  |  |  | sub DESTROY {};
74 |  |  |  |  |
75 |  |  |  |  | package POSIX;
76 |  |  |  |  |
77 | 1 | 10µs |  |  | 1;
78 |  |  |  |  | __END__
79 |  |  |  |  |
80 |  |  |  |  | sub usage {
81 |  |  |  |  | my ($mess) = @_;
82 |  |  |  |  | croak "Usage: POSIX::$mess";
83 |  |  |  |  | }
84 |  |  |  |  |
85 |  |  |  |  | sub redef {
86 |  |  |  |  | my ($mess) = @_;
87 |  |  |  |  | croak "Use method $mess instead";
88 |  |  |  |  | }
89 |  |  |  |  |
90 |  |  |  |  | sub unimpl {
91 |  |  |  |  | my ($mess) = @_;
92 |  |  |  |  | $mess =~ s/xxx//;
93 |  |  |  |  | croak "Unimplemented: POSIX::$mess";
94 |  |  |  |  | }
95 |  |  |  |  |
96 |  |  |  |  | sub assert {
97 |  |  |  |  | usage "assert(expr)" if @_ != 1;
98 |  |  |  |  | if (!$_[0]) {
99 |  |  |  |  | croak "Assertion failed";
100 |  |  |  |  | }
101 |  |  |  |  | }
102 |  |  |  |  |
103 |  |  |  |  | sub tolower {
104 |  |  |  |  | usage "tolower(string)" if @_ != 1;
105 |  |  |  |  | lc($_[0]);
106 |  |  |  |  | }
107 |  |  |  |  |
108 |  |  |  |  | sub toupper {
109 |  |  |  |  | usage "toupper(string)" if @_ != 1;
110 |  |  |  |  | uc($_[0]);
111 |  |  |  |  | }
112 |  |  |  |  |
113 |  |  |  |  | sub closedir {
114 |  |  |  |  | usage "closedir(dirhandle)" if @_ != 1;
115 |  |  |  |  | CORE::closedir($_[0]);
116 |  |  |  |  | }
117 |  |  |  |  |
118 |  |  |  |  | sub opendir {
119 |  |  |  |  | usage "opendir(directory)" if @_ != 1;
120 |  |  |  |  | my $dirhandle;
121 |  |  |  |  | CORE::opendir($dirhandle, $_[0])
122 |  |  |  |  | ? $dirhandle
123 |  |  |  |  | : undef;
124 |  |  |  |  | }
125 |  |  |  |  |
126 |  |  |  |  | sub readdir {
127 |  |  |  |  | usage "readdir(dirhandle)" if @_ != 1;
128 |  |  |  |  | CORE::readdir($_[0]);
129 |  |  |  |  | }
130 |  |  |  |  |
131 |  |  |  |  | sub rewinddir {
132 |  |  |  |  | usage "rewinddir(dirhandle)" if @_ != 1;
133 |  |  |  |  | CORE::rewinddir($_[0]);
134 |  |  |  |  | }
135 |  |  |  |  |
136 |  |  |  |  | sub errno {
137 |  |  |  |  | usage "errno()" if @_ != 0;
138 |  |  |  |  | $! + 0;
139 |  |  |  |  | }
140 |  |  |  |  |
141 |  |  |  |  | sub creat {
142 |  |  |  |  | usage "creat(filename, mode)" if @_ != 2;
143 |  |  |  |  | &open($_[0], &O_WRONLY | &O_CREAT | &O_TRUNC, $_[1]);
144 |  |  |  |  | }
145 |  |  |  |  |
146 |  |  |  |  | sub fcntl {
147 |  |  |  |  | usage "fcntl(filehandle, cmd, arg)" if @_ != 3;
148 |  |  |  |  | CORE::fcntl($_[0], $_[1], $_[2]);
149 |  |  |  |  | }
150 |  |  |  |  |
151 |  |  |  |  | sub getgrgid {
152 |  |  |  |  | usage "getgrgid(gid)" if @_ != 1;
153 |  |  |  |  | CORE::getgrgid($_[0]);
154 |  |  |  |  | }
155 |  |  |  |  |
156 |  |  |  |  | sub getgrnam {
157 |  |  |  |  | usage "getgrnam(name)" if @_ != 1;
158 |  |  |  |  | CORE::getgrnam($_[0]);
159 |  |  |  |  | }
160 |  |  |  |  |
161 |  |  |  |  | sub atan2 {
162 |  |  |  |  | usage "atan2(x,y)" if @_ != 2;
163 |  |  |  |  | CORE::atan2($_[0], $_[1]);
164 |  |  |  |  | }
165 |  |  |  |  |
166 |  |  |  |  | sub cos {
167 |  |  |  |  | usage "cos(x)" if @_ != 1;
168 |  |  |  |  | CORE::cos($_[0]);
169 |  |  |  |  | }
170 |  |  |  |  |
171 |  |  |  |  | sub exp {
172 |  |  |  |  | usage "exp(x)" if @_ != 1;
173 |  |  |  |  | CORE::exp($_[0]);
174 |  |  |  |  | }
175 |  |  |  |  |
176 |  |  |  |  | sub fabs {
177 |  |  |  |  | usage "fabs(x)" if @_ != 1;
178 |  |  |  |  | CORE::abs($_[0]);
179 |  |  |  |  | }
180 |  |  |  |  |
181 |  |  |  |  | sub log {
182 |  |  |  |  | usage "log(x)" if @_ != 1;
183 |  |  |  |  | CORE::log($_[0]);
184 |  |  |  |  | }
185 |  |  |  |  |
186 |  |  |  |  | sub pow {
187 |  |  |  |  | usage "pow(x,exponent)" if @_ != 2;
188 |  |  |  |  | $_[0] ** $_[1];
189 |  |  |  |  | }
190 |  |  |  |  |
191 |  |  |  |  | sub sin {
192 |  |  |  |  | usage "sin(x)" if @_ != 1;
193 |  |  |  |  | CORE::sin($_[0]);
194 |  |  |  |  | }
195 |  |  |  |  |
196 |  |  |  |  | sub sqrt {
197 |  |  |  |  | usage "sqrt(x)" if @_ != 1;
198 |  |  |  |  | CORE::sqrt($_[0]);
199 |  |  |  |  | }
200 |  |  |  |  |
201 |  |  |  |  | sub getpwnam {
202 |  |  |  |  | usage "getpwnam(name)" if @_ != 1;
203 |  |  |  |  | CORE::getpwnam($_[0]);
204 |  |  |  |  | }
205 |  |  |  |  |
206 |  |  |  |  | sub getpwuid {
207 |  |  |  |  | usage "getpwuid(uid)" if @_ != 1;
208 |  |  |  |  | CORE::getpwuid($_[0]);
209 |  |  |  |  | }
210 |  |  |  |  |
211 |  |  |  |  | sub longjmp {
212 |  |  |  |  | unimpl "longjmp() is C-specific: use die instead";
213 |  |  |  |  | }
214 |  |  |  |  |
215 |  |  |  |  | sub setjmp {
216 |  |  |  |  | unimpl "setjmp() is C-specific: use eval {} instead";
217 |  |  |  |  | }
218 |  |  |  |  |
219 |  |  |  |  | sub siglongjmp {
220 |  |  |  |  | unimpl "siglongjmp() is C-specific: use die instead";
221 |  |  |  |  | }
222 |  |  |  |  |
223 |  |  |  |  | sub sigsetjmp {
224 |  |  |  |  | unimpl "sigsetjmp() is C-specific: use eval {} instead";
225 |  |  |  |  | }
226 |  |  |  |  |
227 |  |  |  |  | sub kill {
228 |  |  |  |  | usage "kill(pid, sig)" if @_ != 2;
229 |  |  |  |  | CORE::kill $_[1], $_[0];
230 |  |  |  |  | }
231 |  |  |  |  |
232 |  |  |  |  | sub raise {
233 |  |  |  |  | usage "raise(sig)" if @_ != 1;
234 |  |  |  |  | CORE::kill $_[0], $$; # Is this good enough?
235 |  |  |  |  | }
236 |  |  |  |  |
237 |  |  |  |  | sub offsetof {
238 |  |  |  |  | unimpl "offsetof() is C-specific, stopped";
239 |  |  |  |  | }
240 |  |  |  |  |
241 |  |  |  |  | sub clearerr {
242 |  |  |  |  | redef "IO::Handle::clearerr()";
243 |  |  |  |  | }
244 |  |  |  |  |
245 |  |  |  |  | sub fclose {
246 |  |  |  |  | redef "IO::Handle::close()";
247 |  |  |  |  | }
248 |  |  |  |  |
249 |  |  |  |  | sub fdopen {
250 |  |  |  |  | redef "IO::Handle::new_from_fd()";
251 |  |  |  |  | }
252 |  |  |  |  |
253 |  |  |  |  | sub feof {
254 |  |  |  |  | redef "IO::Handle::eof()";
255 |  |  |  |  | }
256 |  |  |  |  |
257 |  |  |  |  | sub fgetc {
258 |  |  |  |  | redef "IO::Handle::getc()";
259 |  |  |  |  | }
260 |  |  |  |  |
261 |  |  |  |  | sub fgets {
262 |  |  |  |  | redef "IO::Handle::gets()";
263 |  |  |  |  | }
264 |  |  |  |  |
265 |  |  |  |  | sub fileno {
266 |  |  |  |  | redef "IO::Handle::fileno()";
267 |  |  |  |  | }
268 |  |  |  |  |
269 |  |  |  |  | sub fopen {
270 |  |  |  |  | redef "IO::File::open()";
271 |  |  |  |  | }
272 |  |  |  |  |
273 |  |  |  |  | sub fprintf {
274 |  |  |  |  | unimpl "fprintf() is C-specific--use printf instead";
275 |  |  |  |  | }
276 |  |  |  |  |
277 |  |  |  |  | sub fputc {
278 |  |  |  |  | unimpl "fputc() is C-specific--use print instead";
279 |  |  |  |  | }
280 |  |  |  |  |
281 |  |  |  |  | sub fputs {
282 |  |  |  |  | unimpl "fputs() is C-specific--use print instead";
283 |  |  |  |  | }
284 |  |  |  |  |
285 |  |  |  |  | sub fread {
286 |  |  |  |  | unimpl "fread() is C-specific--use read instead";
287 |  |  |  |  | }
288 |  |  |  |  |
289 |  |  |  |  | sub freopen {
290 |  |  |  |  | unimpl "freopen() is C-specific--use open instead";
291 |  |  |  |  | }
292 |  |  |  |  |
293 |  |  |  |  | sub fscanf {
294 |  |  |  |  | unimpl "fscanf() is C-specific--use <> and regular expressions instead";
295 |  |  |  |  | }
296 |  |  |  |  |
297 |  |  |  |  | sub fseek {
298 |  |  |  |  | redef "IO::Seekable::seek()";
299 |  |  |  |  | }
300 |  |  |  |  |
301 |  |  |  |  | sub fsync {
302 |  |  |  |  | redef "IO::Handle::sync()";
303 |  |  |  |  | }
304 |  |  |  |  |
305 |  |  |  |  | sub ferror {
306 |  |  |  |  | redef "IO::Handle::error()";
307 |  |  |  |  | }
308 |  |  |  |  |
309 |  |  |  |  | sub fflush {
310 |  |  |  |  | redef "IO::Handle::flush()";
311 |  |  |  |  | }
312 |  |  |  |  |
313 |  |  |  |  | sub fgetpos {
314 |  |  |  |  | redef "IO::Seekable::getpos()";
315 |  |  |  |  | }
316 |  |  |  |  |
317 |  |  |  |  | sub fsetpos {
318 |  |  |  |  | redef "IO::Seekable::setpos()";
319 |  |  |  |  | }
320 |  |  |  |  |
321 |  |  |  |  | sub ftell {
322 |  |  |  |  | redef "IO::Seekable::tell()";
323 |  |  |  |  | }
324 |  |  |  |  |
325 |  |  |  |  | sub fwrite {
326 |  |  |  |  | unimpl "fwrite() is C-specific--use print instead";
327 |  |  |  |  | }
328 |  |  |  |  |
329 |  |  |  |  | sub getc {
330 |  |  |  |  | usage "getc(handle)" if @_ != 1;
331 |  |  |  |  | CORE::getc($_[0]);
332 |  |  |  |  | }
333 |  |  |  |  |
334 |  |  |  |  | sub getchar {
335 |  |  |  |  | usage "getchar()" if @_ != 0;
336 |  |  |  |  | CORE::getc(STDIN);
337 |  |  |  |  | }
338 |  |  |  |  |
339 |  |  |  |  | sub gets {
340 |  |  |  |  | usage "gets()" if @_ != 0;
341 |  |  |  |  | scalar <STDIN>;
342 |  |  |  |  | }
343 |  |  |  |  |
344 |  |  |  |  | sub perror {
345 |  |  |  |  | print STDERR "@_: " if @_;
346 |  |  |  |  | print STDERR $!,"\n";
347 |  |  |  |  | }
348 |  |  |  |  |
349 |  |  |  |  | sub printf {
350 |  |  |  |  | usage "printf(pattern, args...)" if @_ < 1;
351 |  |  |  |  | CORE::printf STDOUT @_;
352 |  |  |  |  | }
353 |  |  |  |  |
354 |  |  |  |  | sub putc {
355 |  |  |  |  | unimpl "putc() is C-specific--use print instead";
356 |  |  |  |  | }
357 |  |  |  |  |
358 |  |  |  |  | sub putchar {
359 |  |  |  |  | unimpl "putchar() is C-specific--use print instead";
360 |  |  |  |  | }
361 |  |  |  |  |
362 |  |  |  |  | sub puts {
363 |  |  |  |  | unimpl "puts() is C-specific--use print instead";
364 |  |  |  |  | }
365 |  |  |  |  |
366 |  |  |  |  | sub remove {
367 |  |  |  |  | usage "remove(filename)" if @_ != 1;
368 |  |  |  |  | (-d $_[0]) ? CORE::rmdir($_[0]) : CORE::unlink($_[0]);
369 |  |  |  |  | }
370 |  |  |  |  |
371 |  |  |  |  | sub rename {
372 |  |  |  |  | usage "rename(oldfilename, newfilename)" if @_ != 2;
373 |  |  |  |  | CORE::rename($_[0], $_[1]);
374 |  |  |  |  | }
375 |  |  |  |  |
376 |  |  |  |  | sub rewind {
377 |  |  |  |  | usage "rewind(filehandle)" if @_ != 1;
378 |  |  |  |  | CORE::seek($_[0],0,0);
379 |  |  |  |  | }
380 |  |  |  |  |
381 |  |  |  |  | sub scanf {
382 |  |  |  |  | unimpl "scanf() is C-specific--use <> and regular expressions instead";
383 |  |  |  |  | }
384 |  |  |  |  |
385 |  |  |  |  | sub sprintf {
386 |  |  |  |  | usage "sprintf(pattern,args)" if @_ == 0;
387 |  |  |  |  | CORE::sprintf(shift,@_);
388 |  |  |  |  | }
389 |  |  |  |  |
390 |  |  |  |  | sub sscanf {
391 |  |  |  |  | unimpl "sscanf() is C-specific--use regular expressions instead";
392 |  |  |  |  | }
393 |  |  |  |  |
394 |  |  |  |  | sub tmpfile {
395 |  |  |  |  | redef "IO::File::new_tmpfile()";
396 |  |  |  |  | }
397 |  |  |  |  |
398 |  |  |  |  | sub ungetc {
399 |  |  |  |  | redef "IO::Handle::ungetc()";
400 |  |  |  |  | }
401 |  |  |  |  |
402 |  |  |  |  | sub vfprintf {
403 |  |  |  |  | unimpl "vfprintf() is C-specific";
404 |  |  |  |  | }
405 |  |  |  |  |
406 |  |  |  |  | sub vprintf {
407 |  |  |  |  | unimpl "vprintf() is C-specific";
408 |  |  |  |  | }
409 |  |  |  |  |
410 |  |  |  |  | sub vsprintf {
411 |  |  |  |  | unimpl "vsprintf() is C-specific";
412 |  |  |  |  | }
413 |  |  |  |  |
414 |  |  |  |  | sub abs {
415 |  |  |  |  | usage "abs(x)" if @_ != 1;
416 |  |  |  |  | CORE::abs($_[0]);
417 |  |  |  |  | }
418 |  |  |  |  |
419 |  |  |  |  | sub atexit {
420 |  |  |  |  | unimpl "atexit() is C-specific: use END {} instead";
421 |  |  |  |  | }
422 |  |  |  |  |
423 |  |  |  |  | sub atof {
424 |  |  |  |  | unimpl "atof() is C-specific, stopped";
425 |  |  |  |  | }
426 |  |  |  |  |
427 |  |  |  |  | sub atoi {
428 |  |  |  |  | unimpl "atoi() is C-specific, stopped";
429 |  |  |  |  | }
430 |  |  |  |  |
431 |  |  |  |  | sub atol {
432 |  |  |  |  | unimpl "atol() is C-specific, stopped";
433 |  |  |  |  | }
434 |  |  |  |  |
435 |  |  |  |  | sub bsearch {
436 |  |  |  |  | unimpl "bsearch() not supplied";
437 |  |  |  |  | }
438 |  |  |  |  |
439 |  |  |  |  | sub calloc {
440 |  |  |  |  | unimpl "calloc() is C-specific, stopped";
441 |  |  |  |  | }
442 |  |  |  |  |
443 |  |  |  |  | sub div {
444 |  |  |  |  | unimpl "div() is C-specific, use /, % and int instead";
445 |  |  |  |  | }
446 |  |  |  |  |
447 |  |  |  |  | sub exit {
448 |  |  |  |  | usage "exit(status)" if @_ != 1;
449 |  |  |  |  | CORE::exit($_[0]);
450 |  |  |  |  | }
451 |  |  |  |  |
452 |  |  |  |  | sub free {
453 |  |  |  |  | unimpl "free() is C-specific, stopped";
454 |  |  |  |  | }
455 |  |  |  |  |
456 |  |  |  |  | sub getenv {
457 |  |  |  |  | usage "getenv(name)" if @_ != 1;
458 |  |  |  |  | $ENV{$_[0]};
459 |  |  |  |  | }
460 |  |  |  |  |
461 |  |  |  |  | sub labs {
462 |  |  |  |  | unimpl "labs() is C-specific, use abs instead";
463 |  |  |  |  | }
464 |  |  |  |  |
465 |  |  |  |  | sub ldiv {
466 |  |  |  |  | unimpl "ldiv() is C-specific, use /, % and int instead";
467 |  |  |  |  | }
468 |  |  |  |  |
469 |  |  |  |  | sub malloc {
470 |  |  |  |  | unimpl "malloc() is C-specific, stopped";
471 |  |  |  |  | }
472 |  |  |  |  |
473 |  |  |  |  | sub qsort {
474 |  |  |  |  | unimpl "qsort() is C-specific, use sort instead";
475 |  |  |  |  | }
476 |  |  |  |  |
477 |  |  |  |  | sub rand {
478 |  |  |  |  | unimpl "rand() is non-portable, use Perl's rand instead";
479 |  |  |  |  | }
480 |  |  |  |  |
481 |  |  |  |  | sub realloc {
482 |  |  |  |  | unimpl "realloc() is C-specific, stopped";
483 |  |  |  |  | }
484 |  |  |  |  |
485 |  |  |  |  | sub srand {
486 |  |  |  |  | unimpl "srand()";
487 |  |  |  |  | }
488 |  |  |  |  |
489 |  |  |  |  | sub system {
490 |  |  |  |  | usage "system(command)" if @_ != 1;
491 |  |  |  |  | CORE::system($_[0]);
492 |  |  |  |  | }
493 |  |  |  |  |
494 |  |  |  |  | sub memchr {
495 |  |  |  |  | unimpl "memchr() is C-specific, use index() instead";
496 |  |  |  |  | }
497 |  |  |  |  |
498 |  |  |  |  | sub memcmp {
499 |  |  |  |  | unimpl "memcmp() is C-specific, use eq instead";
500 |  |  |  |  | }
501 |  |  |  |  |
502 |  |  |  |  | sub memcpy {
503 |  |  |  |  | unimpl "memcpy() is C-specific, use = instead";
504 |  |  |  |  | }
505 |  |  |  |  |
506 |  |  |  |  | sub memmove {
507 |  |  |  |  | unimpl "memmove() is C-specific, use = instead";
508 |  |  |  |  | }
509 |  |  |  |  |
510 |  |  |  |  | sub memset {
511 |  |  |  |  | unimpl "memset() is C-specific, use x instead";
512 |  |  |  |  | }
513 |  |  |  |  |
514 |  |  |  |  | sub strcat {
515 |  |  |  |  | unimpl "strcat() is C-specific, use .= instead";
516 |  |  |  |  | }
517 |  |  |  |  |
518 |  |  |  |  | sub strchr {
519 |  |  |  |  | unimpl "strchr() is C-specific, use index() instead";
520 |  |  |  |  | }
521 |  |  |  |  |
522 |  |  |  |  | sub strcmp {
523 |  |  |  |  | unimpl "strcmp() is C-specific, use eq instead";
524 |  |  |  |  | }
525 |  |  |  |  |
526 |  |  |  |  | sub strcpy {
527 |  |  |  |  | unimpl "strcpy() is C-specific, use = instead";
528 |  |  |  |  | }
529 |  |  |  |  |
530 |  |  |  |  | sub strcspn {
531 |  |  |  |  | unimpl "strcspn() is C-specific, use regular expressions instead";
532 |  |  |  |  | }
533 |  |  |  |  |
534 |  |  |  |  | sub strerror {
535 |  |  |  |  | usage "strerror(errno)" if @_ != 1;
536 |  |  |  |  | local $! = $_[0];
537 |  |  |  |  | $! . "";
538 |  |  |  |  | }
539 |  |  |  |  |
540 |  |  |  |  | sub strlen {
541 |  |  |  |  | unimpl "strlen() is C-specific, use length instead";
542 |  |  |  |  | }
543 |  |  |  |  |
544 |  |  |  |  | sub strncat {
545 |  |  |  |  | unimpl "strncat() is C-specific, use .= instead";
546 |  |  |  |  | }
547 |  |  |  |  |
548 |  |  |  |  | sub strncmp {
549 |  |  |  |  | unimpl "strncmp() is C-specific, use eq instead";
550 |  |  |  |  | }
551 |  |  |  |  |
552 |  |  |  |  | sub strncpy {
553 |  |  |  |  | unimpl "strncpy() is C-specific, use = instead";
554 |  |  |  |  | }
555 |  |  |  |  |
556 |  |  |  |  | sub strpbrk {
557 |  |  |  |  | unimpl "strpbrk() is C-specific, stopped";
558 |  |  |  |  | }
559 |  |  |  |  |
560 |  |  |  |  | sub strrchr {
561 |  |  |  |  | unimpl "strrchr() is C-specific, use rindex() instead";
562 |  |  |  |  | }
563 |  |  |  |  |
564 |  |  |  |  | sub strspn {
565 |  |  |  |  | unimpl "strspn() is C-specific, stopped";
566 |  |  |  |  | }
567 |  |  |  |  |
568 |  |  |  |  | sub strstr {
569 |  |  |  |  | usage "strstr(big, little)" if @_ != 2;
570 |  |  |  |  | CORE::index($_[0], $_[1]);
571 |  |  |  |  | }
572 |  |  |  |  |
573 |  |  |  |  | sub strtok {
574 |  |  |  |  | unimpl "strtok() is C-specific, stopped";
575 |  |  |  |  | }
576 |  |  |  |  |
577 |  |  |  |  | sub chmod {
578 |  |  |  |  | usage "chmod(mode, filename)" if @_ != 2;
579 |  |  |  |  | CORE::chmod($_[0], $_[1]);
580 |  |  |  |  | }
581 |  |  |  |  |
582 |  |  |  |  | sub fstat {
583 |  |  |  |  | usage "fstat(fd)" if @_ != 1;
584 |  |  |  |  | local *TMP;
585 |  |  |  |  | CORE::open(TMP, "<&$_[0]"); # Gross.
586 |  |  |  |  | my @l = CORE::stat(TMP);
587 |  |  |  |  | CORE::close(TMP);
588 |  |  |  |  | @l;
589 |  |  |  |  | }
590 |  |  |  |  |
591 |  |  |  |  | sub mkdir {
592 |  |  |  |  | usage "mkdir(directoryname, mode)" if @_ != 2;
593 |  |  |  |  | CORE::mkdir($_[0], $_[1]);
594 |  |  |  |  | }
595 |  |  |  |  |
596 |  |  |  |  | sub stat {
597 |  |  |  |  | usage "stat(filename)" if @_ != 1;
598 |  |  |  |  | CORE::stat($_[0]);
599 |  |  |  |  | }
600 |  |  |  |  |
601 |  |  |  |  | sub umask {
602 |  |  |  |  | usage "umask(mask)" if @_ != 1;
603 |  |  |  |  | CORE::umask($_[0]);
604 |  |  |  |  | }
605 |  |  |  |  |
606 |  |  |  |  | sub wait {
607 |  |  |  |  | usage "wait()" if @_ != 0;
608 |  |  |  |  | CORE::wait();
609 |  |  |  |  | }
610 |  |  |  |  |
611 |  |  |  |  | sub waitpid {
612 |  |  |  |  | usage "waitpid(pid, options)" if @_ != 2;
613 |  |  |  |  | CORE::waitpid($_[0], $_[1]);
614 |  |  |  |  | }
615 |  |  |  |  |
616 |  |  |  |  | sub gmtime {
617 |  |  |  |  | usage "gmtime(time)" if @_ != 1;
618 |  |  |  |  | CORE::gmtime($_[0]);
619 |  |  |  |  | }
620 |  |  |  |  |
621 |  |  |  |  | sub localtime {
622 |  |  |  |  | usage "localtime(time)" if @_ != 1;
623 |  |  |  |  | CORE::localtime($_[0]);
624 |  |  |  |  | }
625 |  |  |  |  |
626 |  |  |  |  | sub time {
627 |  |  |  |  | usage "time()" if @_ != 0;
628 |  |  |  |  | CORE::time;
629 |  |  |  |  | }
630 |  |  |  |  |
631 |  |  |  |  | sub alarm {
632 |  |  |  |  | usage "alarm(seconds)" if @_ != 1;
633 |  |  |  |  | CORE::alarm($_[0]);
634 |  |  |  |  | }
635 |  |  |  |  |
636 |  |  |  |  | sub chdir {
637 |  |  |  |  | usage "chdir(directory)" if @_ != 1;
638 |  |  |  |  | CORE::chdir($_[0]);
639 |  |  |  |  | }
640 |  |  |  |  |
641 |  |  |  |  | sub chown {
642 |  |  |  |  | usage "chown(uid, gid, filename)" if @_ != 3;
643 |  |  |  |  | CORE::chown($_[0], $_[1], $_[2]);
644 |  |  |  |  | }
645 |  |  |  |  |
646 |  |  |  |  | sub execl {
647 |  |  |  |  | unimpl "execl() is C-specific, stopped";
648 |  |  |  |  | }
649 |  |  |  |  |
650 |  |  |  |  | sub execle {
651 |  |  |  |  | unimpl "execle() is C-specific, stopped";
652 |  |  |  |  | }
653 |  |  |  |  |
654 |  |  |  |  | sub execlp {
655 |  |  |  |  | unimpl "execlp() is C-specific, stopped";
656 |  |  |  |  | }
657 |  |  |  |  |
658 |  |  |  |  | sub execv {
659 |  |  |  |  | unimpl "execv() is C-specific, stopped";
660 |  |  |  |  | }
661 |  |  |  |  |
662 |  |  |  |  | sub execve {
663 |  |  |  |  | unimpl "execve() is C-specific, stopped";
664 |  |  |  |  | }
665 |  |  |  |  |
666 |  |  |  |  | sub execvp {
667 |  |  |  |  | unimpl "execvp() is C-specific, stopped";
668 |  |  |  |  | }
669 |  |  |  |  |
670 |  |  |  |  | sub fork {
671 |  |  |  |  | usage "fork()" if @_ != 0;
672 |  |  |  |  | CORE::fork;
673 |  |  |  |  | }
674 |  |  |  |  |
675 |  |  |  |  | sub getegid {
676 |  |  |  |  | usage "getegid()" if @_ != 0;
677 |  |  |  |  | $) + 0;
678 |  |  |  |  | }
679 |  |  |  |  |
680 |  |  |  |  | sub geteuid {
681 |  |  |  |  | usage "geteuid()" if @_ != 0;
682 |  |  |  |  | $> + 0;
683 |  |  |  |  | }
684 |  |  |  |  |
685 |  |  |  |  | sub getgid {
686 |  |  |  |  | usage "getgid()" if @_ != 0;
687 |  |  |  |  | $( + 0;
688 |  |  |  |  | }
689 |  |  |  |  |
690 |  |  |  |  | sub getgroups {
691 |  |  |  |  | usage "getgroups()" if @_ != 0;
692 |  |  |  |  | my %seen;
693 |  |  |  |  | grep(!$seen{$_}++, split(' ', $) ));
694 |  |  |  |  | }
695 |  |  |  |  |
696 |  |  |  |  | sub getlogin {
697 |  |  |  |  | usage "getlogin()" if @_ != 0;
698 |  |  |  |  | CORE::getlogin();
699 |  |  |  |  | }
700 |  |  |  |  |
701 |  |  |  |  | sub getpgrp {
702 |  |  |  |  | usage "getpgrp()" if @_ != 0;
703 |  |  |  |  | CORE::getpgrp;
704 |  |  |  |  | }
705 |  |  |  |  |
706 |  |  |  |  | sub getpid {
707 |  |  |  |  | usage "getpid()" if @_ != 0;
708 |  |  |  |  | $$;
709 |  |  |  |  | }
710 |  |  |  |  |
711 |  |  |  |  | sub getppid {
712 |  |  |  |  | usage "getppid()" if @_ != 0;
713 |  |  |  |  | CORE::getppid;
714 |  |  |  |  | }
715 |  |  |  |  |
716 |  |  |  |  | sub getuid {
717 |  |  |  |  | usage "getuid()" if @_ != 0;
718 |  |  |  |  | $<;
719 |  |  |  |  | }
720 |  |  |  |  |
721 |  |  |  |  | sub isatty {
722 |  |  |  |  | usage "isatty(filehandle)" if @_ != 1;
723 |  |  |  |  | -t $_[0];
724 |  |  |  |  | }
725 |  |  |  |  |
726 |  |  |  |  | sub link {
727 |  |  |  |  | usage "link(oldfilename, newfilename)" if @_ != 2;
728 |  |  |  |  | CORE::link($_[0], $_[1]);
729 |  |  |  |  | }
730 |  |  |  |  |
731 |  |  |  |  | sub rmdir {
732 |  |  |  |  | usage "rmdir(directoryname)" if @_ != 1;
733 |  |  |  |  | CORE::rmdir($_[0]);
734 |  |  |  |  | }
735 |  |  |  |  |
736 |  |  |  |  | sub setbuf {
737 |  |  |  |  | redef "IO::Handle::setbuf()";
738 |  |  |  |  | }
739 |  |  |  |  |
740 |  |  |  |  | sub setvbuf {
741 |  |  |  |  | redef "IO::Handle::setvbuf()";
742 |  |  |  |  | }
743 |  |  |  |  |
744 |  |  |  |  | sub sleep {
745 |  |  |  |  | usage "sleep(seconds)" if @_ != 1;
746 |  |  |  |  | $_[0] - CORE::sleep($_[0]);
747 |  |  |  |  | }
748 |  |  |  |  |
749 |  |  |  |  | sub unlink {
750 |  |  |  |  | usage "unlink(filename)" if @_ != 1;
751 |  |  |  |  | CORE::unlink($_[0]);
752 |  |  |  |  | }
753 |  |  |  |  |
754 |  |  |  |  | sub utime {
755 |  |  |  |  | usage "utime(filename, atime, mtime)" if @_ != 3;
756 |  |  |  |  | CORE::utime($_[1], $_[2], $_[0]);
757 |  |  |  |  | }
758 |  |  |  |  |
759 |  |  |  |  | # spent 512µs within POSIX::load_imports which was called # once (512µs+0s) by POSIX::import at line 51 of AutoLoader.pm sub load_imports {
760 | 7 | 515µs |  |  | %EXPORT_TAGS = (
761 |  |  |  |  |
762 |  |  |  |  | assert_h => [qw(assert NDEBUG)],
763 |  |  |  |  |
764 |  |  |  |  | ctype_h => [qw(isalnum isalpha iscntrl isdigit isgraph islower
765 |  |  |  |  | isprint ispunct isspace isupper isxdigit tolower toupper)],
766 |  |  |  |  |
767 |  |  |  |  | dirent_h => [],
768 |  |  |  |  |
769 |  |  |  |  | errno_h => [qw(E2BIG EACCES EADDRINUSE EADDRNOTAVAIL EAFNOSUPPORT
770 |  |  |  |  | EAGAIN EALREADY EBADF EBUSY ECHILD ECONNABORTED
771 |  |  |  |  | ECONNREFUSED ECONNRESET EDEADLK EDESTADDRREQ EDOM EDQUOT
772 |  |  |  |  | EEXIST EFAULT EFBIG EHOSTDOWN EHOSTUNREACH EINPROGRESS
773 |  |  |  |  | EINTR EINVAL EIO EISCONN EISDIR ELOOP EMFILE EMLINK
774 |  |  |  |  | EMSGSIZE ENAMETOOLONG ENETDOWN ENETRESET ENETUNREACH
775 |  |  |  |  | ENFILE ENOBUFS ENODEV ENOENT ENOEXEC ENOLCK ENOMEM
776 |  |  |  |  | ENOPROTOOPT ENOSPC ENOSYS ENOTBLK ENOTCONN ENOTDIR
777 |  |  |  |  | ENOTEMPTY ENOTSOCK ENOTTY ENXIO EOPNOTSUPP EPERM
778 |  |  |  |  | EPFNOSUPPORT EPIPE EPROCLIM EPROTONOSUPPORT EPROTOTYPE
779 |  |  |  |  | ERANGE EREMOTE ERESTART EROFS ESHUTDOWN ESOCKTNOSUPPORT
780 |  |  |  |  | ESPIPE ESRCH ESTALE ETIMEDOUT ETOOMANYREFS ETXTBSY
781 |  |  |  |  | EUSERS EWOULDBLOCK EXDEV errno)],
782 |  |  |  |  |
783 |  |  |  |  | fcntl_h => [qw(FD_CLOEXEC F_DUPFD F_GETFD F_GETFL F_GETLK F_RDLCK
784 |  |  |  |  | F_SETFD F_SETFL F_SETLK F_SETLKW F_UNLCK F_WRLCK
785 |  |  |  |  | O_ACCMODE O_APPEND O_CREAT O_EXCL O_NOCTTY O_NONBLOCK
786 |  |  |  |  | O_RDONLY O_RDWR O_TRUNC O_WRONLY
787 |  |  |  |  | creat
788 |  |  |  |  | SEEK_CUR SEEK_END SEEK_SET
789 |  |  |  |  | S_IRGRP S_IROTH S_IRUSR S_IRWXG S_IRWXO S_IRWXU
790 |  |  |  |  | S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISGID S_ISREG S_ISUID
791 |  |  |  |  | S_IWGRP S_IWOTH S_IWUSR)],
792 |  |  |  |  |
793 |  |  |  |  | float_h => [qw(DBL_DIG DBL_EPSILON DBL_MANT_DIG
794 |  |  |  |  | DBL_MAX DBL_MAX_10_EXP DBL_MAX_EXP
795 |  |  |  |  | DBL_MIN DBL_MIN_10_EXP DBL_MIN_EXP
796 |  |  |  |  | FLT_DIG FLT_EPSILON FLT_MANT_DIG
797 |  |  |  |  | FLT_MAX FLT_MAX_10_EXP FLT_MAX_EXP
798 |  |  |  |  | FLT_MIN FLT_MIN_10_EXP FLT_MIN_EXP
799 |  |  |  |  | FLT_RADIX FLT_ROUNDS
800 |  |  |  |  | LDBL_DIG LDBL_EPSILON LDBL_MANT_DIG
801 |  |  |  |  | LDBL_MAX LDBL_MAX_10_EXP LDBL_MAX_EXP
802 |  |  |  |  | LDBL_MIN LDBL_MIN_10_EXP LDBL_MIN_EXP)],
803 |  |  |  |  |
804 |  |  |  |  | grp_h => [],
805 |  |  |  |  |
806 |  |  |  |  | limits_h => [qw( ARG_MAX CHAR_BIT CHAR_MAX CHAR_MIN CHILD_MAX
807 |  |  |  |  | INT_MAX INT_MIN LINK_MAX LONG_MAX LONG_MIN MAX_CANON
808 |  |  |  |  | MAX_INPUT MB_LEN_MAX NAME_MAX NGROUPS_MAX OPEN_MAX
809 |  |  |  |  | PATH_MAX PIPE_BUF SCHAR_MAX SCHAR_MIN SHRT_MAX SHRT_MIN
810 |  |  |  |  | SSIZE_MAX STREAM_MAX TZNAME_MAX UCHAR_MAX UINT_MAX
811 |  |  |  |  | ULONG_MAX USHRT_MAX _POSIX_ARG_MAX _POSIX_CHILD_MAX
812 |  |  |  |  | _POSIX_LINK_MAX _POSIX_MAX_CANON _POSIX_MAX_INPUT
813 |  |  |  |  | _POSIX_NAME_MAX _POSIX_NGROUPS_MAX _POSIX_OPEN_MAX
814 |  |  |  |  | _POSIX_PATH_MAX _POSIX_PIPE_BUF _POSIX_SSIZE_MAX
815 |  |  |  |  | _POSIX_STREAM_MAX _POSIX_TZNAME_MAX)],
816 |  |  |  |  |
817 |  |  |  |  | locale_h => [qw(LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGES
818 |  |  |  |  | LC_MONETARY LC_NUMERIC LC_TIME NULL
819 |  |  |  |  | localeconv setlocale)],
820 |  |  |  |  |
821 |  |  |  |  | math_h => [qw(HUGE_VAL acos asin atan ceil cosh fabs floor fmod
822 |  |  |  |  | frexp ldexp log10 modf pow sinh tan tanh)],
823 |  |  |  |  |
824 |  |  |  |  | pwd_h => [],
825 |  |  |  |  |
826 |  |  |  |  | setjmp_h => [qw(longjmp setjmp siglongjmp sigsetjmp)],
827 |  |  |  |  |
828 |  |  |  |  | signal_h => [qw(SA_NOCLDSTOP SA_NOCLDWAIT SA_NODEFER SA_ONSTACK
829 |  |  |  |  | SA_RESETHAND SA_RESTART SA_SIGINFO SIGABRT SIGALRM
830 |  |  |  |  | SIGCHLD SIGCONT SIGFPE SIGHUP SIGILL SIGINT SIGKILL
831 |  |  |  |  | SIGPIPE %SIGRT SIGRTMIN SIGRTMAX SIGQUIT SIGSEGV SIGSTOP
832 |  |  |  |  | SIGTERM SIGTSTP SIGTTIN SIGTTOU SIGUSR1 SIGUSR2
833 |  |  |  |  | SIG_BLOCK SIG_DFL SIG_ERR SIG_IGN SIG_SETMASK SIG_UNBLOCK
834 |  |  |  |  | raise sigaction signal sigpending sigprocmask sigsuspend)],
835 |  |  |  |  |
836 |  |  |  |  | stdarg_h => [],
837 |  |  |  |  |
838 |  |  |  |  | stddef_h => [qw(NULL offsetof)],
839 |  |  |  |  |
840 |  |  |  |  | stdio_h => [qw(BUFSIZ EOF FILENAME_MAX L_ctermid L_cuserid
841 |  |  |  |  | L_tmpname NULL SEEK_CUR SEEK_END SEEK_SET
842 |  |  |  |  | STREAM_MAX TMP_MAX stderr stdin stdout
843 |  |  |  |  | clearerr fclose fdopen feof ferror fflush fgetc fgetpos
844 |  |  |  |  | fgets fopen fprintf fputc fputs fread freopen
845 |  |  |  |  | fscanf fseek fsetpos ftell fwrite getchar gets
846 |  |  |  |  | perror putc putchar puts remove rewind
847 |  |  |  |  | scanf setbuf setvbuf sscanf tmpfile tmpnam
848 |  |  |  |  | ungetc vfprintf vprintf vsprintf)],
849 |  |  |  |  |
850 |  |  |  |  | stdlib_h => [qw(EXIT_FAILURE EXIT_SUCCESS MB_CUR_MAX NULL RAND_MAX
851 |  |  |  |  | abort atexit atof atoi atol bsearch calloc div
852 |  |  |  |  | free getenv labs ldiv malloc mblen mbstowcs mbtowc
853 |  |  |  |  | qsort realloc strtod strtol strtoul wcstombs wctomb)],
854 |  |  |  |  |
855 |  |  |  |  | string_h => [qw(NULL memchr memcmp memcpy memmove memset strcat
856 |  |  |  |  | strchr strcmp strcoll strcpy strcspn strerror strlen
857 |  |  |  |  | strncat strncmp strncpy strpbrk strrchr strspn strstr
858 |  |  |  |  | strtok strxfrm)],
859 |  |  |  |  |
860 |  |  |  |  | sys_stat_h => [qw(S_IRGRP S_IROTH S_IRUSR S_IRWXG S_IRWXO S_IRWXU
861 |  |  |  |  | S_ISBLK S_ISCHR S_ISDIR S_ISFIFO S_ISGID S_ISREG
862 |  |  |  |  | S_ISUID S_IWGRP S_IWOTH S_IWUSR S_IXGRP S_IXOTH S_IXUSR
863 |  |  |  |  | fstat mkfifo)],
864 |  |  |  |  |
865 |  |  |  |  | sys_times_h => [],
866 |  |  |  |  |
867 |  |  |  |  | sys_types_h => [],
868 |  |  |  |  |
869 |  |  |  |  | sys_utsname_h => [qw(uname)],
870 |  |  |  |  |
871 |  |  |  |  | sys_wait_h => [qw(WEXITSTATUS WIFEXITED WIFSIGNALED WIFSTOPPED
872 |  |  |  |  | WNOHANG WSTOPSIG WTERMSIG WUNTRACED)],
873 |  |  |  |  |
874 |  |  |  |  | termios_h => [qw( B0 B110 B1200 B134 B150 B1800 B19200 B200 B2400
875 |  |  |  |  | B300 B38400 B4800 B50 B600 B75 B9600 BRKINT CLOCAL
876 |  |  |  |  | CREAD CS5 CS6 CS7 CS8 CSIZE CSTOPB ECHO ECHOE ECHOK
877 |  |  |  |  | ECHONL HUPCL ICANON ICRNL IEXTEN IGNBRK IGNCR IGNPAR
878 |  |  |  |  | INLCR INPCK ISIG ISTRIP IXOFF IXON NCCS NOFLSH OPOST
879 |  |  |  |  | PARENB PARMRK PARODD TCIFLUSH TCIOFF TCIOFLUSH TCION
880 |  |  |  |  | TCOFLUSH TCOOFF TCOON TCSADRAIN TCSAFLUSH TCSANOW
881 |  |  |  |  | TOSTOP VEOF VEOL VERASE VINTR VKILL VMIN VQUIT VSTART
882 |  |  |  |  | VSTOP VSUSP VTIME
883 |  |  |  |  | cfgetispeed cfgetospeed cfsetispeed cfsetospeed tcdrain
884 |  |  |  |  | tcflow tcflush tcgetattr tcsendbreak tcsetattr )],
885 |  |  |  |  |
886 |  |  |  |  | time_h => [qw(CLK_TCK CLOCKS_PER_SEC NULL asctime clock ctime
887 |  |  |  |  | difftime mktime strftime tzset tzname)],
888 |  |  |  |  |
889 |  |  |  |  | unistd_h => [qw(F_OK NULL R_OK SEEK_CUR SEEK_END SEEK_SET
890 |  |  |  |  | STDERR_FILENO STDIN_FILENO STDOUT_FILENO W_OK X_OK
891 |  |  |  |  | _PC_CHOWN_RESTRICTED _PC_LINK_MAX _PC_MAX_CANON
892 |  |  |  |  | _PC_MAX_INPUT _PC_NAME_MAX _PC_NO_TRUNC _PC_PATH_MAX
893 |  |  |  |  | _PC_PIPE_BUF _PC_VDISABLE _POSIX_CHOWN_RESTRICTED
894 |  |  |  |  | _POSIX_JOB_CONTROL _POSIX_NO_TRUNC _POSIX_SAVED_IDS
895 |  |  |  |  | _POSIX_VDISABLE _POSIX_VERSION _SC_ARG_MAX
896 |  |  |  |  | _SC_CHILD_MAX _SC_CLK_TCK _SC_JOB_CONTROL
897 |  |  |  |  | _SC_NGROUPS_MAX _SC_OPEN_MAX _SC_PAGESIZE _SC_SAVED_IDS
898 |  |  |  |  | _SC_STREAM_MAX _SC_TZNAME_MAX _SC_VERSION
899 |  |  |  |  | _exit access ctermid cuserid
900 |  |  |  |  | dup2 dup execl execle execlp execv execve execvp
901 |  |  |  |  | fpathconf fsync getcwd getegid geteuid getgid getgroups
902 |  |  |  |  | getpid getuid isatty lseek pathconf pause setgid setpgid
903 |  |  |  |  | setsid setuid sysconf tcgetpgrp tcsetpgrp ttyname)],
904 |  |  |  |  |
905 |  |  |  |  | utime_h => [],
906 |  |  |  |  |
907 |  |  |  |  | );
908 |  |  |  |  |
909 |  |  |  |  | # Exporter::export_tags();
910 |  |  |  |  | {
911 |  |  |  |  | # De-duplicate the export list:
912 |  |  |  |  | my %export;
913 |  |  |  |  | @export{map {@$_} values %EXPORT_TAGS} = ();
914 |  |  |  |  | # Doing the de-dup with a temporary hash has the advantage that the SVs in
915 |  |  |  |  | # @EXPORT are actually shared hash key sacalars, which will save some memory.
916 |  |  |  |  | push @EXPORT, keys %export;
917 |  |  |  |  | }
918 |  |  |  |  |
919 |  |  |  |  | @EXPORT_OK = qw(
920 |  |  |  |  | abs
921 |  |  |  |  | alarm
922 |  |  |  |  | atan2
923 |  |  |  |  | chdir
924 |  |  |  |  | chmod
925 |  |  |  |  | chown
926 |  |  |  |  | close
927 |  |  |  |  | closedir
928 |  |  |  |  | cos
929 |  |  |  |  | exit
930 |  |  |  |  | exp
931 |  |  |  |  | fcntl
932 |  |  |  |  | fileno
933 |  |  |  |  | fork
934 |  |  |  |  | getc
935 |  |  |  |  | getgrgid
936 |  |  |  |  | getgrnam
937 |  |  |  |  | getlogin
938 |  |  |  |  | getpgrp
939 |  |  |  |  | getppid
940 |  |  |  |  | getpwnam
941 |  |  |  |  | getpwuid
942 |  |  |  |  | gmtime
943 |  |  |  |  | isatty
944 |  |  |  |  | kill
945 |  |  |  |  | lchown
946 |  |  |  |  | link
947 |  |  |  |  | localtime
948 |  |  |  |  | log
949 |  |  |  |  | mkdir
950 |  |  |  |  | nice
951 |  |  |  |  | open
952 |  |  |  |  | opendir
953 |  |  |  |  | pipe
954 |  |  |  |  | printf
955 |  |  |  |  | rand
956 |  |  |  |  | read
957 |  |  |  |  | readdir
958 |  |  |  |  | rename
959 |  |  |  |  | rewinddir
960 |  |  |  |  | rmdir
961 |  |  |  |  | sin
962 |  |  |  |  | sleep
963 |  |  |  |  | sprintf
964 |  |  |  |  | sqrt
965 |  |  |  |  | srand
966 |  |  |  |  | stat
967 |  |  |  |  | system
968 |  |  |  |  | time
969 |  |  |  |  | times
970 |  |  |  |  | umask
971 |  |  |  |  | unlink
972 |  |  |  |  | utime
973 |  |  |  |  | wait
974 |  |  |  |  | waitpid
975 |  |  |  |  | write
976 |  |  |  |  | );
977 |  |  |  |  |
978 |  |  |  |  | require Exporter;
979 |  |  |  |  | }
980 |  |  |  |  |
981 |  |  |  |  | package POSIX::SigAction;
982 | 1 | 4µs |  |  |
983 |  |  |  |  | sub new { bless {HANDLER => $_[1], MASK => $_[2], FLAGS => $_[3] || 0, SAFE => 0}, $_[0] }
984 |  |  |  |  | sub handler { $_[0]->{HANDLER} = $_[1] if @_ > 1; $_[0]->{HANDLER} };
985 |  |  |  |  | sub mask { $_[0]->{MASK} = $_[1] if @_ > 1; $_[0]->{MASK} };
986 |  |  |  |  | sub flags { $_[0]->{FLAGS} = $_[1] if @_ > 1; $_[0]->{FLAGS} };
987 |  |  |  |  | sub safe { $_[0]->{SAFE} = $_[1] if @_ > 1; $_[0]->{SAFE} };
988 |  |  |  |  |
989 |  |  |  |  | package POSIX::SigRt;
990 |  |  |  |  |
991 |  |  |  |  |
992 |  |  |  |  | sub _init {
993 |  |  |  |  | $_SIGRTMIN = &POSIX::SIGRTMIN;
994 |  |  |  |  | $_SIGRTMAX = &POSIX::SIGRTMAX;
995 |  |  |  |  | $_sigrtn = $_SIGRTMAX - $_SIGRTMIN;
996 |  |  |  |  | }
997 |  |  |  |  |
998 |  |  |  |  | sub _croak {
999 |  |  |  |  | &_init unless defined $_sigrtn;
1000 |  |  |  |  | die "POSIX::SigRt not available" unless defined $_sigrtn && $_sigrtn > 0;
1001 |  |  |  |  | }
1002 |  |  |  |  |
1003 |  |  |  |  | sub _getsig {
1004 |  |  |  |  | &_croak;
1005 |  |  |  |  | my $rtsig = $_[0];
1006 |  |  |  |  | # Allow (SIGRT)?MIN( + n)?, a common idiom when doing these things in C.
1007 |  |  |  |  | $rtsig = $_SIGRTMIN + ($1 || 0)
1008 |  |  |  |  | if $rtsig =~ /^(?:(?:SIG)?RT)?MIN(\s*\+\s*(\d+))?$/;
1009 |  |  |  |  | return $rtsig;
1010 |  |  |  |  | }
1011 |  |  |  |  |
1012 |  |  |  |  | sub _exist {
1013 |  |  |  |  | my $rtsig = _getsig($_[1]);
1014 |  |  |  |  | my $ok = $rtsig >= $_SIGRTMIN && $rtsig <= $_SIGRTMAX;
1015 |  |  |  |  | ($rtsig, $ok);
1016 |  |  |  |  | }
1017 |  |  |  |  |
1018 |  |  |  |  | sub _check {
1019 |  |  |  |  | my ($rtsig, $ok) = &_exist;
1020 |  |  |  |  | die "No POSIX::SigRt signal $_[1] (valid range SIGRTMIN..SIGRTMAX, or $_SIGRTMIN..$_SIGRTMAX)"
1021 |  |  |  |  | unless $ok;
1022 |  |  |  |  | return $rtsig;
1023 |  |  |  |  | }
1024 |  |  |  |  |
1025 |  |  |  |  | sub new {
1026 |  |  |  |  | my ($rtsig, $handler, $flags) = @_;
1027 |  |  |  |  | my $sigset = POSIX::SigSet->new($rtsig);
1028 |  |  |  |  | my $sigact = POSIX::SigAction->new($handler,
1029 |  |  |  |  | $sigset,
1030 |  |  |  |  | $flags);
1031 |  |  |  |  | POSIX::sigaction($rtsig, $sigact);
1032 |  |  |  |  | }
1033 |  |  |  |  |
1034 |  |  |  |  | sub EXISTS { &_exist }
1035 |  |  |  |  | sub FETCH { my $rtsig = &_check;
1036 |  |  |  |  | my $oa = POSIX::SigAction->new();
1037 |  |  |  |  | POSIX::sigaction($rtsig, undef, $oa);
1038 |  |  |  |  | return $oa->{HANDLER} }
1039 |  |  |  |  | sub STORE { my $rtsig = &_check; new($rtsig, $_[2], $SIGACTION_FLAGS) }
1040 |  |  |  |  | sub DELETE { delete $SIG{ &_check } }
1041 |  |  |  |  | sub CLEAR { &_exist; delete @SIG{ &POSIX::SIGRTMIN .. &POSIX::SIGRTMAX } }
1042 |  |  |  |  | sub SCALAR { &_croak; $_sigrtn + 1 }
|  |  |  |  | # spent 3µs within POSIX::CORE:match which was called # once (3µs+0s) by POSIX::AUTOLOAD at line 41 of POSIX.pm sub POSIX::CORE:match; # xsub