Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Mar 2021 01:01:08 +0100
From:      Piotr Kubaj <pkubaj@anongoth.pl>
To:        Neel Chauhan <nc@freebsd.org>
Cc:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   Re: svn commit: r568621 - in head/emulators: . qemu-guest-agent qemu-guest-agent/files
Message-ID:  <YFFGxH/uaRzOzp8f@KGPE-D16>
In-Reply-To: <202103162330.12GNUm9r047188@repo.freebsd.org>
References:  <202103162330.12GNUm9r047188@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--e9791wF80h3ibT5S
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 21-03-16 23:30:48, Neel Chauhan wrote:
> Author: nc
> Date: Tue Mar 16 23:30:47 2021
> New Revision: 568621
> URL: https://svnweb.freebsd.org/changeset/ports/568621
>=20
> Log:
>   New port: emulators/qemu-guest-agent: QEMU Guest Agent for FreeBSD
>  =20
>   PR:		254105
>   Submitted by:	zhecka AT gmail DOT com
>=20
> Added:
>   head/emulators/qemu-guest-agent/
>   head/emulators/qemu-guest-agent/Makefile   (contents, props changed)
>   head/emulators/qemu-guest-agent/distinfo   (contents, props changed)
>   head/emulators/qemu-guest-agent/files/
>   head/emulators/qemu-guest-agent/files/patch-Makefile   (contents, props=
 changed)
>   head/emulators/qemu-guest-agent/files/patch-configure   (contents, prop=
s changed)
>   head/emulators/qemu-guest-agent/files/patch-qga_commands-posix.c   (con=
tents, props changed)
>   head/emulators/qemu-guest-agent/files/patch-qga_main.c   (contents, pro=
ps changed)
>   head/emulators/qemu-guest-agent/files/qemu-guest-agent.in   (contents, =
props changed)
>   head/emulators/qemu-guest-agent/pkg-descr   (contents, props changed)
>   head/emulators/qemu-guest-agent/pkg-message   (contents, props changed)
>   head/emulators/qemu-guest-agent/pkg-message-11   (contents, props chang=
ed)
>   head/emulators/qemu-guest-agent/pkg-plist   (contents, props changed)
> Modified:
>   head/emulators/Makefile
>=20
> Modified: head/emulators/Makefile
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- head/emulators/Makefile	Tue Mar 16 23:22:27 2021	(r568620)
> +++ head/emulators/Makefile	Tue Mar 16 23:30:47 2021	(r568621)
> @@ -113,6 +113,7 @@
>      SUBDIR +=3D qemu
>      SUBDIR +=3D qemu-cheri
>      SUBDIR +=3D qemu-devel
> +    SUBDIR +=3D qemu-guest-agent
>      SUBDIR +=3D qemu-powernv
>      SUBDIR +=3D qemu-user-static
>      SUBDIR +=3D qemu-user-static-devel
>=20
> Added: head/emulators/qemu-guest-agent/Makefile
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- /dev/null	00:00:00 1970	(empty, because file is newly added)
> +++ head/emulators/qemu-guest-agent/Makefile	Tue Mar 16 23:30:47 2021	(r5=
68621)
> @@ -0,0 +1,183 @@
> +# Created by: Kaltashkin Eugene <zhecka@gmail.com>
> +# $FreeBSD$
> +
> +PORTNAME=3D	qemu
> +DISTVERSION=3D	5.0.1
> +CATEGORIES=3D	emulators
> +MASTER_SITES=3D	https://download.qemu.org/
> +PKGNAMESUFFIX=3D	-guest-agent
> +
> +MAINTAINER=3D	zhecka@gmail.com
> +COMMENT=3D	QEMU guest-agent utilities
> +
> +LICENSE=3D	GPLv2
> +
> +DIST_SUBDIR=3D	qemu/${PORTVERSION}
> +FILESDIR=3D	${.CURDIR}/files
Why is that necessary?


> +HAS_CONFIGURE=3D	yes
> +USES=3D		gmake gnome pkgconfig python:build tar:xz
> +USE_GNOME=3D	glib20
> +USE_RC_SUBR=3D	qemu-guest-agent
> +MAKE_ENV+=3D	BSD_MAKE=3D"${MAKE}" PREFIX=3D${PREFIX}
> +
> +CONFLICTS_INSTALL=3D	qemu-[0-9]* qemu-devel-* qemu-sbruno-*
> +OPTIONS_EXCLUDE=3DSAMBA X11 GTK3 OPENGL GNUTLS SASL JPEG PNG CURL \
> +		CDROM_DMA PCAP USBREDIR GNS3 X86_TARGETS DOCS\
> +		STATIC_LINK NCURSES VDE
> +
> +PLIST=3D		${.CURDIR}/pkg-plist
> +DESCR=3D		${.CURDIR}/pkg-descr
Same question for those 2 lines above.





