fdpass.h 569 B

1234567891011121314151617181920212223
  1. /* CC0 license (public domain) - see LICENSE file for details */
  2. #ifndef CCAN_FDPASS_H
  3. #define CCAN_FDPASS_H
  4. #include <stdbool.h>
  5. /**
  6. * fdpass_send - send a file descriptor across a socket
  7. * @sockout: socket to write to
  8. * @fd: file descriptor to pass
  9. *
  10. * On failure, sets errno and returns false.
  11. */
  12. bool fdpass_send(int sockout, int fd);
  13. /**
  14. * fdpass_recv - receive a file descriptor from a socket
  15. * @sockin: socket to read from
  16. *
  17. * On failure, returns -1 and sets errno. Otherwise returns fd.
  18. */
  19. int fdpass_recv(int sockin);
  20. #endif /* CCAN_FDPASS_H */