Skip to content

vhost-device-vsock (and maybe others): how do I know when it's listening? #873

@allisonkarlitskaya

Description

@allisonkarlitskaya

Maybe this is already possible and I just missed it. I'm sorry if so...

I want to run vhost-device-vsock and then run qemu but if I want to avoid a race, I need to make sure that vhost-device-vsock has bound and started listening on the --socket first. Just about the only apparent mechanism I have for doing that is to poll on the expected socket filename waiting for it to appear.

A few alternatives:

  • let me bind and listen the socket and I can pass it to you via fd, avoiding races
  • you can close stdout once startup is complete (ssh does this when becoming the control master with no command of its own)
  • let me pass you an fd that you close once startup is complete, similar to bwrap. I can give you the write side of a pipe that I read on to find out when you're ready.

Some not so great alternatives:

  • implement some sd_notify sort of protocol (too complicated)
  • daemon mode where the spawned process exit()s once the daemon is running (too complicated, too difficult to control lifecycle)

If we're gonna be doing some sort of fd passing approach then it might also be nice if I could pass an fd which you poll on and exit when it closes (ie: I give you the read side of a pipe which I hold the writer to).

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