CVS commit: src/usr.bin/cvslatest

2023-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar  7 21:24:19 UTC 2023

Modified Files:
src/usr.bin/cvslatest: cvslatest.c

Log Message:
simplify previous


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/cvslatest/cvslatest.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/cvslatest/cvslatest.c
diff -u src/usr.bin/cvslatest/cvslatest.c:1.10 src/usr.bin/cvslatest/cvslatest.c:1.11
--- src/usr.bin/cvslatest/cvslatest.c:1.10	Wed Feb 15 12:00:24 2023
+++ src/usr.bin/cvslatest/cvslatest.c	Tue Mar  7 16:24:19 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cvslatest.c,v 1.10 2023/02/15 17:00:24 martin Exp $	*/
+/*	$NetBSD: cvslatest.c,v 1.11 2023/03/07 21:24:19 christos Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: cvslatest.c,v 1.10 2023/02/15 17:00:24 martin Exp $");
+__RCSID("$NetBSD: cvslatest.c,v 1.11 2023/03/07 21:24:19 christos Exp $");
 
 /*
  * Find the latest timestamp in a set of CVS trees, by examining the
@@ -92,6 +92,13 @@ getrepo(const FTSENT *e, char *repo, siz
 }
 
 static void
+notimestamp(const char *fn, const char *ename, int uncommitted)
+{
+	warnx("Can't get timestamp from %s file `%s' in `%s'",
+	uncommitted ? "uncommitted" : "locally modified", fn, ename);
+}
+
+static void
 getlatest(const FTSENT *e, const char *repo, struct latest *lat)
 {
 	static const char fmt[] = "%a %b %d %H:%M:%S %Y";
@@ -117,28 +124,14 @@ getlatest(const FTSENT *e, const char *r
 			goto mal;
 		if ((dt = strtok(NULL, "/")) == NULL)
 			goto mal;
-		if (strcmp(dt, "dummy timestamp") == 0) {
-			warnx("Can't get timestamp from uncommitted file %s in `%s'",
-			fn, ename);
-			if (!ignore)
-exit(EXIT_FAILURE);
-			continue;
-		}
-		/*
-		 * This may not be visible in real world, but the cvs code
-		 * has paths that would create this string (mabe server
-		 * side only?)
-		 */
-		if (strcmp(dt, "dummy timestamp from new-entry") == 0) {
-			warnx("Can't get timestamp from uncommitted file %s in `%s'",
-			fn, ename);
+		if (strncmp(dt, "dummy timestamp", 14) == 0) {
+			notimestamp(fn, ename, 1);
 			if (!ignore)
 exit(EXIT_FAILURE);
 			continue;
 		}
 		if (strcmp(dt, "Result of merge") == 0) {
-			warnx("Can't get cvs timestamp for localy modified file %s in `%s', using modification time.",
-			fn, ename);
+			notimestamp(fn, ename, 0);
 			if (fstat(fileno(fp), ) == 0) {
 t = sb.st_mtime;
 goto compare;



CVS commit: src/usr.bin/cvslatest

2023-03-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar  7 21:24:19 UTC 2023

Modified Files:
src/usr.bin/cvslatest: cvslatest.c

Log Message:
simplify previous


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/cvslatest/cvslatest.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/external/bsd/drm2/radeon

2023-03-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Mar  7 20:23:00 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/radeon: radeon_pci.c

Log Message:
remove "nouveau" from a comment.  noted by jmcneill.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/external/bsd/drm2/radeon/radeon_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/radeon/radeon_pci.c
diff -u src/sys/external/bsd/drm2/radeon/radeon_pci.c:1.22 src/sys/external/bsd/drm2/radeon/radeon_pci.c:1.23
--- src/sys/external/bsd/drm2/radeon/radeon_pci.c:1.22	Tue Mar  7 09:47:48 2023
+++ src/sys/external/bsd/drm2/radeon/radeon_pci.c	Tue Mar  7 20:23:00 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeon_pci.c,v 1.22 2023/03/07 09:47:48 mrg Exp $	*/
+/*	$NetBSD: radeon_pci.c,v 1.23 2023/03/07 20:23:00 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeon_pci.c,v 1.22 2023/03/07 09:47:48 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_pci.c,v 1.23 2023/03/07 20:23:00 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "genfb.h"
@@ -285,7 +285,7 @@ radeon_attach_real(device_t self)
 	 * with a firmware-provided framebuffer address, we may have to
 	 * turn it off early, before we are ready to switch the console
 	 * over -- something goes wrong if we're still writing to the
-	 * firmware-provided framebuffer during nouveau initialization.
+	 * firmware-provided framebuffer during initialization.
 	 */
 {
 	bool is_console;



CVS commit: src/sys/external/bsd/drm2/radeon

2023-03-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Mar  7 20:23:00 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/radeon: radeon_pci.c

Log Message:
remove "nouveau" from a comment.  noted by jmcneill.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/external/bsd/drm2/radeon/radeon_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-8] src/sys/kern

2023-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar  7 20:02:57 UTC 2023

Modified Files:
src/sys/kern [netbsd-8]: vfs_syscalls.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1806):

sys/kern/vfs_syscalls.c: revision 1.557

open(2): Don't map ERESTART to EINTR.

If a file or device's open function returns ERESTART, respect that --
restart the syscall; don't pretend a signal has been delivered when
it was not.  If an SA_RESTART signal was delivered, POSIX does not
allow it to fail with EINTR:

SA_RESTART
This flag affects the behavior of interruptible functions;
that is, those specified to fail with errno set to [EINTR].
If set, and a function specified as interruptible is
interrupted by this signal, the function shall restart and
shall not fail with [EINTR] unless otherwise specified.  If
an interruptible function which uses a timeout is restarted,
the duration of the timeout following the restart is set to
an unspecified value that does not exceed the original
timeout value.  If the flag is not set, interruptible
functions interrupted by this signal shall fail with errno
set to [EINTR].

https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaction.html

Nothing in the POSIX definition of open specifies otherwise.

In 1990, Kirk McKusick added these lines with a mysterious commit
message:
Author: Kirk McKusick 
Date:   Tue Apr 10 19:36:33 1990 -0800
eliminate longjmp from the kernel (for karels)
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 7bc7b39bbf..d572d3a32d 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#)vfs_syscalls.c  7.42 (Berkeley) 3/26/90
+ * @(#)vfs_syscalls.c  7.43 (Berkeley) 4/10/90
  */
 #include "param.h"
@@ -530,8 +530,10 @@ copen(scp, fmode, cmode, ndp, resultfd)
if (error = vn_open(ndp, fmode, (cmode & 0) &~ S_ISVTX)) {
crfree(fp->f_cred);
fp->f_count--;
-   if (error == -1)/* XXX from fdopen */
-   return (0); /* XXX from fdopen */
+   if (error == EJUSTRETURN)   /* XXX from fdopen */
+   return (0); /* XXX from fdopen */
+   if (error == ERESTART)
+   error = EINTR;
scp->sc_ofile[indx] = NULL;
return (error);
}

(found via this git import of the CSRG history:
https://github.com/robohack/ucb-csrg-bsd/commit/cce2869b7ae5d360921eb411005b328a29c4a3fe

This change appears to have served two related purposes:
1. The fdopen function (the erstwhile open routine for /dev/fd/N)
   used to return -1 as a hack to mean it had just duplicated the fd;
   it was recently changed by Mike Karels, in kern_descrip.c 7.9, to
   return EJUSTRETURN, now defined to be -2, presumably to avoid a
   conflict with ERESTART, defined to be -1.  So this change finished
   part of the change by Mike Karels to use a different magic return
   code from fdopen.
   Of course, today we use still another disgusting hack, EDUPFD, for
   the same purpose, so none of this is relevant any more.
2. Prior to April 1990, the kernel handled signals during tsleep(9)
   by longjmping out to the system call entry point or similar.  In
   April 1990, Mike Karels worked to convert all of that into
   explicit unwind logic by passing through EINTR or ERESTART as
   appropriate, instead of setjmp at each entry point.

However, it's not clear to me why this setjmp/longjmp and
fdopen/-1/EJUSTRETURN renovation justifies unconditional logic to map
ERESTART to EINTR in open(2).  I suspect it was a mistake.

In 2013, the corresponding logic to map ERESTART to EINTR in open(2)
was removed from FreeBSD:

   r246472 | kib | 2013-02-07 14:53:33 + (Thu, 07 Feb 2013) | 11 lines
   Stop translating the ERESTART error from the open(2) into EINTR.
   Posix requires that open(2) is restartable for SA_RESTART.
   For non-posix objects, in particular, devfs nodes, still disable
   automatic restart of the opens. The open call to a driver could have
   significant side effects for the hardware.
   Noted and reviewed by:  jilles
   Discussed with: bde
   MFC after:  2 weeks

Index: vfs_syscalls.c
===
--- vfs_syscalls.c  (revision 246471)
+++ vfs_syscalls.c  (revision 246472)
@@ -1106,8 +1106,6 @@
goto success;
}
-   if (error == ERESTART)
-   error = EINTR;
goto bad;
}
td->td_dupfd = 0;


CVS commit: [netbsd-8] src/sys/kern

2023-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar  7 20:02:57 UTC 2023

Modified Files:
src/sys/kern [netbsd-8]: vfs_syscalls.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1806):

sys/kern/vfs_syscalls.c: revision 1.557

open(2): Don't map ERESTART to EINTR.

If a file or device's open function returns ERESTART, respect that --
restart the syscall; don't pretend a signal has been delivered when
it was not.  If an SA_RESTART signal was delivered, POSIX does not
allow it to fail with EINTR:

SA_RESTART
This flag affects the behavior of interruptible functions;
that is, those specified to fail with errno set to [EINTR].
If set, and a function specified as interruptible is
interrupted by this signal, the function shall restart and
shall not fail with [EINTR] unless otherwise specified.  If
an interruptible function which uses a timeout is restarted,
the duration of the timeout following the restart is set to
an unspecified value that does not exceed the original
timeout value.  If the flag is not set, interruptible
functions interrupted by this signal shall fail with errno
set to [EINTR].

https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaction.html

Nothing in the POSIX definition of open specifies otherwise.

In 1990, Kirk McKusick added these lines with a mysterious commit
message:
Author: Kirk McKusick 
Date:   Tue Apr 10 19:36:33 1990 -0800
eliminate longjmp from the kernel (for karels)
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 7bc7b39bbf..d572d3a32d 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#)vfs_syscalls.c  7.42 (Berkeley) 3/26/90
+ * @(#)vfs_syscalls.c  7.43 (Berkeley) 4/10/90
  */
 #include "param.h"
@@ -530,8 +530,10 @@ copen(scp, fmode, cmode, ndp, resultfd)
if (error = vn_open(ndp, fmode, (cmode & 0) &~ S_ISVTX)) {
crfree(fp->f_cred);
fp->f_count--;
-   if (error == -1)/* XXX from fdopen */
-   return (0); /* XXX from fdopen */
+   if (error == EJUSTRETURN)   /* XXX from fdopen */
+   return (0); /* XXX from fdopen */
+   if (error == ERESTART)
+   error = EINTR;
scp->sc_ofile[indx] = NULL;
return (error);
}

(found via this git import of the CSRG history:
https://github.com/robohack/ucb-csrg-bsd/commit/cce2869b7ae5d360921eb411005b328a29c4a3fe

This change appears to have served two related purposes:
1. The fdopen function (the erstwhile open routine for /dev/fd/N)
   used to return -1 as a hack to mean it had just duplicated the fd;
   it was recently changed by Mike Karels, in kern_descrip.c 7.9, to
   return EJUSTRETURN, now defined to be -2, presumably to avoid a
   conflict with ERESTART, defined to be -1.  So this change finished
   part of the change by Mike Karels to use a different magic return
   code from fdopen.
   Of course, today we use still another disgusting hack, EDUPFD, for
   the same purpose, so none of this is relevant any more.
2. Prior to April 1990, the kernel handled signals during tsleep(9)
   by longjmping out to the system call entry point or similar.  In
   April 1990, Mike Karels worked to convert all of that into
   explicit unwind logic by passing through EINTR or ERESTART as
   appropriate, instead of setjmp at each entry point.

However, it's not clear to me why this setjmp/longjmp and
fdopen/-1/EJUSTRETURN renovation justifies unconditional logic to map
ERESTART to EINTR in open(2).  I suspect it was a mistake.

In 2013, the corresponding logic to map ERESTART to EINTR in open(2)
was removed from FreeBSD:

   r246472 | kib | 2013-02-07 14:53:33 + (Thu, 07 Feb 2013) | 11 lines
   Stop translating the ERESTART error from the open(2) into EINTR.
   Posix requires that open(2) is restartable for SA_RESTART.
   For non-posix objects, in particular, devfs nodes, still disable
   automatic restart of the opens. The open call to a driver could have
   significant side effects for the hardware.
   Noted and reviewed by:  jilles
   Discussed with: bde
   MFC after:  2 weeks

Index: vfs_syscalls.c
===
--- vfs_syscalls.c  (revision 246471)
+++ vfs_syscalls.c  (revision 246472)
@@ -1106,8 +1106,6 @@
goto success;
}
-   if (error == ERESTART)
-   error = EINTR;
goto bad;
}
td->td_dupfd = 0;


CVS commit: [netbsd-9] src/doc

2023-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar  7 20:02:05 UTC 2023

Modified Files:
src/doc [netbsd-9]: CHANGES-9.4

Log Message:
Ticket #161


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.55 -r1.1.2.56 src/doc/CHANGES-9.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-9.4
diff -u src/doc/CHANGES-9.4:1.1.2.55 src/doc/CHANGES-9.4:1.1.2.56
--- src/doc/CHANGES-9.4:1.1.2.55	Fri Mar  3 17:05:04 2023
+++ src/doc/CHANGES-9.4	Tue Mar  7 20:02:04 2023
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.4,v 1.1.2.55 2023/03/03 17:05:04 martin Exp $
+# $NetBSD: CHANGES-9.4,v 1.1.2.56 2023/03/07 20:02:04 martin Exp $
 
 A complete list of changes from the NetBSD 9.3 release to the NetBSD 9.4
 release:
@@ -1266,3 +1266,8 @@ sys/arch/arm/ti/if_cpsw.c			1.17
 	debugging is requested.
 	[sekiya, ticket #1609]
 
+sys/kern/vfs_syscalls.c1.557
+
+	open(2): PR 57260: don't map ERESTART to EINTR.
+	[riastradh, ticket #1610]
+



CVS commit: [netbsd-9] src/doc

2023-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar  7 20:02:05 UTC 2023

Modified Files:
src/doc [netbsd-9]: CHANGES-9.4

Log Message:
Ticket #161


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.55 -r1.1.2.56 src/doc/CHANGES-9.4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-9] src/sys/kern

2023-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar  7 20:01:07 UTC 2023

Modified Files:
src/sys/kern [netbsd-9]: vfs_syscalls.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1610):

sys/kern/vfs_syscalls.c: revision 1.557

open(2): Don't map ERESTART to EINTR.

If a file or device's open function returns ERESTART, respect that --
restart the syscall; don't pretend a signal has been delivered when
it was not.  If an SA_RESTART signal was delivered, POSIX does not
allow it to fail with EINTR:

SA_RESTART
This flag affects the behavior of interruptible functions;
that is, those specified to fail with errno set to [EINTR].
If set, and a function specified as interruptible is
interrupted by this signal, the function shall restart and
shall not fail with [EINTR] unless otherwise specified.  If
an interruptible function which uses a timeout is restarted,
the duration of the timeout following the restart is set to
an unspecified value that does not exceed the original
timeout value.  If the flag is not set, interruptible
functions interrupted by this signal shall fail with errno
set to [EINTR].

https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaction.html

Nothing in the POSIX definition of open specifies otherwise.

In 1990, Kirk McKusick added these lines with a mysterious commit
message:
Author: Kirk McKusick 
Date:   Tue Apr 10 19:36:33 1990 -0800
eliminate longjmp from the kernel (for karels)
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 7bc7b39bbf..d572d3a32d 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#)vfs_syscalls.c  7.42 (Berkeley) 3/26/90
+ * @(#)vfs_syscalls.c  7.43 (Berkeley) 4/10/90
  */
 #include "param.h"
@@ -530,8 +530,10 @@ copen(scp, fmode, cmode, ndp, resultfd)
if (error = vn_open(ndp, fmode, (cmode & 0) &~ S_ISVTX)) {
crfree(fp->f_cred);
fp->f_count--;
-   if (error == -1)/* XXX from fdopen */
-   return (0); /* XXX from fdopen */
+   if (error == EJUSTRETURN)   /* XXX from fdopen */
+   return (0); /* XXX from fdopen */
+   if (error == ERESTART)
+   error = EINTR;
scp->sc_ofile[indx] = NULL;
return (error);
}

(found via this git import of the CSRG history:
https://github.com/robohack/ucb-csrg-bsd/commit/cce2869b7ae5d360921eb411005b328a29c4a3fe

This change appears to have served two related purposes:
1. The fdopen function (the erstwhile open routine for /dev/fd/N)
   used to return -1 as a hack to mean it had just duplicated the fd;
   it was recently changed by Mike Karels, in kern_descrip.c 7.9, to
   return EJUSTRETURN, now defined to be -2, presumably to avoid a
   conflict with ERESTART, defined to be -1.  So this change finished
   part of the change by Mike Karels to use a different magic return
   code from fdopen.
   Of course, today we use still another disgusting hack, EDUPFD, for
   the same purpose, so none of this is relevant any more.
2. Prior to April 1990, the kernel handled signals during tsleep(9)
   by longjmping out to the system call entry point or similar.  In
   April 1990, Mike Karels worked to convert all of that into
   explicit unwind logic by passing through EINTR or ERESTART as
   appropriate, instead of setjmp at each entry point.

However, it's not clear to me why this setjmp/longjmp and
fdopen/-1/EJUSTRETURN renovation justifies unconditional logic to map
ERESTART to EINTR in open(2).  I suspect it was a mistake.

In 2013, the corresponding logic to map ERESTART to EINTR in open(2)
was removed from FreeBSD:

   r246472 | kib | 2013-02-07 14:53:33 + (Thu, 07 Feb 2013) | 11 lines
   Stop translating the ERESTART error from the open(2) into EINTR.
   Posix requires that open(2) is restartable for SA_RESTART.
   For non-posix objects, in particular, devfs nodes, still disable
   automatic restart of the opens. The open call to a driver could have
   significant side effects for the hardware.
   Noted and reviewed by:  jilles
   Discussed with: bde
   MFC after:  2 weeks

Index: vfs_syscalls.c
===
--- vfs_syscalls.c  (revision 246471)
+++ vfs_syscalls.c  (revision 246472)
@@ -1106,8 +1106,6 @@
goto success;
}
-   if (error == ERESTART)
-   error = EINTR;
goto bad;
}
td->td_dupfd = 0;


CVS commit: [netbsd-9] src/sys/kern

2023-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar  7 20:01:07 UTC 2023

Modified Files:
src/sys/kern [netbsd-9]: vfs_syscalls.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1610):

