1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4 
5 PyDoc_STRVAR(signal_default_int_handler__doc__,
6 "default_int_handler($module, signalnum, frame, /)\n"
7 "--\n"
8 "\n"
9 "The default handler for SIGINT installed by Python.\n"
10 "\n"
11 "It raises KeyboardInterrupt.");
12 
13 #define SIGNAL_DEFAULT_INT_HANDLER_METHODDEF    \
14     {"default_int_handler", _PyCFunction_CAST(signal_default_int_handler), METH_FASTCALL, signal_default_int_handler__doc__},
15 
16 static PyObject *
17 signal_default_int_handler_impl(PyObject *module, int signalnum,
18                                 PyObject *frame);
19 
20 static PyObject *
signal_default_int_handler(PyObject * module,PyObject * const * args,Py_ssize_t nargs)21 signal_default_int_handler(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
22 {
23     PyObject *return_value = NULL;
24     int signalnum;
25     PyObject *frame;
26 
27     if (!_PyArg_CheckPositional("default_int_handler", nargs, 2, 2)) {
28         goto exit;
29     }
30     signalnum = _PyLong_AsInt(args[0]);
31     if (signalnum == -1 && PyErr_Occurred()) {
32         goto exit;
33     }
34     frame = args[1];
35     return_value = signal_default_int_handler_impl(module, signalnum, frame);
36 
37 exit:
38     return return_value;
39 }
40 
41 #if defined(HAVE_ALARM)
42 
43 PyDoc_STRVAR(signal_alarm__doc__,
44 "alarm($module, seconds, /)\n"
45 "--\n"
46 "\n"
47 "Arrange for SIGALRM to arrive after the given number of seconds.");
48 
49 #define SIGNAL_ALARM_METHODDEF    \
50     {"alarm", (PyCFunction)signal_alarm, METH_O, signal_alarm__doc__},
51 
52 static long
53 signal_alarm_impl(PyObject *module, int seconds);
54 
55 static PyObject *
signal_alarm(PyObject * module,PyObject * arg)56 signal_alarm(PyObject *module, PyObject *arg)
57 {
58     PyObject *return_value = NULL;
59     int seconds;
60     long _return_value;
61 
62     seconds = _PyLong_AsInt(arg);
63     if (seconds == -1 && PyErr_Occurred()) {
64         goto exit;
65     }
66     _return_value = signal_alarm_impl(module, seconds);
67     if ((_return_value == -1) && PyErr_Occurred()) {
68         goto exit;
69     }
70     return_value = PyLong_FromLong(_return_value);
71 
72 exit:
73     return return_value;
74 }
75 
76 #endif /* defined(HAVE_ALARM) */
77 
78 #if defined(HAVE_PAUSE)
79 
80 PyDoc_STRVAR(signal_pause__doc__,
81 "pause($module, /)\n"
82 "--\n"
83 "\n"
84 "Wait until a signal arrives.");
85 
86 #define SIGNAL_PAUSE_METHODDEF    \
87     {"pause", (PyCFunction)signal_pause, METH_NOARGS, signal_pause__doc__},
88 
89 static PyObject *
90 signal_pause_impl(PyObject *module);
91 
92 static PyObject *
signal_pause(PyObject * module,PyObject * Py_UNUSED (ignored))93 signal_pause(PyObject *module, PyObject *Py_UNUSED(ignored))
94 {
95     return signal_pause_impl(module);
96 }
97 
98 #endif /* defined(HAVE_PAUSE) */
99 
100 PyDoc_STRVAR(signal_raise_signal__doc__,
101 "raise_signal($module, signalnum, /)\n"
102 "--\n"
103 "\n"
104 "Send a signal to the executing process.");
105 
106 #define SIGNAL_RAISE_SIGNAL_METHODDEF    \
107     {"raise_signal", (PyCFunction)signal_raise_signal, METH_O, signal_raise_signal__doc__},
108 
109 static PyObject *
110 signal_raise_signal_impl(PyObject *module, int signalnum);
111 
112 static PyObject *
signal_raise_signal(PyObject * module,PyObject * arg)113 signal_raise_signal(PyObject *module, PyObject *arg)
114 {
115     PyObject *return_value = NULL;
116     int signalnum;
117 
118     signalnum = _PyLong_AsInt(arg);
119     if (signalnum == -1 && PyErr_Occurred()) {
120         goto exit;
121     }
122     return_value = signal_raise_signal_impl(module, signalnum);
123 
124 exit:
125     return return_value;
126 }
127 
128 PyDoc_STRVAR(signal_signal__doc__,
129 "signal($module, signalnum, handler, /)\n"
130 "--\n"
131 "\n"
132 "Set the action for the given signal.\n"
133 "\n"
134 "The action can be SIG_DFL, SIG_IGN, or a callable Python object.\n"
135 "The previous action is returned.  See getsignal() for possible return values.\n"
136 "\n"
137 "*** IMPORTANT NOTICE ***\n"
138 "A signal handler function is called with two arguments:\n"
139 "the first is the signal number, the second is the interrupted stack frame.");
140 
141 #define SIGNAL_SIGNAL_METHODDEF    \
142     {"signal", _PyCFunction_CAST(signal_signal), METH_FASTCALL, signal_signal__doc__},
143 
144 static PyObject *
145 signal_signal_impl(PyObject *module, int signalnum, PyObject *handler);
146 
147 static PyObject *
signal_signal(PyObject * module,PyObject * const * args,Py_ssize_t nargs)148 signal_signal(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
149 {
150     PyObject *return_value = NULL;
151     int signalnum;
152     PyObject *handler;
153 
154     if (!_PyArg_CheckPositional("signal", nargs, 2, 2)) {
155         goto exit;
156     }
157     signalnum = _PyLong_AsInt(args[0]);
158     if (signalnum == -1 && PyErr_Occurred()) {
159         goto exit;
160     }
161     handler = args[1];
162     return_value = signal_signal_impl(module, signalnum, handler);
163 
164 exit:
165     return return_value;
166 }
167 
168 PyDoc_STRVAR(signal_getsignal__doc__,
169 "getsignal($module, signalnum, /)\n"
170 "--\n"
171 "\n"
172 "Return the current action for the given signal.\n"
173 "\n"
174 "The return value can be:\n"
175 "  SIG_IGN -- if the signal is being ignored\n"
176 "  SIG_DFL -- if the default action for the signal is in effect\n"
177 "  None    -- if an unknown handler is in effect\n"
178 "  anything else -- the callable Python object used as a handler");
179 
180 #define SIGNAL_GETSIGNAL_METHODDEF    \
181     {"getsignal", (PyCFunction)signal_getsignal, METH_O, signal_getsignal__doc__},
182 
183 static PyObject *
184 signal_getsignal_impl(PyObject *module, int signalnum);
185 
186 static PyObject *
signal_getsignal(PyObject * module,PyObject * arg)187 signal_getsignal(PyObject *module, PyObject *arg)
188 {
189     PyObject *return_value = NULL;
190     int signalnum;
191 
192     signalnum = _PyLong_AsInt(arg);
193     if (signalnum == -1 && PyErr_Occurred()) {
194         goto exit;
195     }
196     return_value = signal_getsignal_impl(module, signalnum);
197 
198 exit:
199     return return_value;
200 }
201 
202 PyDoc_STRVAR(signal_strsignal__doc__,
203 "strsignal($module, signalnum, /)\n"
204 "--\n"
205 "\n"
206 "Return the system description of the given signal.\n"
207 "\n"
208 "Returns the description of signal *signalnum*, such as \"Interrupt\"\n"
209 "for :const:`SIGINT`. Returns :const:`None` if *signalnum* has no\n"
210 "description. Raises :exc:`ValueError` if *signalnum* is invalid.");
211 
212 #define SIGNAL_STRSIGNAL_METHODDEF    \
213     {"strsignal", (PyCFunction)signal_strsignal, METH_O, signal_strsignal__doc__},
214 
215 static PyObject *
216 signal_strsignal_impl(PyObject *module, int signalnum);
217 
218 static PyObject *
signal_strsignal(PyObject * module,PyObject * arg)219 signal_strsignal(PyObject *module, PyObject *arg)
220 {
221     PyObject *return_value = NULL;
222     int signalnum;
223 
224     signalnum = _PyLong_AsInt(arg);
225     if (signalnum == -1 && PyErr_Occurred()) {
226         goto exit;
227     }
228     return_value = signal_strsignal_impl(module, signalnum);
229 
230 exit:
231     return return_value;
232 }
233 
234 #if defined(HAVE_SIGINTERRUPT)
235 
236 PyDoc_STRVAR(signal_siginterrupt__doc__,
237 "siginterrupt($module, signalnum, flag, /)\n"
238 "--\n"
239 "\n"
240 "Change system call restart behaviour.\n"
241 "\n"
242 "If flag is False, system calls will be restarted when interrupted by\n"
243 "signal sig, else system calls will be interrupted.");
244 
245 #define SIGNAL_SIGINTERRUPT_METHODDEF    \
246     {"siginterrupt", _PyCFunction_CAST(signal_siginterrupt), METH_FASTCALL, signal_siginterrupt__doc__},
247 
248 static PyObject *
249 signal_siginterrupt_impl(PyObject *module, int signalnum, int flag);
250 
251 static PyObject *
signal_siginterrupt(PyObject * module,PyObject * const * args,Py_ssize_t nargs)252 signal_siginterrupt(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
253 {
254     PyObject *return_value = NULL;
255     int signalnum;
256     int flag;
257 
258     if (!_PyArg_CheckPositional("siginterrupt", nargs, 2, 2)) {
259         goto exit;
260     }
261     signalnum = _PyLong_AsInt(args[0]);
262     if (signalnum == -1 && PyErr_Occurred()) {
263         goto exit;
264     }
265     flag = _PyLong_AsInt(args[1]);
266     if (flag == -1 && PyErr_Occurred()) {
267         goto exit;
268     }
269     return_value = signal_siginterrupt_impl(module, signalnum, flag);
270 
271 exit:
272     return return_value;
273 }
274 
275 #endif /* defined(HAVE_SIGINTERRUPT) */
276 
277 #if defined(HAVE_SETITIMER)
278 
279 PyDoc_STRVAR(signal_setitimer__doc__,
280 "setitimer($module, which, seconds, interval=0.0, /)\n"
281 "--\n"
282 "\n"
283 "Sets given itimer (one of ITIMER_REAL, ITIMER_VIRTUAL or ITIMER_PROF).\n"
284 "\n"
285 "The timer will fire after value seconds and after that every interval seconds.\n"
286 "The itimer can be cleared by setting seconds to zero.\n"
287 "\n"
288 "Returns old values as a tuple: (delay, interval).");
289 
290 #define SIGNAL_SETITIMER_METHODDEF    \
291     {"setitimer", _PyCFunction_CAST(signal_setitimer), METH_FASTCALL, signal_setitimer__doc__},
292 
293 static PyObject *
294 signal_setitimer_impl(PyObject *module, int which, PyObject *seconds,
295                       PyObject *interval);
296 
297 static PyObject *
signal_setitimer(PyObject * module,PyObject * const * args,Py_ssize_t nargs)298 signal_setitimer(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
299 {
300     PyObject *return_value = NULL;
301     int which;
302     PyObject *seconds;
303     PyObject *interval = NULL;
304 
305     if (!_PyArg_CheckPositional("setitimer", nargs, 2, 3)) {
306         goto exit;
307     }
308     which = _PyLong_AsInt(args[0]);
309     if (which == -1 && PyErr_Occurred()) {
310         goto exit;
311     }
312     seconds = args[1];
313     if (nargs < 3) {
314         goto skip_optional;
315     }
316     interval = args[2];
317 skip_optional:
318     return_value = signal_setitimer_impl(module, which, seconds, interval);
319 
320 exit:
321     return return_value;
322 }
323 
324 #endif /* defined(HAVE_SETITIMER) */
325 
326 #if defined(HAVE_GETITIMER)
327 
328 PyDoc_STRVAR(signal_getitimer__doc__,
329 "getitimer($module, which, /)\n"
330 "--\n"
331 "\n"
332 "Returns current value of given itimer.");
333 
334 #define SIGNAL_GETITIMER_METHODDEF    \
335     {"getitimer", (PyCFunction)signal_getitimer, METH_O, signal_getitimer__doc__},
336 
337 static PyObject *
338 signal_getitimer_impl(PyObject *module, int which);
339 
340 static PyObject *
signal_getitimer(PyObject * module,PyObject * arg)341 signal_getitimer(PyObject *module, PyObject *arg)
342 {
343     PyObject *return_value = NULL;
344     int which;
345 
346     which = _PyLong_AsInt(arg);
347     if (which == -1 && PyErr_Occurred()) {
348         goto exit;
349     }
350     return_value = signal_getitimer_impl(module, which);
351 
352 exit:
353     return return_value;
354 }
355 
356 #endif /* defined(HAVE_GETITIMER) */
357 
358 #if defined(HAVE_SIGSET_T) && defined(PYPTHREAD_SIGMASK)
359 
360 PyDoc_STRVAR(signal_pthread_sigmask__doc__,
361 "pthread_sigmask($module, how, mask, /)\n"
362 "--\n"
363 "\n"
364 "Fetch and/or change the signal mask of the calling thread.");
365 
366 #define SIGNAL_PTHREAD_SIGMASK_METHODDEF    \
367     {"pthread_sigmask", _PyCFunction_CAST(signal_pthread_sigmask), METH_FASTCALL, signal_pthread_sigmask__doc__},
368 
369 static PyObject *
370 signal_pthread_sigmask_impl(PyObject *module, int how, sigset_t mask);
371 
372 static PyObject *
signal_pthread_sigmask(PyObject * module,PyObject * const * args,Py_ssize_t nargs)373 signal_pthread_sigmask(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
374 {
375     PyObject *return_value = NULL;
376     int how;
377     sigset_t mask;
378 
379     if (!_PyArg_CheckPositional("pthread_sigmask", nargs, 2, 2)) {
380         goto exit;
381     }
382     how = _PyLong_AsInt(args[0]);
383     if (how == -1 && PyErr_Occurred()) {
384         goto exit;
385     }
386     if (!_Py_Sigset_Converter(args[1], &mask)) {
387         goto exit;
388     }
389     return_value = signal_pthread_sigmask_impl(module, how, mask);
390 
391 exit:
392     return return_value;
393 }
394 
395 #endif /* defined(HAVE_SIGSET_T) && defined(PYPTHREAD_SIGMASK) */
396 
397 #if defined(HAVE_SIGSET_T) && defined(HAVE_SIGPENDING)
398 
399 PyDoc_STRVAR(signal_sigpending__doc__,
400 "sigpending($module, /)\n"
401 "--\n"
402 "\n"
403 "Examine pending signals.\n"
404 "\n"
405 "Returns a set of signal numbers that are pending for delivery to\n"
406 "the calling thread.");
407 
408 #define SIGNAL_SIGPENDING_METHODDEF    \
409     {"sigpending", (PyCFunction)signal_sigpending, METH_NOARGS, signal_sigpending__doc__},
410 
411 static PyObject *
412 signal_sigpending_impl(PyObject *module);
413 
414 static PyObject *
signal_sigpending(PyObject * module,PyObject * Py_UNUSED (ignored))415 signal_sigpending(PyObject *module, PyObject *Py_UNUSED(ignored))
416 {
417     return signal_sigpending_impl(module);
418 }
419 
420 #endif /* defined(HAVE_SIGSET_T) && defined(HAVE_SIGPENDING) */
421 
422 #if defined(HAVE_SIGSET_T) && defined(HAVE_SIGWAIT)
423 
424 PyDoc_STRVAR(signal_sigwait__doc__,
425 "sigwait($module, sigset, /)\n"
426 "--\n"
427 "\n"
428 "Wait for a signal.\n"
429 "\n"
430 "Suspend execution of the calling thread until the delivery of one of the\n"
431 "signals specified in the signal set sigset.  The function accepts the signal\n"
432 "and returns the signal number.");
433 
434 #define SIGNAL_SIGWAIT_METHODDEF    \
435     {"sigwait", (PyCFunction)signal_sigwait, METH_O, signal_sigwait__doc__},
436 
437 static PyObject *
438 signal_sigwait_impl(PyObject *module, sigset_t sigset);
439 
440 static PyObject *
signal_sigwait(PyObject * module,PyObject * arg)441 signal_sigwait(PyObject *module, PyObject *arg)
442 {
443     PyObject *return_value = NULL;
444     sigset_t sigset;
445 
446     if (!_Py_Sigset_Converter(arg, &sigset)) {
447         goto exit;
448     }
449     return_value = signal_sigwait_impl(module, sigset);
450 
451 exit:
452     return return_value;
453 }
454 
455 #endif /* defined(HAVE_SIGSET_T) && defined(HAVE_SIGWAIT) */
456 
457 #if ((defined(HAVE_SIGFILLSET) && defined(HAVE_SIGSET_T)) || defined(MS_WINDOWS))
458 
459 PyDoc_STRVAR(signal_valid_signals__doc__,
460 "valid_signals($module, /)\n"
461 "--\n"
462 "\n"
463 "Return a set of valid signal numbers on this platform.\n"
464 "\n"
465 "The signal numbers returned by this function can be safely passed to\n"
466 "functions like `pthread_sigmask`.");
467 
468 #define SIGNAL_VALID_SIGNALS_METHODDEF    \
469     {"valid_signals", (PyCFunction)signal_valid_signals, METH_NOARGS, signal_valid_signals__doc__},
470 
471 static PyObject *
472 signal_valid_signals_impl(PyObject *module);
473 
474 static PyObject *
signal_valid_signals(PyObject * module,PyObject * Py_UNUSED (ignored))475 signal_valid_signals(PyObject *module, PyObject *Py_UNUSED(ignored))
476 {
477     return signal_valid_signals_impl(module);
478 }
479 
480 #endif /* ((defined(HAVE_SIGFILLSET) && defined(HAVE_SIGSET_T)) || defined(MS_WINDOWS)) */
481 
482 #if defined(HAVE_SIGSET_T) && defined(HAVE_SIGWAITINFO)
483 
484 PyDoc_STRVAR(signal_sigwaitinfo__doc__,
485 "sigwaitinfo($module, sigset, /)\n"
486 "--\n"
487 "\n"
488 "Wait synchronously until one of the signals in *sigset* is delivered.\n"
489 "\n"
490 "Returns a struct_siginfo containing information about the signal.");
491 
492 #define SIGNAL_SIGWAITINFO_METHODDEF    \
493     {"sigwaitinfo", (PyCFunction)signal_sigwaitinfo, METH_O, signal_sigwaitinfo__doc__},
494 
495 static PyObject *
496 signal_sigwaitinfo_impl(PyObject *module, sigset_t sigset);
497 
498 static PyObject *
signal_sigwaitinfo(PyObject * module,PyObject * arg)499 signal_sigwaitinfo(PyObject *module, PyObject *arg)
500 {
501     PyObject *return_value = NULL;
502     sigset_t sigset;
503 
504     if (!_Py_Sigset_Converter(arg, &sigset)) {
505         goto exit;
506     }
507     return_value = signal_sigwaitinfo_impl(module, sigset);
508 
509 exit:
510     return return_value;
511 }
512 
513 #endif /* defined(HAVE_SIGSET_T) && defined(HAVE_SIGWAITINFO) */
514 
515 #if defined(HAVE_SIGSET_T) && defined(HAVE_SIGTIMEDWAIT)
516 
517 PyDoc_STRVAR(signal_sigtimedwait__doc__,
518 "sigtimedwait($module, sigset, timeout, /)\n"
519 "--\n"
520 "\n"
521 "Like sigwaitinfo(), but with a timeout.\n"
522 "\n"
523 "The timeout is specified in seconds, with floating point numbers allowed.");
524 
525 #define SIGNAL_SIGTIMEDWAIT_METHODDEF    \
526     {"sigtimedwait", _PyCFunction_CAST(signal_sigtimedwait), METH_FASTCALL, signal_sigtimedwait__doc__},
527 
528 static PyObject *
529 signal_sigtimedwait_impl(PyObject *module, sigset_t sigset,
530                          PyObject *timeout_obj);
531 
532 static PyObject *
signal_sigtimedwait(PyObject * module,PyObject * const * args,Py_ssize_t nargs)533 signal_sigtimedwait(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
534 {
535     PyObject *return_value = NULL;
536     sigset_t sigset;
537     PyObject *timeout_obj;
538 
539     if (!_PyArg_CheckPositional("sigtimedwait", nargs, 2, 2)) {
540         goto exit;
541     }
542     if (!_Py_Sigset_Converter(args[0], &sigset)) {
543         goto exit;
544     }
545     timeout_obj = args[1];
546     return_value = signal_sigtimedwait_impl(module, sigset, timeout_obj);
547 
548 exit:
549     return return_value;
550 }
551 
552 #endif /* defined(HAVE_SIGSET_T) && defined(HAVE_SIGTIMEDWAIT) */
553 
554 #if defined(HAVE_PTHREAD_KILL)
555 
556 PyDoc_STRVAR(signal_pthread_kill__doc__,
557 "pthread_kill($module, thread_id, signalnum, /)\n"
558 "--\n"
559 "\n"
560 "Send a signal to a thread.");
561 
562 #define SIGNAL_PTHREAD_KILL_METHODDEF    \
563     {"pthread_kill", _PyCFunction_CAST(signal_pthread_kill), METH_FASTCALL, signal_pthread_kill__doc__},
564 
565 static PyObject *
566 signal_pthread_kill_impl(PyObject *module, unsigned long thread_id,
567                          int signalnum);
568 
569 static PyObject *
signal_pthread_kill(PyObject * module,PyObject * const * args,Py_ssize_t nargs)570 signal_pthread_kill(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
571 {
572     PyObject *return_value = NULL;
573     unsigned long thread_id;
574     int signalnum;
575 
576     if (!_PyArg_CheckPositional("pthread_kill", nargs, 2, 2)) {
577         goto exit;
578     }
579     if (!PyLong_Check(args[0])) {
580         _PyArg_BadArgument("pthread_kill", "argument 1", "int", args[0]);
581         goto exit;
582     }
583     thread_id = PyLong_AsUnsignedLongMask(args[0]);
584     signalnum = _PyLong_AsInt(args[1]);
585     if (signalnum == -1 && PyErr_Occurred()) {
586         goto exit;
587     }
588     return_value = signal_pthread_kill_impl(module, thread_id, signalnum);
589 
590 exit:
591     return return_value;
592 }
593 
594 #endif /* defined(HAVE_PTHREAD_KILL) */
595 
596 #if (defined(__linux__) && defined(__NR_pidfd_send_signal))
597 
598 PyDoc_STRVAR(signal_pidfd_send_signal__doc__,
599 "pidfd_send_signal($module, pidfd, signalnum, siginfo=None, flags=0, /)\n"
600 "--\n"
601 "\n"
602 "Send a signal to a process referred to by a pid file descriptor.");
603 
604 #define SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF    \
605     {"pidfd_send_signal", _PyCFunction_CAST(signal_pidfd_send_signal), METH_FASTCALL, signal_pidfd_send_signal__doc__},
606 
607 static PyObject *
608 signal_pidfd_send_signal_impl(PyObject *module, int pidfd, int signalnum,
609                               PyObject *siginfo, int flags);
610 
611 static PyObject *
signal_pidfd_send_signal(PyObject * module,PyObject * const * args,Py_ssize_t nargs)612 signal_pidfd_send_signal(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
613 {
614     PyObject *return_value = NULL;
615     int pidfd;
616     int signalnum;
617     PyObject *siginfo = Py_None;
618     int flags = 0;
619 
620     if (!_PyArg_CheckPositional("pidfd_send_signal", nargs, 2, 4)) {
621         goto exit;
622     }
623     pidfd = _PyLong_AsInt(args[0]);
624     if (pidfd == -1 && PyErr_Occurred()) {
625         goto exit;
626     }
627     signalnum = _PyLong_AsInt(args[1]);
628     if (signalnum == -1 && PyErr_Occurred()) {
629         goto exit;
630     }
631     if (nargs < 3) {
632         goto skip_optional;
633     }
634     siginfo = args[2];
635     if (nargs < 4) {
636         goto skip_optional;
637     }
638     flags = _PyLong_AsInt(args[3]);
639     if (flags == -1 && PyErr_Occurred()) {
640         goto exit;
641     }
642 skip_optional:
643     return_value = signal_pidfd_send_signal_impl(module, pidfd, signalnum, siginfo, flags);
644 
645 exit:
646     return return_value;
647 }
648 
649 #endif /* (defined(__linux__) && defined(__NR_pidfd_send_signal)) */
650 
651 #ifndef SIGNAL_ALARM_METHODDEF
652     #define SIGNAL_ALARM_METHODDEF
653 #endif /* !defined(SIGNAL_ALARM_METHODDEF) */
654 
655 #ifndef SIGNAL_PAUSE_METHODDEF
656     #define SIGNAL_PAUSE_METHODDEF
657 #endif /* !defined(SIGNAL_PAUSE_METHODDEF) */
658 
659 #ifndef SIGNAL_SIGINTERRUPT_METHODDEF
660     #define SIGNAL_SIGINTERRUPT_METHODDEF
661 #endif /* !defined(SIGNAL_SIGINTERRUPT_METHODDEF) */
662 
663 #ifndef SIGNAL_SETITIMER_METHODDEF
664     #define SIGNAL_SETITIMER_METHODDEF
665 #endif /* !defined(SIGNAL_SETITIMER_METHODDEF) */
666 
667 #ifndef SIGNAL_GETITIMER_METHODDEF
668     #define SIGNAL_GETITIMER_METHODDEF
669 #endif /* !defined(SIGNAL_GETITIMER_METHODDEF) */
670 
671 #ifndef SIGNAL_PTHREAD_SIGMASK_METHODDEF
672     #define SIGNAL_PTHREAD_SIGMASK_METHODDEF
673 #endif /* !defined(SIGNAL_PTHREAD_SIGMASK_METHODDEF) */
674 
675 #ifndef SIGNAL_SIGPENDING_METHODDEF
676     #define SIGNAL_SIGPENDING_METHODDEF
677 #endif /* !defined(SIGNAL_SIGPENDING_METHODDEF) */
678 
679 #ifndef SIGNAL_SIGWAIT_METHODDEF
680     #define SIGNAL_SIGWAIT_METHODDEF
681 #endif /* !defined(SIGNAL_SIGWAIT_METHODDEF) */
682 
683 #ifndef SIGNAL_VALID_SIGNALS_METHODDEF
684     #define SIGNAL_VALID_SIGNALS_METHODDEF
685 #endif /* !defined(SIGNAL_VALID_SIGNALS_METHODDEF) */
686 
687 #ifndef SIGNAL_SIGWAITINFO_METHODDEF
688     #define SIGNAL_SIGWAITINFO_METHODDEF
689 #endif /* !defined(SIGNAL_SIGWAITINFO_METHODDEF) */
690 
691 #ifndef SIGNAL_SIGTIMEDWAIT_METHODDEF
692     #define SIGNAL_SIGTIMEDWAIT_METHODDEF
693 #endif /* !defined(SIGNAL_SIGTIMEDWAIT_METHODDEF) */
694 
695 #ifndef SIGNAL_PTHREAD_KILL_METHODDEF
696     #define SIGNAL_PTHREAD_KILL_METHODDEF
697 #endif /* !defined(SIGNAL_PTHREAD_KILL_METHODDEF) */
698 
699 #ifndef SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF
700     #define SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF
701 #endif /* !defined(SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF) */
702 /*[clinic end generated code: output=9b3f9f1ae2ac2b94 input=a9049054013a1b77]*/
703