Re: [PATCH x86_64] Live Patching Function on 2.6.11.7

Miquel van Smoorenburg
2005-04-20T08:34:52Z

In article <42660B6B.6040600@lab.ntt.co.jp>,
Takashi Ikebe <ikebe.takashi@lab.ntt.co.jp> wrote:
>Chris Wedgwood wrote:
>> On Wed, Apr 20, 2005 at 04:35:07PM +0900, Takashi Ikebe wrote:>
>>
>>>To takeover the application status, connection type
>>>communications(SOCK_STREAM) are need to be disconnected by close().
>>>Same network port is not allowed to bind by multiple processes....
>>
>>
>> AF_UNIX socket with SCM_RIGHTS
>>
>hmm.. most internet base services will use TCPv4 TCPv6 SCTP...
>AF_UNIX can not use as inter-nodes communication.

No, Chris means filedescriptor passing.

You can pass any existing open filedescriptor to another process
using an AF_UNIX socket.

For example, the existing running process creates a UNIX socket in
/var/run/mysocket that the new process can connect() to. The
processes can then not only exchange all kinds of information,
the old process can even send open filedescriptors over to
the new process without closing/re-opening.

See "man 7 unix", ANCILLARY MESSAGES -> SCM_RIGHTS

ANCILLARY MESSAGES
Ancillary data is sent and received using sendmsg(2) and recvmsg(2).
For historical reasons the ancillary message types listed below are
specified with a SOL_SOCKET type even though they are PF_UNIX specific.
To send them set the cmsg_level field of the struct cmsghdr to
SOL_SOCKET and the cmsg_type field to the type. For more information
see cmsg(3).

SCM_RIGHTS
Send or receive a set of open file descriptors from another pro-
cess. The data portion contains an integer array of the file
descriptors. The passed file descriptors behave as though they
have been created with dup(2).

Mike.