mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
parent
95f54eeb40
commit
c1d99676c4
1421 changed files with 5556 additions and 2198 deletions
58
third_party/python/Python/cosmomodule.c
vendored
58
third_party/python/Python/cosmomodule.c
vendored
|
@ -19,9 +19,7 @@
|
|||
#define PY_SSIZE_T_CLEAN
|
||||
#include "dsp/scale/cdecimate2xuint8x8.h"
|
||||
#include "libc/bits/popcnt.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/math.h"
|
||||
#include "libc/mem/mem.h"
|
||||
|
@ -29,7 +27,6 @@
|
|||
#include "libc/nexgen32e/rdtsc.h"
|
||||
#include "libc/nexgen32e/rdtscp.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/import.h"
|
||||
#include "third_party/python/Include/longobject.h"
|
||||
|
@ -190,59 +187,6 @@ cosmo_popcount(PyObject *self, PyObject *args)
|
|||
return PyLong_FromSize_t(_countbits(p, n));
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(pledge_doc,
|
||||
"pledge($module, promises, execpromises)\n\
|
||||
--\n\n\
|
||||
Permits syscall operations, e.g.\n\
|
||||
\n\
|
||||
>>> cosmo.pledge('stdio rpath tty', None)\n\
|
||||
\n\
|
||||
This function implements the OpenBSD pledge() API for\n\
|
||||
OpenBSD and Linux, where we use SECCOMP BPF. Read the\n\
|
||||
Cosmopolitan Libc documentation to learn more.");
|
||||
|
||||
static PyObject *
|
||||
cosmo_pledge(PyObject *self, PyObject *args)
|
||||
{
|
||||
int e = errno;
|
||||
const char *x, *y;
|
||||
if (!PyArg_ParseTuple(args, "sz:pledge", &x, &y)) return 0;
|
||||
if (!pledge(x, y)) {
|
||||
Py_RETURN_NONE;
|
||||
} else {
|
||||
PyErr_SetString(PyExc_SystemError, strerror(errno));
|
||||
errno = e;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(unveil_doc,
|
||||
"unveil($module, path, permissions)\n\
|
||||
--\n\n\
|
||||
Permits filesystem operations, e.g.\n\
|
||||
\n\
|
||||
>>> cosmo.unveil('.', 'rwcx')\n\
|
||||
>>> cosmo.unveil(None, None)\n\
|
||||
\n\
|
||||
This function implements the OpenBSD unveil() API for\n\
|
||||
OpenBSD and Linux where we use Landlock LSM. Read the\n\
|
||||
Cosmopolitan Libc documentation to learn more.");
|
||||
|
||||
static PyObject *
|
||||
cosmo_unveil(PyObject *self, PyObject *args)
|
||||
{
|
||||
int e = errno;
|
||||
const char *x, *y;
|
||||
if (!PyArg_ParseTuple(args, "zz:unveil", &x, &y)) return 0;
|
||||
if (!unveil(x, y)) {
|
||||
Py_RETURN_NONE;
|
||||
} else {
|
||||
PyErr_SetString(PyExc_SystemError, strerror(errno));
|
||||
errno = e;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(exit1_doc,
|
||||
"exit1($module)\n\
|
||||
--\n\n\
|
||||
|
@ -325,8 +269,6 @@ static PyMethodDef cosmo_methods[] = {
|
|||
{"exit1", cosmo_exit1, METH_NOARGS, exit1_doc},
|
||||
{"rdtsc", cosmo_rdtsc, METH_NOARGS, rdtsc_doc},
|
||||
{"crc32c", cosmo_crc32c, METH_VARARGS, crc32c_doc},
|
||||
{"pledge", cosmo_pledge, METH_VARARGS, pledge_doc},
|
||||
{"unveil", cosmo_unveil, METH_VARARGS, unveil_doc},
|
||||
{"syscount", cosmo_syscount, METH_NOARGS, syscount_doc},
|
||||
{"popcount", cosmo_popcount, METH_VARARGS, popcount_doc},
|
||||
{"decimate", cosmo_decimate, METH_VARARGS, decimate_doc},
|
||||
|
|
1
third_party/python/Python/dtoa.c
vendored
1
third_party/python/Python/dtoa.c
vendored
|
@ -7,7 +7,6 @@
|
|||
#include "libc/assert.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/math.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "third_party/python/Include/pymem.h"
|
||||
#include "third_party/python/Include/pyport.h"
|
||||
/* clang-format off */
|
||||
|
|
1
third_party/python/Python/errors.c
vendored
1
third_party/python/Python/errors.c
vendored
|
@ -5,7 +5,6 @@
|
|||
│ https://docs.python.org/3/license.html │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/errno.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/nt/enum/formatmessageflags.h"
|
||||
#include "libc/nt/enum/lang.h"
|
||||
#include "libc/nt/memory.h"
|
||||
|
|
1
third_party/python/Python/fileutils.c
vendored
1
third_party/python/Python/fileutils.c
vendored
|
@ -15,7 +15,6 @@
|
|||
#include "libc/sysv/consts/fio.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/unicode/locale.h"
|
||||
#include "libc/unicode/unicode.h"
|
||||
#include "third_party/python/Include/bytesobject.h"
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
#include "third_party/python/Include/fileutils.h"
|
||||
|
|
5
third_party/python/Python/import.c
vendored
5
third_party/python/Python/import.c
vendored
|
@ -11,15 +11,14 @@
|
|||
#include "libc/calls/struct/stat.macros.h"
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/gc.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "libc/sysv/consts/o.h"
|
||||
#include "libc/sysv/consts/s.h"
|
||||
#include "libc/x/x.h"
|
||||
#include "third_party/python/Include/Python-ast.h"
|
||||
#include "third_party/python/Include/abstract.h"
|
||||
#include "third_party/python/Include/bltinmodule.h"
|
||||
#include "third_party/python/Include/boolobject.h"
|
||||
#include "third_party/python/Include/bltinmodule.h"
|
||||
#include "third_party/python/Include/ceval.h"
|
||||
#include "third_party/python/Include/code.h"
|
||||
#include "third_party/python/Include/dictobject.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue