Sponsored Content
Full Discussion: Basic signal and alarm usage
Top Forums Programming Basic signal and alarm usage Post 302119193 by porter on Monday 28th of May 2007 05:37:02 PM
Old 05-28-2007
Although that may be a jolly program, that is far too much code for a signal handler.

C libraries are not "signal safe", the most you should be doing in a signal handler is setting a flag or a minimal bit of IPC to awaken the main program.

If your handler was called in the middle of malloc your heap could get trashed.
 

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

Perl alarm signal

I am trying to write a signal to exit when a process times out. What I have come up with from poking around the web is this. #!/usr/bin/perl eval { local $SIG{ALRM} = sub { die "alarm clock restart" }; alarm 10; open(DSMADMC, "dsmadmc -se=tsmpc1 -id=XXXXX... (2 Replies)
Discussion started by: reggiej
2 Replies

3. AIX

basic question about disk usage

how to i find out the disk usage on a server. say in windows examples its like C:/ D:/ and checking out the disk space. how can i find in Unix. can i just use df -k (3 Replies)
Discussion started by: karthikosu
3 Replies

4. Shell Programming and Scripting

Basic bash 'for loop' usage

Hi! I have a simple question about using a for loop. I'm trying to open up all the zip files in the currect directory with ark, but I am getting the error "bash: syntax error near unexpected token `for $i ; do ark $i ; done ; I looked in the info pages for bash, but I can't seem to figure... (2 Replies)
Discussion started by: Orange Stripes
2 Replies

5. Programming

Usage of exit() inside a signal handler

Is it ok to use exit() inside a signal handler? I catch SIGUSR1 in a signal handler and I try to close a file and then exit. The result is inconsistent. Sometimes the process exit and sometimes it returns to the original state before the signal handler was invoked. Perhaps exit is not legal in... (8 Replies)
Discussion started by: Tuvia
8 Replies

6. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

7. Solaris

False Memory usage alarm!!

Hi Experts, I am using Solaris-10, Sun-Fire-V445. i got often the below message- "Memory Usage – Critical, Memory usage (RAM) exceeding 90% The memory utilization is exceeding 90%" in a application running on solaris. I checked with Vmstat. Everything seems to be fine. Where i should... (5 Replies)
Discussion started by: thepurple
5 Replies

8. Programming

alarm signal processing

I'm writing a function right now, and I want to set an alarm to avoid a timeout, here's the general idea of my code: int amt = -2; alarm(10); amt = read(fd, &t->buf, TASKBUFSIZ - tailpos); //do a read when the alarm goes off, i want to check the value of "amt" ... (1 Reply)
Discussion started by: liaobert
1 Replies

9. Shell Programming and Scripting

basic computer usage report

Our small company, about 5 users, need a basic script that scans mapped network drives (example: drive b,c,d, e, and f) for hard drive usage. This needs to send a report to myself in any type of basic notepad format (easy to read and decipher) for drives that have reached 80% usage... any ideas? ... (1 Reply)
Discussion started by: jessessays
1 Replies

10. UNIX for Dummies Questions & Answers

Basic sed usage in shell script

Hi, A basic sed question. I have a set of files. In each file there is a number that I want replaced. For example, if I run sed I should get the following: % cat test2.txt #goofy//171.00 goofy 171.00 % sed -i 's/171/xxx/g' test2.txt % cat test2.txt #goofy//xxx.00 goofy xxx.00 ... (2 Replies)
Discussion started by: pc2001
2 Replies
signal(3tcl)															      signal(3tcl)

NAME
signal - dynamically loadable signal handling for Tcl/Tk SYNOPSIS
signal (add|delete|print|version) [options] COMMANDS
add signo proc [-async] Adds a signal handler for signal signo through proc proc. Signals can be provided by number, or the most common ones are provided by name (e.g., SIGHUP). The proc is any Tcl procedure, and it is evaluated when the signal comes in. It will be provided no arguments. Signal handlers have Posix semantics - they persist until reset. If -async is used, the signal handler is created using Tcl_AsyncCreate(). Checks for the signal are very frequent (each evaluation) using this technique, but one doesn't know quite where evaluation is or how to handle errors in this situation. The code will evaluate the pro- vided procedure in the current interpreter if available, and in the interpreter which added the signal handler otherwise. At least until a better scheme is suggested. The -async is especially useful to interrupt "runaway" procs, or to cause a quick exit; the default mechanism simply waits for another MainLoop cycle. signal delete signo Restores handling of signal signo to the default ( SIG_DFL ). signal print Prints the handling of all signals with handlers. Formatted as signal ----> procedure or as signal !---> procedure if the signal is handled asynchronously signal print signo Prints the procedure for handling signal signo. Prints the word UNHANDLED if no signal handler is active for that signal. signal version Returns the string representing the current version of the package AUTHOR
Michael Schwartz <mschwart@nyx.net>. Tilman Kranz <tilde@tk-sls.de> patched this for wider portability on Linux Tcl Signal Extension 1.4.0.1 Tcl signal(3tcl)
All times are GMT -4. The time now is 09:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy