go against modern advice and set RLIMIT_NOFILE to 65536.
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
We're otherwise really leniant with our fd usage but since Wayland uses fds to allocate buffers, wanting to create more then 1024 widgets causes a crash, justifying this.
This commit is contained in:
parent
6de65dfe87
commit
c9dbca2cc8
2 changed files with 14 additions and 2 deletions
|
|
@ -62,8 +62,8 @@ void MwLLWaylandBufferSetup(struct _MwLLWaylandShmBuffer* buffer, MwU32 width, M
|
|||
|
||||
buffer->fd = mkstemp(temp_name);
|
||||
buffer->fd_back = mkstemp(temp_name_back);
|
||||
if(buffer->fd >= FD_SETSIZE - 1) {
|
||||
MwDispatchError(-1, "Amount of allocated buffers has reached FD_SETSIZE! Cannot continue.\n");
|
||||
if(buffer->fd >= 65536) {
|
||||
MwDispatchError(-1, "Amount of allocated buffers has gone above 65536! Cannot continue.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <sys/poll.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include "../../../external/stb_ds.h"
|
||||
|
||||
|
|
@ -1968,6 +1969,17 @@ static int MwLLWaylandCallInitImpl(void) {
|
|||
char* milsko_backend_env = getenv("MILSKO_BACKEND");
|
||||
char* mw_backend_env = getenv("MW_BACKEND");
|
||||
|
||||
struct rlimit rl;
|
||||
|
||||
/* Set both soft and hard limit to 65536 file descriptors */
|
||||
rl.rlim_cur = 65536; /* soft limit */
|
||||
rl.rlim_max = 65536; /* hard limit */
|
||||
|
||||
if(setrlimit(RLIMIT_NOFILE, &rl) == -1) {
|
||||
perror("setrlimit");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(milsko_backend_env || mw_backend_env) {
|
||||
if(milsko_backend_env) {
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue