__getcwd

OS/161 Reference Manual

Name

__getcwd - get name of current working directory (backend)

Library

Standard C Library (libc, -lc)

Synopsis

#include <unistd.h>

int
__getcwd(char *buf, size_t buflen);

Description

The name of the current directory is computed and stored in buf, an area of size buflen. The length of data actually stored, which must be non-negative, is returned.

Note: this call behaves like read - the name stored in buf is not 0-terminated.

This function is not meant to be called except by the C library; application programmers should use getcwd instead.

Return Values

On success, __getcwd returns the length of the data returned. On error, -1 is returned, and errno is set according to the error encountered.

Errors

The following error codes should be returned under the conditions given. Other error codes may be returned for other errors not mentioned here.
  
ENOENT A component of the pathname no longer exists.
EIO A hard I/O error occurred.
EFAULT buf points to an invalid address.