Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Aug 2020 06:13:14 +0000 (UTC)
From:      Alexey Dokuchaev <danfe@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r544024 - in head/misc: . hxtools hxtools/files
Message-ID:  <202008030613.0736DEVY009198@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: danfe
Date: Mon Aug  3 06:13:13 2020
New Revision: 544024
URL: https://svnweb.freebsd.org/changeset/ports/544024

Log:
  This is the collection of tools and scripts for different tasks written
  by Jan Engelhardt, each of which seems to be too small to warrant their
  own project.
  
  WWW: http://inai.de/projects/hxtools/

Added:
  head/misc/hxtools/
  head/misc/hxtools/Makefile   (contents, props changed)
  head/misc/hxtools/distinfo   (contents, props changed)
  head/misc/hxtools/files/
  head/misc/hxtools/files/patch-sadmin_hxnetload   (contents, props changed)
  head/misc/hxtools/files/patch-sadmin_ofl.c   (contents, props changed)
  head/misc/hxtools/files/patch-sadmin_pmap__dirty   (contents, props changed)
  head/misc/hxtools/files/patch-sadmin_proc__iomem__count.c   (contents, props changed)
  head/misc/hxtools/files/patch-sadmin_psthreads.c   (contents, props changed)
  head/misc/hxtools/files/patch-sadmin_utmp__register.c   (contents, props changed)
  head/misc/hxtools/files/patch-sadmin_xfs__irecover.c   (contents, props changed)
  head/misc/hxtools/files/patch-sdevel_cctypeinfo.c   (contents, props changed)
  head/misc/hxtools/files/patch-sdevel_paddrspacesize   (contents, props changed)
  head/misc/hxtools/files/patch-smm_hcdplay.c   (contents, props changed)
  head/misc/hxtools/files/patch-smm_vfalib.hpp   (contents, props changed)
  head/misc/hxtools/files/patch-smm_vfontas.cpp   (contents, props changed)
  head/misc/hxtools/files/patch-suser_sysinfo.c   (contents, props changed)
  head/misc/hxtools/pkg-descr   (contents, props changed)
  head/misc/hxtools/pkg-plist   (contents, props changed)
Modified:
  head/misc/Makefile

Modified: head/misc/Makefile
==============================================================================
--- head/misc/Makefile	Mon Aug  3 06:06:33 2020	(r544023)
+++ head/misc/Makefile	Mon Aug  3 06:13:13 2020	(r544024)
@@ -169,6 +169,7 @@
     SUBDIR += histring
     SUBDIR += hotkeys
     SUBDIR += hulgalugha
+    SUBDIR += hxtools
     SUBDIR += ignition-fuel-tools
     SUBDIR += iio-oscilloscope
     SUBDIR += imerge

