Re: feature request: support specifying Unix socket with systemd directive OpenFile=

Paul Gilmartin via curl-users <[email protected]>
Newsgroups gmane.comp.web.curl.general
Message-ID <[email protected]>
On 6/22/23 10:59:15, Erik Sjölund via curl-users wrote:
> On Thu, Jun 22, 2023 at 5:53 PM Dan Fandrich via curl-users
> <[email protected]> wrote:
>> How about just doing this like inetd and passing the fd in as stdin?
> 
> Unfortunately, it's not possible here. File descriptors originating
> from OpenFile= are passed by systemd as file descriptor number 3 or
> higher.


POSIX supports remapping file descriptors with the dup2() function,
and (mentioned by POSIX but not required) many UNIX-like systems
provide "/dev/fd/descriptor-number to access descriptors as
pathnames.  Does that help?  Example using shell:

538 $ exec 5</etc/services 6<&5; ls -l /dev/fd
total 976
crw--w----  1 paulgilm  tty    0x10000001 Jun 22 11:14 0
crw--w----  1 paulgilm  tty    0x10000001 Jun 22 11:14 1
crw--w----  1 paulgilm  tty    0x10000001 Jun 22 11:14 2
drw-r--r--  4 paulgilm  wheel         128 Jun 22 09:03 3
dr--r--r--  1 root      wheel           0 Jun 21 20:35 4
-rw-r--r--  1 root      wheel      677977 Jun  9 09:31 5
-rw-r--r--  1 root      wheel      677977 Jun  9 09:31 6
539 $

-- 
gil

-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users
Etiquette:   https://curl.se/mail/etiquette.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.