> +
> +CONFIGURE_ARGS?=3D--localstatedir=3D/var --extra-ldflags=3D-L\"${LOCALBA=
SE}/lib\" \
> +		--mandir=3D${MANPREFIX}/man \
> +		--prefix=3D${PREFIX} --cc=3D${CC} --disable-kvm \
> +		--python=3D${PYTHON_CMD} \
> +		--extra-cflags=3D-I${WRKSRC}\ -I${LOCALBASE}/include\ -DPREFIX=3D\\\"\=
"${PREFIX}\\\"\"\ -DBSD_GUEST_AGENT\ -DFREEBSD \
> +		--disable-blobs \
> +		--disable-system \
> +		--disable-user \
> +		--disable-linux-user \
> +		--disable-bsd-user \
> +		--disable-docs \
> +		--enable-guest-agent \
> +		--disable-guest-agent-msi \
> +		--disable-pie \
> +		--disable-modules \
> +		--disable-module-upgrades \
> +		--disable-debug-tcg \
> +		--disable-debug-info \
> +		--disable-sparse \
> +		--disable-gnutls \
> +		--disable-nettle \
> +		--disable-gcrypt \
> +		--disable-auth-pam \
> +		--disable-sdl \
> +		--disable-sdl-image \
> +		--disable-gtk \
> +		--disable-vte \
> +		--disable-curses \
> +		--disable-iconv \
> +		--disable-vnc \
> +		--disable-vnc-sasl \
> +		--disable-vnc-jpeg \
> +		--disable-vnc-png \
> +		--disable-cocoa \
> +		--disable-virtfs \
> +		--disable-mpath \
> +		--disable-xen \
> +		--disable-xen-pci-passthrough \
> +		--disable-brlapi \
> +		--disable-curl \
> +		--disable-membarrier \
> +		--disable-fdt \
> +		--disable-kvm \
> +		--disable-hax \
> +		--disable-hvf \
> +		--disable-whpx \
> +		--disable-rdma \
> +		--disable-pvrdma \
> +		--disable-vde \
> +		--disable-netmap \
> +		--disable-linux-aio \
> +		--disable-linux-io-uring \
> +		--disable-cap-ng \
> +		--disable-attr \
> +		--disable-vhost-net \
> +		--disable-vhost-vsock \
> +		--disable-vhost-scsi \
> +		--disable-vhost-crypto \
> +		--disable-vhost-kernel \
> +		--disable-vhost-user \
> +		--disable-spice \
> +		--disable-rbd \
> +		--disable-libiscsi \
> +		--disable-libnfs \
> +		--disable-smartcard \
> +		--disable-libusb \
> +		--disable-live-block-migration \
> +		--disable-usb-redir \
> +		--disable-lzo \
> +		--disable-snappy \
> +		--disable-bzip2 \
> +		--disable-lzfse \
> +		--disable-zstd \
> +		--disable-seccomp \
> +		--disable-coroutine-pool \
> +		--disable-glusterfs \
> +		--disable-tpm \
> +		--disable-libssh \
> +		--disable-numa \
> +		--disable-libxml2 \
> +		--disable-tcmalloc \
> +		--disable-jemalloc \
> +		--disable-avx2 \
> +		--disable-avx512f \
> +		--disable-replication \
> +		--disable-opengl \
> +		--disable-virglrenderer \
> +		--disable-xfsctl \
> +		--disable-qom-cast-debug \
> +		--enable-tools \
> +		--disable-vxhs \
> +		--disable-bochs \
> +		--disable-cloop \
> +		--disable-dmg \
> +		--disable-qcow1 \
> +		--disable-vdi \
> +		--disable-vvfat \
> +		--disable-qed \
> +		--disable-parallels \
> +		--disable-sheepdog \
> +		--disable-crypto-afalg \
> +		--disable-capstone \
> +		--disable-debug-mutex \
> +		--disable-libpmem \
> +		--disable-xkbcommon
> +
> +post-install:
> +	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/qemu-*
> +	@${RM} ${STAGEDIR}${PREFIX}/bin/qemu-nbd
> +	@${RM} ${STAGEDIR}${PREFIX}/bin/qemu-edid
> +	@${RM} ${STAGEDIR}${PREFIX}/bin/qemu-img
> +	@${RM} ${STAGEDIR}${PREFIX}/bin/qemu-io
> +	@${RMDIR} ${STAGEDIR}${DATADIR}
> +	${MKDIR} ${STAGEDIR}${PREFIX}/qemu
> +
> +.include <bsd.port.options.mk>
> +
> +.if !defined(STRIP) || ${STRIP} =3D=3D ""
> +CONFIGURE_ARGS+=3D--disable-strip
> +.endif
> +
> +.if ${ARCH} =3D=3D "amd64"
> +MAKE_ARGS+=3D	ARCH=3Dx86_64
> +.endif
> +
> +.if ${ARCH} =3D=3D "powerpc"
> +MAKE_ARGS+=3D	ARCH=3Dppc
> +.endif
> +
> +.if ${ARCH} =3D=3D "powerpc64"
> +MAKE_ARGS+=3D	ARCH=3Dppc64
> +.endif
> +
> +.if ${ARCH} =3D=3D "sparc64"
> +CONFIGURE_ARGS+=3D	--sparc_cpu=3Dv9
> +.endif
> +
> +.if ${OSVERSION} < 1200000
> +PKGMESSAGE=3D	${.CURDIR}/pkg-message-11
> +.else
> +PKGMESSAGE=3D	${.CURDIR}/pkg-message
And this.






> +.endif
> +
> +PLIST_SUB+=3D	LINUXBOOT_DMA=3D""
> +
> +# XXX need to disable usb host code on head while it's not ported to the
> +# new usb stack yet
> +post-configure:
> +	@${REINPLACE_CMD} -E \
> +		-e "s|^(HOST_USB=3D)bsd|\1stub|" \
> +		${WRKSRC}/config-host.mak
> +
> +.include <bsd.port.mk>
>=20
> Added: head/emulators/qemu-guest-agent/distinfo
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- /dev/null	00:00:00 1970	(empty, because file is newly added)
> +++ head/emulators/qemu-guest-agent/distinfo	Tue Mar 16 23:30:47 2021	(r5=
68621)
> @@ -0,0 +1,7 @@
> +TIMESTAMP =3D 1603483758
> +SHA256 (qemu/5.0.1/qemu-5.0.1.tar.xz) =3D 135fab4c3699a378c9584b3453927e=
2f5002e440311f21efa66fc189d4bb4982
> +SIZE (qemu/5.0.1/qemu-5.0.1.tar.xz) =3D 62430168
> +SHA256 (qemu/5.0.1/55765822804f.patch) =3D 10c2cc93ad01b02d854e26a9e445b=
a22bb5434dda1ef25baeb979be6292fa8ef
> +SIZE (qemu/5.0.1/55765822804f.patch) =3D 2271
> +SHA256 (qemu/5.0.1/aa4d30f6618d.patch) =3D eeddc5f5e08a460d2c133b4193d11=
5fa1f00f206e0833f33ec66379981473efe
> +SIZE (qemu/5.0.1/aa4d30f6618d.patch) =3D 2211
>=20
> Added: head/emulators/qemu-guest-agent/files/patch-Makefile
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- /dev/null	00:00:00 1970	(empty, because file is newly added)
> +++ head/emulators/qemu-guest-agent/files/patch-Makefile	Tue Mar 16 23:30=
:47 2021	(r568621)
> @@ -0,0 +1,106 @@
> +--- Makefile.orig	2020-09-15 19:31:13 UTC
> ++++ Makefile
> +@@ -361,29 +361,6 @@
> + MANUAL_BUILDDIR :=3D docs
> + endif
> +=20
> +-ifdef BUILD_DOCS
> +-DOCS+=3D$(MANUAL_BUILDDIR)/system/qemu.1
> +-DOCS+=3D$(MANUAL_BUILDDIR)/tools/qemu-img.1
> +-DOCS+=3D$(MANUAL_BUILDDIR)/tools/qemu-nbd.8
> +-DOCS+=3D$(MANUAL_BUILDDIR)/interop/qemu-ga.8
> +-ifeq ($(CONFIG_LINUX)$(CONFIG_SECCOMP)$(CONFIG_LIBCAP_NG),yyy)
> +-DOCS+=3D$(MANUAL_BUILDDIR)/tools/virtiofsd.1
> +-endif
> +-DOCS+=3D$(MANUAL_BUILDDIR)/system/qemu-block-drivers.7
> +-DOCS+=3Ddocs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt do=
cs/interop/qemu-qmp-ref.7
> +-DOCS+=3Ddocs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs=
/interop/qemu-ga-ref.7
> +-DOCS+=3D$(MANUAL_BUILDDIR)/system/qemu-cpu-models.7
> +-DOCS+=3D$(MANUAL_BUILDDIR)/index.html
> +-ifdef CONFIG_VIRTFS
> +-DOCS+=3D$(MANUAL_BUILDDIR)/tools/virtfs-proxy-helper.1
> +-endif
> +-ifdef CONFIG_TRACE_SYSTEMTAP
> +-DOCS+=3D$(MANUAL_BUILDDIR)/tools/qemu-trace-stap.1
> +-endif
> +-else
> +-DOCS=3D
> +-endif
> +-
> + SUBDIR_MAKEFLAGS=3D$(if $(V),,--no-print-directory --quiet) BUILD_DIR=
=3D$(BUILD_DIR)
> + SUBDIR_DEVICES_MAK=3D$(patsubst %, %/config-devices.mak, $(filter %-sof=
tmmu, $(TARGET_DIRS)))
> + SUBDIR_DEVICES_MAK_DEP=3D$(patsubst %, %.d, $(SUBDIR_DEVICES_MAK))
> +@@ -878,10 +855,6 @@
> + 	$(call install-manual,user)
> +=20
> + install-doc: $(DOCS) install-sphinxdocs
> +-	$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
> +-	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/index.html "$(DESTDIR)$(qemu_docdir=
)"
> +-	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.html "$(DESTDIR)$(qemu_docdi=
r)"
> +-	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir=
)"
> + ifdef CONFIG_POSIX
> + 	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
> + 	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu.1 "$(DESTDIR)$(mandir)/=
man1"
> +@@ -889,21 +862,10 @@
> + 	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7"
> + 	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu-block-drivers.7 "$(DEST=
DIR)$(mandir)/man7"
> + 	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu-cpu-models.7 "$(DESTDIR=
)$(mandir)/man7"
> +-ifeq ($(CONFIG_TOOLS),y)
> +-	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-img.1 "$(DESTDIR)$(mandi=
r)/man1"
> +-	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
> +-	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-nbd.8 "$(DESTDIR)$(mandi=
r)/man8"
> +-endif
> + ifdef CONFIG_TRACE_SYSTEMTAP
> + 	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/qemu-trace-stap.1 "$(DESTDIR)=
$(mandir)/man1"
> + endif
> +-ifneq (,$(findstring qemu-ga,$(TOOLS)))
> +-	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/interop/qemu-ga.8 "$(DESTDIR)$(mand=
ir)/man8"
> +-	$(INSTALL_DATA) docs/interop/qemu-ga-ref.html "$(DESTDIR)$(qemu_docdir=
)"
> +-	$(INSTALL_DATA) docs/interop/qemu-ga-ref.txt "$(DESTDIR)$(qemu_docdir)"
> +-	$(INSTALL_DATA) docs/interop/qemu-ga-ref.7 "$(DESTDIR)$(mandir)/man7"
> + endif
> +-endif
> + ifdef CONFIG_VIRTFS
> + 	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
> + 	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/tools/virtfs-proxy-helper.1 "$(DEST=
DIR)$(mandir)/man1"
> +@@ -927,7 +889,7 @@
> + install-includedir:
> + 	$(INSTALL_DIR) "$(DESTDIR)$(includedir)"
> +=20
> +-install: all $(if $(BUILD_DOCS),install-doc) \
> ++install: all \
> + 	install-datadir install-localstatedir install-includedir \
> + 	$(if $(INSTALL_BLOBS),$(edk2-decompressed)) \
> + 	recurse-install
> +@@ -974,31 +936,12 @@
> + 			"$(DESTDIR)$(qemu_datadir)/firmware/$$x"; \
> + 	done
> + endif
> +-	for s in $(ICON_SIZES); do \
> +-		mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps"; \
> +-		$(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_$${s}.png \
> +-			"$(DESTDIR)$(qemu_icondir)/hicolor/$${s}/apps/qemu.png"; \
> +-	done; \
> +-	mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps"; \
> +-	$(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu_32x32.bmp \
> +-		"$(DESTDIR)$(qemu_icondir)/hicolor/32x32/apps/qemu.bmp"; \
> +-	mkdir -p "$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps"; \
> +-	$(INSTALL_DATA) $(SRC_PATH)/ui/icons/qemu.svg \
> +-		"$(DESTDIR)$(qemu_icondir)/hicolor/scalable/apps/qemu.svg"
> +-	mkdir -p "$(DESTDIR)$(qemu_desktopdir)"
> +-	$(INSTALL_DATA) $(SRC_PATH)/ui/qemu.desktop \
> +-		"$(DESTDIR)$(qemu_desktopdir)/qemu.desktop"
> + ifdef CONFIG_GTK
> + 	$(MAKE) -C po $@
> + endif
> + ifeq ($(CONFIG_PLUGIN),y)
> + 	$(INSTALL_DATA) $(SRC_PATH)/include/qemu/qemu-plugin.h "$(DESTDIR)$(in=
cludedir)/qemu-plugin.h"
> + endif
> +-	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
> +-	set -e; for x in $(KEYMAPS); do \
> +-		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_dat=
adir)/keymaps"; \
> +-	done
> +-	$(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadi=
r)/trace-events-all"
> +=20
> + .PHONY: ctags
> + ctags:
>=20
> Added: head/emulators/qemu-guest-agent/files/patch-configure
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- /dev/null	00:00:00 1970	(empty, because file is newly added)
> +++ head/emulators/qemu-guest-agent/files/patch-configure	Tue Mar 16 23:3=
0:47 2021	(r568621)
> @@ -0,0 +1,201 @@
> +--- configure.orig	2020-09-15 19:31:13 UTC
> ++++ configure
> +@@ -360,7 +360,7 @@
> + sdl=3D""
> + sdl_image=3D""
> + virtfs=3D""
> +-mpath=3D""
> ++mpath=3D"no"
> + vnc=3D"yes"
> + sparse=3D"no"
> + vde=3D""
> +@@ -408,7 +408,7 @@
> + modules=3D"no"
> + module_upgrades=3D"no"
> + prefix=3D"/usr/local"
> +-mandir=3D"\${prefix}/share/man"
> ++mandir=3D"\${prefix}/man"
> + datadir=3D"\${prefix}/share"
> + firmwarepath=3D"\${prefix}/share/qemu-firmware"
> + qemu_docdir=3D"\${prefix}/share/doc/qemu"
> +@@ -493,6 +493,9 @@
> + tcmalloc=3D"no"
> + jemalloc=3D"no"
> + replication=3D"yes"
> ++pcap=3D"no"
> ++pcap_create=3D"no"
> ++bpf=3D"no"
> + vxhs=3D""
> + bochs=3D"yes"
> + cloop=3D"yes"
> +@@ -509,6 +512,7 @@
> + default_devices=3D"yes"
> + plugins=3D"no"
> + fuzzing=3D"no"
> ++libudev=3D"no"
> +=20
> + supported_cpu=3D"no"
> + supported_os=3D"no"
> +@@ -904,7 +908,7 @@
> +   kvm=3D"yes"
> +   QEMU_INCLUDES=3D"-isystem \$(SRC_PATH)/linux-headers -isystem $PWD/li=
nux-headers $QEMU_INCLUDES"
> +   supported_os=3D"yes"
> +-  libudev=3D"yes"
> ++  libudev=3D"no"
> + ;;
> + esac
> +=20
> +@@ -1168,6 +1172,10 @@
> +   ;;
> +   --enable-vnc-png) vnc_png=3D"yes"
> +   ;;
> ++  --enable-pcap) pcap=3D"yes"
> ++  ;;
> ++  --disable-pcap) pcap=3D"no"
> ++  ;;
> +   --disable-slirp) slirp=3D"no"
> +   ;;
> +   --enable-slirp=3Dgit) slirp=3D"git"
> +@@ -3137,6 +3145,14 @@
> + fi
> +=20
> + ##########################################
> ++# getifaddrs (for tests/test-io-channel-socket )
> ++
> ++have_ifaddrs_h=3Dyes
> ++if ! check_include "ifaddrs.h" ; then
> ++  have_ifaddrs_h=3Dno
> ++fi
> ++
> ++##########################################
> + # VTE probe
> +=20
> + if test "$vte" !=3D "no"; then
> +@@ -3806,7 +3822,7 @@
> +         glib_libs=3D$($pkg_config --libs $i)
> +         QEMU_CFLAGS=3D"$glib_cflags $QEMU_CFLAGS"
> +         LIBS=3D"$glib_libs $LIBS"
> +-        libs_qga=3D"$glib_libs $libs_qga"
> ++        libs_qga=3D"$glib_libs -lintl $libs_qga"
> +     else
> +         error_exit "glib-$glib_req_ver $i is required to compile QEMU"
> +     fi
> +@@ -3926,7 +3942,7 @@
> + ##########################################
> + # pixman support probe
> +=20
> +-if test "$want_tools" =3D "no" && test "$softmmu" =3D "no"; then
> ++if test "$softmmu" =3D "no"; then
> +   pixman_cflags=3D
> +   pixman_libs=3D
> + elif $pkg_config --atleast-version=3D0.21.8 pixman-1 > /dev/null 2>&1; =
then
> +@@ -4957,14 +4973,6 @@
> +   fi
> +   if has makeinfo && has pod2man && test "$sphinx_ok" =3D "yes"; then
> +     docs=3Dyes
> +-  else
> +-    if test "$docs" =3D "yes" ; then
> +-      if has $sphinx_build && test "$sphinx_ok" !=3D "yes"; then
> +-        echo "Warning: $sphinx_build exists but it is either too old or=
 uses too old a Python version" >&2
> +-      fi
> +-      feature_not_found "docs" "Install texinfo, Perl/perl-podlators an=
d a Python 3 version of python-sphinx"
> +-    fi
> +-    docs=3Dno
> +   fi
> + fi
> +=20
> +@@ -5098,7 +5106,7 @@
> +=20
> + # check for libusb
> + if test "$libusb" !=3D "no" ; then
> +-    if $pkg_config --atleast-version=3D1.0.13 libusb-1.0; then
> ++    if $pkg_config libusb-1.0; then
> +         libusb=3D"yes"
> +         libusb_cflags=3D$($pkg_config --cflags libusb-1.0)
> +         libusb_libs=3D$($pkg_config --libs libusb-1.0)
> +@@ -5501,7 +5509,51 @@
> +   fi
> + fi
> +=20
> ++##########################################
> ++# pcap probe
> +=20
> ++if test "$pcap" =3D "yes" -a "$pcap" !=3D "no"; then
> ++  cat > $TMPC << EOF
> ++#include <pcap.h>
> ++int main(void) { return (pcap_lib_version() =3D=3D (char *)0 ? 1 : 0); }
> ++EOF
> ++  if test "$mingw32" =3D "no" ; then
> ++    libpcap=3D-lpcap
> ++  else
> ++    libpcap=3D-lwpcap
> ++  fi
> ++  if compile_prog "" "$libpcap" ; then
> ++    :
> ++  else
> ++    echo
> ++    echo "Error: Could not find pcap"
> ++    echo "Make sure to have the pcap libs and headers installed."
> ++    echo
> ++    exit 1
> ++  fi
> ++  cat > $TMPC << EOF
> ++#include <pcap.h>
> ++int main(void)
> ++{
> ++  char errbuf[PCAP_ERRBUF_SIZE];
> ++  return (pcap_create("foo", errbuf) =3D=3D (pcap_t *)0 ? 1 : 0);
> ++}
> ++EOF
> ++  if compile_prog "" "$libpcap" ; then
> ++    pcap_create=3D"yes"
> ++  fi
> ++  cat > $TMPC << EOF
> ++#define PCAP_DONT_INCLUDE_PCAP_BPF_H
> ++#include <pcap.h>
> ++#include <net/bpf.h>
> ++int main(void) { return (BPF_MAJOR_VERSION); }
> ++EOF
> ++  if compile_prog ; then
> ++    bpf=3D"yes"
> ++  fi
> ++  libs_softmmu=3D"$libpcap $libs_softmmu"
> ++fi # test "$pcap"
> ++
> + ##########################################
> + # check if we have open_by_handle_at
> +=20
> +@@ -6627,6 +6679,7 @@
> + echo "Block whitelist (rw) $block_drv_rw_whitelist"
> + echo "Block whitelist (ro) $block_drv_ro_whitelist"
> + echo "VirtFS support    $virtfs"
> ++echo "pcap support      $pcap"
> + echo "Multipath support $mpath"
> + echo "VNC support       $vnc"
> + if test "$vnc" =3D "yes" ; then
> +@@ -6864,6 +6917,15 @@
> + if test "$want_tools" =3D "yes" ; then
> +   echo "CONFIG_TOOLS=3Dy" >> $config_host_mak
> + fi
> ++if test "$pcap" =3D "yes" ; then
> ++  echo "CONFIG_PCAP=3Dy" >> $config_host_mak
> ++  if test "$pcap_create" =3D "yes" ; then
> ++    echo "CONFIG_PCAP_CREATE=3Dy" >> $config_host_mak
> ++  fi
> ++  if test "$bpf" =3D "yes" ; then
> ++    echo "CONFIG_BPF=3Dy" >> $config_host_mak
> ++  fi
> ++fi
> + if test "$slirp" !=3D "no"; then
> +   echo "CONFIG_SLIRP=3Dy" >> $config_host_mak
> +   echo "CONFIG_SMBD_COMMAND=3D\"$smbd\"" >> $config_host_mak
> +@@ -7120,6 +7182,9 @@
> + # if this macro is set.
> + if test "$have_fsxattr" =3D "yes" ; then
> +     echo "HAVE_FSXATTR=3Dy" >> $config_host_mak
> ++fi
> ++if test "$have_ifaddrs_h" =3D "yes" ; then
> ++    echo "HAVE_IFADDRS_H=3Dy" >> $config_host_mak
> + fi
> + if test "$have_copy_file_range" =3D "yes" ; then
> +     echo "HAVE_COPY_FILE_RANGE=3Dy" >> $config_host_mak
>=20
> Added: head/emulators/qemu-guest-agent/files/patch-qga_commands-posix.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
> --- /dev/null	00:00:00 1970	(empty, because file is newly added)
> +++ head/emulators/qemu-guest-agent/files/patch-qga_commands-posix.c	Tue =
Mar 16 23:30:47 2021	(r568621)
> @@ -0,0 +1,758 @@
> +--- qga/commands-posix.c.orig	2020-09-15 16:31:14 UTC
> ++++ qga/commands-posix.c
> +@@ -28,6 +28,21 @@
> + #include "qemu/cutils.h"
> + #include "commands-common.h"
> +=20
> ++#ifdef BSD_GUEST_AGENT
> ++#include <ifaddrs.h>
> ++#include <arpa/inet.h>
> ++#include <sys/socket.h>
> ++#include <sys/sysctl.h>
> ++#include <net/if.h>
> ++#include <sys/socket.h>
> ++#include <ifaddrs.h>
> ++#include <sys/statvfs.h>
> ++#include <net/if_dl.h>
> ++#include <net/if_types.h>
> ++#include <net/ethernet.h>
> ++#include <net/if_var.h>
> ++#endif
> ++
> + #ifdef HAVE_UTMPX
> + #include <utmpx.h>
> + #endif
> +@@ -85,14 +100,25 @@ void qmp_guest_shutdown(bool has_mode, const char *=
mod
> + {
> +     const char *shutdown_flag;
> +     Error *local_err =3D NULL;
> ++#ifdef BSD_GUEST_AGENT
> ++    char *shutdown_mode;
> ++#endif // BSD_GUEST_AGENT
> +     pid_t pid;
> +     int status;
> +=20
> +     slog("guest-shutdown called, mode: %s", mode);
> +     if (!has_mode || strcmp(mode, "powerdown") =3D=3D 0) {
> ++#ifdef BSD_GUEST_AGENT
> ++        shutdown_flag =3D "-p";
> ++#else
> +         shutdown_flag =3D "-P";
> ++#endif // BSD_GUEST_AGENT
> +     } else if (strcmp(mode, "halt") =3D=3D 0) {
> ++#ifdef BSD_GUEST_AGENT
> ++        shutdown_flag =3D "-h";
> ++#else
> +         shutdown_flag =3D "-H";
> ++#endif // BSD_GUEST_AGENT
> +     } else if (strcmp(mode, "reboot") =3D=3D 0) {
> +         shutdown_flag =3D "-r";
> +     } else {
> +@@ -108,9 +134,15 @@ void qmp_guest_shutdown(bool has_mode, const char *=
mod
> +         reopen_fd_to_null(0);
> +         reopen_fd_to_null(1);
> +         reopen_fd_to_null(2);
> ++#ifdef BSD_GUEST_AGENT
> ++        shutdown_mode =3D g_strdup_printf("hypervisor initiated %s", mo=
de);
> +=20
> ++        execle("/sbin/shutdown", "-h", shutdown_flag, "+0",
> ++               shutdown_mode, (char*)NULL, environ);
> ++#else
> +         execle("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0",
> +                "hypervisor initiated shutdown", (char*)NULL, environ);
> ++#endif // BSD_GUEST_AGENT
> +         _exit(EXIT_FAILURE);
> +     } else if (pid < 0) {
> +         error_setg_errno(errp, errno, "failed to create child process");
> +@@ -153,9 +185,11 @@ int64_t qmp_guest_get_time(Error **errp)
> + void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp)
> + {
> +     int ret;
> ++#ifndef BSD_GUEST_AGENT
> +     int status;
> +     pid_t pid;
> +     Error *local_err =3D NULL;
> ++#endif
> +     struct timeval tv;
> +     static const char hwclock_path[] =3D "/sbin/hwclock";
> +     static int hwclock_available =3D -1;
> +@@ -193,7 +227,7 @@ void qmp_guest_set_time(bool has_time, int64_t time_=
ns
> +             return;
> +         }
> +     }
> +-
> ++#ifndef BSD_GUEST_AGENT
> +     /* Now, if user has passed a time to set and the system time is set=
, we
> +      * just need to synchronize the hardware clock. However, if no time=
 was
> +      * passed, user is requesting the opposite: set the system time fro=
m the
> +@@ -230,6 +264,7 @@ void qmp_guest_set_time(bool has_time, int64_t time_=
ns
> +         error_setg(errp, "hwclock failed to set hardware clock to syste=
m time");
> +         return;
> +     }
> ++#endif // BSD_GUEST_AGENT
> + }
> +=20
> + typedef enum {
> +@@ -2625,25 +2660,263 @@ void qmp_guest_suspend_hybrid(Error **errp)
> + {
> +     error_setg(errp, QERR_UNSUPPORTED);
> + }
> +-
> ++#ifndef BSD_GUEST_AGENT
> + GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **err=
p)
> + {
> +     error_setg(errp, QERR_UNSUPPORTED);
> +     return NULL;
> + }
> ++#else
> ++static GuestNetworkInterfaceList *
> ++guest_find_interface(GuestNetworkInterfaceList *head,
> ++                     const char *name)
> ++{
> ++    for (; head; head =3D head->next) {
> ++        if (strcmp(head->value->name, name) =3D=3D 0) {
> ++            break;
> ++        }
> ++    }
> +=20
> ++    return head;
> ++}
> ++
> ++static int guest_get_network_stats(const char *name,
> ++                       GuestNetworkInterfaceStat *stats)
> ++{
> ++	return -1;
> ++}
> ++
> ++GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **err=
p)
> ++{
> ++    GuestNetworkInterfaceList *head =3D NULL, *cur_item =3D NULL;
> ++    struct ifaddrs *ifap, *ifa;
> ++
> ++    if (getifaddrs(&ifap) < 0) {
> ++        error_setg_errno(errp, errno, "getifaddrs failed");
> ++        goto error;
> ++    }
> ++
> ++    for (ifa =3D ifap; ifa; ifa =3D ifa->ifa_next) {
> ++        GuestNetworkInterfaceList *info;
> ++        GuestIpAddressList **address_list =3D NULL, *address_item =3D N=
ULL;
> ++        GuestNetworkInterfaceStat  *interface_stat =3D NULL;
> ++        char addr4[INET_ADDRSTRLEN];
> ++        char addr6[INET6_ADDRSTRLEN];
> ++        int sock;
> ++        struct ifreq ifr;
> ++        // struct ifnet ifp;
> ++        // struct if_data ifd;
> ++        // unsigned char *mac_addr;
> ++        char mac_addr[18]=3D"00:00:00:00:00:00"; // =3D char[18];
> ++        void *p;
> ++
> ++        g_debug("Processing %s interface", ifa->ifa_name);
> ++
> ++        info =3D guest_find_interface(head, ifa->ifa_name);
> ++
> ++        if (!info) {
> ++            info =3D g_malloc0(sizeof(*info));
> ++            info->value =3D g_malloc0(sizeof(*info->value));
> ++            info->value->name =3D g_strdup(ifa->ifa_name);
> ++
> ++            if (!cur_item) {
> ++                head =3D cur_item =3D info;
> ++            } else {
> ++                cur_item->next =3D info;
> ++                cur_item =3D info;
> ++            }
> ++        }
> ++
> ++        if (!info->value->has_hardware_address &&
> ++            ifa->ifa_flags & SIOCGHWADDR) {
> ++            /* we haven't obtained HW address yet */
> ++            sock =3D socket(PF_INET, SOCK_STREAM, 0);
> ++            if (sock =3D=3D -1) {
> ++                error_setg_errno(errp, errno, "failed to create socket"=
);
> ++                goto error;
> ++            }
> ++            close(sock);
> ++
> ++            memset(&ifr, 0, sizeof(ifr));
> ++            pstrcpy(ifr.ifr_name, IF_NAMESIZE, info->value->name);
> ++            // memset(&ifp, 0, sizeof(ifp));
> ++            // memset(&ifd, 0, sizeof(ifd));
> ++
> ++            if (ifa->ifa_addr->sa_family =3D=3D AF_LINK) {
> ++            	struct sockaddr_dl *sdl =3D
> ++            			(struct sockaddr_dl *)ifa->ifa_addr;
> ++
> ++                info->value->has_hardware_address =3D false;
> ++
> ++                if (sdl->sdl_type =3D=3D IFT_ETHER &&
> ++                		sdl->sdl_alen =3D=3D ETHER_ADDR_LEN) {
> ++                        snprintf(mac_addr, 18, "%s", ether_ntoa((struct=
 ether_addr *)LLADDR(sdl)));
> ++                        info->value->has_hardware_address =3D true;
> ++                }
> ++                else
> ++                {
> ++                    info->value->has_hardware_address =3D true;
> ++                }
> ++                info->value->hardware_address =3D g_strdup_printf("%s",=
 mac_addr);
> ++             }
> ++
> ++        }
> ++
> ++        if (ifa->ifa_addr &&
> ++            ifa->ifa_addr->sa_family =3D=3D AF_INET) {
> ++            /* interface with IPv4 address */
> ++            p =3D &((struct sockaddr_in *)ifa->ifa_addr)->sin_addr;
> ++            if (!inet_ntop(AF_INET, p, addr4, sizeof(addr4))) {
> ++                error_setg_errno(errp, errno, "inet_ntop failed");
> ++                goto error;
> ++            }
> ++
> ++            address_item =3D g_malloc0(sizeof(*address_item));
> ++            address_item->value =3D g_malloc0(sizeof(*address_item->val=
ue));
> ++            address_item->value->ip_address =3D g_strdup(addr4);
> ++            address_item->value->ip_address_type =3D GUEST_IP_ADDRESS_T=
YPE_IPV4;
> ++
> ++            if (ifa->ifa_netmask) {
> ++                /* Count the number of set bits in netmask.
> ++                 * This is safe as '1' and '0' cannot be shuffled in ne=
tmask. */
> ++                p =3D &((struct sockaddr_in *)ifa->ifa_netmask)->sin_ad=
dr;
> ++                address_item->value->prefix =3D ctpop32(((uint32_t *) p=
)[0]);
> ++            }
> ++        } else if (ifa->ifa_addr &&
> ++                   ifa->ifa_addr->sa_family =3D=3D AF_INET6) {
> ++            /* interface with IPv6 address */
> ++            p =3D &((struct sockaddr_in6 *)ifa->ifa_addr)->sin6_addr;
> ++            if (!inet_ntop(AF_INET6, p, addr6, sizeof(addr6))) {
> ++                error_setg_errno(errp, errno, "inet_ntop failed");
> ++                goto error;
> ++            }
> ++
> ++            address_item =3D g_malloc0(sizeof(*address_item));
> ++            address_item->value =3D g_malloc0(sizeof(*address_item->val=
ue));
> ++            address_item->value->ip_address =3D g_strdup(addr6);
> ++            address_item->value->ip_address_type =3D GUEST_IP_ADDRESS_T=
YPE_IPV6;
> ++
> ++            if (ifa->ifa_netmask) {
> ++                /* Count the number of set bits in netmask.
> ++                 * This is safe as '1' and '0' cannot be shuffled in ne=
tmask. */
> ++                p =3D &((struct sockaddr_in6 *)ifa->ifa_netmask)->sin6_=
addr;
> ++                address_item->value->prefix =3D
> ++                    ctpop32(((uint32_t *) p)[0]) +
> ++                    ctpop32(((uint32_t *) p)[1]) +
> ++                    ctpop32(((uint32_t *) p)[2]) +
> ++                    ctpop32(((uint32_t *) p)[3]);
> ++            }
> ++        }
> ++
> ++        if (!address_item) {
> ++            continue;
> ++        }
> ++
> ++        address_list =3D &info->value->ip_addresses;
> ++
> ++        while (*address_list && (*address_list)->next) {
> ++            address_list =3D &(*address_list)->next;
> ++        }
> ++
> ++        if (!*address_list) {
> ++            *address_list =3D address_item;
> ++        } else {
> ++            (*address_list)->next =3D address_item;
> ++        }
> ++
> ++        info->value->has_ip_addresses =3D true;
> ++
> ++        if (!info->value->has_statistics) {
> ++            interface_stat =3D g_malloc0(sizeof(*interface_stat));
> ++            if (guest_get_network_stats(info->value->name,
> ++                interface_stat) =3D=3D -1) {
> ++                info->value->has_statistics =3D false;
> ++                g_free(interface_stat);
> ++            } else {
> ++                info->value->statistics =3D interface_stat;
> ++                info->value->has_statistics =3D true;
> ++            }
> ++        }
> ++    }
> ++
> ++    freeifaddrs(ifap);
> ++    return head;
> ++
> ++error:
> ++    freeifaddrs(ifap);
> ++    qapi_free_GuestNetworkInterfaceList(head);
> ++    return NULL;
> ++}
> ++#endif // BSD_GUEST_AGENT
> ++
> ++#ifndef BSD_GUEST_AGENT
> + GuestLogicalProcessorList *qmp_guest_get_vcpus(Error **errp)
> + {
> +     error_setg(errp, QERR_UNSUPPORTED);
> +     return NULL;
> + }
> ++#else
> ++GuestLogicalProcessorList *qmp_guest_get_vcpus(Error **errp)
> ++{
> ++    int64_t current;
> ++    GuestLogicalProcessorList *head, **link;
> ++    long sc_max;
> ++    Error *local_err =3D NULL;
> ++    int				Query[2];
> ++    int				NumCpu =3D 0;
> ++    size_t			Length =3D sizeof(NumCpu);
> ++    Query[0] =3D CTL_HW;
> ++    Query[1] =3D HW_NCPU;
> +=20
> ++    current =3D 0;
> ++    head =3D NULL;
> ++    link =3D &head;
> ++    if (sysctl(Query, 2, &NumCpu, &Length, NULL, 0) =3D=3D -1) {
> ++        error_setg(errp, "sysctl get CTL_HW.HW_NCPU failed");
> ++    }
> ++    sc_max =3D NumCpu;
> ++
> ++    while (local_err =3D=3D NULL && current < sc_max) {
> ++        GuestLogicalProcessor *vcpu;
> ++        GuestLogicalProcessorList *entry;
> ++        int64_t id =3D current++;
> ++        // char *path =3D g_strdup_printf("/sys/devices/system/cpu/cpu%=
" PRId64 "/",
> ++        //                              id);
> ++
> ++        // if (g_file_test(path, G_FILE_TEST_EXISTS)) {
> ++        vcpu =3D g_malloc0(sizeof *vcpu);
> ++        vcpu->logical_id =3D id;
> ++        vcpu->has_can_offline =3D false; /* lolspeak ftw */
> ++        vcpu->online =3D true;
> ++        vcpu->can_offline =3D false;
> ++        // transfer_vcpu(vcpu, true, path, &local_err);
> ++        entry =3D g_malloc0(sizeof *entry);
> ++        entry->value =3D vcpu;
> ++        *link =3D entry;
> ++        link =3D &entry->next;
> ++        // }
> ++        // g_free(path);
> ++    }
> ++
> ++    if (local_err =3D=3D NULL) {
> ++        /* there's no guest with zero VCPUs */
> ++        g_assert(head !=3D NULL);
> ++        return head;
> ++    }
> ++
> ++    qapi_free_GuestLogicalProcessorList(head);
> ++    error_propagate(errp, local_err);
> ++    return NULL;
> ++}
> ++#endif // BSD_GUEST_AGENT
> ++
> + int64_t qmp_guest_set_vcpus(GuestLogicalProcessorList *vcpus, Error **e=
rrp)
> + {
> +     error_setg(errp, QERR_UNSUPPORTED);
> +     return -1;
> + }
> +=20
> ++#ifndef BSD_GUEST_AGENT
> + void qmp_guest_set_user_password(const char *username,
> +                                  const char *password,
> +                                  bool crypted,
> +@@ -2651,7 +2924,114 @@ void qmp_guest_set_user_password(const char *use=
rname,
> + {
> +     error_setg(errp, QERR_UNSUPPORTED);
> + }
> ++#else
> ++void qmp_guest_set_user_password(const char *username,
> ++                                 const char *password,
> ++                                 bool crypted,
> ++                                 Error **errp)
> ++{
> ++    Error *local_err =3D NULL;
> ++    char *pw_path =3D NULL;
> ++    pid_t pid;
> ++    int status;
> ++    int datafd[2] =3D { -1, -1 };
> ++    char *rawpasswddata =3D NULL;
> ++    size_t rawpasswdlen;
> ++    char *chpasswddata =3D NULL;
> ++    size_t chpasswdlen;
> +=20
> ++    rawpasswddata =3D (char *)qbase64_decode(password, -1, &rawpasswdle=
n, errp);
> ++    if (!rawpasswddata) {
> ++        return;
> ++    }
> ++
> ++    rawpasswddata =3D g_renew(char, rawpasswddata, rawpasswdlen + 1);
> ++    rawpasswddata[rawpasswdlen] =3D '\0';
> ++
> ++    if (strchr(rawpasswddata, '\n')) {
> ++        error_setg(errp, "forbidden characters in raw password");
> ++        goto out;
> ++    }
> ++
> ++    if (strchr(username, '\n') ||
> ++        strchr(username, ':')) {
> ++        error_setg(errp, "forbidden characters in username");
> ++        goto out;
> ++    }
> ++
> ++    chpasswddata =3D g_strdup_printf("%s", rawpasswddata);
> ++    chpasswdlen =3D strlen(chpasswddata);
> ++
> ++    pw_path =3D g_find_program_in_path("pw");
> ++
> ++    if (!pw_path) {
> ++        error_setg(errp, "cannot find 'pw' program in PATH");
> ++        goto out;
> ++    }
> ++
> ++    if (pipe(datafd) < 0) {
> ++        error_setg(errp, "cannot create pipe FDs");
> ++        goto out;
> ++    }
> ++
> ++    pid =3D fork();
> ++    if (pid =3D=3D 0) {
> ++        close(datafd[1]);
> ++        /* child */
> ++        setsid();
> ++        dup2(datafd[0], 0);
> ++        reopen_fd_to_null(1);
> ++        reopen_fd_to_null(2);
> ++
> ++        if (crypted) {
> ++            execle(pw_path, "pw", "usermod", username, "-H", "0", (char=
*)NULL, environ);
> ++        } else {
> ++            execle(pw_path, "pw", "usermod", username, "-h", "0", (char=
*)NULL, environ);
> ++        }
> ++        _exit(EXIT_FAILURE);
> ++    } else if (pid < 0) {
> ++        error_setg_errno(errp, errno, "failed to create child process");
> ++        goto out;
> ++    }
> ++    close(datafd[0]);
> ++    datafd[0] =3D -1;
> ++
> ++    if (qemu_write_full(datafd[1], chpasswddata, chpasswdlen) !=3D chpa=
sswdlen) {
> ++        error_setg_errno(errp, errno, "cannot write new account passwor=
d");
> ++        goto out;
> ++    }
> ++    close(datafd[1]);
> ++    datafd[1] =3D -1;
> ++
> ++    ga_wait_child(pid, &status, &local_err);
> ++    if (local_err) {
> ++        error_propagate(errp, local_err);
> ++        goto out;
> ++    }
> ++
> ++    if (!WIFEXITED(status)) {
> ++        error_setg(errp, "child process has terminated abnormally");
> ++        goto out;
> ++    }
> ++
> ++    if (WEXITSTATUS(status)) {
> ++        error_setg(errp, "child process has failed to set user password=
");
> ++        goto out;
> ++    }
> ++
> ++out:
> ++    g_free(chpasswddata);
> ++    g_free(rawpasswddata);
> ++    g_free(pw_path);
> ++    if (datafd[0] !=3D -1) {
> ++        close(datafd[0]);
> ++    }
> ++    if (datafd[1] !=3D -1) {
> ++        close(datafd[1]);
> ++    }
> ++}
> ++#endif // BSD_GUEST_AGENT
> ++
> + GuestMemoryBlockList *qmp_guest_get_memory_blocks(Error **errp)
> + {
> +     error_setg(errp, QERR_UNSUPPORTED);
> +@@ -2675,12 +3055,240 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_bloc=
k_info(
> +=20
> + #if !defined(CONFIG_FSFREEZE)
>=20
> *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

--e9791wF80h3ibT5S
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEycyIeNkkgohzsoorelmbhSCDnJ0FAmBRRsQACgkQelmbhSCD
nJ308Q/9EoAhyvfVnvypzP6IyCCzOnfZ0rUUNpDIdA4b9kqOCDs5seyJdw7wsSMm
i7grIuhJx+kCtD3Y1gIM5dx3AJjQr5EXqWx71RZG+LnBqVqIFiKxXK1PkSTKs2fk
NuzMpaIcpjYzFl58Tj1yJqetiZ8B8VDgwA5k4dUL69MGs0Wy4nwDLxPMg8aKll+Q
0UMygFlK+G+fP6YH8M0NGN8rJ2TvStL+unu4lgR12OClZPX3l4PMmsL+B/3jJA4L
pxPtw4foNE0WhM/q8bs7uV2HKG8qyibE1dnCpJ6KbOfgJnyTOlxdG39M+Cri4UU0
rKP9Mo4cWTTDFf+v4Q9XXqBbxG5NXxsS3Z9/q8+gpTDON4YlNhizIcfvPHKewntA
S5TK3CcdF+welNfRdo+iI0By8Ii8bxTl3HVCuzT7hUXOT4YCMesqP9jtWpuRicRe
D7W1ea8BTLLlRDrWCA3bLq22hOq+sFfdYT7Azf0fO8S1FaCJG5MWcVjUp8hi7zOQ
TZtvcZAjfBYKElMNXrpmrHlNvr0r5ASpiTUOG2S+McpmdxqVuv+2jyayuXrKpGpz
w38DcAn31pae43oMB8PqKc5TQvL8lWj5kUU0Ntj3bxEZm+9aj7s13uGiciRgOHSs
87ayGNpt5fe4x4W08UXljngKtIdTWk3X/tGWZxSMBq85OAydTE8=
=1k4Y
-----END PGP SIGNATURE-----

--e9791wF80h3ibT5S--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YFFGxH/uaRzOzp8f>