Bugzilla – Attachment 3305 Details for
Bug 3049
ssh startup time on OSX is linear to _SC_OPEN_MAX
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch against https://github.com/openssh/openssh-portable
ssh-high-startup-time.patch (text/plain), 1.94 KB, created by
likan_999.student
on 2019-08-02 05:21:55 AEST
(
hide
)
Description:
Patch against https://github.com/openssh/openssh-portable
Filename:
MIME Type:
Creator:
likan_999.student
Created:
2019-08-02 05:21:55 AEST
Size:
1.94 KB
patch
obsolete
>From 9b47fd8f3b2f656e4f773daf22a129bc8e64f9f3 Mon Sep 17 00:00:00 2001 >From: Kan Li <likan999@users.noreply.github.com> >Date: Wed, 31 Jul 2019 11:22:52 -0700 >Subject: [PATCH] Fix SSH high startup time on OSX when _SC_OPEN_MAX is high. > >--- > configure.ac | 3 +++ > openbsd-compat/bsd-closefrom.c | 23 +++++++++++++++++++++++ > 2 files changed, 26 insertions(+) > >diff --git a/configure.ac b/configure.ac >index 1c35b090..34581c3f 100644 >--- a/configure.ac >+++ b/configure.ac >@@ -679,6 +679,9 @@ main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16)) > AC_CHECK_LIB([sandbox], [sandbox_apply], [ > SSHDLIBS="$SSHDLIBS -lsandbox" > ]) >+ AC_CHECK_HEADERS([libproc.h], [ >+ AC_CHECK_DECLS([proc_pidinfo], [], [], [#include <libproc.h>]) >+ ]) > ;; > *-*-dragonfly*) > SSHDLIBS="$SSHDLIBS -lcrypt" >diff --git a/openbsd-compat/bsd-closefrom.c b/openbsd-compat/bsd-closefrom.c >index b56476a2..cbf528b3 100644 >--- a/openbsd-compat/bsd-closefrom.c >+++ b/openbsd-compat/bsd-closefrom.c >@@ -46,6 +46,9 @@ > # include <ndir.h> > # endif > #endif >+#if !defined(HAVE_FCNTL_CLOSEM) && defined(HAVE_LIBPROC_H) && HAVE_DECL_PROC_PIDINFO >+#include <libproc.h> >+#endif > > #ifndef OPEN_MAX > # define OPEN_MAX 256 >@@ -64,6 +67,26 @@ closefrom(int lowfd) > { > (void) fcntl(lowfd, F_CLOSEM, 0); > } >+#elif defined(HAVE_LIBPROC_H) && HAVE_DECL_PROC_PIDINFO >+void >+closefrom(int lowfd) >+{ >+ int bufsize, i, n, fd; >+ pid_t pid; >+ struct proc_fdinfo *fdinfo_buf; >+ >+ pid = getpid(); >+ bufsize = proc_pidinfo(pid, PROC_PIDLISTFDS, 0, NULL, 0); >+ if (bufsize <= 0) return; >+ fdinfo_buf = (struct proc_fdinfo*) malloc(bufsize); >+ if (fdinfo_buf == NULL) return; >+ bufsize = proc_pidinfo(pid, PROC_PIDLISTFDS, 0, fdinfo_buf, bufsize); >+ for (i = 0, n = bufsize / PROC_PIDLISTFD_SIZE; i < n; ++i) { >+ fd = fdinfo_buf[i].proc_fd; >+ if (fd >= lowfd) close(fd); >+ } >+ free(fdinfo_buf); >+} > #else > void > closefrom(int lowfd) >-- >2.21.0.vfs.1.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 3049
:
3305
|
3306
|
3307
|
3309