2016-12-19 23:46:28 +01:00
|
|
|
/*
|
|
|
|
* Author: Manoj Ampalam <manoj.ampalam@microsoft.com>
|
|
|
|
*
|
|
|
|
* POSIX header and needed function definitions
|
|
|
|
*/
|
2017-01-25 23:43:55 +01:00
|
|
|
#pragma once
|
|
|
|
#include "sys\types.h"
|
|
|
|
#include "fcntl.h"
|
2016-12-19 23:46:28 +01:00
|
|
|
|
2017-01-25 23:43:55 +01:00
|
|
|
#define STDIN_FILENO 0
|
|
|
|
#define STDOUT_FILENO 1
|
|
|
|
#define STDERR_FILENO 2
|
|
|
|
|
|
|
|
int w32_ftruncate(int, off_t);
|
|
|
|
#define ftruncate(a, b) w32_ftruncate((a), (b))
|
2016-12-19 23:46:28 +01:00
|
|
|
|
|
|
|
#define pipe w32_pipe
|
2017-01-25 23:43:55 +01:00
|
|
|
int w32_pipe(int *pfds);
|
|
|
|
|
2016-12-19 23:46:28 +01:00
|
|
|
#define read w32_read
|
2017-01-25 23:43:55 +01:00
|
|
|
int w32_read(int fd, void *dst, size_t max);
|
|
|
|
|
2016-12-19 23:46:28 +01:00
|
|
|
#define write w32_write
|
2017-01-25 23:43:55 +01:00
|
|
|
int w32_write(int fd, const void *buf, unsigned int max);
|
|
|
|
|
2016-12-19 23:46:28 +01:00
|
|
|
#define writev w32_writev
|
2017-01-25 23:43:55 +01:00
|
|
|
int w32_writev(int fd, const struct iovec *iov, int iovcnt);
|
|
|
|
|
|
|
|
int w32_isatty(int fd);
|
2016-12-19 23:46:28 +01:00
|
|
|
/* can't do this #define isatty w32_isatty
|
|
|
|
* as there is a variable in code named isatty*/
|
|
|
|
#define isatty(a) w32_isatty((a))
|
2017-01-25 23:43:55 +01:00
|
|
|
|
|
|
|
int w32_close(int fd);
|
2016-12-19 23:46:28 +01:00
|
|
|
#define close w32_close
|
2017-01-25 23:43:55 +01:00
|
|
|
|
|
|
|
int w32_dup(int oldfd);
|
2016-12-19 23:46:28 +01:00
|
|
|
#define dup w32_dup
|
2017-01-25 23:43:55 +01:00
|
|
|
|
|
|
|
int w32_dup2(int oldfd, int newfd);
|
2016-12-19 23:46:28 +01:00
|
|
|
#define dup2 w32_dup2
|
|
|
|
|
|
|
|
#define sleep(sec) Sleep(1000 * sec)
|
2017-01-25 23:43:55 +01:00
|
|
|
|
|
|
|
unsigned int w32_alarm(unsigned int seconds);
|
2016-12-19 23:46:28 +01:00
|
|
|
#define alarm w32_alarm
|
2017-01-25 23:43:55 +01:00
|
|
|
|
|
|
|
long w32_lseek(int fd, long offset, int origin);
|
2016-12-19 23:46:28 +01:00
|
|
|
#define lseek w32_lseek
|
|
|
|
|
|
|
|
#define getdtablesize() MAX_FDS
|
2017-01-25 23:43:55 +01:00
|
|
|
|
|
|
|
int w32_gethostname(char *, size_t);
|
2016-12-19 23:46:28 +01:00
|
|
|
#define gethostname w32_gethostname
|
|
|
|
|
2017-01-25 23:43:55 +01:00
|
|
|
int w32_fsync(int fd);
|
2016-12-19 23:46:28 +01:00
|
|
|
#define fsync(a) w32_fsync((a))
|
|
|
|
|
2017-01-25 23:43:55 +01:00
|
|
|
int w32_symlink(const char *target, const char *linkpath);
|
2016-12-19 23:46:28 +01:00
|
|
|
#define symlink w32_symlink
|
2017-01-25 23:43:55 +01:00
|
|
|
|
|
|
|
int w32_chown(const char *pathname, unsigned int owner, unsigned int group);
|
2016-12-19 23:46:28 +01:00
|
|
|
#define chown w32_chown
|
2017-01-25 23:43:55 +01:00
|
|
|
|
|
|
|
int w32_unlink(const char *path);
|
2016-12-19 23:46:28 +01:00
|
|
|
#define unlink w32_unlink
|
2017-01-25 23:43:55 +01:00
|
|
|
|
|
|
|
int w32_rmdir(const char *pathname);
|
2016-12-19 23:46:28 +01:00
|
|
|
#define rmdir w32_rmdir
|
2017-01-25 23:43:55 +01:00
|
|
|
|
|
|
|
int w32_chdir(const char *dirname);
|
2016-12-19 23:46:28 +01:00
|
|
|
#define chdir w32_chdir
|
2017-01-25 23:43:55 +01:00
|
|
|
|
|
|
|
char *w32_getcwd(char *buffer, int maxlen);
|
2016-12-19 23:46:28 +01:00
|
|
|
#define getcwd w32_getcwd
|
|
|
|
|
2017-01-25 23:43:55 +01:00
|
|
|
|
|
|
|
|
2016-12-19 23:46:28 +01:00
|
|
|
int daemon(int nochdir, int noclose);
|
|
|
|
char *crypt(const char *key, const char *salt);
|
|
|
|
int link(const char *oldpath, const char *newpath);
|
|
|
|
int readlink(const char *path, char *link, int linklen);
|
2017-01-25 23:43:55 +01:00
|
|
|
|
|
|
|
int spawn_child(char* cmd, int in, int out, int err, unsigned long flags);
|