Synesis Software

unistd.h
[Synesis Software UNIX Emulation for Win32]


Detailed Description

Standard limits and declarations.


Defines

#define _PC_LINK_MAX   UNIXEM_PC_LINK_MAX
#define _PC_MAX_CANON   UNIXEM_PC_MAX_CANON
#define _PC_MAX_INPUT   UNIXEM_PC_MAX_INPUT
#define _PC_NAME_MAX   UNIXEM_PC_NAME_MAX
#define _PC_PATH_MAX   UNIXEM_PC_PATH_MAX
#define _PC_PIPE_BUF   UNIXEM_PC_PIPE_BUF
#define _PC_CHOWN_RESTRICTED   UNIXEM_PC_CHOWN_RESTRICTED
#define _PC_NO_TRUNC   UNIXEM_PC_NO_TRUNC
#define _PC_VDISABLE   UNIXEM_PC_VDISABLE
#define _PC_AIX_DISK_PARTITION   UNIXEM_PC_AIX_DISK_PARTITION
#define _PC_AIX_DISK_SIZE   UNIXEM_PC_AIX_DISK_SIZE
#define _PC_FILESIZEBITS   UNIXEM_PC_FILESIZEBITS
#define _PC_SYNC_IO   UNIXEM_PC_SYNC_IO

Typedefs

typedef unixem_pid_t pid_t
 Process identifier type.
typedef int unixem_pid_t
 Process-identifier type.

Enumerations

