4 * things that are not available in header files
8 #define hstrerror strerror
10 #define S_IFLNK 0120000 /* Symbolic link */
11 #define S_ISLNK(x) (((x) & S_IFMT) == S_IFLNK)
20 #define WIFEXITED(x) ((unsigned)(x) < 259) /* STILL_ACTIVE */
21 #define WEXITSTATUS(x) ((x) & 0xff)
22 #define WIFSIGNALED(x) ((unsigned)(x) > 259)
33 #define FD_CLOEXEC 0x1
42 int fd; /* file descriptor */
43 short events; /* requested events */
44 short revents; /* returned events */
49 typedef void (__cdecl *sig_handler_t)(int);
51 sig_handler_t sa_handler;
54 #define sigemptyset(x) (void)0
58 struct timeval it_value, it_interval;
62 #define st_blocks st_size/512 /* will be cleaned up later */
69 static inline int readlink(const char *path, char *buf, size_t bufsiz)
70 { errno = ENOSYS; return -1; }
71 static inline int symlink(const char *oldpath, const char *newpath)
72 { errno = ENOSYS; return -1; }
73 static inline int link(const char *oldpath, const char *newpath)
74 { errno = ENOSYS; return -1; }
75 static inline int fchmod(int fildes, mode_t mode)
76 { errno = ENOSYS; return -1; }
77 static inline int fork(void)
78 { errno = ENOSYS; return -1; }
79 static inline unsigned int alarm(unsigned int seconds)
81 static inline int fsync(int fd)
83 static inline int getppid(void)
85 static inline void sync(void)
87 static inline int getuid()
89 static inline struct passwd *getpwnam(const char *name)
91 static inline int fcntl(int fd, int cmd, long arg)
93 if (cmd == F_GETFD || cmd == F_SETFD)
103 static inline int mingw_mkdir(const char *path, int mode)
107 #define mkdir mingw_mkdir
109 static inline int waitpid(pid_t pid, unsigned *status, unsigned options)
112 return _cwait(status, pid, 0);
118 static inline int pipe(int filedes[2])
119 { return _pipe(filedes, 8192, 0); }
122 * implementations of missing functions
125 unsigned int sleep (unsigned int seconds);
126 int mkstemp(char *template);
127 int gettimeofday(struct timeval *tv, void *tz);
128 int poll(struct pollfd *ufds, unsigned int nfds, int timeout);
129 struct tm *gmtime_r(const time_t *timep, struct tm *result);
130 struct tm *localtime_r(const time_t *timep, struct tm *result);
131 int getpagesize(void); /* defined in MinGW's libgcc.a */
132 struct passwd *getpwuid(int uid);
133 int setitimer(int type, struct itimerval *in, struct itimerval *out);
134 int sigaction(int sig, struct sigaction *in, struct sigaction *out);
137 * replacements of existing functions
140 char *mingw_getcwd(char *pointer, int len);
141 #define getcwd mingw_getcwd
144 * git specific compatibility
147 #define has_dos_drive_prefix(path) (isalpha(*(path)) && (path)[1] == ':')
148 #define is_dir_sep(c) ((c) == '/' || (c) == '\\')