Re: versionRestartAgent only restarts once

This is a discussion on Re: versionRestartAgent only restarts once within the SNMP Coders forums, part of the Networking and Network Related category; Another problem: my kernel doesn't seem to be delivering the SIGALRM the second time around. Works like a champ ...


Go Back   Usenet Forums > Networking and Network Related > SNMP Coders

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-16-2005
Dana Burns
 
Posts: n/a
Default Re: versionRestartAgent only restarts once


Another problem: my kernel doesn't seem to be delivering the SIGALRM the
second time around.
Works like a champ on Solaris though. I don't know if it has anything to
do with the execv or not.

agent/mibgroup/util_funcs.c:
signal(SIGALRM, restart_doit);
unsigned int atime = alarm(RESTARTSLEEP);
snmp_log(LOG_NOTICE, "alarm returned %u\n", atime);

restart_doit never gets called, that i can tell.
The setitimer in snmp_alarm is never called.
kill -s SIGALRM ${PID} doesn't get it done either.
sigpending always shows 0.

2.4.21-20.ELsmp #1 SMP

The following seems to run forever though, so its' not quite the same
somehow.

#include <stdio.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>

static unsigned int atime = 0;
static char *myargs[2] = { "/tmp/sig", NULL };

void callback(int a) {
printf("callback\n");
}

int main(void) {

unsigned int loop = 0;

printf("setting alarm 1, for 3 secs\n");
signal(SIGALRM, callback);
atime = alarm(3);
printf("atime=%u\n", atime);
printf("waitread 5...\n");
waitread();

printf("setting alarm 2, for 3 secs\n");
signal(SIGALRM, callback);
atime = alarm(3);
printf("atime=%u\n", atime);
printf("waitread\n");
waitread();

execv("/tmp/sig", myargs);

printf("setting alarm 3, for 3 secs\n");
signal(SIGALRM, callback);
atime = alarm(3);
printf("atime=%u\n", atime);
printf("waitread\n");
waitread();

printf("DONE\n");
return 0;

}


int waitread() {

fd_set rfds;
struct timeval tv;
int retval;

/* Watch stdin (fd 0) to see when it has input. */
FD_ZERO(&rfds);
FD_SET(0, &rfds);
/* Wait up to five seconds. */
tv.tv_sec = 5;
tv.tv_usec = 0;

retval = select(1, &rfds, NULL, NULL, &tv);

if (retval == -1)
perror("select()");
else if (retval)
printf("Data is available now.\n");
/* FD_ISSET(0, &rfds) will be true. */
else
printf("No data within five seconds.\n");

return 0;
}





-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/...et-snmp-coders
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:36 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0