additional win32 stuff

git-svn-id: svn://svn.code.sf.net/p/libkqueue/code/trunk@368 fb4e3144-bc1c-4b72-a658-5bcd248dd7f7
This commit is contained in:
mheily 2011-01-14 03:46:18 +00:00
parent 6c5c5b2308
commit 34d9c9b036
7 changed files with 15 additions and 7 deletions

View File

@ -38,7 +38,6 @@
#include <sys/types.h>
#include <stdint.h>
#define LIBKQUEUE 1
int _libkqueue_init(void) __attribute__ ((constructor));
#endif
struct timespec;

View File

@ -123,6 +123,7 @@ filter_unregister_all(struct kqueue *kq)
int
filter_socketpair(struct filter *filt)
{
#ifndef _WIN32
int sockfd[2];
if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfd) < 0)
@ -131,6 +132,9 @@ filter_socketpair(struct filter *filt)
fcntl(sockfd[0], F_SETFL, O_NONBLOCK);
filt->kf_wfd = sockfd[0];
filt->kf_pfd = sockfd[1];
#else
#warning FIXME function has no effect
#endif
return (0);
}

View File

@ -149,7 +149,7 @@ knote_get_socket_type(struct knote *kn)
slen = sizeof(lsock);
lsock = 0;
i = getsockopt(kn->kev.ident, SOL_SOCKET, SO_ACCEPTCONN, &lsock, &slen);
i = getsockopt(kn->kev.ident, SOL_SOCKET, SO_ACCEPTCONN, (char *) &lsock, &slen);
if (i < 0) {
switch (errno) {
case ENOTSOCK: /* same as lsock = 0 */

View File

@ -148,11 +148,13 @@ kqueue_get(int kq)
return (ent);
}
int VISIBLE
kqueue(void)
{
struct kqueue *kq;
#ifdef _WIN32
static int kqueue_id = 0;
#endif
struct kqueue *kq;
int tmp;
kq = calloc(1, sizeof(*kq));
@ -163,12 +165,14 @@ kqueue(void)
#ifdef NDEBUG
KQUEUE_DEBUG = 0;
#elif _WIN32
/* Experimental port, always debug */
KQUEUE_DEBUG = 1;
#else
KQUEUE_DEBUG = (getenv("KQUEUE_DEBUG") == NULL) ? 0 : 1;
#endif
#ifdef _WIN32
static int kqueue_id = 0;
pthread_rwlock_wrlock(&kqtree_mtx);
kqueue_id++;
pthread_rwlock_unlock(&kqtree_mtx);

View File

@ -29,6 +29,7 @@ struct evfilt_data;
#if defined(_WIN32)
# include "../windows/platform.h"
# include "../common/queue.h"
#elif defined(__linux__)
# include "../posix/platform.h"
# include "../linux/platform.h"

View File

@ -14,7 +14,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "private.h"
#include "../common/private.h"
BOOL WINAPI DllMain(
HINSTANCE self,

View File

@ -37,7 +37,7 @@
#define __func__ __FUNCDNAME__
#endif
#define snprintf _snprintf_s
#define snprintf _snprintf
#define ssize_t SSIZE_T
/* For POSIX compatibility when compiling, not for actual use */