unistd.h File Reference

__need_size_t

access ( const char *, int )

IMPORT_C intaccess(const char *_path,
int_amode
)

waccess ( const wchar_t *, int )

IMPORT_C intwaccess(const wchar_t *_path,
int_amode
)

chdir ( const char * )

IMPORT_C intchdir(const char *_path)

Changes the current working directory to be pathname. The current directory is the beginning point for file searches when path names are not absolute. If the chdir() function fails, the current working directory remains unchanged.

Parameters
_pathIs the path name of a directory.
Return Value
On Success, returns 0. On Failure, returns -1, errno may be set.

wchdir ( const wchar_t * )

IMPORT_C intwchdir(const wchar_t *_path)

A wide-character version of chdir().

chmod ( const char *, mode_t )

IMPORT_C intchmod(const char *_path,
mode_t_mode
)

Sets the access permissions for the file whose name is given by pathname to the bit pattern contained in mode. For this call to succeed, the effective user ID of the process must match the owner of the file, or the process must have appropriate privileges. The owner of the file pathname always has privileges to change permission modes and file attributes.

Parameters
_pathPoints to the name of the file.
_modeIs a bitwise-or field that specifies the new permission modes for path name.
Return Value
On Success, returns 0. On Failure, returns -1, errno may be set.

wchmod ( const wchar_t *, mode_t )

IMPORT_C intwchmod(const wchar_t *_path,
mode_t_mode
)

A wide-character version of chmod().

close ( int )

IMPORT_C intclose(int_fildes)

Close a file.

Return Value
On Success, returns 0. On Failure, returns -1, errno may be set.

dup ( int )

IMPORT_C intdup(int_fildes)

Duplicates an open file descriptor.

Parameters
_fildesIs the file descriptor to duplicate.
Return Value
On Success, returns a non-negative integer, namely the duplicated file descriptor, which is the lowest available descriptor. On Failure, returns -1, errno may be set.

dup2 ( int, int )

IMPORT_C intdup2(int_fildes,
int_fildes2
)

Function duplicates an open file descriptor.

Parameters
_fildesIs the file descriptor to duplicate.
_fildes2Is the file descriptor that filedes is duplicated onto.
Return Value
On Success, returns a non-negative integer, namely the duplicated file descriptor, which is the lowest available descriptor. On Failure, returns -1, errno may be set.

fsync ( int )

IMPORT_C intfsync(int_fildes)

Synchronizes a file's in-memory state with that on the physical medium.

Parameters
_fildesIs the file descriptor for the file to be synchronized.
Return Value
On Success, returns 0. On Failure, returns -1, errno may be set.

getcwd ( char *, size_t )

IMPORT_C char *getcwd(char *_buf,
size_t_size
)

Gets the path name of the current working directory. If a buffer is specified, the path name is placed in that buffer, and the address of the buffer is returned.

Parameters
_bufPoints to the buffer to copy the current working directory to, or NULL if getcwd() should allocate the buffer.
_sizeIs the size, in bytes, of the array of characters that buf points to.
Return Value
If successful returns buf, if a non-null pointer was specified, or the address of the allocated memory otherwise.

wgetcwd ( wchar_t *, size_t )

IMPORT_C wchar_t *wgetcwd(wchar_t *_buf,
size_t_size
)

A wide_character version of a getcwd().

gethostname ( char *, size_t )

IMPORT_C intgethostname(char *_buf,
size_t_size
)

Get the internet name of this host. Actually this will always return a null string with TCPIP 030 and onwards because the "name" of a mobile host isn't really very meaningful - in practice the IP address is chosen dynamically once you start doing real networking, at which time the ISP can resolve the IP address into a name of some sort if you really want.

isatty ( int )

IMPORT_C intisatty(int_fildes)

lseek ( int, off_t, int )

IMPORT_C off_tlseek(int_fildes,
off_t_offset,
int_whence
)

Repositions the read/write file offset.

Parameters
_fildesIs the file descriptor of an open file.
_offsetSpecifies the number of bytes to offset the file pointer from a specified file origin.
_whenceSpecifies the location from which to start seeking.
Return Value
a nonnegative integer that indicates the file pointer value.

open ( const char *, int, ... )

IMPORT_C intopen(const char *,
int,
...
)

Opens the file which name is stored in the file string.

Return Value
On Success, a non-negative integer representing the lowest numbered unused file descriptor. On Failure, returns -1, errno may be set.

wopen ( const wchar_t *, int, ... )

IMPORT_C intwopen(const wchar_t *,
int,
...
)

A wide_character version of a open().

read ( int, char *, size_t )

IMPORT_C intread(int_fildes,
char *_buf,
size_t_nbyte
)

Reads a block of data of the length specified by cnt.

Return Value
On Success, return a non-negative integer indicating the number of bytes actually read. On Failure, returns -1, errno may be set.

rename ( const char *, const char * )

IMPORT_C intrename(const char *,
const char *
)

Renames a file.

Parameters
Points to the path name of the file to be renamed. The path name can be absolute or relative. If a relative path name is given, the file is searched from the current working directory.
Points to the path name of the file. The path name can be absolute or relative. If a relative path name is given, the file is searched from the current working directory.
Return Value
On Success, returns 0. On Failure, returns -1, errno may be set. Does not change either the file named by old or the file named by new (if either exists).

