.Sh SYNOPSIS
.Fd #include <unistd.h>
.Ft int
-.Fn chdir "const char *path"
+.Fo chdir
+.Fa "const char *path"
+.Fc
.Ft int
-.Fn fchdir "int fd"
+.Fo fchdir
+.Fa "int fildes"
+.Fc
.Sh DESCRIPTION
The
.Fa path
.Fn fchdir
function
causes the directory referenced by
-.Fa fd
+.Fa fildes
to become the current working directory,
the starting point for path searches of pathnames not beginning with
a slash,
is set to indicate
the error.
.Sh ERRORS
+The
.Fn Chdir
-will fail and the current working directory will be unchanged if
-one or more of the following are true:
+system call will fail
+and the current working directory will be unchanged
+if one or more of the following are true:
.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded
-.Dv {NAME_MAX}
-characters, or an entire path name exceeded
-.Dv {PATH_MAX}
-characters.
-.It Bq Er ENOENT
-The named directory does not exist.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
+.\" ==========
.It Bq Er EACCES
Search permission is denied for any component of
the path name.
+.\" ==========
.It Bq Er EFAULT
.Fa Path
points outside the process's allocated address space.
+.\" ==========
.It Bq Er EIO
An I/O error occurred while reading from or writing to the file system.
+.\" ==========
+.It Bq Er ELOOP
+Too many symbolic links were encountered in translating the pathname.
+This is taken to be indicative of a looping symbolic link.
+.\" ==========
+.It Bq Er ENAMETOOLONG
+A component of a pathname exceeded
+.Dv {NAME_MAX}
+characters, or an entire path name exceeded
+.Dv {PATH_MAX}
+characters.
+.\" ==========
+.It Bq Er ENOENT
+The named directory does not exist.
+.\" ==========
+.It Bq Er ENOTDIR
+A component of the path prefix is not a directory.
.El
.Pp
.Fn Fchdir
will fail and the current working directory will be unchanged if
one or more of the following are true:
.Bl -tag -width Er
+.\" ==========
.It Bq Er EACCES
Search permission is denied for the directory referenced by the
file descriptor.
-.It Bq Er ENOTDIR
-The file descriptor does not reference a directory.
+.\" ==========
.It Bq Er EBADF
The argument
-.Fa fd
+.Fa fildes
is not a valid file descriptor.
+.\" ==========
+.It Bq Er EINTR
+.Fn Fchdir was interrupted by a signal.
+.\" ==========
+.It Bq Er EIO
+An I/O error occurred while reading from or writing to the file system.
+.\" ==========
+.It Bq Er ENOTDIR
+The file descriptor does not reference a directory.
.El
.Sh SEE ALSO
.Xr chroot 2