The system call within a C programm should run a shellscript.
It returns with no error, but on the stdout we see :
invalid file descriptor to bufgetc: 21
The programm runs fine in an other machine.
We run QNX 4.24.
What can we change ?
Thanks for any help.
Bruno
Try pdksh in stead of ksh
Bruno Crameri wrote:
The system call within a C programm should run a shellscript.
It returns with no error, but on the stdout we see :
invalid file descriptor to bufgetc: 21
The programm runs fine in an other machine.
We run QNX 4.24.
What can we change ?
Thanks for any help.
Bruno
I have sh and ksh, where I will find pdksh ?
Thank’s
Rick Lake <rwlake@SPAM.REDIRECTED.TO.DEV.NULL> schrieb in im Newsbeitrag:
3A3F7108.B7A6353C@SPAM.REDIRECTED.TO.DEV.NULL…
Try pdksh in stead of ksh
Bruno Crameri wrote:
The system call within a C programm should run a shellscript.
It returns with no error, but on the stdout we see :
invalid file descriptor to bufgetc: 21
The programm runs fine in an other machine.
We run QNX 4.24.
What can we change ?
Thanks for any help.
Bruno
Bruno Crameri <bruno.crameri@pup.ch> wrote:
The system call within a C programm should run a shellscript.
It returns with no error, but on the stdout we see :
invalid file descriptor to bufgetc: 21
It is a bug/side-effect of the shell using qnx_spawn() to handle
file-descriptor redirection and the fact that qnx_spawn() only has
an array of 10 fds for redirection, so the shell allocates a storage
area of 10, and if you pass a shell more than 10 open fds, it will
generate this error.
So, to continue, when you start the shell, it gets passed to many open
file descriptors – usually you can solve this by using fcntl() to set
the FD_CLOEXEC flag to say that file descriptors that aren’t needed by
the shell will not be inherited.
Or, as someone else suggested, a different shell would also probably
fix this. You just have to be careful, then, that it will still run
your script sucessfully.
-David
QNX Training Services
dagibbs@qnx.com
Bruno Crameri wrote:
I have sh and ksh, where I will find pdksh ?
Thank’s
On QUICS (or on qdn.qnx.com, now-a-days) in the free software area. Make
sure it’s the QNX4 version.
Rick Lake <> rwlake@SPAM.REDIRECTED.TO.DEV.NULL> > schrieb in im Newsbeitrag:
3A3F7108.B7A6353C@SPAM.REDIRECTED.TO.DEV.NULL> …
Try pdksh in stead of ksh
Bruno Crameri wrote:
The system call within a C programm should run a shellscript.
It returns with no error, but on the stdout we see :
invalid file descriptor to bufgetc: 21
The programm runs fine in an other machine.
We run QNX 4.24.
What can we change ?
Thanks for any help.
Bruno
I checked, but there is onle the STD… active. So no success.
Any other idea ?
Thanks for answering
Bruno
David Gibbs <dagibbs@qnx.com> schrieb in im Newsbeitrag:
91o35i$qov$2@nntp.qnx.com…
Bruno Crameri <> bruno.crameri@pup.ch> > wrote:
The system call within a C programm should run a shellscript.
It returns with no error, but on the stdout we see :
invalid file descriptor to bufgetc: 21
It is a bug/side-effect of the shell using qnx_spawn() to handle
file-descriptor redirection and the fact that qnx_spawn() only has
an array of 10 fds for redirection, so the shell allocates a storage
area of 10, and if you pass a shell more than 10 open fds, it will
generate this error.
So, to continue, when you start the shell, it gets passed to many open
file descriptors – usually you can solve this by using fcntl() to set
the FD_CLOEXEC flag to say that file descriptors that aren’t needed by
the shell will not be inherited.
Or, as someone else suggested, a different shell would also probably
fix this. You just have to be careful, then, that it will still run
your script sucessfully.
-David
QNX Training Services
dagibbs@qnx.com
I checked the pdksh out.
One of the restriction I don’t like is : no access to the QNX Network.
Thanks
Bruno
Rick Lake <rwlake@SPAM.REDIRECTED.TO.DEV.NULL> schrieb in im Newsbeitrag:
3A3FA8E7.ACD8D363@SPAM.REDIRECTED.TO.DEV.NULL…
Bruno Crameri wrote:
I have sh and ksh, where I will find pdksh ?
Thank’s
On QUICS (or on qdn.qnx.com, now-a-days) in the free software area. Make
sure it’s the QNX4 version.
Rick Lake <> rwlake@SPAM.REDIRECTED.TO.DEV.NULL> > schrieb in im
Newsbeitrag:
3A3F7108.B7A6353C@SPAM.REDIRECTED.TO.DEV.NULL> …
Try pdksh in stead of ksh
Bruno Crameri wrote:
The system call within a C programm should run a shellscript.
It returns with no error, but on the stdout we see :
invalid file descriptor to bufgetc: 21
The programm runs fine in an other machine.
We run QNX 4.24.
What can we change ?
Thanks for any help.
Bruno
Bruno Crameri <bruno.crameri@pup.ch> wrote:
I checked, but there is onle the STD… active. So no success.
Any other idea ?
How did you check? Is this code of yours? If so, the best way of
checking is putting a pause right before the system() call with a
prompt, then using “sin -Pprogram fd”. If that shows only the 3
standard ones active, I’m really confused. I’ve looked at the
code that triggers that bug in the shell, and it is as I say.
-David
Thanks for answering
Bruno
David Gibbs <> dagibbs@qnx.com> > schrieb in im Newsbeitrag:
91o35i$qov$> 2@nntp.qnx.com> …
Bruno Crameri <> bruno.crameri@pup.ch> > wrote:
The system call within a C programm should run a shellscript.
It returns with no error, but on the stdout we see :
invalid file descriptor to bufgetc: 21
It is a bug/side-effect of the shell using qnx_spawn() to handle
file-descriptor redirection and the fact that qnx_spawn() only has
an array of 10 fds for redirection, so the shell allocates a storage
area of 10, and if you pass a shell more than 10 open fds, it will
generate this error.
So, to continue, when you start the shell, it gets passed to many open
file descriptors – usually you can solve this by using fcntl() to set
the FD_CLOEXEC flag to say that file descriptors that aren’t needed by
the shell will not be inherited.
Or, as someone else suggested, a different shell would also probably
fix this. You just have to be careful, then, that it will still run
your script sucessfully.
-David
QNX Training Services
dagibbs@qnx.com
–
QNX Training Services
dagibbs@qnx.com
Bruno Crameri <bruno.crameri@pup.ch> wrote:
I checked the pdksh out.
One of the restriction I don’t like is : no access to the QNX Network.
How do you mean “no access” to the QNX network? There are a few built-ins
to the shell that are network aware in our ksh, but most of them can be
replaced by utilities. And paths with //1/ are not shell specific – they
are resolved by Proc, the shell doesn’t need to be network aware.
Basically, what I’m saying is that a shell doesn’t need to be network
aware to make use of QNX networking – the stuff will just work with
other shells as well.
-David
QNX Training Services
dagibbs@qnx.com
You are absolutly right !
There were 20 dev’s open from the father process.
Thank for help.
David Gibbs <dagibbs@qnx.com> schrieb in im Newsbeitrag:
91tero$2n8$1@nntp.qnx.com…
Bruno Crameri <> bruno.crameri@pup.ch> > wrote:
I checked, but there is onle the STD… active. So no success.
Any other idea ?
How did you check? Is this code of yours? If so, the best way of
checking is putting a pause right before the system() call with a
prompt, then using “sin -Pprogram fd”. If that shows only the 3
standard ones active, I’m really confused. I’ve looked at the
code that triggers that bug in the shell, and it is as I say.
-David
Thanks for answering
Bruno
David Gibbs <> dagibbs@qnx.com> > schrieb in im Newsbeitrag:
91o35i$qov$> 2@nntp.qnx.com> …
Bruno Crameri <> bruno.crameri@pup.ch> > wrote:
The system call within a C programm should run a shellscript.
It returns with no error, but on the stdout we see :
invalid file descriptor to bufgetc: 21
It is a bug/side-effect of the shell using qnx_spawn() to handle
file-descriptor redirection and the fact that qnx_spawn() only has
an array of 10 fds for redirection, so the shell allocates a storage
area of 10, and if you pass a shell more than 10 open fds, it will
generate this error.
So, to continue, when you start the shell, it gets passed to many open
file descriptors – usually you can solve this by using fcntl() to set
the FD_CLOEXEC flag to say that file descriptors that aren’t needed by
the shell will not be inherited.
Or, as someone else suggested, a different shell would also probably
fix this. You just have to be careful, then, that it will still run
your script sucessfully.
-David
QNX Training Services
dagibbs@qnx.com