Given a pathname fora file, open() returns a file descriptor, a small, nonnegative integer forusein subsequent systemcalls (read(2), write(2), lseek(2), fcntl(2), etc.). The file descriptor returned by a successful call will be the lowest-numbered file descriptor not currently openforthe process.
See the L<open|https://linux.die.net/man/2/open> function in Linux.
See L<Sys::IO::Constant|SPVM::Sys::IO::Constant> about the constant value forthe flags and the mode.
The lseek() function repositions the offset of the openfile associated withthe file descriptor fd to the argument offset according to the directive whence as follows:
See the L<lseek|https://linux.die.net/man/2/lseek> function in Linux.
See L<Sys::IO::Constant|SPVM::Sys::IO::Constant> about the constant value forthe whence.
=head2 close
static method close: int($fd: int);
close() closes a file descriptor, so that it nolonger refers to any file and may be reused. Any record locks (see fcntl(2)) held on the file it was associated with, and owned by the process, are removed (regardless of the file descriptor that was used to obtain the lock).
See the L<close|https://linux.die.net/man/2/close> function in Linux.
The fdopen() function associates a stream withthe existing file descriptor, fd. The mode of the stream (one of the values"r", "r+", "w", "w+", "a", "a+") must be compatible withthe mode of the file descriptor. The file position indicator of the new stream is set to that belonging to fd, and the error and end-of-file indicators are cleared. Modes "w"or "w+"donot cause truncation of the file. The file descriptor is not dup'ed, and will be closed whenthe stream created by fdopen() is closed. The result of applying fdopen() to a shared memory object is undefined.
See the L<fdopen|https://linux.die.net/man/3/fdopen> function in Linux.
The returnvalue is a L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream> object.
The function fread() reads nmemb elements of data, eachsize bytes long, from the stream pointed to by stream, storing them at the location givenby ptr + ptr_offset.
See the L<fread|https://linux.die.net/man/3/fread> function in Linux.
The function feof() tests the end-of-file indicator forthe stream pointed to by stream, returning nonzero ifit is set. The end-of-file indicator can only be cleared by the function clearerr().
See the L<feof|https://linux.die.net/man/3/feof> function in Linux.
The file stream is a L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream> object.
The function ferror() tests the error indicator forthe stream pointed to by stream, returning nonzero ifit is set. The error indicator can only be resetby the clearerr() function.
See the L<ferror|https://linux.die.net/man/3/ferror> function in Linux.
The file stream is a L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream> object.
fgets() reads in at most one less than size characters from stream and stores them into the buf pointed to by s + s_offset. Reading stops afteran EOF or a newline. If a newline is read, it is stored into the buf. A terminating null byte (aq\0aq) is stored afterthe lastcharacter in the buf.
See the L<fgets|https://linux.die.net/man/3/fgets> function in Linux.
The function fwrite() writes nmemb elements of data, eachsize bytes long, to the stream pointed to by stream, obtaining them from the location givenby ptr + ptr_offset.
See the L<fread|https://linux.die.net/man/3/fwrite> function in Linux.
The file stream is a L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream> object.
The fseek() function sets the file position indicator forthe stream pointed to by stream. The new position, measured in bytes, is obtained by adding offset bytes to the position specified by whence. If whence is set to SEEK_SET, SEEK_CUR, or SEEK_END, the offset is relative to the start of the file, the current position indicator, or end-of-file, respectively. A successful call to the fseek() function clears the end-of-file indicator forthe stream and undoes any effects of the ungetc(3) function on the same stream.
See the L<fseek|https://linux.die.net/man/3/fseek> function in Linux.
The file stream is a L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream> object.
See L<Sys::IO::Constant|SPVM::Sys::IO::Constant> about the constant value forthe whence.
=head2 ftell
static method ftell : long ($stream: Sys::IO::FileStream);
The ftell() function obtains the current value of the file position indicator forthe stream pointed to by stream.
See the L<ftell|https://linux.die.net/man/3/ftell> function in Linux.
The file stream is a L<Sys::IO::FileStream|SPVM::Sys::IO::FileStream> object.
For output streams, fflush() forces a writeof all user-space bufed data forthe givenoutput or update stream via the stream's underlying writefunction. For input streams, fflush() discards any bufed data that hasbeen fetched from the underlying file, but hasnot been consumed by the application. The openstatus of the stream is unaffected.
See the L<fflush|https://linux.die.net/man/3/fflush> function in Linux.
mkdir() attempts to create a directory named pathname.
See the L<mkdir|https://linux.die.net/man/2/mkdir> function in Linux.
See L<Sys::IO::Constant|SPVM::Sys::IO::Constant> about the constant value forthe mode.
=head2 umask
static method umask: int($mode: int);
umask() sets the calling process's file mode creation mask (umask) to mask & 0777 (i.e., only the file permission bits of mask are used), and returns the previous value of the mask.
See the L<umask|https://linux.die.net/man/2/umask> function in Linux.
=head2 rmdir
static method rmdir: int($path: string);
rmdir() deletes a directory, which must be empty.
See the L<rmdir|https://linux.die.net/man/2/rmdir> function in Linux.
=head2 unlink
static method unlink: int($pathname: string);
unlink() deletes a name from the file system. If that name was the lastlinkto a file and noprocesses have the file openthe file is deleted and the space it was using is made available forreuse.
See the L<unlink|https://linux.die.net/man/2/unlink> function in Linux.
rename() renames a file, moving it between directories ifrequired. Any other hard links to the file (as created using link(2)) are unaffected. Open file descriptors foroldpath are also unaffected.
See the L<rename|https://linux.die.net/man/2/rename> function in Linux.
realpath() expands all symbolic links and resolves references to /./, /../ and extra '/'characters in the null-terminated string named by path to produce a canonicalized absolute pathname. The resulting pathname is stored as a null-terminated string, up to a maximum of PATH_MAX bytes, in the buf pointed to by resolved_path. The resulting path will have nosymbolic link, /./ or /../ components.
See the L<realpath|https://linux.die.net/man/3/realpath> function in Linux.
readlink() places the contents of the symbolic linkpath in the buf buf, which hassize bufsiz. readlink() does not append a null byte to buf. It will truncatethe contents (to a lengthof bufsiz characters), in case the buf is too small to hold all of the contents.
See the L<readlink|https://linux.die.net/man/2/readlink> function in Linux.
The opendir() function opens a directory stream corresponding to the directory name, and returns a pointer to the directory stream. The stream is positioned at the first entry in the directory.
See the L<opendir|https://linux.die.net/man/3/opendir> function in Linux.
The returnvalue is a L<Sys::IO::DirStream|SPVM::Sys::IO::DirStream> object.
The closedir() function closes the directory stream associated withdirp. A successful call to closedir() also closes the underlying file descriptor associated withdirp. The directory stream descriptor dirp is not available afterthis call.
See the L<closedir|https://linux.die.net/man/3/closedir> function in Linux.
The directory stream is a L<Sys::IO::DirStream|SPVM::Sys::IO::DirStream> object.
The readdir() function returns a pointer to a dirent structure representing the nextdirectory entry in the directory stream pointed to by dirp. It returns NULL on reaching the end of the directory stream or ifan error occurred.
See the L<readdir|https://linux.die.net/man/3/readdir> function in Linux.
The directory stream is a L<Sys::IO::DirStream|SPVM::Sys::IO::DirStream> object.
The returnvalue is a L<Sys::IO::Dirent|SPVM::Sys::IO::Dirent> object.
The seekdir() function sets the location in the directory stream from which the nextreaddir(2) call will start. seekdir() should be used withan offset returned by telldir(3).
See the L<seekdir|https://linux.die.net/man/3/seekdir> function in Linux.
The directory stream is a L<Sys::IO::DirStream|SPVM::Sys::IO::DirStream> object.
The utime() systemcall changes the access and modification timesof the inode specified by filename to the actime and modtime fields of timesrespectively.
See the L<utime|https://linux.die.net/man/2/utime> function in Linux.
The buf is a L<Sys::IO::Utimbuf|SPVM::Sys::IO::Utimbuf> object.
These functions returninformation about a file. No permissions are required on the file itself, but-in the case of stat() and lstat() - execute (search) permission is required on all of the directories in path that lead to the file.
stat() stats the file pointed to by path and fills in buf.
See the L<stat|https://linux.die.net/man/2/stat> function in Linux.
The statis L<Sys::IO::Stat|SPVM::Sys::IO::Stat> object.
These functions returninformation about a file. No permissions are required on the file itself, but-in the case of stat() and lstat() - execute (search) permission is required on all of the directories in path that lead to the file.
lstat() is identical to stat(), except that ifpath is a symbolic link, then the linkitself is stat-ed, not the file that it refers to.
See the L<lstat|https://linux.die.net/man/2/lstat> function in Linux.
The statis L<Sys::IO::Stat|SPVM::Sys::IO::Stat> object.
ungetc() pushes c back to stream, cast to unsigned char, where it is available forsubsequent readoperations. Pushed-back characters will be returned in reverseorder; only one pushback is guaranteed.
See L<ungetc(3) - Linux man page|https://linux.die.net/man/3/ungetc> in Linux.
=head2 fsync
static method fsync : int($fd: int);
fsync() transfers ("flushes") all modified in-core data of (i.e., modified buffer cache pages for) the file referred to by the file descriptor fd to the disk device (or other permanent storage device) so that all changed information can be retrieved even afterthe systemcrashed or was rebooted.
See L<fsync(2) - Linux man page|https://linux.die.net/man/2/fsync> in Linux.