openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/nbd/3.19-r0/nbd-3.19/nbd-server.c
int dosockopts(const int socket, GError** const gerror)
{
#ifndef sun
    int yes = 1;
#else
    char yes = '1';
#endif /* sun */
    struct linger l;

    /* lose the pesky "Address already in use" error message */
    if (setsockopt(socket, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1)
    {
        g_set_error(gerror, NBDS_ERR, NBDS_ERR_SO_REUSEADDR,
                    "failed to set socket option SO_REUSEADDR: %s",
                    strerror(errno));
        return -1;
    }
    l.l_onoff = 1;
    l.l_linger = 10;
    if (setsockopt(socket, SOL_SOCKET, SO_LINGER, &l, sizeof(l)) == -1)
    {
        g_set_error(gerror, NBDS_ERR, NBDS_ERR_SO_LINGER,
                    "failed to set socket option SO_LINGER: %s",
                    strerror(errno));
        return -1;
    }
    if (setsockopt(socket, SOL_SOCKET, SO_KEEPALIVE, &yes, sizeof(int)) == -1)
    {
        g_set_error(gerror, NBDS_ERR, NBDS_ERR_SO_KEEPALIVE,
                    "failed to set socket option SO_KEEPALIVE: %s",
                    strerror(errno));
        return -1;
    }

    return 0;
}
/**
 * Set server socket options.
 *
 * @param socket a socket descriptor of the server
 *
 * @param gerror a pointer to an error object pointer used for reporting
 *        errors. On error, if gerror is not NULL, *gerror is set and -1
 *        is returned.
 *
 * @return 0 on success, -1 on error
 **/
Set server socket options.
@param socket a socket descriptor of the server

@param gerror a pointer to an error object pointer used for reporting
errors. On error, if gerror is not NULL, *gerror is set and -1
is returned.

@return 0 on success, -1 on error
Set server socket options . @param socket a socket descriptor of the server @param gerror a pointer to an error object pointer used for reporting errors . On error if gerror is not NULL * gerror is set and - 1 is returned . @return 0 on success - 1 on error
int dosockopts(const int socket, GError** const gerror)
{
#ifndef sun
    int yes = 1;
#else
    char yes = '1';
#endif 
    struct linger l;
    if (setsockopt(socket, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1)
    {
        g_set_error(gerror, NBDS_ERR, NBDS_ERR_SO_REUSEADDR,
                    "failed to set socket option SO_REUSEADDR: %s",
                    strerror(errno));
        return -1;
    }
    l.l_onoff = 1;
    l.l_linger = 10;
    if (setsockopt(socket, SOL_SOCKET, SO_LINGER, &l, sizeof(l)) == -1)
    {
        g_set_error(gerror, NBDS_ERR, NBDS_ERR_SO_LINGER,
                    "failed to set socket option SO_LINGER: %s",
                    strerror(errno));
        return -1;
    }
    if (setsockopt(socket, SOL_SOCKET, SO_KEEPALIVE, &yes, sizeof(int)) == -1)
    {
        g_set_error(gerror, NBDS_ERR, NBDS_ERR_SO_KEEPALIVE,
                    "failed to set socket option SO_KEEPALIVE: %s",
                    strerror(errno));
        return -1;
    }
    return 0;
}
int dosockopts ( const int socket , GError * * const gerror ) { #ifndef sun int yes = 1 ; #else char yes = ' ' ; #endif struct linger l ; if ( setsockopt ( socket , SOL_SOCKET , SO_REUSEADDR , & yes , sizeof ( int ) ) == -1 ) { g_set_error ( gerror , NBDS_ERR , NBDS_ERR_SO_REUSEADDR , " " , strerror ( errno ) ) ; return -1 ; } l . l_onoff = 1 ; l . l_linger = 10 ; if ( setsockopt ( socket , SOL_SOCKET , SO_LINGER , & l , sizeof ( l ) ) == -1 ) { g_set_error ( gerror , NBDS_ERR , NBDS_ERR_SO_LINGER , " " , strerror ( errno ) ) ; return -1 ; } if ( setsockopt ( socket , SOL_SOCKET , SO_KEEPALIVE , & yes , sizeof ( int ) ) == -1 ) { g_set_error ( gerror , NBDS_ERR , NBDS_ERR_SO_KEEPALIVE , " " , strerror ( errno ) ) ; return -1 ; } return 0 ; }
Set server socket options.
Set server socket options .
/* sun */ /* lose the pesky "Address already in use" error message */