Debian Codegraph @

templates/man2/pidfd_send_signal.2.pot

raw
1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5 #
6 #, fuzzy
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2026-06-05 06:34+0200\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <[email protected]>\n"
14 "Language: \n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18
19 #. type: TH
20 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
21 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
22 #, no-wrap
23 msgid "pidfd_send_signal"
24 msgstr ""
25
26 #. type: TH
27 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
28 #: opensuse-tumbleweed
29 #, no-wrap
30 msgid "2026-02-08"
31 msgstr ""
32
33 #. type: TH
34 #: archlinux debian-unstable
35 #, no-wrap
36 msgid "Linux man-pages 6.18"
37 msgstr ""
38
39 #. type: SH
40 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
41 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
42 #, no-wrap
43 msgid "NAME"
44 msgstr ""
45
46 #. type: Plain text
47 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
48 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
49 msgid ""
50 "pidfd_send_signal - send a signal to a process specified by a file descriptor"
51 msgstr ""
52
53 #. type: SH
54 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
55 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
56 #, no-wrap
57 msgid "LIBRARY"
58 msgstr ""
59
60 #. type: Plain text
61 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
62 #: opensuse-leap-16-1 opensuse-tumbleweed
63 msgid "Standard C library (I<libc>,\\ I<-lc>)"
64 msgstr ""
65
66 #. type: SH
67 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
68 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
69 #, no-wrap
70 msgid "SYNOPSIS"
71 msgstr ""
72
73 #. type: Plain text
74 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
75 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
76 #, no-wrap
77 msgid ""
78 "B<#include E<lt>linux/signal.hE<gt>> /* Definition of B<SIG*> constants */\n"
79 "B<#include E<lt>signal.hE<gt>> /* Definition of B<SI_*> constants */\n"
80 "B<#include E<lt>sys/syscall.hE<gt>> /* Definition of B<SYS_*> constants */\n"
81 "B<#include E<lt>unistd.hE<gt>>\n"
82 msgstr ""
83
84 #. type: Plain text
85 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
86 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
87 #, no-wrap
88 msgid ""
89 "B<int syscall(SYS_pidfd_send_signal, int >I<pidfd>B<, int >I<sig>B<,>\n"
90 "B< siginfo_t *_Nullable >I<info>B<, unsigned int >I<flags>B<);>\n"
91 msgstr ""
92
93 #. type: Plain text
94 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
95 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
96 msgid ""
97 "I<Note>: glibc provides no wrapper for B<pidfd_send_signal>(), necessitating "
98 "the use of B<syscall>(2)."
99 msgstr ""
100
101 #. type: SH
102 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
103 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
104 #, no-wrap
105 msgid "DESCRIPTION"
106 msgstr ""
107
108 #. See the very detailed commit message for kernel commit
109 #. 3eb39f47934f9d5a3027fe00d906a45fe3a15fad
110 #. type: Plain text
111 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
112 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
113 msgid ""
114 "The B<pidfd_send_signal>() system call sends the signal I<sig> to the "
115 "target process referred to by I<pidfd>, a PID file descriptor that refers to "
116 "a process."
117 msgstr ""
118
119 #. type: Plain text
120 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
121 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
122 msgid ""
123 "If the I<info> argument points to a I<siginfo_t> buffer, that buffer should "
124 "be populated as described in B<rt_sigqueueinfo>(2)."
125 msgstr ""
126
127 #. type: Plain text
128 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
129 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
130 msgid ""
131 "If the I<info> argument is a null pointer, this is equivalent to specifying "
132 "a pointer to a I<siginfo_t> buffer whose fields match the values that are "
133 "implicitly supplied when a signal is sent using B<kill>(2):"
134 msgstr ""
135
136 #. type: IP
137 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
138 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
139 #, no-wrap
140 msgid "\\[bu]"
141 msgstr ""
142
143 #. type: Plain text
144 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
145 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
146 msgid "I<si_signo> is set to the signal number;"
147 msgstr ""
148
149 #. type: Plain text
150 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
151 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
152 msgid "I<si_errno> is set to 0;"
153 msgstr ""
154
155 #. type: Plain text
156 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
157 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
158 msgid "I<si_code> is set to B<SI_USER>;"
159 msgstr ""
160
161 #. type: Plain text
162 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
163 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
164 msgid "I<si_pid> is set to the caller's PID; and"
165 msgstr ""
166
167 #. type: Plain text
168 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
169 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
170 msgid "I<si_uid> is set to the caller's real user ID."
171 msgstr ""
172
173 #. type: Plain text
174 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
175 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
176 msgid ""
177 "The calling process must either be in the same PID namespace as the process "
178 "referred to by I<pidfd>, or be in an ancestor of that namespace."
179 msgstr ""
180
181 #. type: Plain text
182 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
183 #: opensuse-tumbleweed
184 msgid ""
185 "The I<flags> argument allows to modify the scope of the signal. By default, "
186 "the scope of the signal will be inferred from the I<pidfd> argument. For "
187 "example, if I<pidfd> refers to a specific thread \\[em]i.e., the I<pidfd> "
188 "was created through B<pidfd_open>(2) using the B<PIDFD_THREAD> flag or "
189 "through B<clone3>(2) using the B<CLONE_PIDFD> flag together with the "
190 "B<CLONE_THREAD> flag\\[em] then passing I<pidfd> to B<pidfd_send_signal>(2) "
191 "and leaving the I<flags> argument as B<0> will cause the signal to be sent "
192 "to the specific thread referenced by the I<pidfd>."
193 msgstr ""
194
195 #. type: TP
196 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
197 #: opensuse-tumbleweed
198 #, no-wrap
199 msgid "B<PIDFD_SIGNAL_THREAD> (since Linux 6.9)"
200 msgstr ""
201
202 #. commit e1fb1dc08e73466830612bcf2f9f72180965c9ba
203 #. type: Plain text
204 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
205 #: opensuse-tumbleweed
206 msgid ""
207 "Ensure that the signal is sent to the specific thread referenced by I<pidfd>."
208 msgstr ""
209
210 #. type: TP
211 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
212 #: opensuse-tumbleweed
213 #, no-wrap
214 msgid "B<PIDFD_SIGNAL_THREAD_GROUP> (since Linux 6.9)"
215 msgstr ""
216
217 #. commit e1fb1dc08e73466830612bcf2f9f72180965c9ba
218 #. type: Plain text
219 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
220 #: opensuse-tumbleweed
221 msgid ""
222 "If I<pidfd> refers to a thread-group leader, ensure that the signal is sent "
223 "to the thread-group, even if I<pidfd> was created to refer to a specific "
224 "thread."
225 msgstr ""
226
227 #. type: TP
228 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
229 #: opensuse-tumbleweed
230 #, no-wrap
231 msgid "B<PIDFD_SIGNAL_PROCESS_GROUP> (since Linux 6.9)"
232 msgstr ""
233
234 #. commit e1fb1dc08e73466830612bcf2f9f72180965c9ba
235 #. type: Plain text
236 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
237 #: opensuse-tumbleweed
238 msgid ""
239 "If I<pidfd> refers to a process-group leader, ensure that the signal is sent "
240 "to the process-group, even if I<pidfd> was created to refer to a specific "
241 "thread or to a thread-group leader."
242 msgstr ""
243
244 #. type: SH
245 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
246 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
247 #, no-wrap
248 msgid "RETURN VALUE"
249 msgstr ""
250
251 #. type: Plain text
252 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
253 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
254 msgid ""
255 "On success, B<pidfd_send_signal>() returns 0. On error, -1 is returned and "
256 "I<errno> is set to indicate the error."
257 msgstr ""
258
259 #. type: SH
260 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
261 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
262 #, no-wrap
263 msgid "ERRORS"
264 msgstr ""
265
266 #. type: TP
267 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
268 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
269 #, no-wrap
270 msgid "B<EBADF>"
271 msgstr ""
272
273 #. type: Plain text
274 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
275 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
276 msgid "I<pidfd> is not a valid PID file descriptor."
277 msgstr ""
278
279 #. type: TP
280 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
281 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
282 #, no-wrap
283 msgid "B<EINVAL>"
284 msgstr ""
285
286 #. type: Plain text
287 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
288 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
289 msgid "I<sig> is not a valid signal."
290 msgstr ""
291
292 #. type: Plain text
293 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
294 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
295 msgid ""
296 "The calling process is not in a PID namespace from which it can send a "
297 "signal to the target process."
298 msgstr ""
299
300 #. type: Plain text
301 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
302 #: opensuse-tumbleweed
303 msgid "I<flags> is not valid."
304 msgstr ""
305
306 #. type: TP
307 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
308 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
309 #, no-wrap
310 msgid "B<EPERM>"
311 msgstr ""
312
313 #. type: Plain text
314 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
315 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
316 msgid ""
317 "The calling process does not have permission to send the signal to the "
318 "target process."
319 msgstr ""
320
321 #. type: Plain text
322 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
323 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
324 msgid ""
325 "I<pidfd> doesn't refer to the calling process, and I<info.si_code> is "
326 "invalid (see B<rt_sigqueueinfo>(2))."
327 msgstr ""
328
329 #. type: TP
330 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
331 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
332 #, no-wrap
333 msgid "B<ESRCH>"
334 msgstr ""
335
336 #. type: Plain text
337 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
338 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
339 msgid ""
340 "The target process does not exist (i.e., it has terminated and been waited "
341 "on)."
342 msgstr ""
343
344 #. type: SH
345 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
346 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
347 #, no-wrap
348 msgid "STANDARDS"
349 msgstr ""
350
351 #. type: Plain text
352 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
353 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
354 msgid "Linux."
355 msgstr ""
356
357 #. type: SH
358 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
359 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
360 #, no-wrap
361 msgid "HISTORY"
362 msgstr ""
363
364 #. type: Plain text
365 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
366 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
367 msgid "Linux 5.1."
368 msgstr ""
369
370 #. type: SH
371 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
372 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
373 #, no-wrap
374 msgid "NOTES"
375 msgstr ""
376
377 #. type: SS
378 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
379 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
380 #, no-wrap
381 msgid "PID file descriptors"
382 msgstr ""
383
384 #. type: Plain text
385 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
386 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
387 msgid ""
388 "The I<pidfd> argument is a PID file descriptor, a file descriptor that "
389 "refers to process. Such a file descriptor can be obtained in any of the "
390 "following ways:"
391 msgstr ""
392
393 #. type: Plain text
394 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
395 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
396 msgid "by opening a I</proc/>pid directory;"
397 msgstr ""
398
399 #. type: Plain text
400 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
401 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
402 msgid "using B<pidfd_open>(2); or"
403 msgstr ""
404
405 #. type: Plain text
406 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
407 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
408 msgid ""
409 "via the PID file descriptor that is returned by a call to B<clone>(2) or "
410 "B<clone3>(2) that specifies the B<CLONE_PIDFD> flag."
411 msgstr ""
412
413 #. type: Plain text
414 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
415 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
416 msgid ""
417 "The B<pidfd_send_signal>() system call allows the avoidance of race "
418 "conditions that occur when using traditional interfaces (such as "
419 "B<kill>(2)) to signal a process. The problem is that the traditional "
420 "interfaces specify the target process via a process ID (PID), with the "
421 "result that the sender may accidentally send a signal to the wrong process "
422 "if the originally intended target process has terminated and its PID has "
423 "been recycled for another process. By contrast, a PID file descriptor is a "
424 "stable reference to a specific process; if that process terminates, "
425 "B<pidfd_send_signal>() fails with the error B<ESRCH>."
426 msgstr ""
427
428 #. type: SH
429 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
430 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
431 #, no-wrap
432 msgid "EXAMPLES"
433 msgstr ""
434
435 #. type: Plain text
436 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
437 #: opensuse-tumbleweed
438 #, no-wrap
439 msgid ""
440 "#define _GNU_SOURCE\n"
441 "#include E<lt>fcntl.hE<gt>\n"
442 "#include E<lt>limits.hE<gt>\n"
443 "#include E<lt>signal.hE<gt>\n"
444 "#include E<lt>stdio.hE<gt>\n"
445 "#include E<lt>stdlib.hE<gt>\n"
446 "#include E<lt>string.hE<gt>\n"
447 "#include E<lt>sys/syscall.hE<gt>\n"
448 "#include E<lt>unistd.hE<gt>\n"
449 "\\&\n"
450 "static int\n"
451 "pidfd_send_signal(int pidfd, int sig, siginfo_t *info,\n"
452 " unsigned int flags)\n"
453 "{\n"
454 " return syscall(SYS_pidfd_send_signal, pidfd, sig, info, flags);\n"
455 "}\n"
456 "\\&\n"
457 "int\n"
458 "main(int argc, char *argv[])\n"
459 "{\n"
460 " int pidfd, sig;\n"
461 " char path[PATH_MAX];\n"
462 " siginfo_t info;\n"
463 "\\&\n"
464 " if (argc != 3) {\n"
465 " fprintf(stderr, \"Usage: %s E<lt>pidE<gt> E<lt>signalE<gt>\\[rs]n\", argv[0]);\n"
466 " exit(EXIT_FAILURE);\n"
467 " }\n"
468 "\\&\n"
469 " sig = atoi(argv[2]);\n"
470 "\\&\n"
471 " /* Obtain a PID file descriptor by opening the /proc/PID directory\n"
472 " of the target process. */\n"
473 "\\&\n"
474 " snprintf(path, sizeof(path), \"/proc/%s\", argv[1]);\n"
475 "\\&\n"
476 " pidfd = open(path, O_RDONLY);\n"
477 " if (pidfd == -1) {\n"
478 " perror(\"open\");\n"
479 " exit(EXIT_FAILURE);\n"
480 " }\n"
481 "\\&\n"
482 " /* Populate a \\[aq]siginfo_t\\[aq] structure for use with\n"
483 " pidfd_send_signal(). */\n"
484 "\\&\n"
485 " memset(&info, 0, sizeof(info));\n"
486 " info.si_code = SI_QUEUE;\n"
487 " info.si_signo = sig;\n"
488 " info.si_errno = 0;\n"
489 " info.si_uid = getuid();\n"
490 " info.si_pid = getpid();\n"
491 " info.si_value.sival_int = 1234;\n"
492 "\\&\n"
493 " /* Send the signal. */\n"
494 "\\&\n"
495 " if (pidfd_send_signal(pidfd, sig, &info, 0) == -1) {\n"
496 " perror(\"pidfd_send_signal\");\n"
497 " exit(EXIT_FAILURE);\n"
498 " }\n"
499 "\\&\n"
500 " exit(EXIT_SUCCESS);\n"
501 "}\n"
502 msgstr ""
503
504 #. SRC END
505 #. type: SH
506 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
507 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
508 #, no-wrap
509 msgid "SEE ALSO"
510 msgstr ""
511
512 #. type: Plain text
513 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
514 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
515 msgid ""
516 "B<clone>(2), B<kill>(2), B<pidfd_open>(2), B<rt_sigqueueinfo>(2), "
517 "B<sigaction>(2), B<pid_namespaces>(7), B<signal>(7)"
518 msgstr ""
519
520 #. type: TH
521 #: debian-trixie
522 #, no-wrap
523 msgid "2024-06-15"
524 msgstr ""
525
526 #. type: TH
527 #: debian-trixie
528 #, no-wrap
529 msgid "Linux man-pages 6.9.1"
530 msgstr ""
531
532 #. type: Plain text
533 #: debian-trixie
534 msgid "Standard C library (I<libc>, I<-lc>)"
535 msgstr ""
536
537 #. type: Plain text
538 #: debian-trixie fedora-44 fedora-rawhide
539 msgid ""
540 "The I<flags> argument is reserved for future use; currently, this argument "
541 "must be specified as 0."
542 msgstr ""
543
544 #. type: Plain text
545 #: debian-trixie fedora-44 fedora-rawhide
546 msgid "I<flags> is not 0."
547 msgstr ""
548
549 #. type: Plain text
550 #: debian-trixie fedora-44 fedora-rawhide
551 #, no-wrap
552 msgid ""
553 "#define _GNU_SOURCE\n"
554 "#include E<lt>fcntl.hE<gt>\n"
555 "#include E<lt>limits.hE<gt>\n"
556 "#include E<lt>signal.hE<gt>\n"
557 "#include E<lt>stdio.hE<gt>\n"
558 "#include E<lt>stdlib.hE<gt>\n"
559 "#include E<lt>string.hE<gt>\n"
560 "#include E<lt>sys/syscall.hE<gt>\n"
561 "#include E<lt>unistd.hE<gt>\n"
562 "\\&\n"
563 "static int\n"
564 "pidfd_send_signal(int pidfd, int sig, siginfo_t *info,\n"
565 " unsigned int flags)\n"
566 "{\n"
567 " return syscall(SYS_pidfd_send_signal, pidfd, sig, info, flags);\n"
568 "}\n"
569 "\\&\n"
570 "int\n"
571 "main(int argc, char *argv[])\n"
572 "{\n"
573 " int pidfd, sig;\n"
574 " char path[PATH_MAX];\n"
575 " siginfo_t info;\n"
576 "\\&\n"
577 " if (argc != 3) {\n"
578 " fprintf(stderr, \"Usage: %s E<lt>pidE<gt> E<lt>signalE<gt>\\[rs]n\", argv[0]);\n"
579 " exit(EXIT_FAILURE);\n"
580 " }\n"
581 "\\&\n"
582 " sig = atoi(argv[2]);\n"
583 "\\&\n"
584 " /* Obtain a PID file descriptor by opening the /proc/PID directory\n"
585 " of the target process. */\n"
586 "\\&\n"
587 " snprintf(path, sizeof(path), \"/proc/%s\", argv[1]);\n"
588 "\\&\n"
589 " pidfd = open(path, O_RDONLY);\n"
590 " if (pidfd == -1) {\n"
591 " perror(\"open\");\n"
592 " exit(EXIT_FAILURE);\n"
593 " }\n"
594 "\\&\n"
595 " /* Populate a \\[aq]siginfo_t\\[aq] structure for use with\n"
596 " pidfd_send_signal(). */\n"
597 "\\&\n"
598 " memset(&info, 0, sizeof(info));\n"
599 " info.si_code = SI_QUEUE;\n"
600 " info.si_signo = sig;\n"
601 " info.si_errno = 0;\n"
602 " info.si_uid = getuid();\n"
603 " info.si_pid = getpid();\n"
604 " info.si_value.sival_int = 1234;\n"
605 "\\&\n"
606 " /* Send the signal. */\n"
607 "\\&\n"
608 " if (pidfd_send_signal(pidfd, sig, &info, 0) == -1) {\n"
609 " perror(\"pidfd_send_signal\");\n"
610 " exit(EXIT_FAILURE);\n"
611 " }\n"
612 "\\&\n"
613 " exit(EXIT_SUCCESS);\n"
614 "}\n"
615 msgstr ""
616
617 #. type: TH
618 #: fedora-44 fedora-rawhide
619 #, no-wrap
620 msgid "2024-07-23"
621 msgstr ""
622
623 #. type: TH
624 #: fedora-44 fedora-rawhide
625 #, no-wrap
626 msgid "Linux man-pages 6.13"
627 msgstr ""
628
629 #. type: TH
630 #: mageia-cauldron
631 #, no-wrap
632 msgid "Linux man-pages 6.17"
633 msgstr ""
634
635 #. type: TH
636 #: opensuse-leap-16-1 opensuse-tumbleweed
637 #, no-wrap
638 msgid "Linux man-pages (unreleased)"
639 msgstr ""