Author: mturk
Date: Tue Aug 4 16:18:57 2009
New Revision: 800861
URL: http://svn.apache.org/viewvc?rev=800861&view=rev
Log:
Check for O_CLOEXEC in file open()
Modified:
commons/sandbox/runtime/trunk/src/main/native/configure
Modified: commons/sandbox/runtime/trunk/src/main/native/configure
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/configure?rev=800861&r1=800860&r2=800861&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/configure (original)
+++ commons/sandbox/runtime/trunk/src/main/native/configure Tue Aug 4 16:18:57
2009
@@ -702,6 +702,32 @@
echo $rc
}
+have_file_cloexec()
+{
+ printf "Checking for %-32s" "O_CLOEXEC flag" 1>&2
+ cat > $test.c << EOF
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+int main() {return open("$test.c", O_RDONLY|O_CLOEXEC) == -1;}
+EOF
+ rc=0
+ co="`$cc $ccflags $cppopts $test.c -o $test$exe 2>&1`"
+ if [ ".$co" = . ]; then
+ rc=1
+ else
+ test -x $test$exe && rc=1
+ fi
+ rm -rf $test.* $test *.pdb >/dev/null 2>&1 || true
+ if [ $rc = 1 ]; then
+ echo ok 1>&2
+ else
+ echo "not found" 1>&2
+ fi
+ echo $rc
+}
+
check_sizeof()
{
printf "Checking for sizeof %-25s" "$1" 1>&2
@@ -883,6 +909,7 @@
#define HAVE_EPOLL_CREATE1 `have_function epoll_create1`
#define HAVE_SIGSETJMP `have_function sigsetjmp`
#define HAVE_SOCK_CLOEXEC `have_sock_cloexec`
+#define HAVE_FILE_CLOEXEC `have_file_cloexec`
#define HAVE_OFF64_T $have_off64t
#define HAVE_LONG_LONG $have_long_long
#define HAVE_LONG_DOUBLE $have_long_double