setcwd

Sets the current working directory of the VM to the specified path context.

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

Syntax

  #include <fsio.h>
   
  int setcwd (
     NXPathctx_t   pathCtx);
  

Parameters

pathCtx

(IN) Specifies a path context.

Return Values

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

Decimal

Constant

Description

4

EBADF

The underlying file descriptor is invalid.

5

ENOMEM

Insufficient memory for the operation.

9

EINVAL

One or more parameters are invalid.

28

EIO

Either the volume isn't mounted or a file system error occurred

65

ENAMETOOLONG

The file system name for a path component is too long.

67

ENOTDIR

The object is not a directory.

79

ENOTSUP

The operation is not supported in the manner requested.

105

ENOCONTEXT

Either the thread context is invalid or not available for the operation.

106

ENAMESPACE

The name space is invalid.

107

EBADCONN

The underlying NCP connection is not valid.

114

EBADIDENT

The underlying security badge is invalid.

Remarks

You create a path context with the NXCreatePathContext function.

The setcwd function sets the current working directory for all threads running in the VM. To set the current working directory only for the current thread, use setcwd2.

The setcwd and setcwd2 functions allow you to inject an NKS path context with authenticated user credentials into the current working directory. Such credentials allow you to access resources:

  • On your current server (with a connection other than connection 0).

  • On remote servers.

To set up the current working directory so that you can access resources on a remote server:

  • Set up a path context to the remote server with NXCreatePathContext.

  • Set the current working directory to that path context with setcwd.

You can then use POSIX and ANSI functions to access files on that remote server.

See Also