chdir2

Changes the current working directory of the thread to the specified directory.

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

Syntax

  #include <fsio.h> 
   
  int chdir2 (
     const char  *path);
  

Parameters

path

(IN) Specifies the buffer containing the directory path.

Return Values

If successful, returns 0. Otherwise, returns -1 and sets errno to one of the following:

Decimal

Constant

Description

1

ENOENT

A component of path does not name an existing file or path is an empty string.

6

EACCES

Search permission is denied on a component of the path.

65

ENAMETOOLONG

The length of the path parameter exceeds maximum path length, or a path component is longer than maximum name length.

67

ENOTDIR

A component of the path is not a directory.

Remarks

The chdir2 function causes the directory named by the path parameter to become the current working directory for the calling thread. It doesn't affect the current working directory of other threads in the VM. This functionality allows one or more threads to operate independently of each other in a same VM, which might be convenient for an application serving diverse client requests.

Any subsequent call to chdir after calling chrdir2 by this thread affects the current working directory of all threads in the VM, except this thread. This thread retains the current working directory established by chdir2.

If the path parameter points to a NULL string, this signals the end of thread-specific use of the current working directory, and the thread returns to the normal, per-VM state of calculating the current working directory.

The chrdir2 function was created for use by the server applications with the following characteristics:

  • Represent or proxy several clients

  • Each client has its own thread

  • Each client has its own unique current working directory, which makes calls to chdir highly inconvenient.

See Also