Sponsored Content
Top Forums Programming Daemon...Zombie?? Please help me Post 71294 by Perderabo on Monday 9th of May 2005 09:18:53 PM
Old 05-09-2005
Please make sure that you have read our rules. And note:
(6) Do not post classroom or homework problems.

But we sometimes bend this rule when a student has done a lot of work. So I'll make a few comments based on a quick scan of your code. This line of code:
while(1) sleep(1);//run
is dangerous. Why do you have it? I would delete it. If you meant to do something like:
while (1) { List() ; sleep(1) ; }
then you have the fork() in the wrong place. You need to fork() once at the beginning of the program. At present, your program is running List() once and then falling into your infinite sleep loop. You have some re-writing to do.

wait(30);
is illegal and also dangerous. I don't even know what you want to happen there. The last thing you do in List is to ignore some signals. You should ignore signals earlier. If you put List() in a loop, you need to move the signal calls to near the beginning somewhere.

Your instructor probably told you to check if the parent pid is 1, but your instructor is wrong. That is not the definition of a daemon. As it happens, you can probably get away with test you have. But the definition of a daemon is a program with no controlling terminal. You could check that by attempting to open /dev/tty. A daemon must fail but a non-damon must succeed.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

zombie program

When you run a ps -ef and if the status is a Z (zombie) does that mean the same as not responding? (Like a windows machine). Also has anyone here heard of the program called 'top' (I've found it on our Solaris 7 machines) If you have you might be able to help me. I need to know if there is a... (8 Replies)
Discussion started by: merlin
8 Replies

2. UNIX for Advanced & Expert Users

Zombie process

I would like to create a zombie process so that I can test monitoring software functionality. Any techniques? (2 Replies)
Discussion started by: swhitney
2 Replies

3. UNIX for Advanced & Expert Users

zombie daemon process!!

My daemon process is the child of init and init has the responsibility to remove it, once it turns zombie. But I want to ask why the daemon process which is child of init turns zombie in the first place. What measures I have to take to avoid this? rish (1 Reply)
Discussion started by: rish2005
1 Replies

4. Shell Programming and Scripting

Zombie process

Hi I need help because I don't know if it is possible to add a find inside a cat. like I have a file with the pid of the process that use to became zombie. And I have the same pid stored in the var (pid1) now, I have no clue how to check if the the find finds the pid or even if it's... (2 Replies)
Discussion started by: ruben.rodrigues
2 Replies

5. Solaris

zombie process

dear friends, in an interview they asked me what is zombie process. how we can identifying these process.if can you kill all zombie process. (8 Replies)
Discussion started by: sijocg
8 Replies

6. AIX

zombie process

Is there an equivilant to the preap command in AIX that would allow me to get rid of a zombie process. I am new to AIX, moving over from Solaris and in the past I have been able to preap the pid on the defunct process to clean them up. I have looked around and the best I can see is that it may... (3 Replies)
Discussion started by: sboots
3 Replies

7. UNIX for Dummies Questions & Answers

what is zombie , how to kill it ,

Hello I try to googled it , but I dint get sufficient answer :( .. When I can see zombie running on server do they consume system resources or not ? I have read that is not good to kill them with signal 9 cause it might cause more troubles .. why is kill -9 so harmfull? thanks (2 Replies)
Discussion started by: kvok
2 Replies

8. UNIX for Advanced & Expert Users

Zombie process

What is the overhead associated with zombie process?Is it running out of process-ID?:confused: Since some information is stored in process table.. Thanks in Advance (4 Replies)
Discussion started by: jois
4 Replies

9. Red Hat

zombie

Hi, Linux redhat 5.5 top shows that i have 20 zombie process : Tasks: 357 total, 1 running, 336 sleeping, 0 stopped, 20 zombie Cpu(s): 0.2%us, 0.3%sy, 0.0%ni, 99.5%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 24949400k total, 2363052k used, 22586348k free, 227084k buffers... (1 Reply)
Discussion started by: yoavbe
1 Replies

10. Programming

Zombie in C

hello all, when we are creating a process by using fork, if the child process terminates before parent, the child process exists as zombie.. My doubt is when that child process terminates, how come that process exists further and show as a zombie process..can anyone help me to clear about this? (1 Reply)
Discussion started by: aarathy
1 Replies
Mail::SRS::Daemon(3pm)					User Contributed Perl Documentation				    Mail::SRS::Daemon(3pm)

NAME
Mail::SRS::Daemon - modular daemon for Mail::SRS SYNOPSIS
my $daemon = new Mail::SRS::Daemon( SecretFile => $secretfile, Separator => $separator, ); $daemon->run(); DESCRIPTION
The SRS daemon listens on a socket for SRS address transformation requests. It transforms the addresses and returns the new addresses on the socket. It may be invoked from exim using ${readsocket ...}, and probably from other MTAs as well. See http://www.anarres.org/projects/srs/ for examples. METHODS
$daemon = new Mail::SRS::Daemon(...) Construct a new Mail::SRS object and return it. All parameters which are valid for Mail::SRS are also valid for Mail::SRS::Daemon and will be passed to the constructor of Mail::SRS verbatim. The exception to this rule is the Secret parameter, which will be promoted to a list and will have all secrets from SecretFile included. New parameters are documented here. See Mail::SRS for the rest. SecretFile => $string A file to read for secrets. Secrets are specified once per line. The first specified secret is used for encoding. Secrets are written one per line. Blank lines and lines starting with a # are ignored. If Secret is not given, then the secret file must be nonempty. Secret will specify a primary secret and override SecretFile if both are specified. However, secrets read from SecretFile still be used for decoding if both are specified. Socket => $socket An instance of IO::Socket, presumed to be a listening socket. This may be provided in order to use a preexisting socket, rather than have Mail::SRS::Daemon construct a new socket. $daemon->run() Run the daemon. This method will never return. Errors and exceptions are caught, and error messages are returned down the socket. EXPORTS
Given :all, this module exports the following variables. $SRSSOCKET The filename of the default socket created by Mail::SRS::Daemon. PROTOCOL
The daemon waits for a single line of text from the client, and will respond with a single line. The lines are all of the form "COMMAND args...". Currently, two commands are supported: forward and reverse. A forward request looks like: FORWARD sender@source.com alias@forwarder.com A reverse request looks like: REVERSE srs0+HHH=TT=domain=local-part@forwarder.com In either case, the daemon will respond with either a translated address, or a line starting "ERROR ", followed by a message. TODO
Add more daemon-related options, such as path to socket, or inet socket address. SEE ALSO
Mail::SRS, srsd, http://www.anarres.org/projects/srs/ AUTHOR
Shevek CPAN ID: SHEVEK cpan@anarres.org http://www.anarres.org/projects/ COPYRIGHT
Copyright (c) 2004 Shevek. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2004-06-23 Mail::SRS::Daemon(3pm)
All times are GMT -4. The time now is 09:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy