Browse Source

macos x support

master
Felix von Leitner 18 years ago
parent
commit
e8c96ef3a7
  1. 2
      CHANGES
  2. 15
      GNUmakefile
  3. 1
      io/io_sendfile.c
  4. 1
      io/iob_send.c
  5. 3
      trybsdsf.c
  6. 4
      trysendfile.c

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

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

1
io/io_sendfile.c

@ -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
io/iob_send.c

@ -16,6 +16,7 @@ int64 iob_send(int64 s,io_batch* b) {
long i;
long headers;
#ifdef HAVE_BSDSENDFILE
#define SENDFILE 1
long trailers;
#endif

3
trybsdsf.c

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

4
trysendfile.c

@ -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…
Cancel
Save