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