sys/kern/vfs_syscalls.c: revision 1.557

open(2): Don't map ERESTART to EINTR.

If a file or device's open function returns ERESTART, respect that --
restart the syscall; don't pretend a signal has been delivered when
it was not.  If an SA_RESTART signal was delivered, POSIX does not
allow it to fail with EINTR:

SA_RESTART
This flag affects the behavior of interruptible functions;
that is, those specified to fail with errno set to [EINTR].
If set, and a function specified as interruptible is
interrupted by this signal, the function shall restart and
shall not fail with [EINTR] unless otherwise specified.  If
an interruptible function which uses a timeout is restarted,
the duration of the timeout following the restart is set to
an unspecified value that does not exceed the original
timeout value.  If the flag is not set, interruptible
functions interrupted by this signal shall fail with errno
set to [EINTR].

https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaction.html

Nothing in the POSIX definition of open specifies otherwise.

In 1990, Kirk McKusick added these lines with a mysterious commit
message:
Author: Kirk McKusick 
Date:   Tue Apr 10 19:36:33 1990 -0800
eliminate longjmp from the kernel (for karels)
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 7bc7b39bbf..d572d3a32d 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#)vfs_syscalls.c  7.42 (Berkeley) 3/26/90
+ * @(#)vfs_syscalls.c  7.43 (Berkeley) 4/10/90
  */
 #include "param.h"
@@ -530,8 +530,10 @@ copen(scp, fmode, cmode, ndp, resultfd)
if (error = vn_open(ndp, fmode, (cmode & 0) &~ S_ISVTX)) {
crfree(fp->f_cred);
fp->f_count--;
-   if (error == -1)/* XXX from fdopen */
-   return (0); /* XXX from fdopen */
+   if (error == EJUSTRETURN)   /* XXX from fdopen */
+   return (0); /* XXX from fdopen */
+   if (error == ERESTART)
+   error = EINTR;
scp->sc_ofile[indx] = NULL;
return (error);
}

(found via this git import of the CSRG history:
https://github.com/robohack/ucb-csrg-bsd/commit/cce2869b7ae5d360921eb411005b328a29c4a3fe

This change appears to have served two related purposes:
1. The fdopen function (the erstwhile open routine for /dev/fd/N)
   used to return -1 as a hack to mean it had just duplicated the fd;
   it was recently changed by Mike Karels, in kern_descrip.c 7.9, to
   return EJUSTRETURN, now defined to be -2, presumably to avoid a
   conflict with ERESTART, defined to be -1.  So this change finished
   part of the change by Mike Karels to use a different magic return
   code from fdopen.
   Of course, today we use still another disgusting hack, EDUPFD, for
   the same purpose, so none of this is relevant any more.
2. Prior to April 1990, the kernel handled signals during tsleep(9)
   by longjmping out to the system call entry point or similar.  In
   April 1990, Mike Karels worked to convert all of that into
   explicit unwind logic by passing through EINTR or ERESTART as
   appropriate, instead of setjmp at each entry point.

However, it's not clear to me why this setjmp/longjmp and
fdopen/-1/EJUSTRETURN renovation justifies unconditional logic to map
ERESTART to EINTR in open(2).  I suspect it was a mistake.

In 2013, the corresponding logic to map ERESTART to EINTR in open(2)
was removed from FreeBSD:

   r246472 | kib | 2013-02-07 14:53:33 + (Thu, 07 Feb 2013) | 11 lines
   Stop translating the ERESTART error from the open(2) into EINTR.
   Posix requires that open(2) is restartable for SA_RESTART.
   For non-posix objects, in particular, devfs nodes, still disable
   automatic restart of the opens. The open call to a driver could have
   significant side effects for the hardware.
   Noted and reviewed by:  jilles
   Discussed with: bde
   MFC after:  2 weeks

Index: vfs_syscalls.c
===
--- vfs_syscalls.c  (revision 246471)
+++ vfs_syscalls.c  (revision 246472)
@@ -1106,8 +1106,6 @@
goto success;
}
-   if (error == ERESTART)
-   error = EINTR;
goto bad;
}
td->td_dupfd = 0;


