sanjay_thakur
asked on
passing pointers in a system call ?
Hi,
I want to know how , if it is possible to pass pointers in a system call.
Basically, I have command line utility functions in a executable say a.out.
from another executable b.out I invoke System calls in a.out.
But I would also like to pass pointers in the System call to be updated by this command line utility.
How do I do this?
a.out is not a running process, it is a command line utility that will exit once the system call is executed.
What are the other efficient solutions I can have for this scenario.
Can I use some perl help to pass pointers.
I want to know how , if it is possible to pass pointers in a system call.
Basically, I have command line utility functions in a executable say a.out.
from another executable b.out I invoke System calls in a.out.
But I would also like to pass pointers in the System call to be updated by this command line utility.
How do I do this?
a.out is not a running process, it is a command line utility that will exit once the system call is executed.
What are the other efficient solutions I can have for this scenario.
Can I use some perl help to pass pointers.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
tell clearly
ASKER
OK:
A attaches itself to shared memory: ptr
A invokes the system call : system(blah);
B attaches itself to shared memory
B executes the system call
Updates the pointer (ptr)
Detaches from shared memory
exits
(B is just a command line utility that will execute the system call and exit)
I presume this will work.
My question:
1) Is there any way to avoid having to use shared memory
2) How exactly do I pass ptr in system calls, curious?
A attaches itself to shared memory: ptr
A invokes the system call : system(blah);
B attaches itself to shared memory
B executes the system call
Updates the pointer (ptr)
Detaches from shared memory
exits
(B is just a command line utility that will execute the system call and exit)
I presume this will work.
My question:
1) Is there any way to avoid having to use shared memory
2) How exactly do I pass ptr in system calls, curious?
You can send ptr to other process. You can update the ptr in other process. But you can't access the value of that ptr pointing to in other process.
you can use file, FIFOs, messages, share memory, sockets.
-Mahesh
you can use file, FIFOs, messages, share memory, sockets.
-Mahesh