next up previous contents
Next: sbrk: low-level memory allocator Up: MOSS system calls Previous: read: read from a

rename: rename a file

SYNOPSIS

int rename(const char *old, const char *new);

DESCRIPTION

This system call implements the POSIX rename function, which changes the name of an existing file.

Since this function is based on the rather limited DOS rename operation, it can't be used to rename a directory, or to move a file from one directory to another. Furthermore, if the file named by new already exists, MOSS will emulate proper POSIX behavior by removing the existing file and replacing it with old; however, this operation will not be atomic as it should be under POSIX.

PARAMETERS

old
The pathname of the file to rename.
new
The new name for the file.

RETURN VALUE

Returns 0 if successful, or -1 on error, in which case errno indicates the error.



Bryan Ford