1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-06 06:30:19 +00:00

audio/pulseaudio: speed up startup

Instead of looping over all possible filedescriptors to close them,
Use closefrom() where possible
This commit is contained in:
Baptiste Daroussin 2024-04-04 08:50:30 +02:00
parent fc136e6599
commit b6601a931c
2 changed files with 25 additions and 1 deletions

View File

@ -4,7 +4,7 @@
PORTNAME= pulseaudio
DISTVERSION= 16.1
PORTREVISION= 3
PORTREVISION= 4
CATEGORIES= audio
MASTER_SITES= https://freedesktop.org/software/pulseaudio/releases/

View File

@ -0,0 +1,24 @@
--- src/pulsecore/core-util.c.orig 2024-04-04 06:44:07 UTC
+++ src/pulsecore/core-util.c
@@ -2849,12 +2849,19 @@ int pa_close_allv(const int except_fds[]) {
}
#endif
-
+#if defined(__FreeBSD__)
+ maxfd = 0;
+ for (i = 0; except_fds[i] >= 0; i++)
+ if (except_fds[i] > maxfd)
+ maxfd = except_fds[i];
+ maxfd++;
+ closefrom(maxfd);
+#else
if (getrlimit(RLIMIT_NOFILE, &rl) >= 0)
maxfd = (int) rl.rlim_max;
else
maxfd = sysconf(_SC_OPEN_MAX);
-
+#endif
for (fd = 3; fd < maxfd; fd++) {
int i;
bool found;