CVS commit: [netbsd-10] src/doc

2023-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar  7 19:57:47 UTC 2023

Modified Files:
src/doc [netbsd-10]: CHANGES-10.0

Log Message:
Tickets #113 - #115


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.40 -r1.1.2.41 src/doc/CHANGES-10.0

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-10] src/doc

2023-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar  7 19:57:47 UTC 2023

Modified Files:
src/doc [netbsd-10]: CHANGES-10.0

Log Message:
Tickets #113 - #115


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.40 -r1.1.2.41 src/doc/CHANGES-10.0

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-10.0
diff -u src/doc/CHANGES-10.0:1.1.2.40 src/doc/CHANGES-10.0:1.1.2.41
--- src/doc/CHANGES-10.0:1.1.2.40	Sun Mar  5 14:38:29 2023
+++ src/doc/CHANGES-10.0	Tue Mar  7 19:57:47 2023
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-10.0,v 1.1.2.40 2023/03/05 14:38:29 martin Exp $
+# $NetBSD: CHANGES-10.0,v 1.1.2.41 2023/03/07 19:57:47 martin Exp $
 
 A complete list of changes from the initial NetBSD 10.0 branch on 2022-12-16
 until the 10.0 release:
@@ -1435,3 +1435,19 @@ sbin/nvmectl/util.c1.3
 	Convert to human-readable value.
 	[mlelstv, ticket #112]
 
+sys/dev/usb/ucom.c1.137
+
+	PR 57259: fix the HUP-wait path in ucomopen()
+	[thorpej, ticket #113]
+
+lib/libc/sys/open.21.66
+
+	open(2): document the error code when O_REGULAR is specified
+	and the last path component is not a regular file.
+	[thorpej, ticket #114]
+
+sys/kern/vfs_syscalls.c1.557
+
+	open(2): PR 57260: don't map ERESTART to EINTR.
+	[riastradh, ticket #115]
+



CVS commit: [netbsd-10] src/sys/kern

2023-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar  7 19:56:45 UTC 2023

Modified Files:
src/sys/kern [netbsd-10]: vfs_syscalls.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #115):

sys/kern/vfs_syscalls.c: revision 1.557

open(2): Don't map ERESTART to EINTR.

If a file or device's open function returns ERESTART, respect that --
restart the syscall; don't pretend a signal has been delivered when
it was not.  If an SA_RESTART signal was delivered, POSIX does not
allow it to fail with EINTR:

SA_RESTART
This flag affects the behavior of interruptible functions;
that is, those specified to fail with errno set to [EINTR].
If set, and a function specified as interruptible is
interrupted by this signal, the function shall restart and
shall not fail with [EINTR] unless otherwise specified.  If
an interruptible function which uses a timeout is restarted,
the duration of the timeout following the restart is set to
an unspecified value that does not exceed the original
timeout value.  If the flag is not set, interruptible
functions interrupted by this signal shall fail with errno
set to [EINTR].

https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaction.html

Nothing in the POSIX definition of open specifies otherwise.

In 1990, Kirk McKusick added these lines with a mysterious commit
message:
Author: Kirk McKusick 
Date:   Tue Apr 10 19:36:33 1990 -0800
eliminate longjmp from the kernel (for karels)
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 7bc7b39bbf..d572d3a32d 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#)vfs_syscalls.c  7.42 (Berkeley) 3/26/90
+ * @(#)vfs_syscalls.c  7.43 (Berkeley) 4/10/90
  */
 #include "param.h"
@@ -530,8 +530,10 @@ copen(scp, fmode, cmode, ndp, resultfd)
if (error = vn_open(ndp, fmode, (cmode & 0) &~ S_ISVTX)) {
crfree(fp->f_cred);
fp->f_count--;
-   if (error == -1)/* XXX from fdopen */
-   return (0); /* XXX from fdopen */
+   if (error == EJUSTRETURN)   /* XXX from fdopen */
+   return (0); /* XXX from fdopen */
+   if (error == ERESTART)
+   error = EINTR;
scp->sc_ofile[indx] = NULL;
return (error);
}

(found via this git import of the CSRG history:
https://github.com/robohack/ucb-csrg-bsd/commit/cce2869b7ae5d360921eb411005b328a29c4a3fe

This change appears to have served two related purposes:
1. The fdopen function (the erstwhile open routine for /dev/fd/N)
   used to return -1 as a hack to mean it had just duplicated the fd;
   it was recently changed by Mike Karels, in kern_descrip.c 7.9, to
   return EJUSTRETURN, now defined to be -2, presumably to avoid a
   conflict with ERESTART, defined to be -1.  So this change finished
   part of the change by Mike Karels to use a different magic return
   code from fdopen.
   Of course, today we use still another disgusting hack, EDUPFD, for
   the same purpose, so none of this is relevant any more.
2. Prior to April 1990, the kernel handled signals during tsleep(9)
   by longjmping out to the system call entry point or similar.  In
   April 1990, Mike Karels worked to convert all of that into
   explicit unwind logic by passing through EINTR or ERESTART as
   appropriate, instead of setjmp at each entry point.

However, it's not clear to me why this setjmp/longjmp and
fdopen/-1/EJUSTRETURN renovation justifies unconditional logic to map
ERESTART to EINTR in open(2).  I suspect it was a mistake.

In 2013, the corresponding logic to map ERESTART to EINTR in open(2)
was removed from FreeBSD:

   r246472 | kib | 2013-02-07 14:53:33 + (Thu, 07 Feb 2013) | 11 lines
   Stop translating the ERESTART error from the open(2) into EINTR.
   Posix requires that open(2) is restartable for SA_RESTART.
   For non-posix objects, in particular, devfs nodes, still disable
   automatic restart of the opens. The open call to a driver could have
   significant side effects for the hardware.
   Noted and reviewed by:  jilles
   Discussed with: bde
   MFC after:  2 weeks

Index: vfs_syscalls.c
===
--- vfs_syscalls.c  (revision 246471)
+++ vfs_syscalls.c  (revision 246472)
@@ -1106,8 +1106,6 @@
goto success;
}
-   if (error == ERESTART)
-   error = EINTR;
goto bad;
}
td->td_dupfd = 0;


CVS commit: [netbsd-10] src/sys/kern

2023-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar  7 19:56:45 UTC 2023

Modified Files:
src/sys/kern [netbsd-10]: vfs_syscalls.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #115):

sys/kern/vfs_syscalls.c: revision 1.557

open(2): Don't map ERESTART to EINTR.

If a file or device's open function returns ERESTART, respect that --
restart the syscall; don't pretend a signal has been delivered when
it was not.  If an SA_RESTART signal was delivered, POSIX does not
allow it to fail with EINTR:

SA_RESTART
This flag affects the behavior of interruptible functions;
that is, those specified to fail with errno set to [EINTR].
If set, and a function specified as interruptible is
interrupted by this signal, the function shall restart and
shall not fail with [EINTR] unless otherwise specified.  If
an interruptible function which uses a timeout is restarted,
the duration of the timeout following the restart is set to
an unspecified value that does not exceed the original
timeout value.  If the flag is not set, interruptible
functions interrupted by this signal shall fail with errno
set to [EINTR].

https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaction.html

Nothing in the POSIX definition of open specifies otherwise.

In 1990, Kirk McKusick added these lines with a mysterious commit
message:
Author: Kirk McKusick 
Date:   Tue Apr 10 19:36:33 1990 -0800
eliminate longjmp from the kernel (for karels)
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 7bc7b39bbf..d572d3a32d 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -14,7 +14,7 @@
  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  *
- * @(#)vfs_syscalls.c  7.42 (Berkeley) 3/26/90
+ * @(#)vfs_syscalls.c  7.43 (Berkeley) 4/10/90
  */
 #include "param.h"
@@ -530,8 +530,10 @@ copen(scp, fmode, cmode, ndp, resultfd)
if (error = vn_open(ndp, fmode, (cmode & 0) &~ S_ISVTX)) {
crfree(fp->f_cred);
fp->f_count--;
-   if (error == -1)/* XXX from fdopen */
-   return (0); /* XXX from fdopen */
+   if (error == EJUSTRETURN)   /* XXX from fdopen */
+   return (0); /* XXX from fdopen */
+   if (error == ERESTART)
+   error = EINTR;
scp->sc_ofile[indx] = NULL;
return (error);
}

(found via this git import of the CSRG history:
https://github.com/robohack/ucb-csrg-bsd/commit/cce2869b7ae5d360921eb411005b328a29c4a3fe

This change appears to have served two related purposes:
1. The fdopen function (the erstwhile open routine for /dev/fd/N)
   used to return -1 as a hack to mean it had just duplicated the fd;
   it was recently changed by Mike Karels, in kern_descrip.c 7.9, to
   return EJUSTRETURN, now defined to be -2, presumably to avoid a
   conflict with ERESTART, defined to be -1.  So this change finished
   part of the change by Mike Karels to use a different magic return
   code from fdopen.
   Of course, today we use still another disgusting hack, EDUPFD, for
   the same purpose, so none of this is relevant any more.
2. Prior to April 1990, the kernel handled signals during tsleep(9)
   by longjmping out to the system call entry point or similar.  In
   April 1990, Mike Karels worked to convert all of that into
   explicit unwind logic by passing through EINTR or ERESTART as
   appropriate, instead of setjmp at each entry point.

However, it's not clear to me why this setjmp/longjmp and
fdopen/-1/EJUSTRETURN renovation justifies unconditional logic to map
ERESTART to EINTR in open(2).  I suspect it was a mistake.

In 2013, the corresponding logic to map ERESTART to EINTR in open(2)
was removed from FreeBSD:

   r246472 | kib | 2013-02-07 14:53:33 + (Thu, 07 Feb 2013) | 11 lines
   Stop translating the ERESTART error from the open(2) into EINTR.
   Posix requires that open(2) is restartable for SA_RESTART.
   For non-posix objects, in particular, devfs nodes, still disable
   automatic restart of the opens. The open call to a driver could have
   significant side effects for the hardware.
   Noted and reviewed by:  jilles
   Discussed with: bde
   MFC after:  2 weeks

Index: vfs_syscalls.c
===
--- vfs_syscalls.c  (revision 246471)
+++ vfs_syscalls.c  (revision 246472)
@@ -1106,8 +1106,6 @@
goto success;
}
-   if (error == ERESTART)
-   error = EINTR;
goto bad;
}
td->td_dupfd = 0;


CVS commit: [netbsd-10] src/sys/dev/usb

2023-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar  7 19:52:02 UTC 2023

Modified Files:
src/sys/dev/usb [netbsd-10]: ucom.c

Log Message:
Pull up following revision(s) (requested by thorpej in ticket #113):

sys/dev/usb/ucom.c: revision 1.137

In the HUP-wait path in ucomopen():
- Use cv_timedwait() rather than cv_timedwait_sig(); the wait here is
 bounded (and fairly short besides) and seems appropriate to treat like
 other uninterruptible waits.  The behavior is now consistent with com(4)
 in this regard.
- Map EWOULDBLOCK return from cv_timedwait() to 0, as the successful passage
 of time is not an error in this case.
- If the HUP-wait time has passed, clear the HUP-wait timestamp.

PR kern/57259 (although insufficient -- another change to vfs_syscalls.c
is required)


To generate a diff of this commit:
cvs rdiff -u -r1.134.2.1 -r1.134.2.2 src/sys/dev/usb/ucom.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/ucom.c
diff -u src/sys/dev/usb/ucom.c:1.134.2.1 src/sys/dev/usb/ucom.c:1.134.2.2
--- src/sys/dev/usb/ucom.c:1.134.2.1	Wed Feb 22 13:06:42 2023
+++ src/sys/dev/usb/ucom.c	Tue Mar  7 19:52:01 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucom.c,v 1.134.2.1 2023/02/22 13:06:42 martin Exp $	*/
+/*	$NetBSD: ucom.c,v 1.134.2.2 2023/03/07 19:52:01 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.134.2.1 2023/02/22 13:06:42 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.134.2.2 2023/03/07 19:52:01 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -552,11 +552,16 @@ ucomopen(dev_t dev, int flag, int mode, 
 			ms = MIN(INT_MAX - 1000, delta.tv_sec*1000);
 			ms += howmany(delta.tv_usec, 1000);
 			ticks = MAX(1, MIN(INT_MAX, mstohz(ms)));
-			error = cv_timedwait_sig(>sc_statecv, >sc_lock,
+			error = cv_timedwait(>sc_statecv, >sc_lock,
 			ticks);
 			mutex_exit(>sc_lock);
+			/* The successful passage of time is not an error. */
+			if (error == EWOULDBLOCK) {
+error = 0;
+			}
 			return error ? error : ERESTART;
 		}
+		timerclear(>sc_hup_time);
 	}
 
 	/*



CVS commit: [netbsd-10] src/lib/libc/sys

2023-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar  7 19:53:31 UTC 2023

Modified Files:
src/lib/libc/sys [netbsd-10]: open.2

Log Message:
Pull up following revision(s) (requested by thorpej in ticket #114):

lib/libc/sys/open.2: revision 1.66

Document the error code when O_REGULAR is specified and the last
path component is not a regular file.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.65.6.1 src/lib/libc/sys/open.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/sys/open.2
diff -u src/lib/libc/sys/open.2:1.65 src/lib/libc/sys/open.2:1.65.6.1
--- src/lib/libc/sys/open.2:1.65	Wed Mar 17 08:13:29 2021
+++ src/lib/libc/sys/open.2	Tue Mar  7 19:53:31 2023
@@ -1,4 +1,4 @@
-.\"	$NetBSD: open.2,v 1.65 2021/03/17 08:13:29 wiz Exp $
+.\"	$NetBSD: open.2,v 1.65.6.1 2023/03/07 19:53:31 martin Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)open.2	8.2 (Berkeley) 11/16/93
 .\"
-.Dd March 17, 2021
+.Dd March 5, 2023
 .Dt OPEN 2
 .Os
 .Sh NAME
@@ -365,6 +365,9 @@ was specified, but the last path compone
 specifies returning
 .Bq Er ELOOP
 for this case.
+.It Bq Er EFTYPE
+.Dv O_REGULAR
+is specified and the last path component is not a regular file.
 .It Bq Er EINTR
 The
 .Fn open



CVS commit: [netbsd-10] src/lib/libc/sys

2023-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar  7 19:53:31 UTC 2023

Modified Files:
src/lib/libc/sys [netbsd-10]: open.2

Log Message:
Pull up following revision(s) (requested by thorpej in ticket #114):

lib/libc/sys/open.2: revision 1.66

Document the error code when O_REGULAR is specified and the last
path component is not a regular file.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.65.6.1 src/lib/libc/sys/open.2

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: [netbsd-10] src/sys/dev/usb

2023-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar  7 19:52:02 UTC 2023

Modified Files:
src/sys/dev/usb [netbsd-10]: ucom.c

Log Message:
Pull up following revision(s) (requested by thorpej in ticket #113):

sys/dev/usb/ucom.c: revision 1.137

In the HUP-wait path in ucomopen():
- Use cv_timedwait() rather than cv_timedwait_sig(); the wait here is
 bounded (and fairly short besides) and seems appropriate to treat like
 other uninterruptible waits.  The behavior is now consistent with com(4)
 in this regard.
- Map EWOULDBLOCK return from cv_timedwait() to 0, as the successful passage
 of time is not an error in this case.
- If the HUP-wait time has passed, clear the HUP-wait timestamp.

PR kern/57259 (although insufficient -- another change to vfs_syscalls.c
is required)


To generate a diff of this commit:
cvs rdiff -u -r1.134.2.1 -r1.134.2.2 src/sys/dev/usb/ucom.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/examples/asm/hello

2023-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar  7 10:43:53 UTC 2023

Modified Files:
src/share/examples/asm/hello: Makefile.inst

Log Message:
This example is plain asm code, running ctf tools on it is not usefull


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/examples/asm/hello/Makefile.inst

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/share/examples/asm/hello

2023-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar  7 10:43:53 UTC 2023

Modified Files:
src/share/examples/asm/hello: Makefile.inst

Log Message:
This example is plain asm code, running ctf tools on it is not usefull


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/examples/asm/hello/Makefile.inst

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/examples/asm/hello/Makefile.inst
diff -u src/share/examples/asm/hello/Makefile.inst:1.2 src/share/examples/asm/hello/Makefile.inst:1.3
--- src/share/examples/asm/hello/Makefile.inst:1.2	Fri Oct 14 19:42:13 2022
+++ src/share/examples/asm/hello/Makefile.inst	Tue Mar  7 10:43:53 2023
@@ -1,4 +1,7 @@
-# $NetBSD: Makefile.inst,v 1.2 2022/10/14 19:42:13 ryo Exp $
+# $NetBSD: Makefile.inst,v 1.3 2023/03/07 10:43:53 martin Exp $
+
+NOPIE=		# defined
+NOCTF=		# defined
 
 .include 
 
@@ -7,7 +10,6 @@ PROG=		hello
 MAN=		# empty
 LDFLAGS=	-nostdlib
 SRCS=		${MACHINE_CPU}.s
-MKPIE=		no
 .endif
 
 .include 



CVS commit: src/sys/external/bsd/drm2/radeon

2023-03-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Mar  7 09:47:48 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/radeon: radeon_pci.c

Log Message:
radeon: Kick out genfb on firmware framebuffer before initializing.

this is the same change as nouveau_pci.c:1.37, and should fix at
least PR#56714 and i thought at least another PR i can't find right
now.  it fixes at least 2 different radeon cards for me on UEFI
booted system.

XXX: pullup-10 also include the original change:
   http://mail-index.netbsd.org/source-changes/2023/03/01/msg143606.html


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/external/bsd/drm2/radeon/radeon_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/radeon/radeon_pci.c
diff -u src/sys/external/bsd/drm2/radeon/radeon_pci.c:1.21 src/sys/external/bsd/drm2/radeon/radeon_pci.c:1.22
--- src/sys/external/bsd/drm2/radeon/radeon_pci.c:1.21	Mon Jul 18 23:34:03 2022
+++ src/sys/external/bsd/drm2/radeon/radeon_pci.c	Tue Mar  7 09:47:48 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeon_pci.c,v 1.21 2022/07/18 23:34:03 riastradh Exp $	*/
+/*	$NetBSD: radeon_pci.c,v 1.22 2023/03/07 09:47:48 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,9 +30,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeon_pci.c,v 1.21 2022/07/18 23:34:03 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_pci.c,v 1.22 2023/03/07 09:47:48 mrg Exp $");
 
 #ifdef _KERNEL_OPT
+#include "genfb.h"
 #include "vga.h"
 #if defined(__arm__) || defined(__aarch64__)
 #include "opt_fdt.h"
@@ -73,6 +74,11 @@ __KERNEL_RCSID(0, "$NetBSD: radeon_pci.c
 #include 
 #include 
 
+#if NGENFB > 0
+#include 
+#include 
+#endif
+
 #include 
 #include "radeon_drv.h"
 #include "radeon_task.h"
@@ -273,6 +279,24 @@ radeon_attach_real(device_t self)
 	}
 	sc->sc_pci_attached = true;
 
+#if NGENFB > 0
+	/*
+	 * If MD initialization has selected this as the console device
+	 * with a firmware-provided framebuffer address, we may have to
+	 * turn it off early, before we are ready to switch the console
+	 * over -- something goes wrong if we're still writing to the
+	 * firmware-provided framebuffer during nouveau initialization.
+	 */
+{
+	bool is_console;
+	if (prop_dictionary_get_bool(device_properties(self), "is_console",
+		_console) &&
+	is_console &&
+	genfb_is_console())
+		wsdisplay_predetach();
+}
+#endif
+
 	/* XXX errno Linux->NetBSD */
 	error = -drm_dev_register(sc->sc_drm_dev, flags);
 	if (error) {



CVS commit: src/sys/external/bsd/drm2/radeon

2023-03-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Mar  7 09:47:48 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/radeon: radeon_pci.c

Log Message:
radeon: Kick out genfb on firmware framebuffer before initializing.

this is the same change as nouveau_pci.c:1.37, and should fix at
least PR#56714 and i thought at least another PR i can't find right
now.  it fixes at least 2 different radeon cards for me on UEFI
booted system.

XXX: pullup-10 also include the original change:
   http://mail-index.netbsd.org/source-changes/2023/03/01/msg143606.html


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/external/bsd/drm2/radeon/radeon_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.