Name

SPVM::Sys - System Calls for File IO, Sockets, Time, Process, Signals, Users

Description

The Sys class of SPVM has methods to call system calls for file IO, sockets, user manipulation, process manipulation, and time.

Usage

use Sys;

Sys->mkdir("foo");

Sys->rmdir("foo");

my $path = Sys->env("PATH");

my $process_id = Sys->getpid;

Class Methods

env

static method env : string ($name : string);

Gets an environment variable with the name $name.

set_env

static method set_env : void ($name : string, $value : string);

Sets an environment variable with the name $name and the value $value.

If $value is undef or "", the environment variable is removed.

Exceptions:

This method calls the following methods, so exceptions thrown by these methods could be thrown.

osname

static method osname : string ()

Gets the OS name. This method corresponds to Perl's $^O.

  • linux

  • darwin

  • MSWin32

  • freebsd

  • openbsd

  • solaris

Excetpions:

If the OS name could not be determined, an exception is thrown.

A

static method A : double ($file : string);

Returns script start time minus file access time of the file $file, in days.

This method corresponds to Perl's -A.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

The exceptions thrown by he "stat" method could be thrown.

C

static method C : double ($file : string);

Returns script start time minus file inode change time of the file $file, in days.

This method corresponds to Perl's -C.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

The exceptions thrown by he "stat" method could be thrown.

M

static method M : double ($file : string);

Returns script start time minus file modification time of the file $file, in days.

This method corresponds to Perl's -M.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

The exceptions thrown by he "stat" method could be thrown.

O

static method O : int ($file : string);

If If the file doesn't exist or can't be examined(These checks are done by the "stat" method), returns 0 and errno is set to a positive value.

Othersize if the file $file is owned by real uid, returns 1, otherwise returns 0.

This method corresponds to Perl's -O.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

R

static method R : int ($file : string);

If If the file doesn't exist or can't be examined(These checks are done by the "stat" method), returns 0 and errno is set to a positive value.

Otherwise if the file $file is readable by real uid/gid, returns 1, otherwise returns 0.

This method corresponds to Perl's -R.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

S

static method S : int ($file : string);

If If the file doesn't exist or can't be examined(These checks are done by the "stat" method), returns 0 and errno is set to a positive value.

Otherwise if the file $file is a socket, returns 1, otherwise returns 0.

This method corresponds to Perl's -S.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

W

static method W : int ($file : string);

If If the file doesn't exist or can't be examined(These checks are done by the "stat" method), returns 0 and errno is set to a positive value.

Otherwise if the file $file is writable by real uid/gid, returns 1, otherwise returns 0.

This method corresponds to Perl's -W.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

X

static method X : int ($file : string);

If If the file doesn't exist or can't be examined(These checks are done by the "stat" method), returns 0 and errno is set to a positive value.

Otherwise if the file $file is executable by real uid/gid, returns 1, otherwise returns 0.

This method corresponds to Perl's -X.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

b

static method b : int ($file : string);

If If the file doesn't exist or can't be examined(These checks are done by the "stat" method), returns 0 and errno is set to a positive value.

Otherwise if the file $file is a block special file, returns 1, otherwise returns 0.

This method corresponds to Perl's -b.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

c

static method c : int ($file : string);

If If the file doesn't exist or can't be examined(These checks are done by the "stat" method), returns 0 and errno is set to a positive value.

Otherwise if the file $file is a character special file, returns 1, otherwise returns 0.

This method corresponds to Perl's -c.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

d

static method d : int ($file : string);

If If the file doesn't exist or can't be examined(These checks are done by the "stat" method), returns 0 and errno is set to a positive value.

Otherwise if the file $file is a directory, returns 1, otherwise returns 0.

This method corresponds to Perl's -d.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

e

static method e : int ($file : string);

If If the file doesn't exist or can't be examined(These checks are done by the "stat" method), returns 0 and errno is set to a positive value.

This method corresponds to Perl's -e.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

f

static method f : int ($file : string);

If If the file doesn't exist or can't be examined(These checks are done by the "stat" method), returns 0 and errno is set to a positive value.

Otherwise if the file $file is a plain file, returns 1, otherwise returns 0.

This method corresponds to Perl's -f.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

g

static method g : int ($file : string);

