Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dimakuv opened this issue Jan 3, 2024 · 0 comments
Open

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

dimakuv opened this issue Jan 3, 2024 · 0 comments

Comments

@dimakuv
Copy link

dimakuv commented Jan 3, 2024

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;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant