Is it possible to open up a file descriptor in my program. And then pass it to a child process for use (along with permissions)? I know each process has it's own list of descriptors, so I don't know how this would be done.
This is a discussion on open file descriptor in remote process within the Linux Programming forums, part of the Platform Specific Boards category; Is it possible to open up a file descriptor in my program. And then pass it to a child process ...
Is it possible to open up a file descriptor in my program. And then pass it to a child process for use (along with permissions)? I know each process has it's own list of descriptors, so I don't know how this would be done.
I don't see why people think Chuck Norris is so awesome. If he was really as great as they say, he would be over here slamming my head into the keybsk;lah;flksalfksdnlcslcnsldk;acklsd;glfbaskfl
/* When I wrote this, only God and I understood what I was doing... Now, God only knows */
yes. This is common. What many programs do is to open some file to which they need access and then chroot and change userID (to a lesser user) to do processing. This is for security's sake.
File descriptors remain valid after a call to fork(). Normally, they also remain valid after a call to exec(), unless the FD_CLOEXEC flag is set of that descriptor.
So the answer is yes.
Code://try //{ if (a) do { f( b); } while(1); else do { f(!b); } while(1); //}
Great. Thanks.
I didn't know exec() did that.
I don't see why people think Chuck Norris is so awesome. If he was really as great as they say, he would be over here slamming my head into the keybsk;lah;flksalfksdnlcslcnsldk;acklsd;glfbaskfl
/* When I wrote this, only God and I understood what I was doing... Now, God only knows */