Add support for DragonFly BSD by sharing code for FreeBSD.

This commit is contained in:
Frank Denis 2011-11-12 15:36:31 -08:00 committed by Ben Noordhuis
parent 93faeb2189
commit 89ea3be6c2
3 changed files with 17 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -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) {