|
|
MPE/iX Developer's Kit Reference Manual Volume I: HP 3000 MPE/iX Computer Systems > Chapter 4
POSIX/iX Library Function Descriptions
rename |
|
Renames an existing file. Upon successful completion, a value of zero will be returned, Otherwise, a value of -1 will be returned and errno will be set to indicate the error. If -1 is returned, neither the filenamed by old nor the filenamed by new, if either exists, will be changed by this function call. The rename() function changes the name of a file. The old argument points to the pathname of the file to be renamed, The new argument points to the new pathname of the file. If the old argument and the new argument both refer to links to the same existing file, The rename() function will return successfully and perform no other action. The old and new arguments must be of the same type of file or directory. If the link named by the new argument exists, it will be removed and old renamed to new. Write access permission is required for both the directory containing old and the directory containing new. If the old argument points to the pathname of a directory, the new argument will not point to the pathname of a file that is not a directory. If the directory named by the new argument exists, it will be removed and old renamed to new. Thus, if new names an existing directory, it will be required to be an empty directory. The new pathname should not contain a path prefix that names old. If the link named by the new argument exists and the link count of the file becomes zero when it is removed and no process has the file open, the space occupied by the file will be freed and the file will no longer be accesable. If one or more processes have the file open when the last link is removed, the link will be removed before rename() returns, but the removal of the file contents will be postponed until all references to the file have been closed. Upon successful completion, the rename() function will mark for update the st_ctime and st_mtime fields of the parent directory of each file. If an error occurs, errno is set to one of the following values:
|
|