The Standard ML Basis Library

The OS structure


signature OS
structure OS :> OS

The OS structure is a container for a collection of structures for interacting with the operating system's file system, directory paths, processes, and I/O subsystem. The types and functions provided by the OS substructures are meant to present a model for handling these resources that is largely independent of the operating system.

The structure also declares the SysErr exception used to report operating system error conditions.


structure FileSys : OS_FILE_SYS
structure IO : OS_IO
structure Path : OS_PATH
structure Process : OS_PROCESS

eqtype syserror

exception SysErr of string * syserror option

val errorMsg : syserror -> string
val errorName : syserror -> string
val syserror  : string -> syserror option


structure FileSys : OS_FILE_SYS
File system: files and directories and their attributes.

structure IO : OS_IO
I/O polling.

structure Path : OS_PATH
Syntactic manipulation of pathnames.

structure Process : OS_PROCESS
Process control, exit status, and environment.

eqtype syserror
The type representing errors that arise when making calls to the run-time or operating system. These values are usually transmitted by the SysErr exception.

exception SysErr of string * syserror option
This exception is raised when a call to the runtime system or host operating system results in an error. The first argument is a descriptive string explaining the error, and the second argument optionally specifies the system error condition. The form and content of the description strings are operating system and implementation dependent, but if a SysErr exception has the form SysErr(s,SOME e), then we have errorMsg e = s. System errors that do not have corresponding syserror value will result in SysErr being raised with a second argument of NONE.

errorMsg err
returns a string describing the system error identified by the error code err. The form and content of the description strings are operating system and implementation dependent.

errorName err
syserror s
These functions provide conversions between the abstract syserror type, and their operating system dependent string names. The primary purpose of these functions is to provide a mechanism for dealing with error codes that might not have symbolic names defined for them in the operating system specific modules. The former function returns a unique name used for the syserror value, while the latter returns the syserror whose name is s, if it exists. If e is a syserror, then it should be the case that
SOME e = syserror(errorName e)

See Also

OS.FileSys, OS.IO, OS.Path, OS.Process

[ Top | Parent | Contents | Index | Root ]

Generated April 12, 2004
Last Modified April 19, 1996
Comments to John Reppy.

This document may be distributed freely over the internet as long as the copyright notice and license terms below are prominently displayed within every machine-readable copy.

Copyright © 2004 AT&T and Lucent Technologies. All rights reserved.

Permission is granted for internet users to make one paper copy for their own personal use. Further hardcopy reproduction is strictly prohibited. Permission to distribute the HTML document electronically on any medium other than the internet must be requested from the copyright holders by contacting the editors. Printed versions of the SML Basis Manual are available from Cambridge University Press. To order, please visit (North America) or (outside North America).