.th K_create II 4/21/86
.sh NAME
K_create - create and open a file
.sh "MODULA SYNOPSIS"
.nh
.na
 CONST protoSeid: seid;
.br
 CONST om: openModes;
.br
 CONST da: discr_access;
.br
 CONST stCap: openDescriptor;
.br
 VAR fSeid: seid;
.br
 VAR od: openDescriptor;
.br
 VAR stat: K_err_num;
.br
 . . .
.br
 stat := NK_create(protoSeid, om, da, stCap, fSeid, od);
.br
.hy
.ad
.sp
.sh "C SYNOPSIS"
.nh
.na
 seid protoSeid;
.br
 open_mode om;
.br
 discr_access da;
.br
 openDescriptor stCap;
.br
 seid fSeid;
.br
 openDescriptor od;
.br
 int stat;
.br
 . . .
.br
 stat = K_create (protoSeid, om, da, stCap, &fSeid, &od);
.br
.hy
.ad
.sh DESCRIPTION
K_create creates and opens a new file on the same file system as the
file specified by protoSeid, which need not refer to an actual file;
only the name space partition part of the seid is examined to determine
which file system is to be used.
.s1
The file is created with size zero, the subtype specified by stCap, and
is opened with the specified open modes, which must be valid open modes
as defined for K_open (II).  The file is created with a link count of
zero.  This implies that the file will be deleted when closed by the
creating process unless the link count of the file is first incremented
by K_link (II).  Use of K_link (II) is normally restricted to the UNIX
directory manager, which thus restricts the creation of permanent files
to those under the control of the directory manager.
.s1
The seid of the new file, fSeid, is chosen pseudo-randomly by the
system.  The concept of re-creating an existing file is thus not
meaningful.
.s1
The open descriptor od is a local name which the process can
subsequently use to access the created file.
.sh EXCEPTIONS
.lp 22 15
XbadDa	SMXdap failure
.lp 22 15
XbadFlow	SMXflow failure
.lp 22 15
XbadModes	Illegal combination of open modes
.lp 22 15
XbadStCap	Invalid Subtype given
.lp 22 15
XbadSubtype	Incorrect Subtype given
.lp 22 15
XnoObj	Non-existent Object
.lp 22 15
XnoPriv	Does not have privilege
.lp 22 15
XodSpace	No od available for object
.i0
.sh "SEE ALSO"
K_open(II), K_close(II),
K_link(II),
seid(IIa)
