From e7e9dfee8839e01f515ae5d977a4d688b607accd Mon Sep 17 00:00:00 2001 From: Unbit Date: Sat, 16 Mar 2013 15:45:49 +0100 Subject: [PATCH] fixed DragonFlyBSD support --- core/logging.c | 17 +++++++++++++---- uwsgiconfig.py | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/core/logging.c b/core/logging.c index 66a6a317..4f0700a0 100644 --- a/core/logging.c +++ b/core/logging.c @@ -1,9 +1,9 @@ -#define _NO_UWSGI_RB -#include "uwsgi.h" - +#ifndef __DragonFly__ +#include +#endif #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) -#include #include +#include #elif defined(__sun__) /* Terrible Hack !!! */ #ifndef _LP64 @@ -17,6 +17,10 @@ #include #endif +#ifdef __DragonFly__ +#include +#endif + extern struct uwsgi_server uwsgi; //use this instead of fprintf to avoid buffering mess with udp logging @@ -737,8 +741,13 @@ void get_memusage(uint64_t * rss, uint64_t * vsz) { struct kinfo_proc *kproc; kproc = kvm_getprocs(kv, KERN_PROC_PID, uwsgi.mypid, &cnt); if (kproc && cnt > 0) { +#if defined(__FreeBSD__) *vsz = kproc->ki_size; *rss = kproc->ki_rssize * uwsgi.page_size; +#elif defined(__DragonFly__) + *vsz = kproc->kp_vm_map_size; + *rss = kproc->kp_vm_rssize * uwsgi.page_size; +#endif } #elif defined(UWSGI_NEW_OPENBSD) struct kinfo_proc *kproc; diff --git a/uwsgiconfig.py b/uwsgiconfig.py index 67e3b2ba..8fbb50da 100644 --- a/uwsgiconfig.py +++ b/uwsgiconfig.py @@ -676,7 +676,7 @@ class uConf(object): if int(sun_major) >= 5: if int(sun_minor) >= 10: event_mode = 'port' - elif uwsgi_os in ('Darwin', 'FreeBSD', 'OpenBSD', 'NetBSD'): + elif uwsgi_os in ('Darwin', 'FreeBSD', 'OpenBSD', 'NetBSD', 'DragonFly'): event_mode = 'kqueue' elif uwsgi_os.startswith('CYGWIN'): event_mode = 'poll'