The renamewtmpx(2) function renames the file
/var/adm/wtmpx to newname.
This ensures that the current wtmpx file is renamed and
that a new wtmpx file is started in its place, and that no
data is lost during the renaming process.
Failure to use this interface means that data continues to be
sent to the original file, even under a new name.
A component of either path prefix denies search
permission.
[EACCES]
The requested link requires writing in a directory with a mode
that denies write permission.
[EEXIST]
The file newname already exists.
[EFAULT]
Newname points outside the process's allocated address
space.
[EINVAL]
Either pathname contains a character with the high-order bit
set, or the device holding one or both of the files does not permit
the operation.
[EIO]
An I/O error occurred while making or updating a directory
entry.
[EISDIR]
Newname is a directory.
[ENAMETOOLONG]
The newname exceeds {NAME_MAX} characters.
[ENOENT]
A path prefix of newname does not exist.
[ENOSPC]
The directory in which the entry for the new name is being
placed cannot be extended because there is no space left on the
file system containing the directory.
[ENOTDIR]
A component of newname's path prefix is not a
directory.
[EPERM]
The newname file exists, the directory containing
newname is marked sticky, and neither the containing
directory nor newname are owned by the effective user
ID.
[EPERM]
The file cannot be moved or renamed to different file system
(for example, /dev/fs/C/dog to /dev/fs/D/dog).
[EROFS]
The requested link requires writing in a directory on a
read-only file system.