Hi all,
I have the following problem:
I’m doing fork/exec on QNX momentics (6.2.1a) in a function that is called from different places in my code. The first time when I call it fork acts normally and the exec passes, but the second time when I call it I get the following error:
[SMA] ps_list: start
[SMA] ps_list: Function not implemented
[SMA] ps_list: failed to exec pidin!
Can anyone tell me what might be the problem?
The code fragment that produces the error is:
sma_debug(“ps_list: start”);
opdatas[0] = (opdata_t*) sma_malloc(sizeof(opdata_t));
opdatas[0]->size = 0;
opdatas[0]->data = NULL;
pipe(fds);
cpid = fork();
if(cpid == -1){
sma_warning(“ps_list: %s”, strerror(errno));
}
if(cpid == (pid_t) 0){
sma_debug(“ps_list: child!”);
close (fds[0]);
dup2 (fds[1], STDOUT_FILENO);
execlp (“pidin”, “pidin”, “-f”, “acdn”, NULL);
abort();
} else {
waitpid (cpid, &i, 0);
if (!WIFEXITED(i)){
sma_warning(“ps_list: failed to exec pidin!”);
return -1;
}
close (fds[1]);
stream = fdopen (fds[0], “r”);
/* get the lables line! */
fgets(line, PS_LINESIZE, stream);
also,
Can anyone point me to a good guide on using procfs on qnx6.2?
The docs on support.qnx.com are quite poor (when it comes to /proc mangling), and the ones that I found on the net were for pretty old APIs (pre 6.2)…
Thanks in advance!