enum  {
  UNIXEM_PC_LINK_MAX,
  UNIXEM_PC_MAX_CANON,
  UNIXEM_PC_MAX_INPUT,
  UNIXEM_PC_NAME_MAX,
  UNIXEM_PC_PATH_MAX,
  UNIXEM_PC_PIPE_BUF,
  UNIXEM_PC_CHOWN_RESTRICTED,
  UNIXEM_PC_NO_TRUNC,
  UNIXEM_PC_VDISABLE,
  UNIXEM_PC_AIX_DISK_PARTITION,
  UNIXEM_PC_AIX_DISK_SIZE,
  UNIXEM_PC_FILESIZEBITS,
  UNIXEM_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.
int unixem_link (char const *originalFile, char const *linkName)
 Creates a hardlink.
int unixem_unlink (char const *path)
 Unlinks a file or directory.
int unixem_chdir (char const *dirName)
 Change the current working directory.
char * unixem_getcwd (char *buffer, size_t max_len)
 Get the current working directory.
int unixem_mkdir (char const *dirName, unsigned mode)
 Creates the given directory.
int unixem_rmdir (char const *dirName)
 Removes the given directory.
int unixem_close (int handle)
 Closes a file.
int unixem_getpagesize (void)
 Returns the size, in bytes, of the page size.
long unixem_pathconf (char const *path, int name)
 Provides access to various system limits not available at compile time.
char * unixem_realpath (char const *path, char resolvedPath[])
 Turns path into a fully qualified path, resolving all symbolic links, multiple /, /.
int unixem_usleep (unsigned long microSeconds)
 Suspends execution for the given internal.
unixem_pid_t unixem_getpid (void)
 Returns the current process identifier.
int __stdcall unixem_gethostname (char *name, size_t cchName)
 Returns the host name for the current machine.


Define Documentation

#define _PC_AIX_DISK_PARTITION   UNIXEM_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.

#define _PC_AIX_DISK_SIZE   UNIXEM_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.

#define _PC_CHOWN_RESTRICTED   UNIXEM_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.

#define _PC_FILESIZEBITS   UNIXEM_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.

#define _PC_LINK_MAX   UNIXEM_PC_LINK_MAX

<

The maximum number of links to the file.

#define _PC_MAX_CANON   UNIXEM_PC_MAX_CANON

<

Maximum number of bytes in canonical input line. Applicable only to terminal devices.

#define _PC_MAX_INPUT   UNIXEM_PC_MAX_INPUT

<

Maximum number of bytes allowed in an input queue. Applicable only to terminal devices.

#define _PC_NAME_MAX   UNIXEM_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.

#define _PC_NO_TRUNC   UNIXEM_PC_NO_TRUNC

<

Returns 0 if long component names are truncated. This value is applicable only to a directory file.

#define _PC_PATH_MAX   UNIXEM_PC_PATH_MAX

<

Maximum number of bytes in a path name, including a nul terminator.

#define _PC_PIPE_BUF   UNIXEM_PC_PIPE_BUF

<

Maximum number of bytes guaranteed to be written atomically. This value is applicable only to a first-in-first-out (FIFO).

#define _PC_SYNC_IO   UNIXEM_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.

#define _PC_VDISABLE   UNIXEM_PC_VDISABLE

<

This is always 0. No disabling character is defined. This value is applicable only to a terminal device.


Typedef Documentation

Process identifier type.

typedef int unixem_pid_t

Process-identifier type.


Enumeration Type Documentation

anonymous enum

Enumerator:
UNIXEM_PC_LINK_MAX  The maximum number of links to the file.
UNIXEM_PC_MAX_CANON  Maximum number of bytes in canonical input line. Applicable only to terminal devices.
UNIXEM_PC_MAX_INPUT  Maximum number of bytes allowed in an input queue. Applicable only to terminal devices.
UNIXEM_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.
UNIXEM_PC_PATH_MAX  Maximum number of bytes in a path name, including a nul terminator.
UNIXEM_PC_PIPE_BUF  Maximum number of bytes guaranteed to be written atomically. This value is applicable only to a first-in-first-out (FIFO).
UNIXEM_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.
UNIXEM_PC_NO_TRUNC  Returns 0 if long component names are truncated. This value is applicable only to a directory file.
UNIXEM_PC_VDISABLE  This is always 0. No disabling character is defined. This value is applicable only to a terminal device.
UNIXEM_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.
UNIXEM_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.
UNIXEM_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.
UNIXEM_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
Note:
This is a macro, which resolves to unixem_chdir()

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
Note:
This is a macro, which resolves to unixem_close()

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.
Note:
This is a macro, which resolves to unixem_getcwd()

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.

Note:
This is a macro, which resolves to unixem_getpagesize()

pid_t getpid ( void   ) 

Returns the current process identifier.

Note:
This is a macro, which resolves to unixem_getpid()

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.

This is a macro, which resolves to unixem_link()

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
Note:
This is a macro, which resolves to unixem_mkdir()

long pathconf ( char const *  path,
int  name 
)

Provides access to various system limits not available at compile time.

Note:
This is a macro, which resolves to unixem_pathconf()

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
Note:
This is a macro, which resolves to unixem_realpath()

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
Note:
This is a macro, which resolves to unixem_rmdir()

int unixem_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 unixem_internal_errno_from_Win32().

int unixem_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* unixem_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 unixem_internal_errno_from_Win32().

int __stdcall unixem_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.

References unixem_internal_errno_from_Win32().

int unixem_getpagesize ( void   ) 

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

unixem_pid_t unixem_getpid ( void   ) 

Returns the current process identifier.

int unixem_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 unixem_internal_errno_from_Win32(), and unixem_internal_get_current_drive().

int unixem_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 unixem_internal_errno_from_Win32().

long unixem_pathconf ( char const *  path,
int  name 
)

char* unixem_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 unixem_internal_errno_from_Win32().

int unixem_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 unixem_internal_errno_from_Win32().

int unixem_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 unixem_internal_errno_from_Win32().

int unixem_usleep ( unsigned long  microSeconds  ) 

Suspends execution for the given internal.

Parameters:
microSeconds The number of microseconds in the sleep interval

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
Note:
This is a macro, which resolves to unixem_unlink()

int usleep ( unsigned long  microSeconds  ) 

Suspends execution for the given internal.

Parameters:
microSeconds The number of microseconds in the sleep interval
Note:
This is a macro, which resolves to unixem_usleep()


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