static void unix_process_msgfd(CharDriverState *chr, struct msghdr *msg)
{
    TCPCharDriver *s = chr->opaque;
    struct cmsghdr *cmsg;
    for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) {
        int fd;
        if (cmsg->cmsg_len != CMSG_LEN(sizeof(int)) ||
            cmsg->cmsg_level != SOL_SOCKET ||
            cmsg->cmsg_type != SCM_RIGHTS)
            continue;
        fd = *((int *)CMSG_DATA(cmsg));
        if (fd < 0)
            continue;
#ifndef MSG_CMSG_CLOEXEC
        qemu_set_cloexec(fd);
#endif
        if (s->msgfd != -1)
            close(s->msgfd);
        s->msgfd = fd;
    }
}
static void unix_process_msgfd(CharDriverState *chr, struct msghdr *msg)
{
    TCPCharDriver *s = chr->opaque;
    struct cmsghdr *cmsg;
    for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) {
        int fd;
        if (cmsg->cmsg_len != CMSG_LEN(sizeof(int)) ||
            cmsg->cmsg_level != SOL_SOCKET ||
            cmsg->cmsg_type != SCM_RIGHTS)
            continue;
        fd = *((int *)CMSG_DATA(cmsg));
        if (fd < 0)
            continue;
#ifndef MSG_CMSG_CLOEXEC
        qemu_set_cloexec(fd);
#endif
        if (s->msgfd != -1)
            close(s->msgfd);
        s->msgfd = fd;
    }
}
static void FUNC_0(CharDriverState *VAR_0, struct msghdr *VAR_1)
{
    TCPCharDriver *s = VAR_0->opaque;
    struct cmsghdr *VAR_2;
    for (VAR_2 = CMSG_FIRSTHDR(VAR_1); VAR_2; VAR_2 = CMSG_NXTHDR(VAR_1, VAR_2)) {
        int VAR_3;
        if (VAR_2->cmsg_len != CMSG_LEN(sizeof(int)) ||
            VAR_2->cmsg_level != SOL_SOCKET ||
            VAR_2->cmsg_type != SCM_RIGHTS)
            continue;
        VAR_3 = *((int *)CMSG_DATA(VAR_2));
        if (VAR_3 < 0)
            continue;
#ifndef MSG_CMSG_CLOEXEC
        qemu_set_cloexec(VAR_3);
#endif
        if (s->msgfd != -1)
            close(s->msgfd);
        s->msgfd = VAR_3;
    }
}
static void FUNC_0(CharDriverState *VAR_0, struct msghdr *VAR_1)
{ TCPCharDriver *s = VAR_0->opaque; struct cmsghdr *VAR_2; for (VAR_2 = CMSG_FIRSTHDR(VAR_1); VAR_2; VAR_2 = CMSG_NXTHDR(VAR_1, VAR_2)) { int VAR_3; if (VAR_2->cmsg_len != CMSG_LEN(sizeof(int)) ||
VAR_2->cmsg_level != SOL_SOCKET ||
VAR_2->cmsg_type != SCM_RIGHTS)
continue; VAR_3 = *((int *)CMSG_DATA(VAR_2)); if (VAR_3 < 0)
continue; #ifndef MSG_CMSG_CLOEXEC
qemu_set_cloexec(VAR_3); #endif
if (s->msgfd != -1)
close(s->msgfd); s->msgfd = VAR_3; } }