01-21-2011
You can use fcntl() to set the O_ASYNC flag on your file descriptors.
Your process will then receive a SIGIO signal when IO is possible on those file descriptors. Which file descriptor will be specified in the siginfo_t structure you get with each SIGIO signal. The siginfo_t structure might also contain other information as well, but offhand I don't recall if there is any additional data.
You need to be real careful in your signal handler, though. Any system call you make from within the signal handler or anything it calls MUST be async-signal safe. For example, no malloc()/free() or new/delete or anything else that might make those calls.
10 More Discussions You Might Find Interesting
1. Linux
hi all,
greetings,
please tell me how to start a java GUI program in the startup of the machine.
since it invokes a GUI is it possiable to entry the same in /etc/rc2.d/S99userdefinedfiles.
thanks in advance .,
:-) (1 Reply)
Discussion started by: raguramtgr
1 Replies
2. Shell Programming and Scripting
hi,
In solaris, psrinfo gives number of cpu in use/online and so on.
What is the equivalent command for "psrinfo" in Suse Linux ?
Thx (3 Replies)
Discussion started by: braindrain
3 Replies
3. Linux
Hi all...
In my Unix system a program exists called "daemon2" which is responsible to enqueue program executions. For example, if I want to make the system to enqueue lpr executions for certain users, I call daemon2 with lpr as the parameter.
Is there an equivalent in Linux?
Thanks
Jaime (0 Replies)
Discussion started by: jstuardo
0 Replies
4. UNIX for Advanced & Expert Users
iostat -e gives the soft, hard and transport error information in Solaris.
What is the equivalent command in the other flavors of Unix AIX HP Linux.
Thanks
Prasi (1 Reply)
Discussion started by: prasi_in
1 Replies
5. UNIX for Dummies Questions & Answers
What is the equivalent of Solaris snoop in Linux
I could not find snoop in RHEL (2 Replies)
Discussion started by: santosh149
2 Replies
6. Linux
I have experience with making bootable images of AIX systems using mksysb and wondered if there was some type of equivalent software for Linux. Or perhaps some of the folks here have alternatives or unique ideas for how they are backing up their Linux systems enabling them to recover them as... (13 Replies)
Discussion started by: scotbuff
13 Replies
7. Linux
I moved to a Linux system from Windows a few months ago. Most of the programs I had been using were already native to Linux (Firefox, the GIMP, Pari, etc.) and most others I found a close enough program (Crimson Editor -> gedit, Visual Studio -> KDevelop, Primo -> Morain's ECPP).
Now I'm down... (1 Reply)
Discussion started by: CRGreathouse
1 Replies
8. Linux
Hi Guys,
I am used to configuring DHCP on Solaris and foreach subnet added I place a corresponding entry in /etc/netmasks. I am now looking at configuring DHCP on linux, is there an equivalnet entry required somewhere or is this not needed in linux
Thanks (3 Replies)
Discussion started by: eeisken
3 Replies
9. Red Hat
Hi,
I need to mount a replicated nfs4 export on a number of AIX and Redhat hosts. To get the failover on the clients working smoothly, I need to change certain values on the AIX boxes like nfs_v4_fail_over_timeout, timeo and retrans values. Since I have no clue about Linux, I am not quite sure... (1 Reply)
Discussion started by: zxmaus
1 Replies
10. Shell Programming and Scripting
I have a folder called "log" which has a few sub-folders say "fda" "fd7" "fdd" "fd6 .... "
I wish to fire the below command inside each subfolder starting with the folder with the latest time stamp.
grep "$greptime.*exit" Prod.$(hostname).log | grep $fdrdate_new
If the seach did not yield... (3 Replies)
Discussion started by: mohtashims
3 Replies
LEARN ABOUT DEBIAN
sigqueue
SIGQUEUE(3) Linux Programmer's Manual SIGQUEUE(3)
NAME
sigqueue - queue a signal and data to a process
SYNOPSIS
#include <signal.h>
int sigqueue(pid_t pid, int sig, const union sigval value);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
sigqueue(): _POSIX_C_SOURCE >= 199309L
DESCRIPTION
sigqueue() sends the signal specified in sig to the process whose PID is given in pid. The permissions required to send a signal are the
same as for kill(2). As with kill(2), the null signal (0) can be used to check if a process with a given PID exists.
The value argument is used to specify an accompanying item of data (either an integer or a pointer value) to be sent with the signal, and
has the following type:
union sigval {
int sival_int;
void *sival_ptr;
};
If the receiving process has installed a handler for this signal using the SA_SIGINFO flag to sigaction(2), then it can obtain this data
via the si_value field of the siginfo_t structure passed as the second argument to the handler. Furthermore, the si_code field of that
structure will be set to SI_QUEUE.
RETURN VALUE
On success, sigqueue() returns 0, indicating that the signal was successfully queued to the receiving process. Otherwise -1 is returned
and errno is set to indicate the error.
ERRORS
EAGAIN The limit of signals which may be queued has been reached. (See signal(7) for further information.)
EINVAL sig was invalid.
EPERM The process does not have permission to send the signal to the receiving process. For the required permissions, see kill(2).
ESRCH No process has a PID matching pid.
VERSIONS
This system call first appeared in Linux 2.2.
CONFORMING TO
POSIX.1-2001.
NOTES
If this function results in the sending of a signal to the process that invoked it, and that signal was not blocked by the calling thread,
and no other threads were willing to handle this signal (either by having it unblocked, or by waiting for it using sigwait(3)), then at
least some signal must be delivered to this thread before this function returns.
On Linux, this function is implemented using the rt_sigqueueinfo(2) system call. The system call differs in its third argument, which is
the siginfo_t structure that will be supplied to the receiving process's signal handler or returned by the receiving process's sigtimed-
wait(2) call. Inside the glibc sigqueue() wrapper, this argument, uinfo, is initialized as follows:
uinfo.si_signo = sig; /* argument supplied to sigqueue() */
uinfo.si_code = SI_QUEUE;
uinfo.si_pid = getpid(); /* Process ID of sender */
uinfo.si_uid = getuid(); /* Real UID of sender */
uinfo.si_value = val; /* argument supplied to sigqueue() */
SEE ALSO
kill(2), rt_sigqueueinfo(2), sigaction(2), signal(2), pthread_sigqueue(3), sigwait(3), signal(7)
COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2012-03-25 SIGQUEUE(3)