2.9
[glibc/nacl-glibc.git] / sysdeps / unix / sysv / linux / aio_sigqueue.c
blob30e9fbf7e5e421da3a70aeb3057c33c71a24ca60
1 /* Copyright (C) 1997,1998,1999,2000,2003,2005
2 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
20 #include <aio.h>
21 #include <errno.h>
22 #include <signal.h>
23 #include <unistd.h>
24 #include <string.h>
26 #include <sysdep.h>
27 #include <sys/syscall.h>
29 #include <aio_misc.h>
31 #ifdef __NR_rt_sigqueueinfo
33 /* Return any pending signal or wait for one for the given time. */
34 int
35 __aio_sigqueue (sig, val, caller_pid)
36 int sig;
37 const union sigval val;
38 pid_t caller_pid;
40 siginfo_t info;
42 /* First, clear the siginfo_t structure, so that we don't pass our
43 stack content to other tasks. */
44 memset (&info, 0, sizeof (siginfo_t));
45 /* We must pass the information about the data in a siginfo_t value. */
46 info.si_signo = sig;
47 info.si_code = SI_ASYNCIO;
48 info.si_pid = caller_pid;
49 info.si_uid = getuid ();
50 info.si_value = val;
52 return INLINE_SYSCALL (rt_sigqueueinfo, 3, info.si_pid,
53 sig, __ptrvalue (&info));
55 #else
56 # include <rt/aio_sigqueue.c>
57 #endif