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
stdarg(5) File Formats Manual stdarg(5)
NAME
stdarg.h - macros for handling variable argument lists
SYNOPSIS
DESCRIPTION
The header contains a set of macros that can be used to write portable procedures that accept variable argument lists. Routines that have
variable argument lists (such as but do not use stdarg are inherently nonportable, because different machines use different argument-pass-
ing conventions.
is a type defined for the variable used to traverse the list.
is called to initialize pvar to the beginning of the list. The type of argN should be the same as the argument to the function just before
the variable portion of the argument list.
returns the next argument in the list pointed to by pvar. type is the type the argument is expected to be. Different types can be mixed,
but it is up to the routine to know what type of argument is expected, because it cannot be determined at runtime.
is used to clean up.
Multiple traversals, each bracketed by ... are possible.
NOTE: The header file supercedes the header, and contains all of the macros. is provided for compatibility with pre-ANSI compilers and
earlier releases of HP C/HP-UX.
EXAMPLE
This example is a possible implementation of (see exec(2)):
#include <stdarg.h>
#define MAXARGS 100
/* execl is called by
execl(file, arg1, arg2, ..., (char *)0);
*/
execl(const char *file, const char *args, ...)
{
va_list ap;
char *array[MAXARGS];
int argno = 0;
va_start(ap, args);
if ((array[0] = args) != 0)
while ((array[argno++] = va_arg(ap, char *)) != 0)
;
va_end(ap);
return execv(file, array);
}
WARNINGS
It is up to the calling routine to specify how many arguments there are, since it is not always possible to determine this from the stack
frame. For example, is passed a zero pointer to signal the end of the list, and can tell how many arguments are there by the format
string.
Unless ANSI C is used, it is non-portable to specify a second argument of char, short, or float to va_arg, because arguments seen by the
called function are never char, short, or float.
Pre-ANSI C converts char and short arguments to int and converts float arguments to double before passing them to a function.
SEE ALSO
exec(2), vprintf(3S), varargs(5).
STANDARDS CONFORMANCE
stdarg(5)