git: 789ffce39294 - main - ig4: Add PCI IDs for Intel Ice Lake I2C controller.

2023-11-27 Thread Vladimir Kondratyev
The branch main has been updated by wulf:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=789ffce392946d2f71a51bbac60db16dcdea2928

commit 789ffce392946d2f71a51bbac60db16dcdea2928
Author: Vladimir Kondratyev 
AuthorDate: 2023-11-27 15:25:48 +
Commit: Vladimir Kondratyev 
CommitDate: 2023-11-27 15:25:48 +

ig4: Add PCI IDs for Intel Ice Lake I2C controller.

PR: 275115
Tested by:  Sam 
MFC after:  2 weeks
---
 sys/dev/ichiic/ig4_pci.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/sys/dev/ichiic/ig4_pci.c b/sys/dev/ichiic/ig4_pci.c
index bb4b75c0c6d1..9f12e713cdeb 100644
--- a/sys/dev/ichiic/ig4_pci.c
+++ b/sys/dev/ichiic/ig4_pci.c
@@ -119,6 +119,12 @@ static int ig4iic_pci_detach(device_t dev);
 #define PCI_CHIP_COMETLAKE_V_I2C_1 0xa3e18086
 #define PCI_CHIP_COMETLAKE_V_I2C_2 0xa3e28086
 #define PCI_CHIP_COMETLAKE_V_I2C_3 0xa3e38086
+#definePCI_CHIP_ICELAKE_LP_I2C_0   0x34e88086
+#definePCI_CHIP_ICELAKE_LP_I2C_1   0x34e98086
+#definePCI_CHIP_ICELAKE_LP_I2C_2   0x34ea8086
+#definePCI_CHIP_ICELAKE_LP_I2C_3   0x34eb8086
+#definePCI_CHIP_ICELAKE_LP_I2C_4   0x34c58086
+#definePCI_CHIP_ICELAKE_LP_I2C_5   0x34c68086
 #define PCI_CHIP_TIGERLAKE_H_I2C_0 0x43d88086
 #define PCI_CHIP_TIGERLAKE_H_I2C_1 0x43e88086
 #define PCI_CHIP_TIGERLAKE_H_I2C_2 0x43e98086
@@ -225,6 +231,12 @@ static struct ig4iic_pci_device ig4iic_pci_devices[] = {
{ PCI_CHIP_COMETLAKE_V_I2C_1, "Intel Comet Lake-V I2C Controller-1", 
IG4_CANNONLAKE},
{ PCI_CHIP_COMETLAKE_V_I2C_2, "Intel Comet Lake-V I2C Controller-2", 
IG4_CANNONLAKE},
{ PCI_CHIP_COMETLAKE_V_I2C_3, "Intel Comet Lake-V I2C Controller-3", 
IG4_CANNONLAKE},
+   { PCI_CHIP_ICELAKE_LP_I2C_0, "Intel Ice Lake-LP I2C Controller-0", 
IG4_TIGERLAKE},
+   { PCI_CHIP_ICELAKE_LP_I2C_1, "Intel Ice Lake-LP I2C Controller-1", 
IG4_TIGERLAKE},
+   { PCI_CHIP_ICELAKE_LP_I2C_2, "Intel Ice Lake-LP I2C Controller-2", 
IG4_TIGERLAKE},
+   { PCI_CHIP_ICELAKE_LP_I2C_3, "Intel Ice Lake-LP I2C Controller-3", 
IG4_TIGERLAKE},
+   { PCI_CHIP_ICELAKE_LP_I2C_4, "Intel Ice Lake-LP I2C Controller-4", 
IG4_TIGERLAKE},
+   { PCI_CHIP_ICELAKE_LP_I2C_5, "Intel Ice Lake-LP I2C Controller-5", 
IG4_TIGERLAKE},
{ PCI_CHIP_TIGERLAKE_H_I2C_0, "Intel Tiger Lake-H I2C Controller-0", 
IG4_TIGERLAKE},
{ PCI_CHIP_TIGERLAKE_H_I2C_1, "Intel Tiger Lake-H I2C Controller-1", 
IG4_TIGERLAKE},
{ PCI_CHIP_TIGERLAKE_H_I2C_2, "Intel Tiger Lake-H I2C Controller-2", 
IG4_TIGERLAKE},



git: ae477ca7da55 - main - bzip2: remove locally added __FBSDID

2023-11-27 Thread Brooks Davis
The branch main has been updated by brooks:

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

commit ae477ca7da55f76d28859e1bd01cd1051e36f28f
Author: Brooks Davis 
AuthorDate: 2023-11-27 16:47:22 +
Commit: Brooks Davis 
CommitDate: 2023-11-27 16:47:22 +

bzip2: remove locally added __FBSDID

Reviewed by:imp
Differential Revision:  https://reviews.freebsd.org/D42700
---
 contrib/bzip2/bzlib.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/contrib/bzip2/bzlib.c b/contrib/bzip2/bzlib.c
index 9496d5abc951..2574a87b2932 100644
--- a/contrib/bzip2/bzlib.c
+++ b/contrib/bzip2/bzlib.c
@@ -28,9 +28,6 @@
  bzBuffToBuffDecompress.  Fixed.
 */
 
-#include 
-__FBSDID("$FreeBSD$");
-
 #include "bzlib_private.h"
 
 #ifndef BZ_NO_COMPRESS



git: 3f944f3bb75f - main - ee: remove locally added __FBSDID

2023-11-27 Thread Brooks Davis
The branch main has been updated by brooks:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=3f944f3bb75fe6eae6000511ad19799d90da54ba

commit 3f944f3bb75fe6eae6000511ad19799d90da54ba
Author: Brooks Davis 
AuthorDate: 2023-11-27 16:47:26 +
Commit: Brooks Davis 
CommitDate: 2023-11-27 16:47:26 +

ee: remove locally added __FBSDID

Reviewed by:imp
Differential Revision:  https://reviews.freebsd.org/D42701
---
 contrib/ee/ee.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/contrib/ee/ee.c b/contrib/ee/ee.c
index 21523ece9c70..072d26519f4c 100644
--- a/contrib/ee/ee.c
+++ b/contrib/ee/ee.c
@@ -54,9 +54,6 @@
  |
  */
 
-#include 
-__FBSDID("$FreeBSD$");
-
 char *ee_copyright_message = 
 "Copyright (c) 1986, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 2009 Hugh Mahon 
";
 



git: 78e6a1bd0638 - main - pnpinfo: remove locally added __FBSDID

2023-11-27 Thread Brooks Davis
The branch main has been updated by brooks:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=78e6a1bd063884ae2c42256bcaee6824efbcfbc8

commit 78e6a1bd063884ae2c42256bcaee6824efbcfbc8
Author: Brooks Davis 
AuthorDate: 2023-11-27 16:47:30 +
Commit: Brooks Davis 
CommitDate: 2023-11-27 16:47:30 +

pnpinfo: remove locally added __FBSDID

Reviewed by:imp
Differential Revision:  https://reviews.freebsd.org/D42702
---
 contrib/pnpinfo/pnpinfo.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/contrib/pnpinfo/pnpinfo.c b/contrib/pnpinfo/pnpinfo.c
index 4ec99b3b27e1..4a91006cebff 100644
--- a/contrib/pnpinfo/pnpinfo.c
+++ b/contrib/pnpinfo/pnpinfo.c
@@ -24,9 +24,6 @@
  * SUCH DAMAGE.
  */
 
-#include 
-__FBSDID("$FreeBSD$");
-
 #include 
 
 #include 



git: a3c858005cae - main - telnet: remove locally added __FBSDID

2023-11-27 Thread Brooks Davis
The branch main has been updated by brooks:

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

commit a3c858005cae175e277f6f6735ca9eaea7eaf3c3
Author: Brooks Davis 
AuthorDate: 2023-11-27 16:47:37 +
Commit: Brooks Davis 
CommitDate: 2023-11-27 16:47:37 +

telnet: remove locally added __FBSDID

This partially reverts 77b7cdf1999ee965ad494fddd184b18f532ac91a.

Reviewed by:imp
Differential Revision:  https://reviews.freebsd.org/D42704
---
 contrib/telnet/libtelnet/auth.c  | 3 ---
 contrib/telnet/libtelnet/enc_des.c   | 2 --
 contrib/telnet/libtelnet/encrypt.c   | 4 
 contrib/telnet/libtelnet/genget.c| 4 
 contrib/telnet/libtelnet/getent.c| 4 
 contrib/telnet/libtelnet/kerberos.c  | 4 
 contrib/telnet/libtelnet/kerberos5.c | 4 
 contrib/telnet/libtelnet/krb4encpwd.c| 4 
 contrib/telnet/libtelnet/misc.c  | 4 
 contrib/telnet/libtelnet/pk.c| 4 
 contrib/telnet/libtelnet/read_password.c | 4 
 contrib/telnet/libtelnet/rsaencpwd.c | 4 
 contrib/telnet/libtelnet/sra.c   | 4 
 contrib/telnet/telnet/authenc.c  | 2 --
 contrib/telnet/telnet/commands.c | 2 --
 contrib/telnet/telnet/main.c | 2 --
 contrib/telnet/telnet/network.c  | 2 --
 contrib/telnet/telnet/ring.c | 2 --
 contrib/telnet/telnet/sys_bsd.c  | 2 --
 contrib/telnet/telnet/telnet.c   | 2 --
 contrib/telnet/telnet/terminal.c | 2 --
 contrib/telnet/telnet/utilities.c| 2 --
 22 files changed, 67 deletions(-)

diff --git a/contrib/telnet/libtelnet/auth.c b/contrib/telnet/libtelnet/auth.c
index 3488edd84b1c..fa1cfdc52869 100644
--- a/contrib/telnet/libtelnet/auth.c
+++ b/contrib/telnet/libtelnet/auth.c
@@ -33,9 +33,6 @@
 static const char sccsid[] = "@(#)auth.c   8.3 (Berkeley) 5/30/95";
 #endif /* not lint */
 #endif
-#include 
-__FBSDID("$FreeBSD$");
-
 
 /*
  * Copyright (C) 1990 by the Massachusetts Institute of Technology
diff --git a/contrib/telnet/libtelnet/enc_des.c 
b/contrib/telnet/libtelnet/enc_des.c
index 2c12ad5e0cf2..0cd9cb44ce05 100644
--- a/contrib/telnet/libtelnet/enc_des.c
+++ b/contrib/telnet/libtelnet/enc_des.c
@@ -32,8 +32,6 @@
 static const char sccsid[] = "@(#)enc_des.c8.3 (Berkeley) 5/30/95";
 #endif /* not lint */
 #endif
-#include 
-__FBSDID("$FreeBSD$");
 
 #ifdef ENCRYPTION
 # ifdefAUTHENTICATION
diff --git a/contrib/telnet/libtelnet/encrypt.c 
b/contrib/telnet/libtelnet/encrypt.c
index 398c7321510c..3c4a2ab1abc1 100644
--- a/contrib/telnet/libtelnet/encrypt.c
+++ b/contrib/telnet/libtelnet/encrypt.c
@@ -27,10 +27,6 @@
  * SUCH DAMAGE.
  */
 
-#include 
-
-__FBSDID("$FreeBSD$");
-
 #ifndef lint
 #if 0
 static const char sccsid[] = "@(#)encrypt.c8.2 (Berkeley) 5/30/95";
diff --git a/contrib/telnet/libtelnet/genget.c 
b/contrib/telnet/libtelnet/genget.c
index e7b48f6b2af0..4bb119315746 100644
--- a/contrib/telnet/libtelnet/genget.c
+++ b/contrib/telnet/libtelnet/genget.c
@@ -27,10 +27,6 @@
  * SUCH DAMAGE.
  */
 
-#include 
-
-__FBSDID("$FreeBSD$");
-
 #ifndef lint
 #if 0
 static const char sccsid[] = "@(#)genget.c 8.2 (Berkeley) 5/30/95";
diff --git a/contrib/telnet/libtelnet/getent.c 
b/contrib/telnet/libtelnet/getent.c
index 3df81409a7d8..3be745e96c0b 100644
--- a/contrib/telnet/libtelnet/getent.c
+++ b/contrib/telnet/libtelnet/getent.c
@@ -27,10 +27,6 @@
  * SUCH DAMAGE.
  */
 
-#include 
-
-__FBSDID("$FreeBSD$");
-
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)getent.c   8.2 (Berkeley) 12/15/93";
diff --git a/contrib/telnet/libtelnet/kerberos.c 
b/contrib/telnet/libtelnet/kerberos.c
index 5f00fd40187f..a5dc774d54ca 100644
--- a/contrib/telnet/libtelnet/kerberos.c
+++ b/contrib/telnet/libtelnet/kerberos.c
@@ -27,10 +27,6 @@
  * SUCH DAMAGE.
  */
 
