1 .\" Copyright (c) 2011 Apple Inc. All rights reserved.
3 .\" @APPLE_LICENSE_HEADER_START@
5 .\" This file contains Original Code and/or Modifications of Original Code
6 .\" as defined in and that are subject to the Apple Public Source License
7 .\" Version 2.0 (the 'License'). You may not use this file except in
8 .\" compliance with the License. Please obtain a copy of the License at
9 .\" http://www.opensource.apple.com/apsl/ and read it before using this
12 .\" The Original Code and all software distributed under the License are
13 .\" distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 .\" EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 .\" INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 .\" FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
17 .\" Please see the License for the specific language governing rights and
18 .\" limitations under the License.
20 .\" @APPLE_LICENSE_HEADER_END@
27 .Nd Auxiliary routine for efficiently creating paths
29 .Fd #include <unistd.h>
33 .Fa "const char * path"
37 This routine allows the caller to create a path, including intermediate
38 directories. It is equivalent to calling
40 with the -p command line argument.
42 Intermediate directories are created with permission bits of rwxrwxrwx (0777)
43 as modified by the current umask, plus write and search permission for the
46 The leaf directory is created with permission bits of
48 as modified by the current umask.
50 A 0 return value indicates success. If an error occurs, the return value is a
51 non-zero error code. Note that EEXIST is returned iff the leaf directory
52 already exists and is a directory, so under certain circumstances, this error
53 value may not indicate a failure state.
55 This routine does NOT modify errno.
57 Any error code that can be returned by
63 will return the error code rather than setting errno.
67 A component of the path is not a directory (in contrast to
69 which returns this based on the path prefix rather than the path).
72 The path already exists and is a directory.
75 This function first appeared in