openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/libnl/1_3.4.0-r0/libnl-3.4.0/lib/socket.c
int nl_socket_set_buffer_size(struct nl_sock* sk, int rxbuf, int txbuf)
{
    int err;

    if (rxbuf <= 0)
        rxbuf = 32768;

    if (txbuf <= 0)
        txbuf = 32768;

    if (sk->s_fd == -1)
        return -NLE_BAD_SOCK;

    err = setsockopt(sk->s_fd, SOL_SOCKET, SO_SNDBUF, &txbuf, sizeof(txbuf));
    if (err < 0)
    {
        NL_DBG(
            4,
            "nl_socket_set_buffer_size(%p): setsockopt() failed with %d (%s)\n",
            sk, errno, nl_strerror_l(errno));
        return -nl_syserr2nlerr(errno);
    }

    err = setsockopt(sk->s_fd, SOL_SOCKET, SO_RCVBUF, &rxbuf, sizeof(rxbuf));
    if (err < 0)
    {
        NL_DBG(
            4,
            "nl_socket_set_buffer_size(%p): setsockopt() failed with %d (%s)\n",
            sk, errno, nl_strerror_l(errno));
        return -nl_syserr2nlerr(errno);
    }

    return 0;
}
/**
 * Set socket buffer size of netlink socket.
 * @arg sk		Netlink socket.
 * @arg rxbuf		New receive socket buffer size in bytes.
 * @arg txbuf		New transmit socket buffer size in bytes.
 *
 * Sets the socket buffer size of a netlink socket to the specified
 * values \c rxbuf and \c txbuf. Providing a value of \c 0 assumes a
 * good default value.
 *
 * @note It is not required to call this function prior to nl_connect().
 * @return 0 on sucess or a negative error code.
 */
Set socket buffer size of netlink socket.
@arg sk              Netlink socket.
@arg rxbuf           New receive socket buffer size in bytes.
@arg txbuf           New transmit socket buffer size in bytes.

Sets the socket buffer size of a netlink socket to the specified
values \c rxbuf and \c txbuf. Providing a value of \c 0 assumes a
good default value.

@note It is not required to call this function prior to nl_connect().
@return 0 on sucess or a negative error code.
Set socket buffer size of netlink socket . @arg sk Netlink socket . @arg rxbuf New receive socket buffer size in bytes . @arg txbuf New transmit socket buffer size in bytes . Sets the socket buffer size of a netlink socket to the specified values \ c rxbuf and \ c txbuf . Providing a value of \ c 0 assumes a good default value . @note It is not required to call this function prior to nl_connect () . @return 0 on sucess or a negative error code .
int nl_socket_set_buffer_size(struct nl_sock* sk, int rxbuf, int txbuf)
{
    int err;
    if (rxbuf <= 0)
        rxbuf = 32768;
    if (txbuf <= 0)
        txbuf = 32768;
    if (sk->s_fd == -1)
        return -NLE_BAD_SOCK;
    err = setsockopt(sk->s_fd, SOL_SOCKET, SO_SNDBUF, &txbuf, sizeof(txbuf));
    if (err < 0)
    {
        NL_DBG(
            4,
            "nl_socket_set_buffer_size(%p): setsockopt() failed with %d (%s)\n",
            sk, errno, nl_strerror_l(errno));
        return -nl_syserr2nlerr(errno);
    }
    err = setsockopt(sk->s_fd, SOL_SOCKET, SO_RCVBUF, &rxbuf, sizeof(rxbuf));
    if (err < 0)
    {
        NL_DBG(
            4,
            "nl_socket_set_buffer_size(%p): setsockopt() failed with %d (%s)\n",
            sk, errno, nl_strerror_l(errno));
        return -nl_syserr2nlerr(errno);
    }
    return 0;
}
int nl_socket_set_buffer_size ( struct nl_sock * sk , int rxbuf , int txbuf ) { int err ; if ( rxbuf <= 0 ) rxbuf = 32768 ; if ( txbuf <= 0 ) txbuf = 32768 ; if ( sk -> s_fd == -1 ) return - NLE_BAD_SOCK ; err = setsockopt ( sk -> s_fd , SOL_SOCKET , SO_SNDBUF , & txbuf , sizeof ( txbuf ) ) ; if ( err < 0 ) { NL_DBG ( 4 , " \n " , sk , errno , nl_strerror_l ( errno ) ) ; return - nl_syserr2nlerr ( errno ) ; } err = setsockopt ( sk -> s_fd , SOL_SOCKET , SO_RCVBUF , & rxbuf , sizeof ( rxbuf ) ) ; if ( err < 0 ) { NL_DBG ( 4 , " \n " , sk , errno , nl_strerror_l ( errno ) ) ; return - nl_syserr2nlerr ( errno ) ; } return 0 ; }
Set socket buffer size of netlink socket.
Set socket buffer size of netlink socket .