qnx_spawn_option

i was using qnx_spawn_option.iov[1] and iov[2] to redirecting the stdout and
stderror of a spawn function to a file by giving the file descriptor, under
Nto, How would I do this??

ran zhang <rzhang@vamcointernational.com> wrote:

i was using qnx_spawn_option.iov[1] and iov[2] to redirecting the stdout and
stderror of a spawn function to a file by giving the file descriptor, under
Nto, How would I do this??

I think you would have to explicitly call spawn() yourself and play
with the fd_count and fd_map parameters. Unfortunately, the docs
don’t really say how to play with them… you might have to experiment
a bit.

-David

QNX Training Services
I do not answer technical questions by email.

ran zhang wrote:

i was using qnx_spawn_option.iov[1] and iov[2] to redirecting the stdout and
stderror of a spawn function to a file by giving the file descriptor, under
Nto, How would I do this??
\

It is pretty much the same thing as before.

If Using a PtTty :
fill the opt.iov[1] and opt.iov[2] of a PtSpawnOptions_t and set the
Pt_ARG_TTY_SPAWN_OPTIONS with it
set Pt_ARG_TTY_FDSET to to 0x01
an now set your Pt_ARG_TTY_CMD or your Pt_ARG_TTY_ARGV

If using PtSpawn() :
fill the opt.iov[1]and opt.iov[2] in the PtSpawnOptions_t you are
passing as argument

If using spawn():
fd_map[ 0 ] = stdin ;
fd_map[ 1 ] = StdoutFileFd ;
fd_map[ 2 ] = StderrFileFd ;
fd_count = 3 ;

Michel Belanger <micbel@videotron.ca> wrote:

ran zhang wrote:

i was using qnx_spawn_option.iov[1] and iov[2] to redirecting the stdout and
stderror of a spawn function to a file by giving the file descriptor, under
Nto, How would I do this??




It is pretty much the same thing as before.

If Using a PtTty :
fill the opt.iov[1] and opt.iov[2] of a PtSpawnOptions_t and set the
Pt_ARG_TTY_SPAWN_OPTIONS with it
set Pt_ARG_TTY_FDSET to to 0x01
an now set your Pt_ARG_TTY_CMD or your Pt_ARG_TTY_ARGV

If using PtSpawn() :
fill the opt.iov[1]and opt.iov[2] in the PtSpawnOptions_t you are
passing as argument

If using spawn():
fd_map[ 0 ] = stdin ;
fd_map[ 1 ] = StdoutFileFd ;
fd_map[ 2 ] = StderrFileFd ;
fd_count = 3 ;

Both of those choices require bringing in the Photon libraries. He may
not be writing a Photon application.

-David

QNX Training Services
I do not answer technical questions by email.

David Gibbs wrote:

Michel Belanger <> micbel@videotron.ca> > wrote:

ran zhang wrote:


i was using qnx_spawn_option.iov[1] and iov[2] to redirecting the stdout and
stderror of a spawn function to a file by giving the file descriptor, under
Nto, How would I do this??





It is pretty much the same thing as before.


If Using a PtTty :
fill the opt.iov[1] and opt.iov[2] of a PtSpawnOptions_t and set the
Pt_ARG_TTY_SPAWN_OPTIONS with it
set Pt_ARG_TTY_FDSET to to 0x01
an now set your Pt_ARG_TTY_CMD or your Pt_ARG_TTY_ARGV


If using PtSpawn() :
fill the opt.iov[1]and opt.iov[2] in the PtSpawnOptions_t you are
passing as argument


If using spawn():
fd_map[ 0 ] = stdin ;
fd_map[ 1 ] = StdoutFileFd ;
fd_map[ 2 ] = StderrFileFd ;
fd_count = 3 ;


Both of those choices require bringing in the Photon libraries. He may
not be writing a Photon application.

-David

Both of these choices … !!! I am counting 3 of them !

And the last one does not need the photon lib, so he can do his pick !

Michel Belanger <micbel@videotron.ca> wrote:

David Gibbs wrote:



If using spawn():
fd_map[ 0 ] = stdin ;
fd_map[ 1 ] = StdoutFileFd ;
fd_map[ 2 ] = StderrFileFd ;
fd_count = 3 ;


Both of those choices require bringing in the Photon libraries. He may
not be writing a Photon application.

-David


Both of these choices … !!! I am counting 3 of them !

And the last one does not need the photon lib, so he can do his pick !

Oops…sorry, I saw the two Pt ones, missed the spawn() one.

Mea culpa. Mea maxima culpa.

-David

QNX Training Services
I do not answer technical questions by email.