• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4 
5 #if defined(MS_WINDOWS)
6 
7 PyDoc_STRVAR(_multiprocessing_closesocket__doc__,
8 "closesocket($module, handle, /)\n"
9 "--\n"
10 "\n");
11 
12 #define _MULTIPROCESSING_CLOSESOCKET_METHODDEF    \
13     {"closesocket", (PyCFunction)_multiprocessing_closesocket, METH_O, _multiprocessing_closesocket__doc__},
14 
15 static PyObject *
16 _multiprocessing_closesocket_impl(PyObject *module, HANDLE handle);
17 
18 static PyObject *
_multiprocessing_closesocket(PyObject * module,PyObject * arg)19 _multiprocessing_closesocket(PyObject *module, PyObject *arg)
20 {
21     PyObject *return_value = NULL;
22     HANDLE handle;
23 
24     if (!PyArg_Parse(arg, ""F_HANDLE":closesocket", &handle)) {
25         goto exit;
26     }
27     return_value = _multiprocessing_closesocket_impl(module, handle);
28 
29 exit:
30     return return_value;
31 }
32 
33 #endif /* defined(MS_WINDOWS) */
34 
35 #if defined(MS_WINDOWS)
36 
37 PyDoc_STRVAR(_multiprocessing_recv__doc__,
38 "recv($module, handle, size, /)\n"
39 "--\n"
40 "\n");
41 
42 #define _MULTIPROCESSING_RECV_METHODDEF    \
43     {"recv", (PyCFunction)(void(*)(void))_multiprocessing_recv, METH_FASTCALL, _multiprocessing_recv__doc__},
44 
45 static PyObject *
46 _multiprocessing_recv_impl(PyObject *module, HANDLE handle, int size);
47 
48 static PyObject *
_multiprocessing_recv(PyObject * module,PyObject * const * args,Py_ssize_t nargs)49 _multiprocessing_recv(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
50 {
51     PyObject *return_value = NULL;
52     HANDLE handle;
53     int size;
54 
55     if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"i:recv",
56         &handle, &size)) {
57         goto exit;
58     }
59     return_value = _multiprocessing_recv_impl(module, handle, size);
60 
61 exit:
62     return return_value;
63 }
64 
65 #endif /* defined(MS_WINDOWS) */
66 
67 #if defined(MS_WINDOWS)
68 
69 PyDoc_STRVAR(_multiprocessing_send__doc__,
70 "send($module, handle, buf, /)\n"
71 "--\n"
72 "\n");
73 
74 #define _MULTIPROCESSING_SEND_METHODDEF    \
75     {"send", (PyCFunction)(void(*)(void))_multiprocessing_send, METH_FASTCALL, _multiprocessing_send__doc__},
76 
77 static PyObject *
78 _multiprocessing_send_impl(PyObject *module, HANDLE handle, Py_buffer *buf);
79 
80 static PyObject *
_multiprocessing_send(PyObject * module,PyObject * const * args,Py_ssize_t nargs)81 _multiprocessing_send(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
82 {
83     PyObject *return_value = NULL;
84     HANDLE handle;
85     Py_buffer buf = {NULL, NULL};
86 
87     if (!_PyArg_ParseStack(args, nargs, ""F_HANDLE"y*:send",
88         &handle, &buf)) {
89         goto exit;
90     }
91     return_value = _multiprocessing_send_impl(module, handle, &buf);
92 
93 exit:
94     /* Cleanup for buf */
95     if (buf.obj) {
96        PyBuffer_Release(&buf);
97     }
98 
99     return return_value;
100 }
101 
102 #endif /* defined(MS_WINDOWS) */
103 
104 PyDoc_STRVAR(_multiprocessing_sem_unlink__doc__,
105 "sem_unlink($module, name, /)\n"
106 "--\n"
107 "\n");
108 
109 #define _MULTIPROCESSING_SEM_UNLINK_METHODDEF    \
110     {"sem_unlink", (PyCFunction)_multiprocessing_sem_unlink, METH_O, _multiprocessing_sem_unlink__doc__},
111 
112 static PyObject *
113 _multiprocessing_sem_unlink_impl(PyObject *module, const char *name);
114 
115 static PyObject *
_multiprocessing_sem_unlink(PyObject * module,PyObject * arg)116 _multiprocessing_sem_unlink(PyObject *module, PyObject *arg)
117 {
118     PyObject *return_value = NULL;
119     const char *name;
120 
121     if (!PyUnicode_Check(arg)) {
122         _PyArg_BadArgument("sem_unlink", "argument", "str", arg);
123         goto exit;
124     }
125     Py_ssize_t name_length;
126     name = PyUnicode_AsUTF8AndSize(arg, &name_length);
127     if (name == NULL) {
128         goto exit;
129     }
130     if (strlen(name) != (size_t)name_length) {
131         PyErr_SetString(PyExc_ValueError, "embedded null character");
132         goto exit;
133     }
134     return_value = _multiprocessing_sem_unlink_impl(module, name);
135 
136 exit:
137     return return_value;
138 }
139 
140 #ifndef _MULTIPROCESSING_CLOSESOCKET_METHODDEF
141     #define _MULTIPROCESSING_CLOSESOCKET_METHODDEF
142 #endif /* !defined(_MULTIPROCESSING_CLOSESOCKET_METHODDEF) */
143 
144 #ifndef _MULTIPROCESSING_RECV_METHODDEF
145     #define _MULTIPROCESSING_RECV_METHODDEF
146 #endif /* !defined(_MULTIPROCESSING_RECV_METHODDEF) */
147 
148 #ifndef _MULTIPROCESSING_SEND_METHODDEF
149     #define _MULTIPROCESSING_SEND_METHODDEF
150 #endif /* !defined(_MULTIPROCESSING_SEND_METHODDEF) */
151 /*[clinic end generated code: output=418191c446cd5751 input=a9049054013a1b77]*/
152