-#include 
-
-__FBSDID("$FreeBSD$");
-
 #ifndef lint
 static const char sccsid[] = "@(#)kerberos.c   8.3 (Berkeley) 5/30/95";
 #endif /* not lint */
diff --git a/contrib/telnet/libtelnet/kerberos5.c 
b/contrib/telnet/libtelnet/kerberos5.c
index 63f515310f9b..bc90ec9cfa6a 100644
--- a/contrib/telnet/libtelnet/kerberos5.c
+++ b/contrib/telnet/libtelnet/kerberos5.c
@@ -47,10 +47,6 @@
  * or implied warranty.
  */
 
-#include 
-
-__FBSDID("$FreeBSD$");
-
 #ifdef KRB5
 
 #include 
diff --git a/contrib/telnet/libtelnet/krb4encpwd.c 
b/contrib/telnet/libtelnet/krb4encpwd.c
index e87b5c41272e..345e24317228 100644
--- a/contrib/telnet/libtelnet/krb4encpwd.c
+++ b/contrib/telnet/libtelnet/krb4encpwd.c
@@ -27,10 +27,6 @@
  * SUCH DAMAGE.
  */
 
-#include 
-
-__FBSDID("$FreeBSD$");
-
 #ifndef lint
 static char sccsid[] = "@(#)krb4encpwd.c   8.3 (Berkeley) 5/30/95";
 #endif /* not lint */
diff --git a/contrib/telnet/libtelnet/misc.c b/contrib/telnet/libtelnet/misc.c
index ef5de4ee45e7..a514376e2b69 100644
--- a/contrib/telnet/libtelnet/misc.c
+++ b/contrib/telnet/libtelnet/misc.c
@@ -27,10 +27,6

git: a159b74a5d86 - main - smbfs: remove locally added __FBSDID

2023-11-27 Thread Brooks Davis
The branch main has been updated by brooks:

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

commit a159b74a5d86e89eb86dcb5df3ec402e662012a6
Author: Brooks Davis 
AuthorDate: 2023-11-27 16:47:33 +
Commit: Brooks Davis 
CommitDate: 2023-11-27 16:47:33 +

smbfs: remove locally added __FBSDID

Differential Revision:  https://reviews.freebsd.org/D42703
---
 contrib/smbfs/lib/smb/mbuf.c| 3 ---
 contrib/smbfs/lib/smb/nb_name.c | 3 ---
 contrib/smbfs/lib/smb/nls.c | 3 ---
 contrib/smbfs/lib/smb/rcfile.c  | 3 ---
 4 files changed, 12 deletions(-)

diff --git a/contrib/smbfs/lib/smb/mbuf.c b/contrib/smbfs/lib/smb/mbuf.c
index 729b5c53d11e..ac3b94524683 100644
--- a/contrib/smbfs/lib/smb/mbuf.c
+++ b/contrib/smbfs/lib/smb/mbuf.c
@@ -32,9 +32,6 @@
  * $Id: mbuf.c,v 1.6 2001/02/24 15:56:04 bp Exp $
  */
 
-#include 
-__FBSDID("$FreeBSD$");
-
 #include 
 #include 
 #include 
diff --git a/contrib/smbfs/lib/smb/nb_name.c b/contrib/smbfs/lib/smb/nb_name.c
index a953ce0a0a9c..319d3c353b01 100644
--- a/contrib/smbfs/lib/smb/nb_name.c
+++ b/contrib/smbfs/lib/smb/nb_name.c
@@ -32,9 +32,6 @@
  * $Id: nb_name.c,v 1.2 2001/08/22 03:31:36 bp Exp $
  */
 
-#include 
-__FBSDID("$FreeBSD$");
-
 #include 
 #include 
 #include 
diff --git a/contrib/smbfs/lib/smb/nls.c b/contrib/smbfs/lib/smb/nls.c
index b79d49c29c58..99693f3aba84 100644
--- a/contrib/smbfs/lib/smb/nls.c
+++ b/contrib/smbfs/lib/smb/nls.c
@@ -32,9 +32,6 @@
  * $Id: nls.c,v 1.10 2002/07/22 08:33:59 bp Exp $
  */
 
-#include 
-__FBSDID("$FreeBSD$");
-
 #include 
 #include 
 #include 
diff --git a/contrib/smbfs/lib/smb/rcfile.c b/contrib/smbfs/lib/smb/rcfile.c
index 26a31d6f37ee..f97cb5abbf35 100644
--- a/contrib/smbfs/lib/smb/rcfile.c
+++ b/contrib/smbfs/lib/smb/rcfile.c
@@ -32,9 +32,6 @@
  * $Id: rcfile.c,v 1.5 2001/04/16 12:46:46 bp Exp $
  */
 
-#include 
-__FBSDID("$FreeBSD$");
-
 #include 
 #include 
 #include 



git: 3faba3002f46 - main - x86emu: remove localy added __FBSDID

2023-11-27 Thread Brooks Davis
The branch main has been updated by brooks:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=3faba3002f466e1bdad4767c55257e04433ee96b

commit 3faba3002f466e1bdad4767c55257e04433ee96b
Author: Brooks Davis 
AuthorDate: 2023-11-27 16:47:41 +
Commit: Brooks Davis 
CommitDate: 2023-11-27 16:47:41 +

x86emu: remove localy added __FBSDID

This partially reverts 0a2e9846fdf3f3d42a9ee65d0d8669f6be11c879.

Reviewed by:imp, delphij
Differential Revision:  https://reviews.freebsd.org/D42705
---
 sys/contrib/x86emu/x86emu.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/sys/contrib/x86emu/x86emu.c b/sys/contrib/x86emu/x86emu.c
index 60a154952f27..44c322849754 100644
--- a/sys/contrib/x86emu/x86emu.c
+++ b/sys/contrib/x86emu/x86emu.c
@@ -32,9 +32,6 @@
  *
  */
 
-#include 
-__FBSDID("$FreeBSD$");
-
 #include 
 #include 
 



git: 1a7c9e1585dd - main - pwait.1: add missing prompt and command in examples

2023-11-27 Thread Mike Karels
The branch main has been updated by karels:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=1a7c9e1585dd3ae14b03226e359d434c10066bfb

commit 1a7c9e1585dd3ae14b03226e359d434c10066bfb
Author: Mike Karels 
AuthorDate: 2023-11-27 16:55:11 +
Commit: Mike Karels 
CommitDate: 2023-11-27 16:59:52 +

pwait.1: add missing prompt and command in examples

Two examples showed '$?' alone on a line, which should be '$ echo $?'.
The third example got it right.  Fix the first two.
---
 bin/pwait/pwait.1 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/pwait/pwait.1 b/bin/pwait/pwait.1
index 9310b74d5683..83ac8bcef317 100644
--- a/bin/pwait/pwait.1
+++ b/bin/pwait/pwait.1
@@ -97,7 +97,7 @@ $ sleep 30 & sleep 3600 &
 [1] 1646
 [2] 1647
 $ pwait -o -t5 1646 1647
-$?
+$ echo $?
 124
 .Ed
 .Pp
@@ -111,7 +111,7 @@ $ sleep 30 & sleep 3600 &
 [2] 1653
 $ pwait -v -t 5 1652 1653
 timeout
-$?
+$ echo $?
 124
 .Ed
 .Pp



Re: git: 29363fb44637 - main - sys: Remove ancient SCCS tags.

2023-11-27 Thread John Baldwin

On 11/26/23 9:24 PM, Warner Losh wrote:

The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=29363fb446372cb3f10bc98664e9767c53fbb457

commit 29363fb446372cb3f10bc98664e9767c53fbb457
Author: Warner Losh 
AuthorDate: 2023-11-23 17:21:37 +
Commit: Warner Losh 
CommitDate: 2023-11-27 05:23:30 +

 sys: Remove ancient SCCS tags.
 
 Remove ancient SCCS tags from the tree, automated scripting, with two

 minor fixup to keep things compiling. All the common forms in the tree
 were removed with a perl script.
 
 Sponsored by:   Netflix

