Not able to Display the Catched Signal


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Not able to Display the Catched Signal
# 8  
Old 08-20-2012
A TTY terminal device is a character device that performs input and output on a character-by-character basis.

The communication between terminal devices and the programs that read and write to them is controlled by the TTY interface. Examples of TTY devices are ASCII terminal and modems.
# 9  
Old 08-20-2012
Quote:
Originally Posted by shyam.sunder91
thanks for ur reply i got an understanding over flushing buffers and their advantage



i did not get this line can u elucidate,what is getting connecting to tty device file
Back in the old days, when Teletype devices and stand-alone terminals were connected by wires to the back of a shared computer or over a phone line that was connected to a modem that was connected by wires to the back of a shared computer, everyone knew how a terminal appeared as a character special file that supported the general terminal interfaces.

Most vendor man page set will have a termios man page (but the section it is in will vary). Chapter 11 of the Base Definitions volume of the current POSIX standard has more than a dozen pages describing the General Terminal Interface (GTI).

The extremely quick overview, is that any time you have a user typing on a keyboard to interactively enter input into a program and interactively looking at output produced by a program on a screen or typewriter-like device, you are likely using a tty device or pseudo-tty device that behaves mostly as specified by the POSIX GTI. Smilie
# 10  
Old 08-24-2012
It is wise to log debug stuff to stderr, which by default is completely unbuffered. Just change 'printf(' to 'fprintf( stderr,'.

If speed is a focus, don't write bulk to unbuffered or line buffered FILE*'s like stderr, use a well buffered one, see man setvbuf(), some multiple of the disk page or packet size size like 65536 or 57600, less than the system write buffer or socket send buffer size, and fflush() only if necessary.

Calling exit() almost always flushes FILE*'s free of charge, but I had a primitive C compiler once that didn't.

---------- Post updated at 04:47 PM ---------- Previous update was at 04:46 PM ----------

You can use a tool like strace/truss/tusc to trace system calls and signals of the running process to a log file, and see what signals are doing what to your process.
# 11  
Old 08-27-2012
Quote:
Originally Posted by DGPickett
It is wise to log debug stuff to stderr, which by default is completely unbuffered. Just change 'printf(' to 'fprintf( stderr,'.
It's also wise because it keeps your error messages separate from your data. If you're writing a PNG image to standard output, for instance, you don't want "Warning: Needed to flatten image" stuck randomly in the middle of that, you want that going where a human will read it or just nowhere. Writing to stderr lets you control it independently.
# 12  
Old 09-06-2012
Good error handling makes for short debug times and happier production support. That is why stderr is always open and unbuffered at the start. Point it at a log file.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Case signal

Task 1: #!/bin/ksh if then echo "Usage : $0 Signalnumber PID" exit fi case "$1" in 1) echo "Sending SIGHUP signal" kill -SIGHUP $2 ;; 2) echo "Sending SIGINT signal" kill -SIGINT $2 ;; 3) echo "Sending SIGQUIT signal" kill -SIGQUIT $2 (3 Replies)
Discussion started by: Ramesh M
3 Replies

2. Programming

queue a signal

A program have to receive signals and work agreed with it, but the process have to receive more than one signal when it is attending other. Those have to be queued to be attended later recived. how can i do that? thanks. (2 Replies)
Discussion started by: marmaster
2 Replies

3. UNIX for Advanced & Expert Users

DISPLAY=local_host:0.0 ; export DISPLAY

Hi, from my Windows Workstation I can connect with PUTTY to an AIX 6.1 unix server. On AIX via PUTTY I run DBCA which has a grphical interface. Then : #DISPLAY=local_host:0.0 ; export DISPLAY $(hostname) $(whoami):/appli/oracle/product/10.2.0/db_1/bin#dbca _X11TransSocketINETConnect()... (12 Replies)
Discussion started by: big123456
12 Replies

4. UNIX for Dummies Questions & Answers

Trying to block signal

I have this code that doesnt do what it is suppose to do. It should block signal that I send while process is running. I press control+z while this process is running and it should be blocked but it isnt. When i press control+z it gives me this.... + Stopped When I change SIGTSP into SIGINT then... (5 Replies)
Discussion started by: joker40
5 Replies

5. Shell Programming and Scripting

Killed by signal 15.

Hi all I have Master script, Main script ,and 4 Child script. Master.sh #!/bin/bash /export/home/user/Main.shMain.sh #!/bin/bash /export/home/user/Child1.sh & /export/home/user/Child2.sh & /export/home/user/Child3.sh & /export/home/user/Child4.sh &I run only Master.sh script... (1 Reply)
Discussion started by: almanto
1 Replies

6. Programming

Signal Problem

I am using the signal function, and passing it a function named quit procedure...I get the following warning.... passing arg2 of signal from incompatible pointer type... void quit_procedure(void); //this is the way i define my prototype... signal(SIGINT, quit_procedure); Please guide... (5 Replies)
Discussion started by: jacques83
5 Replies

7. Shell Programming and Scripting

Signal question

Who can explain the meaning of the &2 &1 or @, #, etc in the script? Is there any document which can explain the usage of these words in details? for example: ls /etc/sysconfig/network > /dev/null 2>&1 #@ bash, ksh and sh. Thanks in advance for ur advice. (1 Reply)
Discussion started by: GCTEII
1 Replies

8. UNIX for Dummies Questions & Answers

Alarm signal

Hi, when I execute a script on unix AIX, I've got an error message: "Execution: 85328 Signal d'alarme". If I edit this file with "vi", I ve got the same error after a while (about 1 minute). If I try with another user I still have the problem. But if I rename this file, no problem. My... (5 Replies)
Discussion started by: cgsteph
5 Replies

9. Shell Programming and Scripting

thread::signal

Hi,all! Now ,I write perl for windows platform,and will use signal for asynchronous operations ,but I find it could bring some bugs if it is used incorrectly ,pls help!!! :D (1 Reply)
Discussion started by: hhh101
1 Replies
Login or Register to Ask a Question