/* * This page documents the getcwd(2) system call, which * is not defined in any user-space header files; you should * use getcwd(3) defined in <unistd.h> instead in applications. */ long getcwd(char *buf, unsigned long size); |
If the current absolute path name would require a buffer longer than size elements, -1is returned, and errno is set to ERANGE; an application should check for this error, and allocate a larger buffer if necessary.
If buf is NULL, the behaviour of getcwd() is undefined.
Note that this return value differs from the getcwd(3) library function, which returnsNULL on failure and the address of buf on success.
標籤 | 描述 |
---|---|
ENOMEM | |
if user memory cannot be mapped | |
ENOENT | |
if directory does not exist (i.e. it has been deleted) | |
ERANGE | |
if not enough space available for storing the path | |
EFAULT | |
if memory access violation occurs while copying
|