macos x support
This commit is contained in:
parent
8f188cc95b
commit
f21e1c57a3
2
CHANGES
2
CHANGES
@ -21,6 +21,8 @@
|
||||
remove socket_sendfile now that we have io_sendfile
|
||||
break out alloca #include dependency into havealloca.h
|
||||
support HP-UX sendfile64 (thanks to Rolf Eike Beer)
|
||||
support Solaris sendfile64
|
||||
support MacOS X sendfile (thanks to Bernhard Schmidt)
|
||||
|
||||
0.16:
|
||||
add buffer_fromsa (make buffer from stralloc)
|
||||
|
15
GNUmakefile
15
GNUmakefile
@ -12,7 +12,7 @@ MAN3DIR=${prefix}/man/man3
|
||||
LIBS=byte.a fmt.a scan.a str.a uint.a open.a stralloc.a unix.a socket.a \
|
||||
buffer.a mmap.a taia.a tai.a dns.a case.a mult.a array.a io.a textcode.a
|
||||
|
||||
all: t $(LIBS) libowfat.a
|
||||
all: t $(LIBS) libowfat.a libsocket
|
||||
|
||||
CC=gcc
|
||||
CFLAGS=-pipe -Wall -O2 -fomit-frame-pointer
|
||||
@ -130,8 +130,8 @@ CFLAGS+=-I.
|
||||
|
||||
t.o: iopause.h
|
||||
|
||||
t: t.o libowfat.a
|
||||
$(DIET) $(CC) -g -o $@ t.o libowfat.a
|
||||
t: t.o libowfat.a libsocket
|
||||
$(DIET) $(CC) -g -o $@ t.o libowfat.a `cat libsocket`
|
||||
|
||||
.PHONY: all clean tar install rename
|
||||
clean:
|
||||
@ -234,6 +234,15 @@ select.h: select.h1 select.h2 trysysel.c
|
||||
if $(DIET) $(CC) $(CFLAGS) -c trysysel.c >/dev/null 2>&1; then cp select.h2 select.h; else cp select.h1 select.h; fi
|
||||
-rm -f trysysel.o
|
||||
|
||||
libsocket: trysocket.c
|
||||
if $(DIET) $(CC) $(CFLAGS) -o trysocket trysocket.c >/dev/null 2>&1; then echo ""; else \
|
||||
if $(DIET) $(CC) $(CFLAGS) -o trysocket trysocket.c -lsocket >/dev/null 2>&1; then echo "-lsocket"; else \
|
||||
if $(DIET) $(CC) $(CFLAGS) -o trysocket trysocket.c -lsocket -lnsl >/dev/null 2>&1; then echo "-lsocket -lnsl"; \
|
||||
fi; fi; fi > blah
|
||||
if $(DIET) $(CC) $(CFLAGS) -o trysocket trysendfile.c `cat blah`>/dev/null 2>&1; then cat blah; else \
|
||||
if $(DIET) $(CC) $(CFLAGS) -o trysocket trysendfile.c -lsendfile `cat blah` >/dev/null 2>&1; then echo "-lsendfile"; cat blah; \
|
||||
fi; fi > libsocket
|
||||
rm -f blah trysocket
|
||||
|
||||
socket_accept6.o socket_connect6.o socket_local6.o socket_mchopcount6.o \
|
||||
socket_mcjoin6.o socket_mcleave6.o socket_mcloop6.o socket_recv6.o \
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "havesendfile.h"
|
||||
|
||||
#if defined(HAVE_BSDSENDFILE)
|
||||
#define SENDFILE 1
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/uio.h>
|
||||
|
@ -1,3 +1,8 @@
|
||||
#include "havebsdsf.h"
|
||||
#ifdef HAVE_BSDSENDFILE
|
||||
/* for MacOS X. Yep, they blew it again. */
|
||||
#define SENDFILE 1
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/uio.h>
|
||||
@ -7,7 +12,6 @@
|
||||
#include <stdlib.h>
|
||||
#include "havealloca.h"
|
||||
#include "iob_internal.h"
|
||||
#include "havebsdsf.h"
|
||||
|
||||
int64 iob_send(int64 s,io_batch* b) {
|
||||
iob_entry* e,* last;
|
||||
@ -16,7 +20,6 @@ int64 iob_send(int64 s,io_batch* b) {
|
||||
long i;
|
||||
long headers;
|
||||
#ifdef HAVE_BSDSENDFILE
|
||||
#define SENDFILE 1
|
||||
long trailers;
|
||||
#endif
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
/* for macos X, don't ask */
|
||||
#define SENDFILE 1
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/uio.h>
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/socket.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
/*
|
||||
@ -18,17 +19,20 @@ int main() {
|
||||
0 /* offset */, 23 /* nbytes */,
|
||||
x, 0);
|
||||
perror("sendfile");
|
||||
return 0;
|
||||
}
|
||||
#elif defined (__sun__) && defined(__svr4__)
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/sendfile.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
off_t o;
|
||||
o=0;
|
||||
sendfile(1 /* dest */, 0 /* src */,&o,23 /* nbytes */);
|
||||
perror("sendfile");
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#error unsupported architecture
|
||||
|
Loading…
x
Reference in New Issue
Block a user