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 read_pipe
370  
371 C<static method read_pipe : int ($fd : int, $buf : mutable string, $count : int, $buf_offset : int = 0);>
372  
373 Calls the L<read|https://linux.die.net/man/2/read> function for a pipe and returns its return value. On Windows, it handles pipe I/O compatibility.
374  
375 Exceptions:
376  
377 $buf must be defined. Otherwise an exception is thrown.
378  
379 $count must be more than or equal to 0. Otherwise an exception is thrown.
380  
381 $count must be less than the length of $buf - $buf_offset. Otherwise an exception is thrown.
382  
383 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.
384  
385 =head2 write_pipe
386  
387 C<static method write_pipe : int ($fd : int, $buf : string, $count : int, $buf_offset : int = 0);>
388  
389 Calls the L<write|https://linux.die.net/man/2/write> function for a pipe and returns its return value. On Windows, it handles pipe I/O compatibility.
390  
391 Exceptions:
392  
393 $buf must be defined. Otherwise an exception is thrown.
394  
395 $buf_offset must be greater than or equal to 0. Otherwise an exception is thrown.
396  
397 $count must be less than the length of $buf - $buf_offset. Otherwise an exception is thrown.
398  
399 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.
400  
401 =head2 lseek
402  
403 C<static method lseek : long ($fd : int, $offset : long, $whence : int);>
404  
405 Calls the L<lseek|https://linux.die.net/man/2/lseek> function and returns its return value.
406  
407 See L<Sys::IO::Constant|SPVM::Sys::IO::Constant> about constant values given to $whence.
408  
409 Exceptions:
410  
411 $offset must be greater than or equal to 0. Otherwise an exception is thrown.
412  
413 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.
414  
415 =head2 close
416  
417 C<static method close : int ($fd : int);>
418  
419 Calls the L<close|https://linux.die.net/man/2/close> function and returns its return value.
420  
421 Exceptions:
422  
423 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.
424  
425 =head2 fsync
426  
427 C<static method fsync : int ($fd : int);>
428  
429 Calls the L<fsync|https://linux.die.net/man/2/fsync> function and returns its return value.
430  
431 Exceptions:
432  
433 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.
434  
435 =head2 fcntl
436  
437 C<static method fcntl : int ($fd : int, $command : int, $command_arg : object of Int|SPVM::Sys::IO::Flock = undef);>
438  
439 Calls the L<fcntl|https://linux.die.net/man/2/fcntl> function and returns its return value.
440  
441 Exceptions:
442  
443 $command_arg must be an instance of the Int class or Sys::IO::Flock class.
444  
445 =head2 ftruncate
446  
447 C<static method ftruncate : int ($fd : int, $length : long);>
448  
449 Calls the L<ftruncate|https://linux.die.net/man/2/ftruncate> function and returns its return value.
450  
451 Exceptions:
452  
453 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.
454  
455 =head2 flock
456  
457 C<static method flock : int ($fd : int, $operation : int);>
458  
459 Calls the L<flock|https://linux.die.net/man/2/flock> function and returns its return value.
460  
461 See L<Sys::IO::Constant|SPVM::Sys::IO::Constant> about constant values given to the operation $operation.
462  
463 Exceptions:
464  
465 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.
466  
467 =head2 access
468  
469 C<static method access : int ($path : string, $mode : int);>
470  
471 Calls the L<access|https://linux.die.net/man/2/access> function and returns its return value.
472  
473 See L<Sys::IO::Constant|SPVM::Sys::IO::Constant> about constant values given to the mode $mode.
474  
475 Exceptions:
476  
477 $path must be defined. Otherwise an exception is thrown.
478  
479 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.
480  
481 =head2 faccessat
482  
483 static method faccessat : int ($dirfd : int, $path : string, $mode : int, $flags : int);
484  
485 Calls the L<faccessat|https://linux.die.net/man/2/faccessat> function and returns its return value.
486  
487 See L<Sys::IO::Constant|SPVM::Sys::IO::Constant> about constant values given to the mode $mode and the flag $flag.
488  
489 Exceptions:
490  
491 $path must be defined. Otherwise an exception is thrown.
492  
493 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.
494  
495 =head2 eaccess
496  
497 C<static method eaccess : int ($path : string, $mode : int);>
498  
499 Calls the L</"faccessat"> method given the following $dirfd and $flag.
500  
501 $dirfd is C<AT_FDCWD>.
502  
503 $flag is C<AT_EACCESS>.
504  
505 =head2 truncate
506  
507 C<static method truncate : int ($path : string, $length : long);>
508  
509 Calls the L<truncate|https://linux.die.net/man/2/truncate> function and returns its return value.
510  
511 Exceptions:
512  
513 $path must be defined. Otherwise an exception is thrown.
514  
515 $length must be less than or equal to 0.
516  
517 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.
518  
519 =head2 mkdir
520  
521 C<static method mkdir : int ($path : string, $mode : int);>
522  
523 Windows:
524  
525 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.
526  
527 OS other than Windows:
528  
529 Calls the L<mkdir|https://linux.die.net/man/2/mkdir> function and return its return value.
530  
531 Exceptions:
532  
533 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.
534  
535 =head2 umask
536  
537 C<static method umask : int ($perms : int);>
538  
539 Calls the L<umask|https://linux.die.net/man/2/umask> function and return its return value.
540  
541 =head2 rmdir
542  
543 C<static method rmdir : int ($path : string);>
544  
545 Calls the L<rmdir|https://linux.die.net/man/2/rmdir> function and return its return value.
546  
547 Exceptions:
548  
549 $path must be defined. Otherwise an exception is thrown.
550  
551 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.
552  
553 =head2 unlink
554  
555 C<static method unlink : int ($path : string);>
556  
557 Calls the L<unlink|https://linux.die.net/man/2/unlink> function and return its return value.
558  
559 Exceptions:
560  
561 $path must be defined. Otherwise an exception is thrown.
562  
563 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.
564  
565 =head2 rename
566  
567 C<static method rename : int ($old_path : string, $new_path : string);>
568  
569 Calls the L<rename|https://linux.die.net/man/2/rename> function and return its return value.
570  
571 Exceptions:
572  
573 $old_path must be defined. Otherwise an exception is thrown.
574  
575 $new_path must be defined. Otherwise an exception is thrown.
576  
577 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.
578  
579 =head2 getcwd
580  
581 C<static method getcwd : string ();>
582  
583 Return the working directory by using L<getcwd|https://linux.die.net/man/2/getcwd> function.
584  
585 Exceptions:
586  
587 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.
588  
589 =head2 getdcwd
590  
591 C<static method getdcwd : string ($drive : int);>
592  
593 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.
594  
595 Exceptions:
596  
597 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.
598  
599 =head2 realpath
600  
601 C<static method realpath : mutable string ($path : string, $resolved_path : mutable string);>
602  
603 Calls the L<realpath|https://linux.die.net/man/3/realpath> function and return its return value.
604  
605 Exceptions:
606  
607 $path must be defined. Otherwise an exception is thrown.
608  
609 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.
610  
611 =head2 chdir
612  
613 C<static method chdir : int ($path : string);>
614  
615 Calls the L<chdir|https://linux.die.net/man/2/chdir> function and return its return value.
616  
617 Exceptions:
618  
619 $path must be defined. Otherwise an exception is thrown.
620  
621 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.
622  
623 =head2 chmod
624  
625 C<static method chmod : int ($path : string, $mode :int);>
626  
627 Calls the L<chmod|https://linux.die.net/man/2/chmod> function and return its return value.
628  
629 See L<Sys::IO::Constant|SPVM::Sys::IO::Constant> about constant values given to the mode $mode.
630  
631 Exceptions:
632  
633 $path must be defined. Otherwise an exception is thrown.
634  
635 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.
636  
637 =head2 chown
638  
639 C<static method chown : int ($path : string, $owner : int, $group : int);>
640  
641 Calls the L<chown|https://linux.die.net/man/2/chown> and return its return value.
642  
643 Exceptions:
644  
645 $path must be defined. Otherwise an exception is thrown.
646  
647 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.
648  
649 =head2 symlink
650  
651 C<static method symlink : int ($old_path : string, $new_path : string);>
652  
653 Calls the L<symlink|https://linux.die.net/man/2/symlink> function and return its return value.
654  
655 Exceptions:
656  
657 $old_path must be defined. Otherwise an exception is thrown.
658  
659 $new_path must be defined. Otherwise an exception is thrown.
660  
661 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.
662  
663 =head2 readlink
664  
665 C<static method readlink : string ($path : string);>
666  
667 Returns a link text by using L<readlink|https://linux.die.net/man/2/readlink> function.
668  
669 Exceptions:
670  
671 $path must be defined. Otherwise an exception is thrown.
672  
673 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.
674  
675 =head2 opendir
676  
677 C<static method opendir : L<Sys::IO::DirStream|SPVM::Sys::IO::DirStream> ($dir : string);>
678  
679 Calls the L<opendir|https://linux.die.net/man/3/opendir> function and return its return value.
680  
681 Exceptions:
682  
683 $dir must be defined. Otherwise an exception is thrown.
684  
685 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.
686  
687 =head2 closedir
688  
689 C<static method closedir : int ($dirp : L<Sys::IO::DirStream|SPVM::Sys::IO::DirStream>);>
690  
691 Calls the L<closedir|https://linux.die.net/man/3/closedir> function and return its return value.
692  
693 Exceptions:
694  
695 $dirp must be defined. Otherwise an exception is thrown.
696  
697 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.
698  
699 =head2 readdir
700  
701 C<static method readdir : L<Sys::IO::Dirent|SPVM::Sys::IO::Dirent> ($dirp : L<Sys::IO::DirStream|SPVM::Sys::IO::DirStream>);>
702  
703 Calls the L<readdir|https://linux.die.net/man/3/readdir> function and return its return value.
704  
705 Exceptions:
706  
707 $dirp must be defined. Otherwise an exception is thrown.
708  
709 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.
710  
711 =head2 rewinddir
712  
713 C<static method rewinddir : void ($dirp : L<Sys::IO::DirStream|SPVM::Sys::IO::DirStream>);>
714  
715 Calls the L<rewinddir|https://linux.die.net/man/3/rewinddir> function.
716  
717 Exceptions:
718  
719 $dirp must be defined. Otherwise an exception is thrown.
720  
721 =head2 telldir
722  
723 C<static method telldir : long ($dirp : L<Sys::IO::DirStream|SPVM::Sys::IO::DirStream>);>
724  
725 Calls the L<telldir|https://linux.die.net/man/3/telldir> function and return its return value.
726  
727 Exceptions:
728  
729 $dirp must be defined. Otherwise an exception is thrown.
730  
731 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.
732  
733 =head2 seekdir
734  
735 C<static method seekdir : void ($dirp : L<Sys::IO::DirStream|SPVM::Sys::IO::DirStream>, $offset : long);>
736  
737 Calls the L<seekdir|https://linux.die.net/man/3/seekdir> function and return its return value.
738  
739 Exceptions:
740  
741 $dirp must be defined. Otherwise an exception is thrown.
742  
743 $offset must be less than or equal to 0.
744  
745 =head2 popen
746  
747 C<static method popen : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream> ($command : string, $type : string);>
748  
749 Calls the L<popen|https://linux.die.net/man/3/popen> function and returns its return value.
750  
751 L<Sys::IO::FileStream#opened_by_popen|SPVM::Sys::IO::FileStream/"opened_by_popen"> field is set to 1.
752  
753 Windows:
754  
755 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.
756  
757 Exceptions:
758  
759 $command must be defined. Otherwise an exception is thrown.
760  
761 $type must be defined. Otherwise an exception is thrown.
762  
763 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.
764  
765 L<Sys::IO::FileStream#opened_by_popen|SPVM::Sys::IO::FileStream/"opened_by_popen"> field is set to 1.
766  
767 Exceptions:
768  
769 =head2 pclose
770  
771 C<static method pclose : int ($stream : L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream>);>
772  
773 Calls the L<pclose|https://linux.die.net/man/3/pclose> function and returns its return value.
774  
775 Windows:
776  
777 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.
778  
779 Exceptions:
780  
781 $stream must be defined. Otherwise an exception is thrown.
782  
783 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.
784  
785 Exceptions:
786  
787 =head2 dup
788  
789 C<static method dup : int ($fd : int);>
790  
791 Calls the L<dup|https://linux.die.net/man/2/dup> function given the arguments, and return its return value.
792  
793 Exceptions:
794  
795 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.
796  
797 =head2 dup2
798  
799 C<static method dup2 : void ($fd : int, $fd_to : int);>
800  
801 Calls L<dup2|https://linux.die.net/man/2/dup2> function.
802  
803 Exceptions:
804  
805 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.
806  
807 =head2 pipepair
808  
809 C<static method pipepair : void ($fd1_ref : int*, $fd2_ref : int*, $non_blocking : int = 0);>
810  
811 Generates a pair of connected sockets or named pipes for bidirectional communication.
812  
813 On Unix-like systems, it uses the L<socketpair|https://linux.die.net/man/2/socketpair> function with TCP stream sockets.
814  
815 On Windows, it emulates the functionality using named pipes with securely generated unique names.
816  
817 Arguments:
818  
819 =over 4
820  
821 =item * $fd1_ref
822  
823 A reference to an integer where the read file descriptor will be stored.
824  
825 =item * $fd2_ref
826  
827 A reference to an integer where the write file descriptor will be stored.
828  
829 =item * $non_blocking
830  
831 If true, sets both file descriptors to non-blocking mode. The default is 0 (blocking mode).
832  
833 =back
834  
835 Exceptions:
836  
837 C<$fd1_ref> must be defined. Otherwise an exception is thrown.
838  
839 C<$fd2_ref> must be defined. Otherwise an exception is thrown.
840  
841 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.
842  
843 =head1 See Also
844  
845 =over 2
846  
847 =item * L<Sys|SPVM::Sys>
848  
849 =back
850  
851 =head1 Copyright & License
852  
853 Copyright (c) 2023 Yuki Kimoto
854  
855 MIT License