Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add support for DragonFly BSD by sharing code for FreeBSD.
  • Loading branch information
jedisct1 authored and bnoordhuis committed Nov 13, 2011
1 parent 93faeb2 commit 89ea3be
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
9 changes: 9 additions & 0 deletions config-unix.mk
Expand Up @@ -74,6 +74,15 @@ OBJS += src/unix/freebsd.o
OBJS += src/unix/kqueue.o
endif

ifeq (DragonFly,$(uname_S))
EV_CONFIG=config_freebsd.h
EIO_CONFIG=config_freebsd.h
CPPFLAGS += -Isrc/ares/config_freebsd
LINKFLAGS+=
OBJS += src/unix/freebsd.o
OBJS += src/unix/kqueue.o
endif

ifeq (NetBSD,$(uname_S))
EV_CONFIG=config_netbsd.h
EIO_CONFIG=config_netbsd.h
Expand Down
2 changes: 1 addition & 1 deletion src/unix/eio/eio.c
Expand Up @@ -316,7 +316,7 @@ static int gettimeofday(struct timeval *tv, struct timezone *tz)
#if HAVE_SENDFILE
# if __linux
# include <sys/sendfile.h>
# elif __FreeBSD__ || defined __APPLE__
# elif __FreeBSD__ || __DragonFly__ || defined __APPLE__
# include <sys/socket.h>
# include <sys/uio.h>
# elif __hpux
Expand Down
8 changes: 7 additions & 1 deletion src/unix/freebsd.c
Expand Up @@ -50,11 +50,17 @@ int uv_exepath(char* buffer, size_t* size) {
return -1;
}


#ifdef __DragonFly__
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_ARGS;
mib[3] = getpid();
#else
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_PATHNAME;
mib[3] = -1;
#endif

cb = *size;
if (sysctl(mib, 4, buffer, &cb, NULL, 0) < 0) {
Expand Down

0 comments on commit 89ea3be

Please sign in to comment.