00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00047 #ifndef SYNSOFT_UNIXEM_INCL_H_UNISTD
00048 #define SYNSOFT_UNIXEM_INCL_H_UNISTD
00049
00050 #ifndef UNIXEM_DOCUMENTATION_SKIP_SECTION
00051 # define SYNSOFT_UNIXEM_VER_H_UNISTD_MAJOR 3
00052 # define SYNSOFT_UNIXEM_VER_H_UNISTD_MINOR 0
00053 # define SYNSOFT_UNIXEM_VER_H_UNISTD_REVISION 1
00054 # define SYNSOFT_UNIXEM_VER_H_UNISTD_EDIT 43
00055 #endif
00056
00057
00058
00059
00060
00061 #include <unixem/unistd.h>
00062
00063
00064
00065
00066
00067
00068 #if defined(__BORLANDC__)
00069 # include <dir.h>
00070 # define UNIXEM_chdir_PROVIDED_BY_COMPILER
00071 # define UNIXEM_getcwd_PROVIDED_BY_COMPILER
00072 # define UNIXEM_mkdir_PROVIDED_BY_COMPILER
00073 # define UNIXEM_rmdir_PROVIDED_BY_COMPILER
00074 #elif defined(__DMC__)
00075 # include <direct.h>
00076 # define UNIXEM_chdir_PROVIDED_BY_COMPILER
00077 # define UNIXEM_close_PROVIDED_BY_COMPILER
00078 # define UNIXEM_getcwd_PROVIDED_BY_COMPILER
00079 # define UNIXEM_pid_t_PROVIDED_BY_COMPILER
00080 #elif defined(__GNUC__)
00081 # include <io.h>
00082 # define UNIXEM_chdir_PROVIDED_BY_COMPILER
00083 # define UNIXEM_chmod_PROVIDED_BY_COMPILER
00084 # define UNIXEM_getcwd_PROVIDED_BY_COMPILER
00085 # define UNIXEM_mkdir_PROVIDED_BY_COMPILER
00086 # ifndef _NO_OLDNAMES
00087 # define UNIXEM_pid_t_PROVIDED_BY_COMPILER
00088 # endif
00089 # define UNIXEM_rmdir_PROVIDED_BY_COMPILER
00090 #elif defined(__INTEL_COMPILER)
00091 # if defined(_WIN32) && \
00092 !defined(__STDC__)
00093 # include <direct.h>
00094 # define UNIXEM_chdir_PROVIDED_BY_COMPILER
00095 # define UNIXEM_getcwd_PROVIDED_BY_COMPILER
00096 # define UNIXEM_mkdir_PROVIDED_BY_COMPILER
00097 # define UNIXEM_rmdir_PROVIDED_BY_COMPILER
00098 # endif
00099 #elif defined(__MWERKS__)
00100 # define UNIXEM_mkdir_PROVIDED_BY_COMPILER
00101 #elif defined(__WATCOMC__)
00102 # define UNIXEM_chdir_PROVIDED_BY_COMPILER
00103 # define UNIXEM_getcwd_PROVIDED_BY_COMPILER
00104 # define UNIXEM_mkdir_PROVIDED_BY_COMPILER
00105 # define UNIXEM_pid_t_PROVIDED_BY_COMPILER
00106 # define UNIXEM_rmdir_PROVIDED_BY_COMPILER
00107 #elif defined(_MSC_VER)
00108 # if !defined(__STDC__)
00109 # include <direct.h>
00110 # define UNIXEM_chdir_PROVIDED_BY_COMPILER
00111 # define UNIXEM_getcwd_PROVIDED_BY_COMPILER
00112 # define UNIXEM_mkdir_PROVIDED_BY_COMPILER
00113 # define UNIXEM_rmdir_PROVIDED_BY_COMPILER
00114 # include <stdio.h>
00115 # define UNIXEM_unlink_PROVIDED_BY_COMPILER
00116 # define UNIXEM_close_PROVIDED_BY_COMPILER
00117 # endif
00118 #else
00119 # error Compiler not discriminated
00120 #endif
00121
00122
00123 #if defined(_MSC_VER) && \
00124 !defined(__STDC__)
00125 # define UNIXEM_UNISTD_INCLUDING_MS_DIRECT_H
00126 #endif
00127
00128
00129
00140
00141
00142 #ifndef _WIN32
00143 # error This file is only currently defined for compilation on Win32 systems
00144 #endif
00145
00146
00147
00148
00149
00150
00204 #define _PC_LINK_MAX UNIXEM_PC_LINK_MAX
00205 #define _PC_MAX_CANON UNIXEM_PC_MAX_CANON
00206 #define _PC_MAX_INPUT UNIXEM_PC_MAX_INPUT
00207 #define _PC_NAME_MAX UNIXEM_PC_NAME_MAX
00208 #define _PC_PATH_MAX UNIXEM_PC_PATH_MAX
00209 #define _PC_PIPE_BUF UNIXEM_PC_PIPE_BUF
00210 #define _PC_CHOWN_RESTRICTED UNIXEM_PC_CHOWN_RESTRICTED
00211 #define _PC_NO_TRUNC UNIXEM_PC_NO_TRUNC
00212 #define _PC_VDISABLE UNIXEM_PC_VDISABLE
00213 #define _PC_AIX_DISK_PARTITION UNIXEM_PC_AIX_DISK_PARTITION
00214 #define _PC_AIX_DISK_SIZE UNIXEM_PC_AIX_DISK_SIZE
00215 #define _PC_FILESIZEBITS UNIXEM_PC_FILESIZEBITS
00216 #define _PC_SYNC_IO UNIXEM_PC_SYNC_IO
00217
00218
00219
00220
00221
00222 #if !defined(UNIXEM_pid_t_PROVIDED_BY_COMPILER) && \
00223 !defined(pid_t) && \
00224 !( defined(_SCHED_H) && \
00225 defined(PTW32_DLLPORT))
00226 # ifndef UNIXEM_DOCUMENTATION_SKIP_SECTION
00227 # define UNIXEM_pid_t_DEFINED
00228 # endif
00229
00230 typedef unixem_pid_t pid_t;
00231 #endif
00232
00233
00234
00235
00236
00237 #ifdef __cplusplus
00238 extern "C" {
00239 #endif
00240
00255 #ifdef UNIXEM_DOCUMENTATION_SKIP_SECTION
00256 int link(
00257 char const* originalFile
00258 , char const* linkName
00259 );
00260 #else
00261 # define link unixem_link
00262 #endif
00263
00264 #ifndef UNIXEM_unlink_PROVIDED_BY_COMPILER
00265
00273 #ifdef UNIXEM_DOCUMENTATION_SKIP_SECTION
00274 int unlink(char const* path);
00275 #else
00276 # define unlink unixem_unlink
00277 #endif
00278 #endif
00279
00280
00281 #ifndef UNIXEM_chdir_PROVIDED_BY_COMPILER
00282
00292 #ifdef UNIXEM_DOCUMENTATION_SKIP_SECTION
00293 int chdir(char const* dirName);
00294 #else
00295 # define chdir unixem_chdir
00296 #endif
00297 #endif
00298
00299
00300 #ifndef UNIXEM_getcwd_PROVIDED_BY_COMPILER
00301
00312 #ifdef UNIXEM_DOCUMENTATION_SKIP_SECTION
00313 char* getcwd(
00314 char* buffer
00315 , size_t max_len
00316 );
00317 #else
00318 # define getcwd unixem_getcwd
00319 #endif
00320 #endif
00321
00322
00323 #ifndef UNIXEM_mkdir_PROVIDED_BY_COMPILER
00324
00335 #ifdef UNIXEM_DOCUMENTATION_SKIP_SECTION
00336 int mkdir(
00337 char const* dirName
00338 , unsigned mode
00339 );
00340 #else
00341 # define mkdir unixem_mkdir
00342 #endif
00343 #endif
00344
00345
00346 #ifndef UNIXEM_rmdir_PROVIDED_BY_COMPILER
00347
00356 #ifdef UNIXEM_DOCUMENTATION_SKIP_SECTION
00357 int rmdir(char const* dirName);
00358 #else
00359 # define rmdir unixem_rmdir
00360 #endif
00361 #endif
00362
00363
00364 #ifndef UNIXEM_close_PROVIDED_BY_COMPILER
00365
00372 #ifdef UNIXEM_DOCUMENTATION_SKIP_SECTION
00373 int close(int handle);
00374 #else
00375 # define close unixem_close
00376 #endif
00377 #endif
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00393 #ifdef UNIXEM_DOCUMENTATION_SKIP_SECTION
00394 int getpagesize(void);
00395 #else
00396 # define getpagesize unixem_getpagesize
00397 #endif
00398
00403 #ifdef UNIXEM_DOCUMENTATION_SKIP_SECTION
00404 long pathconf(
00405 char const* path
00406 , int name
00407 );
00408 #else
00409 # define pathconf unixem_pathconf
00410 #endif
00411
00412
00422 #ifdef UNIXEM_DOCUMENTATION_SKIP_SECTION
00423 char* realpath(
00424 char const* path
00425 , char resolvedPath[]
00426 );
00427 #else
00428 # define realpath unixem_realpath
00429 #endif
00430
00437 #ifdef UNIXEM_DOCUMENTATION_SKIP_SECTION
00438 int usleep(unsigned long microSeconds);
00439 #else
00440 # define usleep unixem_usleep
00441 #endif
00442
00443
00448 #ifdef UNIXEM_DOCUMENTATION_SKIP_SECTION
00449 pid_t getpid(void);
00450 #else
00451 # define getpid unixem_getpid
00452 #endif
00453
00454
00455 #ifdef UNIXEM_DOCUMENTATION_SKIP_SECTION
00456
00467 int gethostname(char* name, size_t cchName);
00468 #else
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481 # ifdef __cplusplus
00482 extern "C++"
00483 {
00484 # ifndef UNIXEM_DOCUMENTATION_SKIP_SECTION
00485 inline int gethostname(char* name, size_t cchName)
00486 {
00487 return unixem_gethostname(name, cchName);
00488 }
00489 # endif
00490 }
00491 # else
00492 # include <unixem/internal/winsock.h>
00493 # define gethostname(name, cchName) unixem_gethostname(name, cchName)
00494 # endif
00495 #endif
00496
00497 #ifdef __cplusplus
00498 }
00499 #endif
00500
00501
00502
00505
00506
00507 #endif
00508
00509