瀏覽代碼

in sysconf, use getrlimit function rather than raw syscall for rlimits

the syscall is deprecated (replaced by prlimit64) and does not work
correctly on x32. this change mildly increases size, but is likely
needed anyway for newer archs that might omit deprecated syscalls.
Rich Felker 11 年之前
父節點
當前提交
6cf7d17f53
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      src/conf/sysconf.c

+ 3 - 3
src/conf/sysconf.c

@@ -228,9 +228,9 @@ long sysconf(int name)
 	} else if (values[name] >= -1) {
 		return values[name];
 	} else if (values[name] < -256) {
-		long lim[2];
-		__syscall(SYS_getrlimit, values[name]&16383, lim);
-		return lim[0] < 0 ? LONG_MAX : lim[0];
+		struct rlimit lim;
+		getrlimit(values[name]&16383, &lim);
+		return lim.rlim_cur > LONG_MAX ? LONG_MAX : lim.rlim_cur;
 	}
 
 	switch ((unsigned char)values[name]) {