compat / vcbuild / include / unistd.hon commit Merge branch 'jk/git-prompt' (ded408f)
   1#ifndef _UNISTD_
   2#define _UNISTD_
   3
   4/* Win32 define for porting git*/
   5
   6#ifndef _MODE_T_
   7#define _MODE_T_
   8typedef unsigned short _mode_t;
   9
  10#ifndef _NO_OLDNAMES
  11typedef _mode_t mode_t;
  12#endif
  13#endif  /* Not _MODE_T_ */
  14
  15#ifndef _SSIZE_T_
  16#define _SSIZE_T_
  17typedef long _ssize_t;
  18
  19#ifndef _OFF_T_
  20#define _OFF_T_
  21typedef long _off_t;
  22
  23#ifndef _NO_OLDNAMES
  24typedef _off_t  off_t;
  25#endif
  26#endif  /* Not _OFF_T_ */
  27
  28
  29#ifndef _NO_OLDNAMES
  30typedef _ssize_t ssize_t;
  31#endif
  32#endif /* Not _SSIZE_T_ */
  33
  34typedef signed char int8_t;
  35typedef unsigned char   uint8_t;
  36typedef short  int16_t;
  37typedef unsigned short  uint16_t;
  38typedef int  int32_t;
  39typedef unsigned   uint32_t;
  40typedef long long  int64_t;
  41typedef unsigned long long   uint64_t;
  42
  43typedef long long  intmax_t;
  44typedef unsigned long long uintmax_t;
  45
  46typedef int64_t off64_t;
  47
  48#define INTMAX_MIN  _I64_MIN
  49#define INTMAX_MAX  _I64_MAX
  50#define UINTMAX_MAX _UI64_MAX
  51
  52#define STDOUT_FILENO 1
  53#define STDERR_FILENO 2
  54
  55/* Some defines for _access nAccessMode (MS doesn't define them, but
  56 * it doesn't seem to hurt to add them). */
  57#define F_OK    0       /* Check for file existence */
  58/* Well maybe it does hurt.  On newer versions of MSVCRT, an access mode
  59   of 1 causes invalid parameter error. */
  60#define X_OK    0       /* MS access() doesn't check for execute permission. */
  61#define W_OK    2       /* Check for write permission */
  62#define R_OK    4       /* Check for read permission */
  63
  64#define _S_IFIFO        0x1000  /* FIFO */
  65#define _S_IFCHR        0x2000  /* Character */
  66#define _S_IFBLK        0x3000  /* Block: Is this ever set under w32? */
  67#define _S_IFDIR        0x4000  /* Directory */
  68#define _S_IFREG        0x8000  /* Regular */
  69
  70#define _S_IFMT         0xF000  /* File type mask */
  71
  72#define _S_IXUSR        _S_IEXEC
  73#define _S_IWUSR        _S_IWRITE
  74#define _S_IRUSR        _S_IREAD
  75#define _S_ISDIR(m)     (((m) & _S_IFMT) == _S_IFDIR)
  76
  77#define S_IFIFO         _S_IFIFO
  78#define S_IFCHR         _S_IFCHR
  79#define S_IFBLK         _S_IFBLK
  80#define S_IFDIR         _S_IFDIR
  81#define S_IFREG         _S_IFREG
  82#define S_IFMT          _S_IFMT
  83#define S_IEXEC         _S_IEXEC
  84#define S_IWRITE        _S_IWRITE
  85#define S_IREAD         _S_IREAD
  86#define S_IRWXU         _S_IRWXU
  87#define S_IXUSR         _S_IXUSR
  88#define S_IWUSR         _S_IWUSR
  89#define S_IRUSR         _S_IRUSR
  90
  91
  92#define S_ISDIR(m)      (((m) & S_IFMT) == S_IFDIR)
  93#define S_ISREG(m)      (((m) & S_IFMT) == S_IFREG)
  94#define S_ISFIFO(m)     (((m) & S_IFMT) == S_IFIFO)
  95
  96#endif