macos x support

master
leitner 21 years ago
parent 8f188cc95b
commit f21e1c57a3

@ -21,6 +21,8 @@
remove socket_sendfile now that we have io_sendfile remove socket_sendfile now that we have io_sendfile
break out alloca #include dependency into havealloca.h break out alloca #include dependency into havealloca.h
support HP-UX sendfile64 (thanks to Rolf Eike Beer) support HP-UX sendfile64 (thanks to Rolf Eike Beer)
support Solaris sendfile64
support MacOS X sendfile (thanks to Bernhard Schmidt)
0.16: 0.16:
add buffer_fromsa (make buffer from stralloc) add buffer_fromsa (make buffer from stralloc)

@ -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 \ 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 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 CC=gcc
CFLAGS=-pipe -Wall -O2 -fomit-frame-pointer CFLAGS=-pipe -Wall -O2 -fomit-frame-pointer
@ -130,8 +130,8 @@ CFLAGS+=-I.
t.o: iopause.h t.o: iopause.h
t: t.o libowfat.a t: t.o libowfat.a libsocket
$(DIET) $(CC) -g -o $@ t.o libowfat.a $(DIET) $(CC) -g -o $@ t.o libowfat.a `cat libsocket`
.PHONY: all clean tar install rename .PHONY: all clean tar install rename
clean: 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 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 -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_accept6.o socket_connect6.o socket_local6.o socket_mchopcount6.o \
socket_mcjoin6.o socket_mcleave6.o socket_mcloop6.o socket_recv6.o \ socket_mcjoin6.o socket_mcleave6.o socket_mcloop6.o socket_recv6.o \

@ -5,6 +5,7 @@
#include "havesendfile.h" #include "havesendfile.h"
#if defined(HAVE_BSDSENDFILE) #if defined(HAVE_BSDSENDFILE)
#define SENDFILE 1
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/uio.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/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/uio.h> #include <sys/uio.h>
@ -7,7 +12,6 @@
#include <stdlib.h> #include <stdlib.h>
#include "havealloca.h" #include "havealloca.h"
#include "iob_internal.h" #include "iob_internal.h"
#include "havebsdsf.h"
int64 iob_send(int64 s,io_batch* b) { int64 iob_send(int64 s,io_batch* b) {
iob_entry* e,* last; iob_entry* e,* last;
@ -16,7 +20,6 @@ int64 iob_send(int64 s,io_batch* b) {
long i; long i;
long headers; long headers;
#ifdef HAVE_BSDSENDFILE #ifdef HAVE_BSDSENDFILE
#define SENDFILE 1
long trailers; long trailers;
#endif #endif

@ -1,3 +1,6 @@
/* for macos X, don't ask */
#define SENDFILE 1
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/uio.h> #include <sys/uio.h>

@ -2,6 +2,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/uio.h> #include <sys/uio.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <stdio.h>
int main() { int main() {
/* /*
@ -18,17 +19,20 @@ int main() {
0 /* offset */, 23 /* nbytes */, 0 /* offset */, 23 /* nbytes */,
x, 0); x, 0);
perror("sendfile"); perror("sendfile");
return 0;
} }
#elif defined (__sun__) && defined(__svr4__) #elif defined (__sun__) && defined(__svr4__)
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/sendfile.h> #include <sys/sendfile.h>
#include <stdio.h>
int main() { int main() {
off_t o; off_t o;
o=0; o=0;
sendfile(1 /* dest */, 0 /* src */,&o,23 /* nbytes */); sendfile(1 /* dest */, 0 /* src */,&o,23 /* nbytes */);
perror("sendfile"); perror("sendfile");
return 0;
} }
#else #else
#error unsupported architecture #error unsupported architecture

Loading…
Cancel
Save