[pulseaudio-discuss] [PATCH] netbsd: NetBSD ships with paccept(2) a superset of Linux-specific accept4()

David Henningsson david.henningsson at canonical.com
Fri Nov 27 00:54:43 PST 2015


Pushed this one (after moving paccept to the "bsd" section, that seemed 
appropriate). Thanks.

// David

On 2015-11-21 23:08, Kamil Rytarowski wrote:
> ---
>   configure.ac              | 2 +-
>   src/pulsecore/core-util.c | 7 +++++++
>   2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/configure.ac b/configure.ac
> index 003673e..24ba7ae 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -572,7 +572,7 @@ AC_CHECK_FUNCS_ONCE([strerror_r])
>   AC_CHECK_FUNCS_ONCE([lstat])
>
>   # Non-standard
> -AC_CHECK_FUNCS_ONCE([setresuid setresgid setreuid setregid seteuid setegid ppoll strsignal sig2str strtod_l pipe2 accept4])
> +AC_CHECK_FUNCS_ONCE([setresuid setresgid setreuid setregid seteuid setegid ppoll strsignal sig2str strtod_l pipe2 accept4 paccept])
>
>   AC_FUNC_ALLOCA
>
> diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
> index 2099686..b5ddd3d 100644
> --- a/src/pulsecore/core-util.c
> +++ b/src/pulsecore/core-util.c
> @@ -3501,6 +3501,8 @@ finish:
>   int pa_accept_cloexec(int sockfd, struct sockaddr *addr, socklen_t *addrlen) {
>       int fd;
>
> +    errno = 0;
> +
>   #ifdef HAVE_ACCEPT4
>       if ((fd = accept4(sockfd, addr, addrlen, SOCK_CLOEXEC)) >= 0)
>           goto finish;
> @@ -3510,6 +3512,11 @@ int pa_accept_cloexec(int sockfd, struct sockaddr *addr, socklen_t *addrlen) {
>
>   #endif
>
> +#ifdef HAVE_PACCEPT
> +    if ((fd = paccept(sockfd, addr, addrlen, NULL, SOCK_CLOEXEC)) >= 0)
> +        goto finish;
> +#endif
> +
>       if ((fd = accept(sockfd, addr, addrlen)) >= 0)
>           goto finish;
>
>

-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic


More information about the pulseaudio-discuss mailing list