From 9512cee6144d5c59004718d8a65c15e2059fe7ce Mon Sep 17 00:00:00 2001 From: leitner Date: Fri, 2 Sep 2005 21:11:58 +0000 Subject: [PATCH] add -D_REENTRANT to CFLAGS so libowfat can be used in multi-threaded programs --- CHANGES | 2 ++ GNUmakefile | 2 ++ Makefile | 2 ++ array.h | 1 - io/io_fd.c | 4 ++++ io/io_mmapwritefile.c | 1 + io/io_sendfile.c | 1 + io_internal.h | 3 +++ 8 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index cca82fa..127c273 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,8 @@ array_allocate no longer truncates the array array_get now not only checks whether the element fits in the allocates space, it also needs to be in the initialized space. + add -D_REENTRANT to CFLAGS so libowfat can be used in multi-threaded + programs 0.24: fix scan_to_sa (Tim Lorenz) diff --git a/GNUmakefile b/GNUmakefile index b60fdca..2c9d1e7 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -20,6 +20,8 @@ CFLAGS=-pipe -W -Wall -O2 -fomit-frame-pointer # CFLAGS += -fstrict-aliasing -Wstrict-aliasing=2 +CFLAGS += -D_REENTRANT + # startrip ifneq ($(DEBUG),) CFLAGS=-pipe -Wall -g diff --git a/Makefile b/Makefile index 6a05f9b..8a99c97 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,8 @@ CC=gcc CFLAGS=-pipe -W -Wall -O2 -fomit-frame-pointer #CFLAGS=-pipe -Os -march=pentiumpro -mcpu=pentiumpro -fomit-frame-pointer -fschedule-insns2 -Wall +CFLAGS += -D_REENTRANT + # CFLAGS += -fstrict-aliasing -Wstrict-aliasing=2 array_allocate.o: array/array_allocate.c safemult.h uint16.h \ diff --git a/array.h b/array.h index 658d7e5..953ce14 100644 --- a/array.h +++ b/array.h @@ -2,7 +2,6 @@ #define ARRAY_H #include "uint64.h" -#include typedef struct { char* p; diff --git a/io/io_fd.c b/io/io_fd.c index b707c40..e361ddf 100644 --- a/io/io_fd.c +++ b/io/io_fd.c @@ -88,6 +88,10 @@ int io_fd(int64 d) { sigprocmask(SIG_BLOCK,&io_ss,0)==0) io_waitmode=_SIGIO; } +#endif +#ifdef __MINGW32__ + io_comport=CreateIoCompletionPort(INVALID_HANDLE_VALUE,NULL,0,1); + if (io_comport) io_waitmode=COMPLETIONPORT; #endif } #if defined(HAVE_SIGIO) diff --git a/io/io_mmapwritefile.c b/io/io_mmapwritefile.c index a1a50d5..1fdd7f9 100644 --- a/io/io_mmapwritefile.c +++ b/io/io_mmapwritefile.c @@ -6,6 +6,7 @@ #include #else #include +#include #endif #define BUFSIZE 16384 diff --git a/io/io_sendfile.c b/io/io_sendfile.c index 92ea954..5c3b20a 100644 --- a/io/io_sendfile.c +++ b/io/io_sendfile.c @@ -3,6 +3,7 @@ #include "io_internal.h" #include "havebsdsf.h" #include "havesendfile.h" +#include #if defined(HAVE_BSDSENDFILE) #define SENDFILE 1 diff --git a/io_internal.h b/io_internal.h index 8b67dd7..34411f7 100644 --- a/io_internal.h +++ b/io_internal.h @@ -56,6 +56,9 @@ extern enum __io_waitmode { #ifdef HAVE_DEVPOLL ,DEVPOLL #endif +#ifdef __MINGW32__ + ,COMPLETIONPORT +#endif } io_waitmode; #if defined(HAVE_KQUEUE) || defined(HAVE_EPOLL) || defined(HAVE_DEVPOLL)