curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

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

From: Paul Gilmartin via curl-users <curl-users_at_lists.haxx.se>
Date: Thu, 22 Jun 2023 11:25:03 -0600

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
> <curl-users_at_lists.haxx.se> 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
Received on 2023-06-22