M_system(3fm) - [M_system::INTRO] Fortran interface to C system interface
(LICENSE:PD)
Public objects:
! ENVIRONMENT
use M_system, only : set_environment_variable, system_unsetenv, &
system_putenv, system_getenv
use 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_system, &
system_issock, system_perm, &
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_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_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_system(3f): call execute_command_line(3c) 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.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=mode_t), | public, | bind(c,name="0") | :: | ACCESSPERMS | |||
integer(kind=mode_t), | public, | bind(c,name="0") | :: | DEFFILEMODE | |||
integer(kind=c_int), | public, | parameter | :: | F_OK | = | 0 | |
integer(kind=mode_t), | public, | bind(c,name="0") | :: | RWX_G | |||
integer(kind=mode_t), | public, | bind(c,name="0") | :: | RWX_O | |||
integer(kind=mode_t), | public, | bind(c,name="0") | :: | RWX_U | |||
integer(kind=mode_t), | public, | bind(c,name="0") | :: | R_GRP | |||
integer(kind=c_int), | public, | parameter | :: | R_OK | = | 4 | |
integer(kind=mode_t), | public, | bind(c,name="0") | :: | R_OTH | |||
integer(kind=mode_t), | public, | bind(c,name="0") | :: | R_USR | |||
integer(kind=mode_t), | public, | bind(c,name="0") | :: | W_GRP | |||
integer(kind=c_int), | public, | parameter | :: | W_OK | = | 2 | |
integer(kind=mode_t), | public, | bind(c,name="0") | :: | W_OTH | |||
integer(kind=mode_t), | public, | bind(c,name="0") | :: | W_USR | |||
integer(kind=mode_t), | public, | bind(c,name="0") | :: | X_GRP | |||
integer(kind=c_int), | public, | parameter | :: | X_OK | = | 1 | |
integer(kind=mode_t), | public, | bind(c,name="0") | :: | X_OTH | |||
integer(kind=mode_t), | public, | bind(c,name="0") | :: | X_USR | |||
integer, | public, | parameter | :: | mode_t | = | int32 |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=c_int), | value | :: | seconds |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=C_SIZE_T), | value | :: | nelem | |||
integer(kind=C_SIZE_T), | value | :: | elsize |
system_errno(3f) - [M_system:ERROR_PROCESSING] C error return value
(LICENSE:PD)
integer(kind=c_int) function system_errno()
Many C routines return an error code which can be queried by errno.
The M_system(3fm) is primarily composed of Fortran routines that
call C routines. In the cases where an error code is returned vi
system_errno(3f) these routines will indicate it.
Sample program:
program demo_system_errno
use M_system, only : system_errno, system_unlink, system_perror
implicit none
integer :: stat
stat=system_unlink('not there/OR/anywhere')
if(stat.ne.0)then
write(*,*)'err=',system_errno()
call system_perror('*demo_system_errno*')
endif
end program demo_system_errno
Typical Results:
err= 2
*demo_system_errno*: No such file or directory
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=C_INTPTR_T), | value | :: | ptr |
system_getegid(3f) - [M_system:QUERY] get the effective group ID (GID) of
current process from Fortran by calling getegid(3c)
(LICENSE:PD)
integer(kind=c_int) function system_getegid()
The getegid() function returns the effective group ID of the
calling process.
The getegid() should always be successful and no return value is
reserved to indicate an error.
No errors are defined.
getegid(), system_geteuid(), getuid(), setegid(), seteuid(), setgid(),
setregid(), setreuid(), setuid()
Get group ID from Fortran
program demo_system_getegid
use M_system, only : system_getegid
implicit none
write(*,*)'GID=',system_getegid()
end program demo_system_getegid
system_geteuid(3f) - [M_system:QUERY] get effective UID of current
process from Fortran by calling geteuid(3c)
(LICENSE:PD)
integer(kind=c_int) function system_geteuid()
The system_geteuid(3f) function shall return the effective user
ID of the calling process. The geteuid() function shall always be
successful and no return value is reserved to indicate the error.
Get group ID from Fortran:
program demo_system_geteuid
use M_system, only : system_geteuid
implicit none
write(*,*)'EFFECTIVE UID=',system_geteuid()
end program demo_system_geteuid
system_getgid(3f) - [M_system:QUERY] get the real group ID (GID) of
current process from Fortran by calling getgid(3c)
(LICENSE:PD)
integer(kind=c_int) function system_getgid()
The getgid() function returns the real group ID of the calling
process.
The getgid() should always be successful and no return value is
reserved to indicate an error.
No errors are defined.
getegid(), system_geteuid(), getuid(), setegid(), seteuid(), setgid(),
setregid(), setreuid(), setuid()
Get group ID from Fortran
program demo_system_getgid
use M_system, only : system_getgid
implicit none
write(*,*)'GID=',system_getgid()
end program demo_system_getgid
system_getpid(3f) - [M_system:QUERY] get PID (process ID) of current
process from Fortran by calling getpid(3c)
(LICENSE:PD)
integer function system_getpid()
The system_getpid() function returns the process ID of the
calling process.
The value returned is the integer process ID. The system_getpid()
function shall always be successful and no return value is reserved
to indicate an error.
Get process PID from Fortran
program demo_system_getpid
use M_system, only : system_getpid
implicit none
write(*,*)'PID=',system_getpid()
end program demo_system_getpid
system_getppid(3f) - [M_system:QUERY] get parent process ID (PPID) of
current process from Fortran by calling getppid(3c)
(LICENSE:PD)
integer(kind=c_int) function system_getppid()
The system_getppid() function returns the parent process ID of
the calling process.
The system_getppid() function should always be successful and no
return value is reserved to indicate an error.
No errors are defined.
exec, fork(), getpgid(), getpgrp(), getpid(), kill(),
setpgid(), setsid()
Get parent process PID (PPID) from Fortran
program demo_system_getppid
use M_system, only : system_getppid
implicit none
write(*,*)'PPID=',system_getppid()
end program demo_system_getppid
system_getsid(3f) - [M_system:QUERY] get the process group ID of
a session leader
(LICENSE:PD)
integer(kind=c_int) function system_getsid(pid)
integer(kind=c_int) :: pid
The system_getsid() function obtains the process group ID of the
process that is the session leader of the process specified by pid.
If pid is 0, it specifies the calling process.
Upon successful completion, system_getsid() shall return
the process group ID of the session leader of the specified
process. Otherwise, it shall return -1 and set errno to indicate
the error.
Get SID from Fortran
program demo_system_getsid
use M_system, only : system_getsid
use ISO_C_BINDING, only : c_int
implicit none
write(*,*)'SID=',system_getsid(0_c_int)
end program demo_system_getsid
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=c_int) | :: | c_pid |
system_getuid(3f) - [M_system:QUERY] get real UID of current process
from Fortran by calling getuid(3c)
(LICENSE:PD)
integer(kind=c_int) function system_getuid()
The system_getuid(3f) function shall return the real user ID
of the calling process. The getuid() function shall always be
successful and no return value is reserved to indicate the error.
Get group ID from Fortran:
program demo_system_getuid
use M_system, only : system_getuid
implicit none
write(*,*)'UID=',system_getuid()
end program demo_system_getuid
Results:
UID= 197609
system_kill(3f) - [M_system:SIGNALS] send a signal to a process or
a group of processes
(LICENSE:PD)
integer(kind=c_int) function system_kill(pid,sig)
integer,intent(in) :: pid
integer,intent(in) :: sig
The kill() function shall send a signal to a process or a group of
processes specified by pid. The signal to be sent is specified by
sig and is either one from the list given in <signal.h> or 0. If sig
is 0 (the null signal), error checking is performed but no signal
is actually sent. The null signal can be used to check the validity
of pid.
For a process to have permission to send a signal to a process
designated by pid, unless the sending process has appropriate
privileges, the real or effective user ID of the sending process
shall match the real or saved set-user-ID of the receiving process.
If pid is greater than 0, sig shall be sent to the process whose
process ID is equal to pid.
If pid is 0, sig shall be sent to all processes (excluding an
unspecified set of system processes) whose process group ID is equal
to the process group ID of the sender, and for which the process has
permission to send a signal.
If pid is -1, sig shall be sent to all processes (excluding an
unspecified set of system processes) for which the process has
permission to send that signal.
If pid is negative, but not -1, sig shall be sent to all processes
(excluding an unspecified set of system processes) whose process
group ID is equal to the absolute value of pid, and for which the
process has permission to send a signal.
If the value of pid causes sig to be generated for the sending process,
and if sig is not blocked for the calling thread and if no other
thread has sig unblocked or is waiting in a sigwait() function for
sig, either sig or at least one pending unblocked signal shall be
delivered to the sending thread before kill() returns.
The user ID tests described above shall not be applied when sending
SIGCONT to a process that is a member of the same session as the
sending process.
An implementation that provides extended security controls may impose
further implementation-defined restrictions on the sending of signals,
including the null signal. In particular, the system may deny the
existence of some or all of the processes specified by pid.
The kill() function is successful if the process has permission to
send sig to any of the processes specified by pid. If kill() fails,
no signal shall be sent.
Upon successful completion, 0 shall be returned. Otherwise, -1 shall be
returned and errno set to indicate the error.
The kill() function shall fail if:
EINVAL The value of the sig argument is an invalid or unsupported
signal number.
EPERM The process does not have permission to send the signal to
any receiving process.
ESRCH No process or process group can be found corresponding to
that specified by pid. The following sections are informative.
Sample program:
program demo_system_kill
use M_system, only : system_kill
use M_system, only : system_perror
implicit none
integer :: i,pid,ios,ierr,signal=9
character(len=80) :: argument
do i=1,command_argument_count()
! get arguments from command line
call get_command_argument(i, argument)
! convert arguments to integers assuming they are PID numbers
read(argument,'(i80)',iostat=ios) pid
if(ios.ne.0)then
write(*,*)'bad PID=',trim(argument)
else
write(*,*)'kill SIGNAL=',signal,' PID=',pid
! send signal SIGNAL to pid PID
ierr=system_kill(pid,signal)
! write message if an error was detected
if(ierr.ne.0)then
call system_perror('*demo_system_kill*')
endif
endif
enddo
end program demo_system_kill
getpid(), raise(), setsid(), sigaction(), sigqueue(),
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=c_int), | intent(in), | value | :: | c_pid | ||
integer(kind=c_int), | intent(in), | value | :: | c_signal |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=C_SIZE_T), | value | :: | size |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=C_INTPTR_T), | value | :: | dest | |||
integer(kind=C_INTPTR_T), | value | :: | src | |||
integer(kind=C_SIZE_T), | value | :: | n |
system_rand(3f) - [M_system:PSEUDORANDOM] call pseudo-random number
generator rand(3c)
(LICENSE:PD)
integer(kind=c_int) :: function system_rand()
Use rand(3c) to generate pseudo-random numbers.
Sample program:
program demo_system_rand
use M_system, only : system_srand, system_rand
implicit none
integer :: i
call system_srand(1001)
do i=1,10
write(*,*)system_rand()
enddo
write(*,*)
end program demo_system_rand
expected results:
1512084687
1329390995
1874040748
60731048
239808950
2017891911
22055588
1105177318
347750200
1729645355
1512084687
1329390995
1874040748
60731048
239808950
2017891911
22055588
1105177318
347750200
1729645355
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=C_INTPTR_T), | value | :: | ptr | |||
integer(kind=C_SIZE_T), | value | :: | size |
system_setsid(3f) - [M_system:QUERY] create session and set the
process group ID of a session leader
(LICENSE:PD)
integer(kind=c_int) function system_setsid(pid)
integer(kind=c_int) :: pid
The setsid() function creates a new session, if the calling
process is not a process group leader. Upon return the calling
process shall be the session leader of this new session, shall be
the process group leader of a new process group, and shall have no
controlling terminal. The process group ID of the calling process
shall be set equal to the process ID of the calling process. The
calling process shall be the only process in the new process
group and the only process in the new session.
Upon successful completion, setsid() shall return the value
of the new process group ID of the calling process. Otherwise,
it shall return -1 and set errno to indicate the error.
The setsid() function shall fail if:
o The calling process is already a process group leader
o the process group ID of a process other than the calling
process matches the process ID of the calling process.
Set SID from Fortran
program demo_system_setsid
use M_system, only : system_setsid
implicit none
write(*,*)'SID=',system_setsid()
end program demo_system_setsid
system_srand(3f) - [M_system:PSEUDORANDOM] set seed for pseudo-random
number generator system_rand(3f)
(LICENSE:PD)
subroutine system_srand()
system_srand(3f) calls the C routine srand(3c) The
srand(3c)/system_srand(3f) function uses its argument as the seed
for a new sequence of pseudo-random integers to be returned by
system_rand(3f)/rand(3c). These sequences are repeatable by calling
system_srand(3f) with the same seed value. If no seed value is
provided, the system_rand(3f) function is automatically seeded with
a value of 1.
Sample program:
program demo_system_srand
use M_system, only : system_srand, system_rand
implicit none
integer :: i,j
do j=1,2
call system_srand(1001)
do i=1,10
write(*,*)system_rand()
enddo
write(*,*)
enddo
end program demo_system_srand
expected results:
1512084687
1329390995
1874040748
60731048
239808950
2017891911
22055588
1105177318
347750200
1729645355
1512084687
1329390995
1874040748
60731048
239808950
2017891911
22055588
1105177318
347750200
1729645355
drand48(3c), random(3c)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=c_int), | intent(in) | :: | seed |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(C_PTR), | value | :: | tloc |
elemental impure logical function system_access(pathname,amode)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | pathname | |||
integer, | intent(in) | :: | amode |
Sample program:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | filename | |||
integer, | intent(in), | value | :: | mode |
elemental impure logical function system_chown(path,owner,group)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | dirname | |||
integer, | intent(in) | :: | owner | |||
integer, | intent(in) | :: | group |
function system_dir(directory,pattern,ignorecase)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in), | optional | :: | directory | ||
character(len=*), | intent(in), | optional | :: | pattern | ||
logical, | intent(in), | optional | :: | ignorecase |
Sample setting an environment variable from Fortran:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | name | |||
character(len=*), | intent(in), | optional | :: | default |
function system_getgrgid(gid) result (gname)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(*), | intent(in) | :: | gid |
function system_getlogin() result (fname)
function system_getpwuid(uid) result (uname)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(*), | intent(in) | :: | uid |
integer function system_getumask() result (umask_value)
system_isblk(3f) - [M_system:QUERY_FILE] checks if argument is a block device (LICENSE:PD)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | pathname |
elemental impure logical function system_ischr(pathname)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | pathname |
elemental impure logical function system_isdir(pathname)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | dirname |
elemental impure logical function system_isfifo(pathname)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | pathname |
Sample program:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | pathname |
elemental impure logical function system_isreg(pathname)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | pathname |
elemental impure logical function system_issock(pathname)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | pathname |
Creating a Link to a File
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | oldname | |||
character(len=*), | intent(in) | :: | newname |
Sample program:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | dirname | |||
integer, | intent(in) | :: | mode |
function system_mkfifo(pathname,mode) result(ierr)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | pathname | |||
integer, | intent(in) | :: | mode |
function system_perm(mode) result (perms)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(*), | intent(in) | :: | mode |
Sample program:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | input |
elemental impure function system_remove(path) result(err)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character, | intent(in) | :: | path |
function system_rename(input,output) result(ierr)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character, | intent(in) | :: | input | |||
character, | intent(in) | :: | output |
Sample program:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character, | intent(in) | :: | dirname |
Sample program
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | umask_value |
Sample program
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | command |
Removing a link to a file
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | fname |
The utime() function may fail if:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | pathname | |||
integer, | intent(in), | optional | :: | times(2) |
fileglob(3f) - [M_system:QUERY_FILE] Read output of an ls(1) command from Fortran (LICENSE:PD)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | glob | |||
character(len=*), | pointer | :: | list(:) |
subroutine set_environment_variable(NAME, VALUE, STATUS)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*) | :: | NAME | ||||
character(len=*) | :: | VALUE | ||||
integer, | intent(out), | optional | :: | STATUS |
Sample run output:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*) | :: | path | ||||
integer, | intent(out), | optional | :: | err |
Sample program:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(out), | optional | :: | ierr |
Sample program
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(c_ptr), | value | :: | dir | |||
integer, | intent(out), | optional | :: | ierr |
Sample program:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real, | intent(out) | :: | total | |||
real, | intent(out) | :: | user | |||
real, | intent(out) | :: | system |
Sample program:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=:), | intent(out), | allocatable | :: | output | ||
integer, | intent(out) | :: | ierr |
Sample program:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=:), | intent(out), | allocatable | :: | NAME | ||
integer, | intent(out) | :: | IERR |
subroutine system_opendir(dirname,dir,ierr)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | dirname | |||
type(c_ptr) | :: | dir | ||||
integer, | intent(out), | optional | :: | ierr |
Sample program:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | prefix |
Sample setting an environment variable from Fortran:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | string | |||
integer, | intent(out), | optional | :: | err |
subroutine system_readdir(dir,filename,ierr)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(c_ptr), | value | :: | dir | |||
character(len=:), | intent(out), | allocatable | :: | filename | ||
integer, | intent(out) | :: | ierr |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | signum | |||
procedure(handler), | optional | :: | handler_routine |
CALL SYSTEM_STAT(NAME, VALUES [, STATUS],[DEBUG])
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | pathname | |||
integer(kind=int64), | intent(out) | :: | values(13) | |||
integer, | intent(out), | optional | :: | ierr |
system_uname(3f) - [M_system] call a C wrapper that calls uname(3c) to get current system information from Fortran (LICENSE:PD)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(kind=C_CHAR), | intent(in) | :: | WHICH | |||
character(len=*), | intent(out) | :: | NAMEOUT |
subroutine system_unsetenv(name,ierr)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | name | |||
integer, | intent(out), | optional | :: | ierr |