Synesis Software

Main Page   Modules   Alphabetical List   Compound List   File List   Compound Members   File Members  

/src/unistd.c File Reference

#include <unixem/unixem.h>
#include <unixem/internal/util.h>
#include <windows.h>
#include <errno.h>
#include <limits.h>
#include "unistd.h"

Defines

#define FILE_ATTRIBUTE_ERROR   (0xFFFFFFFF)
#define _MAX_FNAME   (256)
#define _MAX_PATH   (260)

Functions

int link (const char *originalFile, const char *linkName)
 Creates a hardlink.

int unlink (const char *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 (const char *dirName, unsigned mode)
 Creates the given directory.

int rmdir (const char *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 /, /./ and /../.


Define Documentation

#define _MAX_FNAME   (256)
 

#define _MAX_PATH   (260)
 

#define FILE_ATTRIBUTE_ERROR   (0xFFFFFFFF)
 


Function Documentation

int chdir const char *    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

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.

int getpagesize void   
 

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

int link const char *    originalFile,
const char *    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.

int mkdir const char *    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

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 /, /./ 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

int rmdir const char *    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

int unlink const char *    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

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