annotate docs/ccguide/creat.refentry @ 1914:395e22e5c0bd

Added more defs for porting back to level 1 someday
author boisy
date Sun, 20 Nov 2005 17:11:16 +0000
parents c0da1728ed5b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
1 <refentry id="creat">
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
2 <refnamediv>
468
60b821f18853 A little here and there.
roug
parents: 466
diff changeset
3 <refname>Creat</refname>
60b821f18853 A little here and there.
roug
parents: 466
diff changeset
4 <refpurpose>create a file</refpurpose>
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
5 </refnamediv>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
6
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
7 <refsynopsisdiv>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
8 <funcsynopsis>
468
60b821f18853 A little here and there.
roug
parents: 466
diff changeset
9 <funcsynopsisinfo>
60b821f18853 A little here and there.
roug
parents: 466
diff changeset
10 #include &lt;modes.h&gt;
60b821f18853 A little here and there.
roug
parents: 466
diff changeset
11 </funcsynopsisinfo>
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
12 <funcprototype>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
13 <funcdef><function>creat</function></funcdef>
570
253b6096ee01 All function prototypes are added.
roug
parents: 552
diff changeset
14 <paramdef>char *<parameter>fname</parameter></paramdef>
253b6096ee01 All function prototypes are added.
roug
parents: 552
diff changeset
15 <paramdef>int <parameter>perm</parameter></paramdef>
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
16 </funcprototype>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
17 </funcsynopsis>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
18
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
19 </refsynopsisdiv>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
20
540
395a58bae72e All "See Also" implemented
roug
parents: 468
diff changeset
21 <refsect1><title>Assembler Equivalent</title>
395a58bae72e All "See Also" implemented
roug
parents: 468
diff changeset
22 <para>
395a58bae72e All "See Also" implemented
roug
parents: 468
diff changeset
23 os9 I$CREATE
395a58bae72e All "See Also" implemented
roug
parents: 468
diff changeset
24 </para>
395a58bae72e All "See Also" implemented
roug
parents: 468
diff changeset
25 </refsect1>
395a58bae72e All "See Also" implemented
roug
parents: 468
diff changeset
26
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
27 <refsect1><title>Description</title>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
28 <para>
594
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
29 Creat returns a path number to a new file available for
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
30 writing, giving it the permissions specified in "perm" and
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
31 making the task user the owner. If, however, "fname" is the
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
32 name of an existing file, the file is truncated to zero length,
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
33 and the ownership and permissions remain unchanged. NOTE,
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
34 that unlike the OS-9 assembler service request, creat does
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
35 not return an error if the file already exists. "Access()"
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
36 should be used to establish the existence of a file if it is
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
37 important that a file should not be overwritten.
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
38 </para>
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
39 <para>
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
40 It is unnecessary to specify writing permissions in "perm" in
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
41 order to write to the file in the current task.
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
42 </para>
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
43 <para>
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
44 The permissions allowed are defined in the include file as
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
45 follows:
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
46 </para>
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
47 <programlisting>
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
48 #define S_IPRM 0xff /* mask for permission bits */
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
49 #define S_IREAD 0x01 /* owner read */
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
50 #define S_IWRITE 0x02 /* owner write */
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
51 #define S_IEXEC 0x04 /* owner execute */
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
52 #define S_IOREAD 0x08 /* public read */
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
53 #define S_IOWRITE 0x10 /* public write */
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
54 #define S_IOEXEC 0x20 /* public execute */
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
55 #define S_ISHARE 0x40 /* sharable */
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
56 </programlisting>
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
57 <para>
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
58 Directories may not be created with this call; use "mknod()"
c0da1728ed5b All refentries finished.
roug
parents: 570
diff changeset
59 instead.
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
60 </para>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
61 </refsect1>
540
395a58bae72e All "See Also" implemented
roug
parents: 468
diff changeset
62
552
fcb97f0ba24b All diagnostics added.
roug
parents: 540
diff changeset
63 <refsect1><title>Diagnostics</title>
fcb97f0ba24b All diagnostics added.
roug
parents: 540
diff changeset
64 <para>
fcb97f0ba24b All diagnostics added.
roug
parents: 540
diff changeset
65 This call returns -1 if there are too many files open. If the
fcb97f0ba24b All diagnostics added.
roug
parents: 540
diff changeset
66 pathname cannot be searched, if permission to write is denied,
fcb97f0ba24b All diagnostics added.
roug
parents: 540
diff changeset
67 or if the file exists and is a directory.
fcb97f0ba24b All diagnostics added.
roug
parents: 540
diff changeset
68 </para>
fcb97f0ba24b All diagnostics added.
roug
parents: 540
diff changeset
69 </refsect1>
fcb97f0ba24b All diagnostics added.
roug
parents: 540
diff changeset
70
540
395a58bae72e All "See Also" implemented
roug
parents: 468
diff changeset
71 <refsect1><title>See Also</title>
395a58bae72e All "See Also" implemented
roug
parents: 468
diff changeset
72 <para>
395a58bae72e All "See Also" implemented
roug
parents: 468
diff changeset
73 <link linkend="write">write()</link>,
395a58bae72e All "See Also" implemented
roug
parents: 468
diff changeset
74 <link linkend="close">close()</link>,
395a58bae72e All "See Also" implemented
roug
parents: 468
diff changeset
75 <link linkend="chmod">chmod()</link>
395a58bae72e All "See Also" implemented
roug
parents: 468
diff changeset
76 </para>
395a58bae72e All "See Also" implemented
roug
parents: 468
diff changeset
77 </refsect1>
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
78 </refentry>