How can I pass a Descriptor file to another process?

Asked

Viewed 81 times

1

Recently I read a post by Peter Hutterer explaining about a new protocol called inputfd that is intended to pass a file Descriptor directly to other processes without the interaction of the composer.

I was curious, how is it possible to pass a file from one process to another?

Could show a minimum example of code that does this?

  • 1

    In UNIX (and Linux) environment the process of passing a file descriptor between any processes is well known and uses the function "sendmsg" between local sockets (family AF_UNIX or AF_LOCAL). This Soen page has several examples of how-to: http://stackoverflow.com/questions/28003921/sending-file-descriptor-by-linux-socket/.

  • @nullptr, that’s exactly what I was looking for. Please post your comment in response form and I’ll mark it as the correct one.

1 answer

1


In UNIX (and Linux) environment the process of passing a file descriptor between any processes is well known and uses the function "sendmsg" between local sockets (family AF_UNIX or AF_LOCAL). This page Soen has several examples of how to do.

The first time I saw this example was in one of W. Richard Stevens’s books, which are the basic reference for UNIX programming. Unfortunately on Amazon only one of them is available on Kindle, here. (The 3rd edition is by another author because WRS died some 15 years ago).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.