![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| AWK help reqd | Sathy153 | Shell Programming and Scripting | 17 | 06-19-2008 12:30 AM |
| Who sent the process SIGCHLD ? | Puntino | UNIX for Dummies Questions & Answers | 1 | 06-06-2008 01:43 PM |
| About SIGCHLD | Puntino | UNIX for Dummies Questions & Answers | 3 | 05-07-2008 02:10 AM |
| Help Reqd | PradeepRed | HP-UX | 1 | 03-15-2007 05:55 PM |
| Need help with SIGCHLD | Unlimited Sky | High Level Programming | 1 | 02-21-2005 10:31 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
adv reqd on SIGCHLD on accept call
Hi,
I have small problem. In my (concurrent)server programm, I am handling accept problem from client like this. sample of server code. /*******************/ end = 0; while (! end ) { sockfd = accept(...) if(sockfd == -1) { if (errno == EINTR) /* this is bcoz of SIGCHLD recvd from child */ { continue; } else /* display error and come out*/ { end = 1; } } else { /* continue further ...........*/ } } /*******************/ Is there any way to catch where the error is occuring in the client process? (like the line number / or suggest any debugging procedure) Pl adivce me.. -- Jagannath Desai |
| Forum Sponsor | ||
|
|
|
|||
|
use code tags,
Code:
end = 0;
while (! end )
{
sockfd = accept(...)
if(sockfd == -1)
{
if (errno == EINTR) /* this is bcoz of SIGCHLD recvd from child
*/
{
continue;
}
else
/* display error and come out*/
{
end = 1;
}
}
else
{
/* continue further ...........*/
}
}
the else with continue further... is the above just a snippet |
|
|||
|
adv reqd on SIGCHLD on accept call
yes ..
it is a sample part of my server code .. if child gets killed abruptly then in my server (which is parent process)program, i am checking for EINTR. but i wanted to check in detail where in my child process, this is happening. |
|
|||
|
Hi,
finally I got some reasonable trace by using truss command in AIX . syntax is .. truss -d -f -p -o jj_trc 5054664 where, 5054664 is the parent pid, on which i did the trace. jj_trc is the output trace file -f forces to trace on the childs I also attached the trace file. I am triying to find the cause.. Any body simultaneously also can check.. and this is how I handling the signal.. Code:
static void trtCHLD(int X)
{
int status ;
pid_t ret_pid;
fprintf( stderr, "*** SIGNAL SIGCHLD RECEIVED ***\n");
while ((ret_pid = waitpid((pid_t) -1,(int *) &status ,WNOHANG | WUNTRACED)) > 0);
if (ret_pid > 0)
{
if (WIFEXITED(status)) {
fprintf(stderr, "Child exited with RC=%d\n", WEXITSTATUS(status));
}
if (WIFSIGNALED(status)) {
fprintf(stderr, "Child exited via signal %d\n", WTERMSIG(status));
}
}
signal(SIGCHLD,trtCHLD);
return;
}
Code:
signal(SIGCHLD,trtCHLD); but in the traces files I am not finding any messages getting printed as used in the file. Is there any changes reqd for the arguements to waitpid function? Pl any body can have a look at the trace file (generated using truss command) attached in my prev. posting and suggest me on this... waiting for reply................. |
|
|||
|
[quote=stevenjagan]Hi,
I have small problem. In my (concurrent)server programm, I am handling accept problem from client like this. sample of server code. /*******************/ end = 0; while (! end ) { sockfd = accept(...) if(sockfd == -1) { if (errno == EINTR) /* this is bcoz of SIGCHLD recvd from child */ { continue; } else /* display error and come out*/ { end = 1; } iavpbmwtvdo |
|||
| Google UNIX.COM |