---
diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c
index 378cf2f011f6..e5285586b928 100644
--- a/sys/amd64/amd64/mem.c
+++ b/sys/amd64/amd64/mem.c
@@ -35,7 +35,6 @@
   * SUCH DAMAGE.
   *
   *from: Utah $Hdr: mem.c 1.13 89/10/08$
- * from: @(#)mem.c 7.2 (Berkeley) 5/9/91
   */
  
  #include 


Do we want to axe the Utah $Hdr lines as well?  Those are even older than UCB.


diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
index 27bf3f67ca25..6173aabd97f5 100644
--- a/sys/amd64/amd64/vm_machdep.c
+++ b/sys/amd64/amd64/vm_machdep.c
@@ -37,8 +37,6 @@
   * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
- *
- * from: @(#)vm_machdep.c  7.3 (Berkeley) 5/13/91
   *Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
   */
  


This looks to be a bug in the script as it didn't leave a blank line before the 
Utah hdr.

I'm fine if the fix is to can the Utah headers.

--
John Baldwin




Re: git: b88ca6ee167d - main - cdefs: Remove CC_SUPPORTS macros, they are unused

2023-11-27 Thread John Baldwin

On 11/26/23 9:25 PM, Warner Losh wrote:

The branch main has been updated by imp:

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

commit b88ca6ee167d079c965dfe123bbe296d3a945c0a
Author: Warner Losh 
AuthorDate: 2023-11-20 22:40:55 +
Commit: Warner Losh 
CommitDate: 2023-11-27 05:24:02 +

 cdefs: Remove CC_SUPPORTS macros, they are unused
 
 Remove __CC_SUPPORTS_INLINE, __CC_SUPPORTS___INLINE__,

 __CC_SUPPORTS___FUNC__, __CC_SUPPORTS_WARNING,
 __CC_SUPPORTS_VARADIC_XXX, __CC_SUPPORTS_DYNAMIC_ARRAY_INIT: they are
 unused. Also remove them from the generated cryptodevh.py script.
 
 Retain, for the moment, __CC_SUPPORTS___INLINE, since it's used in this

 file.
 
 PR: 275221 (exp-run)

 Sponsored by:   Netflix
---
  sys/sys/cdefs.h| 10 --
  tests/sys/opencrypto/cryptodevh.py |  7 ---
  2 files changed, 17 deletions(-)

diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index 5782735187c5..7f3efc9300c9 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -79,17 +79,7 @@
   */
  #define   __compiler_membar() __asm __volatile(" " : : : "memory")
  
-/* XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced */

-#define__CC_SUPPORTS_INLINE 1
  #define   __CC_SUPPORTS___INLINE 1
-#define__CC_SUPPORTS___INLINE__ 1
-
-#define__CC_SUPPORTS___FUNC__ 1
-#define__CC_SUPPORTS_WARNING 1
-
-#define__CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */
-
-#define__CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1
  
  #endif /* __GNUC__ */
  
diff --git a/tests/sys/opencrypto/cryptodevh.py b/tests/sys/opencrypto/cryptodevh.py

index d6982c26f1cf..9607bcd4d115 100644
--- a/tests/sys/opencrypto/cryptodevh.py
+++ b/tests/sys/opencrypto/cryptodevh.py
@@ -23,13 +23,6 @@ def __has_include(x): return 0
  
  def __has_builtin(x): return 0
  
-__CC_SUPPORTS_INLINE = 1

-__CC_SUPPORTS___INLINE = 1
-__CC_SUPPORTS___INLINE__ = 1
-__CC_SUPPORTS___FUNC__ = 1
-__CC_SUPPORTS_WARNING = 1
-__CC_SUPPORTS_VARADIC_XXX = 1
-__CC_SUPPORTS_DYNAMIC_ARRAY_INIT = 1
  def __P(protos): return protos
  
  def __STRING(x): return #x		


It doesn't really matter, but you accidentally removed __CC_SUPPORTS___INLINE 
from
the python version but not cdefs.h.  I wonder how hard it would be to just 
regenerate
cryptodevh.py rather than updating it manually as I'm sure it is missing some 
other
updates.

--
John Baldwin




Re: git: 17a238a15fbe - main - cdefs: Remove __func__ define

2023-11-27 Thread John Baldwin

On 11/26/23 9:25 PM, Warner Losh wrote:

The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=17a238a15fbed01477fbc54744d35cbccdb65871

commit 17a238a15fbed01477fbc54744d35cbccdb65871
Author: Warner Losh 
AuthorDate: 2023-11-20 23:34:22 +
Commit: Warner Losh 
CommitDate: 2023-11-27 05:24:02 +

 cdefs: Remove __func__ define
 
 We require an ANSI-C compiler to build the base system. It's required

 that __func__ work. Remove this define since the only known problem
 compilers are ancient history (gcc 2.6 from 1994, almost pre-dating the
 project). 3rd party code that used this define will now need to provide
 it via some other means when using non-ansi-c compilers.
 
 PR: 275221 (exp-run)

 Sponsored by:   Netflix
---
  sys/sys/cdefs.h| 40 ++
  tests/sys/opencrypto/cryptodevh.py |  4 
  2 files changed, 2 insertions(+), 42 deletions(-)

diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index c5b6190077b3..bcbf418f9323 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -96,14 +96,9 @@
  /*
   * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
   * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
- * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI
- * mode -- there must be no spaces between its arguments, and for nested
- * __CONCAT's, all the __CONCAT's must be at the left.  __CONCAT can also
- * concatenate double-quoted strings produced by the __STRING macro, but
- * this only works with ANSI C.
   *
   * __XSTRING is like __STRING, but it expands any macros in its argument
- * first.  It is only available with ANSI C.
+ * first.
   */
  #if defined(__STDC__) || defined(__cplusplus)
  #define   __P(protos) protos  /* full-blown ANSI C */
@@ -122,33 +117,7 @@
  #define   __inline/* delete GCC keyword */
  #endif /* ! __CC_SUPPORTS___INLINE */
  #endif /* !__cplusplus */
-
-#else  /* !(__STDC__ || __cplusplus) */
-#define__P(protos) ()  /* traditional C preprocessor */
-#define__CONCAT(x,y)   x/**/y
-#define__STRING(x) "x"
-
-#if !defined(__CC_SUPPORTS___INLINE)
-#define__const /* delete pseudo-ANSI C 
keywords */
-#define__inline
-#define__signed
-#define__volatile
-/*
- * In non-ANSI C environments, new programs will want ANSI-only C keywords
- * deleted from the program and old programs will want them left alone.
- * When using a compiler other than gcc, programs using the ANSI C keywords
- * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
- * When using "gcc -traditional", we assume that this is the intent; if
- * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
- */
-#ifndefNO_ANSI_KEYWORDS
-#defineconst   /* delete ANSI C keywords */
-#defineinline
-#definesigned
-#definevolatile
-#endif /* !NO_ANSI_KEYWORDS */
-#endif /* !__CC_SUPPORTS___INLINE */
-#endif /* !(__STDC__ || __cplusplus) */
+#endif /* __STDC__ || __cplusplus */
  
  /*

   * Compiler-dependent macros to help declare dead (non-returning) and
@@ -343,11 +312,6 @@
  #define   __unreachable() ((void)0)
  #endif
  
-/* XXX: should use `#if __STDC_VERSION__ < 199901'. */

-#if !__GNUC_PREREQ__(2, 7)
-#define__func__NULL
-#endif
-
  #if (defined(__GNUC__) && __GNUC__ >= 2) && !defined(__STRICT_ANSI__) || 
__STDC_VERSION__ >= 199901
  #define   __LONG_LONG_SUPPORTED
  #endif


This removed a lot more than just __func__?

--
John Baldwin




Re: git: 29363fb44637 - main - sys: Remove ancient SCCS tags.

2023-11-27 Thread Warner Losh
On Mon, Nov 27, 2023 at 10:50 AM John Baldwin  wrote:

> On 11/26/23 9:24 PM, Warner Losh wrote:
> > The branch main has been updated by imp:
> >
> > URL:
> https://cgit.FreeBSD.org/src/commit/?id=29363fb446372cb3f10bc98664e9767c53fbb457
> >
> > commit 29363fb446372cb3f10bc98664e9767c53fbb457
> > Author: Warner Losh 
> > AuthorDate: 2023-11-23 17:21:37 +
> > Commit: Warner Losh 
> > CommitDate: 2023-11-27 05:23:30 +
> >
> >  sys: Remove ancient SCCS tags.
> >
> >  Remove ancient SCCS tags from the tree, automated scripting, with
> two
> >  minor fixup to keep things compiling. All the common forms in the
> tree
> >  were removed with a perl script.
> >
> >  Sponsored by:   Netflix
> > ---
> > diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c
> > index 378cf2f011f6..e5285586b928 100644
> > --- a/sys/amd64/amd64/mem.c
> > +++ b/sys/amd64/amd64/mem.c
> > @@ -35,7 +35,6 @@
> >* SUCH DAMAGE.
> >*
> >*  from: Utah $Hdr: mem.c 1.13 89/10/08$
> > - *   from: @(#)mem.c 7.2 (Berkeley) 5/9/91
> >*/
> >
> >   #include 
>
> Do we want to axe the Utah $Hdr lines as well?  Those are even older than
> UCB.
>

I think so.


> > diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c
> > index 27bf3f67ca25..6173aabd97f5 100644
> > --- a/sys/amd64/amd64/vm_machdep.c
> > +++ b/sys/amd64/amd64/vm_machdep.c
> > @@ -37,8 +37,6 @@
> >* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
> ANY WAY
> >* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
> OF
> >* SUCH DAMAGE.
> > - *
> > - *   from: @(#)vm_machdep.c  7.3 (Berkeley) 5/13/91
> >*  Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
> >*/
> >
>
> This looks to be a bug in the script as it didn't leave a blank line
> before the Utah hdr.
>
> I'm fine if the fix is to can the Utah headers.
>

Ah, I hadn't even noticed the Utah headers there. There's a number of other
places in the tree that have $Id$ or similar things as well. There are
likely others
that we'll find. With tens of thousands of these in the tree, it's easy to
miss a few (I
think I missed about 100 $FreeBSD$'s that were spelled various ways that
were a
bit different than the scripts expected.

Warner


Re: git: b88ca6ee167d - main - cdefs: Remove CC_SUPPORTS macros, they are unused

2023-11-27 Thread Warner Losh
On Mon, Nov 27, 2023 at 10:50 AM John Baldwin  wrote:

> On 11/26/23 9:25 PM, Warner Losh wrote:
> > The branch main has been updated by imp:
> >
> > URL:
> https://cgit.FreeBSD.org/src/commit/?id=b88ca6ee167d079c965dfe123bbe296d3a945c0a
> >
> > commit b88ca6ee167d079c965dfe123bbe296d3a945c0a
> > Author: Warner Losh 
> > AuthorDate: 2023-11-20 22:40:55 +
> > Commit: Warner Losh 
> > CommitDate: 2023-11-27 05:24:02 +
> >
> >  cdefs: Remove CC_SUPPORTS macros, they are unused
> >
> >  Remove __CC_SUPPORTS_INLINE, __CC_SUPPORTS___INLINE__,
> >  __CC_SUPPORTS___FUNC__, __CC_SUPPORTS_WARNING,
> >  __CC_SUPPORTS_VARADIC_XXX, __CC_SUPPORTS_DYNAMIC_ARRAY_INIT: they
> are
> >  unused. Also remove them from the generated cryptodevh.py script.
> >
> >  Retain, for the moment, __CC_SUPPORTS___INLINE, since it's used in
> this
> >  file.
> >
> >  PR: 275221 (exp-run)
> >  Sponsored by:   Netflix
> > ---
> >   sys/sys/cdefs.h| 10 --
> >   tests/sys/opencrypto/cryptodevh.py |  7 ---
> >   2 files changed, 17 deletions(-)
> >
> > diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
> > index 5782735187c5..7f3efc9300c9 100644
> > --- a/sys/sys/cdefs.h
> > +++ b/sys/sys/cdefs.h
> > @@ -79,17 +79,7 @@
> >*/
> >   #define __compiler_membar() __asm __volatile(" " : : :
> "memory")
> >
> > -/* XXX: if __GNUC__ >= 2: not tested everywhere originally, where
> replaced */
> > -#define  __CC_SUPPORTS_INLINE 1
> >   #define __CC_SUPPORTS___INLINE 1
> > -#define  __CC_SUPPORTS___INLINE__ 1
> > -
> > -#define  __CC_SUPPORTS___FUNC__ 1
> > -#define  __CC_SUPPORTS_WARNING 1
> > -
> > -#define  __CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */
> > -
> > -#define  __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1
> >
> >   #endif /* __GNUC__ */
> >
> > diff --git a/tests/sys/opencrypto/cryptodevh.py
> b/tests/sys/opencrypto/cryptodevh.py
> > index d6982c26f1cf..9607bcd4d115 100644
> > --- a/tests/sys/opencrypto/cryptodevh.py
> > +++ b/tests/sys/opencrypto/cryptodevh.py
> > @@ -23,13 +23,6 @@ def __has_include(x): return 0
> >
> >   def __has_builtin(x): return 0
> >
> > -__CC_SUPPORTS_INLINE = 1
> > -__CC_SUPPORTS___INLINE = 1
> > -__CC_SUPPORTS___INLINE__ = 1
> > -__CC_SUPPORTS___FUNC__ = 1
> > -__CC_SUPPORTS_WARNING = 1
> > -__CC_SUPPORTS_VARADIC_XXX = 1
> > -__CC_SUPPORTS_DYNAMIC_ARRAY_INIT = 1
> >   def __P(protos): return protos
> >
> >   def __STRING(x): return #x
>
> It doesn't really matter, but you accidentally removed
> __CC_SUPPORTS___INLINE from
> the python version but not cdefs.h.  I wonder how hard it would be to just
> regenerate
> cryptodevh.py rather than updating it manually as I'm sure it is missing
> some other
> updates.
>

Yea, I'm not at all sure how it was generated in the first place.  And I
removed it there when
I removed it in cdefs.h, but then I failed to add it back when I concluded
that I had to add
it back to cdefs.h  I think I have plans to remove it in 2024q1 cdefs.h
cleaning where I'll
go farther: kill K&R support macros we have in there (so one couldn't use a
pure K&R compiler
on FreeBSD with the system headers... though doing that is already
impossible because of
all the prototypes). I also plan on eliminating all support for gcc prior
to 4.2. There's only one
port in the tree that uses an older gcc (2.8 for hp48x cross compiler) and
it's i386 only. And I've
not installed it to see if it uses the system headers or not (if it
doesn't, then my changes won't
affect it at all). I also have tcc (aka tinyc) working after a fashion
(I've fixed the compile issues
we have with it) just to make sure my future cleanups don't break other
compilers (though this
is the only other one I know works and uses system headers).

Warner


Re: git: 17a238a15fbe - main - cdefs: Remove __func__ define

2023-11-27 Thread Warner Losh
On Mon, Nov 27, 2023 at 10:50 AM John Baldwin  wrote:

> On 11/26/23 9:25 PM, Warner Losh wrote:
> > The branch main has been updated by imp:
> >
> > URL:
> https://cgit.FreeBSD.org/src/commit/?id=17a238a15fbed01477fbc54744d35cbccdb65871
> >
> > commit 17a238a15fbed01477fbc54744d35cbccdb65871
> > Author: Warner Losh 
> > AuthorDate: 2023-11-20 23:34:22 +
> > Commit: Warner Losh 
> > CommitDate: 2023-11-27 05:24:02 +
> >
> >  cdefs: Remove __func__ define
> >
> >  We require an ANSI-C compiler to build the base system. It's
> required
> >  that __func__ work. Remove this define since the only known problem
> >  compilers are ancient history (gcc 2.6 from 1994, almost pre-dating
> the
> >  project). 3rd party code that used this define will now need to
> provide
> >  it via some other means when using non-ansi-c compilers.
> >
> >  PR: 275221 (exp-run)
> >  Sponsored by:   Netflix
> > ---
> >   sys/sys/cdefs.h| 40
> ++
> >   tests/sys/opencrypto/cryptodevh.py |  4 
> >   2 files changed, 2 insertions(+), 42 deletions(-)
> >
> > diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
> > index c5b6190077b3..bcbf418f9323 100644
> > --- a/sys/sys/cdefs.h
> > +++ b/sys/sys/cdefs.h
> > @@ -96,14 +96,9 @@
> >   /*
> >* The __CONCAT macro is used to concatenate parts of symbol names,
> e.g.
> >* with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
> > - * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI
> > - * mode -- there must be no spaces between its arguments, and for nested
> > - * __CONCAT's, all the __CONCAT's must be at the left.  __CONCAT can
> also
> > - * concatenate double-quoted strings produced by the __STRING macro, but
> > - * this only works with ANSI C.
> >*
> >* __XSTRING is like __STRING, but it expands any macros in its
> argument
> > - * first.  It is only available with ANSI C.
> > + * first.
> >*/
> >   #if defined(__STDC__) || defined(__cplusplus)
> >   #define __P(protos) protos  /* full-blown ANSI C */
> > @@ -122,33 +117,7 @@
> >   #define __inline/* delete GCC keyword */
> >   #endif /* ! __CC_SUPPORTS___INLINE */
> >   #endif /* !__cplusplus */
> > -
> > -#else/* !(__STDC__ || __cplusplus) */
> > -#define  __P(protos) ()  /* traditional C
> preprocessor */
> > -#define  __CONCAT(x,y)   x/**/y
> > -#define  __STRING(x) "x"
> > -
> > -#if !defined(__CC_SUPPORTS___INLINE)
> > -#define  __const /* delete pseudo-ANSI C
> keywords */
> > -#define  __inline
> > -#define  __signed
> > -#define  __volatile
> > -/*
> > - * In non-ANSI C environments, new programs will want ANSI-only C
> keywords
> > - * deleted from the program and old programs will want them left alone.
> > - * When using a compiler other than gcc, programs using the ANSI C
> keywords
> > - * const, inline etc. as normal identifiers should define
> -DNO_ANSI_KEYWORDS.
> > - * When using "gcc -traditional", we assume that this is the intent; if
> > - * __GNUC__ is defined but __STDC__ is not, we leave the new keywords
> alone.
> > - */
> > -#ifndef  NO_ANSI_KEYWORDS
> > -#define  const   /* delete ANSI C keywords
> */
> > -#define  inline
> > -#define  signed
> > -#define  volatile
> > -#endif   /* !NO_ANSI_KEYWORDS */
> > -#endif   /* !__CC_SUPPORTS___INLINE */
> > -#endif   /* !(__STDC__ || __cplusplus) */
> > +#endif   /* __STDC__ || __cplusplus */
> >
> >   /*
> >* Compiler-dependent macros to help declare dead (non-returning) and
> > @@ -343,11 +312,6 @@
> >   #define __unreachable() ((void)0)
> >   #endif
> >
> > -/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
> > -#if !__GNUC_PREREQ__(2, 7)
> > -#define  __func__NULL
> > -#endif
> > -
> >   #if (defined(__GNUC__) && __GNUC__ >= 2) && !defined(__STRICT_ANSI__)
> || __STDC_VERSION__ >= 199901
> >   #define __LONG_LONG_SUPPORTED
> >   #endif
>
> This removed a lot more than just __func__?
>

Damn. It looks like future work got folded in here by accident...  This is
the 'remove support for
pure K&R compilers' stuff I've talked about elsewhere. I'll revert and fix.

Warner


git: 6a79e48076bc - main - Fix two latent bugs in hpts. One where a static is put on a local variable, the other an initialization bug where we should be setting tv.tv_sec to 0.

2023-11-27 Thread Randall Stewart
The branch main has been updated by rrs:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=6a79e48076bcce3e902323e62689eacb98faa180

commit 6a79e48076bcce3e902323e62689eacb98faa180
Author: Randall Stewart 
AuthorDate: 2023-11-27 19:38:06 +
Commit: Randall Stewart 
CommitDate: 2023-11-27 19:38:06 +

Fix two latent bugs in hpts. One where a static is put on
a local variable, the other an initialization bug where
we should be setting tv.tv_sec to 0.

PR: 275482
---
 sys/netinet/tcp_hpts.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/netinet/tcp_hpts.c b/sys/netinet/tcp_hpts.c
index 92b2f69c9e58..d673ccbe4a73 100644
--- a/sys/netinet/tcp_hpts.c
+++ b/sys/netinet/tcp_hpts.c
@@ -1519,6 +1519,7 @@ __tcp_run_hpts(struct tcp_hpts_entry *hpts)
hpts->p_mysleep.tv_usec = dynamic_min_sleep;
/* Reschedule with new to value */
tcp_hpts_set_max_sleep(hpts, 0);
+   tv.tv_sec = 0;
tv.tv_usec = hpts->p_hpts_sleep_time * 
HPTS_TICKS_PER_SLOT;
/* Validate its in the right ranges */
if (tv.tv_usec < hpts->p_mysleep.tv_usec) {
@@ -1600,7 +1601,7 @@ tcp_choose_hpts_to_run(void)
 void
 tcp_run_hpts(void)
 {
-   static struct tcp_hpts_entry *hpts;
+   struct tcp_hpts_entry *hpts;
struct epoch_tracker et;
 
NET_EPOCH_ENTER(et);



Re: git: 2a35f3cdf63d - main - sys/mutex.h: Include sys/lock.h instead of sys/_lock.h

2023-11-27 Thread Gleb Smirnoff
On Fri, Nov 24, 2023 at 09:27:39AM -0800, John Baldwin wrote:
J> > commit 2a35f3cdf63d1f9b1ea5ab0174adabb631757210
J> > Author: Emmanuel Vadot 
J> > AuthorDate: 2022-10-27 09:43:19 +
J> > Commit: Emmanuel Vadot 
J> > CommitDate: 2023-11-24 09:49:58 +
J> > 
J> >  sys/mutex.h: Include sys/lock.h instead of sys/_lock.h
J> >  It uses the LA_ defines when INVARIANTS is set.
J> >  This unbreak dpaa2 with FDT only kernel (like ALLWINNER or ROCKCHIP) 
as
J> >  the driver only include sys/lock.h via header polution for ACPI 
kernels.
J> >  Sponsored by:   Beckhoff Automation GmbH & Co. KG
J> >  Differential Revision:  https://reviews.freebsd.org/D37145
J> >  Reviewed by:kib, mjg
J> 
J> Avoiding the nested include here was originally an intentional design 
decision.
J> It was supposed to be a compile error if you didn't include lock.h first, and
J> callers are always supposed to include both (up until now).  However, I'm 
fine
J> with changing this, but we should be consistent and change all the other lock
J> headers at once including sys/rwlock.h, sys/sx.h, and sys/lockmgr.h.
J> 
J> You will also need to patch all of these headers to remove the #error if
J> LOCK_DEBUG or LOCK_FILE isn't defined (including sys/mutex.h which you missed
J> in this commit).
J> 
J> You will also need to update all the relevant manpages (mutex.9, sx.9, 
rwlock.9,
J> and lockmgr.9) to remove the #include .
J> 
J> For MFC purposes I would suggest to also fix dpaa2 to #include 
J> explicitly as it was supposed to do previously.

I'd rather recommend to revert this commit and fix dpaa2 properly. This module 
has
a long history of incorrect include usage, which we were able to handle 
properly:

d6eabdac2ef444b62aba186c793fbd5d4226b157
7fb975c8fb970b35fc34561ed30a0fe220346cb6
b0484678d405722f40278e93cdebe95829c71f3b

We should not modify system headers to satisfy dpaa2 or any other driver.

-- 
Gleb Smirnoff



git: 47a0b59379c3 - main - pfctl: use libpfctl instead of DIOCGETRULES directly

2023-11-27 Thread Kristof Provost
The branch main has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=47a0b59379c3bec547e7c829eb12de8276227dff

commit 47a0b59379c3bec547e7c829eb12de8276227dff
Author: Kristof Provost 
AuthorDate: 2023-11-24 23:43:48 +
Commit: Kristof Provost 
CommitDate: 2023-11-27 20:36:48 +

pfctl: use libpfctl instead of DIOCGETRULES directly

MFC after:  1 week
Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 sbin/pfctl/pfctl_optimize.c | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/sbin/pfctl/pfctl_optimize.c b/sbin/pfctl/pfctl_optimize.c
index aefd7b6471e5..95292999c50a 100644
--- a/sbin/pfctl/pfctl_optimize.c
+++ b/sbin/pfctl/pfctl_optimize.c
@@ -877,24 +877,23 @@ block_feedback(struct pfctl *pf, struct superblock *block)
 int
 load_feedback_profile(struct pfctl *pf, struct superblocks *superblocks)
 {
+   char anchor_call[MAXPATHLEN] = "";
struct superblock *block, *blockcur;
struct superblocks prof_superblocks;
struct pf_opt_rule *por;
struct pf_opt_queue queue;
-   struct pfioc_rule pr;
+   struct pfctl_rules_info rules;
struct pfctl_rule a, b, rule;
int nr, mnr;
 
TAILQ_INIT(&queue);
TAILQ_INIT(&prof_superblocks);
 
-   memset(&pr, 0, sizeof(pr));
-   pr.rule.action = PF_PASS;
-   if (ioctl(pf->dev, DIOCGETRULES, &pr)) {
+   if (pfctl_get_rules_info(pf->dev, &rules, PF_PASS, "")) {
warn("DIOCGETRULES");
return (1);
}
-   mnr = pr.nr;
+   mnr = rules.nr;
 
DEBUG("Loading %d active rules for a feedback profile", mnr);
for (nr = 0; nr < mnr; ++nr) {
@@ -903,15 +902,14 @@ load_feedback_profile(struct pfctl *pf, struct 
superblocks *superblocks)
warn("calloc");
return (1);
}
-   pr.nr = nr;
 
-   if (pfctl_get_rule(pf->dev, nr, pr.ticket, "", PF_PASS,
-   &rule, pr.anchor_call)) {
+   if (pfctl_get_rule(pf->dev, nr, rules.ticket, "", PF_PASS,
+   &rule, anchor_call)) {
warn("DIOCGETRULENV");
return (1);
}
memcpy(&por->por_rule, &rule, sizeof(por->por_rule));
-   rs = pf_find_or_create_ruleset(pr.anchor_call);
+   rs = pf_find_or_create_ruleset(anchor_call);
por->por_rule.anchor = rs->anchor;
if (TAILQ_EMPTY(&por->por_rule.rpool.list))
memset(&por->por_rule.rpool, 0,



git: 2905d10b3927 - main - snmp_pf: use libpfctl's pfctl_get_rules_info() rather than DIOCGETRULES

2023-11-27 Thread Kristof Provost
The branch main has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=2905d10b392766faf0e0ce8070864132d8ab66c3

commit 2905d10b392766faf0e0ce8070864132d8ab66c3
Author: Kristof Provost 
AuthorDate: 2023-11-27 16:48:33 +
Commit: Kristof Provost 
CommitDate: 2023-11-27 20:36:48 +

snmp_pf: use libpfctl's pfctl_get_rules_info() rather than DIOCGETRULES

Prefer libpfctl functions over direct access to the ioctl whenever
possible.

Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c | 15 ++-
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c 
b/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c
index a5786007d3f4..bb064dd549d2 100644
--- a/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c
+++ b/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c
@@ -1513,24 +1513,21 @@ err2:
 static int
 pfl_scan_ruleset(const char *path)
 {
-   struct pfioc_rule pr;
+   struct pfctl_rules_info rules;
struct pfctl_rule rule;
+   char anchor_call[MAXPATHLEN] = "";
struct pfl_entry *e;
u_int32_t nr, i;
 
-   bzero(&pr, sizeof(pr));
-   strlcpy(pr.anchor, path, sizeof(pr.anchor));
-   pr.rule.action = PF_PASS;
-   if (ioctl(dev, DIOCGETRULES, &pr)) {
+   if (pfctl_get_rules_info(dev, &rules, PF_PASS, path)) {
syslog(LOG_ERR, "pfl_scan_ruleset: ioctl(DIOCGETRULES): %s",
strerror(errno));
goto err;
}
 
-   for (nr = pr.nr, i = 0; i < nr; i++) {
-   pr.nr = i;
-   if (pfctl_get_rule(dev, pr.nr, pr.ticket, pr.anchor,
-   PF_PASS, &rule, pr.anchor_call)) {
+   for (nr = rules.nr, i = 0; i < nr; i++) {
+   if (pfctl_get_rule(dev, i, rules.ticket, path,
+   PF_PASS, &rule, anchor_call)) {
syslog(LOG_ERR, "pfl_scan_ruleset: ioctl(DIOCGETRULE):"
" %s", strerror(errno));
goto err;



git: 44f323ecdec0 - main - pf: implement DIOCGETRULES via netlink

2023-11-27 Thread Kristof Provost
The branch main has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=44f323ecdec02dc947c34d08c34b881fe2da1ba6

commit 44f323ecdec02dc947c34d08c34b881fe2da1ba6
Author: Kristof Provost 
AuthorDate: 2023-11-24 23:42:44 +
Commit: Kristof Provost 
CommitDate: 2023-11-27 20:36:49 +

pf: implement DIOCGETRULES via netlink

Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 lib/libpfctl/libpfctl.c   | 57 ++--
 sys/net/pfvar.h   |  1 +
 sys/netpfil/pf/pf_ioctl.c | 56 +++-
 sys/netpfil/pf/pf_nl.c| 66 +--
 sys/netpfil/pf/pf_nl.h|  9 +++
 5 files changed, 149 insertions(+), 40 deletions(-)

diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c
index a600031ec0a9..513d2d0f01be 100644
--- a/lib/libpfctl/libpfctl.c
+++ b/lib/libpfctl/libpfctl.c
@@ -1119,26 +1119,55 @@ pfctl_add_rule(int dev __unused, const struct 
pfctl_rule *r, const char *anchor,
return (e.error);
 }
 
+#define_IN(_field) offsetof(struct genlmsghdr, _field)
+#define_OUT(_field)offsetof(struct pfctl_rules_info, _field)
+static struct snl_attr_parser ap_getrules[] = {
+   { .type = PF_GR_NR, .off = _OUT(nr), .cb = snl_attr_get_uint32 },
+   { .type = PF_GR_TICKET, .off = _OUT(ticket), .cb = snl_attr_get_uint32 
},
+};
+static struct snl_field_parser fp_getrules[] = {
+};
+#undef _IN
+#undef _OUT
+SNL_DECLARE_PARSER(getrules_parser, struct genlmsghdr, fp_getrules, 
ap_getrules);
+
 int
-pfctl_get_rules_info(int dev, struct pfctl_rules_info *rules, uint32_t ruleset,
+pfctl_get_rules_info(int dev __unused, struct pfctl_rules_info *rules, 
uint32_t ruleset,
 const char *path)
 {
-   struct pfioc_rule pr;
-   int ret;
+   struct snl_state ss = {};
+   struct snl_errmsg_data e = {};
+   struct nlmsghdr *hdr;
+   struct snl_writer nw;
+   uint32_t seq_id;
+   int family_id;
 
-   bzero(&pr, sizeof(pr));
-   if (strlcpy(pr.anchor, path, sizeof(pr.anchor)) >= sizeof(pr.anchor))
-   return (E2BIG);
+   snl_init(&ss, NETLINK_GENERIC);
+   family_id = snl_get_genl_family(&ss, PFNL_FAMILY_NAME);
+   if (family_id == 0)
+   return (ENOTSUP);
 
-   pr.rule.action = ruleset;
-   ret = ioctl(dev, DIOCGETRULES, &pr);
-   if (ret != 0)
-   return (ret);
+   snl_init_writer(&ss, &nw);
+   hdr = snl_create_genl_msg_request(&nw, family_id, PFNL_CMD_GETRULES);
+   hdr->nlmsg_flags |= NLM_F_DUMP;
 
-   rules->nr = pr.nr;
-   rules->ticket = pr.ticket;
+   snl_add_msg_attr_string(&nw, PF_GR_ANCHOR, path);
+   snl_add_msg_attr_u8(&nw, PF_GR_ACTION, ruleset);
 
-   return (0);
+   hdr = snl_finalize_msg(&nw);
+   if (hdr == NULL)
+   return (ENOMEM);
+
+   seq_id = hdr->nlmsg_seq;
+   if (! snl_send_message(&ss, hdr))
+   return (ENXIO);
+
+   while ((hdr = snl_read_reply_multi(&ss, seq_id, &e)) != NULL) {
+   if (! snl_parse_nlmsg(&ss, hdr, &getrules_parser, rules))
+   continue;
+   }
+
+   return (e.error);
 }
 
 int
@@ -1368,7 +1397,7 @@ SNL_DECLARE_PARSER(state_parser, struct genlmsghdr, 
fp_state, ap_state);
 
 static const struct snl_hdr_parser *all_parsers[] = {
&state_parser, &skey_parser, &speer_parser,
-   &creator_parser,
+   &creator_parser, &getrules_parser
 };
 
 static int
diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index 4b10190bf9ea..48162b786a86 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -2473,6 +2473,7 @@ intpf_keth_anchor_nvcopyout(
 struct pf_keth_ruleset *pf_find_or_create_keth_ruleset(const char *);
 voidpf_keth_anchor_remove(struct pf_keth_rule *);
 
+int pf_ioctl_getrules(struct pfioc_rule *);
 int pf_ioctl_addrule(struct pf_krule *, uint32_t,
uint32_t, const char *, const char *, uid_t uid,
pid_t);
diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c
index 1598939c2375..ec55d43d3800 100644
--- a/sys/netpfil/pf/pf_ioctl.c
+++ b/sys/netpfil/pf/pf_ioctl.c
@@ -2021,6 +2021,36 @@ pf_rule_to_krule(const struct pf_rule *rule, struct 
pf_krule *krule)
return (0);
 }
 
+int
+pf_ioctl_getrules(struct pfioc_rule *pr)
+{
+   struct pf_kruleset  *ruleset;
+   struct pf_krule *tail;
+   int  rs_num;
+
+   PF_RULES_WLOCK();
+   ruleset = pf_find_kruleset(pr->anchor);
+   if (ruleset == NULL) {
+   PF_RULES_WUNLOCK();
+   return (EINVAL);
+   }
+   rs_num = pf_get_ruleset_number(pr->rule.action);
+   if (rs_num >= PF_RULESET_MAX) {
+   PF_RULES_WUNLOCK();
+   return (EINVAL);
+   }
+   tail = TAILQ_LAST(rule

git: 0187875a6c0b - main - pfctl: Fix recursive printing of anchor labels

2023-11-27 Thread Kristof Provost
The branch main has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=0187875a6c0b68a8026be174f8a0f968fc8ab6ed

commit 0187875a6c0b68a8026be174f8a0f968fc8ab6ed
Author: Luiz Amaral 
AuthorDate: 2023-11-27 15:53:27 +
Commit: Kristof Provost 
CommitDate: 2023-11-27 20:37:33 +

pfctl: Fix recursive printing of anchor labels

We recently noticed that the recursive printing of labels wasn't working
like the recursive printing of rules.

When running pfctl -sr -a* we get a listing of all rules, including the
ones inside anchors. On the other hand, when running pfctl -sl -a*, it
would only print the labels in the root level, just like without the
-a* argument.

As in our use-case we are interested on labels only and our labels are
unique even between anchors, we didn't add indentation or hierarchy to
the printing.

Sponsored by:   InnoGames GmbH
Differential Revision:  https://reviews.freebsd.org/D42728
---
 sbin/pfctl/pfctl.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c
index b752d87e63c6..2702c701f9cc 100644
--- a/sbin/pfctl/pfctl.c
+++ b/sbin/pfctl/pfctl.c
@@ -1367,6 +1367,14 @@ pfctl_show_rules(int dev, char *path, int opts, enum 
pfctl_show format,
(unsigned long long)rule.bytes[1],
(uintmax_t)rule.states_tot);
}
+
+   if (anchor_call[0] &&
+   (((p = strrchr(anchor_call, '/')) ?
+ p[1] == '_' : anchor_call[0] == '_') ||
+opts & PF_OPT_RECURSE)) {
+   pfctl_show_rules(dev, npath, opts, format,
+   anchor_call, depth, rule.anchor_wildcard);
+   }
break;
}
case PFCTL_SHOW_RULES:



git: 1d723c1e565e - main - pf tests: test recursive printing of labels

2023-11-27 Thread Kristof Provost
The branch main has been updated by kp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=1d723c1e565e714e4192883d813ef81e97220f27

commit 1d723c1e565e714e4192883d813ef81e97220f27
Author: Kristof Provost 
AuthorDate: 2023-11-27 15:47:36 +
Commit: Kristof Provost 
CommitDate: 2023-11-27 20:37:33 +

pf tests: test recursive printing of labels

Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 tests/sys/netpfil/pf/anchor.sh | 35 +++
 1 file changed, 35 insertions(+)

diff --git a/tests/sys/netpfil/pf/anchor.sh b/tests/sys/netpfil/pf/anchor.sh
index cf6da8740003..b1faa5f6c57e 100644
--- a/tests/sys/netpfil/pf/anchor.sh
+++ b/tests/sys/netpfil/pf/anchor.sh
@@ -130,9 +130,44 @@ wildcard_cleanup()
pft_cleanup
 }
 
+atf_test_case "nested_label" "cleanup"
+nested_label_head()
+{
+   atf_set descr "Test recursive listing of labels"
+   atf_set require.user root
+}
+
+nested_label_body()
+{
+   pft_init
+
+   vnet_mkjail alcatraz
+
+   pft_set_rules alcatraz \
+   "anchor \"foo\" { \n\
+   pass in quick proto icmp label \"passicmp\"\n\
+   anchor \"bar\" { \n\
+   pass in proto tcp label \"passtcp\"\n\
+   } \n\
+   }" \
+   "pass quick from any to any label \"anytoany\""
+
+   atf_check -s exit:0 \
+   -o inline:"passicmp 0 0 0 0 0 0 0 0
+passtcp 0 0 0 0 0 0 0 0
+anytoany 0 0 0 0 0 0 0 0
+" jexec alcatraz pfctl -sl -a*
+}
+
+nested_label_cleanup()
+{
+   pft_cleanup
+}
+
 atf_init_test_cases()
 {
atf_add_test_case "pr183198"
atf_add_test_case "nested_anchor"
atf_add_test_case "wildcard"
+   atf_add_test_case "nested_label"
 }



git: 96950419f155 - main - tests: don't run atf_* in a subshell

2023-11-27 Thread Gleb Smirnoff
The branch main has been updated by glebius:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=96950419f15510287080c557174e0d8409f06956

commit 96950419f15510287080c557174e0d8409f06956
Author: Gleb Smirnoff 
AuthorDate: 2023-11-27 21:15:58 +
Commit: Gleb Smirnoff 
CommitDate: 2023-11-27 21:15:59 +

tests: don't run atf_* in a subshell

Shell limitation is that a classic function call via $() is a subshell
and atf-sh(3) commands won't work as epxected there.  Subsequently,
atf_skip inside a function won't skip a test.  The test will fail later.

A working approach is to pass desired variable name as argument to
a function and don't run subshell.

Reviewed by:ngie
Differential Revision:  https://reviews.freebsd.org/D42646
Fixes:  ea82362219ee715cfbb195b2114e73fdc8599fa5
---
 tests/sys/geom/class/concat/1_test.sh  |  6 ++--
 tests/sys/geom/class/concat/2_test.sh  |  6 ++--
 tests/sys/geom/class/concat/append1.sh |  6 ++--
 tests/sys/geom/class/concat/append2.sh | 12 
 tests/sys/geom/class/eli/attach_test.sh| 12 
 tests/sys/geom/class/eli/conf.sh   | 16 ++-
 tests/sys/geom/class/eli/configure_test.sh |  2 +-
 tests/sys/geom/class/eli/delkey_test.sh|  4 +--
 tests/sys/geom/class/eli/detach_test.sh|  2 +-
 tests/sys/geom/class/eli/init_test.sh  | 10 +++
 tests/sys/geom/class/eli/kill_test.sh  |  4 +--
 tests/sys/geom/class/eli/misc_test.sh  |  4 +--
 tests/sys/geom/class/eli/onetime_test.sh   |  4 +--
 tests/sys/geom/class/eli/online_resize_test.sh |  2 +-
 tests/sys/geom/class/eli/resize_test.sh|  2 +-
 tests/sys/geom/class/eli/setkey_test.sh|  8 +++---
 tests/sys/geom/class/geom_subr.sh  | 10 ---
 tests/sys/geom/class/mirror/10_test.sh |  8 +++---
 tests/sys/geom/class/mirror/11_test.sh |  8 +++---
 tests/sys/geom/class/mirror/12_test.sh |  8 +++---
 tests/sys/geom/class/mirror/13_test.sh |  8 +++---
 tests/sys/geom/class/mirror/1_test.sh  |  6 ++--
 tests/sys/geom/class/mirror/2_test.sh  |  6 ++--
 tests/sys/geom/class/mirror/3_test.sh  |  6 ++--
 tests/sys/geom/class/mirror/4_test.sh  |  6 ++--
 tests/sys/geom/class/mirror/5_test.sh  |  6 ++--
 tests/sys/geom/class/mirror/6_test.sh  |  6 ++--
 tests/sys/geom/class/mirror/7_test.sh  |  6 ++--
 tests/sys/geom/class/mirror/8_test.sh  |  4 +--
 tests/sys/geom/class/mirror/9_test.sh  |  6 ++--
 tests/sys/geom/class/mirror/component_selection.sh |  6 ++--
 tests/sys/geom/class/mirror/sync_error.sh  | 10 +++
 tests/sys/geom/class/raid3/10_test.sh  |  6 ++--
 tests/sys/geom/class/raid3/11_test.sh  |  6 ++--
 tests/sys/geom/class/raid3/12_test.sh  |  6 ++--
 tests/sys/geom/class/raid3/1_test.sh   |  6 ++--
 tests/sys/geom/class/raid3/2_test.sh   |  6 ++--
 tests/sys/geom/class/raid3/3_test.sh   |  6 ++--
 tests/sys/geom/class/raid3/4_test.sh   |  6 ++--
 tests/sys/geom/class/raid3/5_test.sh   |  6 ++--
 tests/sys/geom/class/raid3/6_test.sh   |  6 ++--
 tests/sys/geom/class/raid3/7_test.sh   |  6 ++--
 tests/sys/geom/class/raid3/8_test.sh   |  6 ++--
 tests/sys/geom/class/raid3/9_test.sh   |  6 ++--
 tests/sys/geom/class/shsec/1_test.sh   |  6 ++--
 tests/sys/geom/class/shsec/2_test.sh   |  6 ++--
 tests/sys/geom/class/stripe/1_test.sh  |  6 ++--
 tests/sys/geom/class/stripe/2_test.sh  |  6 ++--
 tests/sys/geom/class/union/union_test.sh   | 32 +++---
 tests/sys/geom/class/uzip/1_test.sh|  2 +-
 tests/sys/kern/sendfile_test.sh| 14 +-
 51 files changed, 179 insertions(+), 175 deletions(-)

diff --git a/tests/sys/geom/class/concat/1_test.sh 
b/tests/sys/geom/class/concat/1_test.sh
index a35b015e9c24..126768370140 100644
--- a/tests/sys/geom/class/concat/1_test.sh
+++ b/tests/sys/geom/class/concat/1_test.sh
@@ -4,9 +4,9 @@
 
 echo '1..1'
 
-us0=$(attach_md -t malloc -s 1M) || exit 1
-us1=$(attach_md -t malloc -s 2M) || exit 1
-us2=$(attach_md -t malloc -s 3M) || exit 1
+attach_md us0 -t malloc -s 1M || exit 1
+attach_md us1 -t malloc -s 2M || exit 1
+attach_md us2 -t malloc -s 3M || exit 1
 
 gconcat create $name /dev/$us0 /dev/$us1 /dev/$us2 || exit 1
 devwait
diff --git a/tests/sys/geom/class/concat/2_test.sh 
b/tests/sys/geom/class/concat/2_test.sh
index 7b41932f054a..63e545f12297 100644
--- a/tests/sys/geom/class/concat/2_test.sh
+++ b/tests/sys/geom/class/concat/2_test.sh
@@ -8,9 +8,9 @@ tsize=6
 src=`mktemp $base.XX` || exit 1
 dst

git: 97bd53ef4d20 - main - Makefile.vm: Fix duplicate rc.conf files

2023-11-27 Thread Colin Percival
The branch main has been updated by cperciva:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=97bd53ef4d20b7d15e0b0976e885af9438f5637e

commit 97bd53ef4d20b7d15e0b0976e885af9438f5637e
Author: Colin Percival 
AuthorDate: 2023-11-27 21:29:05 +
Commit: Colin Percival 
CommitDate: 2023-11-27 21:35:41 +

Makefile.vm: Fix duplicate rc.conf files

Two bugs in Makefile.vm resulted in disk images being "built" multiple
times, resulting in lines added to /etc/rc.conf being duplicated:

1. The vm-image target reused the same "staging tree" directory for all
of its builds (multiple disk image types and multiple filesystem types).

2. The cw-type-flavour-fs target depends on emulator-portinstall, which
did not have a 'touch ${.TARGET}' and thus re-ran every time -- and
caused the cw-type-flavour-fs target to be re-run.  This was triggered
by release builds running `make cloudware-release` (creating the disk
images) followed by `make ec2amis` (which re-created the disk images
prior to uploading them).

MFC After:  1 week
Sponsored by:   https://www.patreon.com/cperciva
---
 release/Makefile.vm | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/release/Makefile.vm b/release/Makefile.vm
index 1a58a548b9f4..a7624775d48c 100644
--- a/release/Makefile.vm
+++ b/release/Makefile.vm
@@ -81,6 +81,7 @@ emulator-portinstall:
env ASSUME_ALWAYS_YES=yes pkg install -y emulators/qemu-user-static
 .endif
 .endif
+   touch ${.TARGET}
 
 QEMUSTATIC=/usr/local/bin/qemu-${TARGET_ARCH}-static
 .endif
@@ -137,10 +138,11 @@ vm-image:
 .if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES)
 . for FORMAT in ${VMFORMATS}
 .  for FS in ${VMFSLIST}
-   mkdir -p ${.OBJDIR}/${.TARGET}
+   mkdir -p ${.OBJDIR}/${.TARGET}-${FORMAT}-${FS}
env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} SWAPSIZE=${SWAPSIZE} \
${.CURDIR}/scripts/mk-vmimage.sh \
-   -C ${.CURDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} -F 
${FS} \
+   -C ${.CURDIR}/tools/vmimage.subr \
+   -d ${.OBJDIR}/${.TARGET}-${FORMAT}-${FS} -F ${FS} \
-i ${.OBJDIR}/${FORMAT}.${FS}.img -s ${VMSIZE} -f ${FORMAT} \
-S ${WORLDDIR} -o ${.OBJDIR}/${VMBASE}.${FS}.${FORMAT}
 .  endfor



git: 8b923102f957 - main - Revert "cdefs: Remove __func__ define"

2023-11-27 Thread Warner Losh
The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=8b923102f957e72c686d41075ce040f61e64fe6f

commit 8b923102f957e72c686d41075ce040f61e64fe6f
Author: Warner Losh 
AuthorDate: 2023-11-27 18:47:21 +
Commit: Warner Losh 
CommitDate: 2023-11-27 21:59:54 +

Revert "cdefs: Remove __func__ define"

This reverts commit 17a238a15fbed01477fbc54744d35cbccdb65871. There were
too many other changes accidentally mixed in.

Sponsored by:   Netflix
---
 sys/sys/cdefs.h| 40 --
 tests/sys/opencrypto/cryptodevh.py |  4 
 2 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index bcbf418f9323..c5b6190077b3 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -96,9 +96,14 @@
 /*
  * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
  * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
+ * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI
+ * mode -- there must be no spaces between its arguments, and for nested
+ * __CONCAT's, all the __CONCAT's must be at the left.  __CONCAT can also
+ * concatenate double-quoted strings produced by the __STRING macro, but
+ * this only works with ANSI C.
  *
  * __XSTRING is like __STRING, but it expands any macros in its argument
- * first.
+ * first.  It is only available with ANSI C.
  */
 #if defined(__STDC__) || defined(__cplusplus)
 #define__P(protos) protos  /* full-blown ANSI C */
@@ -117,7 +122,33 @@
 #define__inline/* delete GCC keyword */
 #endif /* ! __CC_SUPPORTS___INLINE */
 #endif /* !__cplusplus */
-#endif /* __STDC__ || __cplusplus */
+
+#else  /* !(__STDC__ || __cplusplus) */
+#define__P(protos) ()  /* traditional C preprocessor */
+#define__CONCAT(x,y)   x/**/y
+#define__STRING(x) "x"
+
+#if !defined(__CC_SUPPORTS___INLINE)
+#define__const /* delete pseudo-ANSI C 
keywords */
+#define__inline
+#define__signed
+#define__volatile
+/*
+ * In non-ANSI C environments, new programs will want ANSI-only C keywords
+ * deleted from the program and old programs will want them left alone.
+ * When using a compiler other than gcc, programs using the ANSI C keywords
+ * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
+ * When using "gcc -traditional", we assume that this is the intent; if
+ * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
+ */
+#ifndefNO_ANSI_KEYWORDS
+#defineconst   /* delete ANSI C keywords */
+#defineinline
+#definesigned
+#definevolatile
+#endif /* !NO_ANSI_KEYWORDS */
+#endif /* !__CC_SUPPORTS___INLINE */
+#endif /* !(__STDC__ || __cplusplus) */
 
 /*
  * Compiler-dependent macros to help declare dead (non-returning) and
@@ -312,6 +343,11 @@
 #define__unreachable() ((void)0)
 #endif
 
+/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
+#if !__GNUC_PREREQ__(2, 7)
+#define__func__NULL
+#endif
+
 #if (defined(__GNUC__) && __GNUC__ >= 2) && !defined(__STRICT_ANSI__) || 
__STDC_VERSION__ >= 199901
 #define__LONG_LONG_SUPPORTED
 #endif
diff --git a/tests/sys/opencrypto/cryptodevh.py 
b/tests/sys/opencrypto/cryptodevh.py
index 2d723999abc7..9607bcd4d115 100644
--- a/tests/sys/opencrypto/cryptodevh.py
+++ b/tests/sys/opencrypto/cryptodevh.py
@@ -29,6 +29,10 @@ def __STRING(x): return #x
 
 def __XSTRING(x): return __STRING(x)
 
+def __P(protos): return ()  
+
+def __STRING(x): return "x"
+
 def __aligned(x): return __attribute__((__aligned__(x)))
 
 def __section(x): return __attribute__((__section__(x)))



git: a5c27819344b - main - cdefs: Remove __func__ stub.

2023-11-27 Thread Warner Losh
The branch main has been updated by imp:

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

commit a5c27819344bfcbdf5ae6a430af9c6ca98b0a249
Author: Warner Losh 
AuthorDate: 2023-11-27 18:48:39 +
Commit: Warner Losh 
CommitDate: 2023-11-27 21:59:54 +

cdefs: Remove __func__ stub.

Redo 17a238a15fbe. Remove the __func__ crutch for gcc 2.95 and earlier.
We don't need it today to build the tree (since gcc < 12 is unlikely to
work). And it's not used in any system header that's part of the
standard interfaces today (so we don't need it for compatibility). And
we have other issues that make gcc < 4.2 unlikely to work today with
system headers.

Sponsored by:   Netflix
---
 sys/sys/cdefs.h | 5 -
 1 file changed, 5 deletions(-)

diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h
index c5b6190077b3..fcc90b4d8aee 100644
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -343,11 +343,6 @@
 #define__unreachable() ((void)0)
 #endif
 
-/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
-#if !__GNUC_PREREQ__(2, 7)
-#define__func__NULL
-#endif
-
 #if (defined(__GNUC__) && __GNUC__ >= 2) && !defined(__STRICT_ANSI__) || 
__STDC_VERSION__ >= 199901
 #define__LONG_LONG_SUPPORTED
 #endif



git: c596126a5d3d - main - pmbr: Only load the first 545k rather than error out

2023-11-27 Thread Warner Losh
The branch main has been updated by imp:

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

commit c596126a5d3d2ee015ee6807b4041efa5b9d9b07
Author: Warner Losh 
AuthorDate: 2023-11-27 22:40:40 +
Commit: Warner Losh 
CommitDate: 2023-11-27 22:45:56 +

pmbr: Only load the first 545k rather than error out

It would be nice to have larger boot partitions for ESPs to live in one
day. It's trivial to carve out 5M 10M or 200M when provisioning, but
logistical issues may make it hard to do it after the fact. So only warn
when the partition is > 545k. If we ever grow the boot loader larger
than that, then it will be responsible for loading the rest anyway.

Sponsored by:   Netflix
Reviewed by:tsoome
Differential Revision:  https://reviews.freebsd.org/D42774
---
 stand/i386/pmbr/pmbr.S | 24 +++-
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/stand/i386/pmbr/pmbr.S b/stand/i386/pmbr/pmbr.S
index c61acbe261bd..60b26df15720 100644
--- a/stand/i386/pmbr/pmbr.S
+++ b/stand/i386/pmbr/pmbr.S
@@ -155,8 +155,10 @@ next_boot: addl $1,(%si)   # Next LBA
mov %es,%ax # Adjust segment for next
addw $SECSIZE/16,%ax#  sector
cmp $0x9000,%ax # Don't load past 0x9,
-   jae err_big #  545k should be enough for
-   mov %ax,%es #  any boot code. :)
+   jb sz_ok#  545k should be enough for
+   call err_big#  any boot code, but warn
+   mov $0x9000-SECSIZE/16,%ax  #  and truncate
+sz_ok: mov %ax,%es
jmp load_boot
 #
 # Move to the next partition.  If we walk off the end of the sector, load
@@ -203,17 +205,21 @@ getdrvparams:
 #
 # Various error message entry points.
 #
-err_big:   movw $msg_big,%si   # "Boot loader too
-   jmp putstr  #  large"
+err_big:   movw $msg_big,%si   # "Truncated
+   call putstr #  to 545k"
+   ret
 
 err_pt:movw $msg_pt,%si# "Invalid partition
-   jmp putstr  #  table"
+   call putstr #  table"
+err_pt.1:  jmp err_pt.1# Await reset
 
 err_rd:movw $msg_rd,%si# "I/O error loading
-   jmp putstr  #  boot loader"
+   call putstr #  boot loader"
+   jmp err_pt.1
 
 err_noboot:movw $msg_noboot,%si# "Missing boot
-   jmp putstr  #  loader"
+   call putstr #  loader"
+   jmp err_pt.1
 #
 # Output an ASCIZ string to the console via the BIOS.
 # 
@@ -223,9 +229,9 @@ putstr.0:   movw $0x7,%bx   # Page:attribute
 putstr:lodsb   # Get character
testb %al,%al   # End of string?
jnz putstr.0# No
-putstr.1:  jmp putstr.1# Await reset
+   ret
 
-msg_big:   .asciz "Boot loader too large"
+msg_big:   .asciz "Loaded only 545k"
 msg_pt:.asciz "Invalid partition table"
 msg_rd:.asciz "I/O error loading boot loader"
 msg_noboot:.asciz "Missing boot loader"



git: 4064a1108b51 - main - netgraph: increase size of sockaddr_ng to match maximum node name

2023-11-27 Thread Gleb Smirnoff
The branch main has been updated by glebius:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=4064a1108b51b24903c8d67db21e8dbaf89b475f

commit 4064a1108b51b24903c8d67db21e8dbaf89b475f
Author: Gleb Smirnoff 
AuthorDate: 2023-11-28 04:10:52 +
Commit: Gleb Smirnoff 
CommitDate: 2023-11-28 04:10:52 +

netgraph: increase size of sockaddr_ng to match maximum node name

The ng_socket(4) node already writes more than declared size of the
struct at least in the in ng_getsockaddr().  Make size match size of
a node name.  The value is pasted instead of including ng_message.h
into ng_socket.h.  This is external API and we want to keep it stable
even if NG_NODESIZ is redefined in a kernel build.

Reviewed by:afedorov
Differential Revision:  https://reviews.freebsd.org/D42690
---
 sys/netgraph/ng_message.h   | 5 -
 sys/netgraph/ng_socket.h| 2 +-
 tests/sys/netgraph/socket.c | 5 -
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/sys/netgraph/ng_message.h b/sys/netgraph/ng_message.h
index 46659bc4cec5..45556ecc609c 100644
--- a/sys/netgraph/ng_message.h
+++ b/sys/netgraph/ng_message.h
@@ -42,7 +42,10 @@
 #ifndef _NETGRAPH_NG_MESSAGE_H_
 #define _NETGRAPH_NG_MESSAGE_H_
 
-/* ASCII string size limits */
+/*
+ * ASCII string size limits
+ * Check with struct sockaddr_ng if changing.
+ */
 #defineNG_TYPESIZ  32  /* max type name len (including null) */
 #defineNG_HOOKSIZ  32  /* max hook name len (including null) */
 #defineNG_NODESIZ  32  /* max node name len (including null) */
diff --git a/sys/netgraph/ng_socket.h b/sys/netgraph/ng_socket.h
index 7556ec645f3d..9b537a52814a 100644
--- a/sys/netgraph/ng_socket.h
+++ b/sys/netgraph/ng_socket.h
@@ -60,7 +60,7 @@ enum {
 struct sockaddr_ng {
unsigned char   sg_len; /* total length */
sa_family_t sg_family;  /* address family */
-   charsg_data[14];/* actually longer; address value */
+   charsg_data[32];/* see NG_NODESIZ in ng_message.h */
 };
 
 #endif /* _NETGRAPH_NG_SOCKET_H_ */
diff --git a/tests/sys/netgraph/socket.c b/tests/sys/netgraph/socket.c
index b5216dcc2c39..bd40e4358866 100644
--- a/tests/sys/netgraph/socket.c
+++ b/tests/sys/netgraph/socket.c
@@ -53,12 +53,7 @@ ATF_TC_BODY(getsockname, tc)
/* Named node. */
ATF_REQUIRE(NgMkSockNode(name, &cs, NULL) == 0);
ATF_REQUIRE(getsockname(cs, (struct sockaddr *)&sg, &len) == 0);
-#if 0
-   /* sockaddr_ng truncates name now. */
ATF_REQUIRE(strcmp(sg.sg_data, NAME) == 0);
-#else
-   ATF_REQUIRE(strncmp(sg.sg_data, NAME, sizeof(sg.sg_data)) == 0);
-#endif
 }
 
 ATF_TP_ADD_TCS(tp)



git: d2de66a90d01 - main - ng_socket: with getsockname() return node ID for unnamed node

2023-11-27 Thread Gleb Smirnoff
The branch main has been updated by glebius:

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

commit d2de66a90d01810b1869b7dcac290267f05e4b1d
Author: Gleb Smirnoff 
AuthorDate: 2023-11-28 04:11:38 +
Commit: Gleb Smirnoff 
CommitDate: 2023-11-28 04:11:38 +

ng_socket: with getsockname() return node ID for unnamed node

Reviewed by:afedorov
Differential Revision:  https://reviews.freebsd.org/D42691
---
 sys/netgraph/ng_socket.c| 3 +++
 tests/sys/netgraph/socket.c | 7 +++
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/sys/netgraph/ng_socket.c b/sys/netgraph/ng_socket.c
index 4afa46c3d0f0..8a8f127ee39b 100644
--- a/sys/netgraph/ng_socket.c
+++ b/sys/netgraph/ng_socket.c
@@ -523,6 +523,9 @@ ng_getsockaddr(struct socket *so, struct sockaddr **addr)
if (NG_NODE_HAS_NAME(node))
bcopy(NG_NODE_NAME(node), sg->sg_data,
strlen(NG_NODE_NAME(node)));
+   else
+   snprintf(sg->sg_data, sizeof(sg->sg_data), "[%x]",
+   ng_node2ID(node));
mtx_unlock(&pcbp->sockdata->mtx);
 
sg->sg_len = sg_len;
diff --git a/tests/sys/netgraph/socket.c b/tests/sys/netgraph/socket.c
index bd40e4358866..1e5d68e1d21f 100644
--- a/tests/sys/netgraph/socket.c
+++ b/tests/sys/netgraph/socket.c
@@ -42,13 +42,12 @@ ATF_TC_BODY(getsockname, tc)
char name[NG_NODESIZ] = NAME;
int cs;
 
-#if 0
-   /* Unnamed node. */
+   /* Unnamed node returns its ID as name. */
ATF_REQUIRE(NgMkSockNode(NULL, &cs, NULL) == 0);
ATF_REQUIRE(getsockname(cs, (struct sockaddr *)&sg, &len) == 0);
+   ATF_REQUIRE(strspn(sg.sg_data, "[0123456789abcdef]") >= 3 &&
+   sg.sg_data[strspn(sg.sg_data, "[0123456789abcdef]")] == '\0');
close(cs);
-   /* Unnamed node doesn't return any name/ID now. */
-#endif
 
/* Named node. */
ATF_REQUIRE(NgMkSockNode(name, &cs, NULL) == 0);