Added: head/misc/hxtools/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/hxtools/Makefile	Mon Aug  3 06:13:13 2020	(r544024)
@@ -0,0 +1,52 @@
+# Created by: Alexey Dokuchaev <danfe@FreeBSD.org>
+# $FreeBSD$
+
+PORTNAME=	hxtools
+DISTVERSION=	20200712
+CATEGORIES=	misc
+MASTER_SITES=	http://inai.de/files/hxtools/
+
+MAINTAINER=	danfe@FreeBSD.org
+COMMENT=	Collection of miscellaneous tools and scripts
+
+LIB_DEPENDS=	libHX.so:lang/libhx libpci.so:devel/libpci
+RUN_DEPENDS=	bash:shells/bash
+
+USES=		compiler:c++11-lang iconv perl5 pkgconfig shebangfix \
+		tar:xz xorg
+GNU_CONFIGURE=	yes
+SHEBANG_FILES=	data/hxtools_bashrc.bash data/hxtools_profile.bash \
+		examples/colortable examples/git-deconstruct examples/neon \
+		examples/rc4 examples/unitable sadmin/hxnetload \
+		sadmin/ldif-duplicate-attrs sadmin/ldif-leading-spaces \
+		sadmin/logontime sadmin/pmap_dirty sadmin/recursive_lower \
+		sadmin/vcsaview sdevel/checkbrack sdevel/cwdiff \
+		sdevel/diff2php sdevel/doxygen-kerneldoc-filter \
+		sdevel/git-author-stat sdevel/git-blame-stats \
+		sdevel/git-forest sdevel/git-revert-stats \
+		sdevel/git-track sdevel/man2html sdevel/paddrspacesize \
+		sdevel/proc_stat_signal_decode sdevel/sourcefuncsize \
+		sdevel/spec-beautifier smm/aumeta smm/extract_d3pkg \
+		smm/extract_dfqshared.pm smm/extract_dxhog \
+		smm/extract_f3pod smm/extract_qupak smm/gpsh smm/mkvappend \
+		smm/mod2opus smm/ssa2srt suser/fxterm suser/mailsplit \
+		suser/pegrep suser/pesubst suser/qpdecode suser/qtar \
+		suser/rezip suser/wktimer
+USE_PERL5=	run
+USE_XORG=	xcb
+
+OPTIONS_DEFINE=	DOCS EXAMPLES
+
+post-patch:
+	@${REINPLACE_CMD} -E 's,(/usr)?/bin,${LOCALBASE}/bin,g' \
+		${WRKSRC}/sadmin/su1
+
+post-install-DOCS-on:
+	@${MKDIR} ${STAGEDIR}${DOCSDIR}
+	${INSTALL_DATA} ${WRKSRC}/doc/NEWS.txt ${STAGEDIR}${DOCSDIR}
+
+post-install-EXAMPLES-on:
+	@${MKDIR} ${STAGEDIR}${EXAMPLESDIR}
+	${INSTALL_DATA} ${WRKSRC}/examples/* ${STAGEDIR}${EXAMPLESDIR}
+
+.include <bsd.port.mk>

Added: head/misc/hxtools/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/hxtools/distinfo	Mon Aug  3 06:13:13 2020	(r544024)
@@ -0,0 +1,3 @@
+TIMESTAMP = 1594547101
+SHA256 (hxtools-20200712.tar.xz) = 08bdbd32b54daf39bc44e222e7cc95e1d53dd2892ee075b70f479899567e62d0
+SIZE (hxtools-20200712.tar.xz) = 208032

Added: head/misc/hxtools/files/patch-sadmin_hxnetload
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/hxtools/files/patch-sadmin_hxnetload	Mon Aug  3 06:13:13 2020	(r544024)
@@ -0,0 +1,23 @@
+--- sadmin/hxnetload.orig	2020-07-12 09:44:16 UTC
++++ sadmin/hxnetload
+@@ -28,11 +28,11 @@ else
+ fi;
+ 
+ while :; do
+-	cat /proc/net/dev | grep " $1" | cut -f 2 -d:;
++	cat /compat/linux/proc/net/dev | grep " $1" | cut -f 2 -d:;
+ 	"$sleeper" $wait;
+ done | perl -pe '$|=1;s/.*://' | while read rxcnt rxpkt c d e f g h txcnt txpkt; do
+ 	if [ "$all" != "" ]; then
+-		now="`cat /proc/uptime | cut -f 1 -d " " | sed s/"\."//g`";
++		now="`cat /compat/linux/proc/uptime | cut -f 1 -d " " | sed s/"\."//g`";
+ 		[ $[$now-$oldtm] -eq 0 ] && continue;
+ 		rxbytes=$[($rxcnt-$oldrx)*100/($now-$oldtm)];
+ 		rxint=$[$rxbytes/1024];
+@@ -48,5 +48,5 @@ done | perl -pe '$|=1;s/.*://' | while read rxcnt rxpk
+ 	all=$[$rxcnt+$txcnt];
+ 	oldrx=$rxcnt;
+ 	oldtx=$txcnt;
+-	oldtm="`cat /proc/uptime | cut -f 1 -d " " | sed s/"\."//g`";
++	oldtm="`cat /compat/linux/proc/uptime | cut -f 1 -d " " | sed s/"\."//g`";
+ done;

Added: head/misc/hxtools/files/patch-sadmin_ofl.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/hxtools/files/patch-sadmin_ofl.c	Mon Aug  3 06:13:13 2020	(r544024)
@@ -0,0 +1,57 @@
+--- sadmin/ofl.c.orig	2020-07-12 09:44:16 UTC
++++ sadmin/ofl.c
+@@ -42,7 +42,7 @@ static const char *ofl_comm(pid_t pid, char *buf, size
+ 	const char *p;
+ 	ssize_t ret;
+ 
+-	snprintf(src, sizeof(src), "/proc/%u/exe", (unsigned int)pid);
++	snprintf(src, sizeof(src), "/compat/linux/proc/%u/exe", (unsigned int)pid);
+ 	ret = readlink(src, dst, sizeof(dst) - 1);
+ 	if (ret < 0) {
+ 		*buf = '\0';
+@@ -227,7 +227,7 @@ static bool ofl(const char *mnt, unsigned int signum)
+ 	char tmp[256];
+ 	struct HXdir *dir;
+ 
+-	dir = HXdir_open("/proc");
++	dir = HXdir_open("/compat/linux/proc");
+ 	if (dir == NULL)
+ 		return false;
+ 	while ((de = HXdir_read(dir)) != NULL) {
+@@ -236,30 +236,30 @@ static bool ofl(const char *mnt, unsigned int signum)
+ 		data.pid = strtoul(de, NULL, 0);
+ 		if (data.pid == 0)
+ 			continue;
+-		snprintf(tmp, sizeof(tmp), "/proc/%s", de);
++		snprintf(tmp, sizeof(tmp), "/compat/linux/proc/%s", de);
+ 		if (lstat(tmp, &data.sb) < 0 || !S_ISDIR(data.sb.st_mode))
+ 			continue;
+ 
+ 		/* Program map */
+-		snprintf(tmp, sizeof(tmp), "/proc/%s/maps", de);
++		snprintf(tmp, sizeof(tmp), "/compat/linux/proc/%s/maps", de);
+ 		if (ofl_pmap(mnt, tmp, &data))
+ 			continue;
+ 
+ 		/* Basic links */
+ 		data.check = true;
+-		snprintf(tmp, sizeof(tmp), "/proc/%s/root", de);
++		snprintf(tmp, sizeof(tmp), "/compat/linux/proc/%s/root", de);
+ 		if (ofl_one(mnt, tmp, &data))
+ 			continue;
+-		snprintf(tmp, sizeof(tmp), "/proc/%s/cwd", de);
++		snprintf(tmp, sizeof(tmp), "/compat/linux/proc/%s/cwd", de);
+ 		if (ofl_one(mnt, tmp, &data))
+ 			continue;
+-		snprintf(tmp, sizeof(tmp), "/proc/%s/exe", de);
++		snprintf(tmp, sizeof(tmp), "/compat/linux/proc/%s/exe", de);
+ 		if (ofl_one(mnt, tmp, &data))
+ 			continue;
+ 
+ 		/* All file descriptors */
+ 		data.check = false;
+-		snprintf(tmp, sizeof(tmp), "/proc/%s/task", de);
++		snprintf(tmp, sizeof(tmp), "/compat/linux/proc/%s/task", de);
+ 		ofl_task(mnt, tmp, &data);
+ 	}
+ 

