Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - HAM Manger do not work as I expected: (10 Items)
   
HAM Manger do not work as I expected  
I am planning to make some basic use of HAM manager starting our process, however, I have come across some strange 
problem.

The code I have write is:
int main(int argc, char *argv[]) 
{
	ham_entity_t* ehdl; 
	ham_condition_t* chdl; 
	ham_action_t* ahdl; 

	ham_connect(0); //Connect to HAM. 

	if(!(ehdl = ham_attach("vgham",0,0,"/usr/sbin/vgapp",0))) 
		perror("ehdl");
	if(!(chdl = ham_condition(ehdl,CONDDEATH,"death",HREARMAFTERRESTART))) 
		perror("chdl");
	if(!(ahdl = ham_action_restart(chdl,"vgapp_restart","/usr/sbin/vgapp",HREARMAFTERRESTART))) 
		perror("ahdl");
	
	ham_disconnect(0); //Connect to HAM.
	
	return EXIT_SUCCESS;
}

the program I want to keep restarting is:

int main(int argc, char *argv[]) {

	procmgr_daemon( EXIT_SUCCESS, 0x000000FF );
	
	sleep(1);
	fprintf(stderr,"Welcome to the QNX Momentics IDE\n");
	sleep(1);

	return EXIT_SUCCESS;
}

what I am expect is process 2 keep restarting 

After I start process, the second process will start
However  when the second process exit, nothing happend

The magic thing is, if I "slay syslogd" or "syslogd",
process 2 will be restart once

it seems each time I call or slay syslogd, it will action once
is this a HAM bug, or what I have missing in my second process?




Re: HAM Manger do not work as I expected  
what version are you using. 

shiv
Wed Sep 16 12:56:22 EDT 2009

 --> According to Ji Dong <--
	I am planning to make some basic use of HAM manager starting our
	process, however, I have come across some strange problem.
	
	The code I have write is:
	int main(int argc, char *argv[]) 
	{
		ham_entity_t* ehdl; 
		ham_condition_t* chdl; 
		ham_action_t* ahdl; 
	
		ham_connect(0); //Connect to HAM. 
	
		if(!(ehdl = ham_attach("vgham",0,0,"/usr/sbin/vgapp",0))) 
			perror("ehdl");
		if(!(chdl =
	ham_condition(ehdl,CONDDEATH,"death",HREARMAFTERRESTART))) 
			perror("chdl");
		if(!(ahdl =
	ham_action_restart(chdl,"vgapp_restart","/usr/sbin/vgapp",HREARMAFTERRES
	TART))) 
			perror("ahdl");
		
		ham_disconnect(0); //Connect to HAM.
		
		return EXIT_SUCCESS;
	}
	
	the program I want to keep restarting is:
	
	int main(int argc, char *argv[]) {
	
		procmgr_daemon( EXIT_SUCCESS, 0x000000FF );
		
		sleep(1);
		fprintf(stderr,"Welcome to the QNX Momentics IDE\n");
		sleep(1);
	
		return EXIT_SUCCESS;
	}
	
	what I am expect is process 2 keep restarting 
	
	After I start process, the second process will start
	However  when the second process exit, nothing happend
	
	The magic thing is, if I "slay syslogd" or "syslogd",
	process 2 will be restart once
	
	it seems each time I call or slay syslogd, it will action once
	is this a HAM bug, or what I have missing in my second process?
	
	
	
	
	
	
	
	
	_______________________________________________
	
	OSTech
	http://community.qnx.com/sf/go/post38066
	

-- 
****
Shiv Nagarajan,
Kernel Developer, QNX Software Systems,
Ottawa, Canada
****
AW: HAM Manger do not work as I expected  
is HAM capable of detecting the change of process' state from a regular child to a detached daemon?

when you start the process first, it's a child and you detect starvation through a normal SIGCHLD,
but when the process is doing the procmgr_daemon()
you have to use a pulse through PROCMGR_EVENT_DAEMON_DEATH
as I can't find any special constants for a daemon in ham_condition()
I am asking how ham would detect whether it's a daemon or a child?

BTW: what happens when you just skip that procmgr_daemon() call?

/hp


-----Ursprüngliche Nachricht-----
Von:	Shiv Nagarajan [mailto:community-noreply@qnx.com]
Gesendet:	Mi 16.09.2009 18:52
An:	ostech-core_os
Cc:	
Betreff:	Re: HAM Manger do not work as I expected

what version are you using. 

