Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/wapython
Path: blob/main/python/cpython/src/pyconfig.h
1067 views
1
2
3
// file should start with a blank line.
4
5
// This extern "C" is needed so pyconfig.h can also be included in C++ code, e.g., numpy.
6
#ifdef __cplusplus
7
extern "C" {
8
#endif
9
#include "posix-wasm.h"
10
#ifdef __cplusplus
11
}
12
#endif
13
14
15
#undef HAVE_LINUX_VM_SOCKETS_H
16
#define POLLPRI 0
17
#undef GETPGRP_HAVE_ARG
18
19
// I did implement the non-BSD version of this though, which
20
// doesn't get detected by autoconf:
21
#define SETPGRP_HAVE_ARG 1
22
23
#define PY_CALL_TRAMPOLINE
24
25
// We only use the emscripten changes for the actual changes to the files, NOT for
26
// the extra flags, etc., that are imposed on the build tools, which break things badly.
27
// Thus instead of an option to ./configure, we #define these here.
28
#ifndef __EMSCRIPTEN
29
#define __EMSCRIPTEN__ 1
30
#endif
31
#define __EMSCRIPTEN_major__ 3
32
#define __EMSCRIPTEN_minor__ 1
33
#define __EMSCRIPTEN_tiny__ 16
34
35
// sysconfig(_SC_OPEN_MAX) = -1 in upstream musl wasi.
36
// By undef'ing this constant, we cause Python to think
37
// that sysconfig doesn't know anything about SC_OPEN_MAX,
38
// so Python falls back to some default. This is the right
39
// thing to do since (1) we can't change upstream wasi, and
40
// (2) wasi setting it to -1 is meant to convey that they
41
// don't know. In fact, in our wasi-js implementation,
42
// we are setting the limit to 32768 since it takes about
43
// 0.2 seconds with wasi-js to stat everything up that bound,
44
// which seems acceptable for this sort of thing.
45
// The modern OS default is 2**20 = 1048575, and it takes
46
// about 0.5 seconds to stat everything up to that (of course,
47
// modern os's have better system calls so that stating everything
48
// isn't needed). TODO: I'm also probably going to patch Python
49
// itself to replace its 256 default fallback with 32768 everywhere,
50
// though that can wait.
51
#undef _SC_OPEN_MAX
52
53
// we provide our own stubs
54
#undef HAVE_PTHREAD_STUBS
55