how to permitted setsid()?

Hai all…

I need to know how to permitted operation when we call function
setsid()?

The codes are below:

#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>

int main( void )
{

  if( setsid() == -1 )
    perror( "parent: setsid" );
  else
    printf( "parent: I am a session leader\n" );

return EXIT_SUCCESS;

}

Can you all help me?

Read the setsid() library reference. Especially the “Return” section, also check out the sample.

But in QNX4, a process can easily be a sesion leader, not in QNX 6?
Why?