libowfat/io_internal.h

92 lines
1.7 KiB
C
Raw Normal View History

2003-09-02 00:14:04 +00:00
#include "io.h"
#include "array.h"
#ifdef __MINGW32__
#include "socket.h"
extern HANDLE io_comport;
#else
2003-09-06 01:15:00 +00:00
#include "haveepoll.h"
#include "havekqueue.h"
#include "havedevpoll.h"
#include "havesigio.h"
#ifdef HAVE_SIGIO
#define _GNU_SOURCE
#include <signal.h>
#endif
#endif
2003-09-02 00:14:04 +00:00
typedef struct {
2003-11-11 19:50:42 +00:00
tai6464 timeout;
2003-09-02 00:14:04 +00:00
unsigned int wantread:1;
unsigned int wantwrite:1;
unsigned int canread:1;
unsigned int canwrite:1;
unsigned int nonblock:1;
unsigned int inuse:1;
#ifdef __MINGW32__
unsigned int readqueued:2;
unsigned int writequeued:2;
unsigned int acceptqueued:2;
unsigned int connectqueued:2;
unsigned int sendfilequeued:2;
unsigned int listened:1;
#endif
long next_read;
long next_write;
2003-09-10 00:28:51 +00:00
void* cookie;
2003-11-15 00:11:24 +00:00
void* mmapped;
long maplen;
uint64 mapofs;
#ifdef __MINGW32__
OVERLAPPED or,ow,os; /* overlapped for read+accept, write+connect, sendfile */
HANDLE /* fd, */ mh;
char inbuf[8192];
int bytes_read,bytes_written;
DWORD errorcode;
SOCKET next_accept;
#endif
2003-09-02 00:14:04 +00:00
} io_entry;
extern array io_fds;
extern uint64 io_wanted_fds;
extern array io_pollfds;
extern long first_readable;
extern long first_writeable;
2004-03-06 10:35:09 +00:00
extern enum __io_waitmode {
2003-09-06 01:15:00 +00:00
UNDECIDED,
POLL
#ifdef HAVE_KQUEUE
,KQUEUE
#endif
#ifdef HAVE_EPOLL
,EPOLL
#endif
#ifdef HAVE_SIGIO
,_SIGIO
#endif
#ifdef HAVE_DEVPOLL
,DEVPOLL
#endif
#ifdef __MINGW32__
,COMPLETIONPORT
#endif
2003-09-06 01:15:00 +00:00
} io_waitmode;
#if defined(HAVE_KQUEUE) || defined(HAVE_EPOLL) || defined(HAVE_DEVPOLL)
extern int io_master;
#endif
#if defined(HAVE_SIGIO)
extern int io_signum;
extern sigset_t io_ss;
extern long alt_firstread;
extern long alt_firstwrite;
2003-09-06 01:15:00 +00:00
#endif
int64 io_waituntil2(int64 milliseconds);
2004-02-27 17:04:02 +00:00
void io_sigpipe(void);
#define debug_printf(x)