Hi again Now I want to make a program that will execute the programs with exec, asking the user if he wants the program to run in background or foreground.
Problem is, it will only execute 1 program. If i try to write ./execute /bin/ls /bin/ls only once will be shown. What's worse, when I try to debug it with ddd, ddd will also crash with a segmentation fault (this happens on foreground code).
Edit: related topics below my post may have given me the answer: is it because when you call exec(), the code of my program won't execute any more?
Last edited by lamachejo; 12-12-2011 at 10:39 AM..
hi there,
i was reading about the exec() function. and if i m not wrong, exec() kills your present process and starts a new process in its place. the process id remains the same.
then it says if exec is successful the text data and stack are overlayed by new file! -
i dont get this part "only... (2 Replies)
Hi,
Ho do I differentiate system call from library call?
for example if I am using chmod , how do I find out if it is a system call or library call?
Thanks
Muru (2 Replies)
Hi ,
Can anybody name any System Function in C/C++ for Sun-Solaris (unix) platform which can serve the alternative of execl() system function.
Actually I am calling a fork-execl() pair and then making an interprocess communication between these two(parent-child process). But the problem is... (3 Replies)
I am new in Perl.
I am working in simple script and the varibles are working well outside the exec or system command.
but they don't work as parameters to exec or system command.
The script is attached.
please help. (8 Replies)
Hi,
I have to run two commands one after another from a c program. How can i do this with exec system calls. i tried giving them as argument to execv but it is not working.please help
thanks (3 Replies)
I have a cgi script which is called after certain time interval, which has this:
system ("ls -l /tmp/cgic* | grep -v \"cgicsave.env\" | awk '{print $5}'");
During the execution of this script,the output is 0 sometimes. But due to this the system call is not working at all and doesnt o/p... (2 Replies)
hi everyone
i wrote a system call and compiled the kernel succesfully...
my system call is in a file in the kernel folder named my_syscall1.c (kernel/my_syscall1.c)
the header file for this system call i added it in the folder include like this include/my_syscall1/my_syscall1.h
my problem is... (2 Replies)
Discussion started by: demis87
2 Replies
LEARN ABOUT DEBIAN
ns_execproc
Ns_Exec(3aolserver) AOLserver Library Procedures Ns_Exec(3aolserver)__________________________________________________________________________________________________________________________________________________NAME
Ns_ExecArgblk, Ns_ExecArgv, Ns_ExecProc, Ns_ExecProcess, Ns_Fork, Ns_GetEnviron, Ns_WaitForProcess, Ns_WaitProcess, ns_fork - External
process execution
SYNOPSIS
#include "ns.h"
int
Ns_ExecArgblk(char *exec, char *dir, int fdin, int fdout,
char *args, Ns_Set *env)
int
Ns_ExecArgv(char *exec, char *dir, int fdin, int fdout,
char **argv, Ns_Set *env)
int
Ns_ExecProc(char *exec, char **argv)
int
Ns_ExecProcess(char *exec, char *dir, int fdin, int fdout,
char *args, Ns_Set *env)
int
Ns_Fork(void)
char
**Ns_GetEnviron(void)
int
Ns_WaitForProcess(int pid, int *statusPtr)
int
Ns_WaitProcess(int pid)
int
ns_fork(void)
_________________________________________________________________DESCRIPTION
These functions handle fork and exec operations. See files: nsd/exec.c, nsd/tclenv.c and nsthread/fork.c.
Ns_ExecArgblk(exec, dir, fdin, fdout, args, env)
Executes a command in a child process. Return process id of child process exec'ing the command or -1 on failure. Provides extended
error checking and error messages.
Ns_ExecArgv(exec, dir, fdin, fdout, argv, env)
Execute a command in a child process using fork(2) and execve(2), returns the process id of child process exec'ing the command or -1
on failure. The child sends an extended error message to the parent.
Ns_ExecProc(exec, argv)
Executes a command in a child process. Returns the process id of the child process exec'ing the command or -1 on failure. Simpli-
fies call to Ns_ExecArgv.
Ns_ExecProcess(exec, dir, fdin, fdout, args, env)
Executes a command in a child process. Returns the process id of the child process exec'ing the command or -1 on failure. Calls
Ns_ExecArgblk with same arguments.
Ns_Fork()
Posix style fork(), using fork1() on Solaris if needed. See fork(2) man page. Calls ns_fork.
Ns_GetEnviron()
Returns pointer to the environment vector.
Ns_WaitForProcess(pid, statusPtr)
Wait for child process. Returns NS_OK on success, or NS_ERROR on failure. *statusPtr is set to the exit code of the child process.
Ns_WaitProcess(pid)
Wait for child process. Calls Ns_WaitForProcess with NULL statusPtr. Returns NS_OK on success, or NS_ERROR on failure.
ns_fork()
Posix style fork(), using fork1() on Solaris if needed.
SEE ALSO nsd(1), info(n)
KEYWORDS AOLserver 4.0 Ns_Exec(3aolserver)