diff --git a/event.c b/event.c index 21d26a23..db26f2e2 100644 --- a/event.c +++ b/event.c @@ -262,9 +262,31 @@ struct uwsgi_fmon *event_queue_ack_file_monitor(int id) { #ifdef UWSGI_EVENT_TIMER_USE_TIMERFD -#ifndef UNBIT +#ifndef UWSGI_EVENT_TIMER_USE_TIMERFD_NOINC #include -#else +#endif + +#ifndef timerfd_create + +// timerfd support + +enum + { + TFD_CLOEXEC = 02000000, +#define TFD_CLOEXEC TFD_CLOEXEC + TFD_NONBLOCK = 04000 +#define TFD_NONBLOCK TFD_NONBLOCK + }; + + +/* Bits to be set in the FLAGS parameter of `timerfd_settime'. */ +enum + { + TFD_TIMER_ABSTIME = 1 << 0 +#define TFD_TIMER_ABSTIME TFD_TIMER_ABSTIME + }; + + static int timerfd_create (clockid_t __clock_id, int __flags) { return syscall(322, __clock_id, __flags); } diff --git a/unbit.h b/unbit.h index 90528978..13f96fe9 100644 --- a/unbit.h +++ b/unbit.h @@ -49,22 +49,3 @@ struct uidsec_struct { }; - -// timerfd support - -enum - { - TFD_CLOEXEC = 02000000, -#define TFD_CLOEXEC TFD_CLOEXEC - TFD_NONBLOCK = 04000 -#define TFD_NONBLOCK TFD_NONBLOCK - }; - - -/* Bits to be set in the FLAGS parameter of `timerfd_settime'. */ -enum - { - TFD_TIMER_ABSTIME = 1 << 0 -#define TFD_TIMER_ABSTIME TFD_TIMER_ABSTIME - }; - diff --git a/uwsgi.c b/uwsgi.c index c815ddb1..a78da14b 100644 --- a/uwsgi.c +++ b/uwsgi.c @@ -651,6 +651,18 @@ options_parsed: } #ifdef __linux__ + +#ifndef CLONE_NEWUTS +#define CLONE_NEWUTS 0x04000000 +#endif + +#ifndef CLONE_NEWPID +#define CLONE_NEWPID 0x20000000 +#endif + +#ifndef CLONE_NEWIPC +#define CLONE_NEWIPC 0x08000000 +#endif uwsgi.ns = "/ns/001"; if (uwsgi.ns) { void *linux_clone_stack = alloca(uwsgi.page_size); diff --git a/uwsgiconfig.py b/uwsgiconfig.py index 7940a803..fdeebb48 100644 --- a/uwsgiconfig.py +++ b/uwsgiconfig.py @@ -260,6 +260,8 @@ class uConf(object): if timer_mode == 'timerfd': self.cflags.append('-DUWSGI_EVENT_TIMER_USE_TIMERFD') + if not os.path.exists('/usr/include/sys/timerfd.h') and not os.path.exists('/usr/local/include/sys/timerfd.h'): + self.cflags.append('-DUWSGI_EVENT_TIMER_USE_TIMERFD_NOINC') elif timer_mode == 'kqueue': self.cflags.append('-DUWSGI_EVENT_TIMER_USE_KQUEUE') else: