openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/rsyslog/8.1903.0-r0/rsyslog-8.1903.0/runtime/net.c
static void debugListenInfo(int fd, char* type)
{
    const char* szFamily;
    int port;
    union
    {
        struct sockaddr_storage sa;
        struct sockaddr_in sa4;
        struct sockaddr_in6 sa6;
    } sockaddr;
    socklen_t saLen = sizeof(sockaddr.sa);

    if (getsockname(fd, (struct sockaddr*)&sockaddr.sa, &saLen) == 0)
    {
        switch (sockaddr.sa.ss_family)
        {
            case PF_INET:
                szFamily = "IPv4";
                port = ntohs(sockaddr.sa4.sin_port);
                break;
            case PF_INET6:
                szFamily = "IPv6";
                port = ntohs(sockaddr.sa6.sin6_port);
                break;
            default:
                szFamily = "other";
                port = -1;
                break;
        }
        dbgprintf("Listening on %s syslogd socket %d (%s/port %d).\n", type, fd,
                  szFamily, port);
        return;
    }

    /* we can not obtain peer info. We are just providing
     * debug info, so this is no reason to break the program
     * or do any serious error reporting.
     */
    dbgprintf("Listening on syslogd socket %d - could not obtain peer info.\n",
              fd);
}
/* print out which socket we are listening on. This is only
 * a debug aid. rgerhards, 2007-07-02
 */
print out which socket we are listening on. This is only
a debug aid.
print out which socket we are listening on . This is only a debug aid .
static void debugListenInfo(int fd, char* type)
{
    const char* szFamily;
    int port;
    union
    {
        struct sockaddr_storage sa;
        struct sockaddr_in sa4;
        struct sockaddr_in6 sa6;
    } sockaddr;
    socklen_t saLen = sizeof(sockaddr.sa);
    if (getsockname(fd, (struct sockaddr*)&sockaddr.sa, &saLen) == 0)
    {
        switch (sockaddr.sa.ss_family)
        {
            case PF_INET:
                szFamily = "IPv4";
                port = ntohs(sockaddr.sa4.sin_port);
                break;
            case PF_INET6:
                szFamily = "IPv6";
                port = ntohs(sockaddr.sa6.sin6_port);
                break;
            default:
                szFamily = "other";
                port = -1;
                break;
        }
        dbgprintf("Listening on %s syslogd socket %d (%s/port %d).\n", type, fd,
                  szFamily, port);
        return;
    }
    dbgprintf("Listening on syslogd socket %d - could not obtain peer info.\n",
              fd);
}
static void debugListenInfo ( int fd , char * type ) { const char * szFamily ; int port ; union { struct sockaddr_storage sa ; struct sockaddr_in sa4 ; struct sockaddr_in6 sa6 ; } sockaddr ; socklen_t saLen = sizeof ( sockaddr . sa ) ; if ( getsockname ( fd , ( struct sockaddr * ) & sockaddr . sa , & saLen ) == 0 ) { switch ( sockaddr . sa . ss_family ) { case PF_INET : szFamily = " " ; port = ntohs ( sockaddr . sa4 . sin_port ) ; break ; case PF_INET6 : szFamily = " " ; port = ntohs ( sockaddr . sa6 . sin6_port ) ; break ; default : szFamily = " " ; port = -1 ; break ; } dbgprintf ( " \n " , type , fd , szFamily , port ) ; return ; } dbgprintf ( " \n " , fd ) ; }
print out which socket we are listening on.
print out which socket we are listening on .
/* we can not obtain peer info. We are just providing
     * debug info, so this is no reason to break the program
     * or do any serious error reporting.
     */