shiv
Wed Sep 16 12:56:22 EDT 2009

 --> According to Ji Dong <--
	I am planning to make some basic use of HAM manager starting our
	process, however, I have come across some strange problem.
	
	The code I have write is:
	int main(int argc, char *argv[]) 
	{
		ham_entity_t* ehdl; 
		ham_condition_t* chdl; 
		ham_action_t* ahdl; 
	
		ham_connect(0); //Connect to HAM. 
	
		if(!(ehdl = ham_attach("vgham",0,0,"/usr/sbin/vgapp",0))) 
			perror("ehdl");
		if(!(chdl =
	ham_condition(ehdl,CONDDEATH,"death",HREARMAFTERRESTART))) 
			perror("chdl");
		if(!(ahdl =
	ham_action_restart(chdl,"vgapp_restart","/usr/sbin/vgapp",HREARMAFTERRES
	TART))) 
			perror("ahdl");
		
		ham_disconnect(0); //Connect to HAM.
		
		return EXIT_SUCCESS;
	}
	
	the program I want to keep restarting is:
	
	int main(int argc, char *argv[]) {
	
		procmgr_daemon( EXIT_SUCCESS, 0x000000FF );
		
		sleep(1);
		fprintf(stderr,"Welcome to the QNX Momentics IDE\n");
		sleep(1);
	
		return EXIT_SUCCESS;
	}
	
	what I am expect is process 2 keep restarting 
	
	After I start process, the second process will start
	However  when the second process exit, nothing happend
	
	The magic thing is, if I "slay syslogd" or "syslogd",
	process 2 will be restart once
	
	it seems each time I call or slay syslogd, it will action once
	is this a HAM bug, or what I have missing in my second process?
	
	
	
	
	
	
	
	
	_______________________________________________
	
	OSTech
	http://community.qnx.com/sf/go/post38066
	

-- 
****
Shiv Nagarajan,
Kernel Developer, QNX Software Systems,
Ottawa, Canada
****



_______________________________________________

OSTech
http://community.qnx.com/sf/go/post38084 
 
*******************************************
Harman Becker Automotive Systems GmbH
Management Board: Dr. Klaus Blickle (Chairman), Dr. Udo Hüls, Michael Mauser
Chairman of the Supervisory Board: Ansgar Rempp | Domicile: Karlsbad | 
Local Court Mannheim: Register No. 361395

 
*******************************************
Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen. Wenn Sie nicht der richtige Adressat 
sind oder diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und loeschen Sie diese Mail
. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have 
received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, 
disclosure or distribution of the contents in this e-mail is strictly forbidden.
*******************************************
Attachment: Text winmail.dat 4.42 KB
Re: HAM Manger do not work as I expected  
the ham registers for the procmgr_event when any daemon process dies.
And then it looks through its list of monitored processes. So it should
be able to detect the death any process that calls procmgr_daemon also.

ham registers for 

procmgr_event_notify(PROCMGR_EVENT_DAEMON_DEATH...) 

the reason I wanted to know the version, was because a PR 65295 was
fixed which was an issue similar to this.

shiv
Wed Sep 16 15:10:13 EDT 2009

 --> According to Hans-Peter Reichert <--
	is HAM capable of detecting the change of process' state from a regular child to a detached daemon?
	
	when you start the process first, it's a child and you detect starvation through a normal SIGCHLD,
	but when the process is doing the procmgr_daemon()
	you have to use a pulse through PROCMGR_EVENT_DAEMON_DEATH
	as I can't find any special constants for a daemon in ham_condition()
	I am asking how ham would detect whether it's a daemon or a child?
	
	BTW: what happens when you just skip that procmgr_daemon() call?
	
	/hp
	
	
	-----Ursprüngliche Nachricht-----
	Von:	Shiv Nagarajan [mailto:community-noreply@qnx.com]
	Gesendet:	Mi 16.09.2009 18:52
	An:	ostech-core_os
	Cc:	
	Betreff:	Re: HAM Manger do not work as I expected
	
	what version are you using. 
	
	shiv
	Wed Sep 16 12:56:22 EDT 2009
	
	 --> According to Ji Dong <--
		I am planning to make some basic use of HAM manager starting our
		process, however, I have come across some strange problem.
		
		The code I have write is:
		int main(int argc, char *argv[]) 
		{
			ham_entity_t* ehdl; 
			ham_condition_t* chdl; 
			ham_action_t* ahdl; 
		
			ham_connect(0); //Connect to HAM. 
		
			if(!(ehdl = ham_attach("vgham",0,0,"/usr/sbin/vgapp",0))) 
				perror("ehdl");
			if(!(chdl =
		ham_condition(ehdl,CONDDEATH,"death",HREARMAFTERRESTART))) 
				perror("chdl");
			if(!(ahdl =
		ham_action_restart(chdl,"vgapp_restart","/usr/sbin/vgapp",HREARMAFTERRES
		TART))) 
				perror("ahdl");
			
			ham_disconnect(0); //Connect to HAM.
			
			return EXIT_SUCCESS;
		}
		
		the program I want to keep restarting is:
		
		int main(int argc, char *argv[]) {
		
			procmgr_daemon( EXIT_SUCCESS, 0x000000FF );
			
			sleep(1);
			fprintf(stderr,"Welcome to the QNX Momentics IDE\n");
			sleep(1);
		
			return EXIT_SUCCESS;
		}
		
		what I am expect is process 2 keep restarting 
		
		After I start process, the second process will start
		However  when the second process exit, nothing happend
		
		The magic thing is, if I "slay syslogd" or "syslogd",
		process 2 will be restart once
		
		it seems each time I call or slay syslogd, it will action once
		is this a HAM bug, or what I have missing in my second process?
		
		
		
		
		
		
		
		
		_______________________________________________
		
		OSTech
		http://community.qnx.com/sf/go/post38066
		
	
	-- 
	****
	Shiv Nagarajan,
	Kernel Developer, QNX Software Systems,
	Ottawa, Canada
	****
	
	
	
	_______________________________________________
	
	OSTech
	http://community.qnx.com/sf/go/post38084 
	 
	*******************************************
	Harman Becker Automotive Systems GmbH
	Management Board: Dr. Klaus Blickle (Chairman), Dr. Udo Hüls, Michael Mauser
	Chairman of the Supervisory Board: Ansgar Rempp | Domicile: Karlsbad | 
	Local Court Mannheim: Register No. 361395
	
	 
	*******************************************
	Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen. Wenn Sie nicht der richtige Adressat 
