qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v12 03/10] hw/misc: Add qtest for NPCM7xx PCI Mailbox


From: Peter Maydell
Subject: Re: [PATCH v12 03/10] hw/misc: Add qtest for NPCM7xx PCI Mailbox
Date: Sat, 13 Jan 2024 12:27:33 +0000

On Wed, 10 Jan 2024 at 23:42, Nabih Estefan <nabihestefan@google.com> wrote:
>
> From: Hao Wu <wuhaotsh@google.com>
>
> This patches adds a qtest for NPCM7XX PCI Mailbox module.
> It sends read and write requests to the module, and verifies that
> the module contains the correct data after the requests.
>
> Change-Id: I2e1dbaecf8be9ec7eab55cb54f7fdeb0715b8275
> Signed-off-by: Hao Wu <wuhaotsh@google.com>
> Signed-off-by: Nabih Estefan <nabihestefan@google.com>
> Reviewed-by: Tyrone Ting <kfting@nuvoton.com>


> +/*
> + * Create a local TCP socket with any port, then save off the port we got.
> + */
> +static in_port_t open_socket(void)

This needs to be 'int', to avoid a compilation failure under
Windows, which doesn't define the in_port_t type.

> +{
> +    struct sockaddr_in myaddr;
> +    socklen_t addrlen;
> +
> +    myaddr.sin_family = AF_INET;
> +    myaddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
> +    myaddr.sin_port = 0;
> +    sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
> +    g_assert(sock != -1);
> +    g_assert(bind(sock, (struct sockaddr *) &myaddr, sizeof(myaddr)) != -1);
> +    addrlen = sizeof(myaddr);
> +    g_assert(getsockname(sock, (struct sockaddr *) &myaddr , &addrlen) != 
> -1);
> +    g_assert(listen(sock, 1) != -1);
> +    return ntohs(myaddr.sin_port);
> +}

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]