git: 4ff782c06a56 - main - tcopy: Pick up max blocksize from sysctl kern.maxphys
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 10 Aug 2023 14:58:32 UTC
The branch main has been updated by phk:
URL: https://cgit.FreeBSD.org/src/commit/?id=4ff782c06a56281b113df6dbf48bb397ddcb020a
commit 4ff782c06a56281b113df6dbf48bb397ddcb020a
Author: Poul-Henning Kamp <phk@FreeBSD.org>
AuthorDate: 2023-08-10 14:56:53 +0000
Commit: Poul-Henning Kamp <phk@FreeBSD.org>
CommitDate: 2023-08-10 14:58:18 +0000
tcopy: Pick up max blocksize from sysctl kern.maxphys
---
usr.bin/tcopy/tcopy.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/usr.bin/tcopy/tcopy.c b/usr.bin/tcopy/tcopy.c
index 24dcc969a9af..ef0da430002e 100644
--- a/usr.bin/tcopy/tcopy.c
+++ b/usr.bin/tcopy/tcopy.c
@@ -52,6 +52,7 @@ static const char sccsid[] = "@(#)tcopy.c 8.2 (Berkeley) 4/17/94";
#include <errno.h>
#include <fcntl.h>
#include <paths.h>
+#include <sys/sysctl.h>
#include <signal.h>
#include <stdint.h>
#include <stdio.h>
@@ -82,6 +83,11 @@ main(int argc, char *argv[])
int ch, needeof;
char *buff;
const char *inf;
+ unsigned long maxphys = 0;
+ size_t l_maxphys = sizeof maxphys;
+
+ if (!sysctlbyname("kern.maxphys", &maxphys, &l_maxphys, NULL, 0))
+ maxblk = maxphys;
msg = stdout;
guesslen = 1;