|
Home > Archive > Unix Programming > August 2004 > Transfering file descriptors between processes...
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Transfering file descriptors between processes...
|
|
| Anonymous 2004-08-18, 5:57 pm |
| Suppose you have a process, A, with a file descriptor (a socket, in my
case) and you want process B to have the file descriptor instead. Is there
any way of transfering the file descriptor from one process into another?
Thanks!
| |
| Dragan Cvetkovic 2004-08-18, 5:57 pm |
| "Anonymous" <ihatespam@nowhere.com> writes:
> Suppose you have a process, A, with a file descriptor (a socket, in my
> case) and you want process B to have the file descriptor instead. Is there
> any way of transfering the file descriptor from one process into another?
Yes. Read all about it in Stevens books.
Dragan
--
Dragan Cvetkovic,
To be or not to be is true. G. Boole No it isn't. L. E. J. Brouwer
!!! Sender/From address is bogus. Use reply-to one !!!
| |
| Rich Teer 2004-08-18, 8:48 pm |
| On Wed, 18 Aug 2004, Dragan Cvetkovic wrote:
> Yes. Read all about it in Stevens books.
.... And Solaris Systems Prorgamming (by yours truely)!
--
Rich Teer, SCNA, SCSA, author of "Solaris Systems Programming",
publishing in August 2004.
President,
Rite Online Inc.
Voice: +1 (250) 979-1638
URL: http://www.rite-group.com/rich
| |
| Michael Kerrisk 2004-08-19, 2:50 am |
| On Thu, 19 Aug 2004 01:05:52 GMT, Rich Teer <rich.teer@rite-group.com>
wrote:
>On Wed, 18 Aug 2004, Dragan Cvetkovic wrote:
>
>
>... And Solaris Systems Prorgamming (by yours truely)!
Note also that there are variations in the details across
implementations. What system(s) do you want to do this on?
Cheers,
Michael
| |
| Dragan Cvetkovic 2004-08-19, 7:48 am |
| Michael Kerrisk <michael.kerrisk.at.gmx.net@nospam.com> writes:
> On Thu, 19 Aug 2004 01:05:52 GMT, Rich Teer <rich.teer@rite-group.com>
> wrote:
>
>
> Note also that there are variations in the details across
> implementations. What system(s) do you want to do this on?
Probably Windows, according to OP's headers.
Rich, Amazon.ca says your book will be available 28/8/2004. Is that true?
Dragan
--
Dragan Cvetkovic,
To be or not to be is true. G. Boole No it isn't. L. E. J. Brouwer
!!! Sender/From address is bogus. Use reply-to one !!!
| |
| Rich Teer 2004-08-19, 5:58 pm |
| On Thu, 19 Aug 2004, Dragan Cvetkovic wrote:
> Rich, Amazon.ca says your book will be available 28/8/2004. Is that true?
Amazon.com says tomorrow (the 20th), so yes, it's true (mailing
delays notwithstanding). I hope to be getting a few advance
copies today or tomorrow.
I'll post a general announcement once Amazon.com says they
have some in stock.
--
Rich Teer, SCNA, SCSA, author of "Solaris Systems Programming",
publishing in August 2004.
President,
Rite Online Inc.
Voice: +1 (250) 979-1638
URL: http://www.rite-group.com/rich
| |
| Anonymous 2004-08-22, 6:08 pm |
|
"Michael Kerrisk" <michael.kerrisk.at.gmx.net@nospam.com> wrote in message
news:14e8i0pmqk2s94i3tmprqo2na263h2odou@
4ax.com...
> On Thu, 19 Aug 2004 01:05:52 GMT, Rich Teer <rich.teer@rite-group.com>
> wrote:
>
>
> Note also that there are variations in the details across
> implementations. What system(s) do you want to do this on?
Thank you for asking. I want to do this on Linux (2.4.21-4.0.1.ELsmp).
I'm also curious as to why Cvetkovic would want to plug someone else's
book instead of answering my (hopefully simple) question, but I digress...
| |
| Anonymous 2004-08-22, 6:08 pm |
|
"Dragan Cvetkovic" <me@privacy.net> wrote in message
news:lmd61nnt9g.fsf@privacy.net...
> Michael Kerrisk <michael.kerrisk.at.gmx.net@nospam.com> writes:
>
>
> Probably Windows, according to OP's headers.
Why would you assume this? Perhaps you can tell that I'm using an
MS-Windows news client but that doesn't mean I want to do this on that
platform. Indeed, "file descriptor" is a term absent from MS-Windows jargon
(instead, they refer to handles)...
| |
| Dragan Cvetkovic 2004-08-22, 6:08 pm |
| "Anonymous" <ihatespam@nowhere.com> writes:
> "Michael Kerrisk" <michael.kerrisk.at.gmx.net@nospam.com> wrote in message
> news:14e8i0pmqk2s94i3tmprqo2na263h2odou@
4ax.com...
>
> Thank you for asking. I want to do this on Linux (2.4.21-4.0.1.ELsmp).
>
> I'm also curious as to why Cvetkovic would want to plug someone else's
> book instead of answering my (hopefully simple) question, but I digress...
Why am I recommending Stevens? Because his books about Unix and Network
programming are _the_ programming books for UNIX. I am certain the others
will agree with me.
Btw, the answer to that question is not that simple and depends also on the
platform.
Dragan
P.S. W. Richard Stevens is unfortunally dead, so he can benefit from my
"plug".
--
Dragan Cvetkovic,
To be or not to be is true. G. Boole No it isn't. L. E. J. Brouwer
!!! Sender/From address is bogus. Use reply-to one !!!
| |
| Rich Teer 2004-08-22, 6:08 pm |
| On Fri, 20 Aug 2004, Anonymous wrote:
> I'm also curious as to why Cvetkovic would want to plug someone else's
> book instead of answering my (hopefully simple) question, but I digress...
Dragan recommend Rich Stevens' books because they're among the best
for their subject matter. Also, a simple question does not always
generate a simple answer.
--
Rich Teer, SCNA, SCSA, author of "Solaris Systems Programming",
publishing in August 2004.
President,
Rite Online Inc.
Voice: +1 (250) 979-1638
URL: http://www.rite-group.com/rich
| |
| G. S. Hayes 2004-08-23, 8:01 am |
| "Anonymous" <ihatespam@nowhere.com> wrote in message news:<vDOUc.115$Pd2.44317@monger.newsread.com>...
> Suppose you have a process, A, with a file descriptor (a socket, in my
> case) and you want process B to have the file descriptor instead. Is there
> any way of transfering the file descriptor from one process into another?
If you really want to understand how this works, the recommendation to
get a copy of Stevens' APUE is well taken.
If you just want some sample code to look at or a library to use to do
this for you, type "libancillary" into Google and hit "I Feel Lucky".
| |
| Chuck Dillon 2004-08-23, 5:55 pm |
| Anonymous wrote:
> Suppose you have a process, A, with a file descriptor (a socket, in my
> case) and you want process B to have the file descriptor instead. Is there
> any way of transfering the file descriptor from one process into another?
> Thanks!
>
>
The mechanism is a specially formulated message packet sent through a
unix domain socket. Google usenet (including this forum) for I_SENDFD
and/or I_RECVFD. Steven's book contains example code.
-- ced
--
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.
| |
| Anonymous 2004-08-23, 5:55 pm |
|
"G. S. Hayes" <sjdevnull@yahoo.com> wrote in message
news:96c2e938.0408222139.1e1bc624@posting.google.com...
> "Anonymous" <ihatespam@nowhere.com> wrote in message
news:<vDOUc.115$Pd2.44317@monger.newsread.com>...
>
there[vbcol=seagreen]
another?[vbcol=seagreen]
>
> If you really want to understand how this works, the recommendation to
> get a copy of Stevens' APUE is well taken.
>
> If you just want some sample code to look at or a library to use to do
> this for you, type "libancillary" into Google and hit "I Feel Lucky".
Thank you, both Hayes and Dillon, for your kind answers. I will take
the advice of Stevens' book seriously but I also do appreciate the simple
answer made here, on usenet. It really wasn't hard to understand, at all...
In response to some other posts, if I may be as bold to say so, there
are several important authours (people who wrote important books in the
field) in the comp.os.ms-windows.programmer.nt.kernel-mode newsgroup and
they answer questions _while_ plugging their books (if they even do that).
I think this group can be improved by their example.
Again, thank you...
|
|
|
|
|