sind oder diese E-Mail irrtuemlich erhalten haben, informieren Sie bitte sofort den Absender und loeschen Sie diese Mail
. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
	This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have 
received this e-mail in error) please notify the sender immediately and delete this e-mail. Any...
View Full Message
Re: HAM Manger do not work as I expected  
Not very sure what version it is, and how to get the ham version.
It comes with QNX 6.4.0 DVD package.
and HAM is running on QNX BSP for freescale mpc8313 v6.4.0

I have attached the "ham" binary for your information.




> the ham registers for the procmgr_event when any daemon process dies.
> And then it looks through its list of monitored processes. So it should
> be able to detect the death any process that calls procmgr_daemon also.
> 
> ham registers for 
> 
> procmgr_event_notify(PROCMGR_EVENT_DAEMON_DEATH...) 
> 
> the reason I wanted to know the version, was because a PR 65295 was
> fixed which was an issue similar to this.
> 
> shiv
> Wed Sep 16 15:10:13 EDT 2009
> 
>
Attachment: Text ham 107.81 KB
Re: HAM Manger do not work as I expected  
This appears to have been built 

DESCRIPTION=High Availability Manager
DATE=2008/10/21-00:21:48-EDT
STATE=Stable
HOST=trunkbuild
USER=builder
VERSION=6.4.0

since that other PR I was mentioning was fixed feb 2009, in all
likelihood, the bug exists in your version. Let me try and get you a ppc
binary from the latest source for you to try. 

thanks
shiv

On Thu, 2009-09-17 at 04:03 -0400, Ji Dong wrote:
> Not very sure what version it is, and how to get the ham version.
> It comes with QNX 6.4.0 DVD package.
> and HAM is running on QNX BSP for freescale mpc8313 v6.4.0
> 
> I have attached the "ham" binary for your information.
> 
> 
> 
> 
> > the ham registers for the procmgr_event when any daemon process
> dies.
> > And then it looks through its list of monitored processes. So it
> should
> > be able to detect the death any process that calls procmgr_daemon
> also.
> >
> > ham registers for
> >
> > procmgr_event_notify(PROCMGR_EVENT_DAEMON_DEATH...)
> >
> > the reason I wanted to know the version, was because a PR 65295 was
> > fixed which was an issue similar to this.
> >
> > shiv
> > Wed Sep 16 15:10:13 EDT 2009
> >
> >
> 
> 
> 
> _______________________________________________
> 
> OSTech
> http://community.qnx.com/sf/go/post38131
> 
> 
-- 
****
Shiv Nagarajan,
Kernel Developer, QNX Software Systems,
Ottawa, Canada
E-mail: shiv@qnx.com
****
Re: HAM Manger do not work as I expected  
> This appears to have been built 
> 
> DESCRIPTION=High Availability Manager
> DATE=2008/10/21-00:21:48-EDT
> STATE=Stable
> HOST=trunkbuild
> USER=builder
> VERSION=6.4.0
> 
> since that other PR I was mentioning was fixed feb 2009, in all
> likelihood, the bug exists in your version. Let me try and get you a ppc
> binary from the latest source for you to try. 
> 
> thanks
> shiv
> 
> On Thu, 2009-09-17 at 04:03 -0400, Ji Dong wrote:
> > Not very sure what version it is, and how to get the ham version.
> > It comes with QNX 6.4.0 DVD package.
> > and HAM is running on QNX BSP for freescale mpc8313 v6.4.0
> > 
> > I have attached the "ham" binary for your information.
> > 
> > 
> > 
> > 
> > > the ham registers for the procmgr_event when any daemon process
> > dies.
> > > And then it looks through its list of monitored processes. So it
> > should
> > > be able to detect the death any process that calls procmgr_daemon
> > also.
> > >
> > > ham registers for
> > >
> > > procmgr_event_notify(PROCMGR_EVENT_DAEMON_DEATH...)
> > >
> > > the reason I wanted to know the version, was because a PR 65295 was
> > > fixed which was an issue similar to this.
> > >
> > > shiv
> > > Wed Sep 16 15:10:13 EDT 2009
> > >
> > >
> > 
> > 
> > 
> > _______________________________________________
> > 
> > OSTech
> > http://community.qnx.com/sf/go/post38131
> > 
> > 
> -- 
> ****
> Shiv Nagarajan,
> Kernel Developer, QNX Software Systems,
> Ottawa, Canada
> E-mail: shiv@qnx.com
> ****


