M_system(3fm) - [M_system::INTRO] Fortran interface to C system interface (LICENSE:PD)
Synopsis
Description
Environment Access
File System
Time
Stream Io
Random Numbers
C Error Information
Queries
System Commands
Future Directions
See Also
Public objects:
! ENVIRONMENT use M_system, only : set_environment_variable, system_unsetenv, & system_putenv, system_getenvuse M_system, only : system_intenv, system_readenv, system_clearenv ! FILE SYSTEM use M_system, only : system_getcwd, system_link, & system_mkfifo, system_remove, system_rename, & system_umask, system_unlink, fileglob, & system_rmdir, system_chdir, system_mkdir, & system_stat, system_isdir, system_islnk, system_isreg, & system_isblk, system_ischr, system_isfifo, & system_realpath, & system_access, & system_utime, system_time, system_sleep, & system_cmd, & system_issock, system_perm, & system_stat_print, & epoch_to_calendar, & system_dir, & system_memcpy
!x!use M_system, only : system_getc, system_putc ! ERROR PROCESSING use M_system, only : system_errno, system_perror ! INFO use M_system, only : system_getegid, system_geteuid, system_getgid, & system_gethostname, system_getpid, system_getppid, system_setsid, & system_getsid, system_getuid, system_uname ! SIGNALS use M_system, only : system_kill,system_signal ! RANDOM NUMBERS use M_system, only : system_rand, system_srand ! PROCESS INFORMATION use M_system, only : system_cpu_time
M_system(3fm) is a collection of Fortran procedures that call C or a C wrapper using the ISO_C_BINDING interface to access system calls. System calls are a special set of functions used by programs to communicate directly with an operating system.Generally, system calls are slower than normal function calls because when you make a call control is relinquished to the operating system to perform the system call. In addition, depending on the nature of the system call, your program may be blocked by the OS until the system call has finished, thus making the execution time of your program even longer.
One rule-of-thumb that should always be followed when calling a system call -- Always check the return value.
o system_putenv(3f): call putenv(3c) o system_getenv(3f): function call to get_environment_variable(3f) o system_unsetenv(3f): call unsetenv(3c) to remove variable from environment o set_environment_variable(3f): set environment variable by calling setenv(3c) o system_initenv(3f): initialize environment table for reading o system_readenv(3f): read next entry from environment table o system_clearenv(3f): emulate clearenv(3c) to clear environment
o system_chdir(3f): call chdir(3c) to change current directory of a process o system_getcwd(3f): call getcwd(3c) to get pathname of current working directory o system_stat(3f): determine system information of file by name o system_stat_print(3f): print system information of filename o epoch_to_calendar(3f): convert epoch time in seconds to calendar string o system_perm(3f): create string representing file permission and type o system_access(3f): determine filename access or existence o system_isdir(3f): determine if filename is a directory o system_islnk(3f): determine if filename is a link o system_isreg(3f): determine if filename is a regular file o system_isblk(3f): determine if filename is a block device o system_ischr(3f): determine if filename is a character device o system_isfifo(3f): determine if filename is a fifo - named pipe o system_issock(3f): determine if filename is a socket o system_realpath(3f): resolve a pathname o system_chmod(3f): call chmod(3c) to set file permission mode o system_chown(3f): call chown(3c) to set file owner o system_getumask(3f): call umask(3c) to get process permission mask o system_setumask(3f): call umask(3c) to set process permission mask o system_mkdir(3f): call mkdir(3c) to create empty directory o system_mkfifo(3f): call mkfifo(3c) to create a special FIFO file o system_link(3f): call link(3c) to create a filename link o system_rename(3f): call rename(3c) to change filename o system_remove(3f): call remove(3c) to remove file o system_rmdir(3f): call rmdir(3c) to remove empty directory o system_unlink(3f): call unlink(3c) to remove a link to a file o system_utime(3f): call utime(3c) to set file access and modification times o system_dir(3f): read name of files in specified directory matching a wildcard string o fileglob(3f): Returns list of files using a file globbing pattern
o system_time(3f): call time(3c) o system_sleep(3f): pause specified amount of time
o system_getc(3f): get a character from stdin o system_putc(3f): put a character on stdout
o system_srand(3f): call srand(3c) o system_rand(3f): call rand(3c)
o system_errno(3f): return errno(3c) o system_perror(3f): call perror(3c) to display last C error message
o system_geteuid(3f): call geteuid(3c) o system_getuid(3f): call getuid(3c) o system_getegid(3f): call getegid(3c) o system_getgid(3f): call getgid(3c) o system_getpid(3f): call getpid(3c) o system_getppid(3f): call getppid(3c) o system_gethostname(3f): get name of current host o system_uname(3f): call my_uname(3c) which calls uname(3c) o system_getlogin(3f): get login name o system_getpwuid(3f): get login name associated with given UID o system_getgrgid(3f): get group name associated with given GID o system_cpu_time(3f) : get processor time in seconds using times(3c)
o system_cmd(3f): call execute_command_line(3f) outputting messages
A good idea of what system routines are commonly required is to refer to the POSIX binding standards. (Note: IEEE 1003.9-1992 was withdrawn 6 February 2003.) The IEEE standard covering Fortran 77 POSIX bindings is available online, though currently (unfortunately) only from locations with appropriate subscriptions to the IEEE server (e.g., many university networks). For those who do have such access, the link is: POSIX Fortran 77 Language Interfaces (IEEE Std 1003.9-1992) (pdf)
Some vendors provide their own way to access POSIX functions and make those available as modules; for instance ...
o the IFPORT module of Intel o or the f90_* modules of NAG. o There are also other compiler-independent efforts to make the POSIX procedures accessible from Fortran...
o Posix90 (doc), o flib.a platform/files and directories, o fortranposix.
Nemo Release 3.1 | M_system (3m_system) | March 07, 2025 |