Sidef
view release on metacpan or search on metacpan
lib/Sidef/Sys/Sys.pod view on Meta::CPAN
Returns the priority (nice value) of a process, process group, or user. The which parameter specifies the type (0=process, 1=process group, 2=user), and who specifies the ID.
var priority = Sys.getpriority(0, 0) # Current process priority
=cut
=head2 getprotobyname
Sys.getprotobyname(name)
Returns protocol information for the specified protocol name (e.g., 'tcp', 'udp', 'icmp').
var proto = Sys.getprotobyname('tcp')
say proto{:proto} # Protocol number
=cut
=head2 getprotobynumber
Sys.getprotobynumber(num)
Returns protocol information for the specified protocol number.
var proto = Sys.getprotobynumber(6) # TCP
=cut
=head2 getprotoent
Sys.getprotoent
Returns the next protocol entry from the system protocols database. Returns nil when there are no more entries.
=cut
=head2 getpwent
Sys.getpwent
Returns the next user entry from the system password database. Returns nil when there are no more entries. Must be reset with setpwent() to iterate again.
Sys.setpwent
while (var user = Sys.getpwent) {
say user{:name}
}
=cut
=head2 getpwnam
Sys.getpwnam(name)
Returns user information for the specified username. Returns a hash containing name, passwd, uid, gid, gecos, dir, and shell.
var user = Sys.getpwnam('root')
say user{:uid}
say user{:dir}
=cut
=head2 getpwuid
Sys.getpwuid(uid)
Returns user information for the specified user ID (UID). Returns a hash containing name, passwd, uid, gid, gecos, dir, and shell.
var user = Sys.getpwuid(1000)
say user{:name}
=cut
=head2 getservbyname
Sys.getservbyname(name, proto)
Returns service information for the specified service name and protocol.
var service = Sys.getservbyname('http', 'tcp')
say service{:port} # 80
=cut
=head2 getservbyport
Sys.getservbyport(port, proto)
Returns service information for the specified port number and protocol.
var service = Sys.getservbyport(80, 'tcp')
say service{:name} # "http"
=cut
=head2 getservent
Sys.getservent
Returns the next service entry from the system services database. Returns nil when there are no more entries.
=cut
=head2 isweak
Sys.isweak(obj)
Returns true if the reference to the object is weak (will not prevent garbage collection), false otherwise.
var ref = \obj
say Sys.isweak(ref) # false
Sys.weaken(ref)
say Sys.isweak(ref) # true
=cut
=head2 kill
Sys.kill(signal, *list)
Sends the specified signal to the list of process IDs. Returns the number of processes successfully signaled. Signal can be a number or a name (e.g., 'TERM', 'KILL', 'HUP').
Sys.kill('TERM', 1234) # Terminate process 1234
Sys.kill(9, 1234, 5678) # Kill multiple processes
Sys.kill('HUP', Sys.getppid) # Send HUP to parent
=cut
=head2 nano_sleep
( run in 2.823 seconds using v1.01-cache-2.11-cpan-437f7b0c052 )