The branch main has been updated by phk:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=4ff782c06a56281b113df6dbf48bb397ddcb020a

commit 4ff782c06a56281b113df6dbf48bb397ddcb020a
Author:     Poul-Henning Kamp <[email protected]>
AuthorDate: 2023-08-10 14:56:53 +0000
Commit:     Poul-Henning Kamp <[email protected]>
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;

Reply via email to