Sys/IO.pm untested

filter: Statementstmt n/a Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a SCAR -
1 package SPVM::Sys::IO;
2  
3 1;
4  
5 =head1 Name
6  
7 SPVM::Sys::IO - IO System Call
8  
9 =head1 Usage
10
11 use Sys::IO;
12  
13 =head1 Description
14  
15 C<Sys::IO> is the class for the file IO.
16  
17 =head1 Class Methods
18  
19 =head2 stdin
20  
21 C<static method stdin : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream> ();>
22  
23 Returns L<stdin|https://linux.die.net/man/3/stdin>.
24  
25 =head2 stdout
26  
27 C<static method stdout : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream> ();>
28  
29 Returns L<stdout|https://linux.die.net/man/3/stdout>.
30  
31 =head2 stderr
32  
33 C<static method stderr : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream> ();>
34  
35 Returns L<stderr|https://linux.die.net/man/3/stderr>.
36  
37 =head2 spvm_stdin
38  
39 C<static method spvm_stdin : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream> ();>
40  
41 Returns the L<stdin|SPVM::Document::NativeAPI/"spvm_stdin"> opened by the SPVM language.
42  
43 =head2 spvm_stdout
44  
45 C<static method spvm_stdout : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream> ();>
46  
47 Returns the L<stdout|SPVM::Document::NativeAPI/"spvm_stdout"> opened by the SPVM language.
48  
49 =head2 spvm_stderr
50  
51 C<static method spvm_stderr : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream> ();>
52  
53 Returns the L<stderr|SPVM::Document::NativeAPI/"spvm_stderr"> opened by the SPVM language.
54  
55 =head2 fopen
56  
57 C<static method fopen : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream> ($path : string, $mode : string);>
58  
59 Calls the L<fopen|https://linux.die.net/man/3/fopen> function and returns its return value.
60  
61 Exceptions:
62  
63 $path must be defined. Otherwise an exception is thrown.
64  
65 $mode must be defined. Otherwise an exception is thrown.
66  
67 If the fopen function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
68  
69 =head2 fdopen
70  
71 C<static method fdopen : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream> ($fd : int, $mode : string);>
72  
73 Calls the L<fdopen|https://linux.die.net/man/3/fdopen> function and returns its return value.
74  
75 Exceptions:
76  
77 $fd must be greater than or equal to 0. Otherwise an exception is thrown.
78  
79 $mode must be defined. Otherwise an exception is thrown.
80  
81 If the fdopen function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
82  
83 =head2 fileno
84  
85 C<static method fileno : int ($stream : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream>);>
86  
87 Calls the L<fileno|https://linux.die.net/man/3/fileno> function and returns its return value.
88  
89 Exceptions:
90  
91 $stream must be defined. Otherwise an exception is thrown.
92  
93 If the fileno function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
94  
95 =head2 fread
96  
97 C<static method fread : int ($ptr : mutable string, $size : int, $nmemb : int, $stream : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream>, $ptr_offset : int = 0);>
98  
99 Calls the L<fread|https://linux.die.net/man/3/fread> function and returns its return value.
100  
101 Exceptions:
102  
103 $ptr must be defined. Otherwise an exception is thrown.
104  
105 $size must be more than or equal to 0. Otherwise an exception is thrown.
106  
107 $nmemb must be more than or equal to 0. Otherwise an exception is thrown.
108  
109 $stream must be defined. Otherwise an exception is thrown.
110  
111 $nmemb * $size must be less than or equal to the length of $ptr - $ptr_offset. Otherwise an exception is thrown.
112  
113 If the return value is less than $nmemb and C<ferror(stream)> is non-zero, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
114  
115 =head2 feof
116  
117 C<static method feof : int ($stream : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream>);>
118  
119 Calls the L<feof|https://linux.die.net/man/3/feof> function and returns its return value.
120  
121 Exceptions:
122  
123 $stream must be defined. Otherwise an exception is thrown.
124  
125 =head2 ferror
126  
127 C<static method ferror : int ($stream : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream>);>
128  
129 Calls the L<ferror|https://linux.die.net/man/3/ferror> function and returns its return value.
130  
131 Exceptions:
132  
133 $stream must be defined. Otherwise an exception is thrown.
134  
135 =head2 clearerr
136  
137 C<static method clearerr : void ($stream : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream>);>
138  
139 Calls the L<clearerr|https://linux.die.net/man/3/clearerr> function.
140  
141 Exceptions:
142  
143 $stream must be defined. Otherwise an exception is thrown.
144  
145 =head2 getc
146  
147 C<static method getc : int ($stream : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream>);>
148  
149 Calls the L<getc|https://linux.die.net/man/3/getc> function and returns its return value.
150  
151 Exceptions:
152  
153 $stream must be defined. Otherwise an exception is thrown.
154  
155 If the return value is C<EOF> and C<ferror(stream)> is non-zero, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
156  
157 =head2 ungetc
158  
159 C<static method ungetc : int ($c : int, $stream : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream>);>
160  
161 Calls the L<ungetc|https://linux.die.net/man/3/ungetc> function and returns its return value.
162  
163 Exceptions:
164  
165 $stream must be defined. Otherwise an exception is thrown.
166  
167 If the return value is C<EOF> and C<ferror(stream)> is non-zero, an exception is thrown.
168  
169 =head2 fgets
170  
171 C<static method fgets : mutable string ($s : mutable string, $size : int, $stream : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream>, $s_offset : int = 0);>
172  
173 Calls the L<fgets|https://linux.die.net/man/3/fgets> function and returns its return value.
174  
175 Exceptions:
176  
177 $s must be defined. Otherwise an exception is thrown.
178  
179 $size must be more than or equal to 0. Otherwise an exception is thrown.
180  
181 $stream must be defined. Otherwise an exception is thrown.
182  
183 $size must be less than the length of $s - $s_offset. Otherwise an exception is thrown.
184  
185 =head2 fwrite
186  
187 C<static method fwrite : int ($ptr : string, $size : int, $nmemb : int, $stream : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream>, $ptr_offset : int = 0);>
188  
189 Calls the L<fwrite|https://linux.die.net/man/3/fwrite> function and returns its return value.
190  
191 Exceptions:
192  
193 $ptr must be defined. Otherwise an exception is thrown.
194  
195 $size must be more than or equal to 0. Otherwise an exception is thrown.
196  
197 $nmemb must be more than or equal to 0. Otherwise an exception is thrown.
198  
199 $stream must be defined. Otherwise an exception is thrown.
200  
201 $nmemb * $size must be less than or equal to the length of $ptr - $ptr_offset. Otherwise an exception is thrown.
202  
203 If the return value is less than $nmemb and C<ferror(stream)> is non-zero, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
204  
205 =head2 fclose
206  
207 C<static method fclose : int ($stream : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream>);>
208  
209 Calls the L<fclose|https://linux.die.net/man/3/fclose> function and returns its return value.
210  
211 If successful, the L<closed|SPVM::Sys::IO::FileStream/"closed"> field is set to 1.
212  
213 Exceptions:
214  
215 $stream must be defined
216  
217 If the fclose function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
218  
219 =head2 fseek
220  
221 C<static method fseek : int ($stream : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream>, $offset : long, $whence : int);>
222  
223 Calls the L<fseek|https://linux.die.net/man/3/fseek> function and returns its return value.
224  
225 See L<Sys::IO::Constant|SPVM::Sys::IO::Constant> about constant values given to $whence.
226  
227 Exceptions:
228  
229 $stream must be defined. Otherwise an exception is thrown.
230  
231 $offset must be greater than or equal to 0. Otherwise an exception is thrown.
232  
233 If the fseek function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
234  
235 =head2 ftell
236  
237 C<static method ftell : long ($stream : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream>);>
238  
239 Calls the L<ftell|https://linux.die.net/man/3/ftell> function and returns its return value.
240  
241 Exceptions:
242  
243 $stream must be defined. Otherwise an exception is thrown.
244  
245 If the ftell function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
246  
247 =head2 fflush
248  
249 C<static method fflush : int ($stream : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream>);>
250  
251 Calls the L<fflush|https://linux.die.net/man/3/fflush> function and returns its return value.
252  
253 Exceptions:
254  
255 $stream must be defined. Otherwise an exception is thrown.
256  
257 If the fflush function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
258  
259 =head2 freopen
260  
261 C<static method freopen : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream> ($path : string, $mode : string, $stream : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream>);>
262  
263 Calls the L<freopen|https://linux.die.net/man/3/freopen> function and returns its return value.
264  
265 Exceptions:
266  
267 $path must be defined. Otherwise an exception is thrown.
268  
269 $mode must be defined. Otherwise an exception is thrown.
270  
271 $stream must be defined. Otherwise an exception is thrown.
272  
273 If the freopen function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
274  
275 =head2 setvbuf
276  
277 C<static method setvbuf : int ($stream : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream>, $buf : mutable string, $mode : int, $size : int);>
278  
279 Calls the L<setvbuf|https://linux.die.net/man/3/setvbuf> function and returns its return value.
280  
281 See L<Sys::IO::Constant|SPVM::Sys::IO::Constant> about constant values given to $mode.
282  
283 Exceptions:
284  
285 $stream must be defined. Otherwise an exception is thrown.
286  
287 If $buf is defined, $size must be greater than or equal to 0. Otherwise an exception is thrown.
288  
289 If $buf is defined, $size must be less than or equal to the length of $buf. Otherwise an exception is thrown.
290  
291 If the setvbuf function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
292  
293 =head2 setbuf
294  
295 C<static method setbuf : void ($stream : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream>, $buf : mutable string);>
296  
297 Calls the L</"setvbuf"> method given the following mode $mode and size $size.
298  
299 If $buf is defined, $mode is set to C<_IOFBF>, otherwise C<_IONBF>.
300  
301 $size is C<BUFSIZ>.
302  
303 =head2 setbuffer
304  
305 C<static method setbuffer : void ($stream : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream>, $buf : mutable string, $size : int);>
306  
307 Calls the L</"setvbuf"> method given the following mode $mode.
308  
309 If $buf is defined, $mode is set to C<_IOFBF>, otherwise C<_IONBF>.
310  
311 =head2 setlinebuf
312  
313 C<static method setlinebuf : void ($stream : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream>);>
314  
315 Calls the L</"setvbuf"> method given the following buffer $buf and mode $mode.
316  
317 $buf is undef.
318  
319 $mode is C<_IOLBF>.
320  
321 $size is C<BUFSIZ>.
322  
323 =head2 open
324  
325 C<static method open : int ($path : string, $int_mode : int, $perms : int = 0);>
326  
327 Calls the L<open|https://linux.die.net/man/2/open> function and returns its return value.
328  
329 See L<Sys::IO::Constant|SPVM::Sys::IO::Constant> about constant values given to the interger open mode $int_mode and the permissions $perms.
330  
331 Exceptions:
332  
333 $path must be defined. Otherwise an exception is thrown.
334  
335 If the open function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
336  
337 =head2 read
338  
339 C<static method read : int ($fd : int, $buf : mutable string, $count : int, $buf_offset : int = 0);>
340  
341 Calls the L<read|https://linux.die.net/man/2/read> function and returns its return value.
342  
343 Exceptions:
344  
345 $buf must be defined. Otherwise an exception is thrown.
346  
347 $count must be more than or equal to 0. Otherwise an exception is thrown.
348  
349 $count must be less than the length of $buf - $buf_offset. Otherwise an exception is thrown.
350  
351 If the read function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
352  
353 =head2 write
354  
355 C<static method write : int ($fd : int, $buf : string, $count : int, $buf_offset : int = 0);>
356  
357 Calls the L<write|https://linux.die.net/man/2/write> function and returns its return value.
358  
359 Exceptions:
360  
361 $buf must be defined. Otherwise an exception is thrown.
362  
363 $buf_offse must be greater than or equal to 0. Otherwise an exception is thrown.
364  
365 $count must be less than the length of $buf - $buf_offset. Otherwise an exception is thrown.
366  
367 If the write function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
368  
369 =head2 lseek
370  
371 C<static method lseek : long ($fd : int, $offset : long, $whence : int);>
372  
373 Calls the L<lseek|https://linux.die.net/man/2/lseek> function and returns its return value.
374  
375 See L<Sys::IO::Constant|SPVM::Sys::IO::Constant> about constant values given to $whence.
376  
377 Exceptions:
378  
379 $offset must be greater than or equal to 0. Otherwise an exception is thrown.
380  
381 If the lseek function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
382  
383 =head2 close
384  
385 C<static method close : int ($fd : int);>
386  
387 Calls the L<close|https://linux.die.net/man/2/close> function and returns its return value.
388  
389 Exceptions:
390  
391 If the close function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
392  
393 =head2 fsync
394  
395 C<static method fsync : int ($fd : int);>
396  
397 Calls the L<fsync|https://linux.die.net/man/2/fsync> function and returns its return value.
398  
399 Exceptions:
400  
401 If the fsync function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
402  
403 =head2 fcntl
404  
405 C<static method fcntl : int ($fd : int, $command : int, $command_arg : object of Int|SPVM::Sys::IO::Flock = undef);>
406  
407 Calls the L<fcntl|https://linux.die.net/man/2/fcntl> function and returns its return value.
408  
409 Exceptions:
410  
411 $command_arg must be an instance of the Int class or Sys::IO::Flock class.
412  
413 =head2 ftruncate
414  
415 C<static method ftruncate : int ($fd : int, $length : long);>
416  
417 Calls the L<ftruncate|https://linux.die.net/man/2/ftruncate> function and returns its return value.
418  
419 Exceptions:
420  
421 If the ftruncate function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
422  
423 =head2 flock
424  
425 C<static method flock : int ($fd : int, $operation : int);>
426  
427 Calls the L<flock|https://linux.die.net/man/2/flock> function and returns its return value.
428  
429 See L<Sys::IO::Constant|SPVM::Sys::IO::Constant> about constant values given to the operation $operation.
430  
431 Exceptions:
432  
433 If the flock function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
434  
435 =head2 access
436  
437 C<static method access : int ($path : string, $mode : int);>
438  
439 Calls the L<access|https://linux.die.net/man/2/access> function and returns its return value.
440  
441 See L<Sys::IO::Constant|SPVM::Sys::IO::Constant> about constant values given to the mode $mode.
442  
443 Exceptions:
444  
445 $path must be defined. Otherwise an exception is thrown.
446  
447 If the access function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
448  
449 =head2 faccessat
450  
451 static method faccessat : int ($dirfd : int, $path : string, $mode : int, $flags : int);
452  
453 Calls the L<faccessat|https://linux.die.net/man/2/faccessat> function and returns its return value.
454  
455 See L<Sys::IO::Constant|SPVM::Sys::IO::Constant> about constant values given to the mode $mode and the flag $flag.
456  
457 Exceptions:
458  
459 $path must be defined. Otherwise an exception is thrown.
460  
461 If the faccessat function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
462  
463 =head2 eaccess
464  
465 C<static method eaccess : int ($path : string, $mode : int);>
466  
467 Calls the L</"faccessat"> method given the following $dirfd and $flag.
468  
469 $dirfd is C<AT_FDCWD>.
470  
471 $flag is C<AT_EACCESS>.
472  
473 =head2 truncate
474  
475 C<static method truncate : int ($path : string, $length : long);>
476  
477 Calls the L<truncate|https://linux.die.net/man/2/truncate> function and returns its return value.
478  
479 Exceptions:
480  
481 $path must be defined. Otherwise an exception is thrown.
482  
483 $length must be less than or equal to 0.
484  
485 If the truncate function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
486  
487 =head2 mkdir
488  
489 C<static method mkdir : int ($path : string, $mode : int);>
490  
491 Windows:
492  
493 Calls the L<_mkdir|https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/mkdir-wmkdir?view=msvc-170> function and return its return value.
494  
495 OS other than Windows:
496  
497 Calls the L<mkdir|https://linux.die.net/man/2/mkdir> function and return its return value.
498  
499 Exceptions:
500  
501 If the mkdir(or _mkdir) function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
502  
503 =head2 umask
504  
505 C<static method umask : int ($perms : int);>
506  
507 Calls the L<umask|https://linux.die.net/man/2/umask> function and return its return value.
508  
509 =head2 rmdir
510  
511 C<static method rmdir : int ($path : string);>
512  
513 Calls the L<rmdir|https://linux.die.net/man/2/rmdir> function and return its return value.
514  
515 Exceptions:
516  
517 $path must be defined. Otherwise an exception is thrown.
518  
519 If the rmdir function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
520  
521 =head2 unlink
522  
523 C<static method unlink : int ($path : string);>
524  
525 Calls the L<unlink|https://linux.die.net/man/2/unlink> function and return its return value.
526  
527 Exceptions:
528  
529 $path must be defined. Otherwise an exception is thrown.
530  
531 If the unlink function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
532  
533 =head2 rename
534  
535 C<static method rename : int ($old_path : string, $new_path : string);>
536  
537 Calls the L<rename|https://linux.die.net/man/2/rename> function and return its return value.
538  
539 Exceptions:
540  
541 $old_path must be defined. Otherwise an exception is thrown.
542  
543 $new_path must be defined. Otherwise an exception is thrown.
544  
545 If the rename function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
546  
547 =head2 getcwd
548  
549 C<static method getcwd : string ();>
550  
551 Return the working directory by using L<getcwd|https://linux.die.net/man/2/getcwd> function.
552  
553 Exceptions:
554  
555 If a system call failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
556  
557 =head2 getdcwd
558  
559 C<static method getdcwd : string ($drive : int);>
560  
561 Returns the working directory in the drive $drive by using L<_wgetdcwd|https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/getdcwd-wgetdcwd?view=msvc-170> function.
562  
563 Exceptions:
564  
565 If a system call failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
566  
567 =head2 realpath
568  
569 C<static method realpath : mutable string ($path : string, $resolved_path : mutable string);>
570  
571 Calls the L<realpath|https://linux.die.net/man/3/realpath> function and return its return value.
572  
573 Exceptions:
574  
575 $path must be defined. Otherwise an exception is thrown.
576  
577 If the realpath function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
578  
579 =head2 chdir
580  
581 C<static method chdir : int ($path : string);>
582  
583 Calls the L<chdir|https://linux.die.net/man/2/chdir> function and return its return value.
584  
585 Exceptions:
586  
587 $path must be defined. Otherwise an exception is thrown.
588  
589 If the chdir function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
590  
591 =head2 chmod
592  
593 C<static method chmod : int ($path : string, $mode :int);>
594  
595 Calls the L<chmod|https://linux.die.net/man/2/chmod> function and return its return value.
596  
597 See L<Sys::IO::Constant|SPVM::Sys::IO::Constant> about constant values given to the mode $mode.
598  
599 Exceptions:
600  
601 $path must be defined. Otherwise an exception is thrown.
602  
603 If the chmod function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
604  
605 =head2 chown
606  
607 C<static method chown : int ($path : string, $owner : int, $group : int);>
608  
609 Calls the L<chown|https://linux.die.net/man/2/chown> and return its return value.
610  
611 Exceptions:
612  
613 $path must be defined. Otherwise an exception is thrown.
614  
615 If the chown function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
616  
617 =head2 symlink
618  
619 C<static method symlink : int ($old_path : string, $new_path : string);>
620  
621 Calls the L<symlink|https://linux.die.net/man/2/symlink> function and return its return value.
622  
623 Exceptions:
624  
625 $old_path must be defined. Otherwise an exception is thrown.
626  
627 $new_path must be defined. Otherwise an exception is thrown.
628  
629 If the symlink function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
630  
631 =head2 readlink
632  
633 C<static method readlink : string ($path : string);>
634  
635 Returns a link text by using L<readlink|https://linux.die.net/man/2/readlink> function.
636  
637 Exceptions:
638  
639 $path must be defined. Otherwise an exception is thrown.
640  
641 If the readlink function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
642  
643 =head2 opendir
644  
645 C<static method opendir : L<Sys::IO::DirStream|SPVM::Sys::IO::DirStream> ($dir : string);>
646  
647 Calls the L<opendir|https://linux.die.net/man/3/opendir> function and return its return value.
648  
649 Exceptions:
650  
651 $dir must be defined. Otherwise an exception is thrown.
652  
653 If the opendir function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
654  
655 =head2 closedir
656  
657 C<static method closedir : int ($dirp : L<Sys::IO::DirStream|SPVM::Sys::IO::DirStream>);>
658  
659 Calls the L<closedir|https://linux.die.net/man/3/closedir> function and return its return value.
660  
661 Exceptions:
662  
663 $dirp must be defined. Otherwise an exception is thrown.
664  
665 If the closedir function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
666  
667 =head2 readdir
668  
669 C<static method readdir : L<Sys::IO::Dirent|SPVM::Sys::IO::Dirent> ($dirp : L<Sys::IO::DirStream|SPVM::Sys::IO::DirStream>);>
670  
671 Calls the L<readdir|https://linux.die.net/man/3/readdir> function and return its return value.
672  
673 Exceptions:
674  
675 $dirp must be defined. Otherwise an exception is thrown.
676  
677 If the readdir function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
678  
679 =head2 rewinddir
680  
681 C<static method rewinddir : void ($dirp : L<Sys::IO::DirStream|SPVM::Sys::IO::DirStream>);>
682  
683 Calls the L<rewinddir|https://linux.die.net/man/3/rewinddir> function.
684  
685 Exceptions:
686  
687 $dirp must be defined. Otherwise an exception is thrown.
688  
689 =head2 telldir
690  
691 C<static method telldir : long ($dirp : L<Sys::IO::DirStream|SPVM::Sys::IO::DirStream>);>
692  
693 Calls the L<telldir|https://linux.die.net/man/3/telldir> function and return its return value.
694  
695 Exceptions:
696  
697 $dirp must be defined. Otherwise an exception is thrown.
698  
699 If the telldir function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
700  
701 =head2 seekdir
702  
703 C<static method seekdir : void ($dirp : L<Sys::IO::DirStream|SPVM::Sys::IO::DirStream>, $offset : long);>
704  
705 Calls the L<seekdir|https://linux.die.net/man/3/seekdir> function and return its return value.
706  
707 Exceptions:
708  
709 $dirp must be defined. Otherwise an exception is thrown.
710  
711 $offset must be less than or equal to 0.
712  
713 =head2 popen
714  
715 C<static method popen : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream> ($command : string, $type : string);>
716  
717 Calls the L<popen|https://linux.die.net/man/3/popen> function and returns its return value.
718  
719 L<Sys::IO::FileStream#opened_by_popen|SPVM::Sys::IO::FileStream/"opened_by_popen"> field is set to 1.
720  
721 Windows:
722  
723 Calls the L<_popen|https://learn.microsoft.com/ja-jp/cpp/c-runtime-library/reference/popen-wpopen?view=msvc-170> function and returns its return value.
724  
725 Exceptions:
726  
727 $command must be defined. Otherwise an exception is thrown.
728  
729 $type must be defined. Otherwise an exception is thrown.
730  
731 If the popen function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
732  
733 L<Sys::IO::FileStream#opened_by_popen|SPVM::Sys::IO::FileStream/"opened_by_popen"> field is set to 1.
734  
735 Exceptions:
736  
737 =head2 pclose
738  
739 C<static method pclose : int ($stream : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream>);>
740  
741 Calls the L<pclose|https://linux.die.net/man/3/pclose> function and returns its return value.
742  
743 Windows:
744  
745 Calls the L<_pclose|https://learn.microsoft.com/ja-jp/cpp/c-runtime-library/reference/pclose?view=msvc-170> function and returns its return value.
746  
747 Exceptions:
748  
749 $stream must be defined. Otherwise an exception is thrown.
750  
751 If the pclose function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
752  
753 Exceptions:
754  
755 =head2 dup
756  
757 C<static method dup : int ($fd : int);>
758  
759 Calls the L<dup|https://linux.die.net/man/2/dup> function given the arguments, and return its return value.
760  
761 Exceptions:
762  
763 If dup function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
764  
765 =head2 dup2
766  
767 C<static method dup2 : void ($fd : int, $fd_to : int);>
768  
769 Calls L<dup2|https://linux.die.net/man/2/dup2> function.
770  
771 Exceptions:
772  
773 If dup2 function failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
774  
775 =head2 pipepair
776  
777 C<static method pipepair : void ($fd1_ref : int*, $fd2_ref : int*, $non_blocking : int = 0);>
778  
779 Generates a pair of connected sockets or named pipes for bidirectional communication.
780  
781 On Unix-like systems, it uses the L<socketpair|https://linux.die.net/man/2/socketpair> function with TCP stream sockets.
782  
783 On Windows, it emulates the functionality using named pipes with securely generated unique names.
784  
785 Arguments:
786  
787 =over 4
788  
789 =item * $fd1_ref
790  
791 A reference to an integer where the read file descriptor will be stored.
792  
793 =item * $fd2_ref
794  
795 A reference to an integer where the write file descriptor will be stored.
796  
797 =item * $non_blocking
798  
799 If true, sets both file descriptors to non-blocking mode. The default is 0 (blocking mode).
800  
801 =back
802  
803 Exceptions:
804  
805 C<$fd1_ref> must be defined. Otherwise an exception is thrown.
806  
807 C<$fd2_ref> must be defined. Otherwise an exception is thrown.
808  
809 If the pipepair generation failed, an exception is thrown with C<eval_error_id> set to the basic type ID of the L<Error::System|SPVM::Error::System> class.
810  
811 =head1 See Also
812  
813 =over 2
814  
815 =item * L<Sys|SPVM::Sys>
816  
817 =back
818  
819 =head1 Copyright & License
820  
821 Copyright (c) 2023 Yuki Kimoto
822  
823 MIT License