mirror of https://github.com/F-Stack/f-stack.git
fix kqueue can't add multi event onetime, modify struct event fromm freebsd11 to freebsd13.
This commit is contained in:
parent
f318b88d4e
commit
64c543441e
|
@ -203,10 +203,10 @@ ngx_process_events_and_timers(ngx_cycle_t *cycle)
|
|||
ngx_uint_t flags;
|
||||
ngx_msec_t timer, delta;
|
||||
#if (NGX_HAVE_FSTACK)
|
||||
static ngx_msec_t initial; //msec
|
||||
static ngx_msec_t initial; //msec
|
||||
#endif
|
||||
|
||||
if (ngx_timer_resolution) {
|
||||
if (ngx_timer_resolution) {
|
||||
timer = NGX_TIMER_INFINITE;
|
||||
flags = 0;
|
||||
|
||||
|
|
119
lib/ff_event.h
119
lib/ff_event.h
|
@ -43,36 +43,102 @@ extern "C" {
|
|||
#define EVFILT_PROC (-5) /* attached to struct proc */
|
||||
#define EVFILT_SIGNAL (-6) /* attached to struct proc */
|
||||
#define EVFILT_TIMER (-7) /* timers */
|
||||
/* EVFILT_NETDEV (-8) no longer supported */
|
||||
#define EVFILT_PROCDESC (-8) /* attached to process descriptors */
|
||||
#define EVFILT_FS (-9) /* filesystem events */
|
||||
#define EVFILT_LIO (-10) /* attached to lio requests */
|
||||
#define EVFILT_USER (-11) /* User events */
|
||||
#define EVFILT_SYSCOUNT 11
|
||||
#define EVFILT_SENDFILE (-12) /* attached to sendfile requests */
|
||||
#define EVFILT_EMPTY (-13) /* empty send socket buf */
|
||||
#define EVFILT_SYSCOUNT 13
|
||||
|
||||
#define EV_SET(kevp_, a, b, c, d, e, f) do { \
|
||||
struct kevent *kevp = (kevp_); \
|
||||
(kevp)->ident = (a); \
|
||||
(kevp)->filter = (b); \
|
||||
(kevp)->flags = (c); \
|
||||
(kevp)->fflags = (d); \
|
||||
(kevp)->data = (e); \
|
||||
(kevp)->udata = (f); \
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#define EV_SET(kevp_, a, b, c, d, e, f) do { \
|
||||
*(kevp_) = (struct kevent){ \
|
||||
.ident = (a), \
|
||||
.filter = (b), \
|
||||
.flags = (c), \
|
||||
.fflags = (d), \
|
||||
.data = (e), \
|
||||
.udata = (f), \
|
||||
.ext = {0}, \
|
||||
}; \
|
||||
} while(0)
|
||||
#else /* Pre-C99 or not STDC (e.g., C++) */
|
||||
/* The definition of the local variable kevp could possibly conflict
|
||||
* with a user-defined value passed in parameters a-f.
|
||||
*/
|
||||
#define EV_SET(kevp_, a, b, c, d, e, f) do { \
|
||||
struct kevent *kevp = (kevp_); \
|
||||
(kevp)->ident = (a); \
|
||||
(kevp)->filter = (b); \
|
||||
(kevp)->flags = (c); \
|
||||
(kevp)->fflags = (d); \
|
||||
(kevp)->data = (e); \
|
||||
(kevp)->udata = (f); \
|
||||
(kevp)->ext[0] = 0; \
|
||||
(kevp)->ext[1] = 0; \
|
||||
(kevp)->ext[2] = 0; \
|
||||
(kevp)->ext[3] = 0; \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
struct kevent {
|
||||
uintptr_t ident; /* identifier for this event */
|
||||
short filter; /* filter for event */
|
||||
__uintptr_t ident; /* identifier for this event */
|
||||
short filter; /* filter for event */
|
||||
unsigned short flags; /* action flags for kqueue */
|
||||
unsigned int fflags; /* filter flag value */
|
||||
__int64_t data; /* filter data value */
|
||||
void *udata; /* opaque user data identifier */
|
||||
__uint64_t ext[4]; /* extensions */
|
||||
};
|
||||
|
||||
#if defined(_WANT_FREEBSD11_KEVENT)
|
||||
/* Older structure used in FreeBSD 11.x and older. */
|
||||
struct kevent_freebsd11 {
|
||||
__uintptr_t ident; /* identifier for this event */
|
||||
short filter; /* filter for event */
|
||||
unsigned short flags;
|
||||
unsigned int fflags;
|
||||
__intptr_t data;
|
||||
void *udata; /* opaque user data identifier */
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(_WANT_KEVENT32) || (defined(_KERNEL) && defined(__LP64__))
|
||||
struct kevent32 {
|
||||
uint32_t ident; /* identifier for this event */
|
||||
short filter; /* filter for event */
|
||||
u_short flags;
|
||||
u_int fflags;
|
||||
intptr_t data;
|
||||
void *udata; /* opaque user data identifier */
|
||||
};
|
||||
#ifndef __amd64__
|
||||
uint32_t pad0;
|
||||
#endif
|
||||
uint32_t data1, data2;
|
||||
uint32_t udata; /* opaque user data identifier */
|
||||
#ifndef __amd64__
|
||||
uint32_t pad1;
|
||||
#endif
|
||||
uint32_t ext64[8];
|
||||
};
|
||||
|
||||
#ifdef _WANT_FREEBSD11_KEVENT
|
||||
struct kevent32_freebsd11 {
|
||||
u_int32_t ident; /* identifier for this event */
|
||||
short filter; /* filter for event */
|
||||
u_short flags;
|
||||
u_int fflags;
|
||||
int32_t data;
|
||||
u_int32_t udata; /* opaque user data identifier */
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* actions */
|
||||
#define EV_ADD 0x0001 /* add event to kq (implies enable) */
|
||||
#define EV_DELETE 0x0002 /* delete event from kq */
|
||||
#define EV_ENABLE 0x0004 /* enable event */
|
||||
#define EV_DISABLE 0x0008 /* disable event (not reported) */
|
||||
#define EV_FORCEONESHOT 0x0100 /* enable _ONESHOT and force trigger */
|
||||
|
||||
/* flags */
|
||||
#define EV_ONESHOT 0x0010 /* only report one occurrence */
|
||||
|
@ -83,6 +149,7 @@ struct kevent {
|
|||
#define EV_SYSFLAGS 0xF000 /* reserved by system */
|
||||
#define EV_DROP 0x1000 /* note should be dropped */
|
||||
#define EV_FLAG1 0x2000 /* filter-specific flag */
|
||||
#define EV_FLAG2 0x4000 /* filter-specific flag */
|
||||
|
||||
/* returned values */
|
||||
#define EV_EOF 0x8000 /* EOF detected */
|
||||
|
@ -111,6 +178,7 @@ struct kevent {
|
|||
* data/hint flags for EVFILT_{READ|WRITE}, shared with userspace
|
||||
*/
|
||||
#define NOTE_LOWAT 0x0001 /* low water mark */
|
||||
#define NOTE_FILE_POLL 0x0002 /* behave like poll() */
|
||||
|
||||
/*
|
||||
* data/hint flags for EVFILT_VNODE, shared with userspace
|
||||
|
@ -122,9 +190,15 @@ struct kevent {
|
|||
#define NOTE_LINK 0x0010 /* link count changed */
|
||||
#define NOTE_RENAME 0x0020 /* vnode was renamed */
|
||||
#define NOTE_REVOKE 0x0040 /* vnode access was revoked */
|
||||
#define NOTE_OPEN 0x0080 /* vnode was opened */
|
||||
#define NOTE_CLOSE 0x0100 /* file closed, fd did not
|
||||
allowed write */
|
||||
#define NOTE_CLOSE_WRITE 0x0200 /* file closed, fd did allowed
|
||||
write */
|
||||
#define NOTE_READ 0x0400 /* file was read */
|
||||
|
||||
/*
|
||||
* data/hint flags for EVFILT_PROC, shared with userspace
|
||||
* data/hint flags for EVFILT_PROC and EVFILT_PROCDESC, shared with userspace
|
||||
*/
|
||||
#define NOTE_EXIT 0x80000000 /* process exited */
|
||||
#define NOTE_FORK 0x40000000 /* process forked */
|
||||
|
@ -137,6 +211,13 @@ struct kevent {
|
|||
#define NOTE_TRACKERR 0x00000002 /* could not track child */
|
||||
#define NOTE_CHILD 0x00000004 /* am a child process */
|
||||
|
||||
/* additional flags for EVFILT_TIMER */
|
||||
#define NOTE_SECONDS 0x00000001 /* data is seconds */
|
||||
#define NOTE_MSECONDS 0x00000002 /* data is milliseconds */
|
||||
#define NOTE_USECONDS 0x00000004 /* data is microseconds */
|
||||
#define NOTE_NSECONDS 0x00000008 /* data is nanoseconds */
|
||||
#define NOTE_ABSTIME 0x00000010 /* timeout is absolute */
|
||||
|
||||
struct knote;
|
||||
SLIST_HEAD(klist, knote);
|
||||
struct kqueue;
|
||||
|
@ -145,9 +226,9 @@ struct knlist {
|
|||
struct klist kl_list;
|
||||
void (*kl_lock)(void *); /* lock function */
|
||||
void (*kl_unlock)(void *);
|
||||
void (*kl_assert_locked)(void *);
|
||||
void (*kl_assert_unlocked)(void *);
|
||||
void *kl_lockarg; /* argument passed to kl_lockf() */
|
||||
void (*kl_assert_lock)(void *, int);
|
||||
void *kl_lockarg; /* argument passed to lock functions */
|
||||
int kl_autodestroy;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue