Page MenuHomeFreeBSD

bhyve: insert VM name to the VNC screen title
ClosedPublic

Authored by naito.yuichiro_gmail.com on Sep 2 2025, 1:45 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Oct 10, 10:37 PM
Unknown Object (File)
Fri, Oct 10, 10:37 PM
Unknown Object (File)
Fri, Oct 10, 10:37 PM
Unknown Object (File)
Fri, Oct 10, 10:37 PM
Unknown Object (File)
Fri, Oct 10, 4:33 PM
Unknown Object (File)
Thu, Oct 9, 5:04 PM
Unknown Object (File)
Fri, Oct 3, 2:58 PM
Unknown Object (File)
Thu, Oct 2, 5:21 PM

Details

Summary

I often use Screen Sharing on macOS for the bhyve VNC console. While I'm opening multiple screens for each VM, I hardly select the correct screen that I want to see. Because all the screen names are "bhyve". I would like to insert the VM name as the screen title.

Test Plan

The VM name is shown at the VNC screen title like "bhyve:<vm name>". (<vm name> should be replaced with your VM name.)

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj added inline comments.
usr.sbin/bhyve/rfb.c
280

Rather than allocating the string here each time one connects and trying to handle allocation failure, IMO it'd be better to allocate the string once in rfb_init(), and just keep a pointer in struct rfb_softc. If the allocation fails, handle it in rfb_init() like we do with other errors.

usr.sbin/bhyve/rfb.c
280

OK. It's a nice idea. I'll move asprintf() allocation to rfb_init().

I moved the screen name initialization into the rfb_init() function and hold the title name on the rfb_softc.
I added an argument of rfb_softc to the rfb_send_server_init_msg() function to pass the title name.
To be consistent with the other *_msg() function, rfb_send_server_init_msg() should have 2 arguments, rfb_softc and the cfd socket.

Nice idea, hopefully this will be backported.

Looks ok to me. IMO it is unnecessary to store the string length in the softc, but it's ok.

This revision is now accepted and ready to land.Sep 3 2025, 3:40 PM
This revision was automatically updated to reflect the committed changes.

@markj , would you mind to backport it as well? Very useful!

@markj , would you mind to backport it as well? Very useful!

Yes, that's what "MFC after" in the commit log message refers to.

@markj , would you mind to backport it as well? Very useful!

Yes, that's what "MFC after" in the commit log message refers to.

My bad, it wasn't present in the initial summary. Looking forward to this change.