wrename ( const wchar_t *, const wchar_t * )

IMPORT_C intwrename(const wchar_t *,
const wchar_t *
)

A wide-character version of rename().

rmdir ( const char * )

IMPORT_C intrmdir(const char *_path)

Removes an empty directory whose name is given by pathname. The directory must not have any entries other than dot (.) and dot-dot (..).

Parameters
_pathPoints to the directory that the rmdir() function removes.
Return Value
On Success, returns 0. On Failure, returns -1, errno may be set.

wrmdir ( const wchar_t * )

IMPORT_C intwrmdir(const wchar_t *_path)

A wide-character version of rmdir().

unlink ( const char * )

IMPORT_C intunlink(const char *_path)

Removes a link to a file, and decrements the link count of the referenced file by one. When the file's link count becomes 0 and no process has the file open, the space occupied by the file is freed, and the file is no longer accessible. If one or more processes have the file open when the last link is removed, the link is removed before unlink() returns, but the removal of the file contents is postponed until all references to the file are closed.

Parameters
_pathPoints to the path name that names the file to be unlinked.
Return Value
On Success, returns 0. On Failure, returns -1, errno may be set.

wunlink ( const wchar_t * )

IMPORT_C intwunlink(const wchar_t *_path)

A wide-character version of unlink().

write ( int, const char *, size_t )

IMPORT_C intwrite(int_fildes,
const char *_buf,
size_t_nbyte
)

Writes a block of data of the length specified by cnt.

Return Value
On Success, returns the number of bytes written to the file. The number shall never be greater than cnt. On Failure, returns -1, errno may be set.

_exit ( int )

IMPORT_C void_exit(int_status)

getpid ( void )

IMPORT_C pid_tgetpid(void)

NB. open is also declared in fcntl.h

sleep ( unsigned int )

IMPORT_C unsignedsleep(unsigned int_seconds)

remove

wremove

alarm ( unsigned )

unsignedalarm(unsigned_secs)

chown ( const char *, uid_t, gid_t )

intchown(const char *_path,
uid_t_owner,
gid_t_group
)

ctermid ( char * )

char *ctermid(char *_s)

cuserid ( char * )

char *cuserid(char *_s)

execl ( const char *, const char *, ... )

intexecl(const char *_path,
const char *,
...
)

execle ( const char *, const char *, ... )

intexecle(const char *_path,
const char *,
...
)

execlp ( const char *, const char *, ... )

intexeclp(const char *_file,
const char *,
...
)

execv ( const char *, char *const )

intexecv(const char *_path,
char *const_argv
)

execve ( const char *, char *const, char *const )

intexecve(const char *_path,
char *const_argv,
char *const_envp
)

execvp ( const char *, char *const )

intexecvp(const char *_file,
char *const_argv
)

fork ( void )

pid_t fork(void)

fpathconf ( int, int )

longfpathconf(int_fd,
int_name
)

getegid ( void )

gid_t getegid(void)

geteuid ( void )

uid_t geteuid(void)

getgid ( void )

gid_t getgid(void)

getgroups ( int, gid_t )

intgetgroups(int_gidsetsize,
gid_t_grouplist
)

getlogin ( void )

char *getlogin(void)

getpagesize ( void )

size_t getpagesize(void)

getpgrp ( void )

pid_t getpgrp(void)

getppid ( void )

pid_t getppid(void)

getuid ( void )

uid_t getuid(void)

link ( const char *, const char * )

intlink(const char *_path1,
const char *_path2
)

pathconf ( char *, int )

longpathconf(char *_path,
int_name
)

pause ( void )

intpause(void)

pipe ( int )

intpipe(int_fildes)

sbrk ( size_t )

void *sbrk(size_tincr)

setgid ( gid_t )

intsetgid(gid_t_gid)

setpgid ( pid_t, pid_t )

intsetpgid(pid_t_pid,
pid_t_pgid
)

setsid ( void )

pid_t setsid(void)

setuid ( uid_t )

intsetuid(uid_t_uid)

sysconf ( int )

longsysconf(int_name)

tcgetpgrp ( int )

pid_t tcgetpgrp(int_fildes)

tcsetpgrp ( int, pid_t )

inttcsetpgrp(int_fildes,
pid_t_pgrp_id
)

ttyname ( int )

char *ttyname(int_fildes)

_SC_ARG_MAX

_SC_CHILD_MAX

_SC_CLK_TCK

_SC_NGROUPS_MAX

_SC_OPEN_MAX

_SC_JOB_CONTROL

_SC_SAVED_IDS

_SC_VERSION

_SC_PAGESIZE

_PC_LINK_MAX

_PC_MAX_CANON

_PC_MAX_INPUT

_PC_NAME_MAX

_PC_PATH_MAX

_PC_PIPE_BUF

_PC_CHOWN_RESTRICTED

_PC_NO_TRUNC

_PC_VDISABLE

F_OK

R_OK

W_OK

X_OK

SEEK_SET

SEEK_CUR

SEEK_END

STDIN_FILENO

STDOUT_FILENO

STDERR_FILENO

MAXNAMLEN

MAXPATHLEN