chmod

Changes the file access mode

Local Servers:blocking
Remote Servers:blocking
Classification:POSIX
Platform:NLM
Service:File System

Syntax

   #include <stat.h>  
    
   int chmod  (  
      const char  *path,   
      int          mode); 
   

Parameters

path

(IN) Specifies the string containing the path that includes the file whose access mode is to be modified (maximum 255 characters, including the NULL terminator).

mode

(IN) Specifies the access permission mode for the file.

Return Values

Returns a value of 0 if successful, -1 otherwise. If an error occurs, errno is set.

Remarks

To call chmod, you must meet the following requirements:

  • The current connection must have modify permission to the specified file.

  • The target namespace must be DOS. To set the target namespace, use SetTargetNameSpace(NW_NS_DOS).

  • For remote servers, the current name space must be DOS on NetWare versions before 4.x. See SetCurrentNameSpace.

chmod works on all NetWare file systems, including the DOS partition.

The various mode settings are given in the SYS\STAT.H header file. The access permissions for the file are specified as a combination of bits defined in the SYS\STAT.H header file.

S_IWRITE

The file is writable

S_IREAD

The file is readable

Alternatively, zero can be specified to indicate that the file is readable and writable.

See Also

fstat (Single and Intra-File Services), SetCurrentNameSpace, SetTargetNameSpace, stat