Back to home page

Enduro/X

 
 

    


0001 #ifndef _UNISTD_H
0002 #define _UNISTD_H    1
0003 
0004 /* This file intended to serve as a drop-in replacement for
0005  *  unistd.h on Windows
0006  *  Please add functionality as neeeded
0007  */
0008 
0009 #include <stdlib.h>
0010 #include <io.h>
0011 //CMB - not needed for cgreen!
0012 //#include <getopt.h> /* getopt from: http://www.pwilson.net/sample.html. */
0013 #include <process.h> /* for getpid() and the exec..() family */
0014 
0015 #define srandom srand
0016 #define random rand
0017 
0018 /* Values for the second argument to access.
0019    These may be OR'd together.  */
0020 #define R_OK    4       /* Test for read permission.  */
0021 #define W_OK    2       /* Test for write permission.  */
0022 //#define   X_OK    1       /* execute permission - unsupported in windows*/
0023 #define F_OK    0       /* Test for existence.  */
0024 
0025 #define access _access
0026 #define ftruncate _chsize
0027 
0028 #define ssize_t int
0029 
0030 #define STDIN_FILENO 0
0031 #define STDOUT_FILENO 1
0032 #define STDERR_FILENO 2
0033 /* should be in some equivalent to <sys/types.h> */
0034 /*
0035 typedef __int8            int8_t;
0036 typedef __int16           int16_t;
0037 typedef __int32           int32_t;
0038 typedef __int64           int64_t;
0039 typedef unsigned __int8   uint8_t;
0040 typedef unsigned __int16  uint16_t;
0041 typedef unsigned __int32  uint32_t;
0042 typedef unsigned __int64  uint64_t;
0043 */
0044 #define pipe(x) _pipe(x,256,0)
0045 
0046 #endif /* unistd.h  */