

api {
package error : api {
eqtype System_Error ;
to_unt : System_Error -> one_word_unt::Unt;
from_unt : one_word_unt::Unt -> System_Error;
error_msg : System_Error -> String;
error_name : System_Error -> String;
syserror : String -> Null_Or(System_Error );
toobig : System_Error;
acces : System_Error;
again : System_Error;
badf : System_Error;
badmsg : System_Error;
busy : System_Error;
canceled : System_Error;
child : System_Error;
deadlk : System_Error;
dom : System_Error;
exist : System_Error;
fault : System_Error;
fbig : System_Error;
inprogress : System_Error;
intr : System_Error;
inval : System_Error;
io : System_Error;
isdir : System_Error;
loop : System_Error;
mfile : System_Error;
mlink : System_Error;
msgsize : System_Error;
name_too_long : System_Error;
nfile : System_Error;
nodev : System_Error;
noent : System_Error;
noexec : System_Error;
nolck : System_Error;
nomem : System_Error;
nospc : System_Error;
nosys : System_Error;
notdir : System_Error;
notempty : System_Error;
notsup : System_Error;
notty : System_Error;
nxio : System_Error;
perm : System_Error;
pipe : System_Error;
range : System_Error;
rofs : System_Error;
spipe : System_Error;
srch : System_Error;
xdev : System_Error;
};;
package signal : api {
eqtype Signal ;
to_unt : Signal -> one_word_unt::Unt;
from_unt : one_word_unt::Unt -> Signal;
abrt : Signal;
alrm : Signal;
fpe : Signal;
hup : Signal;
ill : Signal;
int : Signal;
kill : Signal;
pipe : Signal;
quit : Signal;
segv : Signal;
term : Signal;
usr1 : Signal;
usr2 : Signal;
chld : Signal;
cont : Signal;
stop : Signal;
tstp : Signal;
ttin : Signal;
ttou : Signal;
bus : Signal;
};;
package tty : api {
eqtype Process_Id ;
eqtype File_Descriptor ;
package i : api {
eqtype Flags ;
to_unt : Flags -> one_word_unt::Unt;
from_unt : one_word_unt::Unt -> Flags;
all : Flags;
flags : List(Flags ) -> Flags;
intersect : List(Flags ) -> Flags;
clear : (Flags , Flags) -> Flags;
all_set : (Flags , Flags) -> Bool;
any_set : (Flags , Flags) -> Bool;
brkint : Flags;
icrnl : Flags;
ignbrk : Flags;
igncr : Flags;
ignpar : Flags;
inlcr : Flags;
inpck : Flags;
istrip : Flags;
ixoff : Flags;
ixon : Flags;
parmrk : Flags;
};;
package o : api {
eqtype Flags ;
to_unt : Flags -> one_word_unt::Unt;
from_unt : one_word_unt::Unt -> Flags;
all : Flags;
flags : List(Flags ) -> Flags;
intersect : List(Flags ) -> Flags;
clear : (Flags , Flags) -> Flags;
all_set : (Flags , Flags) -> Bool;
any_set : (Flags , Flags) -> Bool;
opost : Flags;
};;
package c : api {
eqtype Flags ;
to_unt : Flags -> one_word_unt::Unt;
from_unt : one_word_unt::Unt -> Flags;
all : Flags;
flags : List(Flags ) -> Flags;
intersect : List(Flags ) -> Flags;
clear : (Flags , Flags) -> Flags;
all_set : (Flags , Flags) -> Bool;
any_set : (Flags , Flags) -> Bool;
clocal : Flags;
cread : Flags;
csize : Flags;
cs5 : Flags;
cs6 : Flags;
cs7 : Flags;
cs8 : Flags;
cstopb : Flags;
hupcl : Flags;
parenb : Flags;
parodd : Flags;
};;
package l : api {
eqtype Flags ;
to_unt : Flags -> one_word_unt::Unt;
from_unt : one_word_unt::Unt -> Flags;
all : Flags;
flags : List(Flags ) -> Flags;
intersect : List(Flags ) -> Flags;
clear : (Flags , Flags) -> Flags;
all_set : (Flags , Flags) -> Bool;
any_set : (Flags , Flags) -> Bool;
echo : Flags;
echoe : Flags;
echok : Flags;
echonl : Flags;
icanon : Flags;
iexten : Flags;
isig : Flags;
noflsh : Flags;
tostop : Flags;
};;
package v : api {
eof : Int;
eol : Int;
erase : Int;
intr : Int;
kill : Int;
min : Int;
quit : Int;
susp : Int;
time : Int;
start : Int;
stop : Int;
nccs : Int;
Cc ;
cc : List(((Int , Char)) ) -> Cc;
update : (Cc , List(((Int , Char)) )) -> Cc;
sub : (Cc , Int) -> Char;
};;
eqtype Speed ;
compare_speed : (Speed , Speed) -> Order;
speed_to_unt : Speed -> one_word_unt::Unt;
unt_to_speed : one_word_unt::Unt -> Speed;
b0 : Speed;
b50 : Speed;
b75 : Speed;
b110 : Speed;
b134 : Speed;
b150 : Speed;
b200 : Speed;
b300 : Speed;
b600 : Speed;
b1200 : Speed;
b1800 : Speed;
b2400 : Speed;
b4800 : Speed;
b9600 : Speed;
b19200 : Speed;
b38400 : Speed;
Termios ;
termios : {cc:v::Cc, cflag:c::Flags, iflag:i::Flags,
ispeed:Speed, lflag:l::Flags, oflag:o::Flags,
ospeed:Speed}
-> Termios;
fields_of : Termios
-> {cc:v::Cc, cflag:c::Flags, iflag:i::Flags,
ispeed:Speed, lflag:l::Flags, oflag:o::Flags,
ospeed:Speed};
getiflag : Termios -> i::Flags;
getoflag : Termios -> o::Flags;
getcflag : Termios -> c::Flags;
getlflag : Termios -> l::Flags;
getcc : Termios -> v::Cc;
getospeed : Termios -> Speed;
setospeed : (Termios , Speed) -> Termios;
getispeed : Termios -> Speed;
setispeed : (Termios , Speed) -> Termios;
package tc : api {
eqtype Set_Action ;
sanow : Set_Action;
sadrain : Set_Action;
saflush : Set_Action;
eqtype Flow_Action ;
ooff : Flow_Action;
oon : Flow_Action;
ioff : Flow_Action;
ion : Flow_Action;
eqtype Queue_Sel ;
iflush : Queue_Sel;
oflush : Queue_Sel;
ioflush : Queue_Sel;
};;
getattr : File_Descriptor -> Termios;
setattr : (File_Descriptor , tc::Set_Action , Termios) -> Void;
sendbreak : (File_Descriptor , Int) -> Void;
drain : File_Descriptor -> Void;
flush : (File_Descriptor , tc::Queue_Sel) -> Void;
flow : (File_Descriptor , tc::Flow_Action) -> Void;
getpgrp : File_Descriptor -> Process_Id;
setpgrp : (File_Descriptor , Process_Id) -> Void;
};;
eqtype Signal ;
eqtype Process_Id ;
unt_to_pid : one_word_unt::Unt -> Process_Id;
pid_to_unt : Process_Id -> one_word_unt::Unt;
fork : Void -> Null_Or(Process_Id );
exec : (String , List(String )) -> X;
exece : (String , List(String ) , List(String )) -> X;
execp : (String , List(String )) -> X;
Waitpid_Arg
= W_ANY_CHILD
| W_CHILD Process_Id
| W_GROUP Process_Id
| W_SAME_GROUP;
Exit_Status
= W_EXITED
| W_EXITSTATUS one_byte_unt::Unt
| W_SIGNALED Signal
| W_STOPPED Signal;
from_status : Int -> Exit_Status;
package w : api {
eqtype Flags ;
to_unt : Flags -> one_word_unt::Unt;
from_unt : one_word_unt::Unt -> Flags;
all : Flags;
flags : List(Flags ) -> Flags;
intersect : List(Flags ) -> Flags;
clear : (Flags , Flags) -> Flags;
all_set : (Flags , Flags) -> Bool;
any_set : (Flags , Flags) -> Bool;
untraced : Flags;
};;
wait : Void -> (Process_Id , Exit_Status);
waitpid : (Waitpid_Arg , List(w::Flags ))
-> (Process_Id , Exit_Status);
waitpid_nh : (Waitpid_Arg , List(w::Flags ))
-> Null_Or(((Process_Id , Exit_Status)) );
exit : one_byte_unt::Unt -> X;
Killpid_Arg
= K_GROUP Process_Id | K_PROC Process_Id | K_SAME_GROUP;
kill : (Killpid_Arg , Signal) -> Void;
alarm : time::Time -> time::Time;
pause : Void -> Void;
sleep : time::Time -> time::Time;
eqtype User_Id ;
eqtype Group_Id ;
eqtype File_Descriptor ;
fd_to_int : File_Descriptor -> Int;
int_to_fd : Int -> File_Descriptor;
fd_to_iod : File_Descriptor -> Int;
iod_to_fd : Int -> File_Descriptor;
Directory_Stream ;
open_directory_stream : String -> Directory_Stream;
read_directory_entry : Directory_Stream -> Null_Or(String );
rewind_directory_stream : Directory_Stream -> Void;
close_directory_stream : Directory_Stream -> Void;
change_directory : String -> Void;
current_directory : Void -> String;
stdin : File_Descriptor;
stdout : File_Descriptor;
stderr : File_Descriptor;
package s : api {
Mode ;
Flags = Mode;
to_unt : Flags -> one_word_unt::Unt;
from_unt : one_word_unt::Unt -> Flags;
all : Flags;
flags : List(Flags ) -> Flags;
intersect : List(Flags ) -> Flags;
clear : (Flags , Flags) -> Flags;
all_set : (Flags , Flags) -> Bool;
any_set : (Flags , Flags) -> Bool;
irwxu : Mode;
irusr : Mode;
iwusr : Mode;
ixusr : Mode;
irwxg : Mode;
irgrp : Mode;
iwgrp : Mode;
ixgrp : Mode;
irwxo : Mode;
iroth : Mode;
iwoth : Mode;
ixoth : Mode;
isuid : Mode;
isgid : Mode;
};;
mode_0755 : s::Mode;
mode_0700 : s::Mode;
mode_0666 : s::Mode;
mode_0644 : s::Mode;
mode_0600 : s::Mode;
package o : api {
eqtype Flags ;
to_unt : Flags -> one_word_unt::Unt;
from_unt : one_word_unt::Unt -> Flags;
all : Flags;
flags : List(Flags ) -> Flags;
intersect : List(Flags ) -> Flags;
clear : (Flags , Flags) -> Flags;
all_set : (Flags , Flags) -> Bool;
any_set : (Flags , Flags) -> Bool;
append : Flags;
dsync : Flags;
excl : Flags;
noctty : Flags;
nonblock : Flags;
rsync : Flags;
sync : Flags;
trunc : Flags;
};;
Open_Mode = O_RDONLY | O_RDWR | O_WRONLY;
openf : (String , Open_Mode , o::Flags) -> File_Descriptor;
createf : (String , Open_Mode , o::Flags , s::Mode)
-> File_Descriptor;
creat : (String , s::Mode) -> File_Descriptor;
umask : s::Mode -> s::Mode;
link : {new:String, old:String} -> Void;
mkstemp : Void -> File_Descriptor;
mkdir : (String , s::Mode) -> Void;
make_named_pipe : (String , s::Mode) -> Void;
unlink : String -> Void;
rmdir : String -> Void;
rename : {from:String, to:String} -> Void;
symlink : {new:String, old:String} -> Void;
readlink : String -> String;
ftruncate : (File_Descriptor , Int) -> Void;
eqtype Device ;
unt_to_dev : one_word_unt::Unt -> Device;
dev_to_unt : Device -> one_word_unt::Unt;
eqtype Inode ;
unt_to_ino : one_word_unt::Unt -> Inode;
ino_to_unt : Inode -> one_word_unt::Unt;
package stat : api {
Stat = {atime:time::Time, ctime:time::Time, dev:Int,
ftype:Int, gid:one_word_unt::Unt, inode:Int,
mode:s::Flags, mtime:time::Time, nlink:Int,
size:Int, uid:one_word_unt::Unt};
is_directory : Stat -> Bool;
is_char_dev : Stat -> Bool;
is_block_dev : Stat -> Bool;
is_file : Stat -> Bool;
is_pipe : Stat -> Bool;
is_symlink : Stat -> Bool;
is_socket : Stat -> Bool;
mode : Stat -> s::Mode;
inode : Stat -> Int;
dev : Stat -> Int;
nlink : Stat -> Int;
uid : Stat -> User_Id;
gid : Stat -> Group_Id;
size : Stat -> Int;
atime : Stat -> time::Time;
mtime : Stat -> time::Time;
ctime : Stat -> time::Time;
};;
stat : String -> stat::Stat;
lstat : String -> stat::Stat;
fstat : File_Descriptor -> stat::Stat;
Access_Mode = MAY_EXECUTE | MAY_READ | MAY_WRITE;
access : (String , List(Access_Mode )) -> Bool;
chmod : (String , s::Mode) -> Void;
fchmod : (File_Descriptor , s::Mode) -> Void;
chown : (String , User_Id , Group_Id) -> Void;
fchown : (File_Descriptor , User_Id , Group_Id) -> Void;
utime : (String
, Null_Or({actime:time::Time, modtime:time::Time} ))
-> Void;
pathconf : (String , String) -> Null_Or(one_word_unt::Unt );
fpathconf : (File_Descriptor , String)
-> Null_Or(one_word_unt::Unt );
make_pipe : Void -> {infd:File_Descriptor, outfd:File_Descriptor};
dup : File_Descriptor -> File_Descriptor;
dup2 : {new:File_Descriptor, old:File_Descriptor} -> Void;
close : File_Descriptor -> Void;
read_as_vector : {file_descriptor:File_Descriptor,
max_bytes_to_read:Int}
-> vector_of_one_byte_unts::Vector;
read_into_buffer : {buffer:rw_vector_slice_of_one_byte_unts::Slice,
file_descriptor:File_Descriptor}
-> Int;
write_vector : (File_Descriptor , vector_slice_of_one_byte_unts::Slice)
-> Int;
write_rw_vector : (File_Descriptor , rw_vector_slice_of_one_byte_unts::Slice)
-> Int;
Whence = SEEK_CUR | SEEK_END | SEEK_SET;
package fd : api {
eqtype Flags ;
to_unt : Flags -> one_word_unt::Unt;
from_unt : one_word_unt::Unt -> Flags;
all : Flags;
flags : List(Flags ) -> Flags;
intersect : List(Flags ) -> Flags;
clear : (Flags , Flags) -> Flags;
all_set : (Flags , Flags) -> Bool;
any_set : (Flags , Flags) -> Bool;
cloexec : Flags;
};;
package flags : api {
eqtype Flags ;
to_unt : Flags -> one_word_unt::Unt;
from_unt : one_word_unt::Unt -> Flags;
all : Flags;
flags : List(Flags ) -> Flags;
intersect : List(Flags ) -> Flags;
clear : (Flags , Flags) -> Flags;
all_set : (Flags , Flags) -> Bool;
any_set : (Flags , Flags) -> Bool;
append : Flags;
nonblock : Flags;
sync : Flags;
rsync : Flags;
dsync : Flags;
};;
dupfd : {base:File_Descriptor, old:File_Descriptor}
-> File_Descriptor;
getfd : File_Descriptor -> fd::Flags;
setfd : (File_Descriptor , fd::Flags) -> Void;
getfl : File_Descriptor
-> (flags::Flags , ?.posix_common::Open_Mode);
setfl : (File_Descriptor , flags::Flags) -> Void;
lseek : (File_Descriptor , Int , Whence) -> Int;
fsync : File_Descriptor -> Void;
Lock_Type = F_RDLCK | F_UNLCK | F_WRLCK;
package flock : api {
Flock ;
flock : {len:Int, ltype:Lock_Type,
pid:Null_Or(Process_Id ), start:Int,
whence:Whence}
-> Flock;
ltype : Flock -> Lock_Type;
whence : Flock -> Whence;
start : Flock -> Int;
len : Flock -> Int;
pid : Flock -> Null_Or(Process_Id );
};;
getlk : (File_Descriptor , flock::Flock) -> flock::Flock;
setlk : (File_Descriptor , flock::Flock) -> flock::Flock;
setlkw : (File_Descriptor , flock::Flock) -> flock::Flock;
make_data_filereader : {file_descriptor:File_Descriptor, filename:String,
ok_to_block:Bool}
-> winix_base_data_file_io_driver_for_posix::Filereader;
make_text_filereader : {file_descriptor:File_Descriptor, filename:String,
ok_to_block:Bool}
-> winix_base_text_file_io_driver_for_posix::Filereader;
make_data_filewriter : {append_mode:Bool, best_io_quantum:Int,
file_descriptor:File_Descriptor, filename:String,
ok_to_block:Bool}
-> winix_base_data_file_io_driver_for_posix::Filewriter;
make_text_filewriter : {append_mode:Bool, best_io_quantum:Int,
file_descriptor:File_Descriptor, filename:String,
ok_to_block:Bool}
-> winix_base_text_file_io_driver_for_posix::Filewriter;
package passwd : api {
Passwd ;
name : Passwd -> String;
uid : Passwd -> User_Id;
gid : Passwd -> Group_Id;
home : Passwd -> String;
shell : Passwd -> String;
};;
package group : api {
Group ;
name : Group -> String;
gid : Group -> Group_Id;
members : Group -> List(String );
};;
getgrgid : Group_Id -> group::Group;
getgrnam : String -> group::Group;
getpwuid : User_Id -> passwd::Passwd;
getpwnam : String -> passwd::Passwd;
uid_to_unt : User_Id -> one_word_unt::Unt;
unt_to_uid : one_word_unt::Unt -> User_Id;
gid_to_unt : Group_Id -> one_word_unt::Unt;
unt_to_gid : one_word_unt::Unt -> Group_Id;
get_process_id : Void -> Int;
get_process_id' : Void -> Process_Id;
get_parent_process_id : Void -> Int;
get_parent_process_id' : Void -> Process_Id;
get_user_id : Void -> Int;
get_user_id' : Void -> User_Id;
get_effective_user_id : Void -> Int;
get_effective_user_id' : Void -> User_Id;
get_group_id : Void -> Int;
get_group_id' : Void -> Group_Id;
get_effective_group_id : Void -> Int;
get_effective_group_id' : Void -> Group_Id;
set_user_id : Int -> Void;
set_user_id' : User_Id -> Void;
set_group_id : Int -> Void;
set_group_id' : Group_Id -> Void;
get_group_ids : Void -> List(Int );
get_group_ids' : Void -> List(Group_Id );
get_login : Void -> String;
get_process_group : Void -> Int;
get_process_group' : Void -> Process_Id;
set_session_id : Void -> Int;
set_session_id' : Void -> Process_Id;
set_process_group_id : (Int , Int) -> Void;
set_process_group_id' : {pgid:Null_Or(Process_Id ),
pid:Null_Or(Process_Id )}
-> Void;
uname : Void -> List(((String , String)) );
time : Void -> one_word_int::Int;
time' : Void -> time::Time;
times : Void
-> {cstime:time::Time, cutime:time::Time,
elapsed:time::Time, stime:time::Time,
utime:time::Time};
getenv : String -> Null_Or(String );
environment : Void -> List(String );
ctermid : Void -> String;
ttyname : File_Descriptor -> String;
isatty : File_Descriptor -> Bool;
sysconf : String -> one_word_unt::Unt;
};
The following information is manually maintained and may contain errors.
The Posix_1003_1b api is implemented by the posix_1003_1b package.
The Posix_1003_1b api source code is in src/lib/std/src/posix-1003.1b/posix-1003-1b.api.

