[comp.os.minix] /usr/man/cat2/*

tholm@uvicctr.UUCP (Terrence W. Holm) (07/08/88)

EFTH Minix report #25  - July 1988 -  /usr/man/cat2/*


Our section 2 "man" pages are included. Please enjoy.

Also, please report mistakes.


--------------------------------------------------------------------
echo x - _exit.2
gres '^X' '' > _exit.2 << '/'
XSYSTEM CALLS
X    _exit(2)		- terminate this process
X
XINVOCATION
X    _exit( code )
X      int code;
X
XEXPLANATION
X    _exit(2) closes all open descriptors.  Any children
X    are inherited by "init".  The process terminates.
X    Files opened using the stdio library are not flushed.
X
X    This call is generally not used directly by a user's
X    program, exit(3) is the preferred interface.
X
XRESULTS
X    The parent may receive the lower byte of <code> by
X    using wait(2).
X
XREFERENCES
X    wait(2), exit(3)
X
XPROBLEMS
X    POSIX states that _exit(2) and exit(3) should perform
X    the same operation.
/
echo x - access.2
gres '^X' '' > access.2 << '/'
XSYSTEM CALLS
X    access(2)		- do I have access to a file
X
XINVOCATION
X    #include <unistd.h>
X
X    int access( file_name, type )
X      char *file_name;
X      int   type;
X
XEXPLANATION
X    Access(2) determines if the <file_name> is accessible
X    according to the real user and group id's of the current
X    process. The <type> of access required is specified by
X    OR'ing R_OK, W_OK and X_OK which corresponds to the "rwx"
X    protection bits. If <type> is F_OK, then access(2) only
X    checks for the existence of the file.
X
XRESULTS
X     0 : File is accessible according to <type>.
X    -1 : File is not accessible.
/
echo x - alarm.2
gres '^X' '' > alarm.2 << '/'
XSYSTEM CALLS
X    alarm(2)		- send me a timeout signal in a while
X
XINVOCATION
X    unsigned alarm( secs )
X      unsigned secs;
X
XEXPLANATION
X    After <secs> seconds, the caller will be interrupted with
X    the signal SIGALRM. If <secs> is zero, then the alarm is
X    turned off.
X
XRESULTS
X    Returns the time that was left if the alarm was currently
X    running.
X
XREFERENCES
X    signal(2), sleep(3)
/
echo x - brk.2
gres '^X' '' > brk.2 << '/'
XSYSTEM CALLS
X    brk(2)		- set the data space size
X
XEXPLANATION
X    Brk(2) and sbrk() are used to change the size of
X    the area used for data allocation. These are never
X    to be used directly by a user's program.
X
XREFERENCES
X    malloc(3)
/
echo x - chdir.2
gres '^X' '' > chdir.2 << '/'
XSYSTEM CALLS
X    chdir(2)		- change directory
X
XINVOCATION
X    chdir( dir_name )
X      char *dir_name;
X
XEXPLANATION
X    The working directory is set to <dir_name>.
X
XRESULTS
X     0 : Ok.
X    -1 : Error.
/
echo x - chmod.2
gres '^X' '' > chmod.2 << '/'
XSYSTEM CALLS
X    chmod(2)		- set the protection for a file
X
XINVOCATION
X    #include <sys/types.h>
X    #include <stat.h>
X
X    chmod( file_name, perm )
X      char *file_name;
X      int   perm;
X
XEXPLANATION
X    Chmod(2) sets the protection for <file_name>. The caller must
X    either be the owner of the file, or the super-user.
X
X    <perm> represents the bits "ug-rwxrwxrwx", where "u" is the
X    "set UID bit", "g" is the "set GID bit", and the rest are
X    three sets of READ/WRITE/EXECUTE permissions for the USER,
X    GROUP and OTHERS respectively.
X
XRESULTS
X     0 : Ok.
X    -1 : Error.
/
echo x - chown.2
gres '^X' '' > chown.2 << '/'
XSYSTEM CALLS
X    chown(2)		- set the owner for a file
X
XINVOCATION
X    chown( file_name, owner, group )
X      char *file_name;
X      int   owner;
X      int   group;
X
XEXPLANATION
X    Chown(2) sets the <owner> and <group> for a file.
X    Only the super-user may use this call.
X
XRESULTS
X     0 : Ok.
X    -1 : Error.
/
echo x - chroot.2
gres '^X' '' > chroot.2 << '/'
XSYSTEM CALLS
X    chroot(2)		- change the root directory
X
XINVOCATION
X    chroot( dir_name )
X      char *dir_name;
X
XEXPLANATION
X    The root directory ("/") is set to <dir_name>. Only
X    the super-user may change the root directory.
X
XRESULTS
X     0 : Ok.
X    -1 : Error.
/
echo x - close.2
gres '^X' '' > close.2 << '/'
XSYSTEM CALLS
X    close(2)		- deallocate a descriptor
X
XINVOCATION
X    close( desc )
X      int desc;
X
XEXPLANATION
X    Deallocates the file descriptor <desc>.
X
XRESULTS
X     0 : Ok.
X    -1 : Error.
X
XREFERENCES
X    open(2), fclose(3)
/
echo x - creat.2
gres '^X' '' > creat.2 << '/'
XSYSTEM CALLS
X    creat(2)		- create a file
X
XINVOCATION
X    #include <sys/types.h>
X    #include <stat.h>
X
X    int creat( file_name, perm )
X      char *file_name;
X      int   perm;
X
XEXPLANATION
X    If <file_name> does not exist, then it is created with
X    the permissions <perm>. If <file_name> exists, then
X    it is truncated.
X
XRESULTS
X    >=0 : The descriptor for writing on the file.
X     -1 : Error.
X
XREFERENCES
X    chmod(2), open(2), umask(2), fopen(3)
/
echo x - dup.2
gres '^X' '' > dup.2 << '/'
XSYSTEM CALLS
X    dup(2)		- make another descriptor
X
XINVOCATION
X    int dup( desc )
X      int  desc;
X
XEXPLANATION
X    The descriptor <desc> is duplicated.
X
XRESULTS
X    >=0 : The new descriptor.
X     -1 : Error.
X
XREFERENCES
X    close(2), dup2(2), open(2)
/
echo x - dup2.2
gres '^X' '' > dup2.2 << '/'
XSYSTEM CALLS
X    dup2(2)		- make another descriptor
X
XINVOCATION
X    dup2( desc, new )
X      int  desc;
X      int  new;
X
XEXPLANATION
X    The descriptor <desc> is duplicated as descriptor <new>.
X    A close(2) is performed on <new> if it was in use.
X
XRESULTS
X    >=0 : The new descriptor.
X     -1 : Error.
X
XREFERENCES
X    close(2), dup(2), open(2)
/
echo x - execve.2
gres '^X' '' > execve.2 << '/'
XSYSTEM CALLS
X    execve(2)     	- load a process image from a file
X
XINVOCATION
X    execve( name, argv, envp )
X      char *name;
X      char *argv[];
X      char *envp[];
X
XEXPLANATION
X    <name> is the path name of the file which contains the process
X    image. <argv> points to a vector of pointers to strings which
X    are to be passed as arguments, the first argument is generally
X    the same the last component in <name>. <envp> points to the
X    environment, see environ(4).
X
X    The new process begins with the following, where <argc> is the
X    number of arguments in <argv>. The global variable <environ> is
X    the same as <envp>.
X
X        main( argc, argv, envp )
X          int  argc;
X          char **argv
X	  char **envp;
X
XRESULTS
X    o/w : Will not return.
X     -1 : Error.
X
XREFERENCES
X    fork(2), execl(3), environ(4)
/
echo x - fork.2
gres '^X' '' > fork.2 << '/'
XSYSTEM CALLS
X    fork(2)		- split into two processes
X
XINVOCATION
X    int fork()
X
XEXPLANATION
X    A child process is created. This new process is a copy
X    of the parent, including descriptors.
X
XRESULTS
X    o/w : Process number of child, you are the parent.
X      0 : You are the child.
X     -1 : Could not fork.
X
XEXAMPLE
X    int pid = fork();
X
X    if ( pid == -1 )
X        return;
X
X    if ( pid == 0 )  {  /*  The child process  */
X        execl( "/bin/sh", "/bin/sh", 0 );
X        perror( "/bin/sh" );
X        exit( 127 );
X    }
X
X    /*  The parent process: ignore signals, wait for sub-process  */
X
X    signal( SIGINT,  SIG_IGN );
X    signal( SIGQUIT, SIG_IGN );
X
X    {
X    int  w, status;
X
X    while ( (w=wait(&status)) != pid  &&  w != -1 );
X    }
X
XREFERENCES
X    execl(3), wait(2)
/
echo x - fstat.2
gres '^X' '' > fstat.2 << '/'
XSYSTEM CALLS
X    fstat(2)		- read an inode
X
XINVOCATION
X    #include <sys/types.h>
X    #include <stat.h>
X
X    fstat( desc, s )
X      int  desc;
X      struct stat *s;
X
XEXPLANATION
X    Fstat(2) reads the inode for the file descriptor <desc>.
X    See stat(2) for a description of the structure pointed to
X    by <s>.
X
XRESULTS
X     0 : Ok.
X    -1 : Error.
X
XREFERENCES
X    stat(2)
/
echo x - getegid.2
gres '^X' '' > getegid.2 << '/'
XSYSTEM CALLS
X    getegid(2)		- what is my effective group id
X
XINVOCATION
X    int getegid()
X
XRESULTS
X    My effective group id.
X
XREFERENCES
X    getgid(2)
/
echo x - geteuid.2
gres '^X' '' > geteuid.2 << '/'
XSYSTEM CALLS
X    geteuid(2)		- what is my effective user id
X
XINVOCATION
X    int geteuid()
X
XRESULTS
X    My effective user id.
X
XREFERENCES
X    getuid(2)
/
echo x - getgid.2
gres '^X' '' > getgid.2 << '/'
XSYSTEM CALLS
X    getgid(2)		- what is my real group id
X
XINVOCATION
X    int getgid()
X
XRESULTS
X    My real group id.
X
XREFERENCES
X    getegid(2)
/
echo x - getpgrp.2
gres '^X' '' > getpgrp.2 << '/'
XSYSTEM CALLS
X    getpgrp(2)     	- who is my process group leader
X
XINVOCATION
X    int getpgrp()
X
XRESULTS
X    My process group id.
X
XREFERENCES
X    setpgrp(2), kill(2)
/
echo x - getpid.2
gres '^X' '' > getpid.2 << '/'
XSYSTEM CALLS
X    getpid(2)		- what is my process id
X
XINVOCATION
X    int getpid()
X
XRESULTS
X    My process id.
/
echo x - getppid.2
gres '^X' '' > getppid.2 << '/'
XSYSTEM CALLS
X    getppid(2)     	- what is my parent's process id
X
XINVOCATION
X    int getppid()
X
XRESULTS
X    My parent's process id.
/
echo x - getuid.2
gres '^X' '' > getuid.2 << '/'
XSYSTEM CALLS
X    getuid(2)		- what is my real user id
X
XINVOCATION
X    int getuid()
X
XRESULTS
X    My real user id.
X
XREFERENCES
X    geteuid(2)
/
echo x - intro.2
gres '^X' '' > intro.2 << '/'
XSYSTEM CALLS
X    intro(2)		- available system calls
X
XEXPLANATION
X    There are 48 functions callable by C programs which send
X    direct requests to the MINIX operating system. These
X    "system calls" are placed in a separate section of the
X    manual to aid students in understanding how MINIX and
X    its libraries operate, (there is also a historical
X    precedent for the separation).
X
X    The following system calls are part of the POSIX standard:
X
X	access	alarm	chdir	chmod	chown	close	creat
X	dup	dup2	execve	_exit	fork	fstat	getegid
X	geteuid	getgid	getpgrp	getpid	getppid	getuid	isatty
X	kill	link	lseek	open	pause	pipe	read
X	setgid	setpgrp	setuid	signal	stat	time	times
X	umask	unlink	utime	wait	write
X
X    The following MINIX system calls are not in the IEEE Std
X    1003.1 Trial-Use Standard:
X
X	brk	chroot	ioctl	mknod	mount	stime	sync
X	umount
X
XREFERENCES
X    intro(3), errno(4)
/
echo x - ioctl.2
gres '^X' '' > ioctl.2 << '/'
XSYSTEM CALLS
X    ioctl(2)		- special functions for devices
X
XINVOCATION
X    #include <sgtty.h>
X
X    ioctl( desc, TIOCSETP, argp )
X      int desc;
X      struct sgttyb *argp;
X
X    ioctl( desc, TIOCSETC, argc )
X      int desc;
X      struct tchars *argc;
X
X    ioctl( desc, TIOCGETP, argp )
X
X    ioctl( desc, TIOCGETC, argc )
X
XEXPLANATION
X    Devices are generally accessed through read(2) and write(2)
X    entry points, ioctl(2) adds an entry point for special
X    functions. The first parameter is a file descriptor,
X    the second is the name of the special function and the
X    last parameter is an appropriate argument for the given
X    function.
X
X    Currently there are four different ioctl(2) calls, all for
X    terminal devices. TIOCSETP and TIOCSETC set some parameters.
X    TIOCGETP and TIOCGETC recall the current parameters. The
X    structures pointed to by the last argument contain the following
X    elements, the initial defaults are also shown:
X
X	(char)  argp->sg_ispeed	 baud rate of rs232 port (1200)
X	(char)  argp->sg_erase	 erase the previous character (^H)
X	(char)  argp->sg_kill	 erase the whole line (@)
X	(short) argp->sg_flags	 see below:
X
X		BITS5	     5 bits of data
X		BITS6	     6 bits of data
X		BITS7	     7 bits of data
X		BITS8	     8 bits of data
X     		EVENP        Even parity generation and checking
X     		ODDP         Odd parity generation and checking
X		XTABS	     expand tabs (^I) to spaces
X		CRMOD	     i/p: ^M becomes ^J, o/p: ^J becomes ^M/^J
X		ECHO	     echo input characters
X		RAW	     enable raw mode, no i/o processing
X		CBREAK	     enable cbreak mode, as opposed to line mode
X
X		console initially: XTABS | CRMOD | ECHO
X		rs232 initially:   BITS7 | EVENP | XTABS | CRMOD
X		stty(1) default:   BITS8 | XTABS | CRMOD | ECHO
X
X	(char)  argc->t_intrc	 generates SIGINT (^?)
X	(char)  argc->t_quitc	 generates SIGQUIT (^\)
X	(char)  argc->t_startc	 restart output (^Q)
X	(char)  argc->t_stopc	 stop output (^S)
X	(char)  argc->t_eofc	 generate end-of-file (^D)
X
XNOTES
X    The following constants are defined in sgtty.h for baud rates:
X
X	     	B110    	 110 baud, 2 stop bits (if BITS5 then 1.5)
X     		B300    	 300 baud, 1 stop bit
X     		B1200		1200 baud, 1 stop bit
X     		B2400		2400 baud, 1 stop bit
X     		B4800		4800 baud, 1 stop bit
X     		B9600		9600 baud, 1 stop bit
X
X    When changing the number of data bits, all other data bit flags
X    must be turned off, for example:
X
X	argp->sg_flags &= ~ ( BITS5 | BITS6 | BITS7 | BITS8 );
X	argp->sg_flags |= BITS7;
X
X    If neither EVENP nor ODDP is set then no parity generation or
X    checking are performed.
X
XRESULTS
X     0 : Ok.
X    -1 : Error.
X
XEXAMPLE
X    ioctl( 0, TIOCGETP, &tty_mode );
X
X    /*  No tab expansion, no echo, cbreak mode  */
X
X    tty_mode.sg_flags = tty_mode.sg_flags & ~XTABS & ~ECHO  |  CBREAK;
X
X    ioctl( 0, TIOCSETP, &tty_mode  );
X
XREFERENCES
X    stty(1), gtty(3), stty(3)
X
XPROBLEMS
X    TIOCGETP does not return a value for sg_ispeed.
/
echo x - isatty.2
gres '^X' '' > isatty.2 << '/'
XSYSTEM CALLS
X    isatty(2)     	- does this descriptor refer to a terminal
X
XINVOCATION
X    int isatty( desc )
X      int desc;
X
XRESULTS
X    1 : <desc> is an open descriptor connected to a terminal.
X    0 : <desc> is not associated with a terminal.
X
XREFERENCES
X    fstat(2), ttyname(3)
/
echo x - kill.2
gres '^X' '' > kill.2 << '/'
XSYSTEM CALLS
X    kill(2)		- signal a process
X
XINVOCATION
X    kill( pid, sig )
X      int  pid;
X      int  sig;
X
XEXPLANATION
X    The signal <sig> is sent to the process <pid>. The sender
X    must either have the same user id, or be the super-user. If
X    <pid> is 0, then everyone in the same process group is
X    signaled.
X
X    If <pid> is -1 and the caller is the super-user then all
X    processes receive the signal.
X
XRESULTS
X     0 : Ok.
X    -1 : Error.
X
XREFERENCES
X    alarm(2), setpgrp(2), signal(2)
X
XPROBLEMS
X    Does not handle sig = 0 or pid < 0 variations as defined
X    in POSIX.
/
echo x - link.2
gres '^X' '' > link.2 << '/'
XSYSTEM CALLS
X    link(2)		- link a file
X
XINVOCATION
X    link( file_name, new_name )
X      char *file_name;
X      char *new_name;
X
XEXPLANATION
X    A new file <new_name> is created as a link to the existing
X    file <file_name>. Both must be on the same file system.
X
XRESULTS
X     0 : Ok.
X    -1 : Error.
/
echo x - lseek.2
gres '^X' '' > lseek.2 << '/'
XSYSTEM CALLS
X    lseek(2)		- seek to a new place in a file
X
XINVOCATION
X    #include <sys/types.h>
X    #include <unistd.h>
X
X    off_t lseek( desc, address, from )
X      int   desc;
X      off_t address;
X      int   from;
X
XEXPLANATION
X    The current read/write pointer for the file descriptor <desc>
X    is set to <address> offset by a location as determined by the
X    value of <from>:
X
X	SEEK_SET	from the beginning of the file
X	SEEK_CUR	from the current position
X	SEEK_END	from the end of the file
X
XRESULTS
X    o/w : Current octet position in file.
X     -1 : Error.
/
echo x - mknod.2
gres '^X' '' > mknod.2 << '/'
XSYSTEM CALLS
X    mknod(2)		- make a file node
X
XINVOCATION
X    #include <sys/types.h>
X    #include <stat.h>
X
X    mknod( file_name, mode, device )
X      char *file_name;
X      int   mode;
X      int   device;
X
XEXPLANATION
X    Mknod(2) creates an inode for <file_name> with the given <mode>.
X    For special files (block or character) the major/minor device is
X    specified by <device>. Only the super-user may use this call.
X
XRESULTS
X     0 : Ok.
X    -1 : Error.
X
XREFERENCES
X    /usr/include/sys/types.h
X    /usr/include/stat.h
/
echo x - mount.2
gres '^X' '' > mount.2 << '/'
XSYSTEM CALLS
X    mount(2)		- mount a new file system
X
XINVOCATION
X    mount( special, file_name, read_only )
X      char *special;
X      char *file_name;
X      int   read_only;
X
XEXPLANATION
X    The block special file <special> is mounted with its root
X    as <file_name>. If <read_only> is non-zero then this new
X    file system will be read only. Only the super-user may use
X    mount(2).
X
XRESULTS
X     0 : Ok.
X    -1 : Error.
X
XREFERENCES
X    umount(2)
/
echo x - open.2
gres '^X' '' > open.2 << '/'
XSYSTEM CALLS
X    open(2)		- open a file descriptor
X
XINVOCATION
X    #include <fcntl.h>
X
X    int open( file_name, flag )
X      char *file_name;
X      int   flag;
X
XEXPLANATION
X    <file_name> is opened as specified by <flag>:
X
X	O_RDONLY	for reading
X	O_WRONLY	for writing
X	O_RDWR		for both reading and writing
X
X    The file must exist.
X
XRESULTS
X    >=0 : The descriptor for the file.
X     -1 : Error.
X
XREFERENCES
X    close(2), creat(2), lseek(2), read(2), write(2), fopen(3)
/
echo x - pause.2
gres '^X' '' > pause.2 << '/'
XSYSTEM CALLS
X    pause(2)		- wait for a signal
X
XINVOCATION
X    pause()
X
XEXPLANATION
X    Waits for a signal, and returns after completion of the
X    signal handler.
X
XRESULTS
X    -1 : Ok.
X
XREFERENCES
X    signal(2), wait(2)
/
echo x - pipe.2
gres '^X' '' > pipe.2 << '/'
XSYSTEM CALLS
X    pipe(2)		- create a pipe
X
XINVOCATION
X    pipe( desc )
X      int desc[2];
X
XEXPLANATION
X    A FIFO pipe is created. Desc[1] is for writing to the
X    pipe and desc[0] is for reading from the pipe.
X
XRESULTS
X     0 : Ok.
X    -1 : Error.
/
echo x - read.2
gres '^X' '' > read.2 << '/'
XSYSTEM CALLS
X    read(2)		- read from a file
X
XINVOCATION
X    int read( desc, buffer, size )
X      int   desc;
X      char *buffer;
X      int   size;
X
XEXPLANATION
X    Up to <size> bytes are read from the file referenced by
X    the file descriptor <desc>.  The data is placed into the
X    storage pointed to by <buffer>.
X
XRESULTS
X    o/w : Number of bytes actually read.
X      0 : At the end of the file.
X     -1 : Error.
/
echo x - setgid.2
gres '^X' '' > setgid.2 << '/'
XSYSTEM CALLS
X    setgid(2)		- change my group id
X
XINVOCATION
X    setgid( group )
X      int  group;
X
XEXPLANATION
X    The real and effective group id are set to <group>.
X    Setgid(2) requires that either the caller's real group
X    id is <group> or the caller is the super-user.
X
XRESULTS
X     0 : Ok.
X    -1 : Error.
X
XREFERENCES
X    getgid(2)
/
echo x - setpgrp.2
gres '^X' '' > setpgrp.2 << '/'
XSYSTEM CALLS
X    setpgrp(2)     	- make me a process group leader
X
XINVOCATION
X    int setpgrp()
X
XEXPLANATION
X    Each child of "init" is a process group leader. The
X    offsprings of this leader belong to the same process
X    group. Setpgrp(2) can be used to break off a new
X    group from this tree.
X
X    Kill(2) is able to send a signal to all members of
X    a process group. This is used by the terminal devices
X    to broadcast a SIGINT or SIGQUIT signal.
X
XRESULTS
X    My process group id (which is now my process id).
X
XREFERENCES
X    getpgrp(2), kill(2)
/
echo x - setuid.2
gres '^X' '' > setuid.2 << '/'
XSYSTEM CALLS
X    setuid(2)		- change my user id
X
XINVOCATION
X    setuid( user )
X      int  user;
X
XEXPLANATION
X    The real and effective user id are set to <user>.
X    Setuid(2) requires that either the caller's real user
X    id is <user> or the caller is the super-user.
X
XRESULTS
X     0 : Ok.
X    -1 : Error.
X
XREFERENCES
X    getuid(2)
/
echo x - signal.2
gres '^X' '' > signal.2 << '/'
XSYSTEM CALLS
X    signal(2)		- what should be done with signals
X
XINVOCATION
X    #include <signal.h>
X
X    void (*signal( sig, handler ))()
X      int  sig;
X      void (*handler)();
X
XEXPLANATION
X    Signal(2) specifies what the system should do if the signal
X    <sig> is sent to this process. There are 16 signals defined
X    in MINIX, though not all of them are used.
X
X    When a signal arrives it may either be ignored, cause the
X    process to terminate or cause an asynchronous call to a
X    handler procedure within the process. When this handler
X    procedure terminates, control resumes where it was before
X    the signal.
X
X    The default for all signals is to terminate the process.
X    Signals marked with a "*" in the list below also create a
X    core image file when the process is terminated.
X
X    Each process may specify that a signal should be ignored,
X    should be set to the default state or cause a call to a
X    handler procedure. <handler> must be one of the following:
X
X	SIG_IGN		ignore the signal
X	SIG_DFL		use the default behavior for the signal
X	a procedure	call this handler when the signal occurs
X
X    The following are the signals defined in signal.h:
X
X	SIGHUP    	 1    	hang-up
X	SIGINT    	 2    	interrupt
X	SIGQUIT   	 3*   	quit
X	SIGILL    	 4*   	illegal instruction
X	SIGTRAP   	 5*   	trace trap
X	SIGIOT    	 6*   	IOT trap
X	SIGEMT    	 7*   	EMT trap
X	SIGFPE    	 8*   	arithmetic exception
X	SIGKILL		 9	kill (cannot be caught or ignored)
X	SIGBUS    	10*  	bus error
X	SIGSEGV   	11*  	segmentation violation
X	SIGSYS    	12*	bad argument to system call
X	SIGPIPE   	13   	write on a pipe with no one to read it
X	SIGALRM   	14   	alarm clock
X	SIGTERM		15   	software termination signal
X
XRESULTS
X    o/w : Last setting for signal.
X     -1 : Error.
X
XEXAMPLE
X    #include <signal.h>
X
X    terminate()  {
X	printf( "\nBye\n" );
X	exit( 1 );
X    }
X
X    main()  {
X    	if ( signal( SIGINT, SIG_IGN ) != SIG_IGN )
X            signal( SIGINT, terminate );
X
X	while( 1 );
X    }
X
XREFERENCES
X    kill(2)
/
echo x - stat.2
gres '^X' '' > stat.2 << '/'
XSYSTEM CALLS
X    stat(2)		- read an inode
X
XINVOCATION
X    #include <sys/types.h>
X    #include <stat.h>
X
X    stat( file_name, s )
X      char *file_name;
X      struct stat *s;
X
XEXPLANATION
X    Stat(2) reads the inode for the file <file_name>. <s> points
X    to a structure containing the following:
X
X	(dev_t)		  s->st_dev	device file is on
X	(ino_t)		  s->st_ino	inode number
X	(unsigned short)  s->st_mode	protection
X	(short int)	  s->st_nlink	number of links
X	(unsigned short)  s->st_uid	owner's user id
X	(unsigned short)  s->st_gid	owner's group id
X	(dev_t)		  s->st_rdev	device type, if is device
X	(off_t)		  s->st_size	file size
X	(time_t)	  s->st_atime	time of last modification
X	(time_t)	  s->st_mtime	time of last modification
X	(time_t)	  s->st_ctime	time of last modification
X
X    (s->st_mode & S_IFMT) is one of the following:
X
X	S_IFREG 	  regular
X	S_IFDIR 	  directory
X	S_IFCHR 	  character special
X	S_IFBLK 	  block special
X
X    The following may be set in s->st_mode:
X
X	S_ISUID   	  set user id on execution
X	S_ISGID   	  set group id on execution
X
X    The lower 9 bits of s->st_mode are the three sets of "rwx"
X    permissions for the USER, GROUP and OTHERS respectively.
X
XRESULTS
X     0 : Ok.
X    -1 : Error.
X
XREFERENCES
X    chmod(2), chown(2), fstat(2), utime(2)
/
echo x - stime.2
gres '^X' '' > stime.2 << '/'
XSYSTEM CALLS
X    stime(2)     	- set the system clock
X
XINVOCATION
X    #include <sys/types.h>
X
X    stime( new_time )
X      time_t *new_time;
X
XEXPLANATION
X    The system clock is set to the value pointed to by <new_time>.
X    Only the super-user may set the clock.
X
XRESULTS
X     0 : Ok.
X    -1 : Error.
/
echo x - sync.2
gres '^X' '' > sync.2 << '/'
XSYSTEM CALLS
X    sync(2)		- copy file system buffers to disk
X
XINVOCATION
X    sync()
X
XEXPLANATION
X    All the file buffers are copied from the volatile RAM
X    to disk.
/
echo x - time.2
gres '^X' '' > time.2 << '/'
XSYSTEM CALLS
X    time(2)		- what time is it
X
XINVOCATION
X    #include <sys/types.h>
X
X    time_t time( secs_spot )
X      time_t *secs_spot;
X
XEXPLANATION
X    Time is kept as a count of the number of seconds since
X    January 1st, 1970.
X
XRESULTS
X    The seconds count is returned. If <secs_spot> is not NULL,
X    then the seconds count is also placed into the location
X    pointed to by <secs_spot>.
X
XREFERENCES
X    ctime(3)
/
echo x - times.2
gres '^X' '' > times.2 << '/'
XSYSTEM CALLS
X    times(2)		- how much CPU time have I used
X
XINVOCATION
X    #include <sys/types.h>
X    #include <sys/times.h>
X
X    times( buf )
X      struct tms *buf;
X
XEXPLANATION
X    The CPU times used by the current process and its
X    children is returned. The accounting is separated
X    into system and user time. The counts are 1/60 of
X    a second. <buf> points to the following structure:
X
X    struct tms {
X	time_t	tms_utime;	my user time
X	time_t	tms_stime;	my system time
X	time_t	tms_cutime;	children's user time
X	time_t	tms_cstime;	children's system time
X    };
X
XRESULTS
X     0 : Ok.
X
XPROBLEMS
X    In the POSIX standard times(2) returns an elapsed
X    time count.
/
echo x - umask.2
gres '^X' '' > umask.2 << '/'
XSYSTEM CALLS
X    umask(2)		- set the default file protection mask
X
XINVOCATION
X    int umask( new_mask )
X      int  new_mask;
X
XEXPLANATION
X    Whenever a file is created its protection mask is AND'ed with
X    the complement of the lower 9 bits of <new_mask>.
X
XRESULTS
X    The previous mask contents.
X
XREFERENCES
X    chmod(2), creat(2)
/
echo x - umount.2
gres '^X' '' > umount.2 << '/'
XSYSTEM CALLS
X    umount(2)		- unmount a file system
X
XINVOCATION
X    umount( special )
X      char *special;
X
XEXPLANATION
X    The block special file <special> is unmounted. Only the
X    super-user may use umount(2).
X
XRESULTS
X     0 : Ok.
X    -1 : Error.
X
XREFERENCES
X    mount(2)
/
echo x - unlink.2
gres '^X' '' > unlink.2 << '/'
XSYSTEM CALLS
X    unlink(2)		- delete a link to a file
X
XINVOCATION
X    unlink( file_name )
X      char *file_name;
X
XEXPLANATION
X    The file link <file_name> is deleted. If this was the last
X    link to a file, and the file is not open, then the file will
X    be removed.
X
XRESULTS
X     0 : Ok.
X    -1 : Error.
/
echo x - utime.2
gres '^X' '' > utime.2 << '/'
XSYSTEM CALLS
X    utime(2)		- change a file's last modified time
X
XINVOCATION
X    #include <sys/types.h>
X    #include <utime.h>
X
X    utime( file_name, times )
X      char *file_name;
X      struct utimbuf *times;
X
XEXPLANATION
X    The file's "last modified" time is set by:
X
X	(time_t)  times->modtime
X
X    Only the owner of a file or the super-user may change this
X    file update time. If <times> is NULL, then the "last modified"
X    time is set to the current time.
X
X    There is no "last accessed" time in the MINIX file system.
X
XRESULTS
X     0 : Ok.
X    -1 : Error.
/
echo x - wait.2
gres '^X' '' > wait.2 << '/'
XSYSTEM CALLS
X    wait(2)		- wait for a child to terminate
X
XINVOCATION
X    int wait( status )
X      int  *status;
X
XEXPLANATION
X    Wait(2) returns if a child has already terminated, or if
X    there are no children. Otherwise wait(2) blocks until a
X    child does terminate.
X
X    If wait(2) returns because a child terminated, and <status>
X    is not NULL, then the lowest byte of the location pointed to
X    by <status> will contain the signal number which terminated
X    the child, 0 for normal termination. On a normal termination
X    the next higher byte receives the value from the child's
X    exit(3) call. If a core dump was generated then 0x80 is OR'ed
X    into the status.
X
XRESULTS
X    o/w : Process number of terminated child.
X     -1 : errno = ECHILD - No children.
X		= EINTR  - A signal occurred.
X
XREFERENCES
X    _exit(2), pause(2), exit(3)
/
echo x - write.2
gres '^X' '' > write.2 << '/'
XSYSTEM CALLS
X    write(2)		- write to a file
X
XINVOCATION
X    int write( desc, buffer, size )
X      int   desc;
X      char *buffer;
X      int   size;
X
XEXPLANATION
X    <size> bytes from the storage pointed to by <buffer>
X    are written to the file referenced by the descriptor
X    <desc>.
X
XRESULTS
X    o/w : Number of bytes actually written.
X     -1 : Error.
/
--------------------------------------------------------------------
               Edwin L. Froese
                  uw-beaver!ubc-cs!mprg!handel!froese

               Terrence W. Holm
                  uw-beaver!ubc-cs!uvicctr!sirius!tholm