If If the file doesn't exist or can't be examined(These checks are done by the "stat" method), returns 0 and errno is set to a positive value.

Otherwise if the file $file has setgid bit set, returns 1, otherwise returns 0.

This method corresponds to Perl's -g.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

k

static method k : int ($file : string);

If If the file doesn't exist or can't be examined(These checks are done by the "stat" method), returns 0 and errno is set to a positive value.

Otherwise if the file $file has sticky bit set, returns 1, otherwise returns 0.

This method corresponds to Perl's -k.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

l

static method l : int ($file : string);

If If the file doesn't exist or can't be examined(These checks are done by the "lstat" method), returns 0 and errno is set to a positive value.

Otherwise if the file $file is a symbolic link (false if symlinks aren't supported by the file system), returns 1, otherwise returns 0.

This method corresponds to Perl's -l.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

o

static method o : int ($file : string);

If If the file doesn't exist or can't be examined(These checks are done by the "stat" method), returns 0 and errno is set to a positive value.

Otherwise if the file $file is owned by effective uid, returns 1, otherwise returns 0.

This method corresponds to Perl's -l.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

p

static method p : int ($file : string);

If If the file doesn't exist or can't be examined(These checks are done by the "stat" method), returns 0 and errno is set to a positive value.

Otherwise if the file $file is a named pipe (FIFO), or Filehandle is a pipe, returns 1, otherwise returns 0.

This method corresponds to Perl's -p.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

r

static method r : int ($file : string);

If If the file doesn't exist or can't be examined(These checks are done by the "stat" method), returns 0 and errno is set to a positive value.

Otherwise if the file $file is readable by effective uid/gid, returns 1, otherwise returns 0.

This method corresponds to Perl's -r.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

s

static method s : long ($file : string);

If the file $file has nonzero size, returns its size in bytes, otherwise returns 0.

This method corresponds to Perl's -s.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

The exceptions thrown by he "stat" method could be thrown.

u

static method u : int ($file : string);

If If the file doesn't exist or can't be examined(These checks are done by the "stat" method), returns 0 and errno is set to a positive value.

Otherwise if the file $file has setuid bit set, returns 1, otherwise returns 0.

This method corresponds to Perl's -u.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

w

static method w : int ($file : string);

If If the file doesn't exist or can't be examined(These checks are done by the "stat" method), returns 0 and errno is set to a positive value.

Otherwise if the file $file is writable by effective uid/gid, returns 1, otherwise returns 0.

This method corresponds to Perl's -u.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

x

static method x : int ($file : string);

If If the file doesn't exist or can't be examined(These checks are done by the "stat" method), returns 0 and errno is set to a positive value.

Otherwise if the file $file is executable by effective uid/gid, returns 1, otherwise returns 0.

This method corresponds to Perl's -x.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

z

static method z : int ($file : string);

If the file $file has zero size (is empty), returns 1, otherwise returns 0.

This method corresponds to Perl's -z.

Exceptions:

$file must be defined. Otherwise an exception is thrown.

The exceptions thrown by he "stat" method could be thrown.

time

static method time : long ();

Returns the current epoch time.

localtime

static method localtime : Sys::Time::Tm ($time : long);

Converts a time to a Sys::Time::Tm object, and returns it.

gmtime

static method gmtime : Sys::Time::Tm ($time : long);

Works just like "localtime", but the returned values are localized for the standard Greenwich time zone.

utime

static method utime : void ($atime : long, $mtime : long, $filename : string);

Changes the access time and the modification time of the inode specified by the file $filename given the access time $atime and the modification time $mtime.

If $atime < 0 and $mtime < 0, changes the access time and the modification time to the current time..

Exceptions:

Exceptions thrown by the utime method in the Sys::Time class could be thrown.

stat

static method stat : Sys::IO::Stat ($path : string);

Creates a Sys::IO::Stat object and calls the stat method in the Sys::IO::Stat class.

And returns the a Sys::IO::Stat object.

fstat

static method fstat : Sys::IO::Stat ($fd : int);

Creates a Sys::IO::Stat object and calls the fstat method in the Sys::IO::Stat class.

And returns the a Sys::IO::Stat object.

chdir

static method chdir : void ($path : string);

Changes the working directory to $path.

chmod

static method chmod : void ($mode :int, $path : string);

Changes the permissions of a file.

mkdir

static method mkdir : void ($path : string, $mode : int);

Creates the directory specified by $path and $mode.

umask

static method umask : int ($mode : int);

Sets the umask for the process to $mode and returns the previous value.

rmdir

static method rmdir : void ($path : string);

Deletes the directory specified by $path.

opendir

static method opendir : void ($dh_ref : Sys::IO::DirStream[], $dir : string);

Calls the opendir method in the Sys::Socket class.

The return value is set to $dh_ref->[0].

closedir

static method closedir : void ($dirp : Sys::IO::DirStream);

Calls the closedir method in the Sys::Socket class.

close

static method close : void ($stream : Sys::IO::FileStream);

Calls the fclose method in the Sys::Socket class.

If succedd, returns 1.

static method unlink : void ($pathname : string);

Deletes a file.

rename

static method rename : void ($oldpath : string, $newpath : string);

Changes the name of a file.

static method readlink : int ($file : string);

Returns the value of a symbolic link.

static method symlink : int ($oldpath : string, $newpath : string);

Creates a $newpath symbolically linked to $oldpath.

sleep

static method sleep : int ($seconds : int);

Causes the program to sleep for $seconds seconds.

ioctl

static method ioctl : int ($fd : int, $request : int, $request_arg_ref : object of byte[]|short[]|int[]|long[]|float[]|double[]|object = undef);

Windows:

Calls the ioctlsocket method in the Sys::Ioctl class and returns its return value.

OSs other than Windows:

Calls the ioctl method in the Sys::Ioctl class and returns its return value.

Excetpions:

Excetpions thrown by the ioctl method or the ioctlsocket method in the Sys::Ioctl class could be thrown.

select

static method select : int ($readfds : Sys::Select::Fd_set, $writefds : Sys::Select::Fd_set, $exceptfds : Sys::Select::Fd_set, $timeout : double = 0);

Calls the select method in the Sys::Select class and returns its return value.

If $timeout is greter than or equal to 0, it is converted to a Sys::Time::Timeval object. Otherwise it becomes undef.

$nfds is set to 1024.

bind

static method bind : void ($sockfd : int, $addr : Sys::Socket::Sockaddr);

The next argument $addrlen is set to the size of $addr.

Calls the bind method in the Sys::Socket class with $addrlen.

listen

static method listen : void ($sockfd : int, $backlog : int);

Calls the listen method in the Sys::Socket class.

accept

static method accept : Sys::Socket::Sockaddr ($new_sockfd_ref : int*, $sockfd : int);

The next argument $addrlen is set to 128.

Calls the accept method in the Sys::Socket class with $addrlen, and returns $addr.

The original return value is set to $$new_sockfd_ref.

connect

static method connect : void ($sockfd : int, $addr : Sys::Socket::Sockaddr);

The next argument $addrlen is set to the size of $addr.

Calls the connect method in the Sys::Socket class with $addrlen.

getpeername

static method getpeername : Sys::Socket::Sockaddr ($sockfd : int);

The next argument $addrlen is set to 128.

Calls the getpeername method in the Sys::Socket class.

The return valus is convert to a child Sys::Socket::Sockaddr object using to_family_sockaddr method in the Sys:Socket|SPVM::Sys::Socket class.

getsockname

static method getsockname : Sys::Socket::Sockaddr ($sockfd : int)

The next argument $addrlen is set to 128.

Calls the getsockname method in the Sys::Socket class.

The return valus is convert to a child Sys::Socket::Sockaddr object using to_family_sockaddr method in the Sys:Socket|SPVM::Sys::Socket class.

recv

static method recv : int ($sockfd : int, $buf : mutable string, $len : int, $flags : int, $buf_offset : int = 0);

Calls the recv method in the Sys::Socket class.

send

static method send : int ($sockfd : int, $buf : string, $flags : int, $addr : Sys::Socket::Sockaddr = undef, $len : int = -1, $buf_offset : int = 0)

If $addr is defined, calls the sendto method in the Sys::Socket class.

Otherwise calls the send method in the Sys::Socket class.

If $len is less than 0, The length of $buffer is set to $len.

shutdown

static method shutdown : void ($sockfd : int, $how : int);

Calls the shutdown method in the Sys::Socket class.

socket

static method socket : void ($sockfd_ref : int*, $domain : int, $type : int, $protocol : int);

Calls the socket method in the Sys::Socket class with $domain, $type, $protocal, and the return value is set to $$sockfd_ref.

socketpair

static method socketpair : void ($sock_fd1_ref : int*, $sock_fd2_ref : int*, $domain : int, $type : int, $protocol : int);

Creates a new int array with the length 2 for the next argument $pair.

Calls the socketpair method in the Sys::Socket class with $pair, and the $$sock_fd1_ref is set the first element of $pair, and the $$sock_fd2_ref is set the second element of $pair, nad

setsockopt

static method setsockopt : void ($sockfd : int, $level : int, $optname : int, $optval : object of string|Int);

If $optval is the Int type, a string for the next argument $optval is created by the length 4.

If $optval is the string type, a string that for the next argument $optval is created by the length of $optval.

Calls the getsockopt method in the Sys::Socket class with $optval and $optlen.

Exceptions:

$optval must be defined. Otherwise an exception is thrown.

The type of $optval must be Int or string. Otherwise an exception is thrown.

getsockopt

static method getsockopt : string ($sockfd : int, $level : int, $optname : int, $optlen : int = -1);

If $optlen is less than 0, it is set to 4.

A string for the next argument $optval is created by the length $optlen.

Calls the getsockopt method in the Sys::Socket class with $optval and $optlen, and $optval set by this method is returnd.

truncate

static method truncate : void ($fd : int, $legnth : long);

Calls the ftruncate method in the Sys::IO class.

sysread

static method sysread : int ($fd : int, $buf : mutable string, $count : int, $buf_offset : int = 0);

Calls the read method in the Sys::IO class.

syswrite

static method syswrite : int ($fd : int, $buf : string, $count : int = -1, $buf_offset : int = 0);

Calls the write method in the Sys::IO class.

eof

static method eof : int ($stream : Sys::IO::Stream);

Calls the feof method in the Sys::IO class.

fileno

static method fileno : int ($stream : Sys::IO::Stream);

Calls the fileno method in the Sys::IO class.

readline

static method readline : mutable string ($stream : Sys::IO::FileStream);

Calls the readline method in the Sys::IO class.

getc

static method getc : int ($stream : Sys::IO::FileStream);

Calls the getc method in the Sys::IO class.

flock

static method flock : void ($fd : int, $operation : int);

Calls the flock method in the Sys::IO class.

print

static method print : void ($stream : Sys::IO::FileStream, $string : string);

Calls the fwrite method in the Sys::IO class given the length of $string.

printf

static method printf : void ($stream, $format : string, $args : object[])

Calls the "print" method after creating formatted string given $stream and $args using the sprintf method in the Format class.

read

static method read : int ($stream : Sys::IO::FileStream, $buf : mutable string, $count : int, $buf_offset : int = 0);

Calls the fread method in the Sys::IO class.

rewinddir

static method rewinddir : void ($dirp : Sys::IO::DirStream);

Calls the rewinddir method in the Sys::IO class.

readdir

static method readdir : Sys::IO::Dirent ($dirp : Sys::IO::DirStream);

Calls the readdir method in the Sys::IO class.

seek

static method seek : void ($stream : Sys::IO::FileStream, $offset : long, $whence : int);

Calls the fseek method in the Sys::IO class.

sysseek

static method sysseek : long ($fd : int, $offset : long, $whence : int);

Calls the lseek method in the Sys::IO class.

tell

static method tell : long ($stream : Sys::IO::FileStream);

Calls the ftell method in the Sys::IO class.

telldir

static method telldir : long ($dirp : Sys::IO::DirStream);

Calls the telldir method in the Sys::IO class.

lstat

static method lstat : Sys::IO::Stat ($path : string);

Creates a Sys::IO::Stat object and calls the lstat method in the Sys::IO::Stat class.

And returns the a Sys::IO::Stat object.

chown

static method chown : void ($owner : int, $group : int, $path : string);

Calls the chown method in the Sys::IO class.

fcntl

static method fcntl : int ($fd : int, $command : int, $command_arg : object of Int|Sys::IO::Flock|object = undef);

Calls the fcntl method in the Sys::IO class.

STDIN

static method STDIN : Sys::IO::FileStream ();

Returns the stdin opened by the SPVM language.

STDOUT

static method STDOUT : Sys::IO::FileStream ();

Returns the stdout opened by the SPVM language.

STDERR

static method STDERR : Sys::IO::FileStream ();

Returns the stderr opened by the SPVM language.

open

static method open : void ($stream_ref : Sys::IO::FileStream[], $open_mode : string, $file_name : string);

$open_mode is replaced by the following logic.

if ($open_mode eq "<") {
  $open_mode = "rb";
}
elsif ($open_mode eq ">") {
  $open_mode = "wb";
}
elsif ($open_mode eq ">>") {
  $open_mode = "wa";
}
elsif ($open_mode eq "+<") {
  $open_mode = "r+b";
}
elsif ($open_mode eq "+>") {
  $open_mode = "w+b";
}
elsif ($open_mode eq "+>>") {
  $open_mode = "a+b";
}

Calls the fopen method in the Sys::IO class.

The return values is set to $stream_ref->[0].

Exceptions:

$stream_ref must be defined. Otherwise an exception is thrown.

The length of \$stream_ref must be equal to 1. Otherwise an exception is thrown.

fdopen

static method fdopen : void ($stream_ref : Sys::IO::FileStream[], $open_mode : string, $fd : int);

$open_mode is replaced by the following logic.

if ($open_mode eq "<") {
  $open_mode = "rb";
}
elsif ($open_mode eq ">") {
  $open_mode = "wb";
}
elsif ($open_mode eq ">>") {
  $open_mode = "wa";
}
elsif ($open_mode eq "+<") {
  $open_mode = "r+b";
}
elsif ($open_mode eq "+>") {
  $open_mode = "w+b";
}
elsif ($open_mode eq "+>>") {
  $open_mode = "a+b";
}

Calls the fdopen method in the Sys::IO class.

The return values is set to $stream_ref->[0].

Exceptions:

$stream_ref must be defined. Otherwise an exception is thrown.

The length of \$stream_ref must be equal to 1. Otherwise an exception is thrown.

sysopen

static method sysopen : void ($fd_ref : int*, $path : string, $flags : int, $mode : int = 0);

Calls the open method in the Sys::IO class.

say

static method say : void ($stream : Sys::IO::FileStream, $string : string);

Calls the "print" method adding \n to the end of $string.

signal

static method signal : void ($signum : int, $handler_name : string);

Sets a signal handler with its name $handler_name for the given signal number $signum.

If $handler_name is "DEFAULT", the signal handler is "SIG_DFL".

If $handler_name is "IGNORE", the signal handler is "SIG_IGN".

See the signal method in the Sys::Signal class in detail.

Exceptions:

If $handler_name is not available, an exception is thrown.

The exceptions thrown by the signal method in the Sys::Signal class could be thrown.

kill

static method kill : void ($sig : int, $pid : int);

Send a signal $sig to the process whose process ID is $pid.

See the kill method in the Sys::Signal class in detail.

In Windows, see the raise method in the Sys::Signal class in detail.

Exceptions:

The exceptions thrown by the alarm method in the Sys::Signal class could be thrown.

The exceptions thrown by the raise method in the Sys::Signal class could be thrown.

$pid must be equal to Sys->process_id in Windows. Otherwise an exception is thrown.

alarm

static method alarm : int ($seconds : int);

Sets a alarm signal sent after seconds $seconds.

See alarm method in the Sys::Signal class in detail.

Exceptions:

The exceptions thrown by the alarm method in the Sys::Signal class could be thrown.

popen

static method popen : void ($stream_ref : Sys::IO::FileStream[], $open_mode : string, $command : string);

pclose

static method pclose : void ($stream : Sys::IO::FileStream);

fork

static method fork : int ();

Forks the process by calling the fork method in the Sys::Process method.

It returns the child process ID to the parent process, or returns 0 to the child process.

Excetpions:

Exceptions thrown by the fork method in the Sys::Process method could be thrown.

getpriority

static method getpriority : int ($which : int, $who : int);

Return the scheduling priority of the process, process group, or user, as indicated by $which and $who is obtained.

Excetpions:

Exceptions thrown by the getpriority method in the Sys::Process method could be thrown.

setpriority

static method setpriority : void ($which : int, $who : int, $prio : int)

Sets the scheduling priority of the process, process group, or user, as indicated by $which and $who is obtained.

Excetpions:

Exceptions thrown by the setpriority method in the Sys::Process method could be thrown.

sleep

static method sleep : int ($seconds : int);

Sleeps for the seconds $seconds.

wait

static method wait : int ($wstatus_ref : int*);

Waits for state changes in a child of the calling process, and returns a process ID whose state is changed.

The status about the child whose state has changed is set to $wstatus_ref.

The following method in the Sys::Process class checks the value of $wstatus_ref.

Excetpions:

Exceptions thrown by the wait method in the Sys::Process method could be thrown.

waitpid

static method waitpid : int ($pid : in, $options : int, $wstatus_ref : int*);

Same as the "wait" method, but can give the process ID $pid and the options $options.

See Sys::Process::Constant about constant values given to $options.

Excetpions:

Exceptions thrown by the waitpid method in the Sys::Process method could be thrown.

system

static method system : int ($command : string);

Executes a command specified in command using shell and return the "wait" status.

exit

static method exit : void ($status : int);

Terminates the calling process immediately with the status $status.

pipe

static method pipe : void ($read_fd_ref : int*, $write_fd_ref : int*);

Opens a pair of pipes.

If the system supports FD_CLOEXEC, this flag is set to $read_fd_ref and $write_fd_ref using "fcntl".

getpgrp

static method getpgrp : int ($pid : int);

Gets the process group number given the process ID $pid of the running this program.

setpgrp

static method setpgrp : void ($pid : int, $pgid : int);

Sets the process group number $pgid given the process ID $pid of the running this program.

process_id

static method process_id : int ();

Gets the process number of the running this program.

getppid

static method getppid : int ();

Returns the process ID of the parent of the calling process.

exec

static method exec : void ($program : string, $args : string[] = undef);

Executes the program $program with the arguments $args without using shell and never returns.

Examples:

Sys->exec("/bin/echo", ["-n", "Hello"]);

real_user_id

static method real_user_id : int ();

Gets the real user ID of this process.

effective_user_id

static method effective_user_id : int ();

Gets the effective user ID of this process.

real_group_id

static method real_group_id : int ();

Gets the real group ID of this process.

effective_group_id

static method effective_group_id : int ();

Gets the effective group ID of this process.

set_real_user_id

static method set_real_user_id : int ($uid : int);

Sets the real user ID of this process.

set_effective_user_id

static method set_effective_user_id : int ($euid : int);

Sets the effective user ID of this process.

set_real_group_id

static method set_real_group_id : int ($gid : int);

Sets the real group ID of this process.

set_effective_group_id

static method set_effective_group_id : int ($egid : int);

Sets the effective group ID of this process.

setpwent

static method setpwent : void ();

Rewinds to the beginning of the password database.

endpwent

static method endpwent : void ();

Closes the password database after all processing has been performed.

getpwent

static method getpwent : Sys::User::Passwd ();

Gets a next password entry.

setgrent

static method setgrent : void ();

Rewinds to the beginning of the group database.

endgrent

static method endgrent : void ();

Closes the group database after all processing has been performed.

getgrent

static method getgrent : Sys::User::Group ();

Gets a next group entry.

getgroups

static method getgroups : int[] ();

Returns the supplementary group IDs of the calling process.

setgroups

static method setgroups : void ($groups : int[]);

Sets the supplementary group IDs for the calling process.

getpwuid

static method getpwuid : Sys::User::Passwd ($id : int);

Searches a password entry given The user ID $id. If found, returns the password entry, otherwise return undef.

getpwnam

static method getpwnam : Sys::User::Passwd ($name : string);

Searches a password entry given The user name $name. If found, returns the password entry, otherwise return undef.

getgrgid

static method getgrgid : Sys::User::Group ($id : int);

Searches a group entry given The group ID $id. If found, returns the group entry, otherwise return undef.

getgrnam

static method getgrnam : Sys::User::Group ($name : string);

Searches a group entry given The group name $name. If found, returns the group entry, otherwise return undef.

Modules

See Also

Repository

SPVM::Sys - Github

Author

Yuki Kimoto(https://github.com/yuki-kimoto)

Contributors

Gabor Szabo(https://github.com/szabgab)

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License