STOPIO(S) UNIX System V STOPIO(S)
Name
stopio - stop further I/O to an open file
Syntax
#include <sys/types.h>
#include <sys/security.h>
#include <sys/audit.h>
#include <prot.h>
int stopio (path)
char *path;
Description
Stopio prevents further I/O on all file descriptors now
having path open. The next time a read(S), write(S) or
ioctl(S) is invoked by any process on any file descriptor of
path, the system call will fail with the [EBADF] error and
the SIGSYS signal is posted to the process. Stopio may only
be invoked by the superuser or owner of file path .
Stopio is used to isolate successive user sessions on a
single terminal. At the time stopio is invoked with the
terminal path as the argument, background processes left by
previous sessions may continue to run on the terminal, but
any further input or output to the terminal will fail as
described above. As the terminal gets re-opened after the
stopio invocation, I/O using those new file descriptors will
succeed until the next stopio call on the same path . This
system call is intended to be used by a program like
getty(1M) immediately before the open of the terminal line.
Stopio will fail if one of the following is true:
[ENOTDIR] A component of the path prefix is not a
directory.
[ENOENT] The named file does not exist.
[EACCES] Search permission is denied on a component of
the path prefix.
[EPERM] The effective user ID does not match the owner
of the file and the effective user ID is not
super-user.
[EROFS] The named file resides on a read-only file
system. (This may go away - see Notes below.)
[EFAULT] Path points outside the allocated address space
of the process.
[ENOTTY] Path is not a local character special file.
(This may go away - see Notes below.)
Return Value
Upon successful completion a value of 0 is returned.
Otherwise, a value of -1 is returned and errno is set to
indicate the error.
See Also
open(S), creat(S), read(S), write(S), ioctl(S)
Notes
The [EROFS] error is not really appropriate for this system
call.
Stopio should work for all file types, but a security study
has not yet been made as to the utility or feasibility in
such an assignment. For now, it works only for character
special files to specifically address the problem of sharing
a single terminal through multiple login sessions.
This functionality should really be a command within
fcntl(S), but fcntl expects the file to be open already and
this call requires a path name.
Value Added
stopio is an extension of AT&T System V provided by the
Santa Cruz Operation.
(printed 6/20/89)