Thanks shiv

I am expecting your new Binary:)
Re: HAM Manger do not work as I expected  
Attached is the ham from 6.4.1 for ppc.
do let me know if this works better.

thanks
shiv
Fri Sep 18 10:52:50 EDT 2009

 --> According to Ji Dong <--
	> This appears to have been built 
	> 
	> DESCRIPTION=High Availability Manager
	> DATE=2008/10/21-00:21:48-EDT
	> STATE=Stable
	> HOST=trunkbuild
	> USER=builder
	> VERSION=6.4.0
	> 
	> since that other PR I was mentioning was fixed feb 2009, in all
	> likelihood, the bug exists in your version. Let me try and get you a
	ppc
	> binary from the latest source for you to try. 
	> 
	> thanks
	> shiv
	> 
	> On Thu, 2009-09-17 at 04:03 -0400, Ji Dong wrote:
	> > Not very sure what version it is, and how to get the ham version.
	> > It comes with QNX 6.4.0 DVD package.
	> > and HAM is running on QNX BSP for freescale mpc8313 v6.4.0
	> > 
	> > I have attached the "ham" binary for your information.
	> > 
	> > 
	> > 
	> > 
	> > > the ham registers for the procmgr_event when any daemon process
	> > dies.
	> > > And then it looks through its list of monitored processes. So it
	> > should
	> > > be able to detect the death any process that calls procmgr_daemon
	> > also.
	> > >
	> > > ham registers for
	> > >
	> > > procmgr_event_notify(PROCMGR_EVENT_DAEMON_DEATH...)
	> > >
	> > > the reason I wanted to know the version, was because a PR 65295
	was
	> > > fixed which was an issue similar to this.
	> > >
	> > > shiv
	> > > Wed Sep 16 15:10:13 EDT 2009
	> > >
	> > >
	> > 
	> > 
	> > 
	> > _______________________________________________
	> > 
	> > OSTech
	> > http://community.qnx.com/sf/go/post38131
	> > 
	> > 
	> -- 
	> ****
	> Shiv Nagarajan,
	> Kernel Developer, QNX Software Systems,
	> Ottawa, Canada
	> E-mail: shiv@qnx.com
	> ****
	
	
	Thanks shiv
	
	I am expecting your new Binary:)
	
	
	
	_______________________________________________
	
	OSTech
	http://community.qnx.com/sf/go/post38248
	

-- 
****
Shiv Nagarajan,
Kernel Developer, QNX Software Systems,
Ottawa, Canada
****
Attachment: Text ham 100.01 KB
Re: HAM Manger do not work as I expected  
Hi shiv:

Thanks for your help, the binary works perfect.....

> Attached is the ham from 6.4.1 for ppc.
> do let me know if this works better.
> 
> thanks
> shiv
Re: AW: HAM Manger do not work as I expected  
Hi Hans-Peter Reichert:

Initially I have not call procmgr_daemon(), it is the same. and I have search around and not quite understand something 
like, it  have to run on "session 1" so have to use procmgr_daemon() instead of daemon(), so I just give a try, and this
 do not really help.

Because currently all our software is single thread, and have not actually spawn any child process, not sure what harm 
will cause if I use procmgr_daemon() to run the process in the backgrand.

Cheers 

Ji



> is HAM capable of detecting the change of process' state from a regular child 
> to a detached daemon?
> 
> when you start the process first, it's a child and you detect starvation 
> through a normal SIGCHLD,
> but when the process is doing the procmgr_daemon()
> you have to use a pulse through PROCMGR_EVENT_DAEMON_DEATH
> as I can't find any special constants for a daemon in ham_condition()
> I am asking how ham would detect whether it's a daemon or a child?
> 
> BTW: what happens when you just skip that procmgr_daemon() call?
> 
> /hp