Death Message

Is there an equivalent for QNX4’s death messages under NTO?
I would like a process to be inform of processes death.

  • Mario

Mario,
can you explain real quick how to use death messages in QNX4?
I just went to the docs and didn’t get any more info than on how to set
_PPF_INFORM.
I would be also interested on the NTO equivalent.
Markus


“Mario Charest” <mcharest@antispam_zinformatic.com> wrote in message
news:97vmgm$j4n$1@inn.qnx.com

Is there an equivalent for QNX4’s death messages under NTO?
I would like a process to be inform of processes death.

  • Mario

“Markus Loffler” <loffler@ces.clemson.edu> wrote in message
news:97vt8r$nec$1@inn.qnx.com

Mario,
can you explain real quick how to use death messages in QNX4?

With pleasure. Once you set the _PPF_INFORM flag your program
must be ready to handle a message from Proc32. The message
will match struct _proc_death as described in /usr/include/sys/proc_msg.h

If you download iomanager.tgz from ftp section you will find a file
call io_sys.c (from memory) that handles system messages. I’m not
sure if the death message one of those messages though. If not here
is a little snippet that might get you started (QNX4)

void dump_process(pid_t pid, int signum )
{
struct _dumper_hdr hdr;
// — info comes from QNX this isn’t documented anywhere
hdr.signature = 0x706d7564;
hdr.version = 100;
hdr.zero = 0;
hdr.numsegs = 0;
hdr.numthreads = 1;
qnx_psinfo( PROC_PID, pid, &hdr.psdata, 0, NULL);
__qnx_debug_xfer(PROC_PID, pid, _DEBUG_REG_RD, &hdr.reg,
sizeof(hdr.reg), 0, 0);
// now print to stdout any values i want, including any registers
log_string( log_context, NULL,0,LOG_SOFTWARE_FAULT, “Pid %d (%s), signal %d,
cs:ip=0x%lx:0x%lx”,
pid, hdr.psdata.un.proc.name, signum, hdr.reg.cs, hdr.reg.ip );
printf( “Pid %d (%s), signal %d, cs:ip=0x%lx:0x%lx\n”,
pid, hdr.psdata.un.proc.name, signum, hdr.reg.cs, hdr.reg.ip );

}

