C Board  

Go Back   C Board > Platform Specific Boards > Linux Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 10-14-2009, 01:08 PM   #1
Unregistered User
 
Yarin's Avatar
 
Join Date: Jul 2007
Posts: 925
open file descriptor in remote 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.
__________________
GCC 4.4.0, Code::Blocks 8.02, Fedora 11, x64
Yarin is offline   Reply With Quote
Old 10-14-2009, 01:20 PM   #2
Jaxom's & Imriel's Dad
 
Kennedy's Avatar
 
Join Date: Aug 2006
Location: Alabama
Posts: 801
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.
Kennedy is offline   Reply With Quote
Old 10-14-2009, 01:37 PM   #3
Senior software engineer
 
brewbuck's Avatar
 
Join Date: Mar 2007
Location: Portland, OR
Posts: 5,381
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.
__________________
"Congratulations on your purchase. To begin using your quantum computer, set the power switch to both off and on simultaneously." -- raftpeople@slashdot
brewbuck is offline   Reply With Quote
Old 10-14-2009, 05:36 PM   #4
Unregistered User
 
Yarin's Avatar
 
Join Date: Jul 2007
Posts: 925
Great. Thanks.
I didn't know exec() did that.
__________________
GCC 4.4.0, Code::Blocks 8.02, Fedora 11, x64
Yarin is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
sequenceing or queueing multiple process sv_joshi_pune Windows Programming 1 08-14-2009 09:43 AM
Can we have a daemon process sleeping until a file is created, using C/C++ in window Krsh Windows Programming 3 02-20-2009 12:46 AM
Simple File encryption caroundw5h C Programming 2 10-13-2004 10:51 PM
file processing updating record error uuser C Programming 2 04-27-2003 12:13 AM


All times are GMT -6. The time now is 11:04 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22