changeset 7074:43b8a9ce4c53

. Undo a merge botch. closeDescriptors() and associated functions have moved to childproc.c. So remove them from here rather than merging them back in with the BSD changes.
author Greg Lewis <glewis@eyesbeyond.com>
date Sun, 20 Apr 2014 11:16:43 -0700
parents fce4580b1310
children 98c8aed0346d
files src/solaris/native/java/lang/UNIXProcess_md.c
diffstat 1 files changed, 0 insertions(+), 101 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/native/java/lang/UNIXProcess_md.c	Sat Apr 19 01:32:17 2014 -0700
+++ b/src/solaris/native/java/lang/UNIXProcess_md.c	Sun Apr 20 11:16:43 2014 -0700
@@ -276,107 +276,6 @@
     }
 }
 
-static ssize_t
-restartableWrite(int fd, const void *buf, size_t count)
-{
-    ssize_t result;
-    RESTARTABLE(write(fd, buf, count), result);
-    return result;
-}
-
-static int
-restartableDup2(int fd_from, int fd_to)
-{
-    int err;
-    RESTARTABLE(dup2(fd_from, fd_to), err);
-    return err;
-}
-
-static int
-restartableClose(int fd)
-{
-    int err;
-    RESTARTABLE(close(fd), err);
-    return err;
-}
-
-static int
-closeSafely(int fd)
-{
-    return (fd == -1) ? 0 : restartableClose(fd);
-}
-
-static int
-isAsciiDigit(char c)
-{
-  return c >= '0' && c <= '9';
-}
-
-#if defined(__OpenBSD__)
-static int
-closeDescriptors(void)
-{
-    int err;
-    RESTARTABLE(closefrom(FAIL_FILENO + 1), err);
-    return err;
-}
-#else
-
-#if defined(_ALLBSD_SOURCE)
-#define FD_DIR "/dev/fd"
-#define dirent64 dirent
-#define readdir64 readdir
-#else
-#define FD_DIR "/proc/self/fd"
-#endif
-
-static int
-closeDescriptors(void)
-{
-    DIR *dp;
-    struct dirent64 *dirp;
-    int from_fd = FAIL_FILENO + 1;
-
-    /* We're trying to close all file descriptors, but opendir() might
-     * itself be implemented using a file descriptor, and we certainly
-     * don't want to close that while it's in use.  We assume that if
-     * opendir() is implemented using a file descriptor, then it uses
-     * the lowest numbered file descriptor, just like open().  So we
-     * close a couple explicitly.  */
-
-    restartableClose(from_fd);          /* for possible use by opendir() */
-    restartableClose(from_fd + 1);      /* another one for good luck */
-
-    if ((dp = opendir(FD_DIR)) == NULL)
-        return 0;
-
-    /* We use readdir64 instead of readdir to work around Solaris bug
-     * 6395699: /proc/self/fd fails to report file descriptors >= 1024 on Solaris 9
-     */
-    while ((dirp = readdir64(dp)) != NULL) {
-        int fd;
-        if (isAsciiDigit(dirp->d_name[0]) &&
-            (fd = strtol(dirp->d_name, NULL, 10)) >= from_fd + 2)
-            restartableClose(fd);
-    }
-
-    closedir(dp);
-
-    return 1;
-}
-#endif
-
-static int
-moveDescriptor(int fd_from, int fd_to)
-{
-    if (fd_from != fd_to) {
-        if ((restartableDup2(fd_from, fd_to) == -1) ||
-            (restartableClose(fd_from) == -1))
-            return -1;
-    }
-    return 0;
-}
-
 static const char *
 getBytes(JNIEnv *env, jbyteArray arr)
 {