Re: arm64 fpu fixes

2017-04-10 Thread Philip Guenther
On Mon, 10 Apr 2017, Mark Kettenis wrote:
> Diff below revises the struct fpreg definition and enables the dumping 
> of fpu registers in core dumps.  That pointed out that we need to reset 
> the FPU state upon exec.
> 
> ok?

ok guenther@

Hmm, the consequences of __uint128_t are non-trivial.  Are {,u}intmax_t 
128bit types on arm64?



I should elaborate a bit what this diff does

2017-04-10 Thread Walter Alejandro Iglesias
I'm thinking I should've explained more in detail what this patch does.

With window managers that implement a window list menu, like fvwm, after
cycling using Alt+Tab, previous and new focused windows, both end in the
front (currently cwm lets the previously focused window overlapped.)
This is specially convenient when one of the windows is maximized.

To imitate this useful behavior this diff makes cwm to raise the
previously focused window after releasing the Alt key, right before
focusing and warping the pointer to the new chosen one.

It's not my idea, I took it from WindowMaker.




Re: relayd(8): convert explicit_bzero() + free() to freezero()

2017-04-10 Thread Claudio Jeker
On Mon, Apr 10, 2017 at 05:08:43PM +0200, Frederic Cambus wrote:
> Hi tech@,
> 
> Convert explicit_bzero() + free() to freezero().
> 
> Comments? OK?
> 
> Index: usr.sbin/relayd/relayd.c
> ===
> RCS file: /cvs/src/usr.sbin/relayd/relayd.c,v
> retrieving revision 1.165
> diff -u -p -r1.165 relayd.c
> --- usr.sbin/relayd/relayd.c  24 Jan 2017 10:49:14 -  1.165
> +++ usr.sbin/relayd/relayd.c  10 Apr 2017 15:06:38 -
> @@ -550,8 +550,7 @@ purge_key(char **ptr, off_t len)
>   if (key == NULL || len == 0)
>   return;

I think this can also be dropped because freezero(NULL, 0) is save.

>  
> - explicit_bzero(key, len);
> - free(key);
> + freezero(key, len);
>  
>   *ptr = NULL;
>  }
> 

-- 
:wq Claudio



relayd(8): convert explicit_bzero() + free() to freezero()

2017-04-10 Thread Frederic Cambus
Hi tech@,

Convert explicit_bzero() + free() to freezero().

Comments? OK?

Index: usr.sbin/relayd/relayd.c
===
RCS file: /cvs/src/usr.sbin/relayd/relayd.c,v
retrieving revision 1.165
diff -u -p -r1.165 relayd.c
--- usr.sbin/relayd/relayd.c24 Jan 2017 10:49:14 -  1.165
+++ usr.sbin/relayd/relayd.c10 Apr 2017 15:06:38 -
@@ -550,8 +550,7 @@ purge_key(char **ptr, off_t len)
if (key == NULL || len == 0)
return;
 
-   explicit_bzero(key, len);
-   free(key);
+   freezero(key, len);
 
*ptr = NULL;
 }



Re: fsck_ffs(8): remove always false comparison

2017-04-10 Thread Todd C. Miller
On Sun, 09 Apr 2017 18:09:51 +0200, Frederic Cambus wrote:

> Remove always false comparison: inosused type is ino_t, which is
> unsigned.

It's not so simple.

It looks like this is intended to handle inosused wrapping, which
is possible.  I think it is worth having a check in there of some
kind.  The loop invariant also assumes that inosused is signed.
Currently, if inosused wraps the loop will not terminate.

Perhaps something like this.  The only time we continue the loop
is when *cp == 0 so we can move the "inosused -= CHAR_BIT" into
that block and check for wrap before performing the subtraction.

 - todd

Index: sbin/fsck_ffs//pass1.c
===
RCS file: /cvs/src/sbin/fsck_ffs/pass1.c,v
retrieving revision 1.44
diff -u -p -u -r1.44 pass1.c
--- sbin/fsck_ffs//pass1.c  10 Apr 2017 08:19:12 -  1.44
+++ sbin/fsck_ffs//pass1.c  10 Apr 2017 15:05:55 -
@@ -116,9 +116,14 @@ pass1(void)
 */
