I need help with SIGIO and the terminal..


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users I need help with SIGIO and the terminal..
# 1  
Old 10-29-2009
I need help with SIGIO and the terminal..

I want write a program where I call the pause() function to wait for any signal. Now I have registered the SIGIO signal with the following lines of code:

const int on = 1;

fcntl(STDIN_FILENO,F_SETOWN,getpid());

ioctl(STDIN_FILENO, FIOASYNC, &on);
ioctl(STDIN_FILENO, FIONBIO, &on);

signal(SIGIO,catchSIGIO);

then I called the pause() function. The body of the catchSIGIO() is given below:

void catchSIGIO(int num){
printf("INSIDE SIGIO\n");
}

The program compiles alright. When I run the program, it halts/pauses at the pause() function call. Then when I type something in the keyboard, the SIGIO signal is NOT generated (I guess) because nothing happens. The program remains stuck at the pause() function. I can ONLY get out by pressing ctrl+C.

But I want to detect ANY KEY PRESS by SIGIO signal or any other signal (if there is any).

Can anyone help me on this issue? Thanks in advance.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Print Terminal Output Exactly how it Appears in the Terminal to a New Text File

Hello All, I have a text file containing output from a command that contains lots of escape/control characters that when viewed using vi or view, looks like jibberish. But when viewed using the cat command the output is formatted properly. Is there any way to take the output from the cat... (7 Replies)
Discussion started by: mrm5102
7 Replies

2. Shell Programming and Scripting

Cannot get terminal application to launch with a graphical launcher when successful in terminal

I have been having an extremely annoying problem. For the record, I am relatively new at this. I've only been working with unix-based OS's for roughly two years, mostly Xubuntu and some Kali. I am pretty familiar with the BASH language, as that's the default shell for debian. Now, I've made this... (16 Replies)
Discussion started by: Huitzilopochtli
16 Replies

3. UNIX for Dummies Questions & Answers

A terminal controlling a terminal...

Hi all... Consider me a dummy here... I do not want any code or for anyone to show me how to do it at this time, but here is the question:- I have had this brainstorm to be able to control the AudioScope.sh program in the "Shell Scripting And Programming" forum... Is it possible, by... (4 Replies)
Discussion started by: wisecracker
4 Replies

4. UNIX for Dummies Questions & Answers

Does DOS has a terminal or pseudo terminal?

I am wondering if the DOS console works like the unix terminal? (1 Reply)
Discussion started by: vistastar
1 Replies

5. UNIX for Dummies Questions & Answers

Gnuplot wxt terminal vs x11 terminal

Hi, I installed ubuntu recently on my pc. And I installed gnuplot as well. When I first started working with gnuplot it was working . I did a plot and when I wanted to fit my data something happened and not the default terminal of gnuplot is xwt! I changed it to: set terminal x11, but it... (0 Replies)
Discussion started by: cosmologist
0 Replies

6. UNIX for Advanced & Expert Users

Pseudo-terminal will not be allocated because stdin is not a terminal.

I am trying to automate a SSH login using Keys using the following command ssh -i id_rsa usernamw@ipaddr. I am successful in doing this and i am getting the Warning Screen and I logon successfully. but when I am executing the command tail -1cf put.dat | ssh -i id_rsa username@ipaddr > get.dat ... (1 Reply)
Discussion started by: Shivdatta
1 Replies

7. UNIX for Dummies Questions & Answers

Terminal

Hello, I'm completely new to UNIX, and as part of a project I'm doing at university I am using a UNIX SOLAR computer. I have been told to SSH tunnel to access it, using Putty and VNC, which I have done and works. When I could then 'see' the computer from home I had a terminal open, but I was... (10 Replies)
Discussion started by: Jono_H
10 Replies

8. AIX

Terminal

People, what util can help me as a terminal for COM connection with a Zyxel modem so that I can connect to another server (p630) with the same modem through a dedicated line??? And also does anybody know where can I put a question about Storage Area Networking?? I am having problems with setting... (5 Replies)
Discussion started by: dilshik
5 Replies

9. UNIX for Dummies Questions & Answers

terminal

Hi there, Does anyone know what exactly is the different between a terminal and a console ? My understanding is a console is normally a local session while a terminal can be a remote as well. What do you think guys? Thanks (1 Reply)
Discussion started by: guest100
1 Replies

10. UNIX for Advanced & Expert Users

connecting to unix through hyper terminal - as a dumb terminal

I just changed from windows NT to XP and I am no longer able to connect to my unix system. I used to use hyper terminal -- which acts as dumb terminal to my main frame unix system. I think one of the options used to be "direct to comX". This option isn't listed now. I use a serial port and the... (2 Replies)
Discussion started by: michelle
2 Replies
Login or Register to Ask a Question
pause(2)							System Calls Manual							  pause(2)

NAME
pause - suspend process until signal SYNOPSIS
DESCRIPTION
suspends the calling process until it receives a signal. The signal must be one that is not currently set to be ignored or blocked (masked) by the calling process. If the signal causes termination of the calling process, does not return. If the signal is by the calling process and control is returned from the signal-catching function (see signal(5)), the calling process resumes execution from the point of suspension; with a return value of -1 from and set to APPLICATION USAGE
Threads Considerations Signal dispositions (such as catch/default/ignore) are shared by all threads in the process and blocked signal masks are maintained by each thread. Therefore, the signals being waited for should not be ignored by the process or blocked by the calling thread. will suspend only the calling thread until it receives a signal. If other threads in the process do not block the signal, the signal may be delivered to another thread in the process and the thread in may continue waiting. For this reason, the use of is recommended instead of for multi-threaded applications. For more information regarding signals and threads, refer to signal(5). SEE ALSO
alarm(2), kill(2), sigwait(2), wait(2), signal(5). STANDARDS CONFORMANCE
pause(2)