Simple POSIX I/O emulation layer to work around Windows's defective

Unix I/O:
[_WIN32] (socklen_t, accept, posix_accept, bind. posix_bind, listen)
(posix_listen, setsockopt, posix_setsockopt, shutdown, posix_shutdown)
(socket, posix_socket, close, posix_close, creat, fstat, posix_fstat)
(lseek, posix_lseek, open, posix_open, read, posix_read, write)
(posix_write, fileno, posix_fileno, fcntl, O_NONBLOCK, F_RDLCK)
(F_WRLCK, F_GETFL, F_SETFL, F_SETLK, EWOULDBLOCK, ENOTSOCK)
(flock, fsync, posix_fsync):
New.
(ef_open, io_close, io_input, io_output, io_shutdown, io_noblocking)
(player_accept): Use them to simplify.
[_WIN32] (posix_fd2socket): New.
(empth_select): Use it.
(gen_power): Use it.
This commit is contained in:
Ron Koenderink 2007-08-14 03:33:28 +00:00
parent e7b04123a9
commit 4bbc3f4286
17 changed files with 669 additions and 109 deletions

View file

@ -47,8 +47,8 @@
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/ioctl.h>
#include <unistd.h>
#endif
#include <unistd.h>
#include <signal.h>
#include <errno.h>
#include <fcntl.h>
@ -170,7 +170,7 @@ player_accept(void *unused)
void *inaddr;
int s = player_socket;
struct player *np;
int len;
socklen_t len;
int ns;
int set = 1;
int stacksize;