On the operating system, the internal format of directories is defined in the following location:
The link count of a directory is the total number of directories that are listed in that directory, including "." and "..".
On the operating system, the pointer returned by
readdir()
points to data that may be overwritten by another call to
readdir()
on the same directory stream.
Overwriting occurs when the number of entries buffered by
readdir()
is exhausted and the next set of entries is read by the function.
On the operating system, the
readdir()
function does
buffer several directory entries per actual read operation.
On the operating system,
if a file is removed from or added to the directory after the most recent
call to
opendir()
or
rewinddir(),
a subsequent call to
readdir()
may or may not
accurately reflect the contents of the directory.
On the operating system, upon return from the
closedir()
function,
dir
no longer points to an accessible object of type
DIR
because the memory in which the object resided has been freed.
On the operating system, if the dirp argument passed to any of the file operation functions does not refer to a currently-open directory stream, the following occurs:
errno
is set to [EBADF].
On the operating system,
using a previously-opened directory stream after one of the
exec()
family of functions causes the following to happen:
opendir()
function sets the close-on-exec (FD_CLOEXEC) flag on the file
descriptor for the directory file.
On the operating system, after a call to the
fork()
function, if both the parent and child processes use the
readdir()
function or a combination of
readdir()
and
rewinddir()
on a directory stream opened prior to the
fork()
the behavior is as follows:
dd_loc
in
DIR).
For the
opendir()
function, the operating system
detects the conditions and returns the corresponding
errno
values for [EMFILE] and [ENFILE].
For the
readdir()
function, the operating system
detects the conditions and returns the corresponding
errno
value for [EBADF].
For the
closedir()
function, the operating system
detects the conditions and returns the corresponding
errno
value for [EBADF].
On the operating system, if the argument
buf
to
getcwd()
is a NULL pointer,
getcwd()
behaves as follows:
malloc(),
getcwd()
allocates an array of
size
bytes and copies the absolute pathname into the array. The pointer
to this array is then returned. This pointer can be used as
the argument to a subsequent call to
free().
On the operating system, after an error on a call to
getcwd(),
the contents of
buf
are indeterminate.
For the
getcwd()
function, the operating system
detects the conditions and returns the corresponding
errno
value for [EACCES].
On the operating system, if O_RDWR is set in
oflag,
and
open(
path,
oflag,
mode)
is called to open a FIFO, the following results:
open()
can be used for reading and writing bytes to and from the FIFO.
A newly-created file's group ID is set to the group ID of the directory in which the file is being created.
On the operating system, when O_CREAT is set in oflag and bits in mode other than the file permission bits are set, the results are as follows:
On the operating system, if O_EXCL is set and O_CREAT is not set in oflag, the following results:
open()
function is attempted.
When opening a character special file that supports nonblocking opens with O_NONBLOCK set, the behavior subsequent to the immediate return is as follows:
On the operating system, when O_NONBLOCK is set in oflag, and path is not a character special file that supports non-blocking opens, and path is not a FIFO being opened with O_RDONLY or O_WRONLY set in oflag, the following behavior occurs:
On the operating system, if O_TRUNC is set in oflag and path refers to a file type other than a regular file, a FIFO special file, or a terminal device file, the effect is as follows:
On the operating system, setting both O_TRUNC and O_RDONLY in oflag has the following effect:
open()
function returns -1 and sets
errno
to [EACCES].
On the operating system,
the bits of the
cmask
argument to
umask(),
other than the file permission bits
and the set-id-on-execution bits (S_ISUID and S_ISGID)
are ignored.
On the operating system,
umask()
returns the previous value of the file mode creation mask in the
least-significant 12 bits of the
mode_t
return value. The remaining bits are all set to zero.
These 12 bits include the 9 file permission bits, the 2
set-id-on-execution bits (S_ISUID and S_ISGID), and the sticky bit.
(See
chmod(1)
for information on the sticky bit.)
The operating system does not support linking of files across file systems.
The operating system does not support linking directories through the
link()
function even for superuser processes.
The operating system does not require that the calling process have permission to access the existing file when linking files.
On the operating system, bits in the
mode
argument to the
mkdir()
function, other than the file permission bits, are ignored.
A newly-created directory's group ID is set to the group ID of the new directory's parent directory.
On the operating system, bits in the
mode
argument to the
mkfifo()
function, other than the file permission bits, set-id-on-execution
bits (S_ISUID and S_ISGID), and the sticky bit are ignored.
(See
chmod(1)
for information on the sticky bit.)
A newly-created FIFO's group ID is set to the group ID of the FIFO's parent directory.
If the named directory is the root directory or the current
working directory of any process,
other than the process calling
rmdir()
and the directory contains no entries other than "." and "..", the
rmdir()
function
succeeds.
On the operating system, if the directory indicated in the call to
rmdir()
is being used by another process,
rmdir()
succeeds.
If the named directory is the current working directory of the
calling process,
rmdir()
returns -1 and sets
errno
to [EBUSY].
On the operating system, in a call to
rename(
old,new
),
if the
old
argument points to the pathname of a directory, write access permission
is not
required for the directory named by
old,
or, if it exists, for the directory named by
new.
If
file
is a file type other than a regular file, the
st_size
field in the
struct
stat
returned by
stat(
file, buf
)
has the following meaning:
On the operating system, the following
bits are ORed with S_IRWXU, S_IRWXG, and S_IRWXO in the
st_mode
field of the
struct
stat
returned by
stat(
file, buf
):
On the operating system, the
access()
function
does
indicate success for X_OK if the process has appropriate privileges yet
none of the file's execute permission bits is set.
For the
access()
function, the operating system
detects the conditions and returns the corresponding
errno
value for [EINVAL] .
On the operating system, a process running as user
root
may change file
access modes regardless of the file's owner.
On the operating system,
chmod()
has no effect on the file
descriptors for those files open at the time of the
chmod()
call.
On the operating system, if the
path
argument to
chown()
refers to a regular file and
if the call is made by a process with appropriate privileges, the
set-user-ID (S_ISUID) and set-group-ID (S_ISGID) bits of the file mode
are not
cleared upon successful return from
chown().
For the
chown()
function, the operating system
detects the conditions and returns the corresponding
errno
value for [EINVAL].
If the owner or group ID is larger than 65535, -1 is returned and
errno
is set to [EINVAL].
The operating system adds no extensions to the
utimbuf
structure.
Although the operating system checks for existence and permissions
on the
path
argument to
pathconf()
neither the
path
nor
fildes
argument is needed to return the value of the pathname
variable
name.
Therefore, the return value of
pathconf()
or
fpathconf()
is not affected by the type of file to which the argument refers.
For the
pathconf()
function, the operating system
detects the conditions and returns the corresponding
errno
values for [EACCES], [EINVAL], [ENAMETOOLONG], [ENOENT], and [ENOTDIR].
For the
fpathconf()
function, the operating system
detects the conditions and return the corresponding
errno
values for [EINVAL]. The
fildes
argument to
fpathconf()
is ignored.