2020-07-12 13:11:11 -03:00
|
|
|
/*[clinic input]
|
|
|
|
preserve
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
2023-10-17 09:30:31 -03:00
|
|
|
#include "pycore_modsupport.h" // _PyArg_CheckPositional()
|
|
|
|
|
2020-07-12 13:11:11 -03:00
|
|
|
#if defined(MS_WINDOWS)
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_multiprocessing_closesocket__doc__,
|
|
|
|
"closesocket($module, handle, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _MULTIPROCESSING_CLOSESOCKET_METHODDEF \
|
|
|
|
{"closesocket", (PyCFunction)_multiprocessing_closesocket, METH_O, _multiprocessing_closesocket__doc__},
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
_multiprocessing_closesocket_impl(PyObject *module, HANDLE handle);
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
_multiprocessing_closesocket(PyObject *module, PyObject *arg)
|
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
HANDLE handle;
|
|
|
|
|
2022-07-04 10:11:11 -03:00
|
|
|
handle = PyLong_AsVoidPtr(arg);
|
|
|
|
if (!handle && PyErr_Occurred()) {
|
2020-07-12 13:11:11 -03:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
return_value = _multiprocessing_closesocket_impl(module, handle);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* defined(MS_WINDOWS) */
|
|
|
|
|
|
|
|
#if defined(MS_WINDOWS)
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_multiprocessing_recv__doc__,
|
|
|
|
"recv($module, handle, size, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _MULTIPROCESSING_RECV_METHODDEF \
|
2022-05-03 15:25:41 -03:00
|
|
|
{"recv", _PyCFunction_CAST(_multiprocessing_recv), METH_FASTCALL, _multiprocessing_recv__doc__},
|
2020-07-12 13:11:11 -03:00
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
_multiprocessing_recv_impl(PyObject *module, HANDLE handle, int size);
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
_multiprocessing_recv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
HANDLE handle;
|
|
|
|
int size;
|
|
|
|
|
2022-07-04 10:11:11 -03:00
|
|
|
if (!_PyArg_CheckPositional("recv", nargs, 2, 2)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
handle = PyLong_AsVoidPtr(args[0]);
|
|
|
|
if (!handle && PyErr_Occurred()) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2023-08-24 19:51:22 -03:00
|
|
|
size = PyLong_AsInt(args[1]);
|
2022-07-04 10:11:11 -03:00
|
|
|
if (size == -1 && PyErr_Occurred()) {
|
2020-07-12 13:11:11 -03:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
return_value = _multiprocessing_recv_impl(module, handle, size);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* defined(MS_WINDOWS) */
|
|
|
|
|
|
|
|
#if defined(MS_WINDOWS)
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_multiprocessing_send__doc__,
|
|
|
|
"send($module, handle, buf, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _MULTIPROCESSING_SEND_METHODDEF \
|
2022-05-03 15:25:41 -03:00
|
|
|
{"send", _PyCFunction_CAST(_multiprocessing_send), METH_FASTCALL, _multiprocessing_send__doc__},
|
2020-07-12 13:11:11 -03:00
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
_multiprocessing_send_impl(PyObject *module, HANDLE handle, Py_buffer *buf);
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
_multiprocessing_send(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
|
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
HANDLE handle;
|
|
|
|
Py_buffer buf = {NULL, NULL};
|
|
|
|
|
2022-07-04 10:11:11 -03:00
|
|
|
if (!_PyArg_CheckPositional("send", nargs, 2, 2)) {
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
handle = PyLong_AsVoidPtr(args[0]);
|
|
|
|
if (!handle && PyErr_Occurred()) {
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
if (PyObject_GetBuffer(args[1], &buf, PyBUF_SIMPLE) != 0) {
|
|
|
|
goto exit;
|
|
|
|
}
|
2020-07-12 13:11:11 -03:00
|
|
|
return_value = _multiprocessing_send_impl(module, handle, &buf);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
/* Cleanup for buf */
|
|
|
|
if (buf.obj) {
|
|
|
|
PyBuffer_Release(&buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* defined(MS_WINDOWS) */
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_multiprocessing_sem_unlink__doc__,
|
|
|
|
"sem_unlink($module, name, /)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n");
|
|
|
|
|
|
|
|
#define _MULTIPROCESSING_SEM_UNLINK_METHODDEF \
|
|
|
|
{"sem_unlink", (PyCFunction)_multiprocessing_sem_unlink, METH_O, _multiprocessing_sem_unlink__doc__},
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
_multiprocessing_sem_unlink_impl(PyObject *module, const char *name);
|
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
_multiprocessing_sem_unlink(PyObject *module, PyObject *arg)
|
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
if (!PyUnicode_Check(arg)) {
|
|
|
|
_PyArg_BadArgument("sem_unlink", "argument", "str", arg);
|
|
|
|
goto exit;
|
|
|
|
}
|
2023-11-01 12:34:42 -03:00
|
|
|
name = PyUnicode_AsUTF8(arg);
|
2020-07-12 13:11:11 -03:00
|
|
|
if (name == NULL) {
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
return_value = _multiprocessing_sem_unlink_impl(module, name);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef _MULTIPROCESSING_CLOSESOCKET_METHODDEF
|
|
|
|
#define _MULTIPROCESSING_CLOSESOCKET_METHODDEF
|
|
|
|
#endif /* !defined(_MULTIPROCESSING_CLOSESOCKET_METHODDEF) */
|
|
|
|
|
|
|
|
#ifndef _MULTIPROCESSING_RECV_METHODDEF
|
|
|
|
#define _MULTIPROCESSING_RECV_METHODDEF
|
|
|
|
#endif /* !defined(_MULTIPROCESSING_RECV_METHODDEF) */
|
|
|
|
|
|
|
|
#ifndef _MULTIPROCESSING_SEND_METHODDEF
|
|
|
|
#define _MULTIPROCESSING_SEND_METHODDEF
|
|
|
|
#endif /* !defined(_MULTIPROCESSING_SEND_METHODDEF) */
|
2023-11-01 12:34:42 -03:00
|
|
|
/*[clinic end generated code: output=c6735cbc59b6f324 input=a9049054013a1b77]*/
|