@@ -642,3 +642,61 @@ pub fn set_tcp_nodelay<Fd: AsFd>(fd: Fd, nodelay: bool) -> io::Result<()> {
642642pub fn get_tcp_nodelay < Fd : AsFd > ( fd : Fd ) -> io:: Result < bool > {
643643 backend:: net:: syscalls:: sockopt:: get_tcp_nodelay ( fd. as_fd ( ) )
644644}
645+
646+ /// `getsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE)`
647+ ///
648+ /// # References
649+ /// - [POSIX `getsockopt`]
650+ /// - [POSIX `netinet/tcp.h`]
651+ /// - [Linux `getsockopt`]
652+ /// - [Linux `tcp`]
653+ /// - [Winsock2 `getsockopt`]
654+ /// - [Winsock2 `IPPROTO_TCP` options]
655+ ///
656+ /// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
657+ /// [POSIX `netinet/tcp.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_tcp.h.html
658+ /// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
659+ /// [Linux `tcp`]: https://man7.org/linux/man-pages/man7/tcp.7.html
660+ /// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
661+ /// [Winsock2 `IPPROTO_TCP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options
662+ #[ cfg( any(
663+ target_os = "freebsd" ,
664+ target_os = "macos" ,
665+ target_os = "ios" ,
666+ target_os = "tvos" ,
667+ target_os = "watchos"
668+ ) ) ]
669+ #[ doc( alias = "SO_NOSIGPIPE" ) ]
670+ #[ inline]
671+ pub fn getsockopt_nosigpipe < Fd : AsFd > ( fd : Fd ) -> io:: Result < bool > {
672+ backend:: net:: syscalls:: sockopt:: getsockopt_nosigpipe ( fd. as_fd ( ) )
673+ }
674+
675+ /// `setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, val)`
676+ ///
677+ /// # References
678+ /// - [POSIX `getsockopt`]
679+ /// - [POSIX `netinet/tcp.h`]
680+ /// - [Linux `getsockopt`]
681+ /// - [Linux `tcp`]
682+ /// - [Winsock2 `getsockopt`]
683+ /// - [Winsock2 `IPPROTO_TCP` options]
684+ ///
685+ /// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
686+ /// [POSIX `netinet/tcp.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_tcp.h.html
687+ /// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
688+ /// [Linux `tcp`]: https://man7.org/linux/man-pages/man7/tcp.7.html
689+ /// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
690+ /// [Winsock2 `IPPROTO_TCP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options
691+ #[ cfg( any(
692+ target_os = "freebsd" ,
693+ target_os = "macos" ,
694+ target_os = "ios" ,
695+ target_os = "tvos" ,
696+ target_os = "watchos"
697+ ) ) ]
698+ #[ doc( alias = "SO_NOSIGPIPE" ) ]
699+ #[ inline]
700+ pub fn setsockopt_nosigpipe < Fd : AsFd > ( fd : Fd , val : bool ) -> io:: Result < ( ) > {
701+ backend:: net:: syscalls:: sockopt:: setsockopt_nosigpipe ( fd. as_fd ( ) , val)
702+ }
0 commit comments