Added: head/misc/hxtools/files/patch-sadmin_pmap__dirty
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/hxtools/files/patch-sadmin_pmap__dirty	Mon Aug  3 06:13:13 2020	(r544024)
@@ -0,0 +1,32 @@
+--- sadmin/pmap_dirty.orig	2020-07-12 09:44:16 UTC
++++ sadmin/pmap_dirty
+@@ -25,9 +25,9 @@ my %total_counter;
+ 
+ if (scalar(@ARGV) == 0) {
+ 	@ARGV = sort { $a <=> $b } map {
+-		$_ = ($_ =~ m{^/proc/(\d+)$})[0];
++		$_ = ($_ =~ m{^/compat/linux/proc/(\d+)$})[0];
+ 		(!defined($_) || $_ eq "") ? () : $_
+-	} glob("/proc/*");
++	} glob("/compat/linux/proc/*");
+ }
+ 
+ &print_one();
+@@ -35,7 +35,7 @@ if (scalar(@ARGV) == 0) {
+ foreach my $pid (@ARGV) {
+ 	my $proc_name;
+ 	my $fh;
+-	open($fh, "< /proc/$pid/smaps");
++	open($fh, "< /compat/linux/proc/$pid/smaps");
+ 
+ 	my %counter = (
+ 		Private_Dirty => 0,
+@@ -50,7 +50,7 @@ foreach my $pid (@ARGV) {
+ 	}
+ 
+ 	close $fh;
+-	if (open($fh, "</proc/$pid/stat")) {
++	if (open($fh, "</compat/linux/proc/$pid/stat")) {
+ 		($proc_name) = (<$fh> =~ /^.*?\((.*)\)/);
+ 		close $fh;
+ 	}

Added: head/misc/hxtools/files/patch-sadmin_proc__iomem__count.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/hxtools/files/patch-sadmin_proc__iomem__count.c	Mon Aug  3 06:13:13 2020	(r544024)
@@ -0,0 +1,20 @@
+--- sadmin/proc_iomem_count.c.orig	2020-07-12 09:44:16 UTC
++++ sadmin/proc_iomem_count.c
+@@ -17,7 +17,7 @@
+ 
+ static int main2(int argc, const char **argv)
+ {
+-	const char *file = "/proc/iomem";
++	const char *file = "/compat/linux/proc/iomem";
+ 	uint64_t start, end;
+ 	hxmc_t *ln = NULL;
+ 	char *e;
+@@ -28,7 +28,7 @@ static int main2(int argc, const char **argv)
+ 
+ 	fp = fopen(file, "r");
+ 	if (fp == NULL) {
+-		fprintf(stderr, "fopen: /proc/iomem: %s\n", strerror(errno));
++		fprintf(stderr, "fopen: /compat/linux/proc/iomem: %s\n", strerror(errno));
+ 		return EXIT_FAILURE;
+ 	}
+ 

Added: head/misc/hxtools/files/patch-sadmin_psthreads.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/hxtools/files/patch-sadmin_psthreads.c	Mon Aug  3 06:13:13 2020	(r544024)
@@ -0,0 +1,41 @@
+--- sadmin/psthreads.c.orig	2020-07-12 09:44:16 UTC
++++ sadmin/psthreads.c
+@@ -141,15 +141,15 @@ static struct kps_proc_data *kps_proc_read_one(unsigne
+ 	HXlist_init(&task->process_children);
+ 	task->cmdlen = 0;
+ 
+-	snprintf(buf, sizeof(buf), "/proc/%u/cmdline", pid);
++	snprintf(buf, sizeof(buf), "/compat/linux/proc/%u/cmdline", pid);
+ 	if ((fd = open(buf, O_RDONLY)) >= 0)
+ 		kps_read_cmdline(task, fd);
+ 
+-	snprintf(buf, sizeof(buf), "/proc/%u/status", pid);
++	snprintf(buf, sizeof(buf), "/compat/linux/proc/%u/status", pid);
+ 	if ((fp = fopen(buf, "r")) != NULL)
+ 		kps_read_status(task, fp);
+ 
+-	snprintf(buf, sizeof(buf), "/proc/%u/stat", pid);
++	snprintf(buf, sizeof(buf), "/compat/linux/proc/%u/stat", pid);
+ 	if ((fp = fopen(buf, "r")) != NULL)
+ 		kps_read_stat(task, fp);
+ 
+@@ -162,8 +162,8 @@ static void kps_proc_read(struct HXmap *tree)
+ 	char buf[64];
+ 	struct HXdir *dproc, *dthr;
+ 
+-	if ((dproc = HXdir_open("/proc")) == NULL) {
+-		fprintf(stderr, "Could not open /proc: %s\n", strerror(errno));
++	if ((dproc = HXdir_open("/compat/linux/proc")) == NULL) {
++		fprintf(stderr, "Could not open /compat/linux/proc: %s\n", strerror(errno));
+ 		return;
+ 	}
+ 
+@@ -175,7 +175,7 @@ static void kps_proc_read(struct HXmap *tree)
+ 		if (end == dentry || *end != '\0')
+ 			continue;
+ 
+-		snprintf(buf, sizeof(buf), "/proc/%u/task", tgid);
++		snprintf(buf, sizeof(buf), "/compat/linux/proc/%u/task", tgid);
+ 		if ((dthr = HXdir_open(buf)) == NULL) {
+ 			fprintf(stderr, "Could not open %s: %s\n", buf, strerror(errno));
+ 			continue;

Added: head/misc/hxtools/files/patch-sadmin_utmp__register.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/hxtools/files/patch-sadmin_utmp__register.c	Mon Aug  3 06:13:13 2020	(r544024)
@@ -0,0 +1,50 @@
+--- sadmin/utmp_register.c.orig	2020-07-12 09:44:16 UTC
++++ sadmin/utmp_register.c
+@@ -71,8 +71,10 @@ static bool get_options(int *argc, const char ***argv)
+ 		 .help = "Perform operation on lastlog"},
+ 		{.sh = 'U', .type = HXTYPE_NONE, .ptr = &Opt.op_utmp,
+ 		 .help = "Perform operation on UTMP"},
++#if 0
+ 		{.sh = 'W', .type = HXTYPE_NONE, .ptr = &Opt.op_wtmp,
+ 		 .help = "Perform operation on WTMP"},
++#endif
+ 		{.sh = 'e', .type = HXTYPE_NONE, .ptr = &Opt.epid,
+ 		 .help = "Encode PID into ut_id"},
+ 		{.sh = 'h', .type = HXTYPE_STRING, .ptr = &Opt.host,
+@@ -87,8 +89,10 @@ static bool get_options(int *argc, const char ***argv)
+ 		 .help = "Unique ID 2", .htyp = "sess"},
+ 		{.sh = 'u', .type = HXTYPE_STRING, .ptr = &Opt.futmp,
+ 		 .help = "Path to utmp"},
++#if 0
+ 		{.sh = 'w', .type = HXTYPE_STRING, .ptr = &Opt.fwtmp,
+ 		 .help = "Path to wtmp"},
++#endif
+ 		HXOPT_AUTOHELP,
+ 		HXOPT_TABLEEND,
+ 	};
+@@ -181,8 +185,10 @@ static int main2(int argc, const char **argv)
+ 			setutxent();
+ 			pututxline(&entry);
+ 		}
++#if 0
+ 		if (Opt.op_wtmp)
+ 			updwtmpx(Opt.fwtmp, &entry);
++#endif
+ 		if (Opt.op_lastlog)
+ 			update_lastlog(Opt.flastlog, &entry);
+ 	}
+@@ -193,11 +199,13 @@ static int main2(int argc, const char **argv)
+ 			setutxent();
+ 			pututxline(&entry);
+ 		}
++#if 0
+ 		if (Opt.op_wtmp)
+ 			updwtmpx(Opt.fwtmp, &entry);
++#endif
+ 	}
+ 
+-	endutent();
++	endutxent();
+ 	return EXIT_SUCCESS;
+ }
+ 

Added: head/misc/hxtools/files/patch-sadmin_xfs__irecover.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/hxtools/files/patch-sadmin_xfs__irecover.c	Mon Aug  3 06:13:13 2020	(r544024)
@@ -0,0 +1,11 @@
+--- sadmin/xfs_irecover.c.orig	2020-07-12 09:44:16 UTC
++++ sadmin/xfs_irecover.c
+@@ -42,7 +42,7 @@
+ #include <libHX/proc.h>
+ #include <libHX/string.h>
+ #include <arpa/inet.h>
+-#include <linux/types.h>
++#include <infiniband/types.h>
+ 
+ struct work_info {
+ 	char *device;

Added: head/misc/hxtools/files/patch-sdevel_cctypeinfo.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/hxtools/files/patch-sdevel_cctypeinfo.c	Mon Aug  3 06:13:13 2020	(r544024)
@@ -0,0 +1,30 @@
+--- sdevel/cctypeinfo.c.orig	2020-07-12 09:44:16 UTC
++++ sdevel/cctypeinfo.c
+@@ -6,6 +6,7 @@
+  *	modify it under the terms of the WTF Public License version 2 or
+  *	(at your option) any later version.
+  */
++#include <sys/socket.h>
+ #include <stdint.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -61,9 +62,6 @@ p(intptr_t);
+ p(wchar_t);
+ p(size_t);
+ p(off_t);
+-#ifdef HAVE_LOFF_T
+-p(loff_t)
+-#endif
+ p(uint8_t);
+ p(uint16_t);
+ p(uint32_t);
+@@ -98,9 +96,6 @@ int main(void)
+ 	t(size_t);
+ 	t(wchar_t);
+ 	t(off_t);
+-#ifdef HAVE_LOFF_T
+-	t(loff_t);
+-#endif
+ 	t(uint8_t);
+ 	t(uint16_t);
+ 	t(uint32_t);

Added: head/misc/hxtools/files/patch-sdevel_paddrspacesize
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/hxtools/files/patch-sdevel_paddrspacesize	Mon Aug  3 06:13:13 2020	(r544024)
@@ -0,0 +1,11 @@
+--- sdevel/paddrspacesize.orig	2020-07-12 09:44:16 UTC
++++ sdevel/paddrspacesize
+@@ -18,7 +18,7 @@ foreach my $line (@list) {
+ 	my($pid, $reset) = ($line =~ /^\s*(\d+)\s+(.*)/);
+ 	my $bitness = 0;
+ 
+-	if (!open(FH, "</proc/$pid/maps")) {
++	if (!open(FH, "</compat/linux/proc/$pid/maps")) {
+ 		next;
+ 	}
+ 

Added: head/misc/hxtools/files/patch-smm_hcdplay.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/hxtools/files/patch-smm_hcdplay.c	Mon Aug  3 06:13:13 2020	(r544024)
@@ -0,0 +1,115 @@
+--- smm/hcdplay.c.orig	2020-07-12 09:44:16 UTC
++++ smm/hcdplay.c
+@@ -15,16 +15,18 @@
+ #include <unistd.h>
+ #include <libHX/option.h>
+ #include <sys/ioctl.h>
+-#include <linux/cdrom.h>
+-#define DEFAULT_ROM "/dev/sr0"
++#include <sys/cdio.h>
++#define DEFAULT_ROM "/dev/cd0"
+ 
+ static char *cdev;
+ static unsigned int dump_toc, do_start, do_pause, do_resume;
+-static unsigned int do_play, do_stop, do_eject;
++static unsigned int do_play, do_stop, do_eject, do_close;
+ 
+ static bool cdp_get_options(int *argc, const char ***argv)
+ {
+ 	static const struct HXoption option_table[] = {
++		{.sh = 'C', .ln = "close",  .type = HXTYPE_NONE, .ptr = &do_close,
++		 .help = "Close the CD-ROM"},
+ 		{.sh = 'D', .ln = "device", .type = HXTYPE_STRING, .ptr = &cdev,
+ 		 .help = "CD-ROM device path", .htyp = "FILE"},
+ 		{.sh = 'E', .ln = "eject",  .type = HXTYPE_NONE, .ptr = &do_eject,
+@@ -56,7 +58,7 @@ static bool cdp_get_options(int *argc, const char ***a
+ 
+ int main(int argc, const char **argv)
+ {
+-	struct cdrom_tochdr toc;
++	struct ioc_toc_header toc;
+ 	int fd;
+ 
+ 	if (!cdp_get_options(&argc, &argv))
+@@ -69,38 +71,57 @@ int main(int argc, const char **argv)
+ 		return EXIT_FAILURE;
+ 	}
+ 
+-	if (ioctl(fd, CDROMREADTOCHDR, &toc) < 0) {
+-		perror("ioctl CDROMREADTOCHDR");
++	/*
++	 * Ejecting and closing the CD-ROM tray does not require reading
++	 * of the TOC header first (at least on FreeBSD).
++	 */
++	if (do_eject) {
++		(void)ioctl(fd, CDIOCALLOW);
++		if (ioctl(fd, CDIOCEJECT) < 0)
++			perror("ioctl CDIOCEJECT");
++		/*
++		 * It is pointless to do anything after CD-ROM had been
++		 * ejected, so exit early.
++		 */
++		goto done;
++	}
++	if (do_close) {
++		(void)ioctl(fd, CDIOCALLOW);
++		if (ioctl(fd, CDIOCCLOSE) < 0)
++			perror("ioctl CDIOCCLOSE");
++	}
++	if (ioctl(fd, CDIOREADTOCHEADER, &toc) < 0) {
++		perror("ioctl CDIOREADTOCHEADER");
+ 		return EXIT_FAILURE;
+ 	}
+ 	if (dump_toc)
+-		printf("Tracks: %u-%u\n", toc.cdth_trk0, toc.cdth_trk1);
++		printf("Tracks: %u-%u\n", toc.starting_track, toc.ending_track);
+ 	if (do_start)
+-		if (ioctl(fd, CDROMSTART) < 0)
+-			perror("ioctl CDROMSTART");
++		if (ioctl(fd, CDIOCSTART) < 0)
++			perror("ioctl CDIOCSTART");
+ 	if (do_pause)
+-		if (ioctl(fd, CDROMPAUSE) < 0)
+-			perror("ioctl CDROMPAUSE");
++		if (ioctl(fd, CDIOCPAUSE) < 0)
++			perror("ioctl CDIOCPAUSE");
+ 	if (do_resume)
+-		if (ioctl(fd, CDROMRESUME) < 0)
+-			perror("ioctl CDROMRESUME");
++		if (ioctl(fd, CDIOCRESUME) < 0)
++			perror("ioctl CDIOCRESUME");
+ 	if (do_play) {
+-		struct cdrom_ti t;
+-		t.cdti_trk0 = (argc >= 2) ? strtoul(argv[1], NULL, 0) :
+-		              toc.cdth_trk0;
+-		t.cdti_trk1 = (argc >= 3) ? strtoul(argv[2], NULL, 0) :
+-		              toc.cdth_trk1;
+-		t.cdti_ind0 = 0;
+-		t.cdti_ind1 = 0;
+-		if (ioctl(fd, CDROMPLAYTRKIND, &t) < 0)
+-			perror("ioctl CDROMPLAYTRKIND");
++		struct ioc_play_track t;
++		t.start_track = (argc >= 2) ? strtoul(argv[1], NULL, 0) :
++		              toc.starting_track;
++		t.end_track = (argc >= 3) ? strtoul(argv[2], NULL, 0) :
++		              toc.ending_track;
++		t.start_index = 1;
++		t.end_index = 1;
++		if (ioctl(fd, CDIOCPLAYTRACKS, &t) < 0)
++			perror("ioctl CDIOCPLAYTRACKS");
+ 	}
+-	if (do_stop)
+-		if (ioctl(fd, CDROMSTOP) < 0)
+-			perror("ioctl CDROMSTOP");
+-	if (do_eject)
+-		if (ioctl(fd, CDROMEJECT) < 0)
+-			perror("ioctl CDROMEJECT");
++	if (do_stop) {
++		if (ioctl(fd, CDIOCSTOP) < 0)
++			perror("ioctl CDIOCSTOP");
++		(void)ioctl(fd, CDIOCALLOW);
++	}
++ done:
+ 	close(fd);
+ 	return EXIT_SUCCESS;
+ }

Added: head/misc/hxtools/files/patch-smm_vfalib.hpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/hxtools/files/patch-smm_vfalib.hpp	Mon Aug  3 06:13:13 2020	(r544024)
@@ -0,0 +1,11 @@
+--- smm/vfalib.hpp.orig	2020-07-12 09:44:16 UTC
++++ smm/vfalib.hpp
+@@ -9,7 +9,7 @@
+ #include <vector>
+ #include <cstdint>
+ #include <cstdio>
+-#include <endian.h>
++#include <sys/endian.h>
+ #if (defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN) || \
+     (defined(_BYTE_ORDER) && _BYTE_ORDER == _BIG_ENDIAN)
+ 	/* We need to use constexpr functions, and htole16 unfortunately is not. */

Added: head/misc/hxtools/files/patch-smm_vfontas.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/hxtools/files/patch-smm_vfontas.cpp	Mon Aug  3 06:13:13 2020	(r544024)
@@ -0,0 +1,10 @@
+--- smm/vfontas.cpp.orig	2020-07-12 09:44:16 UTC
++++ smm/vfontas.cpp
+@@ -15,6 +15,7 @@
+ #include <cstdio>
+ #include <cstdlib>
+ #include <cstring>
++#include <errno.h>
+ #include <fcntl.h>
+ #include <getopt.h>
+ #include <unistd.h>

Added: head/misc/hxtools/files/patch-suser_sysinfo.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/hxtools/files/patch-suser_sysinfo.c	Mon Aug  3 06:13:13 2020	(r544024)
@@ -0,0 +1,42 @@
+--- suser/sysinfo.c.orig	2020-07-12 09:44:16 UTC
++++ suser/sysinfo.c
+@@ -48,9 +48,9 @@ struct sy_block {
+ 	unsigned int display_width, display_height;
+ };
+ 
+-static const char *sy_osrelease_file = "/etc/os-release";
+-static const char *sy_cpuinfo_file = "/proc/cpuinfo";
+-static const char sysfs_cpu_dir[] = "/sys/devices/system/cpu";
++static const char *sy_osrelease_file = "/var/run/os-release";
++static const char *sy_cpuinfo_file = "/compat/linux/proc/cpuinfo";
++static const char sysfs_cpu_dir[] = "/compat/linux/sys/devices/system/cpu";
+ static unsigned int sy_verbose;
+ 
+ static void sy_num_cpu_threads(struct sy_block *sib)
+@@ -190,7 +190,7 @@ static void sy_loadavg(struct sy_block *sib)
+ {
+ 	double avg5, avg15;
+ 	unsigned int run;
+-	FILE *fp = fopen("/proc/loadavg", "r");
++	FILE *fp = fopen("/compat/linux/proc/loadavg", "r");
+ 
+ 	if (fp == NULL)
+ 		return;
+@@ -202,7 +202,7 @@ static void sy_loadavg(struct sy_block *sib)
+ static void sy_memory(struct sy_block *sib)
+ {
+ 	unsigned long long mem_free = 0, mem_buf = 0, mem_cac = 0, mem_shm = 0;
+-	FILE *fp = fopen("/proc/meminfo", "r");
++	FILE *fp = fopen("/compat/linux/proc/meminfo", "r");
+ 	hxmc_t *line = NULL;
+ 	char *key, *value;
+ 
+@@ -448,6 +448,7 @@ int main(int argc, const char **argv)
+ 	sy_gfx_hardware(&sib);
+ 	sy_display_size(&sib);
+ 	sy_dump(&sib);
+-	HXmap_free(sib.osrel);
++	if (sib.osrel)
++		HXmap_free(sib.osrel);
+ 	return EXIT_SUCCESS;
+ }

Added: head/misc/hxtools/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/hxtools/pkg-descr	Mon Aug  3 06:13:13 2020	(r544024)
@@ -0,0 +1,8 @@
+This is the collection of tools and scripts for different tasks written
+by Jan Engelhardt, each of which seems to be too small to warrant their
+own project.
+
+Some of these utilities need linprocfs(5) and linsysfs(5) to be mounted
+under /compat/linux/{proc,sys} to operate.
+
+WWW: http://inai.de/projects/hxtools/

Added: head/misc/hxtools/pkg-plist
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/hxtools/pkg-plist	Mon Aug  3 06:13:13 2020	(r544024)
@@ -0,0 +1,136 @@
+bin/aumeta
+bin/bin2c
+bin/bsvplay
+bin/checkbrack
+bin/cwdiff
+bin/declone
+bin/extract_d3pkg
+bin/extract_dfqshared.pm
+bin/extract_dxhog
+bin/extract_f3pod
+bin/extract_qupak
+bin/fxterm
+bin/git-author-stat
+bin/git-blame-stats
+bin/git-forest
+bin/git-revert-stats
+bin/git-track
+bin/gpsh
+bin/gxxdm
+bin/hcdplay
+bin/man2html
+bin/mkvappend
+bin/mod2opus
+bin/ofl
+bin/pcmdiff
+bin/pcmmix
+bin/pegrep
+bin/pesubst
+bin/pmap_dirty
+bin/proc_iomem_count
+bin/proc_stat_parse
+bin/qpdecode
+bin/qplay
+bin/qtar
+bin/rot13
+bin/spec-beautifier
+bin/ssa2srt
+bin/su1
+bin/sysinfo
+bin/tailhex
+bin/vfontas
+bin/wktimer
+bin/xcp
+etc/hxloginpref.conf
+libexec/hxtools/cctypeinfo
+libexec/hxtools/clock_info
+libexec/hxtools/diff2php
+libexec/hxtools/doxygen-kerneldoc-filter
+libexec/hxtools/fd0ssh
+libexec/hxtools/hxnetload
+libexec/hxtools/ldif-duplicate-attrs
+libexec/hxtools/ldif-leading-spaces
+libexec/hxtools/logontime
+libexec/hxtools/mailsplit
+libexec/hxtools/paddrspacesize
+libexec/hxtools/peicon
+libexec/hxtools/proc_stat_signal_decode
+libexec/hxtools/psthreads
+libexec/hxtools/recursive_lower
+libexec/hxtools/rezip
+libexec/hxtools/sourcefuncsize
+libexec/hxtools/utmp_register
+libexec/hxtools/vcsaview
+man/man1/aumeta.1.gz
+man/man1/bin2c.1.gz
+man/man1/bsvplay.1.gz
+man/man1/cctypeinfo.1.gz
+man/man1/checkbrack.1.gz
+man/man1/clock_info.1.gz
+man/man1/cwdiff.1.gz
+man/man1/declone.1.gz
+man/man1/diff2php.1.gz
+man/man1/extract_d3pkg.1.gz
+man/man1/extract_dxhog.1.gz
+man/man1/extract_f3pod.1.gz
+man/man1/extract_qupak.1.gz
+man/man1/fd0ssh.1.gz
+man/man1/fxterm.1.gz
+man/man1/git-author-stat.1.gz
+man/man1/git-forest.1.gz
+man/man1/git-revert-stats.1.gz
+man/man1/git-track.1.gz
+man/man1/hcdplay.1.gz
+man/man1/ldif-duplicate-attrs.1.gz
+man/man1/mailsplit.1.gz
+man/man1/man2html.1.gz
+man/man1/mod2opus.1.gz
+man/man1/ofl.1.gz
+man/man1/pcmdiff.1.gz
+man/man1/pcmmix.1.gz
+man/man1/pegrep.1.gz
+man/man1/peicon.1.gz
+man/man1/pesubst.1.gz
+man/man1/psthreads.1.gz
+man/man1/qplay.1.gz
+man/man1/qtar.1.gz
+man/man1/recursive_lower.1.gz
+man/man1/rezip.1.gz
+man/man1/rot13.1.gz
+man/man1/sourcefuncsize.1.gz
+man/man1/spec-beautifier.1.gz
+man/man1/ssa2srt.1.gz
+man/man1/sysinfo.1.gz
+man/man1/tailhex.1.gz
+man/man1/vfontas.1.gz
+man/man1/wktimer.1.gz
+man/man1/xcp.1.gz
+man/man7/hxtools.7.gz
+man/man8/hxnetload.8.gz
+man/man8/logontime.8.gz
+man/man8/utmp_register.8.gz
+man/man8/vcsaview.8.gz
+man/man8/xfs_irecover.8.gz
+%%PORTDOCS%%%%DOCSDIR%%/NEWS.txt
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/colortable
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/git-deconstruct
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/neon
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/prime.S
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/prime.txt
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/rc4
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/sym_word.S
+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/unitable
+%%DATADIR%%/gitconfig
+%%DATADIR%%/hxloginpref.conf
+%%DATADIR%%/hxtools_bashrc.bash
+%%DATADIR%%/hxtools_dircolors
+%%DATADIR%%/hxtools_profile.bash
+%%DATADIR%%/rfc2307bis-utf8.schema
+share/kbd/consolefonts/A1.fnt
+share/kbd/consolefonts/B1.fnt
+share/kbd/consolefonts/E1.fnt
+share/kbd/consolefonts/neuropol.fnt
+share/kbd/keymaps/i386/qwerty/us_jng.map
+share/kbd/keymaps/i386/qwerty/us_jng_vaiou3.map
+share/kbd/keymaps/i386/qwertz/de_jng.map
+share/kbd/unimaps/cp437AB.uni



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