NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/57259: ucom serial ports cannot be re-opened "too quickly" with O_NONBLOCK



The following reply was made to PR kern/57259; it has been noted by GNATS.

From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: Jason Thorpe <thorpej%me.com@localhost>
Cc: gnats-bugs%NetBSD.org@localhost
Subject: Re: kern/57259: ucom serial ports cannot be re-opened "too quickly"
	with O_NONBLOCK
Date: Sun, 5 Mar 2023 13:15:32 +0000

 I did some more digging and found what appears to be the CSRG BSD
 commit that put this ERESTART->EINTR change into open:
 
 https://github.com/robohack/ucb-csrg-bsd/commit/cce2869b7ae5d360921eb411005=
 b328a29c4a3fe
 
 commit cce2869b7ae5d360921eb411005b328a29c4a3fe
 Author: Kirk McKusick <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
   */
 =20
  #include "param.h"
 @@ -530,8 +530,10 @@ copen(scp, fmode, cmode, ndp, resultfd)
  	if (error =3D vn_open(ndp, fmode, (cmode & 07777) &~ S_ISVTX)) {
  		crfree(fp->f_cred);
  		fp->f_count--;
 -		if (error =3D=3D -1)	/* XXX from fdopen */
 -			return (0);	/* XXX from fdopen */
 +		if (error =3D=3D EJUSTRETURN)	/* XXX from fdopen */
 +			return (0);		/* XXX from fdopen */
 +		if (error =3D=3D ERESTART)
 +			error =3D EINTR;
  		scp->sc_ofile[indx] =3D NULL;
  		return (error);
  	}
 
 This leaves me no more illuminated than before, but makes me suspect
 it was a mistake in some unrelated change that is no longer relevant.
 So now I'm wondering whether we should try to ask Kirk or just nix it
 and see what happens...
 


Home | Main Index | Thread Index | Old Index