From owner-svn-ports-all@freebsd.org Wed Dec 23 17:47:16 2020 Return-Path: Delivered-To: svn-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 012954C65E6; Wed, 23 Dec 2020 17:47:16 +0000 (UTC) (envelope-from tcberner@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D1LJ22M3yz3lLv; Wed, 23 Dec 2020 17:47:12 +0000 (UTC) (envelope-from tcberner@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F4C722317; Wed, 23 Dec 2020 17:47:12 +0000 (UTC) (envelope-from tcberner@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0BNHlCv9061555; Wed, 23 Dec 2020 17:47:12 GMT (envelope-from tcberner@FreeBSD.org) Received: (from tcberner@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0BNHlBBR061553; Wed, 23 Dec 2020 17:47:11 GMT (envelope-from tcberner@FreeBSD.org) Message-Id: <202012231747.0BNHlBBR061553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tcberner set sender to tcberner@FreeBSD.org using -f From: "Tobias C. Berner" Date: Wed, 23 Dec 2020 17:47:11 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-branches@freebsd.org Subject: svn commit: r559008 - in branches/2020Q4/devel/glib20: . files X-SVN-Group: ports-branches X-SVN-Commit-Author: tcberner X-SVN-Commit-Paths: in branches/2020Q4/devel/glib20: . files X-SVN-Commit-Revision: 559008 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Dec 2020 17:47:16 -0000 Author: tcberner Date: Wed Dec 23 17:47:11 2020 New Revision: 559008 URL: https://svnweb.freebsd.org/changeset/ports/559008 Log: MFH: r559006 devel/glib20: loops over all possible file descriptors - Stop glib from looping over all possible file descriptors. - This should greatly increase performance PR: 236815 Submitted by: rozhuk.im@gmail.com (committed version) Reported by: Eugene Grosbein Added: branches/2020Q4/devel/glib20/files/patch-glib_gspawn.c - copied unchanged from r559006, head/devel/glib20/files/patch-glib_gspawn.c Modified: branches/2020Q4/devel/glib20/Makefile Directory Properties: branches/2020Q4/ (props changed) Modified: branches/2020Q4/devel/glib20/Makefile ============================================================================== --- branches/2020Q4/devel/glib20/Makefile Wed Dec 23 17:38:43 2020 (r559007) +++ branches/2020Q4/devel/glib20/Makefile Wed Dec 23 17:47:11 2020 (r559008) @@ -3,7 +3,7 @@ PORTNAME= glib PORTVERSION= 2.66.0 -PORTREVISION= 1 +PORTREVISION= 2 PORTEPOCH= 1 CATEGORIES= devel MASTER_SITES= GNOME Copied: branches/2020Q4/devel/glib20/files/patch-glib_gspawn.c (from r559006, head/devel/glib20/files/patch-glib_gspawn.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/2020Q4/devel/glib20/files/patch-glib_gspawn.c Wed Dec 23 17:47:11 2020 (r559008, copy of r559006, head/devel/glib20/files/patch-glib_gspawn.c) @@ -0,0 +1,81 @@ +--- glib/gspawn.c 2018-09-21 12:29:23.000000000 +0300 ++++ glib/gspawn.c 2019-07-20 18:05:15.486558000 +0300 +@@ -51,6 +51,13 @@ + #include /* for syscall and SYS_getdents64 */ + #endif + ++#ifdef __FreeBSD__ ++#include ++#include ++#include ++#include ++#endif ++ + #include "gspawn.h" + #include "gspawn-private.h" + #include "gthread.h" +@@ -1204,6 +1211,51 @@ + } + #endif + ++#ifdef __FreeBSD__ ++static int ++fdwalk2(int (*func)(void *, int), void *udata, int *ret) { ++ size_t i, bufsz = 0; ++ struct xfile *xfbuf, *xf; ++ int uret = 0, pid_found = 0; ++ int mib[2] = { CTL_KERN, KERN_FILE }; ++ pid_t pid; ++ ++ if (NULL == func) ++ return EINVAL; ++ ++ if (sysctl (mib, nitems(mib), NULL, &bufsz, NULL, 0) == -1) ++ return (errno); ++ bufsz += 65536; ++ xfbuf = alloca (bufsz); ++ if (xfbuf == NULL) ++ return errno; ++ if (sysctl (mib, 2, xfbuf, &bufsz, NULL, 0) == -1) ++ return errno; ++ bufsz /= sizeof(struct xfile); ++ ++ pid = getpid(); ++ for (i = 0; i < bufsz; i++) { ++ xf = &xfbuf[i]; ++ if (pid != xf->xf_pid) { ++ if (pid_found) { ++ return 0; ++ } else { ++ continue; ++ } ++ } ++ pid_found = 1; ++ if (0 > xf->xf_fd) ++ continue; ++ uret = func (udata, xf->xf_fd); ++ if (uret != 0) ++ break; ++ ++ } ++ ++ return 0; ++} ++#endif ++ + /* This function is called between fork() and exec() and hence must be + * async-signal-safe (see signal-safety(7)). */ + static int +@@ -1228,6 +1280,12 @@ + + #if 0 && defined(HAVE_SYS_RESOURCE_H) + struct rlimit rl; ++#endif ++ ++#ifdef __FreeBSD__ ++ if (fdwalk2(cb, data, &res) == 0) ++ return res; ++ /* If any sysctl/malloc call fails continue with the fall back method */ + #endif + + #ifdef __linux__