From 6a4fc6f6ca78ef0d2a546f9c1156ac14e9ac9691 Mon Sep 17 00:00:00 2001 From: newbluemoon Date: Mon, 11 Jul 2022 21:21:35 +0200 Subject: [PATCH] nine: replace ulimit with sysconf call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit __UL_GETOPENMAX seems to be glibc specific and not portable. In glibc’s sysdeps/posix/ulimit.c it is assigned the return value of sysconf(_SC_OPEN_MAX). So use the latter in the first place. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5176 CC: mesa-stable Part-of: --- src/gallium/frontends/nine/nine_memory_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/frontends/nine/nine_memory_helper.c b/src/gallium/frontends/nine/nine_memory_helper.c index 1c52a5e0838..f7249ea2ebe 100644 --- a/src/gallium/frontends/nine/nine_memory_helper.c +++ b/src/gallium/frontends/nine/nine_memory_helper.c @@ -1009,7 +1009,7 @@ nine_allocator_create(struct NineDevice9 *device, int memfd_virtualsizelimit) allocator->device = device; allocator->page_size = sysconf(_SC_PAGESIZE); assert(allocator->page_size == 4 << 10); - allocator->num_fd_max = (memfd_virtualsizelimit >= 0) ? MIN2(128, ulimit(__UL_GETOPENMAX)) : 0; + allocator->num_fd_max = (memfd_virtualsizelimit >= 0) ? MIN2(128, sysconf(_SC_OPEN_MAX)) : 0; allocator->min_file_size = DIVUP(100 * (1 << 20), allocator->page_size) * allocator->page_size; /* 100MB files */ allocator->total_allocations = 0; allocator->total_locked_memory = 0;