libc functions¶
- function libc/access pathname mode¶
in C,
access (pathname, mode)
a wrapper to libc access(2)- Param pathname:
file name
- Type pathname:
string
- Param mode:
accessibility check(s)
- Type mode:
C/int
- Return:
#t
or#f
- Rtype:
boolean
- Raises ^rt-libc-format-error:
if pathname contains an ASCII NUL
Any non-zero value from access(2) returns
#f
, no ^system-error is raised.Warning
Use of this function is discouraged.
- function libc/asctime tm¶
in C,
asctime (tm)
a wrapper to libc asctime(3)- Param tm:
- Type tm:
C/pointer
- Return:
string representation of tm
- Rtype:
string
- Raises ^system-error:
- function libc/chdir path¶
in C,
chdir (path)
a wrapper to libc chdir(2)- Param path:
directory name
- Type path:
string
- Return:
0
- Rtype:
C/int
- Raises ^rt-libc-format-error:
if path contains an ASCII NUL
- Raises ^system-error:
- function libc/chmod pathname mode¶
in C:
chmod (pathname, mode)
a wrapper to libc chmod(2)- Param pathname:
pathname
- Type pathname:
string
- Param mode:
mode flags
- Type mode:
libc/mode_t
- Return:
0
- Rtype:
C/int
- Raises ^rt-libc-format-error:
if pathname contains an ASCII NUL
- Raises ^system-error:
- function libc/chown pathname owner group¶
in C:
chown (pathname, owner, group)
a wrapper to libc chown(2)- Param pathname:
pathname
- Type pathname:
string
- Param owner:
User ID
- Type owner:
libc/uid_t
- Param group:
Group ID
- Type group:
libc/gid_t
- Return:
0
- Rtype:
C/int
- Raises ^rt-libc-format-error:
if pathname contains an ASCII NUL
- Raises ^system-error:
- function libc/chroot path¶
in C:
chroot (path)
a wrapper to libc chroot(2)- Param path:
path
- Type path:
string
- Return:
0
- Rtype:
C/int
- Raises ^rt-libc-format-error:
if path contains an ASCII NUL
- Raises ^system-error:
- function libc/close fd¶
in C,
close (fd)
a wrapper to libc close(2)- Param fd:
file descriptor
- Type fd:
C/int
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
- function libc/close-if-open fd¶
in C,
fcntl(fd, F_GETFD) && close (fd)
This exists to avoid close reacting to
EBADF
which is handled specially.- Param fd:
file descriptor
- Type fd:
C/int
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
- function libc/ctermid¶
in C:
ctermid (s)
a wrapper to libc ctermid(3)- Return:
controlling terminal pathname
- Rtype:
pathname
- function libc/ctime [t]¶
in C,
ctime (t)
a wrapper to libc ctime(3)- Param t:
time in seconds since epoch, defaults to the result of time(2)
- Type t:
libc/time_t, optional
- Return:
string representation of t
- Rtype:
string
- Raises ^system-error:
- function libc/dup oldfd¶
in C,
dup (oldfd)
a wrapper to libc dup(2)- Param oldfd:
file descriptor
- Type oldfd:
C/int
- Return:
new fd
- Rtype:
C/int
- Raises ^system-error:
- function libc/dup2 oldfd newfd¶
in C,
dup2 (oldfd, newfd)
a wrapper to libc dup2(2)- Param oldfd:
file descriptor
- Type oldfd:
C/int
- Param newfd:
file descriptor
- Type newfd:
fixnum or C/int
- Return:
new fd
- Rtype:
C/int
- Raises ^system-error:
- function libc/exit status¶
in C,
exit (status)
a wrapper to libc exit(3)- Param status:
exit status
- Type status:
fixnum or C/int
DOES NOT RETURN :)
- function libc/faccessat dirfd pathname mode [flag ...]¶
in C:
faccessat (dirfd, pathname, mode, flags)
a wrapper to libc faccessat(2)- Param dirfd:
file descriptor for a directory
- Type dirfd:
C/int
- Param pathname:
pathname
- Type pathname:
string
- Param mode:
accessibility check(s)
- Type mode:
C/int
- Param flags:
see below, default none
- Type flags:
C/int, optional
- Return:
#t
or#f
- Rtype:
boolean
- Raises ^rt-libc-format-error:
if pathname contains an ASCII NUL
Any non-zero value from faccessat(2) returns
#f
, no ^system-error is raised.The following value can be used for dirfd:
AT_FDCWD
The following values are defined for flags, they can be
C/|
-bitwise OR’d together or passed as extra arguments:AT_EACCESS
AT_SYMLINK_NOFOLLOW
Warning
Use of this function is discouraged.
Note
faccessat
is not available on all systems. Use theIDIO_NO_FACCESSAT
feature in cond-expand.
- function libc/fchdir fd¶
in C:
fchdir (fd)
a wrapper to libc fchdir(2)- Param fd:
file descriptor
- Type fd:
C/int
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
- function libc/fchmod fd mode¶
in C:
fchmod (fd, mode)
a wrapper to libc fchmod(2)- Param fd:
file descriptor
- Type fd:
C/int
- Param mode:
mode flags
- Type mode:
libc/mode_t
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
- function libc/fchmodat dirfd pathname mode [flag ...]¶
in C:
fchmodat (dirfd, pathname, mode, flags)
a wrapper to libc fchmodat(2)- Param dirfd:
file descriptor for a directory
- Type dirfd:
C/int
- Param pathname:
pathname
- Type pathname:
string
- Param mode:
mode flags
- Type mode:
libc/mode_t
- Param flags:
see below, default none
- Type flags:
C/int
- Return:
0
- Rtype:
C/int
- Raises ^rt-libc-format-error:
if pathname contains an ASCII NUL
- Raises ^system-error:
The following value can be used for dirfd:
AT_FDCWD
The following values are defined for flags, they can be
C/|
-bitwise OR’d together or passed as extra arguments:AT_SYMLINK_NOFOLLOW
Note
fchmodat
is not available on all systems. Use theIDIO_NO_FCHMODAT
feature in cond-expand.
- function libc/fchown fd owner group¶
in C:
fchown (fd, owner, group)
a wrapper to libc fchown(2)- Param fd:
file descriptor
- Type fd:
C/int
- Param owner:
User ID
- Type owner:
libc/uid_t
- Param group:
Group ID
- Type group:
libc/gid_t
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
- function libc/fchownat dirfd pathname owner group [flag ...]¶
in C:
fchownat (dirfd, pathname, owner, group, flags)
a wrapper to libc fchownat(2)- Param dirfd:
file descriptor for a directory
- Type dirfd:
C/int
- Param pathname:
pathname
- Type pathname:
string
- Param owner:
user ID
- Type owner:
libc/uid_t
- Param group:
group ID
- Type group:
libc/gid_t
- Param flags:
see below, default none
- Type flags:
C/int, optional
- Return:
0
- Rtype:
C/int
- Raises ^rt-libc-format-error:
if pathname contains an ASCII NUL
- Raises ^system-error:
The following value can be used for dirfd:
AT_FDCWD
The following values are defined for flags, they can be
C/|
-bitwise OR’d together or passed as extra arguments:AT_SYMLINK_NOFOLLOW
Note
fchownat
is not available on all systems. Use theIDIO_NO_FCHOWNAT
feature in cond-expand.
- function libc/fcntl fd cmd [args]¶
in C,
fcntl (fd, cmd[, args])
a wrapper to libc fcntl(2)- Param fd:
file descriptor
- Type fd:
C/int
- Param cmd:
fcntl command
- Type cmd:
C/int
- Param args:
fcntl command args
- Type args:
list
- Return:
appropriate value
- Rtype:
C/int
- Raises ^system-error:
Supported commands include:
libc/F_DUPFD
libc/F_DUPFD_CLOEXEC
(if available)libc/F_GETFL
libc/F_SETFL
- function libc/fork¶
in C,
fork ()
a wrapper to libc fork(2)- Return:
0 or Process ID of child
- Rtype:
libc/pid_t
- Raises ^system-error:
- function libc/fstat fd¶
in C,
fstat (fd)
a wrapper to libc fstat(2)- Param fd:
file descriptor
- Type fd:
C/int
- Return:
- Rtype:
C/pointer
- Raises ^system-error:
- function libc/fstatat dirfd pathname [flag ...]¶
in C:
fstatat (dirfd, pathname, statbuf, flags)
a wrapper to libc fstatat(2)- Param dirfd:
file descriptor for a directory
- Type dirfd:
C/int
- Param pathname:
pathname
- Type pathname:
string
- Param flags:
see below, default none
- Type flags:
C/int, optional
- Return:
- Rtype:
C/pointer
- Raises ^rt-libc-format-error:
if pathname contains an ASCII NUL
- Raises ^system-error:
The following value can be used for dirfd:
AT_FDCWD
The following values are defined for flags, they can be
C/|
-bitwise OR’d together or passed as extra arguments:AT_SYMLINK_NOFOLLOW
Note
fstatat
is not available on all systems. Use theIDIO_NO_FSTATAT
feature in cond-expand.
- function libc/fstatvfs fd¶
in C:
fstatvfs (fd)
a wrapper to libc fstatvfs(3)- Param fd:
file descriptor
- Type fd:
C/int
- Return:
- Rtype:
C/pointer
- Raises ^system-error:
- function libc/fsync fd¶
in C:
fsync (fd)
a wrapper to libc fsync(2)- Param fd:
file descriptor
- Type fd:
C/int
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
- function libc/ftruncate fd length¶
in C:
ftruncate (fd, length)
a wrapper to libc ftruncate(2)- Param fd:
file descriptor
- Type fd:
C/int
- Param length:
length
- Type length:
libc/off_t
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
- function libc/futimes fd atime mtime¶
in C:
futimes (fd, (atime, mtime))
a wrapper to libc futimes(3)- Param fd:
file descriptor
- Type fd:
C/int
- Param atime:
- Type atime:
C/pointer
- Param mtime:
- Type mtime:
C/pointer
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
Note
futimes
is not available on all systems. Use theIDIO_NO_FUTIMES
feature in cond-expand.See also
- function libc/futimesat dirfd pathname atime mtime¶
in C:
futimesat (dirfd, pathname, (atime, mtime))
a wrapper to libc futimesat(2)- Param dirfd:
file descriptor for a directory
- Type dirfd:
C/int
- Param pathname:
pathname
- Type pathname:
string
- Param atime:
- Type atime:
C/pointer
- Param mtime:
- Type mtime:
C/pointer
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
Note
futimesat
is not available on all systems. Use theIDIO_NO_FUTIMESAT
feature in cond-expand.See also
- function libc/getcwd¶
in C,
getcwd (buf, size)
a wrapper to libc getcwd(3)- Return:
current working directory
- Rtype:
pathname
- Raises ^system-error:
Note
The returned value is limited to
libc/PATH_MAX
bytes
- function libc/getegid¶
in C:
getegid ()
a wrapper to libc getegid(2)- Return:
effective group ID
- Rtype:
libc/gid_t
- function libc/geteuid¶
in C:
geteuid ()
a wrapper to libc geteuid(2)- Return:
effective user ID
- Rtype:
libc/uid_t
- function libc/getgid¶
in C:
getgid ()
a wrapper to libc getgid(2)- Return:
real group ID
- Rtype:
libc/gid_t
- function libc/getgrgid gid¶
in C:
getgrgid (gid)
a wrapper to libc getgrgid(3)- Param gid:
group ID
- Type gid:
unsigned fixnum or libc/gid_t
- Return:
struct-group or
#f
- Rtype:
C/pointer
- Raises ^system-error:
- function libc/getgrnam name¶
in C:
getgrnam (name)
a wrapper to libc getgrnam(3)- Param name:
group name
- Type name:
string
- Return:
struct-group or
#f
- Rtype:
C/pointer
- Raises ^rt-libc-format-error:
if name contains an ASCII NUL
- Raises ^system-error:
- function libc/getlogin¶
in C:
getlogin ()
a wrapper to libc getlogin(3)- Return:
user name
- Rtype:
string
- function libc/getpgid pid¶
in C,
getpgid (pid)
a wrapper to libc getpgid(2)- Param pid:
progress ID
- Type pid:
libc/pid_t
- Return:
Process Group ID
- Rtype:
libc/pid_t
- Raises ^system-error:
- function libc/getpgrp¶
in C,
getpgrp ()
a wrapper to libc getpgrp(2)- Return:
Process Group ID
- Rtype:
libc/pid_t
- Raises ^system-error:
- function libc/getpid¶
in C,
getpid ()
a wrapper to libc getpid(2)- Return:
Process ID
- Rtype:
libc/pid_t
- Raises ^system-error:
- function libc/getppid¶
in C,
getppid ()
a wrapper to libc getppid(2)- Return:
Parent Process ID
- Rtype:
libc/pid_t
- Raises ^system-error:
- function libc/getpriority which who¶
in C:
getpriority (which, who)
a wrapper to libc getpriority(2)- Param which:
see below
- Type which:
C/int
- Param who:
dependent on which
- Type who:
libc/id_t
- Return:
nice value
- Rtype:
C/int
- Raises ^system-error:
which should be one of the values:
PRIO_PROCESS
,PRIO_PGRP
orPRIO_USER
. who is then an appropriate value.
- function libc/getpwuid uid¶
in C:
getpwuid (uid)
a wrapper to libc getpwuid(3)- Param uid:
user ID
- Type uid:
unsigned fixnum or libc/uid_t
- Return:
struct-passwd or
#f
- Rtype:
C/pointer
- Raises ^system-error:
- function libc/getpwnam name¶
in C:
getpwnam (name)
a wrapper to libc getpwnam(3)- Param name:
user name
- Type name:
string
- Return:
struct-passwd or
#f
- Rtype:
C/pointer
- Raises ^rt-libc-format-error:
if name contains an ASCII NUL
- Raises ^system-error:
- function libc/getrlimit res¶
a more convenient getrlimit(2) which can use a
:nickname
keyword, eg.:NOFILE
forlibc/RLIMIT_NOFILE
- Param res:
either the
libc/RLIMIT_*
symbol or C/int or:nickname
keyword- Return:
- Rtype:
C/pointer
- Raises ^system-error:
The resource names follow C conventions such as
libc/RLIMIT_AS
andlibc/RLIMIT_NOFILE
.See also
- function libc/getrusage who¶
in C,
getrusage (who, rusage)
a wrapper to libc getrusage(2)- Param who:
who, see below
- Type who:
C/int
- Return:
- Rtype:
C/pointer
- Raises ^system-error:
The parameter who refers to
libc/RUSAGE_SELF
orlibc/RUSAGE_CHILDREN
- function libc/getsid pid¶
in C,
getsid (pid)
a wrapper to libc getsid(2)- Param pid:
Process ID
- Type pid:
libc/pid_t
- Return:
Session ID
- Rtype:
libc/pid_t
- Raises ^system-error:
- function libc/gettimeofday¶
in C,
gettimeofday ()
a wrapper to libc gettimeofday(2)- Return:
- Rtype:
C/pointer
- Raises ^system-error:
Note
The struct timezone parameter is not used.
- function libc/getuid¶
in C:
getuid ()
a wrapper to libc getuid(2)- Return:
real user ID
- Rtype:
libc/uid_t
- function libc/gmtime [t]¶
in C,
gmtime (t)
a wrapper to libc gmtime(3)- Param t:
time in seconds since epoch, defaults to the result of time(2)
- Type t:
libc/time_t, optional
- Return:
- Rtype:
C/pointer
- Raises ^system-error:
- function libc/grantpt fd¶
in C,
grantpt (fd)
a wrapper to libc grantpt(3)- Param fd:
fd to grantpt
- Type fd:
C/int
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
- function libc/ioctl fd cmd [args]¶
in C,
ioctl (fd, cmd[, args])
a wrapper to libc ioctl(2)- Param fd:
file descriptor
- Type fd:
C/int
- Param cmd:
ioctl command
- Type cmd:
C/int
- Param args:
ioctl command args
- Type args:
list
- Return:
appropriate value
- Rtype:
C/int
- Raises ^system-error:
Supported commands include:
libc/I_PUSH
- function libc/isatty fd¶
in C,
isatty (fd)
a wrapper to libc isatty(3)- Param fd:
file descriptor
- Type fd:
C/int
- Return:
#t
or#f
- Rtype:
boolean
- Raises ^system-error:
A strictly conforming
isatty
would raise a ^system-error forENOTTY
however this wrapper returns#f
in that case but raises ^system-error for any other isatty(3) error.Warning
Not all operating systems set
errno
when isatty(3) returns 0,isatty
also returns#f
in that case.
- function libc/kill pid sig¶
in C,
kill (pid, sig)
a wrapper to libc kill(2)- Param pid:
Process ID
- Type pid:
libc/pid_t
- Param fd:
signal number
- Type fd:
C/int
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
- function libc/killpg pgrp sig¶
in C,
killpg (pgrp, sig)
a wrapper to libc killpg(3)- Param pgrp:
Process Group ID
- Type pgrp:
libc/pid_t
- Param sig:
signal number
- Type sig:
C/int
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
- function libc/link oldpath newpath¶
in C:
link (oldpath, newpath)
a wrapper to libc link(2)- Param oldpath:
existing file name
- Type oldpath:
string
- Param newpath:
new file name
- Type newpath:
string
- Return:
0
- Rtype:
C/int
- Raises ^rt-libc-format-error:
if oldpath or newpath contain an ASCII NUL
- Raises ^system-error:
- function libc/linkat olddirfd oldpath newdirfd newpath [flag ...]¶
in C:
linkat (olddirfd, oldpath, newdirfd, newpath, flags)
a wrapper to libc linkat(2)- Param olddirfd:
file descriptor for a directory
- Type olddirfd:
C/int
- Param oldpath:
existing file name
- Type oldpath:
string
- Param newdirfd:
file descriptor for a directory
- Type newdirfd:
C/int
- Param newpath:
new file name
- Type newpath:
string
- Param flags:
see below, default none
- Type flags:
C/int, optional
- Return:
0
- Rtype:
C/int
- Raises ^rt-libc-format-error:
if pathname contains an ASCII NUL
- Raises ^system-error:
The following value can be used for dirfd:
AT_FDCWD
The following values are defined for flags, they can be
C/|
-bitwise OR’d together or passed as extra arguments:AT_SYMLINK_FOLLOW
Note
linkat
is not available on all systems. Use theIDIO_NO_LINKAT
feature in cond-expand.
- function libc/localtime [t]¶
in C,
localtime (t)
a wrapper to libc localtime(3)- Param t:
time in seconds since epoch, defaults to the result of time(2)
- Type t:
libc/time_t, optional
- Return:
- Rtype:
C/pointer
- Raises ^system-error:
- function libc/lockf fd cmd len¶
in C:
lockf (fd, cmd, len)
a wrapper to libc lockf(3)- Param fd:
file descriptor
- Type fd:
C/int
- Param cmd:
see below
- Type cmd:
C/int
- Param len:
relative offset
- Type len:
libc/off_t
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
- function libc/lstat pathname¶
in C,
lstat (pathname)
a wrapper to libc lstat(2)- Param pathname:
filename to stat
- Type pathname:
string
- Return:
- Rtype:
C/pointer
- Raises ^rt-libc-format-error:
if pathname contains an ASCII NUL
- Raises ^system-error:
- function libc/mkdir pathname mode¶
in C,
mkdir (pathname, mode)
a wrapper to libc mkdir(2)- Param pathname:
directory name
- Type pathname:
string
- Param mode:
mode flags
- Type mode:
libc/mode_t
- Return:
0
- Rtype:
C/int
- Raises ^rt-libc-format-error:
if pathname contains an ASCII NUL
- Raises ^system-error:
- function libc/mkdirat dirfd pathname mode¶
in C:
mkdirat (dirfd, pathname, mode)
a wrapper to libc mkdirat(2)- Param dirfd:
file descriptor for a directory
- Type dirfd:
C/int
- Param pathname:
pathname
- Type pathname:
string
- Param mode:
mode flags
- Type mode:
libc/mode_t
- Return:
0
- Rtype:
C/int
- Raises ^rt-libc-format-error:
if pathname contains an ASCII NUL
- Raises ^system-error:
The following value can be used for dirfd:
AT_FDCWD
- function libc/mkdtemp template¶
in C,
mkdtemp (template)
a wrapper to libc mkdtemp(3)- Param template:
directory template
- Type template:
string
- Return:
modified template
- Rtype:
pathname
- Raises ^rt-libc-format-error:
if template contains an ASCII NUL
- Raises ^system-error:
- function libc/mkfifo path mode¶
in C,
mkfifo (path, mode)
a wrapper to libc mkfifo(2)- Param path:
filename of FIFO
- Type path:
string
- Param mode:
mode flags
- Type mode:
libc/mode_t
- Return:
0
- Rtype:
C/int
- Raises ^rt-libc-format-error:
if path contains an ASCII NUL
- Raises ^system-error:
- function libc/mkstemp template¶
in C,
mkstemp (template)
a wrapper to libc mkstemp(3)- Param template:
filename template
- Type template:
string
- Return:
(fd filename)
- Rtype:
list (C/int, pathname)
- Raises ^rt-libc-format-error:
if template contains an ASCII NUL
- Raises ^system-error:
- function libc/mktime tm¶
in C,
mktime (tm)
a wrapper to libc mktime(3)- Param tm:
time structure
- Type tm:
- Return:
calendar time
- Rtype:
libc/time_t
- Raises ^system-error:
- function libc/nanosleep req¶
in C,
nanosleep (req, rem)
a wrapper to libc nanosleep(2)- Param req:
see below
- Type req:
struct-timespec or a list
- Return:
(completed? rem)
- Rtype:
list
- Raises ^system-error:
rem is a struct-timespec
EINTR
will return(#f rem)
otherwise return(#t rem)
req can be a list of
(sec [nsec])
where sec can be a libc/time_t | fixnum | bignum and nsec can be aC/long
| fixnum | bignum
- function libc/open pathname flags [mode]¶
in C,
open (pathname, mode)
a wrapper to libc open(2)- Param pathname:
filename
- Type pathname:
string
- Param flags:
access/creation flags
- Type flags:
C/int
- Param mode:
mode flags, defaults to 0
- Type mode:
libc/mode_t, optional
- Return:
file descriptor
- Rtype:
C/int
- Raises ^rt-libc-format-error:
if pathname contains an ASCII NUL
- Raises ^system-error:
- function libc/openat dirfd pathname flags [mode]¶
in C:
openat (dirfd, pathname, flags, mode)
a wrapper to libc openat(2)- Param dirfd:
file descriptor for a directory
- Type dirfd:
C/int
- Param pathname:
pathname
- Type pathname:
string
- Param flags:
access/creation flags
- Type flags:
C/int
- Param mode:
mode flags, defaults to 0
- Type mode:
libc/mode_t, optional
- Return:
file descriptor
- Rtype:
C/int
- Raises ^rt-libc-format-error:
if pathname contains an ASCII NUL
- Raises ^system-error:
- function libc/pipe¶
in C,
pipe (pipefd)
a wrapper to libc pipe(2)- Return:
pointer to pipe array
- Rtype:
C/pointer
- Raises ^system-error:
pipefd is a C/pointer to a C
int[2]
.See also
pipe-reader and pipe-writer for accessors to pipefd.
- function libc/pipe-reader pipefd¶
Return the read end of the pipe array
- Param pipefd:
pointer to pipe array
- Type pipefd:
C/pointer
- Return:
read end of the pipe array
- Rtype:
C/int
See also
pipe for a constructor of the pipe array.
- function libc/pipe-writer pipefd¶
Return the write end of the pipe array
- Param pipefd:
pointer to pipe array
- Type pipefd:
C/pointer
- Return:
write end of the pipe array
- Rtype:
C/int
See also
pipe for a constructor of the pipe array.
- function libc/posix_openpt [flags]¶
in C,
posix_openpt (flags)
a wrapper to libc posix_openpt(3)- Param flags:
flags to posix_openpt, defaults to
O_RDWR [| O_NOCTTY]
- Type flags:
C/int, optional
- Return:
file descriptor for master
- Rtype:
C/int
- Raises ^system-error:
Note
O_NOCTTY
is not available on all systems.
- function libc/pread fd offset [count]¶
in C:
pread (fd, buf, count, offset)
a wrapper to libc pread(2)- Param fd:
file descriptor
- Type fd:
C/int
- Param offset:
offset
- Type offset:
libc/off_t
- Param count:
number of bytes to read, defaults to
libc/BUFSIZ
- Type count:
fixnum or libc/size_t, optional
- Return:
string of bytes read or see below
- Rtype:
octet string or see below
- Raises ^system-error:
If pread(2) returned 0 then this code returns
#<eof>
.If pread(2) indicated
EAGAIN
then this code returns #f.See also
- function libc/ptsname fd¶
in C,
ptsname (fd)
a wrapper to libc ptsname(3)- Param fd:
fd to ptsname
- Type fd:
C/int
- Return:
ptsname
- Rtype:
pathname
- Raises ^system-error:
- function libc/pwrite fd str offset¶
in C:
pwrite (fd, str, offset)
a wrapper to libc pwrite(2)- Param fd:
file descriptor
- Type fd:
C/int
- Param str:
string
- Type buf:
string
- Param offset:
offset
- Type offset:
libc/off_t
- Return:
number of bytes written
- Rtype:
libc/ssize_t
- Raises ^system-error:
- function libc/read fd [count]¶
in C,
read (fd, buf, count)
a wrapper to libc read(2)- Param fd:
file descriptor
- Type fd:
C/int
- Param count:
number of bytes to read, defaults to
libc/BUFSIZ
- Type count:
fixnum or libc/size_t, optional
- Return:
string of bytes read or see below
- Rtype:
octet string or see below
- Raises ^system-error:
If read(2) returned 0 then this code returns
#<eof>
.If read(2) indicated
EAGAIN
then this code returns #f.See also
- function libc/readlink pathname¶
in C:
readlink (pathname, buf, bufsiz)
a wrapper to libc readlink(2)- Param pathname:
pathname
- Type pathname:
string
- Return:
contents of symlink
- Rtype:
pathname
- Raises ^rt-libc-format-error:
if pathname contains an ASCII NUL
- Raises ^system-error:
- function libc/readlinkat dirfd pathname¶
in C:
readlinkat (dirfd, pathname, buf, bufsiz)
a wrapper to libc readlinkat(2)- Param dirfd:
file descriptor for a directory
- Type dirfd:
C/int
- Param pathname:
pathname
- Type pathname:
string
- Return:
contents of symlink
- Rtype:
pathname
- Raises ^rt-libc-format-error:
if pathname contains an ASCII NUL
- Raises ^system-error:
- function libc/rename oldpath newpath¶
in C:
rename (oldpath, newpath)
a wrapper to libc rename(2)- Param oldpath:
existing file name
- Type oldpath:
string
- Param newpath:
new file name
- Type newpath:
string
- Return:
0
- Rtype:
C/int
- Raises ^rt-libc-format-error:
if oldpath or newpath contain an ASCII NUL
- Raises ^system-error:
- function libc/renameat olddirfd oldpath newdirfd newpath¶
in C:
renameat (olddirfd, oldpath, newdirfd, newpath)
a wrapper to libc renameat(2)- Param olddirfd:
file descriptor for a directory
- Type olddirfd:
C/int
- Param oldpath:
pathname
- Type oldpath:
string
- Param newdirfd:
file descriptor for a directory
- Type newdirfd:
C/int
- Param newpath:
pathname
- Type newpath:
string
- Return:
0
- Rtype:
C/int
- Raises ^rt-libc-format-error:
if oldpath or newpath contain an ASCII NUL
- Raises ^system-error:
- function libc/rmdir pathname¶
in C,
rmdir (pathname)
a wrapper to libc rmdir(2)- Param pathname:
directory to remove
- Type pathname:
string
- Return:
0
- Rtype:
C/int
- Raises ^rt-libc-format-error:
if pathname contains an ASCII NUL
- Raises ^system-error:
- function libc/select rlist wlist elist [timeout]¶
Call select(2) for timeout microseconds
- Param rlist:
a list of selectable entities for read events
- Type rlist:
list
- Param wlist:
a list of selectable entities for write events
- Type wlist:
list
- Param elist:
a list of selectable entities for exception events
- Type elist:
list
- Param timeout:
timeout in microseconds, defaults to
#n
- Type timeout:
fixnum, bignum or libc/struct-timeval
- Return:
list of three lists of events, see below
- Rtype:
list
- Raises ^rt-parameter-type-error:
- Raises ^system-error:
The return value is a list of three lists of ready objects, derived from the first three arguments.
Selectable entities are file descriptors (C/int) and file descriptor handles.
- function libc/setegid egid¶
in C:
setegid (egid)
a wrapper to libc setegid(2)- Param egid:
effective group ID
- Type egid:
libc/gid_t
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
- function libc/seteuid euid¶
in C:
seteuid (euid)
a wrapper to libc seteuid(2)- Param euid:
effective user ID
- Type euid:
libc/uid_t
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
- function libc/setgid gid¶
in C:
setgid (gid)
a wrapper to libc setgid(2)- Param gid:
group ID
- Type gid:
libc/gid_t
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
- function libc/setpgid pid pgid¶
in C,
setpgid (pid, pgid)
a wrapper to libc setpgid(2)- Param pid:
process ID
- Type pid:
libc/pid_t
- Param pgid:
Process Group ID
- Type pgid:
libc/pid_t
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
- function libc/setpriority which who prio¶
in C:
setpriority (which, who, prio)
a wrapper to libc setpriority(2)- Param which:
see below
- Type which:
C/int
- Param who:
dependent on which
- Type who:
libc/id_t
- Param prio:
priority
- Type prio:
C/int
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
which should be one of the values:
PRIO_PROCESS
,PRIO_PGRP
orPRIO_USER
. who is then an appropriate value.
- function libc/setregid rgid egid¶
in C:
setregid (rgid, egid)
a wrapper to libc setregid(2)- Param rgid:
real group ID
- Type rgid:
libc/gid_t
- Param egid:
effective group ID
- Type egid:
libc/gid_t
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
- function libc/setresgid rgid egid sgid¶
in C:
setresgid (rgid, egid, sgid)
a wrapper to libc setresgid(2)- Param rgid:
real group ID
- Type rgid:
libc/gid_t
- Param egid:
effective group ID
- Type egid:
libc/gid_t
- Param sgid:
saved group ID
- Type sgid:
libc/gid_t
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
Note
setresgid
is not available on all systems. Use theIDIO_NO_SET_SAVED_IDS
feature in cond-expand.
- function libc/setresuid ruid euid suid¶
in C:
setresuid (ruid, euid, suid)
a wrapper to libc setresuid(2)- Param ruid:
real user ID
- Type ruid:
libc/uid_t
- Param euid:
effective user ID
- Type euid:
libc/uid_t
- Param suid:
saved user ID
- Type suid:
libc/uid_t
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
Note
setresuid
is not available on all systems. Use theIDIO_NO_SET_SAVED_IDS
feature in cond-expand.
- function libc/setreuid ruid euid¶
in C:
setreuid (ruid, euid)
a wrapper to libc setreuid(2)- Param ruid:
real user ID
- Type ruid:
libc/uid_t
- Param euid:
effective user ID
- Type euid:
libc/uid_t
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
- function libc/setrlimit res rlim¶
a more convenient setrlimit(2) which can use a
:nickname
keyword, eg.:NOFILE
forlibc/RLIMIT_NOFILE
- Param res:
either the
libc/RLIMIT_*
symbol or C/int or:nickname
keyword- Param rlim:
- Type rlim:
C/pointer
- Return:
#<unspec>
- Raises ^system-error:
The resource names follow C conventions such as
libc/RLIMIT_AS
andlibc/RLIMIT_NOFILE
.See also
getrlimit to obtain a struct-rlimit and rlimit-names
- function libc/setsid¶
in C,
setsid ()
a wrapper to libc setsid(2)- Return:
Process Group ID of progress group
- Rtype:
libc/pid_t
- Raises ^system-error:
- function libc/setuid uid¶
in C:
setuid (uid)
a wrapper to libc setuid(2)- Param uid:
user ID
- Type uid:
libc/uid_t
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
- function libc/signal sig handler¶
in C,
signal (sig, handler)
a wrapper to libc signal(2)- Param sig:
signal
- Type sig:
C/int
- Param handler:
signal disposition
- Type handler:
C/pointer
- Return:
previous disposition
- Rtype:
C/pointer
- Raises ^system-error:
The following dispositions are defined:
libc/SIG_IGN
libc/SIG_DFL
- function libc/signal-handler sig¶
signal-handler (sig)
A helper function to advise of the current disposition for a given signal.
- Param sig:
signal
- Type sig:
C/int
- Return:
current disposition
- Rtype:
C/pointer
- Raises ^system-error:
The following dispositions are defined:
libc/SIG_IGN
libc/SIG_DFL
- Example:
C/== (libc/signal-handler libc/SIGPIPE) libc/SIG_IGN ; #t or #f
- function libc/sleep seconds¶
in C,
sleep (seconds)
a wrapper to libc sleep(3)- Param seconds:
seconds to sleep
- Type seconds:
unsigned fixnum or C/uint
- Return:
0 or the number of seconds left if interrupted
- Rtype:
C/uint
- function libc/stat pathname¶
in C,
stat (pathname)
a wrapper to libc stat(2)- Param pathname:
filename to stat
- Type pathname:
string
- Return:
- Rtype:
C/pointer
- Raises ^rt-libc-format-error:
if pathname contains an ASCII NUL
- Raises ^system-error:
- function libc/statvfs path¶
in C:
statvfs (path)
a wrapper to libc statvfs(3)- Param path:
filename to stat
- Type path:
string
- Return:
- Rtype:
C/pointer
- Raises ^rt-libc-format-error:
if path contains an ASCII NUL
- Raises ^system-error:
- function libc/strerrno errnum¶
return the error name of errnum
- Param errnum:
error number
- Type errnum:
C/int
- Return:
error name
- Rtype:
string
Identical to errno-name.
- function libc/strerror errnum¶
in C,
strerror (errnum)
a wrapper to libc strerror(3)- Param errnum:
error code to describe
- Type errnum:
C/int
- Return:
string describing errnum
- Rtype:
string
- Raises ^system-error:
- function libc/strftime format tm¶
in C,
strftime (format, tm)
a wrapper to libc strftime(3)- Param format:
format string
- Type format:
string
- Param tm:
time structure
- Type tm:
- Return:
formatted time
- Rtype:
string
- Raises ^rt-libc-format-error:
if format contains an ASCII NUL
Note
Internally,
libc/BUFSIZ
is used for the maximum string size
- function libc/strptime s format¶
in C,
strptime (s, format)
a wrapper to libc strptime(3)- Param s:
time string
- Type s:
string
- Param format:
format string
- Type format:
string
- Return:
time structure
- Rtype:
- Raises ^rt-libc-format-error:
if s or format contain an ASCII NUL
- function libc/strsignal sig¶
in C,
strsignal (sig)
a wrapper to libc strsignal(3)- Param sig:
signal number to describe
- Type sig:
C/int
- Return:
string describing sig
- Rtype:
string
On some systems (SunOS)
#n
may be returned for an invalid signal number.
- function libc/symlink target linkpath¶
in C:
symlink (target, linkpath)
a wrapper to libc symlink(2)- Param target:
existing file name
- Type target:
string
- Param linkpath:
new file name
- Type linkpath:
string
- Return:
0
- Rtype:
C/int
- Raises ^rt-libc-format-error:
if target or linkpath contain an ASCII NUL
- Raises ^system-error:
- function libc/symlinkat target newdirfd linkpath¶
in C:
symlinkat (target, newdirfd, linkpath)
a wrapper to libc symlinkat(2)- Param target:
existing file name
- Type target:
string
- Param newdirfd:
file descriptor for a directory
- Type newdirfd:
C/int
- Param linkpath:
new file name
- Type linkpath:
string
- Return:
0
- Rtype:
C/int
- Raises ^rt-libc-format-error:
if target or linkpath contain an ASCII NUL
- Raises ^system-error:
- function libc/sync¶
in C:
sync ()
a wrapper to libc sync(2)- Return:
#<unspec>
- function libc/tcgetattr fd¶
in C,
tcgetattr (fd, termiosp)
a wrapper to libc tcgetattr(3)- Param fd:
file descriptor
- Type fd:
C/int
- Return:
- Rtype:
C/pointer
- Raises ^system-error:
- function libc/tcgetpgrp fd¶
in C,
tcgetpgrp (fd)
a wrapper to libc tcgetpgrp(3)- Param fd:
file descriptor
- Type fd:
C/int
- Return:
Process ID
- Rtype:
libc/pid_t
- Raises ^system-error:
- function libc/tcsetattr fd options termios¶
in C,
tcsetattr (fd, options, termios)
a wrapper to libc tcsetattr(3)- Param fd:
file descriptor
- Type fd:
C/int
- Param options:
see below
- Type options:
C/int
- Param termios:
- Type termios:
C/pointer
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
The following options are defined:
libc/TCSADRAIN
libc/TCSAFLUSH
See also
tcgetattr for obtaining a struct-termios.
- function libc/tcsetpgrp fd pgrp¶
in C,
tcsetpgrp (fd, pgrp)
a wrapper to libc tcsetpgrp(3)- Param fd:
file descriptor
- Type fd:
C/int
- Param pgrp:
Process Group ID
- Type pgrp:
libc/pid_t
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
- function libc/time¶
in C,
time ()
a wrapper to libc time(2)- Return:
seconds since epoch
- Rtype:
libc/time_t
- Raises ^system-error:
- function libc/times¶
in C,
times ()
a wrapper to libc times(3)- Return:
(clock_t, struct-tms)
- Rtype:
list
- Raises ^system-error:
times(3) is complicated because we need to return the
struct tms
that the user would have passed in as a pointer and theclock_t
, elapsed real time, that times(3) returns.All fields are in clock ticks for which
sysconf(_SC_CLK_TCK)
is available for reference aslibc/CLK_TCK
.
- function libc/truncate path length¶
in C:
truncate (path, length)
a wrapper to libc truncate(2)- Param path:
file name
- Type path:
string
- Param length:
length
- Type length:
libc/off_t
- Return:
0
- Rtype:
C/int
- Raises ^rt-libc-format-error:
if path contains an ASCII NUL
- Raises ^system-error:
- function libc/ttyname fd¶
in C:
ttyname (fd)
a wrapper to libc ttyname(3)- Param fd:
terminal device file descriptor
- Type fd:
C/int
- Return:
pathname of the terminal device
- Rtype:
pathname
- Raises ^system-error:
- function libc/umask mask¶
in C:
umask (mask)
a wrapper to libc umask(2)- Param mask:
file mode creation mask
- Type mask:
libc/mode_t
- Return:
previous value
- Rtype:
libc/mode_t
- function libc/uname¶
in C,
uname (utsname)
a wrapper to libc uname(3)- Return:
- Rtype:
C/pointer
- Raises ^system-error:
Not strictly useful at the moment. You might want to use libc/idio-uname instead.
- function libc/unlink pathname¶
in C,
unlink (pathname)
a wrapper to libc unlink(2)- Param pathname:
filename to unlink
- Type pathname:
string
- Return:
0
- Rtype:
C/int
- Raises ^rt-libc-format-error:
if pathname contains an ASCII NUL
- Raises ^system-error:
- function libc/unlinkat dirfd pathname [flag ...]¶
in C:
unlinkat (dirfd, pathname, flags)
a wrapper to libc unlinkat(2)- Param dirfd:
file descriptor for a directory
- Type dirfd:
C/int
- Param pathname:
pathname
- Type pathname:
string
- Param flags:
see below, default none
- Type flags:
C/int, optional
- Return:
0
- Rtype:
C/int
- Raises ^rt-libc-format-error:
if pathname contains an ASCII NUL
- Raises ^system-error:
The following value can be used for dirfd:
AT_FDCWD
The following values are defined for flags, they can be
C/|
-bitwise OR’d together or passed as extra arguments:AT_REMOVEDIR
Note
unlinkat
is not available on all systems. Use theIDIO_NO_UNLINKAT
feature in cond-expand.
- function libc/unlockpt fd¶
in C,
unlockpt (fd)
a wrapper to libc unlockpt(3)- Param fd:
fd to unlockpt
- Type fd:
C/int
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
- function libc/utimes filename atime mtime¶
in C:
utimes (filename, (atime, mtime))
a wrapper to libc utimes(2)- Param filename:
filename
- Type filename:
string
- Param atime:
- Type atime:
C/pointer
- Param mtime:
- Type mtime:
C/pointer
- Return:
0
- Rtype:
C/int
- Raises ^system-error:
- function libc/wait¶
in C,
wait (status)
a wrapper to libc wait(2)- Return:
list of (pid, status)
- Rtype:
list of (libc/pid_t, C/pointer or
#n
)- Raises ^system-error:
status is a C/pointer to a C
int
.See also
WIFEXITED, WEXITSTATUS, WIFSIGNALED, WTERMSIG, WIFSTOPPED for functions to manipulate status.
- function libc/waitpid pid [options]¶
in C,
waitpid (pid, status[, options])
a wrapper to libc waitpid(2)- Param pid:
Process ID
- Type pid:
libc/pid_t
- Param options:
see below
- Type options:
C/int, optional
- Return:
list of (pid, status)
- Rtype:
list of (libc/pid_t, C/pointer or
#n
)- Raises ^system-error:
libc/WAIT_ANY
is defined as -1 for use as pid.The following options are defined:
libc/WNOHANG
libc/WUNTRACED
Options will be IORed together
status is a C/pointer to a C
int
.See also
WIFEXITED, WEXITSTATUS, WIFSIGNALED, WTERMSIG, WIFSTOPPED for functions to manipulate status.
Job Control calls
waitpid
withWAIT_ANY
(-1) andWNOHANG
which means we can get a variety of results. The value returned is always a list of two elements.If a child process has exited then
waitpid
returns(pid, status)
.If
pid
is not identified as a process in the list of known jobs then the Job Control code enters it into a stray pids table along with its status.If no child process has exited then
waitpid
returns(0, status)
.If
waitpid
errors thenIf the error is
ECHILD
then either the pid doesn’t exist, is not a child process or the disposition of theSIGCHLD
signal isSIG_IGN
.However,
waitpid
can look at the stray pids table and see if the queried pid exists and return that PID and its status.Otherwise we return
(0 #n)
.If the result is
EINTR
we can loop, re-invokingwaitpid
.Otherwise raise a
^system-error
.
- function libc/write fd str¶
in C,
write (fd, str)
a wrapper to libc write(2)- Param fd:
file descriptor
- Type fd:
C/int
- Param str:
string
- Type str:
string
- Return:
number of bytes written
- Rtype:
libc/ssize_t
- Raises ^system-error:
- function libc/WEXITSTATUS status¶
in C,
WEXITSTATUS (status)
a wrapper to libc macroWEXITSTATUS
, see waitpid(2)- Param status:
process status
- Type status:
C/pointer
- Return:
exit status of child
- Rtype:
C/int
- function libc/WIFEXITED status¶
in C,
WIFEXITED (status)
a wrapper to libc macroWIFEXITED
, see waitpid(2)- Param status:
process status
- Type status:
C/pointer
- Return:
#t
if the child exited normally or#f
- Rtype:
boolean
- function libc/WIFSIGNALED status¶
in C,
WIFSIGNALED (status)
a wrapper to libc macroWIFSIGNALED
, see waitpid(2)- Param status:
process status
- Type status:
C/pointer
- Return:
#t
if the child was terminated by a signal or#f
- Rtype:
boolean
- function libc/WIFSTOPPED status¶
in C,
WIFSTOPPED (status)
a wrapper to libc macroWIFSTOPPED
, see waitpid(2)- Param status:
process status
- Type status:
C/pointer
- Return:
#t
if the child was stopped by a signal or#f
- Rtype:
boolean
- function libc/WTERMSIG status¶
in C,
WTERMSIG (status)
a wrapper to libc macroWTERMSIG
, see waitpid(2)- Param status:
process status
- Type status:
C/pointer
- Return:
signal number that terminated child
- Rtype:
C/int
- function libc/S_ISBLK mode¶
does mode represent a block device?
- Param mode:
mode from stat(2)
- Type mode:
libc/mode_t
- Return:
#t
or#f
- Rtype:
boolean
- function libc/S_ISCHR mode¶
does mode represent a character device?
- Param mode:
mode from stat(2)
- Type mode:
libc/mode_t
- Return:
#t
or#f
- Rtype:
boolean
- function libc/S_ISDIR mode¶
does mode represent a directory?
- Param mode:
mode from stat(2)
- Type mode:
libc/mode_t
- Return:
#t
or#f
- Rtype:
boolean
- function libc/S_ISFIFO mode¶
does mode represent a FIFO?
- Param mode:
mode from stat(2)
- Type mode:
libc/mode_t
- Return:
#t
or#f
- Rtype:
boolean
- function libc/S_ISLNK mode¶
does mode represent a symbolic link?
- Param mode:
mode from stat(2)
- Type mode:
libc/mode_t
- Return:
#t
or#f
- Rtype:
boolean
- function libc/S_ISREG mode¶
does mode represent a regular file?
- Param mode:
mode from stat(2)
- Type mode:
libc/mode_t
- Return:
#t
or#f
- Rtype:
boolean
- function libc/S_ISSOCK mode¶
does mode represent a socket?
- Param mode:
mode from stat(2)
- Type mode:
libc/mode_t
- Return:
#t
or#f
- Rtype:
boolean
- function libc/stdin-fileno¶
return the file descriptor of the current input handle
- Return:
file descriptor or a list of a file descriptor
If the current input handle is a string handle then its contents are written to a temporary file and a file descriptor open to that file is returned as the head of a list.
The caller should close the file descriptor when the task is complete.
- function libc/stdout-fileno¶
return the file descriptor of the current output handle
- Return:
file descriptor or a list of a file descriptor
If the current output handle is a string handle then a temporary file is created and a file descriptor open to that file is returned as the head of a list.
When the task is complete, the caller should rewind the file pointer and read the contents of the file back in before closing the file descriptor.
- function libc/stderr-fileno¶
return the file descriptor of the current error handle
- Return:
file descriptor or a list of a file descriptor
If the current error handle is a string handle then a temporary file is created and a file descriptor open to that file is returned as the head of a list.
When the task is complete, the caller should rewind the file pointer and read the contents of the file back in before closing the file descriptor.
- function libc/make-tmp-dir [prefix]¶
create a temporary directory and return its name
- Param prefix:
prefix for directory name, defaults to
"idio-tmp-"
- Type prefix:
string, optional
- Return:
directory name
- Rtype:
pathname
The directory is created in a temporary directory (commonly
/tmp
).
- function libc/make-tmp-fd [prefix]¶
create a temporary file and return an open file descriptor to it
- Param prefix:
prefix for file name, defaults to
"idio-tmp-"
- Type prefix:
string, optional
- Return:
open file descriptor
- Rtype:
C/int
The file is created in a temporary directory (commonly
/tmp
). The file’s name is unlinked therefore the returned file descriptor is the only reference to the file.
- function libc/make-tmp-file [prefix]¶
create a temporary file and return its name
- Param prefix:
prefix for file name, defaults to
"idio-tmp-"
- Type prefix:
string, optional
- Return:
file name
- Rtype:
pathname
The file is created in a temporary directory (commonly
/tmp
).
- function libc/make-tmp-file-handle [prefix]¶
create a temporary file and return an open file handle to it
- Param prefix:
prefix for file name, defaults to
"idio-tmp-"
- Type prefix:
string, optional
- Return:
file handle
- Rtype:
handle
The file is created in a temporary directory (commonly
/tmp
).
- function libc/sig-name signum¶
return the short signal name of signum
- Param signum:
signal number
- Type signum:
C/int
- Return:
short signal name
- Rtype:
string
A short signal name would be
QUIT
orINT
.See also
signal-name for long signal names.
- function libc/signal-name signum¶
return the long signal name of signum
- Param signum:
signal number
- Type signum:
C/int
- Return:
long signal name
- Rtype:
string
A long signal name would be
SIGQUIT
orSIGINT
.See also
sig-name for short signal names.
- function libc/sig-names¶
return a list of
(number & short name)
pairs of known signals- Return:
association list of signal pairs
- Rtype:
list
A short signal name would be
QUIT
orINT
.See also
signal-names for long signal names.
- function libc/signal-names¶
return a list of
(number & long name)
pairs of known signals- Return:
map of signal pairs
- Rtype:
list
A long signal name would be
SIGQUIT
orSIGINT
.See also
sig-names for short signal names.
- function libc/errno-name errnum¶
return the error name of errnum
- Param errnum:
error number
- Type errnum:
C/int
- Return:
error name
- Rtype:
string
- function libc/errno-names¶
return a list of
(number & name)
pairs of known errno numbers- Return:
association list of errno pairs
- Rtype:
list
- function libc/rlimit-name rlim¶
return the string name of the getrlimit(2) C macro
- Param rlim:
the value of the macro
- Type rlim:
C/int
- Return:
a string
- Raises ^rt-parameter-type-error:
- function libc/rlimit-names¶
return a list of
(number & name)
pairs of the getrlimit(2) C macroseach pair is the C value and string name of the macro
- Return:
a list of pairs
- function libc/open-flag-names¶
return a list of the open(2) O_* flags
- Return:
a list of flag names
- function libc/make-poller [args]¶
Create a poller from args
- Param args:
see below
- Type args:
list
- Return:
poller
- Rtype:
C/pointer
- Raises ^rt-parameter-type-error:
Each element of args should be a list of
(fdh eventmask [eventmask ...])
where fdh can be an FD or an FD handle and eventmask can be aPOLL*
name or C/int derived from such names
- function libc/poller-register poller pollee¶
Add pollee to poller
- Param poller:
a poller from libc/make-poller
- Type poller:
C/pointer
- Param pollee:
see below
- Type pollee:
list
- Return:
#<unspec>
- Raises ^rt-parameter-type-error:
pollee should be a list of
(fdh eventmask [eventmask ...])
where fdh can be an FD or an FD handle and eventmask can be aPOLL*
name or C/int derived from such names
- function libc/poller-deregister poller fdh¶
Remove fdh from poller
- Param poller:
a poller from libc/make-poller
- Type poller:
C/pointer
- Param fdh:
an FD or FD handle
- Type fdh:
C/int or FD handle
- Return:
#<unspec>
- Raises ^rt-parameter-type-error:
- function libc/poller-poll poller [timeout]¶
Poll poller for timeout milliseconds
- Param poller:
a poller from libc/make-poller
- Type poller:
C/pointer
- Param timeout:
timeout in milliseconds, defaults to
#n
- Type timeout:
fixnum, bignum or C/int
- Return:
list of
(fdh event)
tuples or#n
- Rtype:
list
- Raises ^rt-parameter-type-error:
- Raises ^system-error:
- function libc/poll-name pollevent¶
return the string name of the poll(2) C macro
- Param pollevent:
the value of the macro
- Type pollevent:
C/int
- Return:
a symbol
- Raises ^rt-parameter-type-error:
- Raises ^rt-hash-key-not-found-error:
if pollevent not found
- function libc/poll-names¶
return a list of
(number & name)
pairs of the poll(2) C macroseach pair is the C value and string name of the macro
- Return:
a list of pairs
- function libc/proc-subst-named-pipe-from¶
return a (possibly named) pipe with pathnames for each end
- Return:
see below
- Rtype:
list
On /dev/fd supporting systems the return value is the four element list:
(rfd, wfd, rname, wname)
Otherwise the return value is the five element list:
(#f, #f, pipe-name, pipe-name, tmpdir)
- function libc/proc-subst-named-pipe-into¶
return a (possibly named) pipe with pathnames for each end
- Return:
see below
- Rtype:
list
On /dev/fd supporting systems the return value is the four element list:
(rfd, wfd, rname, wname)
Otherwise the return value is the five element list:
(#f, #f, pipe-name, pipe-name, tmpdir)
poll predicates¶
The C/int C macros, POLLIN
, POLLERR
, etc., are
managed as bitmasks in a C/short in poll(2)’s struct
pollfd
.
This is complicated because Idio doesn’t use a C/int of 0 (zero) as false and the C bitwise operators, C/&, etc., only operate on C/int types.
So a series of predicates exist which do the right thing, POLLIN?
will test that the bit-field represented by the C macro,
POLLIN
is set in the C/short argument.
When registering a file descriptor or file handle you can pass a list
of C/int values which will be OR-ed together into a C
short
. Later, the list of event results from poller-poll will have an revents
value which you can test
with these predicates:
fh := open-input-file ...
poller := libc/make-poller (list fh libc/POLLIN)
r := libc/poller-poll poller 1000
for p in r {
fdh := ph p
revents := pht p
(cond
((libc/POLLERR? revents) {
libc/poller-deregister poller fdh
})
((libc/POLLIN? revents) {
...
}))
}
Last built at 2024-05-17T06:10:51Z+0000 from 62cca4c (dev) for Idio 0.3.b.6