.Fd #include <sys/types.h>
.Fd #include <sys/stat.h>
.Ft int
-.Fn chmod "const char *path" "mode_t mode"
+.Fo chmod
+.Fa "const char *path"
+.Fa "mode_t mode"
+.Fc
.Ft int
-.Fn fchmod "int fd" "mode_t mode"
+.Fo fchmod
+.Fa "int fildes"
+.Fa "mode_t mode"
+.Fc
.Sh DESCRIPTION
The function
.Fn chmod
.Fn Fchmod
sets the permission bits of the specified
file descriptor
-.Fa fd .
+.Fa fildes .
.Fn Chmod
verifies that the process owner (user) either owns
the file specified by
.Fa path
(or
-.Fa fd ) ,
+.Fa fildes ) ,
or
is the super-user.
A mode is created from
.Va errno
is set to indicate the error.
.Sh ERRORS
-.Fn Chmod
-will fail and the file mode will be unchanged if:
+The
+.Fn chmod
+system call will fail and the file mode will be unchanged if:
.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
+.\" ==========
+.It Bq Er EACCES
+Search permission is denied for a component of the path prefix.
+.\" ==========
+.It Bq Er EFAULT
+.Fa Path
+points outside the process's allocated address space.
+.\" ==========
+.It Bq Er EINTR
+Its execution 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 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 file does not exist.
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
+.\" ==========
+.It Bq Er ENOTDIR
+A component of the path prefix is not a directory.
+.\" ==========
.It Bq Er EPERM
The effective user ID does not match the owner of the file and
the effective user ID is not the super-user.
+.\" ==========
.It Bq Er EROFS
The named file resides on a read-only file system.
-.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.
.El
.Pp
-.Fn Fchmod
+.Fn fchmod
will fail if:
.Bl -tag -width Er
+.\" ==========
.It Bq Er EBADF
-The descriptor is not valid.
+.Fa fildes
+is not a valid file descriptor.
+.\" ==========
.It Bq Er EINVAL
-.Fa fd
+.Fa fildes
refers to a socket, not to a file.
-.It Bq Er EROFS
-The file resides on a read-only file system.
+.\" ==========
+.It Bq Er EINVAL
+.Fa mode
+is not a valid file mode.
+.\" ==========
+.It Bq Er EINTR
+Its execution 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 EPERM
+The effective user ID does not match the owner of the file and
+the effective user ID is not the super-user.
+.\" ==========
+.It Bq Er EROFS
+The file resides on a read-only file system.
.El
+.Sh LEGACY SYNOPSIS
+.Fd #include <sys/types.h>
+.Fd #include <sys/stat.h>
+.Pp
+The include file
+.In sys/types.h
+is necessary.
.Sh SEE ALSO
.Xr chmod 1 ,
-.Xr open 2 ,
.Xr chown 2 ,
+.Xr open 2 ,
.Xr stat 2 ,
+.Xr compat 5 ,
.Xr sticky 8
.Sh STANDARDS
The