mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 15:28:30 +00:00
Fix a few more Python tests
This commit is contained in:
parent
59e1c245d1
commit
bc464a8898
7 changed files with 1018 additions and 547 deletions
|
@ -16,8 +16,21 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/calls/struct/rlimit.h"
|
||||
#include "libc/limits.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/runtime/clktck.h"
|
||||
#include "libc/runtime/sysconf.h"
|
||||
#include "libc/sysv/consts/rlim.h"
|
||||
#include "libc/sysv/consts/rlimit.h"
|
||||
|
||||
static long GetResourceLimit(int resource) {
|
||||
struct rlimit rl;
|
||||
getrlimit(resource, &rl);
|
||||
if (rl.rlim_cur == RLIM_INFINITY) return -1;
|
||||
return MIN(rl.rlim_cur, LONG_MAX);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns configuration value about system.
|
||||
|
@ -39,8 +52,12 @@ long sysconf(int name) {
|
|||
switch (name) {
|
||||
case _SC_ARG_MAX:
|
||||
return ARG_MAX;
|
||||
case _SC_CHILD_MAX:
|
||||
return GetResourceLimit(RLIMIT_NPROC);
|
||||
case _SC_CLK_TCK:
|
||||
return CLK_TCK;
|
||||
case _SC_OPEN_MAX:
|
||||
return GetResourceLimit(RLIMIT_NOFILE);
|
||||
case _SC_PAGESIZE:
|
||||
return FRAMESIZE;
|
||||
case _SC_NPROCESSORS_ONLN:
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
#define COSMOPOLITAN_LIBC_RUNTIME_SYSCONF_H_
|
||||
|
||||
#define _SC_ARG_MAX 0
|
||||
#define _SC_CHILD_MAX 1
|
||||
#define _SC_CLK_TCK 2
|
||||
#define _SC_OPEN_MAX 4
|
||||
#define _SC_PAGESIZE 30
|
||||
#define _SC_PAGE_SIZE 30
|
||||
#define _SC_NPROCESSORS_ONLN 1002
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue