teach manpages about largefile's demise
[unleashed.git] / share / man / man2 / creat.2
bloba281c66b5370788ee21985b74d40b3282a6b64fd
1 .\"
2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
6 .\"
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
9 .\" documentation.
10 .\"
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
13 .\"
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group.  In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document.  The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
24 .\"
25 .\" This notice shall appear on any product containing this material.
26 .\"
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
30 .\"
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
35 .\"
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
41 .\"
42 .\"
43 .\" Copyright 1989 AT&T
44 .\" Copyright (c) 1997, The Open Group. All Rights Reserved.
45 .\" Portions Copyright (c) 2001, Sun Microsystems, Inc.  All Rights Reserved.
46 .\"
47 .TH CREAT 2 "Mar 25, 2002"
48 .SH NAME
49 creat \- create a new file or rewrite an existing one
50 .SH SYNOPSIS
51 .LP
52 .nf
53 #include <sys/stat.h>
54 #include <fcntl.h>
56 \fBint\fR \fBcreat\fR(\fBconst char *\fR\fIpath\fR, \fBmode_t\fR \fImode\fR);
57 .fi
59 .SH DESCRIPTION
60 .sp
61 .LP
62 The function call
63 .sp
64 .LP
65 creat(path, mode)
66 .sp
67 .LP
68 is equivalent to:
69 .sp
70 .LP
71 \fBopen(path, O_WRONLY | O_CREAT | O_TRUNC, mode)\fR
72 .SH RETURN VALUES
73 .sp
74 .LP
75 Refer to \fBopen\fR(2).
76 .SH ERRORS
77 .sp
78 .LP
79 Refer to \fBopen\fR(2).
80 .SH EXAMPLES
81 .LP
82 \fBExample 1 \fRCreating a File
83 .sp
84 .LP
85 The following example creates the file \fB/tmp/file\fR with read and write
86 permissions for the file owner and read permission for group and others. The
87 resulting file descriptor is assigned to the \fIfd\fR variable.
89 .sp
90 .in +2
91 .nf
92 #include <fcntl.h>
93 \&...
94 int fd;
95 mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
96 char *filename = "/tmp/file";
97 \&...
98 fd = creat(filename, mode);
99 \&...
101 .in -2
103 .SH ATTRIBUTES
106 See \fBattributes\fR(5) for descriptions of the following attributes:
111 box;
112 c | c
113 l | l .
114 ATTRIBUTE TYPE  ATTRIBUTE VALUE
116 Interface Stability     Standard
118 MT-Level        Async-Signal-Safe
121 .SH SEE ALSO
124 \fBopen\fR(2), \fBattributes\fR(5), \fBstandards\fR(5)