3-5 C1
This commit is contained in:
parent
e625fb2bf5
commit
6085753a30
|
@ -2,11 +2,11 @@
|
|||
* Author: Manoj Ampalam <manoj.ampalam@microsoft.com>
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/select.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include "test_helper.h"
|
||||
|
||||
#define SMALL_RECV_BUF_SIZE 128
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
* Author: Manoj Ampalam <manoj.ampalam@microsoft.com>
|
||||
*/
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/select.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/select.h>
|
||||
#include "test_helper.h"
|
||||
|
||||
#define PORT "34912"
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
* Author: Manoj Ampalam <manoj.ampalam@microsoft.com>
|
||||
*/
|
||||
|
||||
#define __STDC__ 1
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
|
|
@ -31,23 +31,29 @@
|
|||
#define FD_CLOEXEC 0x1
|
||||
|
||||
|
||||
/*
|
||||
* open() flags and modes
|
||||
* all commented out macros are defined in fcntl.h
|
||||
* they are listed here so as to cross check any conflicts with macros explicitly
|
||||
* defined below.
|
||||
*/
|
||||
/*open access modes. only one of these can be specified*/
|
||||
#define O_RDONLY 0x1
|
||||
#define O_WRONLY 0x2
|
||||
#define O_RDWR 0x4
|
||||
/*open file creation and file status flags // can be bitwise-or'd*/
|
||||
/* #define O_RDONLY 0x0 */
|
||||
/* #define O_WRONLY 0x1 */
|
||||
/* #define O_RDWR 0x2 */
|
||||
/* open file creation and file status flags can be bitwise-or'd*/
|
||||
/* #define O_APPEND 0x8 /*file is opened in append mode*/
|
||||
#define O_NONBLOCK 0x10 /*io operations wont block*/
|
||||
#define O_APPEND 0x20 /*file is opened in append mode*/
|
||||
#define O_CREAT 0x40 /*If the file does not exist it will be created*/
|
||||
/* #define O_CREAT 0x100 /*If the file does not exist it will be created*/
|
||||
/*
|
||||
* If the file exists and is a regular file, and the file is successfully
|
||||
* opened O_RDWR or O_WRONLY, its length shall be truncated to 0, and the mode
|
||||
* and owner shall be unchanged
|
||||
*/
|
||||
#define O_TRUNC 0x80
|
||||
//If O_CREAT and O_EXCL are set, open() shall fail if the file exists
|
||||
#define O_EXCL 0x100
|
||||
#define O_BINARY 0x200 //Gives raw data (while O_TEXT normalises line endings
|
||||
/* #define O_TRUNC 0x200 */
|
||||
/* If O_CREAT and O_EXCL are set, open() shall fail if the file exists */
|
||||
/* #define O_EXCL 0x400 */
|
||||
/* #define O_BINARY 0x8000 //Gives raw data (while O_TEXT normalises line endings */
|
||||
// open modes
|
||||
#define S_IRUSR 00400 //user has read permission
|
||||
#define S_IWUSR 00200 //user has write permission
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
*
|
||||
* POSIX header and needed function definitions
|
||||
*/
|
||||
|
||||
#include "w32posix.h"
|
||||
|
||||
#define fcntl w32_fcntl
|
||||
#define signal w32_signal
|
|
@ -1,9 +0,0 @@
|
|||
/*
|
||||
* Author: Manoj Ampalam <manoj.ampalam@microsoft.com>
|
||||
*
|
||||
* POSIX header and needed function definitions
|
||||
*/
|
||||
|
||||
#include "..\w32posix.h"
|
||||
|
||||
#define fstat w32_fstat
|
|
@ -15,4 +15,5 @@
|
|||
#define dup w32_dup
|
||||
#define dup2 w32_dup2
|
||||
|
||||
#define sleep(sec) Sleep(1000 * sec)
|
||||
#define sleep(sec) Sleep(1000 * sec)
|
||||
#define alarm w32_alarm
|
|
@ -37,6 +37,8 @@ int w32_socketpair(int domain, int type, int sv[2]);
|
|||
|
||||
/*non-network (file) i/o*/
|
||||
#define fdopen w32_fdopen
|
||||
#define fstat w32_fstat
|
||||
|
||||
int w32_pipe(int *pfds);
|
||||
int w32_open(const char *pathname, int flags, ...);
|
||||
int w32_read(int fd, void *dst, unsigned int max);
|
||||
|
@ -46,6 +48,7 @@ int w32_isatty(int fd);
|
|||
FILE* w32_fdopen(int fd, const char *mode);
|
||||
|
||||
/*common i/o*/
|
||||
#define fcntl w32_fcntl
|
||||
int w32_close(int fd);
|
||||
int w32_select(int fds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds,
|
||||
const struct timeval *timeout);
|
||||
|
@ -53,6 +56,11 @@ int w32_fcntl(int fd, int cmd, ... /* arg */);
|
|||
int w32_dup(int oldfd);
|
||||
int w32_dup2(int oldfd, int newfd);
|
||||
|
||||
/* misc */
|
||||
unsigned int w32_alarm(unsigned int seconds);
|
||||
#define signal w32_signal
|
||||
#define mysignal w32_signal
|
||||
|
||||
|
||||
/* Shutdown constants */
|
||||
#define SHUT_WR SD_SEND
|
||||
|
|
|
@ -153,10 +153,8 @@
|
|||
<ItemGroup>
|
||||
<ClInclude Include="debug.h" />
|
||||
<ClInclude Include="inc\defs.h" />
|
||||
<ClInclude Include="inc\fcntl.h" />
|
||||
<ClInclude Include="inc\sys\select.h" />
|
||||
<ClInclude Include="inc\sys\socket.h" />
|
||||
<ClInclude Include="inc\sys\stat.h" />
|
||||
<ClInclude Include="inc\unistd.h" />
|
||||
<ClInclude Include="inc\w32posix.h" />
|
||||
<ClInclude Include="w32fd.h" />
|
||||
|
|
|
@ -50,12 +50,6 @@
|
|||
<ClInclude Include="inc\sys\socket.h">
|
||||
<Filter>inc\sys</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="inc\sys\stat.h">
|
||||
<Filter>inc\sys</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="inc\fcntl.h">
|
||||
<Filter>inc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="inc\w32posix.h">
|
||||
<Filter>inc</Filter>
|
||||
</ClInclude>
|
||||
|
|
Loading…
Reference in New Issue