foo() {

struct _sysmsg_death *p;

if ( sigbits & ( 1 << p->signum -1 ) )
{
dump_process( pid, p->signum );
Reply( pid, NULL, 0 );
}

It’ very important to Reply ASAP since Proc32 is waiting on you…

I just went to the docs and didn’t get any more info than on how to set
_PPF_INFORM.
I would be also interested on the NTO equivalent.

Well I just found out in the DOC that an equivalent to _PPF_INFORM isn’t
support.
The doc suggests scanning /proc but also says that it’s highly ineficient.

Implementing a watchdog it going to be a lot more difficult ;-( But then
how is dumper implemented in QNX6 ??


Markus


“Mario Charest” <mcharest@antispam_zinformatic.com> wrote in message
news:97vmgm$j4n$> 1@inn.qnx.com> …


Is there an equivalent for QNX4’s death messages under NTO?
I would like a process to be inform of processes death.

  • Mario

    \

Dumper registers as an resmgr with path /proc/dumper, with type
_FTYPE_DUMPER. Proc will open /proc/dumper, and write the pid of the
process that died - it will wait until dumper replys that the write was
ok before reaping the child.

You could write a wrapper that does whatever it wants with the dump
message, then spawns dumper -d dumper_dir -p pid to properly dump it.

Mario Charest <mcharest@antispam_zinformatic.com> wrote:

“Markus Loffler” <> loffler@ces.clemson.edu> > wrote in message
news:97vt8r$nec$> 1@inn.qnx.com> …
Mario,
can you explain real quick how to use death messages in QNX4?

With pleasure. Once you set the _PPF_INFORM flag your program
must be ready to handle a message from Proc32. The message
will match struct _proc_death as described in /usr/include/sys/proc_msg.h

If you download iomanager.tgz from ftp section you will find a file
call io_sys.c (from memory) that handles system messages. I’m not
sure if the death message one of those messages though. If not here
is a little snippet that might get you started (QNX4)

void dump_process(pid_t pid, int signum )
{
struct _dumper_hdr hdr;
// — info comes from QNX this isn’t documented anywhere
hdr.signature = 0x706d7564;
hdr.version = 100;
hdr.zero = 0;
hdr.numsegs = 0;
hdr.numthreads = 1;
qnx_psinfo( PROC_PID, pid, &hdr.psdata, 0, NULL);
__qnx_debug_xfer(PROC_PID, pid, _DEBUG_REG_RD, &hdr.reg,
sizeof(hdr.reg), 0, 0);
// now print to stdout any values i want, including any registers
log_string( log_context, NULL,0,LOG_SOFTWARE_FAULT, “Pid %d (%s), signal %d,
cs:ip=0x%lx:0x%lx”,
pid, hdr.psdata.un.proc.name, signum, hdr.reg.cs, hdr.reg.ip );
printf( “Pid %d (%s), signal %d, cs:ip=0x%lx:0x%lx\n”,
pid, hdr.psdata.un.proc.name, signum, hdr.reg.cs, hdr.reg.ip );

}

foo() {

struct _sysmsg_death *p;

if ( sigbits & ( 1 << p->signum -1 ) )
{
dump_process( pid, p->signum );
Reply( pid, NULL, 0 );
}

It’ very important to Reply ASAP since Proc32 is waiting on you…

I just went to the docs and didn’t get any more info than on how to set
_PPF_INFORM.
I would be also interested on the NTO equivalent.

Well I just found out in the DOC that an equivalent to _PPF_INFORM isn’t
support.
The doc suggests scanning /proc but also says that it’s highly ineficient.

Implementing a watchdog it going to be a lot more difficult ;-( But then
how is dumper implemented in QNX6 ??



Markus


“Mario Charest” <mcharest@antispam_zinformatic.com> wrote in message
news:97vmgm$j4n$> 1@inn.qnx.com> …


Is there an equivalent for QNX4’s death messages under NTO?
I would like a process to be inform of processes death.

  • Mario


    \


cburgess@qnx.com

“Colin Burgess” <cburgess@qnx.com> wrote in message
news:980q08$hi$1@nntp.qnx.com

Dumper registers as an resmgr with path /proc/dumper, with type
_FTYPE_DUMPER. Proc will open /proc/dumper, and write the pid of the
process that died - it will wait until dumper replys that the write was
ok before reaping the child.

Interesting.

How does the equivalent of __qnx_debug_xfer under QNX4 can
be acheived.

You could write a wrapper that does whatever it wants with the dump
message, then spawns dumper -d dumper_dir -p pid to properly dump it.

Mario Charest <mcharest@antispam_zinformatic.com> wrote:

“Markus Loffler” <> loffler@ces.clemson.edu> > wrote in message
news:97vt8r$nec$> 1@inn.qnx.com> …
Mario,
can you explain real quick how to use death messages in QNX4?

With pleasure. Once you set the _PPF_INFORM flag your program
must be ready to handle a message from Proc32. The message
will match struct _proc_death as described in
/usr/include/sys/proc_msg.h

If you download iomanager.tgz from ftp section you will find a file
call io_sys.c (from memory) that handles system messages. I’m not
sure if the death message one of those messages though. If not here
is a little snippet that might get you started (QNX4)

void dump_process(pid_t pid, int signum )
{
struct _dumper_hdr hdr;
// — info comes from QNX this isn’t documented anywhere
hdr.signature = 0x706d7564;
hdr.version = 100;
hdr.zero = 0;
hdr.numsegs = 0;
hdr.numthreads = 1;
qnx_psinfo( PROC_PID, pid, &hdr.psdata, 0, NULL);
__qnx_debug_xfer(PROC_PID, pid, _DEBUG_REG_RD, &hdr.reg,
sizeof(hdr.reg), 0, 0);
// now print to stdout any values i want, including any registers
log_string( log_context, NULL,0,LOG_SOFTWARE_FAULT, “Pid %d (%s), signal
%d,
cs:ip=0x%lx:0x%lx”,
pid, hdr.psdata.un.proc.name, signum, hdr.reg.cs, hdr.reg.ip );
printf( “Pid %d (%s), signal %d, cs:ip=0x%lx:0x%lx\n”,
pid, hdr.psdata.un.proc.name, signum, hdr.reg.cs, hdr.reg.ip );

}

foo() {

struct _sysmsg_death *p;

if ( sigbits & ( 1 << p->signum -1 ) )
{
dump_process( pid, p->signum );
Reply( pid, NULL, 0 );
}

It’ very important to Reply ASAP since Proc32 is waiting on you…

I just went to the docs and didn’t get any more info than on how to set
_PPF_INFORM.
I would be also interested on the NTO equivalent.

Well I just found out in the DOC that an equivalent to _PPF_INFORM isn’t
support.
The doc suggests scanning /proc but also says that it’s highly
ineficient.

Implementing a watchdog it going to be a lot more difficult ;-( But
then
how is dumper implemented in QNX6 ??


Markus


“Mario Charest” <mcharest@antispam_zinformatic.com> wrote in message
news:97vmgm$j4n$> 1@inn.qnx.com> …


Is there an equivalent for QNX4’s death messages under NTO?
I would like a process to be inform of processes death.

You have /proc filesystem. Open /proc/as/ and read process address
space :wink:
There are devctls to read registers and other info. See sys/debug.h,
sys/procfs.h, sys/dcmd_proc.h.

  • igor

Mario Charest wrote:

“Colin Burgess” <> cburgess@qnx.com> > wrote in message
news:980q08$hi$> 1@nntp.qnx.com> …
Dumper registers as an resmgr with path /proc/dumper, with type
_FTYPE_DUMPER. Proc will open /proc/dumper, and write the pid of the
process that died - it will wait until dumper replys that the write was
ok before reaping the child.

Interesting.

How does the equivalent of __qnx_debug_xfer under QNX4 can
be acheived.


You could write a wrapper that does whatever it wants with the dump
message, then spawns dumper -d dumper_dir -p pid to properly dump it.

Mario Charest <mcharest@antispam_zinformatic.com> wrote:

“Markus Loffler” <> loffler@ces.clemson.edu> > wrote in message
news:97vt8r$nec$> 1@inn.qnx.com> …
Mario,
can you explain real quick how to use death messages in QNX4?

With pleasure. Once you set the _PPF_INFORM flag your program
must be ready to handle a message from Proc32. The message
will match struct _proc_death as described in
/usr/include/sys/proc_msg.h

If you download iomanager.tgz from ftp section you will find a file
call io_sys.c (from memory) that handles system messages. I’m not
sure if the death message one of those messages though. If not here
is a little snippet that might get you started (QNX4)

void dump_process(pid_t pid, int signum )
{
struct _dumper_hdr hdr;
// — info comes from QNX this isn’t documented anywhere
hdr.signature = 0x706d7564;
hdr.version = 100;
hdr.zero = 0;
hdr.numsegs = 0;
hdr.numthreads = 1;
qnx_psinfo( PROC_PID, pid, &hdr.psdata, 0, NULL);
__qnx_debug_xfer(PROC_PID, pid, _DEBUG_REG_RD, &hdr.reg,
sizeof(hdr.reg), 0, 0);
// now print to stdout any values i want, including any registers
log_string( log_context, NULL,0,LOG_SOFTWARE_FAULT, “Pid %d (%s), signal
%d,
cs:ip=0x%lx:0x%lx”,
pid, hdr.psdata.un.proc.name, signum, hdr.reg.cs, hdr.reg.ip );
printf( “Pid %d (%s), signal %d, cs:ip=0x%lx:0x%lx\n”,
pid, hdr.psdata.un.proc.name, signum, hdr.reg.cs, hdr.reg.ip );

}

foo() {

struct _sysmsg_death *p;

if ( sigbits & ( 1 << p->signum -1 ) )
{
dump_process( pid, p->signum );
Reply( pid, NULL, 0 );
}

It’ very important to Reply ASAP since Proc32 is waiting on you…

I just went to the docs and didn’t get any more info than on how to set
_PPF_INFORM.
I would be also interested on the NTO equivalent.

Well I just found out in the DOC that an equivalent to _PPF_INFORM isn’t
support.
The doc suggests scanning /proc but also says that it’s highly
ineficient.

Implementing a watchdog it going to be a lot more difficult ;-( But
then
how is dumper implemented in QNX6 ??


Markus


“Mario Charest” <mcharest@antispam_zinformatic.com> wrote in message
news:97vmgm$j4n$> 1@inn.qnx.com> …


Is there an equivalent for QNX4’s death messages under NTO?
I would like a process to be inform of processes death.

Ok thanks Igor.

“Igor Kovalenko” <Igor.Kovalenko@motorola.com> wrote in message
news:3AA43BBF.DB12CCB9@motorola.com

You have /proc filesystem. Open /proc/as/ and read process address
space > :wink:
There are devctls to read registers and other info. See sys/debug.h,
sys/procfs.h, sys/dcmd_proc.h.

  • igor

Mario Charest wrote:

“Colin Burgess” <> cburgess@qnx.com> > wrote in message
news:980q08$hi$> 1@nntp.qnx.com> …
Dumper registers as an resmgr with path /proc/dumper, with type
_FTYPE_DUMPER. Proc will open /proc/dumper, and write the pid of the
process that died - it will wait until dumper replys that the write
was
ok before reaping the child.

Interesting.

How does the equivalent of __qnx_debug_xfer under QNX4 can
be acheived.


You could write a wrapper that does whatever it wants with the dump
message, then spawns dumper -d dumper_dir -p pid to properly dump it.

Mario Charest <mcharest@antispam_zinformatic.com> wrote:

“Markus Loffler” <> loffler@ces.clemson.edu> > wrote in message
news:97vt8r$nec$> 1@inn.qnx.com> …
Mario,
can you explain real quick how to use death messages in QNX4?

With pleasure. Once you set the _PPF_INFORM flag your program
must be ready to handle a message from Proc32. The message
will match struct _proc_death as described in
/usr/include/sys/proc_msg.h

If you download iomanager.tgz from ftp section you will find a file
call io_sys.c (from memory) that handles system messages. I’m not
sure if the death message one of those messages though. If not
here
is a little snippet that might get you started (QNX4)

void dump_process(pid_t pid, int signum )
{
struct _dumper_hdr hdr;
// — info comes from QNX this isn’t documented anywhere
hdr.signature = 0x706d7564;
hdr.version = 100;
hdr.zero = 0;
hdr.numsegs = 0;
hdr.numthreads = 1;
qnx_psinfo( PROC_PID, pid, &hdr.psdata, 0, NULL);
__qnx_debug_xfer(PROC_PID, pid, _DEBUG_REG_RD, &hdr.reg,
sizeof(hdr.reg), 0, 0);
// now print to stdout any values i want, including any registers
log_string( log_context, NULL,0,LOG_SOFTWARE_FAULT, “Pid %d (%s),
signal
%d,
cs:ip=0x%lx:0x%lx”,
pid, hdr.psdata.un.proc.name, signum, hdr.reg.cs, hdr.reg.ip );
printf( “Pid %d (%s), signal %d, cs:ip=0x%lx:0x%lx\n”,
pid, hdr.psdata.un.proc.name, signum, hdr.reg.cs, hdr.reg.ip );

}

foo() {

struct _sysmsg_death *p;

if ( sigbits & ( 1 << p->signum -1 ) )
{
dump_process( pid, p->signum );
Reply( pid, NULL, 0 );
}

It’ very important to Reply ASAP since Proc32 is waiting on you…

I just went to the docs and didn’t get any more info than on how to
set
_PPF_INFORM.
I would be also interested on the NTO equivalent.

Well I just found out in the DOC that an equivalent to _PPF_INFORM
isn’t
support.
The doc suggests scanning /proc but also says that it’s highly
ineficient.

Implementing a watchdog it going to be a lot more difficult ;-( But
then
how is dumper implemented in QNX6 ??


Markus


“Mario Charest” <mcharest@antispam_zinformatic.com> wrote in
message
news:97vmgm$j4n$> 1@inn.qnx.com> …


Is there an equivalent for QNX4’s death messages under NTO?
I would like a process to be inform of processes death.

Mario Charest <mcharest@antispam_zinformatic.com> wrote:


Is there an equivalent for QNX4’s death messages under NTO?
I would like a process to be inform of processes death.

I think I’ve written notes about this in the mig4nto docs.
Take a look there. If not, let me know… I’ve definitely
got notes in the course.

(There isn’t a clean way that completely covers it, but by doing
a combination of things, you can make sure you do get the notification
that you need. Overloading the route that dumper uses won’t work,
as you don’t get informed of normal terminations – just abnormal
ones that would cause a dump to be generated.)

-David

QNX Training Services
dagibbs@qnx.com

“David Gibbs” <dagibbs@qnx.com> wrote in message
news:986d6g$abp$1@nntp.qnx.com

Mario Charest <mcharest@antispam_zinformatic.com> wrote:


Is there an equivalent for QNX4’s death messages under NTO?
I would like a process to be inform of processes death.

I think I’ve written notes about this in the mig4nto docs.
Take a look there. If not, let me know… I’ve definitely
got notes in the course.

I couldn’t find anything aside using resmgr, but that doesn’t
solve the problem of program I don’t have source for.

(There isn’t a clean way that completely covers it, but by doing
a combination of things, you can make sure you do get the notification
that you need. Overloading the route that dumper uses won’t work,
as you don’t get informed of normal terminations – just abnormal
ones that would cause a dump to be generated.)

-David

QNX Training Services
dagibbs@qnx.com

Mario Charest <mcharest@void_zinformatic.com> wrote:

“David Gibbs” <> dagibbs@qnx.com> > wrote in message
news:986d6g$abp$> 1@nntp.qnx.com> …
Mario Charest <mcharest@antispam_zinformatic.com> wrote:


Is there an equivalent for QNX4’s death messages under NTO?
I would like a process to be inform of processes death.

I think I’ve written notes about this in the mig4nto docs.
Take a look there. If not, let me know… I’ve definitely
got notes in the course.

I couldn’t find anything aside using resmgr, but that doesn’t
solve the problem of program I don’t have source for.

Well, if you can write a program that starts it… open an fd to
the resource manager, and make sure the program (that you don’t
own) inherits that fd. Then, if it goes away, your death monitor
resgmr will notice it. Of course… this does get a little more
complicated… dups & parent dieing, and figuring out who belongs
to the fd… but you should have a fairly good idea of what you
are starting.

-David

QNX Training Services
dagibbs@qnx.com