shutdown for qnx6

hi all
how can i shutdown the system (qnx6.x) from my C-apps ?

like Send to procmgr in QNX4.x


/----------------------------------------------------------------------------/

static void shutdown(void)
{
struct sched_param param;
sigset_t bits;
union
{
struct _proc_shutdown s;
struct _proc_shutdown_reply r;
}msg;
qnx_sync(getnid());
bits=~0L;
sigprocmask(SIG_BLOCK,&bits,0);
msg.s.type=_PROC_SHUTDOWN;
msg.s.signum=SIGPWR;
Send(PROC_PID,&msg.s,&msg.r,sizeof(msg.s),sizeof(msg.r));
sleep(2);
param.sched_priority=PRIO_FIFO_MAX;
sched_setscheduler(0,SCHED_FIFO,&param); }
/----------------------------------------------------------------------------/


void halt(void)
{
shutdown();
while(1)
Yield();
}
/----------------------------------------------------------------------------/

void reboot(void)
{
union
{
struct _proc_shutdown s;
struct _proc_shutdown_reply r;
}msg;
shutdown();
msg.s.type=_PROC_SHUTDOWN;
msg.s.signum=-1; // Restart
Send(PROC_PID,&msg.s,&msg.r,sizeof(msg.s),sizeof(msg.r));
}
/----------------------------------------------------------------------------/


Thank you

Have a look at sysmgr_reboot() call
For info under QNX6 it’s not SIGPWR that is used on shutdown but SIGTERM …

Laveau.

“Jörg Hering” <jhering@avecs-bergen.de> a écrit dans le message de news:3F01A1B5.8060901@avecs-bergen.de
hi all
how can i shutdown the system (qnx6.x) from my C-apps ?

like Send to procmgr in QNX4.x


/----------------------------------------------------------------------------/
static void shutdown(void)
{
struct sched_param param;
sigset_t bits;
union
{
struct _proc_shutdown s;
struct _proc_shutdown_reply r;
}msg;
qnx_sync(getnid());
bits=~0L;
sigprocmask(SIG_BLOCK,&bits,0);
msg.s.type=_PROC_SHUTDOWN;
msg.s.signum=SIGPWR;
Send(PROC_PID,&msg.s,&msg.r,sizeof(msg.s),sizeof(msg.r));
sleep(2);
param.sched_priority=PRIO_FIFO_MAX;
sched_setscheduler(0,SCHED_FIFO,&param); }
/----------------------------------------------------------------------------/

void halt(void)
{
shutdown();
while(1)
Yield();
}
/----------------------------------------------------------------------------/
void reboot(void)
{
union
{
struct _proc_shutdown s;
struct _proc_shutdown_reply r;
}msg;
shutdown();
msg.s.type=_PROC_SHUTDOWN;
msg.s.signum=-1; // Restart
Send(PROC_PID,&msg.s,&msg.r,sizeof(msg.s),sizeof(msg.r));
}
/----------------------------------------------------------------------------/

Thank you