From nobody Wed Sep 3 15:44:39 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cH6P4151Rz66d4b; Wed, 03 Sep 2025 15:44:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cH6P405Pkz3xH2; Wed, 03 Sep 2025 15:44:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1756914280; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BGLo66UnwQkRoh6nFwBuTgP+VY0P/sAsswigz7vyzXQ=; b=r/OUqM9mnSmY6unOyEhCM6dmx1JjUm0s8hwYT0dyIPd55ScCQQAjLBSPeTj7qCQ2HDXsCg 1csOyTrwQEJAkNMVSTN/fk1GaHTgwjJRiHxl2HT+Q9pG7KggeO65E2GyKwf+lsfMgZgzcx pKdUrZjlXB0SMHQTLw399Dk4lhtTYl9ZHKXSPD22L/vjJkMvkLkFlkmaYW1UenH2xBPIZT t38p4EzSC80Egt2AoKfvOd5QxzFFJZMIBpSk7wJLutViBNKwUidrDZMq6xxmInxjM2TkPH KeJV0ig1a1vbLsUXj0zH84BN5h82ixks0Zzr7rZ0PUF3CQBG9uOugEg5chiB3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1756914280; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BGLo66UnwQkRoh6nFwBuTgP+VY0P/sAsswigz7vyzXQ=; b=rG9qRdoLqp3nih4jDh5nIMKbAvn+hm4HDEPP/ETWxSU8uvRCXF3TDRXQ6/uJjJaLays5sE 6J5YE/LpcmK0CQx/Fy+xn1LfvzaXRJHdE4mBZuO4xcMN5LiFcp5hrAnVnIzZN8zzKtGB/R NwaSFa1vGBIppyETR895cwyaDQIYiVcuWIf0472uxuUZ0xoa7MqvAegLWma3Z5lxzuah/T 4QqUr4eA9DjJt3ZnSIcfI21QXzAH6HqA//pX8zEShmKKfd7apsHrsym/Fdd4toGaLct/yo clvNJARgx/+1i2Dd+FkkAd41ZmRAJDasmNYMMcKIVLPtbMr2B57xXpEn2DJRlA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1756914280; a=rsa-sha256; cv=none; b=gLKqGZJRxBNB7tSRHxAbnLEGL0cHliRjeIrHoeYiv6HPLatG6tExiKzQFh1jK/ZP3xCC93 +355cZIO3jM1+rIIgeiDIDU+yBvEt5E83atG6yDgUIxhPcTD0FrakPbLF6wgbx7srgaa2I b9zAM0cfyyaGdIWVN7aRxGhxymOFNvIhXIlg1QRzH9C00r0wh7JO/ugem/zCYPvRInK5ac qcEvI2MA86B7t+6iI7pEkWSEme/FsUVVY727D8lZUW6u59Am6zPZcCpc/IoQrGjH7vRJOQ d89JtJ+gOe+7T0h5Dp3o0wytd0DghJ7wsgv1kFqIOlKY1NdleezUC/rM2yuoTw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cH6P36l7sz7Cq; Wed, 03 Sep 2025 15:44:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 583Fidr9039114; Wed, 3 Sep 2025 15:44:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 583FidJw039111; Wed, 3 Sep 2025 15:44:39 GMT (envelope-from git) Date: Wed, 3 Sep 2025 15:44:39 GMT Message-Id: <202509031544.583FidJw039111@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 0e7f8abb4526 - main - bhyve: insert VM name to the VNC screen title List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0e7f8abb45263c780a4b448fb52af6b6a3cbc9fd Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0e7f8abb45263c780a4b448fb52af6b6a3cbc9fd commit 0e7f8abb45263c780a4b448fb52af6b6a3cbc9fd Author: Yuichiro NAITO AuthorDate: 2025-09-03 15:43:33 +0000 Commit: Mark Johnston CommitDate: 2025-09-03 15:43:33 +0000 bhyve: insert VM name to the VNC screen title Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D52329 --- usr.sbin/bhyve/rfb.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/usr.sbin/bhyve/rfb.c b/usr.sbin/bhyve/rfb.c index 6af374a83bbe..716e191e2fc0 100644 --- a/usr.sbin/bhyve/rfb.c +++ b/usr.sbin/bhyve/rfb.c @@ -63,6 +63,7 @@ #include "bhyvegc.h" #include "debug.h" #include "console.h" +#include "config.h" #include "rfb.h" #include "sockstream.h" @@ -152,6 +153,8 @@ struct rfb_softc { struct pixfmt pixfmt; /* owned by the write thread */ struct pixfmt new_pixfmt; /* managed with pixfmt_mtx */ uint32_t *pixrow; + char *fbname; + int fbnamelen; }; struct rfb_pixfmt { @@ -262,7 +265,7 @@ struct rfb_cuttext_msg { }; static void -rfb_send_server_init_msg(int cfd) +rfb_send_server_init_msg(struct rfb_softc *rc, int cfd) { struct bhyvegc_image *gc_image; struct rfb_srvr_info sinfo; @@ -284,9 +287,9 @@ rfb_send_server_init_msg(int cfd) sinfo.pixfmt.pad[0] = 0; sinfo.pixfmt.pad[1] = 0; sinfo.pixfmt.pad[2] = 0; - sinfo.namelen = htonl(strlen("bhyve")); + sinfo.namelen = htonl(rc->fbnamelen); (void)stream_write(cfd, &sinfo, sizeof(sinfo)); - (void)stream_write(cfd, "bhyve", strlen("bhyve")); + (void)stream_write(cfd, rc->fbname, rc->fbnamelen); } static void @@ -1144,7 +1147,7 @@ report_and_done: len = stream_read(cfd, buf, 1); /* 4a. Write server-init info */ - rfb_send_server_init_msg(cfd); + rfb_send_server_init_msg(rc, cfd); if (!rc->zbuf) { rc->zbuf = malloc(RFB_ZLIB_BUFSZ + 16); @@ -1276,6 +1279,13 @@ rfb_init(const char *hostname, int port, int wait, const char *password) rc->password = password; + rc->fbnamelen = asprintf(&rc->fbname, "bhyve:%s", + get_config_value("name")); + if (rc->fbnamelen < 0) { + EPRINTLN("rfb: failed to allocate memory for VNC title"); + goto error; + } + rc->pixrow = malloc(RFB_MAX_WIDTH * sizeof(uint32_t)); if (rc->pixrow == NULL) { EPRINTLN("rfb: failed to allocate memory for pixrow buffer"); @@ -1358,6 +1368,7 @@ rfb_init(const char *hostname, int port, int wait, const char *password) free(rc->crc); free(rc->crc_tmp); free(rc->pixrow); + free(rc->fbname); free(rc); return (-1); }