The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Name

SPVM::Sys - System Calls for File IO, User, Process, Signal, Socket

Caution

The Sys module and the system modules will be highly changed without warnings.

SPVM itself is yet experimental release.

Description

Sys is the class for system calls such as file IO, user manipulation, process, socket, time,

Modules

The list of the modules that provide system calls.

Sys::IO

Sys::IO - File I/O

Sys::Ioctl

Sys::Ioctl - The ioctl function

Sys::Socket

Sys::Socket - Socket

Sys::Select

Sys::Select - The select function

Sys::Poll

Sys::Poll - The poll function.

Sys::Process

Sys::Process - Process Manipulation

Sys::Signal

Sys::Signal - Signal

Sys::Time

Sys::Time - Time Manipulation

Sys::User

Sys::User - User Manipulation

Sys::FiteTest

Sys::FiteTest - File Tests

Class Methods

getenv

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

The getenv() function searches the environment list to find the environment variable name, and returns a pointer to the corresponding value string.

See the detail of the getenv function in the case of Linux.

setenv

  static method setenv : int ($name : string, $value : string, $overwrite : int);

The setenv() function adds the variable name to the environment with the value value, if name does not already exist. If name does exist in the environment, then its value is changed to value if overwrite is nonzero; if overwrite is zero, then the value of name is not changed. This function makes copies of the strings pointed to by name and value (by contrast with putenv(3)).

See the detail of the setenv function in the case of Linux.

unsetenv

  static method unsetenv : int ($name : string);

The unsetenv() function deletes the variable name from the environment. If name does not exist in the environment, then the function succeeds, and the environment is unchanged.

See the detail of the unsetenv function in the case of Linux.

defined

  static method defined : int ($macro_name : string, $value = undef : object of Int|Long|Double);

Checks if the macro in C langauge is defined. If the macro is defined, returns 1. Otherwise returns 0.

If $value is specifed and $macro_name is defined, the macro value converted to the given type is set to $value.

Supports the following macro names.

  • __GNUC__

  • __clang__

  • __BORLANDC__

  • __INTEL_COMPILER

  • __unix

  • __unix__

  • __linux

  • __linux__

  • __FreeBSD__

  • __NetBSD__

  • __OpenBSD__

  • _WIN32

  • WIN32

  • _WIN64

  • _WINDOWS

  • _CONSOLE

  • WINVER

  • _WIN32_WINDOWS

  • _WIN32_WINNT

  • WINCEOSVER

  • __CYGWIN__

  • __CYGWIN32__

  • __MINGW32__

  • __MINGW64__

  • __APPLE__

  • __MACH__

  • __sun

  • __solaris

get_osname

  static method get_osname : string ()

Gets the OS name(Perl's $^O ). The list of the OS names are described at PLATFORMS - perlport.

The get_osname in the Sys class supports the following os names.

  • linux

  • darwin

  • MSWin32

  • freebsd

  • openbsd

  • solaris

Author

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

Contributors

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

Repository

SPVM::Sys - Github

Copyright & License

Copyright Yuki Kimoto 2022-2022, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.