Common Lisp Package: IOLIB.OS

README:

FUNCTION

Public

CLEAR-ENVIRONMENT (&OPTIONAL ENV)

Removes all variables from an environment.

CURRENT-DIRECTORY

CURRENT-DIRECTORY returns the operating system's current directory, which may or may not correspond to *DEFAULT-FILE-PATH-DEFAULTS*.

SETFCURRENT-DIRECTORY (PATHSPEC)

SETF CURRENT-DIRECTORY changes the operating system's current directory to the PATHSPEC. An error is signalled if PATHSPEC is not a directory.

DIRECTORY-EXISTS-P (PATHSPEC)

Checks whether the file named by the file-path designator PATHSPEC exists and is a directory. Returns its truename if this is the case, NIL otherwise. Follows symbolic links.

ENVIRONMENT

Return the current global environment.

SETFENVIRONMENT (NEWENV)

SETF ENVIRONMENT replaces the contents of the global environment with that of its argument. Often it is preferable to use SETF ENVIRONMENT-VARIABLE and MAKUNBOUND-ENVIRONMENT-VARIABLE to modify the environment instead of SETF ENVIRONMENT.

ENVIRONMENT-VARIABLE (NAME &OPTIONAL ENV)

ENVIRONMENT-VARIABLE returns the environment variable identified by NAME, or NIL if one does not exist. NAME can either be a symbol or a string.

SETFENVIRONMENT-VARIABLE (VALUE NAME &OPTIONAL ENV &KEY (OVERWRITE T))

SETF ENVIRONMENT-VARIABLE sets the environment variable identified by NAME to VALUE. Both NAME and VALUE can be either a symbols or strings. Signals an error on failure.

FILE-EXISTS-P (PATHSPEC &OPTIONAL FILE-KIND)

Checks whether the file named by the file-path designator PATHSPEC exists, if this is the case and FILE-KIND is specified it also checks the file kind. If the tests succeed, return two values: truename and file kind of PATHSPEC, NIL otherwise. Follows symbolic links.

FILE-KIND (PATHSPEC &KEY FOLLOW-SYMLINKS)

Returns a keyword indicating the kind of file designated by PATHSPEC, or NIL if the file does not exist. Does not follow symbolic links by default. Possible file-kinds in addition to NIL are: :REGULAR-FILE, :SYMBOLIC-LINK, :DIRECTORY, :PIPE, :SOCKET, :CHARACTER-DEVICE, and :BLOCK-DEVICE. If FOLLOW-SYMLINKS is non-NIL and PATHSPEC designates a broken symlink returns :BROKEN as second value.

FILE-PERMISSIONS (PATHSPEC)

FILE-PERMISSIONS returns a list of keywords identifying the permissions of PATHSPEC. SETF FILE-PERMISSIONS sets the permissions of PATHSPEC as identified by the symbols in list. If PATHSPEC designates a symbolic link, that link is implicitly resolved. Permission symbols consist of :USER-READ, :USER-WRITE, :USER-EXEC, :GROUP-READ, :GROUP-WRITE, :GROUP-EXEC, :OTHER-READ, :OTHER-WRITE, :OTHER-EXEC, :SET-USER-ID, :SET-GROUP-ID, and :STICKY. Both signal an error if PATHSPEC doesn't designate an existing file.

LIST-DIRECTORY (PATHSPEC)

Returns a fresh list of file-paths corresponding to all files within the directory named by PATHSPEC.

MAKUNBOUND-ENVIRONMENT-VARIABLE (NAME &OPTIONAL ENV)

Removes the environment variable identified by NAME from the current environment. NAME can be either a string or a symbol. Returns the string designated by NAME. Signals an error on failure.

MAPDIR (FUNCTION PATHSPEC)

Applies function to each entry in directory designated by PATHSPEC in turn and returns a list of the results. Binds *DEFAULT-FILE-PATH-DEFAULTS* to the directory designated by pathspec round to function call. If PATHSPEC designates a symbolic link, it is implicitly resolved. Signals an error if PATHSPEC is not a directory.

