Synesis Software

unistd.h
[Synesis Software UNIX Emulation for Win32]


Detailed Description

Standard limits and declarations.


Typedefs

typedef int pid_t
 Process identifier type.

Enumerations

enum  {
  _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,
  _PC_AIX_DISK_PARTITION,
  _PC_AIX_DISK_SIZE,
  _PC_FILESIZEBITS,
  _PC_SYNC_IO
}

Functions

int link (char const *originalFile, char const *linkName)
 Creates a hardlink.
int unlink (char const *path)
 Unlinks a file or directory.
int chdir (char const *dirName)
 Change the current working directory.
char * getcwd (char *buffer, size_t max_len)
 Get the current working directory.
int mkdir (char const *dirName, unsigned mode)
 Creates the given directory.
int rmdir (char const *dirName)
 Removes the given directory.
int close (int handle)
 Closes a file.
int getpagesize (void)
 Returns the size, in bytes, of the page size.
long pathconf (char const *path, int name)
 Provides access to various system limits not available at compile time.
char * realpath (char const *path, char resolvedPath[])
 Turns path into a fully qualified path, resolving all symbolic links, multiple /, /.
int usleep (unsigned long microSeconds)
 Suspends execution for the given internal.
pid_t getpid (void)
 Returns the current process identifier.
int gethostname (char *name, size_t cchName)
 Returns the host name for the current machine.


Typedef Documentation

typedef int pid_t

Process identifier type.


Enumeration Type Documentation

anonymous enum

Enumerator:
_PC_LINK_MAX  The maximum number of links to the file.
_PC_MAX_CANON  Maximum number of bytes in canonical input line. Applicable only to terminal devices.
_PC_MAX_INPUT  Maximum number of bytes allowed in an input queue. Applicable only to terminal devices.
_PC_NAME_MAX  Maximum number of bytes in a file name, not including a nul terminator. This number can range from 14 through 255. This value is applicable only to a directory file.
_PC_PATH_MAX  Maximum number of bytes in a path name, including a nul terminator.
_PC_PIPE_BUF  Maximum number of bytes guaranteed to be written atomically. This value is applicable only to a first-in-first-out (FIFO).
_PC_CHOWN_RESTRICTED  Returns 0 if the use of the chown subroutine is restricted to a process with appropriate privileges, and if the chown subroutine is restricted to changing the group ID of a file only to the effective group ID of the process or to one of its supplementary group IDs.
_PC_NO_TRUNC  Returns 0 if long component names are truncated. This value is applicable only to a directory file.
_PC_VDISABLE  This is always 0. No disabling character is defined. This value is applicable only to a terminal device.
_PC_AIX_DISK_PARTITION  Determines the physical partition size of the disk. Note: The _PC_AIX_DISK_PARTITION variable is available only to the root user.
_PC_AIX_DISK_SIZE  Determines the disk size in megabytes. Note: The _PC_AIX_DISK_SIZE variable is available only to the root user. Note: The _PC_FILESIZEBITS and PC_SYNC_IO flags apply to AIX 4.3 and later releases.
_PC_FILESIZEBITS  Returns the minimum number of bits required to hold the file system's maximum file size as a signed integer. The smallest value returned is 32.
_PC_SYNC_IO  Returns -1 if the file system does not support the Synchronized Input and Output option. Any value other than -1 is returned if the file system supports the option.


Function Documentation

int chdir ( char const *  dirName  ) 

Change the current working directory.

This function changes the current working directory to the directory specified by dirName. dirName must refer to an existing directory.

Parameters:
dirName Path of new working directory
Returns:
O on success, or -1 if there is an error

References errno_from_Win32().

int close ( int  handle  ) 

Closes a file.

Parameters:
handle The handle of the file to be closed
Returns:
0 on success, or -1 if there is an error

char* getcwd ( char *  buffer,
size_t  max_len 
)

Get the current working directory.

This function gets the full path of the current working directory and stores it in buffer.

Parameters:
buffer Storage location for the current working directory
max_len Maximum length of path (in characters)
Returns:
buffer on success, or NULL to indicate error.

References errno_from_Win32().

int gethostname ( char *  name,
size_t  cchName 
)

Returns the host name for the current machine.

Parameters:
name Pointer to an array of characters to receive the results
cchName Number of characters available in the buffer
Return values:
0 the operation completed successfully
-1 the operation failed
Note:
This function's calling convention is stdcall, to ensure compatibility if it is loaded (from ws2_32l.dll) dynamically.

int getpagesize ( void   ) 

Returns the size, in bytes, of the page size.

pid_t getpid ( void   ) 

Returns the current process identifier.

int link ( char const *  originalFile,
char const *  linkName 
)

Creates a hardlink.

This function creates a link from originalFile to linkName.

Parameters:
originalFile Path of the original file
linkName Path of the link
Returns:
O on success, or -1 if there is an error
Note:
Hardlink support is only available on Windows 2000 and later, and only works within a single drive.

References errno_from_Win32(), and get_current_drive().

int mkdir ( char const *  dirName,
unsigned  mode 
)

Creates the given directory.

This function creates the named directory.

Parameters:
dirName Path of directory to remove
mode The access permissions of the directory
Returns:
O on success, or -1 if there is an error

References errno_from_Win32().

long pathconf ( char const *  path,
int  name 
)

char* realpath ( char const *  path,
char  resolvedPath[] 
)

Turns path into a fully qualified path, resolving all symbolic links, multiple /, /.

/ and /../

Parameters:
path The relative path to be converted into absolute form
resolvedPath Pointer to a buffer to receive the path. This must contain sufficient storage for a valid path

References errno_from_Win32().

int rmdir ( char const *  dirName  ) 

Removes the given directory.

This function removes the named directory.

Parameters:
dirName Path of directory to remove
Returns:
O on success, or -1 if there is an error

References errno_from_Win32().

int unlink ( char const *  path  ) 

Unlinks a file or directory.

Parameters:
path The path of the file or directory to unlink
Returns:
O on success, or -1 if there is an error

References errno_from_Win32().

int usleep ( unsigned long  microSeconds  ) 

Suspends execution for the given internal.

Parameters:
microSeconds The number of microseconds in the sleep interval


UNIX Emulation for Win32 Libraries documentation © Synesis Software Pty Ltd, 2002-2010