Skip to content

[PAL/vm-common] Emulate PAL_HANDLE_FD_HANG_UP/PAL_WAIT_HANG_UP #4

@dimakuv

Description

@dimakuv

The PAL_HANDLE_FD_HANG_UP/PAL_WAIT_HANG_UP events correspond to normal POSIX POLLHUP events (hang up, e.g. in case of a pipe/stream socket when one end of the channel was shutdown).

Currently the VM PALs never return these events, instead they simply return PAL_HANDLE_FD_ERROR/PAL_WAIT_ERROR.

See related code:

  • if (!pipe_buf->readable && !pipe_buf->writable) {
    /* pipe was shutdown */
    handle->flags |= PAL_HANDLE_FD_ERROR; /* TODO: maybe PAL_HANDLE_FD_HANG_UP? */
    revents = PAL_WAIT_ERROR; /* TODO: maybe PAL_WAIT_HANG_UP? */
    goto out;
    }
  • long peeked = virtio_vsock_peek(handle->sock.fd);
    if (peeked < 0) {
    /* socket is invalid or was shutdown or in the process of closing */
    handle->flags |= PAL_HANDLE_FD_ERROR;
    *out_events = PAL_WAIT_ERROR;
    spinlock_unlock(&handle->sock.lock);
    return 0;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions