]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/aio_sigqueue.c
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / aio_sigqueue.c
CommitLineData
688903eb 1/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
cbdee279
UD
2 This file is part of the GNU C Library.
3
4 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
cbdee279
UD
8
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 12 Lesser General Public License for more details.
cbdee279 13
41bdb6e2 14 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
cbdee279
UD
17
18#include <aio.h>
0dee6738 19#include <errno.h>
cbdee279
UD
20#include <signal.h>
21#include <unistd.h>
e645ed3a 22#include <string.h>
cbdee279 23
0dee6738
UD
24#include <sysdep.h>
25#include <sys/syscall.h>
26
8f480b4b 27#include <aio_misc.h>
cbdee279 28
655b26bb 29#ifdef __NR_rt_sigqueueinfo
cbdee279
UD
30
31/* Return any pending signal or wait for one for the given time. */
32int
bd2260a2 33__aio_sigqueue (int sig, const union sigval val, pid_t caller_pid)
cbdee279
UD
34{
35 siginfo_t info;
36
e645ed3a
UD
37 /* First, clear the siginfo_t structure, so that we don't pass our
38 stack content to other tasks. */
39 memset (&info, 0, sizeof (siginfo_t));
cbdee279
UD
40 /* We must pass the information about the data in a siginfo_t value. */
41 info.si_signo = sig;
cbdee279 42 info.si_code = SI_ASYNCIO;
3a9eb648 43 info.si_pid = caller_pid;
a53bad16 44 info.si_uid = getuid ();
cbdee279
UD
45 info.si_value = val;
46
e5dee2c8 47 return INLINE_SYSCALL (rt_sigqueueinfo, 3, info.si_pid, sig, &info);
cbdee279 48}
655b26bb 49#else
2826ac7e 50# include <rt/aio_sigqueue.c>
655b26bb 51#endif