2

I've read that you can pass a file descriptor to another process there, which seems perfect for what I want. Any chance that's do-able in Haskell in any way ? To be clear, I'm not forking and I can't pre-open the file, I actually need a way to pass a file descriptor (mainly stdin) from a bunch of processes to a daemon, to avoid having to keep processes up just to forward their input, that'd fill the process list quite fast and would probably eat ressources for no reason.

Thanks !

Ulrar
  • 895
  • 8
  • 17

1 Answers1

2

You can get the file descriptor of STDIN from the unix package and UNIX-domain sockets from network.

I've never tried passing a file descriptor between processes, but it should work the same in Haskell as any other language.

bergey
  • 3,041
  • 11
  • 17
  • Oh I was looking at the deprecated sendAncillary functions, I didn't even realize there's a sendFd and RecvFd .. Thanks, I'll try it out ! – Ulrar Feb 08 '19 at 08:01
  • I didn't read far enough down the page to find `sendFd`! Good to know. :) – bergey Feb 08 '19 at 19:08