From 1d3ef5238312755492352d6aac38e8b5a868db42 Mon Sep 17 00:00:00 2001 From: Greg Lewis Date: Tue, 28 Aug 2007 15:24:32 +0000 Subject: [PATCH] . Sync the BSD specific code with the changes between 1.5 and 1.6 and start closing file descriptors at FAIL_FILENO + 1 rather than 3. This fixes the problem with determining the exit code for exec()'ed processes. PR: 115557 Submitted by: Michiel Boland --- java/jdk16/Makefile | 2 +- .../files/patch-j2se-lang-UNIXProcess_md.c | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 java/jdk16/files/patch-j2se-lang-UNIXProcess_md.c diff --git a/java/jdk16/Makefile b/java/jdk16/Makefile index d57d08b39d87..c0798697995e 100644 --- a/java/jdk16/Makefile +++ b/java/jdk16/Makefile @@ -7,7 +7,7 @@ PORTNAME= jdk PORTVERSION= ${JDK_VERSION}.${JDK_UPDATE_VERSION}p${JDK_PATCHSET_VERSION} -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= java devel MASTER_SITES= # http://download.java.net/jdk6/ # http://www.eyesbeyond.com/freebsddom/java/jdk16.html diff --git a/java/jdk16/files/patch-j2se-lang-UNIXProcess_md.c b/java/jdk16/files/patch-j2se-lang-UNIXProcess_md.c new file mode 100644 index 000000000000..6c5d4aa41200 --- /dev/null +++ b/java/jdk16/files/patch-j2se-lang-UNIXProcess_md.c @@ -0,0 +1,31 @@ +$FreeBSD$ + +--- ../../j2se/src/solaris/native/java/lang/UNIXProcess_md.c 13 Aug 2007 21:37:38 -0000 1.4 ++++ ../../j2se/src/solaris/native/java/lang/UNIXProcess_md.c 28 Aug 2007 06:36:09 -0000 +@@ -264,7 +264,7 @@ + static int + closeDescriptors(void) + { +- return _thread_sys_closefrom(3); ++ return _thread_sys_closefrom(FAIL_FILENO + 1); + } + + #elif defined(_ALLBSD_SOURCE) +@@ -282,7 +282,7 @@ + /* + * BSDNOTE: There's no known way to find list of all open file descriptors + * associated with process in FreeBSD. Therefore we have to pass from +- * fd == 3 to maximum fd per process number. It's possible to retrive ++ * fd == FAIL_FILENO + 1 to maximum fd per process number. It's possible to retrive + * max number of fd's with three ways: sysctl(kern.maxfilesperproc), + * getrlimit(RLIMIT_NOFILE) and getdtablesize(). In current implementation + * getdtablesize() returns MIN() of first two ways. +@@ -297,7 +297,7 @@ + max_fd = getdtablesize(); + ebadf = 0; + +- for (i = 3; i < max_fd; i++) { ++ for (i = FAIL_FILENO + 1; i < max_fd; i++) { + if (close(i) < 0) { ebadf++; } else { ebadf = 0; } + /* + * GUESS_FINISHED subsequent calls to close() returned EBADF, assume