01-03-2008
alternatives of exec() system function
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 that somewhere in exec() function which is working on some machines and failing on a few machines.
So anybody if have any alternative to exec() or fork()-exec() pair of system function questions then please reply.
Regards,
Raj Kumar Arora
10 More Discussions You Might Find Interesting
1. Programming
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)
Discussion started by: a25khan
2 Replies
2. UNIX for Advanced & Expert Users
Hi all,
I need to syncronize a Solaris client with a QNX Server, modifying the client date, I need any alternative to set the sistem date (client Solaris) but i can't use commands date -a XXX (XXX are the time in seconds) and can't use rdate and ntp.
How can I do It? :confused: (2 Replies)
Discussion started by: ulisses0205
2 Replies
3. Shell Programming and Scripting
Hi,
I wrote a smiple ksh function
send_notification() {
...
}
and want to execute it on each file, matched by the find command.
I tried:
find / -name "*.err" -mtime -8 -exec send_notification {} \;
but it doesn't work. What should I do? I work in ksh on Hp-Ux.
Regards,
Pit (11 Replies)
Discussion started by: piooooter
11 Replies
4. UNIX for Advanced & Expert Users
I would like to call a particular function in a C program using execl(). Is this possible using execl or anyother function ?
Thanks (2 Replies)
Discussion started by: vpraveen84
2 Replies
5. Programming
Runtime.getSystem.exec() waits for child process to complete .. I do not want to wait for the child process to complete ..what is the option which has to be used ? (2 Replies)
Discussion started by: shafi2all
2 Replies
6. Shell Programming and Scripting
Hi All,
I want to execute a piped command like 'ls /opt | grep xml' using array as parameters list. How can I do that? (2 Replies)
Discussion started by: bharadiaam
2 Replies
7. Shell Programming and Scripting
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)
Discussion started by: ahmed_zaher
8 Replies
8. UNIX for Dummies Questions & Answers
Hi Guys ,
I want to use system function in C to do the following work.
cp <file1> <file2> and then ><file1>
e,g cp \var\log\cpm_cpmd_1.log.1 \var\log\cpm_cpmd_1.log.2 and then
>\var\log\cpm_cpmd_1.log.1
1. g_config_info.cpmm_config.cpm_log_path=\var\log\
2. ... (3 Replies)
Discussion started by: meet123321
3 Replies
9. Programming
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.
scanf("%c",&caracter);
if (caracter=='y'){
printf("Has decidido ejecutarlo en background\n");
if((pid=fork())==0) {// fork para... (3 Replies)
Discussion started by: lamachejo
3 Replies
10. Shell Programming and Scripting
I have the following bash script lines in a file named test.sh.
#!/bin/bash
#
# Write Date to cron.log
#
echo "Begin SSI Load $(date +%d%b%y_%T)"
#
# Get the latest rates file for processing.
#
d=$(ls -tr /rms/data/ssi | grep -v "processed" | tail -n 1)
filename=$d
export filename... (3 Replies)
Discussion started by: ginowms
3 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)