NXRename

Renames a file, FIFO, device, etc.

Library:LibC
Classification:NKS
Service:File and Directory I/O

Syntax

  #include <nks/fsio.h> 
  
  int NXRename (
     NXPathCtx_t   sourcePathCtx,
     const void   *oldname,
     NXPathCtx_t   targetPathCtx,
     const void   *newname,
     NXBool_t      overwrite);
  

Parameters

sourcePathCtx

(IN) Specifies the file system path context of the object to rename. Along with the oldname parameter, it specifies the object.

oldname

(IN) Points to the current name of an existing object.

targetPathCtx

(IN) Specifies the file system path context for the renamed object. Along with the newname parameter, it specifies the new name of the object.

newname

(IN) Points to a new name (in Unicode or ASCII) for the specified object.

overwrite

(IN) Specifies whether to overwrite the target object if it already exists.

  • TRUE Overwrite an existing target object
  • FALSE Fail and return an error if the target object exists

Return Values

If successful, returns 0. Otherwise, returns one of the following error codes:

Decimal

Hex

Constant

Description

1

0x01

NX_ENOENT

A component of the path prefix specified by oldname or newname does not exist, or one of them is NULL.

4

0x04

NX_EBADF

Invalid path context.

6

0x06

NX_EACCES

Insufficient rights to the object.

7

0x07

NX_EEXIST

The target object already exists.

9

0x09

NX_EINVAL

A path context was specified, but sourcename indicates a full path.

24

0x18

NX_EAGAIN

Resource exhaustion prevented successful completion of the call.

65

0x41

NX_ENAMETOOLONG

The name contents are longer than system permitted name length.

79

0x4F

NX_ENOTSUP

The operation is not supported.

105

0x69

NX_ENOCONTEXT

The calling thread has no NKS context.

Remarks

NXRename renames a file object. After a file is successfully renamed, attempts to open that file by the old name fail unless the file is recreated.

The target path context must be identical to the source path context or NX_ENOTSUP is returned because the NetWare file system does not support the ability to have different handles for the source and target.

See Also

NXRemove