mirror of
https://github.com/darlinghq/darling-libkqueue.git
synced 2024-11-23 11:49:50 +00:00
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:
parent
6c5c5b2308
commit
34d9c9b036
@ -38,7 +38,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#define LIBKQUEUE 1
|
||||
int _libkqueue_init(void) __attribute__ ((constructor));
|
||||
#endif
|
||||
|
||||
struct timespec;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
@ -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"
|
||||
|
@ -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,
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user