Is there a system call that will be called for sure when a program exit?

Is there a system call that will be called for sure when a program exit?

Post by Yong L » Wed, 07 Apr 1999 04:00:00



Is _exithandle the one?

How about if the program exits unnormally?

thanks

 
 
 

Is there a system call that will be called for sure when a program exit?

Post by SR » Wed, 07 Apr 1999 04:00:00


It looks like what you want to do is handle signals. Look up sigaction() in
the man pages.


>Is _exithandle the one?

>How about if the program exits unnormally?

>thanks



 
 
 

Is there a system call that will be called for sure when a program exit?

Post by G. Sumner Haye » Thu, 08 Apr 1999 04:00:00



> Is _exithandle the one?

> How about if the program exits unnormally?

Try atexit()

Also, if you're interested in abnormal termination (segfaults, kill)
then sigaction() is handy to know about.

--Sumner

 
 
 

Is there a system call that will be called for sure when a program exit?

Post by Barry Margoli » Thu, 08 Apr 1999 04:00:00




Quote:>Is _exithandle the one?

_exit(2) will be called whenever a process calls exit(3).

Quote:>How about if the program exits unnormally?

If a process dies due to an unhandled signal, no system call is invoked.

--

GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

1. How to get calling program name in called program

Hi,

When one program executes another, the child can get the parent pid and,
using ps, grep and awk get the name of the calling process (or is there a
simpler way in C?).

Is there a way for the child to get the name of a script if it was called
from one?  Since the script is not a process, the abovementioned method
won't work, eg:

Assume program foo and script foo.script.  I want to be able to get
"foo.scipt" in foo if foo was called from foo.script.  Is this as
impossible as it seems?

Thank you
Marcel Groenewald

ISCOR Newcastle
South Africa



2. SuSe 6.1 - glibc version?

3. exit()-System or C Library call, return vs exit

4. Disabling Martian Packet Dropping

5. How I could add a new system call to linux or modify a system calls

6. kde and ppp problems

7. How to use open system call in a new system call

8. SILO breaks !

9. "Interrupted system call" at "low level" - system calls

10. getting exit status of called program via system

11. Making sure script executes (called from c program)

12. i am getting the error: gmon.out file is missing call-graph data..

13. "where am I" - for a called script