REGULAR-FILE-EXISTS-P (PATHSPEC)

Checks whether the file named by the file-path designator PATHSPEC exists and is a regular file. Returns its truename if this is the case, NIL otherwise. Follows symbolic links.

RESOLVE-FILE-PATH (PATHSPEC &KEY (DEFAULTS *DEFAULT-FILE-PATH-DEFAULTS*) (CANONICALIZE T))

Returns an absolute file-path corresponding to PATHSPEC by merging it with DEFAULT, and (CURRENT-DIRECTORY) if necessary. If CANONICALIZE is non-NIL, the path is canonicalised: if it is :STRIP-DOTS, then just remove "." and "..", otherwise symlinks are resolved too.

USER-INFO (ID)

USER-INFO returns the password entry for the given name or numerical user ID, as an assoc-list.

WALK-DIRECTORY (DIRECTORY FN &KEY (IF-DOES-NOT-EXIST ERROR) FOLLOW-SYMLINKS (DIRECTORIES BEFORE) (MINDEPTH 1) (MAXDEPTH 65535) (TEST (CONSTANTLY T)) (KEY #'IDENTITY))

Recursively applies the function FN to all files within the directory named by the FILE-PATH designator DIRNAME and all of the files and directories contained within. Returns T on success.

Undocumented

ABSOLUTE-FILE-PATH (PATHSPEC &OPTIONAL (DEFAULTS *DEFAULT-FILE-PATH-DEFAULTS*))

CREATE-PROCESS (PROGRAM &OPTIONAL ARGUMENTS &KEY (SEARCH T) ENVIRONMENT)

DELETE-FILES (PATHSPEC &KEY RECURSIVE)

SETFFILE-PERMISSIONS (PERMS PATHSPEC)

PROCESS-KILL (PROCESS SIGNUM)

PROCESS-WAIT (PROCESS)

RUN-PROGRAM (PROGRAM &OPTIONAL ARGUMENTS &KEY (SEARCH T) ENVIRONMENT)

Private

Undocumented

%OBJ-CLEARENV (ENV)

%OBJ-GETENV (ENV NAME)

%OBJ-SETENV (ENV NAME VALUE OVERWRITE)

%OBJ-UNSETENV (ENV NAME)

ALLOCATE-ARGV (ARGV ARGC PROGRAM ARGLIST)

ALLOCATE-ENV (ARGV VARIABLES)

CALL-WITH-DIRECTORY-ITERATOR (PATHSPEC FN)

DEALLOCATE-NULL-ENDED-LIST (ARGV)

GET-FILE-KIND (FILE FOLLOW-P)

POSIX-SPAWN (PID PATH FILE-ACTIONS ATTRIBUTES ARGUMENTS ENVIRONMENT)

POSIX-SPAWN-FILE-ACTIONS-ADDCLOSE (FILE-ACTIONS FD)

POSIX-SPAWN-FILE-ACTIONS-ADDDUP2 (FILE-ACTIONS FD NEWFD)

POSIX-SPAWN-FILE-ACTIONS-ADDOPEN (FILE-ACTIONS FD PATH FLAGS MODE)

POSIX-SPAWN-FILE-ACTIONS-DESTROY (FILE-ACTIONS)

POSIX-SPAWN-FILE-ACTIONS-INIT (FILE-ACTIONS)

POSIX-SPAWNATTR-DESTROY (ATTRIBUTES)

POSIX-SPAWNATTR-GETFLAGS (ATTRIBUTES FLAGS)

POSIX-SPAWNATTR-GETPGROUP (ATTRIBUTES PGROUP)

POSIX-SPAWNATTR-GETSCHEDPARAM (ATTRIBUTES SCHEDPARAM)

POSIX-SPAWNATTR-GETSCHEDPOLICY (ATTRIBUTES SCHEDPOLICY)

POSIX-SPAWNATTR-GETSIGDEFAULT (ATTRIBUTES SIGDEFAULT)

POSIX-SPAWNATTR-GETSIGMASK (ATTRIBUTES SIGMASK)

POSIX-SPAWNATTR-INIT (ATTRIBUTES)

POSIX-SPAWNATTR-SETFLAGS (ATTRIBUTES FLAGS)

POSIX-SPAWNATTR-SETPGROUP (ATTRIBUTES PGROUP)

POSIX-SPAWNATTR-SETSCHEDPARAM (ATTRIBUTES SCHEDPARAM)

POSIX-SPAWNATTR-SETSCHEDPOLICY (ATTRIBUTES SCHEDPOLICY)

POSIX-SPAWNATTR-SETSIGDEFAULT (ATTRIBUTES SIGDEFAULT)

POSIX-SPAWNATTR-SETSIGMASK (ATTRIBUTES SIGMASK)

POSIX-SPAWNP (PID FILE FILE-ACTIONS ATTRIBUTES ARGUMENTS ENVIRONMENT)

SPLIT-ROOT/NODES (DIR)

STRIP-DOTS (PATH)

MACRO

Public

WITH-DIRECTORY-ITERATOR ((ITERATOR PATHSPEC) &BODY BODY)

PATHSPEC must be a valid directory designator: *DEFAULT-FILE-PATH-DEFAULTS* is bound, and (CURRENT-DIRECTORY) is set to the designated directory for the dynamic scope of the body. Within the lexical scope of the body, ITERATOR is defined via macrolet such that successive invocations of (ITERATOR) return the directory entries, one by one. Both files and directories are returned, except '.' and '..'. The order of entries is not guaranteed. The entries are returned as relative file-paths against the designated directory. Entries that are symbolic links are not resolved, but links that point to directories are interpreted as directory designators. Once all entries have been returned, further invocations of (ITERATOR) will all return NIL. The value returned is the value of the last form evaluated in body. Signals an error if PATHSPEC is not a directory.

Undocumented

WITH-CURRENT-DIRECTORY (PATHSPEC &BODY BODY)

Private

Undocumented

DEFSYSCALL (NAME-AND-OPTS RETURN-TYPE &BODY ARGS)

WITH-3-PIPES ((STDIN-R STDIN-W STDOUT-R STDOUT-W STDERR-R STDERR-W) &BODY BODY)

WITH-ARGV ((ARGV PROGRAM ARGUMENTS) &BODY BODY)

WITH-C-ENVIRONMENT ((ENVIRONMENT) &BODY BODY)

WITH-POSIX-SPAWN-ARGUMENTS ((ATTRIBUTES FILE-ACTIONS PID) &BODY BODY)

SLOT-ACCESSOR

Public

Undocumented

PROCESS-PID (OBJECT)

PROCESS-STDERR (OBJECT)

PROCESS-STDIN (OBJECT)

PROCESS-STDOUT (OBJECT)

Private

Undocumented

ENVIRONMENT-VARIABLES (OBJECT)

SETFENVIRONMENT-VARIABLES (NEW-VALUE OBJECT)

VARIABLE

Public

Undocumented

*TEMPORARY-DIRECTORY*

CLASS

Public

Undocumented

ENVIRONMENT

PROCESS

Private

Undocumented

POSIX-SPAWN-FILE-ACTIONS-T-TCLASS

POSIX-SPAWNATTR-T-TCLASS

CONSTANT

Private

Undocumented

+PERMISSIONS+

+STDERR+

+STDIN+

+STDOUT+

FD-CLOEXEC

POSIX-SPAWN-RESETIDS

POSIX-SPAWN-SETPGROUP

POSIX-SPAWN-SETSCHEDPARAM

POSIX-SPAWN-SETSCHEDULER

POSIX-SPAWN-SETSIGDEF

POSIX-SPAWN-SETSIGMASK

SIZE-OF-MODE-T

SIZE-OF-PID-T

SIZE-OF-POSIX-SPAWN-FILE-ACTIONS-T

SIZE-OF-POSIX-SPAWNATTR-T