if (preen && usedsoftdep) {
cp = _inosused()[(inosused - 1) / CHAR_BIT];
-   for ( ; inosused > 0; inosused -= CHAR_BIT, cp--) {
-   if (*cp == 0)
+   for ( ; inosused != 0; cp--) {
+   if (*cp == 0) {
+   if (inosused > CHAR_BIT)
+   inosused -= CHAR_BIT;
+   else
+   inosused = 0;
continue;
+   }
for (i = 1 << (CHAR_BIT - 1); i > 0; i >>= 1) {
if (*cp & i)
break;



I finally learned how to make the diff :-)

2017-04-10 Thread Walter Alejandro Iglesias

I finally learned how to make the diff using cvs :-)


Index: client.c
===
RCS file: /cvs/xenocara/app/cwm/client.c,v
retrieving revision 1.234
diff -u -p -r1.234 client.c
--- client.c6 Feb 2017 18:10:28 -   1.234
+++ client.c10 Apr 2017 14:16:31 -
@@ -645,9 +645,11 @@ match:
 void
 client_cycle(struct screen_ctx *sc, int flags)
 {
-   struct client_ctx   *newcc, *oldcc;
+   struct client_ctx   *newcc, *oldcc, *prevcc;
int  again = 1;
 
+   prevcc = TAILQ_FIRST(>clientq);
+
/* For X apps that ignore events. */
XGrabKeyboard(X_Dpy, sc->rootwin, True,
GrabModeAsync, GrabModeAsync, CurrentTime);
@@ -686,6 +688,7 @@ client_cycle(struct screen_ctx *sc, int 
/* reset when cycling mod is released. XXX I hate this hack */
sc->cycling = 1;
client_ptrsave(oldcc);
+   client_raise(prevcc);
client_raise(newcc);
if (!client_inbound(newcc, newcc->ptr.x, newcc->ptr.y)) {
newcc->ptr.x = newcc->geom.w / 2;



Re: Additional errno values

2017-04-10 Thread Mark Kettenis
> Date: Mon, 10 Apr 2017 23:21:43 +1000
> From: Jonathan Gray 
> 
> On Mon, Apr 10, 2017 at 03:03:10PM +0200, Jeremie Courreges-Anglas wrote:
> > 
> > We have a bunch of patches in ports to deal with EPROTO and EBADMSG not
> > being defined.  It would be nice to get rid of those.  The diff below
> > also adds the also missing ENOTRECOVERABLE and EOWNERDEAD.
> > 
> > Thoughts?
> > 
> > (Dunno if there is a point describing verbosely what those new errno
> > values mean on other systems...)
> 
> I sent a mail around last year for the posix errnos we lack.
> Still waiting for a libc major crank which adding errnos requires
> as the size of sys_errmsg changes.

This version is obviously better ;).  But it is probably good to wait
a bit longer before we crank the libc major.

> ---
>
> We are missing a few errnos mentioned in posix 2013.
> Excluding the reserved and streams/obsolete ones there is
> 
> EBADMSG   Bad message
> ENOTRECOVERABLE   State not recoverable
> EOWNERDEADPrevious owner died
> EPROTOProtocol error
> 
> Index: sys/sys/errno.h
> ===
> RCS file: /cvs/src/sys/sys/errno.h,v
> retrieving revision 1.24
> diff -u -p -r1.24 errno.h
> --- sys/sys/errno.h   24 Oct 2015 10:42:02 -  1.24
> +++ sys/sys/errno.h   2 Sep 2016 13:51:36 -
> @@ -167,8 +167,12 @@
>  #define EIDRM89  /* Identifier removed */
>  #define ENOMSG   90  /* No message of desired type */
>  #define ENOTSUP  91  /* Not supported */
> +#define EBADMSG  92  /* Bad message */
> +#define ENOTRECOVERABLE  93  /* State not recoverable */
> +#define EOWNERDEAD   94  /* Previous owner died */
> +#define EPROTO   95  /* Protocol error */
>  #if __BSD_VISIBLE
> -#define ELAST91  /* Must be equal largest errno */
> +#define ELAST95  /* Must be equal largest errno */
>  #endif /* __BSD_VISIBLE */
>  
>  #ifdef _KERNEL
> Index: lib/libc/gen/errlist.c
> ===
> RCS file: /cvs/src/lib/libc/gen/errlist.c,v
> retrieving revision 1.18
> diff -u -p -r1.18 errlist.c
> --- lib/libc/gen/errlist.c24 Oct 2015 10:42:02 -  1.18
> +++ lib/libc/gen/errlist.c2 Sep 2016 13:51:36 -
> @@ -142,6 +142,10 @@ const char *const sys_errlist[] = {
>   "Identifier removed",   /* 89 - EIDRM */
>   "No message of desired type",   /* 90 - ENOMSG */
>   "Not supported",/* 91 - ENOTSUP */
> + "Bad message",  /* 92 - EBADMSG */
> + "State not recoverable",/* 93 - ENOTRECOVERABLE */
> + "Previous owner died",  /* 94 - EOWNERDEAD */
> + "Protocol error",   /* 95 - EPROTO */
>  };
>  const int sys_nerr = { sizeof sys_errlist/sizeof sys_errlist[0] };
>  #if 0
> Index: sys/dev/pci/drm/drm_linux.h
> ===
> RCS file: /cvs/src/sys/dev/pci/drm/drm_linux.h,v
> retrieving revision 1.47
> diff -u -p -r1.47 drm_linux.h
> --- sys/dev/pci/drm/drm_linux.h   5 Apr 2016 20:44:03 -   1.47
> +++ sys/dev/pci/drm/drm_linux.h   2 Sep 2016 13:51:36 -
> @@ -87,7 +87,6 @@ typedef off_t loff_t;
>  #define ERESTARTSYS  EINTR
>  #define ETIMEETIMEDOUT
>  #define EREMOTEIOEIO
> -#define EPROTO   EIO
>  #define ENOTSUPP ENOTSUP
>  
>  #define KERN_INFO
> 
> 



Re: Additional errno values

2017-04-10 Thread Mark Kettenis
> From: Jeremie Courreges-Anglas 
> Date: Mon, 10 Apr 2017 15:03:10 +0200
> 
> We have a bunch of patches in ports to deal with EPROTO and EBADMSG not
> being defined.  It would be nice to get rid of those.  The diff below
> also adds the also missing ENOTRECOVERABLE and EOWNERDEAD.
> 
> Thoughts?
> 
> (Dunno if there is a point describing verbosely what those new errno
> values mean on other systems...)

These are all in POSIX now.  ENORECOVERABLE and EOWNERDEAD are errors
returned for robus mutexes that we don't implement yet (but might want
to implement at one point).  EBASMSG and EPROTO are really obsolete
values for streams.  EBADMSG got re-used in catgets(3), but our
implementation doesn't generate it and the message passing extension
(which we don't implement).  EPROTO probably should have been marked
as obsolete (and therefore optional).  Given that Darwin, FreeBSD,
NetBSD, Linux and Solaris all provide this, we're probably better off
adding them as well.

ok kettenis@

> Index: lib/libc/shlib_version
> ===
> RCS file: /d/cvs/src/lib/libc/shlib_version,v
> retrieving revision 1.189
> diff -u -p -r1.189 shlib_version
> --- lib/libc/shlib_version10 Apr 2017 05:10:56 -  1.189
> +++ lib/libc/shlib_version10 Apr 2017 12:56:16 -
> @@ -1,4 +1,4 @@
>  major=89
> -minor=4
> +minor=5
>  # note: If changes were made to include/thread_private.h or if system
>  # calls were added/changed then librthread/shlib_version also be updated.
> Index: lib/libc/gen/errlist.c
> ===
> RCS file: /d/cvs/src/lib/libc/gen/errlist.c,v
> retrieving revision 1.18
> diff -u -p -r1.18 errlist.c
> --- lib/libc/gen/errlist.c24 Oct 2015 10:42:02 -  1.18
> +++ lib/libc/gen/errlist.c10 Apr 2017 12:56:16 -
> @@ -142,6 +142,10 @@ const char *const sys_errlist[] = {
>   "Identifier removed",   /* 89 - EIDRM */
>   "No message of desired type",   /* 90 - ENOMSG */
>   "Not supported",/* 91 - ENOTSUP */
> + "Bad message",  /* 92 - EBADMSG */
> + "State not recoverable",/* 93 - ENOTRECOVERABLE */
> + "Previous owner died",  /* 94 - EOWNERDEAD */
> + "Protocol error",   /* 95 - EPROTO */
>  };
>  const int sys_nerr = { sizeof sys_errlist/sizeof sys_errlist[0] };
>  #if 0
> Index: lib/libc/sys/intro.2
> ===
> RCS file: /d/cvs/src/lib/libc/sys/intro.2,v
> retrieving revision 1.64
> diff -u -p -r1.64 intro.2
> --- lib/libc/sys/intro.2  17 Apr 2016 14:36:44 -  1.64
> +++ lib/libc/sys/intro.2  10 Apr 2017 12:58:29 -
> @@ -425,6 +425,18 @@ An IPC message queue does not contain a 
>  or a message catalog does not contain the requested message.
>  .It Er 91 ENOTSUP Em "Not supported" .
>  The operation has requested an unsupported value.
> +.It Er 92 EBADMSG Em "Bad message" .
> +Not used on
> +.Ox .
> +.It Er 93 ENOTRECOVERABLE Em "State not recoverable" .
> +Not used in
> +.Ox .
> +.It Er 94 EOWNERDEAD Em "Previous owner died" .
> +Not used in
> +.Ox .
> +.It Er 95 EPROTO Em "Protocol error" .
> +Not used in
> +.Ox .
>  .El
>  .Sh DEFINITIONS
>  .Bl -tag -width Ds
> Index: sys/sys/errno.h
> ===
> RCS file: /d/cvs/src/sys/sys/errno.h,v
> retrieving revision 1.24
> diff -u -p -r1.24 errno.h
> --- sys/sys/errno.h   24 Oct 2015 10:42:02 -  1.24
> +++ sys/sys/errno.h   10 Apr 2017 12:56:16 -
> @@ -167,8 +167,12 @@
>  #define EIDRM89  /* Identifier removed */
>  #define ENOMSG   90  /* No message of desired type */
>  #define ENOTSUP  91  /* Not supported */
> +#define EBADMSG  92  /* Bad message. */
> +#define ENOTRECOVERABLE  93  /* State not recoverable. */
> +#define EOWNERDEAD   94  /* Previous owner died. */
> +#define EPROTO   95  /* Protocol error. */
>  #if __BSD_VISIBLE
> -#define ELAST91  /* Must be equal largest errno */
> +#define ELAST95  /* Must be equal largest errno */
>  #endif /* __BSD_VISIBLE */
>  
>  #ifdef _KERNEL
> 
> -- 
> jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE
> 
> 



Re: openssl(1) not error exiting on full file system

2017-04-10 Thread Craig Skinner
On Mon, 10 Apr 2017 12:46:03 +0100 Craig Skinner wrote:
> $ openssl enc -bf -salt \
>   -pass file:/etc/myname -in /bsd \
>   -out /altroot/tmp/bsd.crypto
> 
> /altroot: write failed, file system is full
> $ print $?
> 0

Whoops;- I forgot to mention this is a default 6.0 release machine:

$ uname -msrv
OpenBSD 6.0 GENERIC#1917 i386


Would 74 from sysexits.h be the code to return?:
EX_IOERR -- An error occurred while doing I/O on some file.


Thanks,
-- 
Craig Skinner | http://linkd.in/yGqkv7



Re: Additional errno values

2017-04-10 Thread Jonathan Gray
On Mon, Apr 10, 2017 at 03:03:10PM +0200, Jeremie Courreges-Anglas wrote:
> 
> We have a bunch of patches in ports to deal with EPROTO and EBADMSG not
> being defined.  It would be nice to get rid of those.  The diff below
> also adds the also missing ENOTRECOVERABLE and EOWNERDEAD.
> 
> Thoughts?
> 
> (Dunno if there is a point describing verbosely what those new errno
> values mean on other systems...)

I sent a mail around last year for the posix errnos we lack.
Still waiting for a libc major crank which adding errnos requires
as the size of sys_errmsg changes.

--

We are missing a few errnos mentioned in posix 2013.
Excluding the reserved and streams/obsolete ones there is

EBADMSG Bad message
ENOTRECOVERABLE State not recoverable
EOWNERDEAD  Previous owner died
EPROTO  Protocol error

Index: sys/sys/errno.h
===
RCS file: /cvs/src/sys/sys/errno.h,v
retrieving revision 1.24
diff -u -p -r1.24 errno.h
--- sys/sys/errno.h 24 Oct 2015 10:42:02 -  1.24
+++ sys/sys/errno.h 2 Sep 2016 13:51:36 -
@@ -167,8 +167,12 @@
 #define EIDRM  89  /* Identifier removed */
 #define ENOMSG 90  /* No message of desired type */
 #define ENOTSUP91  /* Not supported */
+#define EBADMSG92  /* Bad message */
+#define ENOTRECOVERABLE93  /* State not recoverable */
+#define EOWNERDEAD 94  /* Previous owner died */
+#define EPROTO 95  /* Protocol error */
 #if __BSD_VISIBLE
-#define ELAST  91  /* Must be equal largest errno */
+#define ELAST  95  /* Must be equal largest errno */
 #endif /* __BSD_VISIBLE */
 
 #ifdef _KERNEL
Index: lib/libc/gen/errlist.c
===
RCS file: /cvs/src/lib/libc/gen/errlist.c,v
retrieving revision 1.18
diff -u -p -r1.18 errlist.c
--- lib/libc/gen/errlist.c  24 Oct 2015 10:42:02 -  1.18
+++ lib/libc/gen/errlist.c  2 Sep 2016 13:51:36 -
@@ -142,6 +142,10 @@ const char *const sys_errlist[] = {
"Identifier removed",   /* 89 - EIDRM */
"No message of desired type",   /* 90 - ENOMSG */
"Not supported",/* 91 - ENOTSUP */
+   "Bad message",  /* 92 - EBADMSG */
+   "State not recoverable",/* 93 - ENOTRECOVERABLE */
+   "Previous owner died",  /* 94 - EOWNERDEAD */
+   "Protocol error",   /* 95 - EPROTO */
 };
 const int sys_nerr = { sizeof sys_errlist/sizeof sys_errlist[0] };
 #if 0
Index: sys/dev/pci/drm/drm_linux.h
===
RCS file: /cvs/src/sys/dev/pci/drm/drm_linux.h,v
retrieving revision 1.47
diff -u -p -r1.47 drm_linux.h
--- sys/dev/pci/drm/drm_linux.h 5 Apr 2016 20:44:03 -   1.47
+++ sys/dev/pci/drm/drm_linux.h 2 Sep 2016 13:51:36 -
@@ -87,7 +87,6 @@ typedef off_t loff_t;
 #define ERESTARTSYSEINTR
 #define ETIME  ETIMEDOUT
 #define EREMOTEIO  EIO
-#define EPROTO EIO
 #define ENOTSUPP   ENOTSUP
 
 #define KERN_INFO



Re: Fix file descriptor leak in swig

2017-04-10 Thread Jonathan Gray
On Mon, Apr 10, 2017 at 02:50:50PM +0200, Mark Kettenis wrote:
> > Date: Mon, 10 Apr 2017 21:42:11 +1000
> > From: Jonathan Gray 
> > 
> > On Mon, Apr 10, 2017 at 01:35:57PM +0200, Mark Kettenis wrote:
> > > Looking into arm_neon.h.  This header file is supposed to be generated
> > > using the clang_tablegen tool, which is why we missed it.
> > 
> > Index: Makefile
> > ===
> > RCS file: /cvs/src/gnu/usr.bin/clang/include/clang/intrin/Makefile,v
> > retrieving revision 1.6
> > diff -u -p -r1.6 Makefile
> > --- Makefile24 Jan 2017 08:44:47 -  1.6
> > +++ Makefile10 Apr 2017 11:39:51 -
> > @@ -4,6 +4,8 @@
> >  
> >  LLVM_V=4.0.0
> >  CLANG_INTR_INCDIR= /usr/lib/clang/${LLVM_V}/include
> > +TBLGEN= ${.OBJDIR}/../../../clang-tblgen/clang-tblgen
> > +CLANG_INC=${.CURDIR}/../../../../../llvm/tools/clang/include
> >  
> >  .PATH: ${.CURDIR}/../../../../../llvm/tools/clang/lib/Headers
> >  
> > @@ -16,7 +18,8 @@ HEADERS=  stdalign.h \
> > module.modulemap \
> >  
> >  .if ${MACHINE_ARCH} == "aarch64" || ${MACHINE_ARCH} == "arm"
> > -HEADERS+=  arm_acle.h
> > +HEADERS+=  arm_acle.h \
> > +   arm_neon.h
> >  .elif ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
> >  HEADERS+=  adxintrin.h \
> > ammintrin.h \
> > @@ -73,6 +76,10 @@ HEADERS+=altivec.h \
> >  .endif
> >  
> >  all:   ${HEADERS}
> > +
> > +arm_neon.h: ${CLANG_INC}/clang/Basic/arm_neon.td
> > +   ${TBLGEN} -I${CLANG_INC} -gen-arm-neon \
> > +   -o ${.TARGET} ${.ALLSRC}   
> >  
> >  depend:
> > # Nothing here so far ...
> > 
> 
> Here's a slightly better version that removes the generated header
> file when you do "make clean":

ok jsg@

> 
> Index: gnu/usr.bin/clang/include/clang/intrin/Makefile
> ===
> RCS file: /cvs/src/gnu/usr.bin/clang/include/clang/intrin/Makefile,v
> retrieving revision 1.6
> diff -u -p -r1.6 Makefile
> --- gnu/usr.bin/clang/include/clang/intrin/Makefile   24 Jan 2017 08:44:47 
> -  1.6
> +++ gnu/usr.bin/clang/include/clang/intrin/Makefile   10 Apr 2017 12:48:05 
> -
> @@ -5,8 +5,12 @@
>  LLVM_V=  4.0.0
>  CLANG_INTR_INCDIR=   /usr/lib/clang/${LLVM_V}/include
>  
> +TBLGEN= ${.OBJDIR}/../../../clang-tblgen/clang-tblgen
> +CLANG_INC=${.CURDIR}/../../../../../llvm/tools/clang/include
> +
>  .PATH:   ${.CURDIR}/../../../../../llvm/tools/clang/lib/Headers
>  
> +GEN=
>  HEADERS= stdalign.h \
>   stdatomic.h \
>   stdnoreturn.h \
> @@ -16,7 +20,8 @@ HEADERS=stdalign.h \
>   module.modulemap \
>  
>  .if ${MACHINE_ARCH} == "aarch64" || ${MACHINE_ARCH} == "arm"
> -HEADERS+=arm_acle.h
> +GEN+=arm_neon.h
> +HEADERS+=arm_acle.h ${GEN}
>  .elif ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
>  HEADERS+=adxintrin.h \
>   ammintrin.h \
> @@ -78,12 +83,15 @@ depend:
>   # Nothing here so far ...
>  
>  clean cleandir:
> - # Nothing here so far ...
> + rm -f ${GEN}
>  
>  install includes: ${HEADERS}
>   ${INSTALL} -d -o ${SHAREOWN} -g ${SHAREGRP} -m ${DIRMODE} \
>   ${DESTDIR}${CLANG_INTR_INCDIR}
>   ${INSTALL} ${INSTALL_COPY} -m 444 ${.ALLSRC} \
>   ${DESTDIR}${CLANG_INTR_INCDIR}
> +
> +arm_neon.h: ${CLANG_INC}/clang/Basic/arm_neon.td
> + ${TBLGEN} -gen-arm-neon -o ${.TARGET} ${.ALLSRC}
>  
>  .include 
> 



Additional errno values

2017-04-10 Thread Jeremie Courreges-Anglas

We have a bunch of patches in ports to deal with EPROTO and EBADMSG not
being defined.  It would be nice to get rid of those.  The diff below
also adds the also missing ENOTRECOVERABLE and EOWNERDEAD.

Thoughts?

(Dunno if there is a point describing verbosely what those new errno
values mean on other systems...)


Index: lib/libc/shlib_version
===
RCS file: /d/cvs/src/lib/libc/shlib_version,v
retrieving revision 1.189
diff -u -p -r1.189 shlib_version
--- lib/libc/shlib_version  10 Apr 2017 05:10:56 -  1.189
+++ lib/libc/shlib_version  10 Apr 2017 12:56:16 -
@@ -1,4 +1,4 @@
 major=89
-minor=4
+minor=5
 # note: If changes were made to include/thread_private.h or if system
 # calls were added/changed then librthread/shlib_version also be updated.
Index: lib/libc/gen/errlist.c
===
RCS file: /d/cvs/src/lib/libc/gen/errlist.c,v
retrieving revision 1.18
diff -u -p -r1.18 errlist.c
--- lib/libc/gen/errlist.c  24 Oct 2015 10:42:02 -  1.18
+++ lib/libc/gen/errlist.c  10 Apr 2017 12:56:16 -
@@ -142,6 +142,10 @@ const char *const sys_errlist[] = {
"Identifier removed",   /* 89 - EIDRM */
"No message of desired type",   /* 90 - ENOMSG */
"Not supported",/* 91 - ENOTSUP */
+   "Bad message",  /* 92 - EBADMSG */
+   "State not recoverable",/* 93 - ENOTRECOVERABLE */
+   "Previous owner died",  /* 94 - EOWNERDEAD */
+   "Protocol error",   /* 95 - EPROTO */
 };
 const int sys_nerr = { sizeof sys_errlist/sizeof sys_errlist[0] };
 #if 0
Index: lib/libc/sys/intro.2
===
RCS file: /d/cvs/src/lib/libc/sys/intro.2,v
retrieving revision 1.64
diff -u -p -r1.64 intro.2
--- lib/libc/sys/intro.217 Apr 2016 14:36:44 -  1.64
+++ lib/libc/sys/intro.210 Apr 2017 12:58:29 -
@@ -425,6 +425,18 @@ An IPC message queue does not contain a 
 or a message catalog does not contain the requested message.
 .It Er 91 ENOTSUP Em "Not supported" .
 The operation has requested an unsupported value.
+.It Er 92 EBADMSG Em "Bad message" .
+Not used on
+.Ox .
+.It Er 93 ENOTRECOVERABLE Em "State not recoverable" .
+Not used in
+.Ox .
+.It Er 94 EOWNERDEAD Em "Previous owner died" .
+Not used in
+.Ox .
+.It Er 95 EPROTO Em "Protocol error" .
+Not used in
+.Ox .
 .El
 .Sh DEFINITIONS
 .Bl -tag -width Ds
Index: sys/sys/errno.h
===
RCS file: /d/cvs/src/sys/sys/errno.h,v
retrieving revision 1.24
diff -u -p -r1.24 errno.h
--- sys/sys/errno.h 24 Oct 2015 10:42:02 -  1.24
+++ sys/sys/errno.h 10 Apr 2017 12:56:16 -
@@ -167,8 +167,12 @@
 #define EIDRM  89  /* Identifier removed */
 #define ENOMSG 90  /* No message of desired type */
 #define ENOTSUP91  /* Not supported */
+#define EBADMSG92  /* Bad message. */
+#define ENOTRECOVERABLE93  /* State not recoverable. */
+#define EOWNERDEAD 94  /* Previous owner died. */
+#define EPROTO 95  /* Protocol error. */
 #if __BSD_VISIBLE
-#define ELAST  91  /* Must be equal largest errno */
+#define ELAST  95  /* Must be equal largest errno */
 #endif /* __BSD_VISIBLE */
 
 #ifdef _KERNEL

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: Fix file descriptor leak in swig

2017-04-10 Thread Mark Kettenis
> Date: Mon, 10 Apr 2017 21:42:11 +1000
> From: Jonathan Gray 
> 
> On Mon, Apr 10, 2017 at 01:35:57PM +0200, Mark Kettenis wrote:
> > Looking into arm_neon.h.  This header file is supposed to be generated
> > using the clang_tablegen tool, which is why we missed it.
> 
> Index: Makefile
> ===
> RCS file: /cvs/src/gnu/usr.bin/clang/include/clang/intrin/Makefile,v
> retrieving revision 1.6
> diff -u -p -r1.6 Makefile
> --- Makefile  24 Jan 2017 08:44:47 -  1.6
> +++ Makefile  10 Apr 2017 11:39:51 -
> @@ -4,6 +4,8 @@
>  
>  LLVM_V=  4.0.0
>  CLANG_INTR_INCDIR=   /usr/lib/clang/${LLVM_V}/include
> +TBLGEN= ${.OBJDIR}/../../../clang-tblgen/clang-tblgen
> +CLANG_INC=${.CURDIR}/../../../../../llvm/tools/clang/include
>  
>  .PATH:   ${.CURDIR}/../../../../../llvm/tools/clang/lib/Headers
>  
> @@ -16,7 +18,8 @@ HEADERS=stdalign.h \
>   module.modulemap \
>  
>  .if ${MACHINE_ARCH} == "aarch64" || ${MACHINE_ARCH} == "arm"
> -HEADERS+=arm_acle.h
> +HEADERS+=arm_acle.h \
> + arm_neon.h
>  .elif ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
>  HEADERS+=adxintrin.h \
>   ammintrin.h \
> @@ -73,6 +76,10 @@ HEADERS+=  altivec.h \
>  .endif
>  
>  all: ${HEADERS}
> +
> +arm_neon.h: ${CLANG_INC}/clang/Basic/arm_neon.td
> + ${TBLGEN} -I${CLANG_INC} -gen-arm-neon \
> + -o ${.TARGET} ${.ALLSRC}   
>  
>  depend:
>   # Nothing here so far ...
> 

Here's a slightly better version that removes the generated header
file when you do "make clean":

Index: gnu/usr.bin/clang/include/clang/intrin/Makefile
===
RCS file: /cvs/src/gnu/usr.bin/clang/include/clang/intrin/Makefile,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile
--- gnu/usr.bin/clang/include/clang/intrin/Makefile 24 Jan 2017 08:44:47 
-  1.6
+++ gnu/usr.bin/clang/include/clang/intrin/Makefile 10 Apr 2017 12:48:05 
-
@@ -5,8 +5,12 @@
 LLVM_V=4.0.0
 CLANG_INTR_INCDIR= /usr/lib/clang/${LLVM_V}/include
 
+TBLGEN= ${.OBJDIR}/../../../clang-tblgen/clang-tblgen
+CLANG_INC=${.CURDIR}/../../../../../llvm/tools/clang/include
+
 .PATH: ${.CURDIR}/../../../../../llvm/tools/clang/lib/Headers
 
+GEN=
 HEADERS=   stdalign.h \
stdatomic.h \
stdnoreturn.h \
@@ -16,7 +20,8 @@ HEADERS=  stdalign.h \
module.modulemap \
 
 .if ${MACHINE_ARCH} == "aarch64" || ${MACHINE_ARCH} == "arm"
-HEADERS+=  arm_acle.h
+GEN+=  arm_neon.h
+HEADERS+=  arm_acle.h ${GEN}
 .elif ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"
 HEADERS+=  adxintrin.h \
ammintrin.h \
@@ -78,12 +83,15 @@ depend:
# Nothing here so far ...
 
 clean cleandir:
-   # Nothing here so far ...
+   rm -f ${GEN}
 
 install includes: ${HEADERS}
${INSTALL} -d -o ${SHAREOWN} -g ${SHAREGRP} -m ${DIRMODE} \
${DESTDIR}${CLANG_INTR_INCDIR}
${INSTALL} ${INSTALL_COPY} -m 444 ${.ALLSRC} \
${DESTDIR}${CLANG_INTR_INCDIR}
+
+arm_neon.h: ${CLANG_INC}/clang/Basic/arm_neon.td
+   ${TBLGEN} -gen-arm-neon -o ${.TARGET} ${.ALLSRC}
 
 .include 



Alt-Tab cycling improvement for cwm

2017-04-10 Thread Walter Alejandro Iglesias

Raise previous window after cycling on cwm.


--- client.c.orig   Mon Apr 10 14:24:11 2017
+++ client.cMon Apr 10 14:29:14 2017
@@ -645,9 +645,11 @@ match:
 void
 client_cycle(struct screen_ctx *sc, int flags)
 {
-   struct client_ctx   *newcc, *oldcc;
+   struct client_ctx   *newcc, *oldcc, *prevcc;
int  again = 1;
 
+   prevcc = TAILQ_FIRST(>clientq);
+
/* For X apps that ignore events. */
XGrabKeyboard(X_Dpy, sc->rootwin, True,
GrabModeAsync, GrabModeAsync, CurrentTime);
@@ -686,6 +688,7 @@ client_cycle(struct screen_ctx *sc, int flags)
/* reset when cycling mod is released. XXX I hate this hack */
sc->cycling = 1;
client_ptrsave(oldcc);
+   client_raise(prevcc);
client_raise(newcc);
if (!client_inbound(newcc, newcc->ptr.x, newcc->ptr.y)) {
newcc->ptr.x = newcc->geom.w / 2;





openssl(1) not error exiting on full file system

2017-04-10 Thread Craig Skinner
Hello,

When encrypting a file with openssl(1),
it exits cleanly when there is not enough disk space:

$ df /altroot
Filesystem SizeUsed   Avail Capacity  Mounted on
/dev/wd1a  100M   52.5M   42.7M55%/altroot
$ while cp /bsd /altroot/tmp/bsd.${RANDOM}
> do
> df /altroot
> done
Filesystem SizeUsed   Avail Capacity  Mounted on
/dev/wd1a  100M   62.9M   32.3M66%/altroot
Filesystem SizeUsed   Avail Capacity  Mounted on
/dev/wd1a  100M   73.3M   21.9M77%/altroot
Filesystem SizeUsed   Avail Capacity  Mounted on
/dev/wd1a  100M   83.7M   11.5M88%/altroot
Filesystem SizeUsed   Avail Capacity  Mounted on
/dev/wd1a  100M   94.0M1.1M99%/altroot

/altroot: write failed, file system is full
cp: /altroot/tmp/bsd.25298: No space left on device
$ df /altroot
Filesystem SizeUsed   Avail Capacity  Mounted on
/dev/wd1a  100M   95.1M   36.0K   100%/altroot
$ ls -lh /altroot/tmp/
total 87328
-rw-r-  1 operator  wheel  10.4M Apr 10 12:22 bsd.16165
-rw-r-  1 operator  wheel  10.4M Apr 10 12:21 bsd.16877
-rw-r-  1 operator  wheel   1.1M Apr 10 12:22 bsd.25298
-rw-r-  1 operator  wheel  10.4M Apr 10 12:22 bsd.728
-rw-r-  1 operator  wheel  10.4M Apr 10 12:22 bsd.7450
$ rm /altroot/tmp/bsd.25298
remove /altroot/tmp/bsd.25298? y
$ cp /bsd /altroot/tmp/bsd.25298

/altroot: write failed, file system is full
cp: /altroot/tmp/bsd.25298: No space left on device
$ print $?
1
$ rm /altroot/tmp/bsd.25298
remove /altroot/tmp/bsd.25298? y
$ df /altroot
Filesystem SizeUsed   Avail Capacity  Mounted on
/dev/wd1a  100M   94.0M1.1M99%/altroot
$ openssl enc -bf -salt \
-pass file:/etc/myname -in /bsd \
-out /altroot/tmp/bsd.crypto

/altroot: write failed, file system is full
$ print $?
0
$ ls -lh /altroot/tmp/
total 87424
-rw-r-  1 operator  wheel  10.4M Apr 10 12:22 bsd.16165
-rw-r-  1 operator  wheel  10.4M Apr 10 12:21 bsd.16877
-rw-r-  1 operator  wheel  10.4M Apr 10 12:22 bsd.728
-rw-r-  1 operator  wheel  10.4M Apr 10 12:22 bsd.7450
-rw-r-  1 operator  wheel   1.1M Apr 10 12:26 bsd.crypto


Bug?
-- 
Craig Skinner | http://linkd.in/yGqkv7



arm64 fpu fixes

2017-04-10 Thread Mark Kettenis
Diff below revises the struct fpreg definition and enables the dumping
of fpu registers in core dumps.  That pointed out that we need to
reset the FPU state upon exec.

ok?


Index: arch/arm64/arm64/machdep.c
===
RCS file: /cvs/src/sys/arch/arm64/arm64/machdep.c,v
retrieving revision 1.12
diff -u -p -r1.12 machdep.c
--- arch/arm64/arm64/machdep.c  13 Mar 2017 00:53:56 -  1.12
+++ arch/arm64/arm64/machdep.c  10 Apr 2017 11:10:43 -
@@ -42,6 +42,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -454,6 +455,11 @@ setregs(struct proc *p, struct exec_pack
 register_t *retval)
 {
struct trapframe *tf;
+
+   /* If we were using the FPU, forget about it. */
+   if (p->p_addr->u_pcb.pcb_fpcpu != NULL)
+   vfp_discard(p);
+   p->p_addr->u_pcb.pcb_flags &= ~PCB_FPU;
 
tf = p->p_addr->u_pcb.pcb_tf;
 
Index: arch/arm64/arm64/process_machdep.c
===
RCS file: /cvs/src/sys/arch/arm64/arm64/process_machdep.c,v
retrieving revision 1.2
diff -u -p -r1.2 process_machdep.c
--- arch/arm64/arm64/process_machdep.c  21 Mar 2017 18:43:40 -  1.2
+++ arch/arm64/arm64/process_machdep.c  10 Apr 2017 11:10:43 -
@@ -68,7 +68,11 @@ process_read_regs(struct proc *p, struct
 int
 process_read_fpregs(struct proc *p, struct fpreg *regs)
 {
-   memset(regs, 0, sizeof(*regs));
+   if (p->p_addr->u_pcb.pcb_flags & PCB_FPU)
+   memcpy(regs, >p_addr->u_pcb.pcb_fpstate, sizeof(*regs));
+   else
+   memset(regs, 0, sizeof(*regs));
+
return(0);
 }
 
Index: arch/arm64/include/reg.h
===
RCS file: /cvs/src/sys/arch/arm64/include/reg.h,v
retrieving revision 1.2
diff -u -p -r1.2 reg.h
--- arch/arm64/include/reg.h21 Mar 2017 18:43:40 -  1.2
+++ arch/arm64/include/reg.h10 Apr 2017 11:10:43 -
@@ -28,7 +28,7 @@ struct reg {
 };
 
 struct fpreg {
-   uint64_tfp_registers[64]; // really 32 128 bit registers.
+   __uint128_t fp_reg[32];
uint32_tfp_sr;
uint32_tfp_cr;
 };



adventure(6): clean up disabled declaration

2017-04-10 Thread Frederic Cambus
Hi tech@,

Clean up disabled declaration in the text struct.

Comments? OK?

Index: games/adventure/hdr.h
===
RCS file: /cvs/src/games/adventure/hdr.h,v
retrieving revision 1.15
diff -u -p -r1.15 hdr.h
--- games/adventure/hdr.h   8 Mar 2016 10:48:39 -   1.15
+++ games/adventure/hdr.h   10 Apr 2017 09:24:28 -
@@ -85,9 +85,6 @@ struct hashtab{   /* hash table for voca
 } voc[HTSIZE];
 
 struct text {
-#ifdef OLDSTUFF
-   int seekadr;/* DATFILE must be < 2**16  */
-#endif /* OLDSTUFF */
char *seekadr;  /* Msg start in virtual disk*/
int txtlen; /* length of msg starting here  */
 };