From f67416822a54109bd9cfa0fd210d7d8f53412ced Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Wed, 14 Jun 2017 13:09:23 -0500 Subject: move all compatibility library stuff into libgcompat/ --- resource.c | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 resource.c (limited to 'resource.c') diff --git a/resource.c b/resource.c deleted file mode 100644 index 029b31e..0000000 --- a/resource.c +++ /dev/null @@ -1,37 +0,0 @@ -#include /* setrlimit, struct rlimit */ -#include /* assert */ -#include /* dlsym, RTLD_NEXT */ -#include /* NULL */ -#include /* memcpy */ - -/* Sigh. - * Valve compiled Steam against the glibc2.2 version of setrlimit. - * This broken version aliased 0 to RLIM_INFINITY. - * - * So, what you have to do is: if you want to run steam with this gcompat, - * ensure you compile *without* defining NO_BROKEN_SHADOW_SETRLIMIT. - * If you do *not* want to run steam with this gcompat, define it. - * - * The only problem with enabling this all the time is that if a binary - * really does need a ulimit to be 0 for any reason (such as coredumps), it - * very obviously won't work here. - */ -#ifndef NO_BROKEN_SHADOW_SETRLIMIT -int (*real_rlimit)(int, const struct rlimit *); - -int setrlimit(int resource, const struct rlimit *rlim) -{ - struct rlimit my_rlim; - real_rlimit = dlsym(RTLD_NEXT, "setrlimit"); - assert(real_rlimit != NULL); - - memcpy(&my_rlim, rlim, sizeof(struct rlimit)); - - if(my_rlim.rlim_cur == 0) - { - my_rlim.rlim_cur = my_rlim.rlim_max; - } - - return real_rlimit(resource, &my_rlim); -} -#endif -- cgit v1.2.3-70-g09d2