svn commit: r297057 - head/usr.bin/localedef

2016-03-19 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Mar 20 03:27:06 2016
New Revision: 297057
URL: https://svnweb.freebsd.org/changeset/base/297057

Log:
  localedef(1): minor sorting to match Illumos.
  
  Illumos recently included space in 'print' class. We already had
  this but the code had slight sorting differences. Move it some
  lines up to reduce diffs with Illumos.
  
  No functional change.
  
  Reference:
  https://illumos.org/issues/5227

Modified:
  head/usr.bin/localedef/ctype.c

Modified: head/usr.bin/localedef/ctype.c
==
--- head/usr.bin/localedef/ctype.c  Sun Mar 20 03:09:01 2016
(r297056)
+++ head/usr.bin/localedef/ctype.c  Sun Mar 20 03:27:06 2016
(r297057)
@@ -332,14 +332,14 @@ dump_ctype(void)
ctn->ctype |= _ISLOWER;
if ((wc >= '0') && (wc <= '9'))
ctn->ctype |= _ISDIGIT;
+   if (wc == ' ')
+   ctn->ctype |= _ISPRINT;
if (strchr(" \f\n\r\t\v", (char)wc) != NULL)
ctn->ctype |= _ISSPACE;
if (strchr("0123456789ABCDEFabcdef", (char)wc) != NULL)
ctn->ctype |= _ISXDIGIT;
if (strchr(" \t", (char)wc))
ctn->ctype |= _ISBLANK;
-   if (wc == ' ')
-   ctn->ctype |= _ISPRINT;
 
/*
 * Technically these settings are only
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296816 - head/cddl/contrib/opensolaris/lib/libdtrace/common

2016-03-13 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Mar 14 00:34:12 2016
New Revision: 296816
URL: https://svnweb.freebsd.org/changeset/base/296816

Log:
  libdtrace: use calloc(3) instead of malloc(3) when it makes sense.
  
  calloc(3) is faster and occasionally safer than malloc(3) + bzero(3).
  
  In one case, pointed out by Mark[1], this also cleans up a calculation.
  
  Reviewed by:  markj [1]
  MFC after:1 week

Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_regset.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_strtab.c

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c
==
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c  Sun Mar 
13 23:32:59 2016(r296815)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c  Mon Mar 
14 00:34:12 2016(r296816)
@@ -24,6 +24,7 @@
  */
 /*
  * Copyright (c) 2013, Joyent, Inc.  All rights reserved.
+ * Copyright (c) 2016, Pedro Giffuni.  All rights reserved.
  */
 
 #include 
@@ -721,22 +722,20 @@ dt_module_load_proc(dtrace_hdl_t *dtp, d
return (dt_set_errno(dtp, EDT_CANTLOAD));
}
 
-   dmp->dm_libctfp = malloc(sizeof (ctf_file_t *) * arg.dpa_count);
+   dmp->dm_libctfp = calloc(arg.dpa_count, sizeof (ctf_file_t *));
if (dmp->dm_libctfp == NULL) {
dt_proc_unlock(dtp, p);
dt_proc_release(dtp, p);
return (dt_set_errno(dtp, EDT_NOMEM));
}
-   bzero(dmp->dm_libctfp, sizeof (ctf_file_t *) * arg.dpa_count);
 
-   dmp->dm_libctfn = malloc(sizeof (char *) * arg.dpa_count);
+   dmp->dm_libctfn = calloc(arg.dpa_count, sizeof (char *));
if (dmp->dm_libctfn == NULL) {
free(dmp->dm_libctfp);
dt_proc_unlock(dtp, p);
dt_proc_release(dtp, p);
return (dt_set_errno(dtp, EDT_NOMEM));
}
-   bzero(dmp->dm_libctfn, sizeof (char *) * arg.dpa_count);
 
dmp->dm_nctflibs = arg.dpa_count;
 
@@ -817,17 +816,14 @@ dt_module_load(dtrace_hdl_t *dtp, dt_mod
dmp->dm_nsymbuckets = _dtrace_strbuckets;
dmp->dm_symfree = 1;/* first free element is index 1 */
 
-   dmp->dm_symbuckets = malloc(sizeof (uint_t) * dmp->dm_nsymbuckets);
-   dmp->dm_symchains = malloc(sizeof (dt_sym_t) * dmp->dm_nsymelems + 1);
+   dmp->dm_symbuckets = calloc(dmp->dm_nsymbuckets, sizeof (uint_t));
+   dmp->dm_symchains = calloc(dmp->dm_nsymelems + 1, sizeof (dt_sym_t));
 
if (dmp->dm_symbuckets == NULL || dmp->dm_symchains == NULL) {
dt_module_unload(dtp, dmp);
return (dt_set_errno(dtp, EDT_NOMEM));
}
 
-   bzero(dmp->dm_symbuckets, sizeof (uint_t) * dmp->dm_nsymbuckets);
-   bzero(dmp->dm_symchains, sizeof (dt_sym_t) * dmp->dm_nsymelems + 1);
-
/*
 * Iterate over the symbol table data buffer and insert each symbol
 * name into the name hash if the name and type are valid.  Then

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_regset.c
==
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_regset.c  Sun Mar 
13 23:32:59 2016(r296815)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_regset.c  Mon Mar 
14 00:34:12 2016(r296816)
@@ -27,6 +27,7 @@
 
 /*
  * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2016 Pedro Giffuni.  All rights reserved.
  */
 
 #include 
@@ -47,15 +48,15 @@ dt_regset_create(ulong_t nregs)
if (drp == NULL)
return (NULL);
 
-   drp->dr_bitmap = malloc(sizeof (ulong_t) * n);
-   drp->dr_size = nregs;
+   drp->dr_bitmap = calloc(n, sizeof (ulong_t));
 
if (drp->dr_bitmap == NULL) {
dt_regset_destroy(drp);
return (NULL);
}
 
-   bzero(drp->dr_bitmap, sizeof (ulong_t) * n);
+   drp->dr_size = nregs;
+
return (drp);
 }
 

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_strtab.c
==
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_strtab.c  Sun Mar 
13 23:32:59 2016(r296815)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_strtab.c  Mon Mar 
14 00:34:12 2016(r296816)
@@ -24,6 +24,10 @@
  * Use is subject to license terms.
  */
 
+/*
+ * Portions Copyright 2016 Pedro Giffuni.  All rights reserved.
+ */
+ 
 #pragma ident  "%Z%%M% %I% %E% SMI"
 
 #include 
@@ -70,12 +74,11 @@ dt_strtab_create(size_t bufsz)
return (NULL);
 
bzero(sp, sizeof (dt_strtab_t));
-   sp->str_hash = malloc(nbuckets * sizeof (dt_strhash_t *));
+   sp->str_hash = calloc(nbuckets, sizeof 

svn commit: r296435 - in head/lib/libedit: . TEST edit/readline

2016-03-06 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Mar  6 21:32:54 2016
New Revision: 296435
URL: https://svnweb.freebsd.org/changeset/base/296435

Log:
  Revert r296175
  Undo update of libedit 2016-02-27
  
  Something in libedit appears to be causing breakage in lldb38.
  The changes are not generally huge but they are suficient to
  to justify reverting for now.
  
  Reported by:  novel, bapt

Modified:
  head/lib/libedit/Makefile
  head/lib/libedit/TEST/tc1.c
  head/lib/libedit/TEST/wtc1.c
  head/lib/libedit/chared.c
  head/lib/libedit/chared.h
  head/lib/libedit/chartype.c
  head/lib/libedit/chartype.h
  head/lib/libedit/common.c
  head/lib/libedit/config.h
  head/lib/libedit/edit/readline/readline.h
  head/lib/libedit/editline.3
  head/lib/libedit/el.c
  head/lib/libedit/el.h
  head/lib/libedit/eln.c
  head/lib/libedit/emacs.c
  head/lib/libedit/filecomplete.c
  head/lib/libedit/hist.c
  head/lib/libedit/hist.h
  head/lib/libedit/histedit.h
  head/lib/libedit/history.c
  head/lib/libedit/keymacro.c
  head/lib/libedit/makelist
  head/lib/libedit/map.c
  head/lib/libedit/parse.c
  head/lib/libedit/prompt.c
  head/lib/libedit/prompt.h
  head/lib/libedit/read.c
  head/lib/libedit/read.h
  head/lib/libedit/readline.c
  head/lib/libedit/refresh.c
  head/lib/libedit/refresh.h
  head/lib/libedit/search.c
  head/lib/libedit/search.h
  head/lib/libedit/sig.c
  head/lib/libedit/sig.h
  head/lib/libedit/sys.h
  head/lib/libedit/terminal.c
  head/lib/libedit/terminal.h
  head/lib/libedit/tokenizer.c
  head/lib/libedit/tty.c
  head/lib/libedit/tty.h
  head/lib/libedit/vi.c
Directory Properties:
  head/lib/libedit/   (props changed)
  head/lib/libedit/edit/readline/   (props changed)

Modified: head/lib/libedit/Makefile
==
--- head/lib/libedit/Makefile   Sun Mar  6 18:41:48 2016(r296434)
+++ head/lib/libedit/Makefile   Sun Mar  6 21:32:54 2016(r296435)
@@ -1,4 +1,4 @@
-#  $NetBSD: Makefile,v 1.55 2016/02/24 14:25:38 christos Exp $
+#  $NetBSD: Makefile,v 1.37 2009/01/18 12:17:49 lukem Exp $
 #  @(#)Makefile8.1 (Berkeley) 6/4/93
 # $FreeBSD$
 
@@ -6,7 +6,7 @@ LIB=edit
 SHLIB_MAJOR=   7
 SHLIBDIR?= /lib
 
-OSRCS= chared.c common.c el.c eln.c emacs.c fcns.c filecomplete.c help.c \
+OSRCS= chared.c common.c el.c emacs.c fcns.c filecomplete.c help.c \
hist.c keymacro.c map.c chartype.c \
parse.c prompt.c read.c refresh.c search.c sig.c terminal.c tty.c vi.c
 
@@ -34,6 +34,7 @@ CLEANFILES+= common.h editline.c emacs.h
 
 INCS=  histedit.h
 
+OSRCS+=eln.c
 SRCS+= tokenizern.c historyn.c
 CLEANFILES+=   tokenizern.c historyn.c
 CFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/edit -DWIDECHAR

Modified: head/lib/libedit/TEST/tc1.c
==
--- head/lib/libedit/TEST/tc1.c Sun Mar  6 18:41:48 2016(r296434)
+++ head/lib/libedit/TEST/tc1.c Sun Mar  6 21:32:54 2016(r296435)
@@ -1,4 +1,4 @@
-/* $NetBSD: tc1.c,v 1.7 2016/02/17 19:47:49 christos Exp $ */
+/* $NetBSD: tc1.c,v 1.6 2014/06/18 20:12:15 christos Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 19
 #if 0
 static char sccsid[] = "@(#)test.c 8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: tc1.c,v 1.7 2016/02/17 19:47:49 christos Exp $");
+__RCSID("$NetBSD: tc1.c,v 1.6 2014/06/18 20:12:15 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 __FBSDID("$FreeBSD$");
@@ -50,15 +50,15 @@ __FBSDID("$FreeBSD$");
 /*
  * test.c: A little test program
  */
+#include 
+#include 
+#include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
 #include 
-#include 
 #include 
+#include 
+#include 
 
 #include "histedit.h"
 
@@ -158,7 +158,7 @@ main(int argc, char *argv[])
/* Add a user-defined function  */
el_set(el, EL_ADDFN, "ed-complete", "Complete argument", complete);
 
-   /* Bind tab to it   */
+   /* Bind tab to it   */
el_set(el, EL_BIND, "^I", "ed-complete", NULL);
 
/*

Modified: head/lib/libedit/TEST/wtc1.c
==
--- head/lib/libedit/TEST/wtc1.cSun Mar  6 18:41:48 2016
(r296434)
+++ head/lib/libedit/TEST/wtc1.cSun Mar  6 21:32:54 2016
(r296435)
@@ -5,16 +5,13 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
+#include 
 #include 
-#include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
 
 #include "../histedit.h"
 

Modified: head/lib/libedit/chared.c
==
--- head/lib/libedit/chared.c   Sun Mar  6 18:41:48 2016(r296434)
+++ head/lib/libedit/chared.c   Sun Mar  6 21:32:54 2016

svn commit: r296404 - head/lib/libc/rpc

2016-03-04 Thread Pedro F. Giffuni
Author: pfg
Date: Sat Mar  5 01:17:23 2016
New Revision: 296404
URL: https://svnweb.freebsd.org/changeset/base/296404

Log:
  Stray tabs and spaces.
  
  No functional change.

Modified:
  head/lib/libc/rpc/rtime.c

Modified: head/lib/libc/rpc/rtime.c
==
--- head/lib/libc/rpc/rtime.c   Fri Mar  4 22:37:44 2016(r296403)
+++ head/lib/libc/rpc/rtime.c   Sat Mar  5 01:17:23 2016(r296404)
@@ -61,8 +61,8 @@ __FBSDID("$FreeBSD$");
 
 extern int _rpc_dtablesize( void );
 
-#define NYEARS (unsigned long)(1970 - 1900)
-#define TOFFSET (unsigned long)(60*60*24*(365*NYEARS + (NYEARS/4)))
+#defineNYEARS  (unsigned long)(1970 - 1900)
+#defineTOFFSET (unsigned long)(60*60*24*(365*NYEARS + (NYEARS/4)))
 
 static void do_close( int );
 
@@ -98,11 +98,11 @@ rtime(struct sockaddr_in *addrp, struct 
addrp->sin_port = serv->s_port;
 
if (type == SOCK_DGRAM) {
-   res = _sendto(s, (char *), sizeof(thetime), 0, 
+   res = _sendto(s, (char *), sizeof(thetime), 0,
 (struct sockaddr *)addrp, sizeof(*addrp));
if (res < 0) {
do_close(s);
-   return(-1); 
+   return(-1);
}
do {
FD_ZERO();
@@ -115,14 +115,14 @@ rtime(struct sockaddr_in *addrp, struct 
errno = ETIMEDOUT;
}
do_close(s);
-   return(-1); 
+   return(-1);
}
fromlen = sizeof(from);
-   res = _recvfrom(s, (char *), sizeof(thetime), 0, 
+   res = _recvfrom(s, (char *), sizeof(thetime), 0,
   (struct sockaddr *), );
do_close(s);
if (res < 0) {
-   return(-1); 
+   return(-1);
}
} else {
if (_connect(s, (struct sockaddr *)addrp, sizeof(*addrp)) < 0) {
@@ -137,7 +137,7 @@ rtime(struct sockaddr_in *addrp, struct 
}
if (res != sizeof(thetime)) {
errno = EIO;
-   return(-1); 
+   return(-1);
}
thetime = ntohl(thetime);
timep->tv_sec = thetime - TOFFSET;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296394 - head/include/rpc

2016-03-04 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Mar  4 22:03:38 2016
New Revision: 296394
URL: https://svnweb.freebsd.org/changeset/base/296394

Log:
  xdr: Fix xdr_rpc* defines.
  
  The defines for xdr_rpc* in xdr.h are wrong. It could be
  very well that Solaris did strip the '_t' from xdr_u_int32_t,
  but Solaris has a xdr_u_int32 function, we don't have this.
  So all of this defines will lead to an unresolved symbol.
  
  This explains why we do not use these functions in FreeBSD
  while they are used in Illumos/Solaris.
  
  Obtained from:linux libtirpc (git 
7864122e61ffe4db1aa8ace89117358a1e3a391b)
  MFC after:3 weeks

Modified:
  head/include/rpc/xdr.h

Modified: head/include/rpc/xdr.h
==
--- head/include/rpc/xdr.h  Fri Mar  4 21:22:11 2016(r296393)
+++ head/include/rpc/xdr.h  Fri Mar  4 22:03:38 2016(r296394)
@@ -219,15 +219,11 @@ xdr_putint32(XDR *xdrs, int32_t *ip)
(*(xdrs)->x_ops->x_control)(xdrs, req, op)
 #define xdr_control(xdrs, req, op) XDR_CONTROL(xdrs, req, op)
 
-/*
- * Solaris strips the '_t' from these types -- not sure why.
- * But, let's be compatible.
- */
-#define xdr_rpcvers(xdrs, versp) xdr_u_int32(xdrs, versp)
-#define xdr_rpcprog(xdrs, progp) xdr_u_int32(xdrs, progp)
-#define xdr_rpcproc(xdrs, procp) xdr_u_int32(xdrs, procp)
-#define xdr_rpcprot(xdrs, protp) xdr_u_int32(xdrs, protp)
-#define xdr_rpcport(xdrs, portp) xdr_u_int32(xdrs, portp)
+#define xdr_rpcvers(xdrs, versp) xdr_u_int32_t(xdrs, versp)
+#define xdr_rpcprog(xdrs, progp) xdr_u_int32_t(xdrs, progp)
+#define xdr_rpcproc(xdrs, procp) xdr_u_int32_t(xdrs, procp)
+#define xdr_rpcprot(xdrs, protp) xdr_u_int32_t(xdrs, protp)
+#define xdr_rpcport(xdrs, portp) xdr_u_int32_t(xdrs, portp)
 
 /*
  * Support struct for discriminated unions.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296386 - head/lib/libc/rpc

2016-03-04 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Mar  4 15:30:41 2016
New Revision: 296386
URL: https://svnweb.freebsd.org/changeset/base/296386

Log:
  Work around aliasing issues detected in modern GCC.
  
  Avoid casting gymnastics that lead to pointer aliasing by introducing an
  inline function as done in NetBSD (but without #if0'd WIP code).
  
  Obtained from:NetBSD (CVS Rev. 1.24, 1.25)

Modified:
  head/lib/libc/rpc/clnt_vc.c

Modified: head/lib/libc/rpc/clnt_vc.c
==
--- head/lib/libc/rpc/clnt_vc.c Fri Mar  4 14:23:34 2016(r296385)
+++ head/lib/libc/rpc/clnt_vc.c Fri Mar  4 15:30:41 2016(r296386)
@@ -502,6 +502,20 @@ clnt_vc_abort(CLIENT *cl)
 {
 }
 
+static __inline void
+htonlp(void *dst, const void *src, uint32_t incr)
+{
+   /* We are aligned, so we think */
+   *(uint32_t *)dst = htonl(*(const uint32_t *)src + incr);
+}
+
+static __inline void
+ntohlp(void *dst, const void *src)
+{
+   /* We are aligned, so we think */
+   *(uint32_t *)dst = htonl(*(const uint32_t *)src);
+}
+
 static bool_t
 clnt_vc_control(CLIENT *cl, u_int request, void *info)
 {
@@ -576,14 +590,12 @@ clnt_vc_control(CLIENT *cl, u_int reques
 * first element in the call structure
 * This will get the xid of the PREVIOUS call
 */
-   *(u_int32_t *)info =
-   ntohl(*(u_int32_t *)(void *)>ct_u.ct_mcalli);
+   ntohlp(info, >ct_u.ct_mcalli);
break;
case CLSET_XID:
/* This will set the xid of the NEXT call */
-   *(u_int32_t *)(void *)>ct_u.ct_mcalli =
-   htonl(*((u_int32_t *)info) + 1);
/* increment by 1 as clnt_vc_call() decrements once */
+   htonlp(>ct_u.ct_mcalli, info, 1);
break;
case CLGET_VERS:
/*
@@ -592,15 +604,11 @@ clnt_vc_control(CLIENT *cl, u_int reques
 * begining of the RPC header. MUST be changed if the
 * call_struct is changed
 */
-   *(u_int32_t *)info =
-   ntohl(*(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
-   4 * BYTES_PER_XDR_UNIT));
+   ntohlp(info, ct->ct_u.ct_mcallc + 4 * BYTES_PER_XDR_UNIT);
break;
 
case CLSET_VERS:
-   *(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
-   4 * BYTES_PER_XDR_UNIT) =
-   htonl(*(u_int32_t *)info);
+   htonlp(ct->ct_u.ct_mcallc + 4 * BYTES_PER_XDR_UNIT, info, 0);
break;
 
case CLGET_PROG:
@@ -610,15 +618,11 @@ clnt_vc_control(CLIENT *cl, u_int reques
 * begining of the RPC header. MUST be changed if the
 * call_struct is changed
 */
-   *(u_int32_t *)info =
-   ntohl(*(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
-   3 * BYTES_PER_XDR_UNIT));
+   ntohlp(info, ct->ct_u.ct_mcallc + 3 * BYTES_PER_XDR_UNIT);
break;
 
case CLSET_PROG:
-   *(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
-   3 * BYTES_PER_XDR_UNIT) =
-   htonl(*(u_int32_t *)info);
+   htonlp(ct->ct_u.ct_mcallc + 3 * BYTES_PER_XDR_UNIT, info, 0);
break;
 
default:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296349 - head/include/rpc

2016-03-03 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Mar  3 14:44:30 2016
New Revision: 296349
URL: https://svnweb.freebsd.org/changeset/base/296349

Log:
  Add sunrpc compat define for xp_sock.
  
  SunRPC is using xp_sock in SVCXPRT, while TI-RPC is using
  xp_fd. Add a compatibility define.
  
  Illumos has something similar for the non-kernel case.
  
  Obtained from: linux-nfs project (git 
0d94036c3a0d4c24d22bf6a8c40ac6625d972c29)

Modified:
  head/include/rpc/svc.h

Modified: head/include/rpc/svc.h
==
--- head/include/rpc/svc.h  Thu Mar  3 13:07:59 2016(r296348)
+++ head/include/rpc/svc.h  Thu Mar  3 14:44:30 2016(r296349)
@@ -89,6 +89,7 @@ enum xprt_stat {
  */
 typedef struct __rpc_svcxprt {
int xp_fd;
+#definexp_sock xp_fd
u_short xp_port; /* associated port number */
const struct xp_ops {
/* receive incoming requests */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296351 - head/contrib/openresolv

2016-03-03 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Mar  3 15:36:00 2016
New Revision: 296351
URL: https://svnweb.freebsd.org/changeset/base/296351

Log:
  MFV   r296350:
  Split each domain again after striping any trailing dot.
  
  Reported by:   dumbbell
  Obtained from:openresolv (53416cf1b4)

Modified:
  head/contrib/openresolv/resolvconf.in
Directory Properties:
  head/contrib/openresolv/   (props changed)

Modified: head/contrib/openresolv/resolvconf.in
==
--- head/contrib/openresolv/resolvconf.in   Thu Mar  3 15:32:50 2016
(r296350)
+++ head/contrib/openresolv/resolvconf.in   Thu Mar  3 15:36:00 2016
(r296351)
@@ -127,10 +127,11 @@ echo_resolv()
 # This also solves setting up duplicate zones in our subscribers.
 strip_trailing_dots()
 {
-   local n=
+   local n= d=
 
for n; do
-   printf "%s" "${n%.}"
+   printf "$d%s" "${n%.}"
+   d=" "
done
printf "\n"
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296278 - head/lib/libc/locale

2016-03-01 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Mar  1 19:15:34 2016
New Revision: 296278
URL: https://svnweb.freebsd.org/changeset/base/296278

Log:
  mbtowc(3): set errno to EILSEQ if an incomplete character is passed.
  
  According to POSIX, The mbtowc() function shall fail if:
  [EILSEQ] An invalid character sequence is detected.
  
  Reviewed by:  bapt
  Differential Revision:https://reviews.freebsd.org/D5496
  
  Obtained from:OpenBSD (Ingo Schwarze)
  MFC after:1 month

Modified:
  head/lib/libc/locale/mbtowc.c

Modified: head/lib/libc/locale/mbtowc.c
==
--- head/lib/libc/locale/mbtowc.c   Tue Mar  1 18:12:14 2016
(r296277)
+++ head/lib/libc/locale/mbtowc.c   Tue Mar  1 19:15:34 2016
(r296278)
@@ -32,6 +32,7 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
 #include 
 #include 
 #include "mblocal.h"
@@ -49,9 +50,15 @@ mbtowc_l(wchar_t * __restrict pwc, const
return (0);
}
rval = XLOCALE_CTYPE(locale)->__mbrtowc(pwc, s, n, >mbtowc);
-   if (rval == (size_t)-1 || rval == (size_t)-2)
+   switch (rval) {
+   case (size_t)-2:
+   errno = EILSEQ;
+   /* FALLTHROUGH */
+   case (size_t)-1:
return (-1);
-   return ((int)rval);
+   default:
+   return ((int)rval);
+   }
 }
 int
 mbtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296190 - head/contrib/openresolv

2016-02-29 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Feb 29 14:46:39 2016
New Revision: 296190
URL: https://svnweb.freebsd.org/changeset/base/296190

Log:
  MFV   r296164:
  Update openresolve to version 3.7.3 including:
  
   *  Save the initial working directory and change to it just before
   running any scripts.
   This avoids scripts putting files accidently where they shouldn't.
   *  Strip trailing dot from search and domain names.
   *  man page improvements.
  
  Relnotes: yes

Modified:
  head/contrib/openresolv/Makefile
  head/contrib/openresolv/resolvconf.conf.5.in
  head/contrib/openresolv/resolvconf.in
Directory Properties:
  head/contrib/openresolv/   (props changed)

Modified: head/contrib/openresolv/Makefile
==
--- head/contrib/openresolv/MakefileMon Feb 29 09:22:39 2016
(r296189)
+++ head/contrib/openresolv/MakefileMon Feb 29 14:46:39 2016
(r296190)
@@ -1,5 +1,5 @@
 PKG=   openresolv
-VERSION=   3.7.1
+VERSION=   3.7.3
 
 # Nasty hack so that make clean works without configure being run
 _CONFIG_MK!=   test -e config.mk && echo config.mk || echo config-null.mk

Modified: head/contrib/openresolv/resolvconf.conf.5.in
==
--- head/contrib/openresolv/resolvconf.conf.5.inMon Feb 29 09:22:39 
2016(r296189)
+++ head/contrib/openresolv/resolvconf.conf.5.inMon Feb 29 14:46:39 
2016(r296190)
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2009-2015 Roy Marples
+.\" Copyright (c) 2009-2016 Roy Marples
 .\" All rights reserved
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd May 14, 2015
+.Dd February 21, 2016
 .Dt RESOLVCONF.CONF 5
 .Os
 .Sh NAME
@@ -42,8 +42,11 @@ must contain valid shell commands.
 Listed below are the standard
 .Nm
 variables that may be set.
-If the values contain white space for special shell characters,
+If the values contain whitespace, wildcards or other special shell characters,
 ensure they are quoted and escaped correctly.
+See the
+.Sy replace
+variable for an example on quoting.
 .Pp
 After updating this file, you may wish to run
 .Nm resolvconf -u

Modified: head/contrib/openresolv/resolvconf.in
==
--- head/contrib/openresolv/resolvconf.in   Mon Feb 29 09:22:39 2016
(r296189)
+++ head/contrib/openresolv/resolvconf.in   Mon Feb 29 14:46:39 2016
(r296190)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (c) 2007-2015 Roy Marples
+# Copyright (c) 2007-2016 Roy Marples
 # All rights reserved
 
 # Redistribution and use in source and binary forms, with or without
@@ -55,6 +55,7 @@ METRICDIR="$VARDIR/metrics"
 PRIVATEDIR="$VARDIR/private"
 EXCLUSIVEDIR="$VARDIR/exclusive"
 LOCKDIR="$VARDIR/lock"
+_PWD="$PWD"
 
 warn()
 {
@@ -119,6 +120,21 @@ echo_resolv()
IFS="$OIFS"
 }
 
+# Strip any trailing dot from each name as a FQDN does not belong
+# in resolv.conf(5)
+# If you think otherwise, capture a DNS trace and you'll see libc
+# will strip it regardless.
+# This also solves setting up duplicate zones in our subscribers.
+strip_trailing_dots()
+{
+   local n=
+
+   for n; do
+   printf "%s" "${n%.}"
+   done
+   printf "\n"
+}
+
 # Parse resolv.conf's and make variables
 # for domain name servers, search name servers and global nameservers
 parse_resolv()
@@ -162,14 +178,14 @@ parse_resolv()
$islocal || ns="$ns${line#* } "
;;
"domain "*)
+   search="$(strip_trailing_dots ${line#* })"
if [ -z "$domain" ]; then
-   domain="${line#* }"
+   domain="$search"
echo "DOMAIN=\"$domain\""
fi
-   search="${line#* }"
;;
"search "*)
-   search="${line#* }"
+   search="$(strip_trailing_dots ${line#* })"
;;
*)
[ -n "$line" ] && continue
@@ -752,6 +768,10 @@ eval "$(make_vars)"
 export RESOLVCONF DOMAINS SEARCH NAMESERVERS LOCALNAMESERVERS
 : ${list_resolv:=list_resolv -l}
 retval=0
+
+# Run scripts in the same directory resolvconf is run from
+# in case any scripts accidently dump files in the wrong place.
+cd "$_PWD"
 for script in "$LIBEXECDIR"/*; do
if [ -f "$script" ]; then
eval script_enabled="\$${script##*/}"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296175 - in head/lib/libedit: . TEST edit/readline

2016-02-28 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Feb 29 00:15:25 2016
New Revision: 296175
URL: https://svnweb.freebsd.org/changeset/base/296175

Log:
  MFV r296159
  Sync our libedit with NetBSD's libedit 2016-02-27.
  
  Obtained from:NetBSD

Modified:
  head/lib/libedit/Makefile
  head/lib/libedit/TEST/tc1.c
  head/lib/libedit/TEST/wtc1.c
  head/lib/libedit/chared.c
  head/lib/libedit/chared.h
  head/lib/libedit/chartype.c
  head/lib/libedit/chartype.h
  head/lib/libedit/common.c
  head/lib/libedit/config.h
  head/lib/libedit/edit/readline/readline.h
  head/lib/libedit/editline.3
  head/lib/libedit/el.c
  head/lib/libedit/el.h
  head/lib/libedit/eln.c
  head/lib/libedit/emacs.c
  head/lib/libedit/filecomplete.c
  head/lib/libedit/hist.c
  head/lib/libedit/hist.h
  head/lib/libedit/histedit.h
  head/lib/libedit/history.c
  head/lib/libedit/keymacro.c
  head/lib/libedit/makelist
  head/lib/libedit/map.c
  head/lib/libedit/parse.c
  head/lib/libedit/prompt.c
  head/lib/libedit/prompt.h
  head/lib/libedit/read.c
  head/lib/libedit/read.h
  head/lib/libedit/readline.c
  head/lib/libedit/refresh.c
  head/lib/libedit/refresh.h
  head/lib/libedit/search.c
  head/lib/libedit/search.h
  head/lib/libedit/sig.c
  head/lib/libedit/sig.h
  head/lib/libedit/sys.h
  head/lib/libedit/terminal.c
  head/lib/libedit/terminal.h
  head/lib/libedit/tokenizer.c
  head/lib/libedit/tty.c
  head/lib/libedit/tty.h
  head/lib/libedit/vi.c
Directory Properties:
  head/lib/libedit/   (props changed)
  head/lib/libedit/edit/readline/   (props changed)

Modified: head/lib/libedit/Makefile
==
--- head/lib/libedit/Makefile   Mon Feb 29 00:05:37 2016(r296174)
+++ head/lib/libedit/Makefile   Mon Feb 29 00:15:25 2016(r296175)
@@ -1,4 +1,4 @@
-#  $NetBSD: Makefile,v 1.37 2009/01/18 12:17:49 lukem Exp $
+#  $NetBSD: Makefile,v 1.55 2016/02/24 14:25:38 christos Exp $
 #  @(#)Makefile8.1 (Berkeley) 6/4/93
 # $FreeBSD$
 
@@ -6,7 +6,7 @@ LIB=edit
 SHLIB_MAJOR=   7
 SHLIBDIR?= /lib
 
-OSRCS= chared.c common.c el.c emacs.c fcns.c filecomplete.c help.c \
+OSRCS= chared.c common.c el.c eln.c emacs.c fcns.c filecomplete.c help.c \
hist.c keymacro.c map.c chartype.c \
parse.c prompt.c read.c refresh.c search.c sig.c terminal.c tty.c vi.c
 
@@ -34,7 +34,6 @@ CLEANFILES+= common.h editline.c emacs.h
 
 INCS=  histedit.h
 
-OSRCS+=eln.c
 SRCS+= tokenizern.c historyn.c
 CLEANFILES+=   tokenizern.c historyn.c
 CFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/edit -DWIDECHAR

Modified: head/lib/libedit/TEST/tc1.c
==
--- head/lib/libedit/TEST/tc1.c Mon Feb 29 00:05:37 2016(r296174)
+++ head/lib/libedit/TEST/tc1.c Mon Feb 29 00:15:25 2016(r296175)
@@ -1,4 +1,4 @@
-/* $NetBSD: tc1.c,v 1.6 2014/06/18 20:12:15 christos Exp $ */
+/* $NetBSD: tc1.c,v 1.7 2016/02/17 19:47:49 christos Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 19
 #if 0
 static char sccsid[] = "@(#)test.c 8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: tc1.c,v 1.6 2014/06/18 20:12:15 christos Exp $");
+__RCSID("$NetBSD: tc1.c,v 1.7 2016/02/17 19:47:49 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 __FBSDID("$FreeBSD$");
@@ -50,15 +50,15 @@ __FBSDID("$FreeBSD$");
 /*
  * test.c: A little test program
  */
-#include 
-#include 
-#include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 #include "histedit.h"
 
@@ -158,7 +158,7 @@ main(int argc, char *argv[])
/* Add a user-defined function  */
el_set(el, EL_ADDFN, "ed-complete", "Complete argument", complete);
 
-   /* Bind tab to it   */
+   /* Bind tab to it   */
el_set(el, EL_BIND, "^I", "ed-complete", NULL);
 
/*

Modified: head/lib/libedit/TEST/wtc1.c
==
--- head/lib/libedit/TEST/wtc1.cMon Feb 29 00:05:37 2016
(r296174)
+++ head/lib/libedit/TEST/wtc1.cMon Feb 29 00:15:25 2016
(r296175)
@@ -5,13 +5,16 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
-#include 
-#include 
 #include 
+#include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 #include "../histedit.h"
 

Modified: head/lib/libedit/chared.c
==
--- head/lib/libedit/chared.c   Mon Feb 29 00:05:37 2016(r296174)
+++ head/lib/libedit/chared.c   Mon Feb 29 00:15:25 2016(r296175)
@@ -1,4 +1,4 @@
-/* $NetBSD: chared.c,v 1.40 2014/06/18 18:12:28 christos Exp $ */
+/* $NetBSD: chared.c,v 1.49 2016/02/24 14:29:21 

svn commit: r296134 - head/libexec/getty

2016-02-26 Thread Pedro F. Giffuni
Author: pfg
Date: Sat Feb 27 02:11:00 2016
New Revision: 296134
URL: https://svnweb.freebsd.org/changeset/base/296134

Log:
  Missing tab.
  
  Pointed out by:   bapt

Modified:
  head/libexec/getty/subr.c

Modified: head/libexec/getty/subr.c
==
--- head/libexec/getty/subr.c   Fri Feb 26 23:25:21 2016(r296133)
+++ head/libexec/getty/subr.c   Sat Feb 27 02:11:00 2016(r296134)
@@ -635,7 +635,7 @@ portselector(void)
 const char *
 autobaud(void)
 {
-struct pollfd set[1];
+   struct pollfd set[1];
struct timespec timeout;
char c;
const char *type = "9600-baud";
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296133 - in head: include/rpc lib/libc/rpc

2016-02-26 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Feb 26 23:25:21 2016
New Revision: 296133
URL: https://svnweb.freebsd.org/changeset/base/296133

Log:
  RPC: update the getrpcbyname() definition to include a const qualifier.
  
  Add const qualifier making getrpcbyname() and getrpcbyname_r()
  prototypes match those used in latest Sun RPC code (TI-RPC 2.3).
  
  Obtained from:NetBSD

Modified:
  head/include/rpc/rpcent.h
  head/lib/libc/rpc/getrpcent.3
  head/lib/libc/rpc/getrpcent.c

Modified: head/include/rpc/rpcent.h
==
--- head/include/rpc/rpcent.h   Fri Feb 26 23:12:59 2016(r296132)
+++ head/include/rpc/rpcent.h   Fri Feb 26 23:25:21 2016(r296133)
@@ -56,7 +56,7 @@ __BEGIN_DECLS
  * These interfaces are currently implemented through nsswitch and are
  * MT-safe.
  */
-extern struct rpcent *getrpcbyname(char *);
+extern struct rpcent *getrpcbyname(const char *);
 extern struct rpcent *getrpcbynumber(int);
 extern struct rpcent *getrpcent(void);
 extern void setrpcent(int);

Modified: head/lib/libc/rpc/getrpcent.3
==
--- head/lib/libc/rpc/getrpcent.3   Fri Feb 26 23:12:59 2016
(r296132)
+++ head/lib/libc/rpc/getrpcent.3   Fri Feb 26 23:25:21 2016
(r296133)
@@ -2,7 +2,7 @@
 .\" $NetBSD: getrpcent.3,v 1.6 1998/02/05 18:49:06 perry Exp $
 .\" $FreeBSD$
 .\"
-.Dd December 14, 1987
+.Dd February 26, 2016
 .Dt GETRPCENT 3
 .Os
 .Sh NAME
@@ -19,7 +19,7 @@
 .Ft struct rpcent *
 .Fn getrpcent void
 .Ft struct rpcent *
-.Fn getrpcbyname "char *name"
+.Fn getrpcbyname "const char *name"
 .Ft struct rpcent *
 .Fn getrpcbynumber "int number"
 .Ft void

Modified: head/lib/libc/rpc/getrpcent.c
==
--- head/lib/libc/rpc/getrpcent.c   Fri Feb 26 23:12:59 2016
(r296132)
+++ head/lib/libc/rpc/getrpcent.c   Fri Feb 26 23:25:21 2016
(r296133)
@@ -969,7 +969,7 @@ getrpc(int (*fn)(union key, struct rpcen
 }
 
 struct rpcent *
-getrpcbyname(char *name)
+getrpcbyname(const char *name)
 {
union key key;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296132 - head/usr.sbin/pciconf

2016-02-26 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Feb 26 23:12:59 2016
New Revision: 296132
URL: https://svnweb.freebsd.org/changeset/base/296132

Log:
  pciconf: Silence a GCC warning.
  
  Fix the build on sparc64 and powerpc.
  
  Taken from:   wma

Modified:
  head/usr.sbin/pciconf/cap.c

Modified: head/usr.sbin/pciconf/cap.c
==
--- head/usr.sbin/pciconf/cap.c Fri Feb 26 22:25:35 2016(r296131)
+++ head/usr.sbin/pciconf/cap.c Fri Feb 26 23:12:59 2016(r296132)
@@ -535,7 +535,7 @@ cap_pciaf(int fd, struct pci_conf *p, ui
 }
 
 static const char *
-ea_bei_to_name(uint8_t bei)
+ea_bei_to_name(int bei)
 {
static const char *barstr[] = {
"BAR0", "BAR1", "BAR2", "BAR3", "BAR4", "BAR5"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296109 - head/libexec/rlogind

2016-02-26 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Feb 26 20:02:01 2016
New Revision: 296109
URL: https://svnweb.freebsd.org/changeset/base/296109

Log:
  rlogin(1): Replace select(2) with poll(2).
  
  Obtanied from:NetBSD (CVS Rev. 1.27 - 1.28)

Modified:
  head/libexec/rlogind/rlogind.c

Modified: head/libexec/rlogind/rlogind.c
==
--- head/libexec/rlogind/rlogind.c  Fri Feb 26 19:49:04 2016
(r296108)
+++ head/libexec/rlogind/rlogind.c  Fri Feb 26 20:02:01 2016
(r296109)
@@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -350,34 +351,27 @@ protocol(int f, int p)
nfd = f + 1;
else
nfd = p + 1;
-   if (nfd > FD_SETSIZE) {
-   syslog(LOG_ERR, "select mask too small, increase FD_SETSIZE");
-   fatal(f, "internal error (select mask too small)", 0);
-   }
for (;;) {
-   fd_set ibits, obits, ebits, *omask;
+   struct pollfd set[2];
 
-   FD_ZERO();
-   FD_ZERO();
-   FD_ZERO();
-   omask = (fd_set *)NULL;
-   if (fcc) {
-   FD_SET(p, );
-   omask = 
-   } else
-   FD_SET(f, );
+   set[0].fd = p;
+   set[0].events = POLLPRI;
+   set[1].fd = f;
+   set[1].events = 0;
+   if (fcc)
+   set[0].events |= POLLOUT;
+   else
+   set[1].events |= POLLIN;
if (pcc >= 0) {
-   if (pcc) {
-   FD_SET(f, );
-   omask = 
-   } else
-   FD_SET(p, );
+   if (pcc)
+   set[1].events |= POLLOUT;
+   else
+   set[0].events |= POLLIN;
}
-   FD_SET(p, );
-   if ((n = select(nfd, , omask, , 0)) < 0) {
+   if ((n = poll(set, 2, INFTIM)) < 0) {
if (errno == EINTR)
continue;
-   fatal(f, "select", 1);
+   fatal(f, "poll", 1);
}
if (n == 0) {
/* shouldn't happen... */
@@ -385,18 +379,16 @@ protocol(int f, int p)
continue;
}
 #definepkcontrol(c)
((c)&(TIOCPKT_FLUSHWRITE|TIOCPKT_NOSTOP|TIOCPKT_DOSTOP))
-   if (FD_ISSET(p, )) {
+   if (set[0].revents & POLLPRI) {
cc = read(p, , 1);
if (cc == 1 && pkcontrol(cntl)) {
cntl |= oobdata[0];
send(f, , 1, MSG_OOB);
-   if (cntl & TIOCPKT_FLUSHWRITE) {
+   if (cntl & TIOCPKT_FLUSHWRITE)
pcc = 0;
-   FD_CLR(p, );
-   }
}
}
-   if (FD_ISSET(f, )) {
+   if (set[1].revents & POLLIN) {
fcc = read(f, fibuf, sizeof(fibuf));
if (fcc < 0 && errno == EWOULDBLOCK)
fcc = 0;
@@ -422,11 +414,10 @@ protocol(int f, int p)
goto top; /* n^2 */
}
}
-   FD_SET(p, );  /* try write */
}
}
 
-   if (FD_ISSET(p, ) && fcc > 0) {
+   if (set[0].revents & POLLOUT && fcc > 0) {
cc = write(p, fbp, fcc);
if (cc > 0) {
fcc -= cc;
@@ -434,7 +425,7 @@ protocol(int f, int p)
}
}
 
-   if (FD_ISSET(p, )) {
+   if (set[0].revents & POLLIN) {
pcc = read(p, pibuf, sizeof (pibuf));
pbp = pibuf;
if (pcc < 0 && errno == EWOULDBLOCK)
@@ -443,7 +434,6 @@ protocol(int f, int p)
break;
else if (pibuf[0] == 0) {
pbp++, pcc--;
-   FD_SET(f, );  /* try write */
} else {
if (pkcontrol(pibuf[0])) {
pibuf[0] |= oobdata[0];
@@ -452,18 +442,8 @@ protocol(int f, int p)
pcc = 0;
}
}
-   if ((FD_ISSET(f, 

svn commit: r296107 - head/libexec/getty

2016-02-26 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Feb 26 19:35:51 2016
New Revision: 296107
URL: https://svnweb.freebsd.org/changeset/base/296107

Log:
  getty(8): Undo incomplete support VEOL2 and VSTATUS.
  
  Forgot to add some definitions for charnames[].

Modified:
  head/libexec/getty/subr.c

Modified: head/libexec/getty/subr.c
==
--- head/libexec/getty/subr.c   Fri Feb 26 19:08:37 2016(r296106)
+++ head/libexec/getty/subr.c   Fri Feb 26 19:35:51 2016(r296107)
@@ -212,8 +212,7 @@ charvars[] = {
_cc[VQUIT], _cc[VSTART], _cc[VSTOP],
_cc[VEOF], _cc[VEOL], _cc[VSUSP],
_cc[VDSUSP], _cc[VREPRINT], _cc[VDISCARD],
-   _cc[VWERASE], _cc[VLNEXT], _cc[VSTATUS],
-   _cc[VEOL2], 0
+   _cc[VWERASE], _cc[VLNEXT], 0
 };
 
 void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296106 - head/libexec/getty

2016-02-26 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Feb 26 19:08:37 2016
New Revision: 296106
URL: https://svnweb.freebsd.org/changeset/base/296106

Log:
  getty(8): Support VEOL2 and VSTATUS
  
  Bring some type cleanups while here.
  
  Obtained from:NetBSD

Modified:
  head/libexec/getty/subr.c

Modified: head/libexec/getty/subr.c
==
--- head/libexec/getty/subr.c   Fri Feb 26 18:54:26 2016(r296105)
+++ head/libexec/getty/subr.c   Fri Feb 26 19:08:37 2016(r296106)
@@ -73,7 +73,7 @@ gettable(const char *name, char *buf)
static int firsttime = 1;
 
dba[0] = _PATH_GETTYTAB;
-   dba[1] = 0;
+   dba[1] = NULL;
 
if (firsttime) {
/*
@@ -212,7 +212,8 @@ charvars[] = {
_cc[VQUIT], _cc[VSTART], _cc[VSTOP],
_cc[VEOF], _cc[VEOL], _cc[VSUSP],
_cc[VDSUSP], _cc[VREPRINT], _cc[VDISCARD],
-   _cc[VWERASE], _cc[VLNEXT], 0
+   _cc[VWERASE], _cc[VLNEXT], _cc[VSTATUS],
+   _cc[VEOL2], 0
 };
 
 void
@@ -595,7 +596,7 @@ struct  portselect {
{ "B4800",  "std.4800" },
{ "B9600",  "std.9600" },
{ "B19200", "std.19200" },
-   { 0 }
+   { NULL, NULL }
 };
 
 const char *
@@ -604,7 +605,7 @@ portselector(void)
char c, baud[20];
const char *type = "default";
struct portselect *ps;
-   int len;
+   size_t len;
 
alarm(5*60);
for (len = 0; len < sizeof (baud) - 1; len++) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296104 - head/libexec/getty

2016-02-26 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Feb 26 18:52:06 2016
New Revision: 296104
URL: https://svnweb.freebsd.org/changeset/base/296104

Log:
  getty(8): Use poll(2) and nanosleep(2) instead of select(2).
  
  Sort headers while here.
  
  Obtained from:NetBSD (CVS Rev. 1.25 - 1.26)

Modified:
  head/libexec/getty/subr.c

Modified: head/libexec/getty/subr.c
==
--- head/libexec/getty/subr.c   Fri Feb 26 16:18:47 2016(r296103)
+++ head/libexec/getty/subr.c   Fri Feb 26 18:52:06 2016(r296104)
@@ -38,14 +38,16 @@ static const char rcsid[] =
 /*
  * Melbourne getty.
  */
-#include 
-#include 
-#include 
-#include 
 #include 
 #include 
 #include 
+
+#include 
+#include 
+#include 
 #include 
+#include 
+#include 
 
 #include "gettytab.h"
 #include "pathnames.h"
@@ -633,24 +635,21 @@ portselector(void)
 const char *
 autobaud(void)
 {
-   int rfds;
-   struct timeval timeout;
+struct pollfd set[1];
+   struct timespec timeout;
char c;
const char *type = "9600-baud";
 
(void)tcflush(0, TCIOFLUSH);
-   rfds = 1 << 0;
-   timeout.tv_sec = 5;
-   timeout.tv_usec = 0;
-   if (select(32, (fd_set *), (fd_set *)NULL,
-   (fd_set *)NULL, ) <= 0)
+   set[0].fd = STDIN_FILENO;
+   set[0].events = POLLIN;
+   if (poll(set, 1, 5000) <= 0)
return (type);
if (read(STDIN_FILENO, , sizeof(char)) != sizeof(char))
return (type);
timeout.tv_sec = 0;
-   timeout.tv_usec = 20;
-   (void) select(32, (fd_set *)NULL, (fd_set *)NULL,
-   (fd_set *)NULL, );
+   timeout.tv_nsec = 2;
+   (void)nanosleep(, NULL);
(void)tcflush(0, TCIOFLUSH);
switch (c & 0377) {
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296095 - head/lib/libc/rpc

2016-02-26 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Feb 26 14:39:39 2016
New Revision: 296095
URL: https://svnweb.freebsd.org/changeset/base/296095

Log:
  rpc: fix failure to clear string by passing the wrong size to memset.
  
  Noted by NetBSD's PR/21014
  
  Obtained from:NetBSD (CVS Rev. 1.24, 1.25)
  MFC after:1 month

Modified:
  head/lib/libc/rpc/svc_simple.c

Modified: head/lib/libc/rpc/svc_simple.c
==
--- head/lib/libc/rpc/svc_simple.c  Fri Feb 26 14:04:00 2016
(r296094)
+++ head/lib/libc/rpc/svc_simple.c  Fri Feb 26 14:39:39 2016
(r296095)
@@ -272,7 +272,7 @@ universal(struct svc_req *rqstp, SVCXPRT
/* decode arguments into a CLEAN buffer */
xdrbuf = pl->p_xdrbuf;
/* Zero the arguments: reqd ! */
-   (void) memset(xdrbuf, 0, sizeof (pl->p_recvsz));
+   (void) memset(xdrbuf, 0, (size_t)pl->p_recvsz);
/*
 * Assuming that sizeof (xdrbuf) would be enough
 * for the arguments; if not then the program
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296054 - head/usr.bin/talk

2016-02-25 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Feb 25 19:06:44 2016
New Revision: 296054
URL: https://svnweb.freebsd.org/changeset/base/296054

Log:
  talk(1): Replace select(2) with poll(2)
  
  Hinted by:OpenBSD and NetBSD

Modified:
  head/usr.bin/talk/ctl_transact.c
  head/usr.bin/talk/io.c

Modified: head/usr.bin/talk/ctl_transact.c
==
--- head/usr.bin/talk/ctl_transact.cThu Feb 25 18:49:48 2016
(r296053)
+++ head/usr.bin/talk/ctl_transact.cThu Feb 25 19:06:44 2016
(r296054)
@@ -38,6 +38,7 @@ static const char sccsid[] = "@(#)ctl_tr
 #include 
 
 #include 
+#include 
 
 #include "talk.h"
 #include "talk_ctl.h"
@@ -52,23 +53,20 @@ static const char sccsid[] = "@(#)ctl_tr
 void
 ctl_transact(struct in_addr target, CTL_MSG lmsg, int type, CTL_RESPONSE *rp)
 {
-   fd_set read_mask, ctl_mask;
+   struct pollfd pfd[1];
int nready = 0, cc;
-   struct timeval wait;
 
lmsg.type = type;
daemon_addr.sin_addr = target;
daemon_addr.sin_port = daemon_port;
-   FD_ZERO(_mask);
-   FD_SET(ctl_sockt, _mask);
+   pfd[0].fd = ctl_sockt;
+   pfd[0].events = POLLIN;
 
/*
 * Keep sending the message until a response of
 * the proper type is obtained.
 */
do {
-   wait.tv_sec = CTL_WAIT;
-   wait.tv_usec = 0;
/* resend message until a response is obtained */
do {
cc = sendto(ctl_sockt, (char *), sizeof (lmsg), 0,
@@ -79,8 +77,7 @@ ctl_transact(struct in_addr target, CTL_
continue;
p_error("Error on write to talk daemon");
}
-   read_mask = ctl_mask;
-   nready = select(32, _mask, 0, 0, );
+   nready = poll(pfd, 1, CTL_WAIT * 1000);
if (nready < 0) {
if (errno == EINTR)
continue;
@@ -99,10 +96,7 @@ ctl_transact(struct in_addr target, CTL_
continue;
p_error("Error on read from talk daemon");
}
-   read_mask = ctl_mask;
-   /* an immediate poll */
-   timerclear();
-   nready = select(32, _mask, 0, 0, );
+   nready = poll(pfd, 1, 0);
} while (nready > 0 && (rp->vers != TALK_VERSION ||
rp->type != type));
} while (rp->vers != TALK_VERSION || rp->type != type);

Modified: head/usr.bin/talk/io.c
==
--- head/usr.bin/talk/io.c  Thu Feb 25 18:49:48 2016(r296053)
+++ head/usr.bin/talk/io.c  Thu Feb 25 19:06:44 2016(r296054)
@@ -46,6 +46,7 @@ static const char sccsid[] = "@(#)io.c8
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -67,8 +68,8 @@ void
 talk(void)
 {
struct hostent *hp, *hp2;
+   struct pollfd fds[2];
int nb;
-   fd_set read_set;
wchar_t buf[BUFSIZ];
char **addr, *his_machine_name;
FILE *sockfp;
@@ -107,10 +108,11 @@ talk(void)
 * Wait on both the other process (sockt) and standard input.
 */
for (;;) {
-   FD_ZERO(_set);
-   FD_SET(sockt, _set);
-   FD_SET(fileno(stdin), _set);
-   nb = select(32, _set, 0, 0, NULL);
+   fds[0].fd = fileno(stdin);
+   fds[0].events = POLLIN;
+   fds[1].fd = sockt;
+   fds[1].events = POLLIN;
+   nb = poll(fds, 2, INFTIM);
if (gotwinch) {
resize_display();
gotwinch = 0;
@@ -119,10 +121,10 @@ talk(void)
if (errno == EINTR)
continue;
/* Panic, we don't know what happened. */
-   p_error("Unexpected error from select");
+   p_error("Unexpected error from poll");
quit();
}
-   if (FD_ISSET(sockt, _set)) {
+   if (fds[1].revents & POLLIN) {
wint_t w;
 
/* There is data on sockt. */
@@ -133,7 +135,7 @@ talk(void)
}
display(_win, );
}
-   if (FD_ISSET(fileno(stdin), _set)) {
+   if (fds[0].revents & POLLIN) {
wint_t w;
 
if ((w = getwchar()) != WEOF) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail 

svn commit: r295975 - head/lib/libc/db/recno

2016-02-24 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Feb 24 17:14:11 2016
New Revision: 295975
URL: https://svnweb.freebsd.org/changeset/base/295975

Log:
  db(3): Fix aliasing warnings from modern GCC.
  
  While here also drop a malloc cast.
  
  Obtained from:NetBSD (CVS Rev. 1.18 - 1.20)

Modified:
  head/lib/libc/db/recno/rec_put.c

Modified: head/lib/libc/db/recno/rec_put.c
==
--- head/lib/libc/db/recno/rec_put.cWed Feb 24 17:10:32 2016
(r295974)
+++ head/lib/libc/db/recno/rec_put.cWed Feb 24 17:14:11 2016
(r295975)
@@ -140,8 +140,7 @@ einval: errno = EINVAL;
return (RET_ERROR);
if (nrec > t->bt_nrecs + 1) {
if (F_ISSET(t, R_FIXLEN)) {
-   if ((tdata.data =
-   (void *)malloc(t->bt_reclen)) == NULL)
+   if ((tdata.data = malloc(t->bt_reclen)) == NULL)
return (RET_ERROR);
tdata.size = t->bt_reclen;
memset(tdata.data, t->bt_bval, tdata.size);
@@ -208,7 +207,7 @@ __rec_iput(BTREE *t, recno_t nrec, const
return (RET_ERROR);
tdata.data = db;
tdata.size = NOVFLSIZE;
-   *(pgno_t *)db = pg;
+   memcpy(db, , sizeof(pg));
*(u_int32_t *)(db + sizeof(pgno_t)) = data->size;
dflags = P_BIGDATA;
data = 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295973 - head/lib/libc/db/btree

2016-02-24 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Feb 24 16:52:03 2016
New Revision: 295973
URL: https://svnweb.freebsd.org/changeset/base/295973

Log:
  db(3): Fix aliasing warnings from modern GCC.
  
  Obtained from:NetBSD (CVS Rev. 1.20)

Modified:
  head/lib/libc/db/btree/bt_split.c

Modified: head/lib/libc/db/btree/bt_split.c
==
--- head/lib/libc/db/btree/bt_split.c   Wed Feb 24 16:50:34 2016
(r295972)
+++ head/lib/libc/db/btree/bt_split.c   Wed Feb 24 16:52:03 2016
(r295973)
@@ -236,9 +236,12 @@ __bt_split(BTREE *t, PAGE *sp, const DBT
WR_BINTERNAL(dest, nksize ? nksize : bl->ksize,
rchild->pgno, bl->flags & P_BIGKEY);
memmove(dest, bl->bytes, nksize ? nksize : bl->ksize);
-   if (bl->flags & P_BIGKEY &&
-   bt_preserve(t, *(pgno_t *)bl->bytes) == RET_ERROR)
-   goto err1;
+   if (bl->flags & P_BIGKEY) {
+   pgno_t pgno;
+   memcpy(, bl->bytes, sizeof(pgno));
+   if (bt_preserve(t, pgno) == RET_ERROR)
+   goto err1;
+   }
break;
case P_RINTERNAL:
/*
@@ -544,9 +547,12 @@ bt_broot(BTREE *t, PAGE *h, PAGE *l, PAG
 * If the key is on an overflow page, mark the overflow chain
 * so it isn't deleted when the leaf copy of the key is deleted.
 */
-   if (bl->flags & P_BIGKEY &&
-   bt_preserve(t, *(pgno_t *)bl->bytes) == RET_ERROR)
-   return (RET_ERROR);
+   if (bl->flags & P_BIGKEY) {
+   pgno_t pgno;
+   memcpy(, bl->bytes, sizeof(pgno));
+   if (bt_preserve(t, pgno) == RET_ERROR)
+   return (RET_ERROR);
+   }
break;
case P_BINTERNAL:
bi = GETBINTERNAL(r, 0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295861 - head/sys/dev/pms/freebsd/driver/ini/src

2016-02-21 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Feb 21 16:45:22 2016
New Revision: 295861
URL: https://svnweb.freebsd.org/changeset/base/295861

Log:
  ostiInitiatorIOCompleted(): wrong sizeof() argument.
  
  Detected by:  PVS Static Analysis
  CID:  1331601, 1331523

Modified:
  head/sys/dev/pms/freebsd/driver/ini/src/osapi.c

Modified: head/sys/dev/pms/freebsd/driver/ini/src/osapi.c
==
--- head/sys/dev/pms/freebsd/driver/ini/src/osapi.c Sun Feb 21 16:27:55 
2016(r295860)
+++ head/sys/dev/pms/freebsd/driver/ini/src/osapi.c Sun Feb 21 16:45:22 
2016(r295861)
@@ -313,7 +313,7 @@ ostiInitiatorIOCompleted(tiRoot_t  *
   }
   sense_len = MIN( pSenseData->senseLen,
pccb->senseLen - csio->sense_resid );
-  bzero(>sense_data, sizeof(>sense_data));
+  bzero(>sense_data, sizeof(csio->sense_data));
   AGTIAPI_PRINTK("ostiInitiatorIOCompleted: check condition copying\n");
   memcpy( (void *)pccb->pSenseData,
   pSenseData->senseData,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295822 - head/sys/dev/qlxgb

2016-02-19 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Feb 19 18:05:02 2016
New Revision: 295822
URL: https://svnweb.freebsd.org/changeset/base/295822

Log:
  qlxgb: fix mismatch.
  
  Found by: PVS Static Analysis
  Reviewed by:  davidcs
  MFC after:1 month

Modified:
  head/sys/dev/qlxgb/qla_hw.c

Modified: head/sys/dev/qlxgb/qla_hw.c
==
--- head/sys/dev/qlxgb/qla_hw.c Fri Feb 19 17:34:11 2016(r295821)
+++ head/sys/dev/qlxgb/qla_hw.c Fri Feb 19 18:05:02 2016(r295822)
@@ -797,7 +797,8 @@ qla_tx_tso(qla_host_t *ha, struct mbuf *
}
 
if ((*tcp_opt != 0x01) || (*(tcp_opt + 1) != 0x01) ||
-   (*(tcp_opt + 2) != 0x08) || (*(tcp_opt + 2) != 
10)) {
+   (*(tcp_opt + 2) != 0x08) ||
+   (*(tcp_opt + 3) != 10)) {
return -1;
}
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295811 - head/sys/fs/ext2fs

2016-02-19 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Feb 19 15:53:08 2016
New Revision: 295811
URL: https://svnweb.freebsd.org/changeset/base/295811

Log:
  Ext2: cleanup setting of ctime/mtime/birthtime.
  
  This adopts the same change as r291936 for UFS.
  Directly clear IN_ACCESS or IN_UPDATE when user supplied the time, and
  copy the value into the inode.
  
  This keeps the behaviour cleaner and is consistent with UFS.
  
  Reviewed by:  bde
  MFC after:1 month (only 10)

Modified:
  head/sys/fs/ext2fs/ext2_vnops.c

Modified: head/sys/fs/ext2fs/ext2_vnops.c
==
--- head/sys/fs/ext2fs/ext2_vnops.c Fri Feb 19 15:35:20 2016
(r295810)
+++ head/sys/fs/ext2fs/ext2_vnops.c Fri Feb 19 15:53:08 2016
(r295811)
@@ -464,16 +464,14 @@ ext2_setattr(struct vop_setattr_args *ap
((vap->va_vaflags & VA_UTIMES_NULL) == 0 ||
(error = VOP_ACCESS(vp, VWRITE, cred, td
return (error);
-   if (vap->va_atime.tv_sec != VNOVAL)
-   ip->i_flag |= IN_ACCESS;
-   if (vap->va_mtime.tv_sec != VNOVAL)
-   ip->i_flag |= IN_CHANGE | IN_UPDATE;
-   ext2_itimes(vp);
+   ip->i_flag |= IN_CHANGE | IN_MODIFIED;
if (vap->va_atime.tv_sec != VNOVAL) {
+   ip->i_flag &= ~IN_ACCESS;
ip->i_atime = vap->va_atime.tv_sec;
ip->i_atimensec = vap->va_atime.tv_nsec;
}
if (vap->va_mtime.tv_sec != VNOVAL) {
+   ip->i_flag &= ~IN_UPDATE;
ip->i_mtime = vap->va_mtime.tv_sec;
ip->i_mtimensec = vap->va_mtime.tv_nsec;
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295810 - head/sys/dev/firewire

2016-02-19 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Feb 19 15:35:20 2016
New Revision: 295810
URL: https://svnweb.freebsd.org/changeset/base/295810

Log:
  firewire: fix a mismatch introduced in r230558.
  
  Found by: PVS Static Analysis
  Reviewed by:  sbruno
  MFC after:1 month

Modified:
  head/sys/dev/firewire/sbp_targ.c

Modified: head/sys/dev/firewire/sbp_targ.c
==
--- head/sys/dev/firewire/sbp_targ.cFri Feb 19 15:11:54 2016
(r295809)
+++ head/sys/dev/firewire/sbp_targ.cFri Feb 19 15:35:20 2016
(r295810)
@@ -1324,7 +1324,7 @@ sbp_targ_action1(struct cam_sim *sim, un
 | PIT_DISCONNECT
 | PIT_TERM_IO;
cpi->transport = XPORT_SPI; /* FIXME add XPORT_FW type to cam */
-   cpi->hba_misc = PIM_NOBUSRESET | PIM_NOBUSRESET;
+   cpi->hba_misc = PIM_NOBUSRESET | PIM_NO_6_BYTE;
cpi->hba_eng_cnt = 0;
cpi->max_target = 7; /* XXX */
cpi->max_lun = MAX_LUN - 1;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295675 - head/usr.bin/mail

2016-02-16 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Feb 16 21:39:19 2016
New Revision: 295675
URL: https://svnweb.freebsd.org/changeset/base/295675

Log:
  Fix naive use of ftell(3).
  
  Secure coding practices, FIO19-C.

Modified:
  head/usr.bin/mail/def.h

Modified: head/usr.bin/mail/def.h
==
--- head/usr.bin/mail/def.h Tue Feb 16 21:36:48 2016(r295674)
+++ head/usr.bin/mail/def.h Tue Feb 16 21:39:19 2016(r295675)
@@ -270,5 +270,5 @@ struct ignoretab {
  */
 #define trunc(stream) {
\
(void)fflush(stream);   \
-   (void)ftruncate(fileno(stream), (off_t)ftell(stream));  \
+   (void)ftruncate(fileno(stream), ftello(stream));\
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295672 - head/usr.sbin/cron/crontab

2016-02-16 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Feb 16 21:19:39 2016
New Revision: 295672
URL: https://svnweb.freebsd.org/changeset/base/295672

Log:
  crontab: ftruncate() with ftello() instead of ftell().
  
  Obtained from:OpenBSD (CVS rev. 1.47)

Modified:
  head/usr.sbin/cron/crontab/crontab.c

Modified: head/usr.sbin/cron/crontab/crontab.c
==
--- head/usr.sbin/cron/crontab/crontab.cTue Feb 16 20:59:49 2016
(r295671)
+++ head/usr.sbin/cron/crontab/crontab.cTue Feb 16 21:19:39 2016
(r295672)
@@ -532,7 +532,7 @@ replace_cmd() {
Set_LineNum(1)
while (EOF != (ch = get_char(NewCrontab)))
putc(ch, tmp);
-   ftruncate(fileno(tmp), ftell(tmp));
+   ftruncate(fileno(tmp), ftello(tmp));
fflush(tmp);  rewind(tmp);
 
if (ferror(tmp)) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295671 - head/usr.sbin/cron/cron

2016-02-16 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Feb 16 20:59:49 2016
New Revision: 295671
URL: https://svnweb.freebsd.org/changeset/base/295671

Log:
  cron: use (char *)NULL instead of (char *)0 in execle.
  
  Obtained from:OpenBSD (CVS Rev 1.25)

Modified:
  head/usr.sbin/cron/cron/do_command.c

Modified: head/usr.sbin/cron/cron/do_command.c
==
--- head/usr.sbin/cron/cron/do_command.cTue Feb 16 20:33:18 2016
(r295670)
+++ head/usr.sbin/cron/cron/do_command.cTue Feb 16 20:59:49 2016
(r295671)
@@ -337,8 +337,9 @@ child_process(e, u)
_exit(OK_EXIT);
}
 # endif /*DEBUGGING*/
-   execle(shell, shell, "-c", e->cmd, (char *)0, e->envp);
-   warn("execl: couldn't exec `%s'", shell);
+   execle(shell, shell, "-c", e->cmd, (char *)NULL,
+   e->envp);
+   warn("execle: couldn't exec `%s'", shell);
_exit(ERROR_EXIT);
}
break;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295638 - head/lib/libc/stdio

2016-02-15 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Feb 15 21:18:52 2016
New Revision: 295638
URL: https://svnweb.freebsd.org/changeset/base/295638

Log:
  fputs: Return the number of bytes written.
  
  Fix r295631: wrong value.
  
  Pointy hat:   pfg (me)
  Pointed out by:   bde

Modified:
  head/lib/libc/stdio/fputs.c

Modified: head/lib/libc/stdio/fputs.c
==
--- head/lib/libc/stdio/fputs.c Mon Feb 15 20:27:16 2016(r295637)
+++ head/lib/libc/stdio/fputs.c Mon Feb 15 21:18:52 2016(r295638)
@@ -64,6 +64,6 @@ fputs(const char * __restrict s, FILE * 
retval = __sfvwrite(fp, );
FUNLOCKFILE(fp);
if (retval == 0)
-   return (iov.iov_len > INT_MAX ? INT_MAX : uio.uio_resid);
+   return (iov.iov_len > INT_MAX ? INT_MAX : iov.iov_len);
return (retval);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295632 - head/lib/libc/stdio

2016-02-15 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Feb 15 18:14:21 2016
New Revision: 295632
URL: https://svnweb.freebsd.org/changeset/base/295632

Log:
  getln: We cannot expand the buffer beyond INT_MAX.
  
  In such cases return ENOMEM. This is a limitation of our
  implementation, alternatively you may consider getline(3).
  
  Differential Revision:https://reviews.freebsd.org/D442 (Partial)
  Obtained from:Apple Inc. (Libc 997.90.3)
  Relnotes: yes

Modified:
  head/lib/libc/stdio/fgetln.3
  head/lib/libc/stdio/fgetln.c

Modified: head/lib/libc/stdio/fgetln.3
==
--- head/lib/libc/stdio/fgetln.3Mon Feb 15 18:13:33 2016
(r295631)
+++ head/lib/libc/stdio/fgetln.3Mon Feb 15 18:14:21 2016
(r295632)
@@ -28,7 +28,7 @@
 .\" @(#)fgetln.3   8.3 (Berkeley) 4/19/94
 .\" $FreeBSD$
 .\"
-.Dd April 19, 1994
+.Dd February 15, 2016
 .Dt FGETLN 3
 .Os
 .Sh NAME
@@ -97,6 +97,9 @@ These changes are lost as soon as the po
 The argument
 .Fa stream
 is not a stream open for reading.
+.It Bq Er ENOMEM
+The internal line buffer could not be expanded due to lack of available memory,
+or because it would need to expand beyond INT_MAX in size.
 .El
 .Pp
 The

Modified: head/lib/libc/stdio/fgetln.c
==
--- head/lib/libc/stdio/fgetln.cMon Feb 15 18:13:33 2016
(r295631)
+++ head/lib/libc/stdio/fgetln.cMon Feb 15 18:14:21 2016
(r295632)
@@ -37,6 +37,8 @@ static char sccsid[] = "@(#)fgetln.c  8.2
 __FBSDID("$FreeBSD$");
 
 #include "namespace.h"
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -61,6 +63,10 @@ __slbexpand(FILE *fp, size_t newsize)
 #endif
if (fp->_lb._size >= newsize)
return (0);
+   if (newsize > INT_MAX) {
+   errno = ENOMEM;
+   return (-1);
+   }
if ((p = realloc(fp->_lb._base, newsize)) == NULL)
return (-1);
fp->_lb._base = p;
@@ -152,13 +158,14 @@ fgetln(FILE *fp, size_t *lenp)
}
*lenp = len;
 #ifdef notdef
-   fp->_lb._base[len] = 0;
+   fp->_lb._base[len] = '\0';
 #endif
FUNLOCKFILE(fp);
return ((char *)fp->_lb._base);
 
 error:
*lenp = 0;  /* ??? */
+   fp->_flags |= __SERR;
FUNLOCKFILE(fp);
return (NULL);  /* ??? */
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295631 - head/lib/libc/stdio

2016-02-15 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Feb 15 18:13:33 2016
New Revision: 295631
URL: https://svnweb.freebsd.org/changeset/base/295631

Log:
  fputs: Return the number of bytes written.
  
  POSIX.1-2008 requires that successful completion simply return a
  non-negative integer. We have regularly returned a constant value.
  Another, equally valid, implementation convention implies returning
  the number of bytes written.
  
  Adopt this last convention to be in line with what Apple's libc
  does. POSIX also explicitly notes:
  
  Note that this implementation convention cannot be adhered to for strings
  longer than {INT_MAX} bytes as the value would not be representable in the
  return type of the function. For backwards-compatibility, implementations
  can return the number of bytes for strings of up to {INT_MAX} bytes, and
  return {INT_MAX} for all longer strings.
  
  Developers shouldn't depend specifically on either convention but
  the change may help port software from Apple.
  
  Differential Revision:  https://reviews.freebsd.org/D442 (Partial)
  Obtained from:  Apple Inc. (Libc 997.90.3 with changes)
  Relnotes: yes

Modified:
  head/lib/libc/stdio/fputs.c

Modified: head/lib/libc/stdio/fputs.c
==
--- head/lib/libc/stdio/fputs.c Mon Feb 15 17:14:10 2016(r295630)
+++ head/lib/libc/stdio/fputs.c Mon Feb 15 18:13:33 2016(r295631)
@@ -37,6 +37,7 @@ static char sccsid[] = "@(#)fputs.c   8.1 
 __FBSDID("$FreeBSD$");
 
 #include "namespace.h"
+#include 
 #include 
 #include 
 #include "un-namespace.h"
@@ -62,5 +63,7 @@ fputs(const char * __restrict s, FILE * 
ORIENT(fp, -1);
retval = __sfvwrite(fp, );
FUNLOCKFILE(fp);
+   if (retval == 0)
+   return (iov.iov_len > INT_MAX ? INT_MAX : uio.uio_resid);
return (retval);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295616 - head/sys/fs/ext2fs

2016-02-14 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Feb 14 19:52:50 2016
New Revision: 295616
URL: https://svnweb.freebsd.org/changeset/base/295616

Log:
  ext2fs:   Remove panics for rename() race conditions.
  
  Sync with r84642 from UFS:
  
  The panics are inappropriate because the IN_RENAME flag only fixes a
  few of the huge number of race conditions that can result in the
  source path becoming invalid even prior to the VOP_RENAME() call.
  
  Found accidentally while checking an issue from PVS Static Analysis.
  
  MFC after:3 days

Modified:
  head/sys/fs/ext2fs/ext2_vnops.c

Modified: head/sys/fs/ext2fs/ext2_vnops.c
==
--- head/sys/fs/ext2fs/ext2_vnops.c Sun Feb 14 18:57:40 2016
(r295615)
+++ head/sys/fs/ext2fs/ext2_vnops.c Sun Feb 14 19:52:50 2016
(r295616)
@@ -985,10 +985,10 @@ abortit:
dp = VTOI(fdvp);
} else {
/*
-* From name has disappeared.
+* From name has disappeared.  IN_RENAME is not sufficient
+* to protect against directory races due to timing windows,
+* so we can't panic here.
 */
-   if (doingdirectory)
-   panic("ext2_rename: lost dir entry");
vrele(ap->a_fvp);
return (0);
}
@@ -1003,8 +1003,11 @@ abortit:
 * rename.
 */
if (xp != ip) {
-   if (doingdirectory)
-   panic("ext2_rename: lost dir entry");
+   /*
+* From name resolves to a different inode.  IN_RENAME is
+* not sufficient protection against timing window races
+* so we can't panic here.
+*/
} else {
/*
 * If the source is a directory with a
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295586 - head/sys/fs/cd9660

2016-02-12 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Feb 12 22:46:14 2016
New Revision: 295586
URL: https://svnweb.freebsd.org/changeset/base/295586

Log:
  cd9660: More "check for NULL" cleaunps.
  
  Cleanup some checks for NULL. Most of these were always unnecessary and
  starting with r294954 brelse() doesn't need any NULL checks at all.
  
  For now keep the checks somewhat consistent with NetBSD in case we want to
  merge the cleanups to older versions.

Modified:
  head/sys/fs/cd9660/cd9660_vfsops.c

Modified: head/sys/fs/cd9660/cd9660_vfsops.c
==
--- head/sys/fs/cd9660/cd9660_vfsops.c  Fri Feb 12 21:46:20 2016
(r295585)
+++ head/sys/fs/cd9660/cd9660_vfsops.c  Fri Feb 12 22:46:14 2016
(r295586)
@@ -309,13 +309,13 @@ iso_mountfs(devvp, mp)
default:
break;
}
-   if (bp) {
+   if (bp != NULL) {
brelse(bp);
bp = NULL;
}
}
  vd_end:
-   if (bp) {
+   if (bp != NULL) {
brelse(bp);
bp = NULL;
}
@@ -474,11 +474,11 @@ iso_mountfs(devvp, mp)
 
return 0;
 out:
-   if (bp)
+   if (bp != NULL)
brelse(bp);
-   if (pribp)
+   if (pribp != NULL)
brelse(pribp);
-   if (supbp)
+   if (supbp != NULL)
brelse(supbp);
if (cp != NULL) {
DROP_GIANT();
@@ -751,8 +751,7 @@ cd9660_vget_internal(mp, ino, flags, vpp
 #if 0
if (isonum_733(isodir->extent) +
isonum_711(isodir->ext_attr_length) != ifhp->ifid_start) {
-   if (bp != 0)
-   brelse(bp);
+   brelse(bp);
printf("fhtovp: file start miss %d vs %d\n",
   isonum_733(isodir->extent) + 
isonum_711(isodir->ext_attr_length),
   ifhp->ifid_start);
@@ -770,7 +769,7 @@ cd9660_vget_internal(mp, ino, flags, vpp
 * read the `.' entry out of a dir.
 */
ip->iso_start = ino >> imp->im_bshift;
-   if (bp != 0)
+   if (bp != NULL)
brelse(bp);
if ((error = cd9660_blkatoff(vp, (off_t)0, NULL, )) != 0) {
vput(vp);
@@ -809,8 +808,7 @@ cd9660_vget_internal(mp, ino, flags, vpp
break;
}
 
-   if (bp != 0)
-   brelse(bp);
+   brelse(bp);
 
/*
 * Initialize the associated vnode
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295523 - head/sys/fs/ext2fs

2016-02-11 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Feb 11 15:27:14 2016
New Revision: 295523
URL: https://svnweb.freebsd.org/changeset/base/295523

Log:
  Ext4: Use boolean type instead of '0' and '1'
  
  There are precedents of uses of bool in the kernel and
  it is incorrect style to use integers as replacement for
  a boolean type.

Modified:
  head/sys/fs/ext2fs/ext2_extents.c
  head/sys/fs/ext2fs/ext2_extents.h

Modified: head/sys/fs/ext2fs/ext2_extents.c
==
--- head/sys/fs/ext2fs/ext2_extents.c   Thu Feb 11 14:45:18 2016
(r295522)
+++ head/sys/fs/ext2fs/ext2_extents.c   Thu Feb 11 15:27:14 2016
(r295523)
@@ -43,7 +43,7 @@
 #include 
 #include 
 
-static int
+static bool
 ext4_ext_binsearch_index(struct inode *ip, struct ext4_extent_path *path,
daddr_t lbn, daddr_t *first_lbn, daddr_t *last_lbn)
 {
@@ -67,14 +67,14 @@ ext4_ext_binsearch_index(struct inode *i
path->ep_sparse_ext.e_len = first->ei_blk - *first_lbn;
path->ep_sparse_ext.e_start_hi = 0;
path->ep_sparse_ext.e_start_lo = 0;
-   path->ep_is_sparse = 1;
-   return (1);
+   path->ep_is_sparse = true;
+   return (true);
}
path->ep_index = l - 1;
*first_lbn = path->ep_index->ei_blk;
if (path->ep_index < last)
*last_lbn = l->ei_blk - 1;
-   return (0);
+   return (false);
 }
 
 static void
@@ -103,7 +103,7 @@ ext4_ext_binsearch(struct inode *ip, str
path->ep_sparse_ext.e_len = first->e_blk - first_lbn;
path->ep_sparse_ext.e_start_hi = 0;
path->ep_sparse_ext.e_start_lo = 0;
-   path->ep_is_sparse = 1;
+   path->ep_is_sparse = true;
return;
}
path->ep_ext = l - 1;
@@ -118,7 +118,7 @@ ext4_ext_binsearch(struct inode *ip, str
path->ep_sparse_ext.e_blk + 1;
path->ep_sparse_ext.e_start_hi = 0;
path->ep_sparse_ext.e_start_lo = 0;
-   path->ep_is_sparse = 1;
+   path->ep_is_sparse = true;
}
 }
 
@@ -213,7 +213,7 @@ ext4_ext_find_extent(struct m_ext2fs *fs
path->ep_depth = i;
path->ep_ext = NULL;
path->ep_index = NULL;
-   path->ep_is_sparse = 0;
+   path->ep_is_sparse = false;
 
ext4_ext_binsearch(ip, path, lbn, first_lbn, last_lbn);
return (path);

Modified: head/sys/fs/ext2fs/ext2_extents.h
==
--- head/sys/fs/ext2fs/ext2_extents.h   Thu Feb 11 14:45:18 2016
(r295522)
+++ head/sys/fs/ext2fs/ext2_extents.h   Thu Feb 11 15:27:14 2016
(r295523)
@@ -84,7 +84,7 @@ struct ext4_extent_cache {
 struct ext4_extent_path {
uint16_t ep_depth;
struct buf *ep_bp;
-   int ep_is_sparse;
+   bool ep_is_sparse;
union {
struct ext4_extent ep_sparse_ext;
struct ext4_extent *ep_ext;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295494 - head/sys/fs/ext2fs

2016-02-10 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Feb 11 00:34:11 2016
New Revision: 295494
URL: https://svnweb.freebsd.org/changeset/base/295494

Log:
  Ext4: fix handling of files with sparse blocks before extent's index.
  
  This is ongoing work from Damjan Jovanovic to improve ext4 read support
  with sparse files:
  
  Keep track of the first and last block in each extent as it descends down
  the extent tree, thus being able to work out that some blocks are sparse
  earlier. This solves an issue on r293680.
  
  In ext4_bmapext() start supporting the runb parameter, which appears to be
  the number of adjacent blocks prior to the block being converted in the
  same way that runp is the number of blocks after, speding up random access
  to mmaped files.
  
  PR:   206652

Modified:
  head/sys/fs/ext2fs/ext2_bmap.c
  head/sys/fs/ext2fs/ext2_extents.c

Modified: head/sys/fs/ext2fs/ext2_bmap.c
==
--- head/sys/fs/ext2fs/ext2_bmap.c  Thu Feb 11 00:30:51 2016
(r295493)
+++ head/sys/fs/ext2fs/ext2_bmap.c  Thu Feb 11 00:34:11 2016
(r295494)
@@ -114,6 +114,8 @@ ext4_bmapext(struct vnode *vp, int32_t b
if (runp != NULL)
*runp = path.ep_sparse_ext.e_len -
(lbn - path.ep_sparse_ext.e_blk) - 1;
+   if (runb != NULL)
+   *runb = lbn - path.ep_sparse_ext.e_blk;
} else {
ep = path.ep_ext;
if (ep == NULL)
@@ -127,6 +129,8 @@ ext4_bmapext(struct vnode *vp, int32_t b
 
if (runp != NULL)
*runp = ep->e_len - (lbn - ep->e_blk) - 1;
+   if (runb != NULL)
+   *runb = lbn - ep->e_blk;
}
}
 

Modified: head/sys/fs/ext2fs/ext2_extents.c
==
--- head/sys/fs/ext2fs/ext2_extents.c   Thu Feb 11 00:30:51 2016
(r295493)
+++ head/sys/fs/ext2fs/ext2_extents.c   Thu Feb 11 00:34:11 2016
(r295494)
@@ -43,14 +43,17 @@
 #include 
 #include 
 
-static void ext4_ext_binsearch_index(struct inode *ip, struct ext4_extent_path
-   *path, daddr_t lbn)
+static int
+ext4_ext_binsearch_index(struct inode *ip, struct ext4_extent_path *path,
+   daddr_t lbn, daddr_t *first_lbn, daddr_t *last_lbn)
 {
struct ext4_extent_header *ehp = path->ep_header;
-   struct ext4_extent_index *l, *r, *m;
+   struct ext4_extent_index *first, *last, *l, *r, *m;
 
-   l = (struct ext4_extent_index *)(char *)(ehp + 1);
-   r = (struct ext4_extent_index *)(char *)(ehp + 1) + ehp->eh_ecount - 1;
+   first = (struct ext4_extent_index *)(char *)(ehp + 1);
+   last = first + ehp->eh_ecount - 1;
+   l = first;
+   r = last;
while (l <= r) {
m = l + (r - l) / 2;
if (lbn < m->ei_blk)
@@ -59,11 +62,24 @@ static void ext4_ext_binsearch_index(str
l = m + 1;
}
 
+   if (l == first) {
+   path->ep_sparse_ext.e_blk = *first_lbn;
+   path->ep_sparse_ext.e_len = first->ei_blk - *first_lbn;
+   path->ep_sparse_ext.e_start_hi = 0;
+   path->ep_sparse_ext.e_start_lo = 0;
+   path->ep_is_sparse = 1;
+   return (1);
+   }
path->ep_index = l - 1;
+   *first_lbn = path->ep_index->ei_blk;
+   if (path->ep_index < last)
+   *last_lbn = l->ei_blk - 1;
+   return (0);
 }
 
 static void
-ext4_ext_binsearch(struct inode *ip, struct ext4_extent_path *path, daddr_t 
lbn)
+ext4_ext_binsearch(struct inode *ip, struct ext4_extent_path *path, daddr_t 
lbn,
+   daddr_t first_lbn, daddr_t last_lbn)
 {
struct ext4_extent_header *ehp = path->ep_header;
struct ext4_extent *first, *l, *r, *m;
@@ -83,8 +99,8 @@ ext4_ext_binsearch(struct inode *ip, str
}
 
if (l == first) {
-   path->ep_sparse_ext.e_blk = lbn;
-   path->ep_sparse_ext.e_len = first->e_blk - lbn;
+   path->ep_sparse_ext.e_blk = first_lbn;
+   path->ep_sparse_ext.e_len = first->e_blk - first_lbn;
path->ep_sparse_ext.e_start_hi = 0;
path->ep_sparse_ext.e_start_lo = 0;
path->ep_is_sparse = 1;
@@ -92,11 +108,14 @@ ext4_ext_binsearch(struct inode *ip, str
}
path->ep_ext = l - 1;
if (path->ep_ext->e_blk + path->ep_ext->e_len <= lbn) {
-   path->ep_sparse_ext.e_blk = lbn;
+   path->ep_sparse_ext.e_blk = path->ep_ext->e_blk +
+   path->ep_ext->e_len;
if (l <= (first + ehp->eh_ecount - 1))
-   path->ep_sparse_ext.e_len = l->e_blk - lbn;
-   else// XXX: where does it end?
-   path->ep_sparse_ext.e_len = 1;
+ 

svn commit: r295409 - head/sys/boot/ficl

2016-02-08 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Feb  8 19:45:55 2016
New Revision: 295409
URL: https://svnweb.freebsd.org/changeset/base/295409

Log:
  ficl: Replace rand(3) with random(3).
  
  While the later is a better random generator than the former, the main
  reason of the change is that random() has a better chance to work with
  libstand(3).
  
  At this time we don't include random number generators in bootforth
  so this has no effect.

Modified:
  head/sys/boot/ficl/words.c

Modified: head/sys/boot/ficl/words.c
==
--- head/sys/boot/ficl/words.c  Mon Feb  8 19:34:17 2016(r295408)
+++ head/sys/boot/ficl/words.c  Mon Feb  8 19:45:55 2016(r295409)
@@ -4822,7 +4822,7 @@ WORDKIND ficlWordClassify(FICL_WORD *pFW
 **/
 static void ficlRandom(FICL_VM *pVM)
 {
-PUSHINT(rand());
+PUSHINT(random());
 }
 
 
@@ -4832,7 +4832,7 @@ static void ficlRandom(FICL_VM *pVM)
 **/
 static void ficlSeedRandom(FICL_VM *pVM)
 {
-srand(POPINT());
+srandom(POPUNS());
 }
 #endif
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295410 - head/sys/boot/ficl

2016-02-08 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Feb  8 20:03:14 2016
New Revision: 295410
URL: https://svnweb.freebsd.org/changeset/base/295410

Log:
  ficl: Replace rand(3) with random(3).
  
  Be a little more consistent with random(3) and push an
  unsigned value.
  
  Again, this has no effect as this code doesn't get compiled
  for the boot code.

Modified:
  head/sys/boot/ficl/words.c

Modified: head/sys/boot/ficl/words.c
==
--- head/sys/boot/ficl/words.c  Mon Feb  8 19:45:55 2016(r295409)
+++ head/sys/boot/ficl/words.c  Mon Feb  8 20:03:14 2016(r295410)
@@ -4822,7 +4822,7 @@ WORDKIND ficlWordClassify(FICL_WORD *pFW
 **/
 static void ficlRandom(FICL_VM *pVM)
 {
-PUSHINT(random());
+PUSHUNS(random());
 }
 
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295372 - head/sys/kern

2016-02-07 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Feb  7 16:18:12 2016
New Revision: 295372
URL: https://svnweb.freebsd.org/changeset/base/295372

Log:
  Minor grammar fix in comment.

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Sun Feb  7 15:40:01 2016(r295371)
+++ head/sys/kern/vfs_bio.c Sun Feb  7 16:18:12 2016(r295372)
@@ -2245,7 +2245,7 @@ brelse(struct buf *bp)
int qindex;
 
/*
-* Many function erroneously call brelse with a NULL bp under rare
+* Many functions erroneously call brelse with a NULL bp under rare
 * error conditions. Simply return when called with a NULL bp.
 */
if (bp == NULL)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295369 - head/lib/libedit

2016-02-07 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Feb  7 15:26:21 2016
New Revision: 295369
URL: https://svnweb.freebsd.org/changeset/base/295369

Log:
  MFV r295360
  Sync our libedit with NetBSD's libedit 2016-01-16
  
  Obtained from:NetBSD

Modified:
  head/lib/libedit/editline.3
  head/lib/libedit/el.c
  head/lib/libedit/hist.h
  head/lib/libedit/keymacro.h
  head/lib/libedit/search.c
  head/lib/libedit/tokenizer.c
  head/lib/libedit/tty.c
Directory Properties:
  head/lib/libedit/   (props changed)
  head/lib/libedit/edit/readline/   (props changed)

Modified: head/lib/libedit/editline.3
==
--- head/lib/libedit/editline.3 Sun Feb  7 13:33:18 2016(r295368)
+++ head/lib/libedit/editline.3 Sun Feb  7 15:26:21 2016(r295369)
@@ -1,4 +1,4 @@
-.\"$NetBSD: editline.3,v 1.84 2014/12/25 13:39:41 wiz Exp $
+.\"$NetBSD: editline.3,v 1.85 2015/11/03 21:36:59 christos Exp $
 .\"
 .\" Copyright (c) 1997-2014 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 25, 2014
+.Dd November 3, 2015
 .Dt EDITLINE 3
 .Os
 .Sh NAME
@@ -191,7 +191,7 @@ counterparts.
 The following functions are available:
 .Bl -tag -width 4n
 .It Fn el_init
-Initialise the line editor, and return a data structure
+Initialize the line editor, and return a data structure
 to be used by all other line editing functions, or
 .Dv NULL
 on failure.
@@ -521,61 +521,68 @@ are supported, along with actual type of
 .Fa result :
 .Bl -tag -width 4n
 .It Dv EL_PROMPT , Fa "char *(*f)(EditLine *)" , Fa "char *c"
-Return a pointer to the function that displays the prompt in
+Set
 .Fa f .
+to a pointer to the function that displays the prompt.
 If
 .Fa c
 is not
 .Dv NULL ,
-return the start/stop literal prompt character in it.
+set it to the start/stop literal prompt character.
 .It Dv EL_RPROMPT , Fa "char *(*f)(EditLine *)" , Fa "char *c"
-Return a pointer to the function that displays the prompt in
+Set
 .Fa f .
+to a pointer to the function that displays the prompt.
 If
 .Fa c
 is not
 .Dv NULL ,
-return the start/stop literal prompt character in it.
-.It Dv EL_EDITOR , Fa "const char **"
-Return the name of the editor, which will be one of
+set it to the start/stop literal prompt character.
+.It Dv EL_EDITOR , Fa "const char **n"
+Set the name of the editor in
+.Fa n ,
+which will be one of
 .Dq emacs
 or
 .Dq vi .
 .It Dv EL_GETTC , Fa "const char *name" , Fa "void *value"
-Return non-zero if
+If
 .Fa name
 is a valid
 .Xr termcap 5
-capability
-and set
+capability set
 .Fa value
 to the current value of that capability.
-.It Dv EL_SIGNAL , Fa "int *"
-Return non-zero if
+.It Dv EL_SIGNAL , Fa "int *s"
+Set
+.Fa s
+to non zero if
 .Nm
 has installed private signal handlers (see
 .Fn el_get
 above).
-.It Dv EL_EDITMODE , Fa "int *"
-Return non-zero if editing is enabled.
+.It Dv EL_EDITMODE , Fa "int *c"
+Set
+.Fa c
+to non-zero if editing is enabled.
 .It Dv EL_GETCFN , Fa "int (**f)(EditLine *, char *)"
 Return a pointer to the function that read characters, which is equal to
 .Dq Dv EL_BUILTIN_GETCFN
 in the case of the default builtin function.
 .It Dv EL_CLIENTDATA , Fa "void **data"
-Retrieve
+Set
 .Fa data
-previously registered with the corresponding
+to the previously registered client data set by an
 .Fn el_set
 call.
-.It Dv EL_UNBUFFERED , Fa "int"
-Return non-zero if unbuffered mode is enabled.
-.It Dv EL_PREP_TERM , Fa "int"
-Sets or clears terminal editing mode.
+.It Dv EL_UNBUFFERED , Fa "int *c"
+Set
+.Fa c
+to non-zero if unbuffered mode is enabled.
 .It Dv EL_GETFP , Fa "int fd", Fa "FILE **fp"
-Return in
+Set
 .Fa fp
-the current
+to the current
 .Nm editline
 file pointer for
 .Dq input
@@ -593,7 +600,7 @@ or
 .Dv 2 .
 .El
 .It Fn el_source
-Initialise
+Initialize
 .Nm
 by reading the contents of
 .Fa file .
@@ -671,7 +678,7 @@ and freed by
 The following functions are available:
 .Bl -tag -width 4n
 .It Fn history_init
-Initialise the history list, and return a data structure
+Initialize the history list, and return a data structure
 to be used by all other history list functions, or
 .Dv NULL
 on failure.
@@ -810,7 +817,7 @@ and freed by
 The following functions are available:
 .Bl -tag -width 4n
 .It Fn tok_init
-Initialise the tokenizer, and return a data structure
+Initialize the tokenizer, and return a data structure
 to be used by all other tokenizer functions.
 .Fa IFS
 contains the Input Field Separators, which defaults to

Modified: head/lib/libedit/el.c
==
--- head/lib/libedit/el.c   Sun Feb  7 13:33:18 2016(r295368)
+++ head/lib/libedit/el.c   Sun Feb  7 15:26:21 2016(r295369)
@@ -1,4 +1,4 @@
-/* $NetBSD: el.c,v 1.73 2014/06/18 18:12:28 christos Exp $ */
+/* $NetBSD: el.c,v 1.74 2015/12/08 12:56:55 christos Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 

svn commit: r295371 - head/sys/fs/fdescfs

2016-02-07 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Feb  7 15:40:01 2016
New Revision: 295371
URL: https://svnweb.freebsd.org/changeset/base/295371

Log:
  Revert r295359:
  CID 1018688 is a false positive.
  
  The initialization is done by calling vn_start_write(... , flags).
  mp is only an output parameter unless (flags & V_MNTREF), and fdesc
  doesn't put V_MNTREF in flags.
  
  Pointed out by:   bde

Modified:
  head/sys/fs/fdescfs/fdesc_vnops.c

Modified: head/sys/fs/fdescfs/fdesc_vnops.c
==
--- head/sys/fs/fdescfs/fdesc_vnops.c   Sun Feb  7 15:36:16 2016
(r295370)
+++ head/sys/fs/fdescfs/fdesc_vnops.c   Sun Feb  7 15:40:01 2016
(r295371)
@@ -465,7 +465,7 @@ fdesc_setattr(ap)
 {
struct vattr *vap = ap->a_vap;
struct vnode *vp;
-   struct mount *mp = NULL;
+   struct mount *mp;
struct file *fp;
struct thread *td = curthread;
cap_rights_t rights;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295370 - head/sys/fs/msdosfs

2016-02-07 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Feb  7 15:36:16 2016
New Revision: 295370
URL: https://svnweb.freebsd.org/changeset/base/295370

Log:
  msdosfs_rename: yet another unused value.
  
  As with r295355, it seems to be left over from a cleanup
  in r33548. The code is not in NetBSD either.
  
  Thanks to bde for checking out the history.

Modified:
  head/sys/fs/msdosfs/msdosfs_vnops.c

Modified: head/sys/fs/msdosfs/msdosfs_vnops.c
==
--- head/sys/fs/msdosfs/msdosfs_vnops.c Sun Feb  7 15:26:21 2016
(r295369)
+++ head/sys/fs/msdosfs/msdosfs_vnops.c Sun Feb  7 15:36:16 2016
(r295370)
@@ -941,13 +941,10 @@ msdosfs_rename(struct vop_rename_args *a
int error;
u_long cn, pcl;
daddr_t bn;
-   struct denode *fddep;   /* from file's parent directory  */
struct msdosfsmount *pmp;
struct direntry *dotdotp;
struct buf *bp;
 
-   fddep = VTODE(ap->a_fdvp);
-
pmp = VFSTOMSDOSFS(fdvp->v_mount);
 
 #ifdef DIAGNOSTIC
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295355 - head/sys/fs/msdosfs

2016-02-06 Thread Pedro F. Giffuni
Author: pfg
Date: Sat Feb  6 21:54:02 2016
New Revision: 295355
URL: https://svnweb.freebsd.org/changeset/base/295355

Log:
  msdosfs_rename: Unused value
  
  Assigned value to pmp, is immediatedly overwritten before it can be used.
  
  CID:  1304892

Modified:
  head/sys/fs/msdosfs/msdosfs_vnops.c

Modified: head/sys/fs/msdosfs/msdosfs_vnops.c
==
--- head/sys/fs/msdosfs/msdosfs_vnops.c Sat Feb  6 17:10:46 2016
(r295354)
+++ head/sys/fs/msdosfs/msdosfs_vnops.c Sat Feb  6 21:54:02 2016
(r295355)
@@ -947,7 +947,6 @@ msdosfs_rename(struct vop_rename_args *a
struct buf *bp;
 
fddep = VTODE(ap->a_fdvp);
-   pmp = fddep->de_pmp;
 
pmp = VFSTOMSDOSFS(fdvp->v_mount);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295359 - head/sys/fs/fdescfs

2016-02-06 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Feb  7 01:09:38 2016
New Revision: 295359
URL: https://svnweb.freebsd.org/changeset/base/295359

Log:
  fdesc_setattr: unitialized pointer read
  
  CID:  1018688

Modified:
  head/sys/fs/fdescfs/fdesc_vnops.c

Modified: head/sys/fs/fdescfs/fdesc_vnops.c
==
--- head/sys/fs/fdescfs/fdesc_vnops.c   Sun Feb  7 01:04:47 2016
(r295358)
+++ head/sys/fs/fdescfs/fdesc_vnops.c   Sun Feb  7 01:09:38 2016
(r295359)
@@ -465,7 +465,7 @@ fdesc_setattr(ap)
 {
struct vattr *vap = ap->a_vap;
struct vnode *vp;
-   struct mount *mp;
+   struct mount *mp = NULL;
struct file *fp;
struct thread *td = curthread;
cap_rights_t rights;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295362 - head/sys/fs/cd9660

2016-02-06 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Feb  7 03:48:40 2016
New Revision: 295362
URL: https://svnweb.freebsd.org/changeset/base/295362

Log:
  cd9660: Drop an unnecessary check for NULL.
  
  This was unnecessary and also confused Coverity.
  
  Confirmed on: NetBSD
  CID:  978558

Modified:
  head/sys/fs/cd9660/cd9660_vfsops.c

Modified: head/sys/fs/cd9660/cd9660_vfsops.c
==
--- head/sys/fs/cd9660/cd9660_vfsops.c  Sun Feb  7 01:45:24 2016
(r295361)
+++ head/sys/fs/cd9660/cd9660_vfsops.c  Sun Feb  7 03:48:40 2016
(r295362)
@@ -741,8 +741,7 @@ cd9660_vget_internal(mp, ino, flags, vpp
if (off + isonum_711(isodir->length) >
imp->logical_block_size) {
vput(vp);
-   if (bp != 0)
-   brelse(bp);
+   brelse(bp);
printf("fhtovp: directory crosses block boundary 
%d[off=%d/len=%d]\n",
   off +isonum_711(isodir->length), off,
   isonum_711(isodir->length));
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295209 - head/sys/fs/ext2fs

2016-02-03 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Feb  3 14:31:23 2016
New Revision: 295209
URL: https://svnweb.freebsd.org/changeset/base/295209

Log:
  Revert r294695:
  ext2fs: passthrough any extra timestamps to the dinode struct.
  
  While it passed the classic testing, the change appears to have
  caused some regression and still requires some more precautions.
  
  PR:   206820
  MFC after:3 days

Modified:
  head/sys/fs/ext2fs/ext2_inode_cnv.c

Modified: head/sys/fs/ext2fs/ext2_inode_cnv.c
==
--- head/sys/fs/ext2fs/ext2_inode_cnv.c Wed Feb  3 14:04:07 2016
(r295208)
+++ head/sys/fs/ext2fs/ext2_inode_cnv.c Wed Feb  3 14:31:23 2016
(r295209)
@@ -149,11 +149,13 @@ ext2_i2ei(struct inode *ip, struct ext2f
ei->e2di_atime = ip->i_atime;
ei->e2di_mtime = ip->i_mtime;
ei->e2di_ctime = ip->i_ctime;
-   ei->e2di_ctime_extra = NSEC_TO_XTIME(ip->i_ctimensec);
-   ei->e2di_mtime_extra = NSEC_TO_XTIME(ip->i_mtimensec);
-   ei->e2di_atime_extra = NSEC_TO_XTIME(ip->i_atimensec);
-   ei->e2di_crtime = ip->i_birthtime;
-   ei->e2di_crtime_extra = NSEC_TO_XTIME(ip->i_birthnsec);
+   if (E2DI_HAS_XTIME(ip)) {
+   ei->e2di_ctime_extra = NSEC_TO_XTIME(ip->i_ctimensec);
+   ei->e2di_mtime_extra = NSEC_TO_XTIME(ip->i_mtimensec);
+   ei->e2di_atime_extra = NSEC_TO_XTIME(ip->i_atimensec);
+   ei->e2di_crtime = ip->i_birthtime;
+   ei->e2di_crtime_extra = NSEC_TO_XTIME(ip->i_birthnsec);
+   }
ei->e2di_flags = 0;
ei->e2di_flags |= (ip->i_flags & SF_APPEND) ? EXT2_APPEND: 0;
ei->e2di_flags |= (ip->i_flags & SF_IMMUTABLE) ? EXT2_IMMUTABLE: 0;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r295165 - head/contrib/openresolv

2016-02-02 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Feb  2 21:10:43 2016
New Revision: 295165
URL: https://svnweb.freebsd.org/changeset/base/295165

Log:
  MFV r295109:
  Update openresolve to version 3.7.2
  
  Relnotes: yes

Modified:
  head/contrib/openresolv/Makefile
  head/contrib/openresolv/resolvconf.8.in
  head/contrib/openresolv/resolvconf.conf.5.in
  head/contrib/openresolv/resolvconf.in
  head/contrib/openresolv/unbound.in
Directory Properties:
  head/contrib/openresolv/   (props changed)

Modified: head/contrib/openresolv/Makefile
==
--- head/contrib/openresolv/MakefileTue Feb  2 21:06:09 2016
(r295164)
+++ head/contrib/openresolv/MakefileTue Feb  2 21:10:43 2016
(r295165)
@@ -1,5 +1,5 @@
 PKG=   openresolv
-VERSION=   3.7.0
+VERSION=   3.7.1
 
 # Nasty hack so that make clean works without configure being run
 _CONFIG_MK!=   test -e config.mk && echo config.mk || echo config-null.mk
@@ -37,7 +37,7 @@ SED_RESTARTCMD=   -e 's:@RESTARTCMD \(.*\
 
 DISTPREFIX?=   ${PKG}-${VERSION}
 DISTFILEGZ?=   ${DISTPREFIX}.tar.gz
-DISTFILE?= ${DISTPREFIX}.tar.bz2
+DISTFILE?= ${DISTPREFIX}.tar.xz
 FOSSILID?= current
 
 .SUFFIXES: .in
@@ -77,9 +77,9 @@ install: proginstall maninstall
 import:
rm -rf /tmp/${DISTPREFIX}
${INSTALL} -d /tmp/${DISTPREFIX}
-   cp README ${SRCS} /tmp/${DISPREFIX}
+   cp README ${SRCS} /tmp/${DISTPREFIX}
 
 dist:
fossil tarball --name ${DISTPREFIX} ${FOSSILID} ${DISTFILEGZ}
-   gunzip -c ${DISTFILEGZ} |  bzip2 >${DISTFILE}
+   gunzip -c ${DISTFILEGZ} | xz >${DISTFILE}
rm ${DISTFILEGZ}

Modified: head/contrib/openresolv/resolvconf.8.in
==
--- head/contrib/openresolv/resolvconf.8.in Tue Feb  2 21:06:09 2016
(r295164)
+++ head/contrib/openresolv/resolvconf.8.in Tue Feb  2 21:10:43 2016
(r295165)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd April 27, 2014
+.Dd April 27, 2015
 .Dt RESOLVCONF 8
 .Os
 .Sh NAME

Modified: head/contrib/openresolv/resolvconf.conf.5.in
==
--- head/contrib/openresolv/resolvconf.conf.5.inTue Feb  2 21:06:09 
2016(r295164)
+++ head/contrib/openresolv/resolvconf.conf.5.inTue Feb  2 21:10:43 
2016(r295165)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd March 20, 2015
+.Dd May 14, 2015
 .Dt RESOLVCONF.CONF 5
 .Os
 .Sh NAME
@@ -91,6 +91,11 @@ To remove a block, you can use 192.168.*
 These interfaces name servers will only be queried for the domains listed
 in their resolv.conf.
 Useful for VPN domains.
+Setting
+.Sy private_interfaces Ns ="*"
+will stop the forwarding of the root zone and allows the local resolver to
+recursively query the root servers directly.
+Requires a local nameserver other than libc.
 This is equivalent to the
 .Nm resolvconf -p
 option.
@@ -149,7 +154,7 @@ When set to /dev/null or NULL,
 .Sy resolv_conf_local_only
 is defaulted to NO,
 .Sy local_nameservers
-is unset unless overriden and only the information set in
+is unset unless overridden and only the information set in
 .Nm
 is written to
 .Sy resolv_conf .
@@ -271,7 +276,7 @@ Each subscriber attempts to automaticall
 distribution has been catered for.
 Also, users could equally want to use a different version from the one
 installed by default, such as bind8 and bind9.
-To accomodate this, the subscribers have these files in configurable
+To accommodate this, the subscribers have these files in configurable
 variables, documented below.
 .Pp
 .Bl -tag -width indent

Modified: head/contrib/openresolv/resolvconf.in
==
--- head/contrib/openresolv/resolvconf.in   Tue Feb  2 21:06:09 2016
(r295164)
+++ head/contrib/openresolv/resolvconf.in   Tue Feb  2 21:10:43 2016
(r295165)
@@ -50,7 +50,6 @@ elif [ -d "$SYSCONFDIR/resolvconf" ]; th
interface_order="$(cat "$SYSCONFDIR"/interface-order)"
fi
 fi
-TMPDIR="$VARDIR/tmp"
 IFACEDIR="$VARDIR/interfaces"
 METRICDIR="$VARDIR/metrics"
 PRIVATEDIR="$VARDIR/private"

Modified: head/contrib/openresolv/unbound.in
==
--- head/contrib/openresolv/unbound.in  Tue Feb  2 21:06:09 2016
(r295164)
+++ head/contrib/openresolv/unbound.in  Tue Feb  2 21:10:43 2016
(r295165)
@@ -45,7 +45,8 @@ for d in $DOMAINS; do
ns="${d#*:}"
case "$unbound_insecure" in
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
-   newconf="$newconf${NL}domain-insecure: \"$dn\""
+   newconf="$newconf${NL}server:$NL"
+  

svn commit: r294695 - head/sys/fs/ext2fs

2016-01-24 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Jan 24 23:24:47 2016
New Revision: 294695
URL: https://svnweb.freebsd.org/changeset/base/294695

Log:
  ext2fs: passthrough any extra timestamps to the dinode struct.
  
  In general we don't trust any of the extended timestamps unless the
  EXT2F_ROCOMPAT_EXTRA_ISIZE feature is set. However, in the case where
  we freshly allocated a new inode the information is valid and it is
  better to pass it along instead of leaving the value undefined.
  
  This should have no practical effect but should reduce the amount of
  garbage if EXT2F_ROCOMPAT_EXTRA_ISIZE is set, like in cases where the
  filesystem is converted from ext3 to ext4.
  
  MFC after:4 days

Modified:
  head/sys/fs/ext2fs/ext2_inode_cnv.c

Modified: head/sys/fs/ext2fs/ext2_inode_cnv.c
==
--- head/sys/fs/ext2fs/ext2_inode_cnv.c Sun Jan 24 22:31:34 2016
(r294694)
+++ head/sys/fs/ext2fs/ext2_inode_cnv.c Sun Jan 24 23:24:47 2016
(r294695)
@@ -149,13 +149,11 @@ ext2_i2ei(struct inode *ip, struct ext2f
ei->e2di_atime = ip->i_atime;
ei->e2di_mtime = ip->i_mtime;
ei->e2di_ctime = ip->i_ctime;
-   if (E2DI_HAS_XTIME(ip)) {
-   ei->e2di_ctime_extra = NSEC_TO_XTIME(ip->i_ctimensec);
-   ei->e2di_mtime_extra = NSEC_TO_XTIME(ip->i_mtimensec);
-   ei->e2di_atime_extra = NSEC_TO_XTIME(ip->i_atimensec);
-   ei->e2di_crtime = ip->i_birthtime;
-   ei->e2di_crtime_extra = NSEC_TO_XTIME(ip->i_birthnsec);
-   }
+   ei->e2di_ctime_extra = NSEC_TO_XTIME(ip->i_ctimensec);
+   ei->e2di_mtime_extra = NSEC_TO_XTIME(ip->i_mtimensec);
+   ei->e2di_atime_extra = NSEC_TO_XTIME(ip->i_atimensec);
+   ei->e2di_crtime = ip->i_birthtime;
+   ei->e2di_crtime_extra = NSEC_TO_XTIME(ip->i_birthnsec);
ei->e2di_flags = 0;
ei->e2di_flags |= (ip->i_flags & SF_APPEND) ? EXT2_APPEND: 0;
ei->e2di_flags |= (ip->i_flags & SF_IMMUTABLE) ? EXT2_IMMUTABLE: 0;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r294652 - head/sys/fs/ext2fs

2016-01-23 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Jan 24 02:25:41 2016
New Revision: 294652
URL: https://svnweb.freebsd.org/changeset/base/294652

Log:
  ext2: Initialize i_flag after allocation.
  
  We use i_flag to carry some flags like IN_E4INDEX which newer
  ext2fs variants uses internally.
  
  fsck.ext3 rightfully complains after our implementation tags
  non-directory inodes with INDEX_FL.
  
  Initializing i_flag during allocation removes the noise factor
  and quiets down fsck.
  
  Patch from:   Damjan Jovanovic
  PR:   206530

Modified:
  head/sys/fs/ext2fs/ext2_alloc.c

Modified: head/sys/fs/ext2fs/ext2_alloc.c
==
--- head/sys/fs/ext2fs/ext2_alloc.c Sun Jan 24 02:10:05 2016
(r294651)
+++ head/sys/fs/ext2fs/ext2_alloc.c Sun Jan 24 02:25:41 2016
(r294652)
@@ -393,6 +393,7 @@ ext2_valloc(struct vnode *pvp, int mode,
 * Linux doesn't read the old inode in when it is allocating a
 * new one. I will set at least i_size and i_blocks to zero.
 */
+   ip->i_flag = 0;
ip->i_size = 0;
ip->i_blocks = 0;
ip->i_mode = 0;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r294654 - head/sys/fs/ext2fs

2016-01-23 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Jan 24 02:44:00 2016
New Revision: 294654
URL: https://svnweb.freebsd.org/changeset/base/294654

Log:
  Fix comment.

Modified:
  head/sys/fs/ext2fs/ext2_dinode.h

Modified: head/sys/fs/ext2fs/ext2_dinode.h
==
--- head/sys/fs/ext2fs/ext2_dinode.hSun Jan 24 02:41:49 2016
(r294653)
+++ head/sys/fs/ext2fs/ext2_dinode.hSun Jan 24 02:44:00 2016
(r294654)
@@ -52,7 +52,7 @@
  * Inode flags
  * The system supports EXT2_IMMUTABLE, EXT2_APPEND and EXT2_NODUMP flags.
  * The current implementation also uses EXT3_INDEX, EXT4_EXTENTS and
- * EXT4_HUGE_FILE with some restrictions, imposed the lack of write
+ * EXT4_HUGE_FILE with some restrictions imposed by the lack of write
  * support.
  */
 #defineEXT2_SECRM  0x0001  /* Secure deletion */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r294653 - head/sys/fs/ext2fs

2016-01-23 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Jan 24 02:41:49 2016
New Revision: 294653
URL: https://svnweb.freebsd.org/changeset/base/294653

Log:
  Rename some directory index constants.
  
  Directory index was introduced in ext3. We don't always use the
  prefix to denote the ext2 variant they belong to but when we
  do we should try to be accurate.

Modified:
  head/sys/fs/ext2fs/ext2_dinode.h
  head/sys/fs/ext2fs/ext2_htree.c
  head/sys/fs/ext2fs/ext2_inode_cnv.c
  head/sys/fs/ext2fs/ext2_lookup.c

Modified: head/sys/fs/ext2fs/ext2_dinode.h
==
--- head/sys/fs/ext2fs/ext2_dinode.hSun Jan 24 02:25:41 2016
(r294652)
+++ head/sys/fs/ext2fs/ext2_dinode.hSun Jan 24 02:41:49 2016
(r294653)
@@ -51,7 +51,7 @@
 /*
  * Inode flags
  * The system supports EXT2_IMMUTABLE, EXT2_APPEND and EXT2_NODUMP flags.
- * The current implementation also uses EXT4_INDEX, EXT4_EXTENTS and
+ * The current implementation also uses EXT3_INDEX, EXT4_EXTENTS and
  * EXT4_HUGE_FILE with some restrictions, imposed the lack of write
  * support.
  */
@@ -63,7 +63,7 @@
 #defineEXT2_APPEND 0x0020 /* Writes to file may only 
append */
 #defineEXT2_NODUMP 0x0040  /* Do not dump file */
 #defineEXT2_NOATIME0x0080  /* Do not update atime 
*/
-#defineEXT4_INDEX  0x1000  /* Hash-indexed 
directory */
+#defineEXT3_INDEX  0x1000  /* Hash-indexed 
directory */
 #defineEXT4_IMAGIC 0x2000  /* AFS directory */
 #defineEXT4_JOURNAL_DATA   0x4000 /* File data should be 
journaled */
 #defineEXT4_NOTAIL 0x8000 /* File tail should not be 
merged */

Modified: head/sys/fs/ext2fs/ext2_htree.c
==
--- head/sys/fs/ext2fs/ext2_htree.c Sun Jan 24 02:25:41 2016
(r294652)
+++ head/sys/fs/ext2fs/ext2_htree.c Sun Jan 24 02:41:49 2016
(r294653)
@@ -90,7 +90,7 @@ int
 ext2_htree_has_idx(struct inode *ip)
 {
if (EXT2_HAS_COMPAT_FEATURE(ip->i_e2fs, EXT2F_COMPAT_DIRHASHINDEX) &&
-   ip->i_flag & IN_E4INDEX)
+   ip->i_flag & IN_E3INDEX)
return (1);
else
return (0);
@@ -653,7 +653,7 @@ ext2_htree_create_index(struct vnode *vp
((char *)ep + ep->e2d_reclen);
ep->e2d_reclen = buf1 + blksize - (char *)ep;
 
-   dp->i_flag |= IN_E4INDEX;
+   dp->i_flag |= IN_E3INDEX;
 
/*
 * Initialize index root.

Modified: head/sys/fs/ext2fs/ext2_inode_cnv.c
==
--- head/sys/fs/ext2fs/ext2_inode_cnv.c Sun Jan 24 02:25:41 2016
(r294652)
+++ head/sys/fs/ext2fs/ext2_inode_cnv.c Sun Jan 24 02:41:49 2016
(r294653)
@@ -110,7 +110,7 @@ ext2_ei2i(struct ext2fs_dinode *ei, stru
ip->i_flags |= (ei->e2di_flags & EXT2_APPEND) ? SF_APPEND : 0;
ip->i_flags |= (ei->e2di_flags & EXT2_IMMUTABLE) ? SF_IMMUTABLE : 0;
ip->i_flags |= (ei->e2di_flags & EXT2_NODUMP) ? UF_NODUMP : 0;
-   ip->i_flag |= (ei->e2di_flags & EXT4_INDEX) ? IN_E4INDEX : 0;
+   ip->i_flag |= (ei->e2di_flags & EXT3_INDEX) ? IN_E3INDEX : 0;
ip->i_flag |= (ei->e2di_flags & EXT4_EXTENTS) ? IN_E4EXTENTS : 0;
ip->i_blocks = ei->e2di_nblock;
if (E2DI_HAS_HUGE_FILE(ip)) {
@@ -160,7 +160,7 @@ ext2_i2ei(struct inode *ip, struct ext2f
ei->e2di_flags |= (ip->i_flags & SF_APPEND) ? EXT2_APPEND: 0;
ei->e2di_flags |= (ip->i_flags & SF_IMMUTABLE) ? EXT2_IMMUTABLE: 0;
ei->e2di_flags |= (ip->i_flags & UF_NODUMP) ? EXT2_NODUMP: 0;
-   ei->e2di_flags |= (ip->i_flag & IN_E4INDEX) ? EXT4_INDEX: 0;
+   ei->e2di_flags |= (ip->i_flag & IN_E3INDEX) ? EXT3_INDEX: 0;
ei->e2di_flags |= (ip->i_flag & IN_E4EXTENTS) ? EXT4_EXTENTS: 0;
ei->e2di_nblock = ip->i_blocks & 0x;
ei->e2di_nblock_high = ip->i_blocks >> 32 & 0x;

Modified: head/sys/fs/ext2fs/ext2_lookup.c
==
--- head/sys/fs/ext2fs/ext2_lookup.cSun Jan 24 02:25:41 2016
(r294652)
+++ head/sys/fs/ext2fs/ext2_lookup.cSun Jan 24 02:41:49 2016
(r294653)
@@ -888,7 +888,7 @@ ext2_direnter(struct inode *ip, struct v
if (ext2_htree_has_idx(dp)) {
error = ext2_htree_add_entry(dvp, , cnp);
if (error) {
-   dp->i_flag &= ~IN_E4INDEX;
+   dp->i_flag &= ~IN_E3INDEX;
dp->i_flag |= IN_CHANGE | IN_UPDATE;
}
return (error);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to 

svn commit: r294655 - head/sys/fs/ext2fs

2016-01-23 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Jan 24 04:30:30 2016
New Revision: 294655
URL: https://svnweb.freebsd.org/changeset/base/294655

Log:
  ext2: rename some directory index constants.
  
  Missed from r294653.
  
  Pointyhat:me

Modified:
  head/sys/fs/ext2fs/inode.h

Modified: head/sys/fs/ext2fs/inode.h
==
--- head/sys/fs/ext2fs/inode.h  Sun Jan 24 02:44:00 2016(r294654)
+++ head/sys/fs/ext2fs/inode.h  Sun Jan 24 04:30:30 2016(r294655)
@@ -157,7 +157,7 @@ struct inode {
  * These are translation flags for some attributes that Ext4
  * passes as inode flags but that we cannot pass directly.
  */
-#defineIN_E4INDEX  0x01
+#defineIN_E3INDEX  0x01
 #defineIN_E4EXTENTS0x02
 
 #define i_devvp i_ump->um_devvp
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r294504 - in head/sys: conf fs/ext2fs modules/ext2fs

2016-01-21 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Jan 21 14:50:28 2016
New Revision: 294504
URL: https://svnweb.freebsd.org/changeset/base/294504

Log:
  ext2fs: Bring back the htree dir_index implementation.
  
  The htree dir_index is perhaps one of the most characteristic
  features of the linux ext3 implementation. It was removed
  in r281670, due to repeated bug reports.
  
  Damjan Jovanic detected and fixed three bugs and did some
  stress testing by building Apache OpenOffice on top of it
  so it is now in good shape to bring back.
  
  Differential Revision:https://reviews.freebsd.org/D5007
  
  Submitted by: Damjan Jovanovic
  Reviewed by:  pfg
  Tested by:pho
  Relnotes: Yes
  MFC after:2 months (only 10.x)

Added:
  head/sys/fs/ext2fs/ext2_hash.c
 - copied unchanged from r281669, head/sys/fs/ext2fs/ext2_hash.c
  head/sys/fs/ext2fs/ext2_htree.c
 - copied, changed from r281669, head/sys/fs/ext2fs/ext2_htree.c
Modified:
  head/sys/conf/files
  head/sys/fs/ext2fs/ext2_dir.h
  head/sys/fs/ext2fs/ext2_extern.h
  head/sys/fs/ext2fs/ext2_lookup.c
  head/sys/fs/ext2fs/ext2_vfsops.c
  head/sys/fs/ext2fs/ext2fs.h
  head/sys/modules/ext2fs/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Thu Jan 21 14:11:01 2016(r294503)
+++ head/sys/conf/files Thu Jan 21 14:50:28 2016(r294504)
@@ -3114,6 +3114,8 @@ fs/ext2fs/ext2_bmap.c optional ext2fs
 fs/ext2fs/ext2_extents.c   optional ext2fs
 fs/ext2fs/ext2_inode.c optional ext2fs
 fs/ext2fs/ext2_inode_cnv.c optional ext2fs
+fs/ext2fs/ext2_hash.c  optional ext2fs
+fs/ext2fs/ext2_htree.c optional ext2fs
 fs/ext2fs/ext2_lookup.coptional ext2fs
 fs/ext2fs/ext2_subr.c  optional ext2fs
 fs/ext2fs/ext2_vfsops.coptional ext2fs

Modified: head/sys/fs/ext2fs/ext2_dir.h
==
--- head/sys/fs/ext2fs/ext2_dir.h   Thu Jan 21 14:11:01 2016
(r294503)
+++ head/sys/fs/ext2fs/ext2_dir.h   Thu Jan 21 14:50:28 2016
(r294504)
@@ -40,6 +40,21 @@ struct   ext2fs_direct {
uint16_t e2d_namlen;/* length of string in e2d_name */
char e2d_name[EXT2FS_MAXNAMLEN];/* name with length<=EXT2FS_MAXNAMLEN */
 };
+
+enum slotstatus {
+   NONE,
+   COMPACT,
+   FOUND
+};
+
+struct ext2fs_searchslot {
+   enum slotstatus slotstatus;
+   doff_t slotoffset;  /* offset of area with free space */
+   int slotsize;   /* size of area at slotoffset */
+   int slotfreespace;  /* amount of space free in slot */
+   int slotneeded; /* sizeof the entry we are seeking */
+};
+
 /*
  * The new version of the directory entry.  Since EXT2 structures are
  * stored in intel byte order, and the name_len field could never be

Modified: head/sys/fs/ext2fs/ext2_extern.h
==
--- head/sys/fs/ext2fs/ext2_extern.hThu Jan 21 14:11:01 2016
(r294503)
+++ head/sys/fs/ext2fs/ext2_extern.hThu Jan 21 14:50:28 2016
(r294504)
@@ -40,12 +40,15 @@
 #define_FS_EXT2FS_EXT2_EXTERN_H_
 
 struct ext2fs_dinode;
+struct ext2fs_direct_2;
+struct ext2fs_searchslot;
 struct indir;
 struct inode;
 struct mount;
 struct vfsconf;
 struct vnode;
 
+intext2_add_entry(struct vnode *, struct ext2fs_direct_2 *);
 intext2_alloc(struct inode *, daddr_t, e4fs_daddr_t, int,
struct ucred *, e4fs_daddr_t *);
 intext2_balloc(struct inode *,
@@ -83,6 +86,18 @@ int  ext2_dirempty(struct inode *, ino_t,
 intext2_checkpath(struct inode *, struct inode *, struct ucred *);
 intcg_has_sb(int i);
 intext2_inactive(struct vop_inactive_args *);
+intext2_htree_add_entry(struct vnode *, struct ext2fs_direct_2 *,
+   struct componentname *);
+intext2_htree_create_index(struct vnode *, struct componentname *,
+   struct ext2fs_direct_2 *);
+intext2_htree_has_idx(struct inode *);
+intext2_htree_hash(const char *, int, uint32_t *, int, uint32_t *,
+   uint32_t *);
+intext2_htree_lookup(struct inode *, const char *, int, struct buf **,
+   int *, doff_t *, doff_t *, doff_t *, struct ext2fs_searchslot *);
+intext2_search_dirblock(struct inode *, void *, int *, const char *, int,
+   int *, doff_t *, doff_t *, doff_t *, struct ext2fs_searchslot *);
+
 
 /* Flags to low-level allocation routines.
  * The low 16-bits are reserved for IO_ flags from vnode.h.

Copied: head/sys/fs/ext2fs/ext2_hash.c (from r281669, 
head/sys/fs/ext2fs/ext2_hash.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/fs/ext2fs/ext2_hash.c  Thu Jan 21 14:50:28 2016
(r294504, copy of r281669, 

svn commit: r293680 - head/sys/fs/ext2fs

2016-01-11 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Jan 11 19:14:55 2016
New Revision: 293680
URL: https://svnweb.freebsd.org/changeset/base/293680

Log:
  ext4: add support for reading sparse files
  
  Add support for sparse files in ext4. Also implement read-ahead, which
  greatly increases the performance when transferring files from ext4.
  
  Both features implemented by Damjan Jovanovic.
  
  PR:   205816
  MFC after:1 week

Modified:
  head/sys/fs/ext2fs/ext2_bmap.c
  head/sys/fs/ext2fs/ext2_extents.c
  head/sys/fs/ext2fs/ext2_extents.h
  head/sys/fs/ext2fs/ext2_vnops.c

Modified: head/sys/fs/ext2fs/ext2_bmap.c
==
--- head/sys/fs/ext2fs/ext2_bmap.c  Mon Jan 11 18:11:06 2016
(r293679)
+++ head/sys/fs/ext2fs/ext2_bmap.c  Mon Jan 11 19:14:55 2016
(r293680)
@@ -102,9 +102,6 @@ ext4_bmapext(struct vnode *vp, int32_t b
fs = ip->i_e2fs;
lbn = bn;
 
-   /*
-* TODO: need to implement read ahead to improve the performance.
-*/
if (runp != NULL)
*runp = 0;
 
@@ -112,15 +109,25 @@ ext4_bmapext(struct vnode *vp, int32_t b
*runb = 0;
 
ext4_ext_find_extent(fs, ip, lbn, );
-   ep = path.ep_ext;
-   if (ep == NULL)
-   ret = EIO;
-   else {
-   *bnp = fsbtodb(fs, lbn - ep->e_blk +
-   (ep->e_start_lo | (daddr_t)ep->e_start_hi << 32));
+   if (path.ep_is_sparse) {
+   *bnp = -1;
+   if (runp != NULL)
+   *runp = path.ep_sparse_ext.e_len -
+   (lbn - path.ep_sparse_ext.e_blk) - 1;
+   } else {
+   ep = path.ep_ext;
+   if (ep == NULL)
+   ret = EIO;
+   else {
+   *bnp = fsbtodb(fs, lbn - ep->e_blk +
+   (ep->e_start_lo | (daddr_t)ep->e_start_hi << 32));
 
-   if (*bnp == 0)
-   *bnp = -1;
+   if (*bnp == 0)
+   *bnp = -1;
+
+   if (runp != NULL)
+   *runp = ep->e_len - (lbn - ep->e_blk) - 1;
+   }
}
 
if (path.ep_bp != NULL) {

Modified: head/sys/fs/ext2fs/ext2_extents.c
==
--- head/sys/fs/ext2fs/ext2_extents.c   Mon Jan 11 18:11:06 2016
(r293679)
+++ head/sys/fs/ext2fs/ext2_extents.c   Mon Jan 11 19:14:55 2016
(r293680)
@@ -66,13 +66,14 @@ static void
 ext4_ext_binsearch(struct inode *ip, struct ext4_extent_path *path, daddr_t 
lbn)
 {
struct ext4_extent_header *ehp = path->ep_header;
-   struct ext4_extent *l, *r, *m;
+   struct ext4_extent *first, *l, *r, *m;
 
if (ehp->eh_ecount == 0)
return;
 
-   l = (struct ext4_extent *)(char *)(ehp + 1);
-   r = (struct ext4_extent *)(char *)(ehp + 1) + ehp->eh_ecount - 1;
+   first = (struct ext4_extent *)(char *)(ehp + 1);
+   l = first;
+   r = first + ehp->eh_ecount - 1;
while (l <= r) {
m = l + (r - l) / 2;
if (lbn < m->e_blk)
@@ -81,7 +82,25 @@ ext4_ext_binsearch(struct inode *ip, str
l = m + 1;
}
 
+   if (l == first) {
+   path->ep_sparse_ext.e_blk = lbn;
+   path->ep_sparse_ext.e_len = first->e_blk - lbn;
+   path->ep_sparse_ext.e_start_hi = 0;
+   path->ep_sparse_ext.e_start_lo = 0;
+   path->ep_is_sparse = 1;
+   return;
+   }
path->ep_ext = l - 1;
+   if (path->ep_ext->e_blk + path->ep_ext->e_len <= lbn) {
+   path->ep_sparse_ext.e_blk = lbn;
+   if (l <= (first + ehp->eh_ecount - 1))
+   path->ep_sparse_ext.e_len = l->e_blk - lbn;
+   else// XXX: where does it end?
+   path->ep_sparse_ext.e_len = 1;
+   path->ep_sparse_ext.e_start_hi = 0;
+   path->ep_sparse_ext.e_start_lo = 0;
+   path->ep_is_sparse = 1;
+   }
 }
 
 /*
@@ -169,6 +188,7 @@ ext4_ext_find_extent(struct m_ext2fs *fs
path->ep_depth = i;
path->ep_ext = NULL;
path->ep_index = NULL;
+   path->ep_is_sparse = 0;
 
ext4_ext_binsearch(ip, path, lbn);
return (path);

Modified: head/sys/fs/ext2fs/ext2_extents.h
==
--- head/sys/fs/ext2fs/ext2_extents.h   Mon Jan 11 18:11:06 2016
(r293679)
+++ head/sys/fs/ext2fs/ext2_extents.h   Mon Jan 11 19:14:55 2016
(r293680)
@@ -84,7 +84,11 @@ struct ext4_extent_cache {
 struct ext4_extent_path {
uint16_t ep_depth;
struct buf *ep_bp;
-   struct ext4_extent *ep_ext;
+   int ep_is_sparse;
+   union {
+   struct ext4_extent 

svn commit: r293683 - head/sys/fs/ext2fs

2016-01-11 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Jan 11 19:25:43 2016
New Revision: 293683
URL: https://svnweb.freebsd.org/changeset/base/293683

Log:
  ext4: mount panic from freeing invalid pointers
  
  Initialize the struct with those fields to zeroes on allocation,
  preventing the panic.
  
  Patch by: Damjan Jovanovic.
  
  PR:   206056
  MFC after:3 days

Modified:
  head/sys/fs/ext2fs/ext2_vfsops.c

Modified: head/sys/fs/ext2fs/ext2_vfsops.c
==
--- head/sys/fs/ext2fs/ext2_vfsops.cMon Jan 11 19:22:58 2016
(r293682)
+++ head/sys/fs/ext2fs/ext2_vfsops.cMon Jan 11 19:25:43 2016
(r293683)
@@ -590,7 +590,7 @@ ext2_mountfs(struct vnode *devvp, struct
 * while Linux keeps the super block in a locked buffer.
 */
ump->um_e2fs = malloc(sizeof(struct m_ext2fs),
-   M_EXT2MNT, M_WAITOK);
+   M_EXT2MNT, M_WAITOK | M_ZERO);
ump->um_e2fs->e2fs = malloc(sizeof(struct ext2fs),
M_EXT2MNT, M_WAITOK);
mtx_init(EXT2_MTX(ump), "EXT2FS", "EXT2FS Lock", MTX_DEF);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r293370 - head/sys/fs/ext2fs

2016-01-07 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Jan  7 21:43:43 2016
New Revision: 293370
URL: https://svnweb.freebsd.org/changeset/base/293370

Log:
  ext2fs: reading mmaped file in Ext4 causes panic
  
  Always call brelse(path.ep_bp), fixing reading EXT4 files using mmap().
  
  Patch by Damjan Jovanovic.
  
  PR:   205938
  MFC after:1 week

Modified:
  head/sys/fs/ext2fs/ext2_bmap.c

Modified: head/sys/fs/ext2fs/ext2_bmap.c
==
--- head/sys/fs/ext2fs/ext2_bmap.c  Thu Jan  7 21:16:44 2016
(r293369)
+++ head/sys/fs/ext2fs/ext2_bmap.c  Thu Jan  7 21:43:43 2016
(r293370)
@@ -96,6 +96,7 @@ ext4_bmapext(struct vnode *vp, int32_t b
struct ext4_extent *ep;
struct ext4_extent_path path = { .ep_bp = NULL };
daddr_t lbn;
+   int ret = 0;
 
ip = VTOI(vp);
fs = ip->i_e2fs;
@@ -113,15 +114,21 @@ ext4_bmapext(struct vnode *vp, int32_t b
ext4_ext_find_extent(fs, ip, lbn, );
ep = path.ep_ext;
if (ep == NULL)
-   return (EIO);
+   ret = EIO;
+   else {
+   *bnp = fsbtodb(fs, lbn - ep->e_blk +
+   (ep->e_start_lo | (daddr_t)ep->e_start_hi << 32));
 
-   *bnp = fsbtodb(fs, lbn - ep->e_blk +
-   (ep->e_start_lo | (daddr_t)ep->e_start_hi << 32));
+   if (*bnp == 0)
+   *bnp = -1;
+   }
 
-   if (*bnp == 0)
-   *bnp = -1;
+   if (path.ep_bp != NULL) {
+   brelse(path.ep_bp);
+   path.ep_bp = NULL;
+   }
 
-   return (0);
+   return (ret);
 }
 
 /*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r292872 - head/sys/fs/ext2fs

2015-12-29 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Dec 29 15:51:52 2015
New Revision: 292872
URL: https://svnweb.freebsd.org/changeset/base/292872

Log:
  ext2: recognize ext4 INCOMPAT_RECOVER flag
  
  This is a flag specific for journalling in ext4.
  Add it to the list of ext4 features we ignore for
  read-only purposes.
  
  PR:   205668
  MFC after:1 week

Modified:
  head/sys/fs/ext2fs/ext2fs.h

Modified: head/sys/fs/ext2fs/ext2fs.h
==
--- head/sys/fs/ext2fs/ext2fs.h Tue Dec 29 15:36:46 2015(r292871)
+++ head/sys/fs/ext2fs/ext2fs.h Tue Dec 29 15:51:52 2015(r292872)
@@ -187,6 +187,7 @@ struct csum {
 
 #defineEXT2F_INCOMPAT_COMP 0x0001
 #defineEXT2F_INCOMPAT_FTYPE0x0002
+#defineEXT2F_INCOMPAT_RECOVER  0x0004
 #defineEXT2F_INCOMPAT_META_BG  0x0010
 #defineEXT2F_INCOMPAT_EXTENTS  0x0040
 #defineEXT2F_INCOMPAT_64BIT0x0080
@@ -208,6 +209,7 @@ struct csum {
  *
  * We do not support these EXT4 features but they are irrelevant
  * for read-only support:
+ * - EXT2F_INCOMPAT_RECOVER
  * - EXT2F_INCOMPAT_FLEX_BG
  * - EXT2F_INCOMPAT_META_BG
  */
@@ -216,6 +218,7 @@ struct csum {
 EXT2F_ROCOMPAT_EXTRA_ISIZE)
 #defineEXT2F_INCOMPAT_SUPP EXT2F_INCOMPAT_FTYPE
 #defineEXT4F_RO_INCOMPAT_SUPP  (EXT2F_INCOMPAT_EXTENTS | \
+EXT2F_INCOMPAT_RECOVER | \
 EXT2F_INCOMPAT_FLEX_BG | \
 EXT2F_INCOMPAT_META_BG )
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r292877 - head/bin/pax

2015-12-29 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Dec 29 16:31:28 2015
New Revision: 292877
URL: https://svnweb.freebsd.org/changeset/base/292877

Log:
  pax: prevent possible buffer overflow
  
  Or at least quiet down some static analyzers about it.
  
  CID:  978835
  MFC after:1 week
  Obtained from:OpenBSD

Modified:
  head/bin/pax/pat_rep.c

Modified: head/bin/pax/pat_rep.c
==
--- head/bin/pax/pat_rep.c  Tue Dec 29 16:29:42 2015(r292876)
+++ head/bin/pax/pat_rep.c  Tue Dec 29 16:31:28 2015(r292877)
@@ -878,7 +878,7 @@ rep_name(char *name, int *nlen, int prnt
 * (the user already saw that substitution go by)
 */
pt = rephead;
-   (void)strcpy(buf1, name);
+   (void)strlcpy(buf1, name, sizeof(buf1));
inpt = buf1;
outpt = nname;
endpt = outpt + PAXPATHLEN;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r292605 - head/usr.sbin/cron/cron

2015-12-22 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Dec 22 15:20:08 2015
New Revision: 292605
URL: https://svnweb.freebsd.org/changeset/base/292605

Log:
  crontab: replace malloc + bzero with calloc
  
  Obtained from:OpenBSD (Rev 1.20)

Modified:
  head/usr.sbin/cron/cron/popen.c

Modified: head/usr.sbin/cron/cron/popen.c
==
--- head/usr.sbin/cron/cron/popen.c Tue Dec 22 15:03:45 2015
(r292604)
+++ head/usr.sbin/cron/cron/popen.c Tue Dec 22 15:20:08 2015
(r292605)
@@ -82,9 +82,8 @@ cron_popen(program, type, e)
if (!pids) {
if ((fds = getdtablesize()) <= 0)
return(NULL);
-   if (!(pids = (PID_T *)malloc((u_int)(fds * sizeof(PID_T)
+   if (!(pids = calloc(fds, sizeof(PID_T
return(NULL);
-   bzero((char *)pids, fds * sizeof(PID_T));
}
if (pipe(pdes) < 0)
return(NULL);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r292606 - head/usr.sbin/cron/crontab

2015-12-22 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Dec 22 15:30:26 2015
New Revision: 292606
URL: https://svnweb.freebsd.org/changeset/base/292606

Log:
  crontab: properly free an entry
  
  This should close memory leak.
  
  Obtained from:OpenBSD (rev. 1.62)
  CID:  271773

Modified:
  head/usr.sbin/cron/crontab/crontab.c

Modified: head/usr.sbin/cron/crontab/crontab.c
==
--- head/usr.sbin/cron/crontab/crontab.cTue Dec 22 15:20:08 2015
(r292605)
+++ head/usr.sbin/cron/crontab/crontab.cTue Dec 22 15:30:26 2015
(r292606)
@@ -558,7 +558,7 @@ replace_cmd() {
case FALSE:
e = load_entry(tmp, check_error, pw, envp);
if (e)
-   free(e);
+   free_entry(e);
break;
case TRUE:
break;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r292607 - head/usr.sbin/cron/cron

2015-12-22 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Dec 22 15:32:45 2015
New Revision: 292607
URL: https://svnweb.freebsd.org/changeset/base/292607

Log:
  cron: Check the return value of pipe(2)
  
  Fix inspired by:  OpenBSD (rev 1.56)
  CID:  1009830

Modified:
  head/usr.sbin/cron/cron/do_command.c

Modified: head/usr.sbin/cron/cron/do_command.c
==
--- head/usr.sbin/cron/cron/do_command.cTue Dec 22 15:30:26 2015
(r292606)
+++ head/usr.sbin/cron/cron/do_command.cTue Dec 22 15:32:45 2015
(r292607)
@@ -114,7 +114,7 @@ child_process(e, u)
struct pam_conv pamc = {
.conv = openpam_nullconv,
.appdata_ptr = NULL
-   };
+   }
 
Debug(DPROC, ("[%d] checking account with PAM\n", getpid()))
 
@@ -161,8 +161,10 @@ child_process(e, u)
 
/* create some pipes to talk to our future child
 */
-   pipe(stdin_pipe);   /* child's stdin */
-   pipe(stdout_pipe);  /* child's stdout */
+   if (pipe(stdin_pipe) != 0 || pipe(stdout_pipe) != 0) {
+   log_it("CRON", getpid(), "error", "can't pipe");
+   exit(ERROR_EXIT);
+   }
 
/* since we are a forked process, we can diddle the command string
 * we were passed -- nobody else is going to use it again, right?
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r292608 - head/usr.sbin/cron/cron

2015-12-22 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Dec 22 15:42:53 2015
New Revision: 292608
URL: https://svnweb.freebsd.org/changeset/base/292608

Log:
  Undo change from r292607 that was not meant to be there
  
  Pointyhat: me

Modified:
  head/usr.sbin/cron/cron/do_command.c

Modified: head/usr.sbin/cron/cron/do_command.c
==
--- head/usr.sbin/cron/cron/do_command.cTue Dec 22 15:32:45 2015
(r292607)
+++ head/usr.sbin/cron/cron/do_command.cTue Dec 22 15:42:53 2015
(r292608)
@@ -114,7 +114,7 @@ child_process(e, u)
struct pam_conv pamc = {
.conv = openpam_nullconv,
.appdata_ptr = NULL
-   }
+   };
 
Debug(DPROC, ("[%d] checking account with PAM\n", getpid()))
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r292455 - head/bin/ed

2015-12-18 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Dec 18 23:05:36 2015
New Revision: 292455
URL: https://svnweb.freebsd.org/changeset/base/292455

Log:
  ed(1): Prevent possible string overflows
  
  Use strlcpy instead of strncpy to guarantee NULL termination.
  
  Pointed out by:   imp
  CID:  1007252
  X-MFC with:   r292454

Modified:
  head/bin/ed/main.c

Modified: head/bin/ed/main.c
==
--- head/bin/ed/main.c  Fri Dec 18 21:58:42 2015(r292454)
+++ head/bin/ed/main.c  Fri Dec 18 23:05:36 2015(r292455)
@@ -506,7 +506,7 @@ exec_command(void)
else if (open_sbuf() < 0)
return FATAL;
if (*fnp && *fnp != '!')
-strncpy(old_filename, fnp, PATH_MAX);
+strlcpy(old_filename, fnp, PATH_MAX);
 #ifdef BACKWARDS
if (*fnp == '\0' && *old_filename == '\0') {
errmsg = "no current filename";
@@ -534,7 +534,7 @@ exec_command(void)
}
GET_COMMAND_SUFFIX();
if (*fnp)
-   strncpy(old_filename, fnp, PATH_MAX);
+   strlcpy(old_filename, fnp, PATH_MAX);
printf("%s\n", strip_escapes(old_filename));
break;
case 'g':
@@ -665,7 +665,7 @@ exec_command(void)
GET_COMMAND_SUFFIX();
if (!isglobal) clear_undo_stack();
if (*old_filename == '\0' && *fnp != '!')
-   strncpy(old_filename, fnp, PATH_MAX);
+   strlcpy(old_filename, fnp, PATH_MAX);
 #ifdef BACKWARDS
if (*fnp == '\0' && *old_filename == '\0') {
errmsg = "no current filename";
@@ -799,7 +799,7 @@ exec_command(void)
return ERR;
GET_COMMAND_SUFFIX();
if (*old_filename == '\0' && *fnp != '!')
-   strncpy(old_filename, fnp, PATH_MAX);
+   strlcpy(old_filename, fnp, PATH_MAX);
 #ifdef BACKWARDS
if (*fnp == '\0' && *old_filename == '\0') {
errmsg = "no current filename";
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r292454 - head/bin/ed

2015-12-18 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Dec 18 21:58:42 2015
New Revision: 292454
URL: https://svnweb.freebsd.org/changeset/base/292454

Log:
  ed(1): Prevent possible string overflows
  
  CID:  1007252
  MFC after:2 weeks

Modified:
  head/bin/ed/main.c

Modified: head/bin/ed/main.c
==
--- head/bin/ed/main.c  Fri Dec 18 21:34:28 2015(r292453)
+++ head/bin/ed/main.c  Fri Dec 18 21:58:42 2015(r292454)
@@ -505,7 +505,8 @@ exec_command(void)
return ERR;
else if (open_sbuf() < 0)
return FATAL;
-   if (*fnp && *fnp != '!') strcpy(old_filename, fnp);
+   if (*fnp && *fnp != '!')
+strncpy(old_filename, fnp, PATH_MAX);
 #ifdef BACKWARDS
if (*fnp == '\0' && *old_filename == '\0') {
errmsg = "no current filename";
@@ -532,7 +533,8 @@ exec_command(void)
return ERR;
}
GET_COMMAND_SUFFIX();
-   if (*fnp) strcpy(old_filename, fnp);
+   if (*fnp)
+   strncpy(old_filename, fnp, PATH_MAX);
printf("%s\n", strip_escapes(old_filename));
break;
case 'g':
@@ -663,7 +665,7 @@ exec_command(void)
GET_COMMAND_SUFFIX();
if (!isglobal) clear_undo_stack();
if (*old_filename == '\0' && *fnp != '!')
-   strcpy(old_filename, fnp);
+   strncpy(old_filename, fnp, PATH_MAX);
 #ifdef BACKWARDS
if (*fnp == '\0' && *old_filename == '\0') {
errmsg = "no current filename";
@@ -797,7 +799,7 @@ exec_command(void)
return ERR;
GET_COMMAND_SUFFIX();
if (*old_filename == '\0' && *fnp != '!')
-   strcpy(old_filename, fnp);
+   strncpy(old_filename, fnp, PATH_MAX);
 #ifdef BACKWARDS
if (*fnp == '\0' && *old_filename == '\0') {
errmsg = "no current filename";
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r291234 - head/usr.bin/bc

2015-11-23 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Nov 24 04:15:13 2015
New Revision: 291234
URL: https://svnweb.freebsd.org/changeset/base/291234

Log:
  bc(1): Fix memory corruption issues
  
  Fix crashes and hangs found by AFL.
  Improve handling of non-ascii chars.
  
  Obtained from:OpenBSD (CVS rev 1.49)

Modified:
  head/usr.bin/bc/bc.y

Modified: head/usr.bin/bc/bc.y
==
--- head/usr.bin/bc/bc.yTue Nov 24 03:42:58 2015(r291233)
+++ head/usr.bin/bc/bc.yTue Nov 24 04:15:13 2015(r291234)
@@ -80,7 +80,7 @@ static voidgrow(void);
 static ssize_t  cs(const char *);
 static ssize_t  as(const char *);
 static ssize_t  node(ssize_t, ...);
-static void emit(ssize_t);
+static void emit(ssize_t, int);
 static void emit_macro(int, ssize_t);
 static void free_tree(void);
 static ssize_t  numnode(int);
@@ -196,7 +196,7 @@ program : /* empty */
 
 input_item : semicolon_list NEWLINE
{
-   emit($1);
+   emit($1, 0);
macro_char = reset_macro_char;
putchar('\n');
free_tree();
@@ -826,13 +826,18 @@ node(ssize_t arg, ...)
 }
 
 static void
-emit(ssize_t i)
+emit(ssize_t i, int level)
 {
 
-   if (instructions[i].index >= 0)
-   while (instructions[i].index != END_NODE)
-   emit(instructions[i++].index);
-   else
+   if (level > 1000)
+   errx(1, "internal error: tree level > 1000");
+   if (instructions[i].index >= 0) {
+   while (instructions[i].index != END_NODE &&
+   instructions[i].index != i)  {
+   emit(instructions[i].index, level + 1);
+   i++;
+   }
+   } else if (instructions[i].index != END_NODE)
fputs(instructions[i].u.cstr, stdout);
 }
 
@@ -841,7 +846,7 @@ emit_macro(int nodeidx, ssize_t code)
 {
 
putchar('[');
-   emit(code);
+   emit(code, 0);
printf("]s%s\n", instructions[nodeidx].u.cstr);
nesting--;
 }
@@ -978,7 +983,7 @@ yyerror(const char *s)
!isprint((unsigned char)yytext[0]))
n = asprintf(,
"%s: %s:%d: %s: ascii char 0x%02x unexpected",
-   __progname, filename, lineno, s, yytext[0]);
+   __progname, filename, lineno, s, yytext[0] & 0xff);
else
n = asprintf(, "%s: %s:%d: %s: %s unexpected",
__progname, filename, lineno, s, yytext);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r291155 - head/usr.bin/bc

2015-11-21 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Nov 22 02:43:14 2015
New Revision: 291155
URL: https://svnweb.freebsd.org/changeset/base/291155

Log:
  bc: sync with OpenBSD
  
  tty.c Rev. 1.3
  Avoid unintended problems with operator precedence when doing an
  assignment and comparison.
  
  bc.1, Rev. 1.31, 1.32
  '.Ql Quit' -> '.Ql quit' because only the lowercase command is valid.
  Clarify sentence about `quit` in BUGS section.
  
  extern.h, Rev. 1.12
  whitespace
  
  bc.y, Rev. 1.47
  Prefer setvbuf() to setlinebuf() for portability
  
  Obtained from:OpenBSD
  MFC after:2 weeks

Modified:
  head/usr.bin/bc/bc.1
  head/usr.bin/bc/bc.y
  head/usr.bin/bc/extern.h
  head/usr.bin/bc/tty.c

Modified: head/usr.bin/bc/bc.1
==
--- head/usr.bin/bc/bc.1Sun Nov 22 02:40:19 2015(r291154)
+++ head/usr.bin/bc/bc.1Sun Nov 22 02:43:14 2015(r291155)
@@ -1,5 +1,5 @@
 .\"$FreeBSD$
-.\"$OpenBSD: bc.1,v 1.30 2014/01/14 07:42:42 jmc Exp $
+.\"$OpenBSD: bc.1,v 1.32 2015/11/17 05:45:35 mmcc Exp $
 .\"
 .\" Copyright (C) Caldera International Inc.  2001-2002.
 .\" All rights reserved.
@@ -35,7 +35,7 @@
 .\"
 .\"@(#)bc.16.8 (Berkeley) 8/8/91
 .\"
-.Dd April 16, 2014
+.Dd November 21 2015 
 .Dt BC 1
 .Os
 .Sh NAME
@@ -407,8 +407,9 @@ The current version of the
 utility was written by
 .An Otto Moerbeek .
 .Sh BUGS
-.Ql Quit
-is interpreted when read, not when executed.
+The
+.Ql quit
+statement is interpreted when read, not when executed.
 .Pp
 Some non-portable extensions, as found in the GNU version of the
 .Nm

Modified: head/usr.bin/bc/bc.y
==
--- head/usr.bin/bc/bc.ySun Nov 22 02:40:19 2015(r291154)
+++ head/usr.bin/bc/bc.ySun Nov 22 02:43:14 2015(r291155)
@@ -1125,7 +1125,7 @@ main(int argc, char *argv[])
int ch, i;
 
init();
-   setlinebuf(stdout);
+   setvbuf(stdout, NULL, _IOLBF, 0);
 
sargv = malloc(argc * sizeof(char *));
if (sargv == NULL)

Modified: head/usr.bin/bc/extern.h
==
--- head/usr.bin/bc/extern.hSun Nov 22 02:40:19 2015(r291154)
+++ head/usr.bin/bc/extern.hSun Nov 22 02:43:14 2015(r291155)
@@ -1,5 +1,5 @@
 /* $FreeBSD$   */
-/*  $OpenBSD: extern.h,v 1.10 2013/09/19 16:12:01 otto Exp $   */
+/*  $OpenBSD: extern.h,v 1.12 2014/04/17 19:07:14 otto Exp $   */
 
 /*
  * Copyright (c) 2003, Otto Moerbeek 
@@ -39,9 +39,9 @@ extern intfileindex;
 extern int sargc;
 extern const char  **sargv;
 extern const char  *filename;
-extern bool interactive;
-extern EditLine*el;
-extern History *hist;
-extern HistEventhe;
+extern bool interactive;
+extern EditLine*el;
+extern History *hist;
+extern HistEvent he;
 extern char*cmdexpr;
 extern struct termios ttysaved;

Modified: head/usr.bin/bc/tty.c
==
--- head/usr.bin/bc/tty.c   Sun Nov 22 02:40:19 2015(r291154)
+++ head/usr.bin/bc/tty.c   Sun Nov 22 02:43:14 2015(r291155)
@@ -1,5 +1,5 @@
 /* $FreeBSD$   */
-/*  $OpenBSD: tty.c,v 1.2 2013/11/12 13:54:51 deraadt Exp $*/
+/*  $OpenBSD: tty.c,v 1.3 2015/09/05 09:49:24 jsg Exp $*/
 
 /*
  * Copyright (c) 2013, Otto Moerbeek 
@@ -30,7 +30,7 @@ settty(struct termios *t)
 {
int ret;
 
-   while ((ret = tcsetattr(0, TCSADRAIN,  t) == -1) && errno == EINTR)
+   while ((ret = tcsetattr(0, TCSADRAIN,  t)) == -1 && errno == EINTR)
continue;
return ret;
 }
@@ -40,7 +40,7 @@ gettty(struct termios *t)
 {
int ret;
 
-   while ((ret = tcgetattr(0, t) == -1) && errno == EINTR)
+   while ((ret = tcgetattr(0, t)) == -1 && errno == EINTR)
continue;
return ret;
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r290394 - in head: include sys/sys

2015-11-05 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Nov  5 14:55:58 2015
New Revision: 290394
URL: https://svnweb.freebsd.org/changeset/base/290394

Log:
  Rename __sentinel to __null_sentinel
  
  GCC 5 uses a conflicting __sentinel definition in include/c++/bits/stl_algo.h
  
  Reported by:  matteo

Modified:
  head/include/unistd.h
  head/sys/sys/cdefs.h

Modified: head/include/unistd.h
==
--- head/include/unistd.h   Thu Nov  5 14:37:17 2015(r290393)
+++ head/include/unistd.h   Thu Nov  5 14:55:58 2015(r290394)
@@ -327,9 +327,9 @@ int  close(int);
 voidclosefrom(int);
 int dup(int);
 int dup2(int, int);
-int execl(const char *, const char *, ...) __sentinel;
+int execl(const char *, const char *, ...) __null_sentinel;
 int execle(const char *, const char *, ...);
-int execlp(const char *, const char *, ...) __sentinel;
+int execlp(const char *, const char *, ...) __null_sentinel;
 int execv(const char *, char * const *);
 int execve(const char *, char * const *, char * const *);
 int execvp(const char *, char * const *);

Modified: head/sys/sys/cdefs.h
==
--- head/sys/sys/cdefs.hThu Nov  5 14:37:17 2015(r290393)
+++ head/sys/sys/cdefs.hThu Nov  5 14:55:58 2015(r290394)
@@ -459,11 +459,11 @@
 #endif
 
 #if __GNUC_PREREQ__(4, 0)
-#define__sentinel  __attribute__((__sentinel__))
+#define__null_sentinel __attribute__((__sentinel__))
 #define__exported  __attribute__((__visibility__("default")))
 #define__hidden__attribute__((__visibility__("hidden")))
 #else
-#define__sentinel
+#define__null_sentinel
 #define__exported
 #define__hidden
 #endif
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r289150 - head/contrib/gcc/cp

2015-10-11 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Oct 11 19:58:57 2015
New Revision: 289150
URL: https://svnweb.freebsd.org/changeset/base/289150

Log:
  Correct handling of enum attributes with g++
  
  From OpenBSD's commit log:
  
  This was responsible for memory corruption with recent versions
  of Mesa where c and c++ code share a header with a packed enum type.
  
  Reference:
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39219
  
  Obtained from:OpenBSD (CVS rev. 1.2)
  MFC after:1 week

Modified:
  head/contrib/gcc/cp/parser.c

Modified: head/contrib/gcc/cp/parser.c
==
--- head/contrib/gcc/cp/parser.cSun Oct 11 19:30:09 2015
(r289149)
+++ head/contrib/gcc/cp/parser.cSun Oct 11 19:58:57 2015
(r289150)
@@ -10906,6 +10906,7 @@ cp_parser_enum_specifier (cp_parser* par
   if (cp_parser_allow_gnu_extensions_p (parser))
 {
   tree trailing_attr = cp_parser_attributes_opt (parser);
+  trailing_attr = chainon (trailing_attr, attributes);
   cplus_decl_attributes (,
 trailing_attr,
 (int) ATTR_FLAG_TYPE_IN_PLACE);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r289160 - head/contrib/gcc/cp

2015-10-11 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Oct 12 02:05:25 2015
New Revision: 289160
URL: https://svnweb.freebsd.org/changeset/base/289160

Log:
  Revertr289150:
  Correct handling of enum attributes with g++
  
  It is causing issues on some platforms.
  
  Reported by:  sbruno (through adrian)

Modified:
  head/contrib/gcc/cp/parser.c

Modified: head/contrib/gcc/cp/parser.c
==
--- head/contrib/gcc/cp/parser.cSun Oct 11 21:33:00 2015
(r289159)
+++ head/contrib/gcc/cp/parser.cMon Oct 12 02:05:25 2015
(r289160)
@@ -10906,7 +10906,6 @@ cp_parser_enum_specifier (cp_parser* par
   if (cp_parser_allow_gnu_extensions_p (parser))
 {
   tree trailing_attr = cp_parser_attributes_opt (parser);
-  trailing_attr = chainon (trailing_attr, attributes);
   cplus_decl_attributes (,
 trailing_attr,
 (int) ATTR_FLAG_TYPE_IN_PLACE);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r288669 - head/share/mk

2015-10-04 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Oct  4 18:54:02 2015
New Revision: 288669
URL: https://svnweb.freebsd.org/changeset/base/288669

Log:
  Bump the stack protector to level "strong".
  
  The general stack protector is known to be weak and has pretty small
  coverage. While setting stack-protector-all would give better protection
  it would come with a performance cost: for this reason Google's Chrome OS
  team developed a new stack-protector-strong variant.
  
  In addition to the protections offered by -fstack-protector, the new option
  will guard any function that declares any type or length of local array,
  even those in structs or unions. It will also protect functions that use a
  local variable's address in a function argument or on the right-hand side
  of an assignment.
  
  The option was introduced in GCC-4.9, but support for it has been
  back-ported to our base GCC (r286074) and is also available in clang.
  
  The change was tested with dbench and doesn't introduce performance
  regressions. An exp-run over the ports tree revealed no failures when
  using the stricter stack-protector-all. Thanks to all testers involved.
  
  Reference:
  https://outflux.net/blog/archives/2014/01/27/fstack-protector-strong/
  
  Tested by:pho, portmgr (antoine)
  Discussed with:   secteam (delphij)
  
  Differential Revision: https://reviews.freebsd.org/D3463
  PR:   203394 (exp-run)
  
  Relnotes: yes
  MFC:  no (not supported in older clang)

Modified:
  head/share/mk/bsd.sys.mk

Modified: head/share/mk/bsd.sys.mk
==
--- head/share/mk/bsd.sys.mkSun Oct  4 13:49:09 2015(r288668)
+++ head/share/mk/bsd.sys.mkSun Oct  4 18:54:02 2015(r288669)
@@ -149,7 +149,7 @@ CXXFLAGS.clang+= -Wno-c++11-extensions
 .if ${MK_SSP} != "no" && \
 ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips"
 # Don't use -Wstack-protector as it breaks world with -Werror.
-SSP_CFLAGS?=   -fstack-protector
+SSP_CFLAGS?=   -fstack-protector-strong
 CFLAGS+=   ${SSP_CFLAGS}
 .endif # SSP && !ARM && !MIPS
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r287254 - head/sys/sys

2015-08-28 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Aug 28 14:06:28 2015
New Revision: 287254
URL: https://svnweb.freebsd.org/changeset/base/287254

Log:
  Be more GCC-friendly with attributes
  
  Being clang the default compiler, we were always giving precedence to
  the __has_attribute check. Unfortunately clang generally doesn't support
  the new attributes (alloc_size was briefly supported and then reverted)
  so we were always doing both checks. Give the precedence to GCC as that is
  the working case now.
  
  Do the same for  __has_builtin() for consistency.

Modified:
  head/sys/sys/cdefs.h

Modified: head/sys/sys/cdefs.h
==
--- head/sys/sys/cdefs.hFri Aug 28 13:57:30 2015(r287253)
+++ head/sys/sys/cdefs.hFri Aug 28 14:06:28 2015(r287254)
@@ -237,12 +237,12 @@
 #define__aligned(x)__attribute__((__aligned__(x)))
 #define__section(x)__attribute__((__section__(x)))
 #endif
-#if __has_attribute(alloc_size) || __GNUC_PREREQ__(4, 3)
+#if __GNUC_PREREQ__(4, 3) || __has_attribute(alloc_size)
 #define__alloc_size(x) __attribute__((__alloc_size__(x)))
 #else
 #define__alloc_size(x)
 #endif
-#if __has_attribute(alloc_align) || __GNUC_PREREQ__(4, 9)
+#if __GNUC_PREREQ__(4, 9) || __has_attribute(alloc_align)
 #define__alloc_align(x)__attribute__((__alloc_align__(x)))
 #else
 #define__alloc_align(x)
@@ -382,7 +382,7 @@
 #define__returns_twice
 #endif
 
-#if __has_builtin(__builtin_unreachable) || __GNUC_PREREQ__(4, 6)
+#if __GNUC_PREREQ__(4, 6) || __has_builtin(__builtin_unreachable) 
 #define__unreachable() __builtin_unreachable()
 #else
 #define__unreachable() ((void)0)
@@ -535,7 +535,7 @@
  * well enough to use them in limited cases.
  */ 
 #if defined(__GNUC_GNU_INLINE__) || defined(__GNUC_STDC_INLINE__)
-#if __has_attribute(artificial) || __GNUC_PREREQ__(4, 3)
+#if __GNUC_PREREQ__(4, 3) || __has_attribute(artificial)
 #define__gnu_inline__attribute__((__gnu_inline__, __artificial__))
 #else
 #define__gnu_inline__attribute__((__gnu_inline__))
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r287255 - head/sys/sys

2015-08-28 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Aug 28 14:13:01 2015
New Revision: 287255
URL: https://svnweb.freebsd.org/changeset/base/287255

Log:
  trailing space

Modified:
  head/sys/sys/cdefs.h

Modified: head/sys/sys/cdefs.h
==
--- head/sys/sys/cdefs.hFri Aug 28 14:06:28 2015(r287254)
+++ head/sys/sys/cdefs.hFri Aug 28 14:13:01 2015(r287255)
@@ -382,7 +382,7 @@
 #define__returns_twice
 #endif
 
-#if __GNUC_PREREQ__(4, 6) || __has_builtin(__builtin_unreachable) 
+#if __GNUC_PREREQ__(4, 6) || __has_builtin(__builtin_unreachable)
 #define__unreachable() __builtin_unreachable()
 #else
 #define__unreachable() ((void)0)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r287259 - head/sys/sys

2015-08-28 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Aug 28 15:36:05 2015
New Revision: 287259
URL: https://svnweb.freebsd.org/changeset/base/287259

Log:
  Add underscores to attributes when checking for __has_attribute.
  
  This is a good practice to avoid confusion with allowed macros.
  
  Suggested by: jilles

Modified:
  head/sys/sys/cdefs.h

Modified: head/sys/sys/cdefs.h
==
--- head/sys/sys/cdefs.hFri Aug 28 15:27:55 2015(r287258)
+++ head/sys/sys/cdefs.hFri Aug 28 15:36:05 2015(r287259)
@@ -237,12 +237,12 @@
 #define__aligned(x)__attribute__((__aligned__(x)))
 #define__section(x)__attribute__((__section__(x)))
 #endif
-#if __GNUC_PREREQ__(4, 3) || __has_attribute(alloc_size)
+#if __GNUC_PREREQ__(4, 3) || __has_attribute(__alloc_size__)
 #define__alloc_size(x) __attribute__((__alloc_size__(x)))
 #else
 #define__alloc_size(x)
 #endif
-#if __GNUC_PREREQ__(4, 9) || __has_attribute(alloc_align)
+#if __GNUC_PREREQ__(4, 9) || __has_attribute(__alloc_align__)
 #define__alloc_align(x)__attribute__((__alloc_align__(x)))
 #else
 #define__alloc_align(x)
@@ -535,7 +535,7 @@
  * well enough to use them in limited cases.
  */ 
 #if defined(__GNUC_GNU_INLINE__) || defined(__GNUC_STDC_INLINE__)
-#if __GNUC_PREREQ__(4, 3) || __has_attribute(artificial)
+#if __GNUC_PREREQ__(4, 3) || __has_attribute(__artificial__)
 #define__gnu_inline__attribute__((__gnu_inline__, __artificial__))
 #else
 #define__gnu_inline__attribute__((__gnu_inline__))
@@ -787,8 +787,8 @@
  * properties that cannot be enforced by the C type system. 
  */
 
-#if __has_attribute(argument_with_type_tag)  \
-__has_attribute(type_tag_for_datatype)  !defined(lint)
+#if __has_attribute(__argument_with_type_tag__)  \
+__has_attribute(__type_tag_for_datatype__)  !defined(lint)
 #define__arg_type_tag(arg_kind, arg_idx, type_tag_idx) \
__attribute__((__argument_with_type_tag__(arg_kind, arg_idx, 
type_tag_idx)))
 #define__datatype_type_tag(kind, type) \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286972 - head/contrib/hyperv/tools

2015-08-20 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Aug 20 21:49:59 2015
New Revision: 286972
URL: https://svnweb.freebsd.org/changeset/base/286972

Log:
  Appease gcc-4.2
  
  It needs to die, but it resists mipsteriously.
  
  Submitted by: Oliver Pinter

Modified:
  head/contrib/hyperv/tools/hv_kvp_daemon.c

Modified: head/contrib/hyperv/tools/hv_kvp_daemon.c
==
--- head/contrib/hyperv/tools/hv_kvp_daemon.c   Thu Aug 20 21:31:36 2015
(r286971)
+++ head/contrib/hyperv/tools/hv_kvp_daemon.c   Thu Aug 20 21:49:59 2015
(r286972)
@@ -811,7 +811,7 @@ kvp_get_ip_info(int family, char *if_nam
int error = 0;
char *buffer;
size_t buffer_length;
-   struct hv_kvp_ipaddr_value *ip_buffer;
+   struct hv_kvp_ipaddr_value *ip_buffer = NULL;
char cidr_mask[5];
int weight;
int i;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286891 - head/usr.bin/calendar/calendars

2015-08-18 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Aug 18 15:11:41 2015
New Revision: 286891
URL: https://svnweb.freebsd.org/changeset/base/286891

Log:
  Calendar: add a few more dates to the Christian calendar
  
  The many christian denominations have different dates for their
  celebrations and controversies are likely to be always.
  
  These are well established and happen to be holidays in many
  Catholic countries.
  
  MFC after:1 month

Modified:
  head/usr.bin/calendar/calendars/calendar.christian

Modified: head/usr.bin/calendar/calendars/calendar.christian
==
--- head/usr.bin/calendar/calendars/calendar.christian  Tue Aug 18 14:54:29 
2015(r286890)
+++ head/usr.bin/calendar/calendars/calendar.christian  Tue Aug 18 15:11:41 
2015(r286891)
@@ -5,8 +5,9 @@
  */
 
 #ifndef _calendar_christian_
-#define _calendar_christian_
+#define_calendar_christian_
 
+01/01  Solemnity of Mary, Mother of God
 01/05  Last (twelfth) day of Christmastide
 01/06  Epiphany
 Easter-47  Shrove Tuesday / Mardi Gras (day before Ash Wednesday)
@@ -21,10 +22,13 @@ Easter+50   Whitmonday
 Easter+56  Trinity Sunday (7 days after Pentecost)
 Easter+60  Corpus Christi (11 days after Pentecost)
 05/28* Rogation Sunday
+08/15  Assumption of the Blessed Virgin Mary
+09/01  All Saints' Day
 10/18  Feast Day of St. Luke
 11/SunLast First Sunday of Advent (4th Sunday before Christmas)
 12/SunFirstFirst Sunday of Advent (4th Sunday before Christmas)
 12/06  St. Nicholas' Day
+12/08  Feast of the Immaculate Conception
 12/24  Christmas Eve
 12/25  Christmastide begins: First day of Christmas
 12/26  Second day of Christmas (Boxing Day)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286893 - head/usr.bin/calendar/calendars

2015-08-18 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Aug 18 15:50:02 2015
New Revision: 286893
URL: https://svnweb.freebsd.org/changeset/base/286893

Log:
  Correct All Saints' day.
  
  Thanks to:zec
  X-MFC with:   r286891

Modified:
  head/usr.bin/calendar/calendars/calendar.christian

Modified: head/usr.bin/calendar/calendars/calendar.christian
==
--- head/usr.bin/calendar/calendars/calendar.christian  Tue Aug 18 15:33:23 
2015(r286892)
+++ head/usr.bin/calendar/calendars/calendar.christian  Tue Aug 18 15:50:02 
2015(r286893)
@@ -23,8 +23,8 @@ Easter+56 Trinity Sunday (7 days after P
 Easter+60  Corpus Christi (11 days after Pentecost)
 05/28* Rogation Sunday
 08/15  Assumption of the Blessed Virgin Mary
-09/01  All Saints' Day
 10/18  Feast Day of St. Luke
+11/01  All Saints' Day
 11/SunLast First Sunday of Advent (4th Sunday before Christmas)
 12/SunFirstFirst Sunday of Advent (4th Sunday before Christmas)
 12/06  St. Nicholas' Day
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286782 - in head/lib/libc: secure sys

2015-08-14 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Aug 14 14:58:04 2015
New Revision: 286782
URL: https://svnweb.freebsd.org/changeset/base/286782

Log:
  Remove a stale comment and clarify the original where it was taken from
  
  The comment in the libc/sys symbol map referenced the generated symbols
  for the syscall trampolines. Such comment was out of place in the secure
  symbol map so remove the stale comment and attempt to clarify the old one
  to avoid risks of confusion.
  
  Pointed out by:   kib

Modified:
  head/lib/libc/secure/Symbol.map
  head/lib/libc/sys/Symbol.map

Modified: head/lib/libc/secure/Symbol.map
==
--- head/lib/libc/secure/Symbol.map Fri Aug 14 14:26:13 2015
(r286781)
+++ head/lib/libc/secure/Symbol.map Fri Aug 14 14:58:04 2015
(r286782)
@@ -2,11 +2,6 @@
  * $FreeBSD$
  */
 
-/*
- * It'd be nice to have this automatically generated, but we don't
- * know to what version they will eventually belong, so for now
- * it has to be manual.
- */
 FBSD_1.0 {
__chk_fail;
__stack_chk_fail;

Modified: head/lib/libc/sys/Symbol.map
==
--- head/lib/libc/sys/Symbol.mapFri Aug 14 14:26:13 2015
(r286781)
+++ head/lib/libc/sys/Symbol.mapFri Aug 14 14:58:04 2015
(r286782)
@@ -3,8 +3,8 @@
  */
 
 /*
- * It'd be nice to have this automatically generated, but we don't
- * know to what version they will eventually belong, so for now
+ * It'd be nice to automatically generate the syscall symbols, but we
+ * don't know to what version they will eventually belong to, so for now
  * it has to be manual.
  */
 FBSD_1.0 {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286760 - in head/lib/libc: . secure sys

2015-08-13 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Aug 14 03:03:13 2015
New Revision: 286760
URL: https://svnweb.freebsd.org/changeset/base/286760

Log:
  Move the stack protector to a new secure directory
  
  As part of the code refactoring to support FORTIFY_SOURCE we want
  a new subdirectory secure to keep the files related to security.
  Move the stack protector functions to this new directory.
  
  No functional change.
  
  Differential Review:  https://reviews.freebsd.org/D

Added:
  head/lib/libc/secure/
  head/lib/libc/secure/Makefile.inc   (contents, props changed)
  head/lib/libc/secure/Symbol.map   (contents, props changed)
  head/lib/libc/secure/stack_protector.c
 - copied unchanged from r286712, head/lib/libc/sys/stack_protector.c
  head/lib/libc/secure/stack_protector_compat.c
 - copied unchanged from r286392, head/lib/libc/sys/stack_protector_compat.c
Deleted:
  head/lib/libc/sys/stack_protector.c
  head/lib/libc/sys/stack_protector_compat.c
Modified:
  head/lib/libc/Makefile
  head/lib/libc/sys/Makefile.inc
  head/lib/libc/sys/Symbol.map

Modified: head/lib/libc/Makefile
==
--- head/lib/libc/Makefile  Fri Aug 14 02:45:22 2015(r286759)
+++ head/lib/libc/Makefile  Fri Aug 14 03:03:13 2015(r286760)
@@ -95,6 +95,7 @@ NOASM=
 .include ${LIBC_SRCTOP}/stdtime/Makefile.inc
 .include ${LIBC_SRCTOP}/string/Makefile.inc
 .include ${LIBC_SRCTOP}/sys/Makefile.inc
+.include ${LIBC_SRCTOP}/secure/Makefile.inc
 .include ${LIBC_SRCTOP}/rpc/Makefile.inc
 .include ${LIBC_SRCTOP}/uuid/Makefile.inc
 .include ${LIBC_SRCTOP}/xdr/Makefile.inc

Added: head/lib/libc/secure/Makefile.inc
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/secure/Makefile.inc   Fri Aug 14 03:03:13 2015
(r286760)
@@ -0,0 +1,12 @@
+# $FreeBSD$
+#
+# libc sources related to security
+
+.PATH: ${LIBC_SRCTOP}/secure
+
+# Sources common to both syscall interfaces:
+SRCS+= \
+   stack_protector.c \
+   stack_protector_compat.c
+
+SYM_MAPS+=${LIBC_SRCTOP}/secure/Symbol.map

Added: head/lib/libc/secure/Symbol.map
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/secure/Symbol.map Fri Aug 14 03:03:13 2015
(r286760)
@@ -0,0 +1,14 @@
+/*
+ * $FreeBSD$
+ */
+
+/*
+ * It'd be nice to have this automatically generated, but we don't
+ * know to what version they will eventually belong, so for now
+ * it has to be manual.
+ */
+FBSD_1.0 {
+   __chk_fail;
+   __stack_chk_fail;
+   __stack_chk_guard;
+};

Copied: head/lib/libc/secure/stack_protector.c (from r286712, 
head/lib/libc/sys/stack_protector.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/secure/stack_protector.c  Fri Aug 14 03:03:13 2015
(r286760, copy of r286712, head/lib/libc/sys/stack_protector.c)
@@ -0,0 +1,117 @@
+/* $NetBSD: stack_protector.c,v 1.4 2006/11/22 17:23:25 christos Exp $ */
+/* $OpenBSD: stack_protector.c,v 1.10 2006/03/31 05:34:44 deraadt Exp $
*/
+/*
+ * Copyright (c) 2002 Hiroaki Etoh, Federico G. Schwindt, and Miodrag Vallat.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT 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.
+ *
+ */
+
+#include sys/cdefs.h
+__FBSDID($FreeBSD$);
+
+#include sys/param.h
+#include sys/sysctl.h
+#include sys/types.h
+#include errno.h
+#include link.h
+#include signal.h
+#include string.h
+#include syslog.h
+#include unistd.h
+#include libc_private.h
+
+extern int 

svn commit: r286615 - in head: sys/arm/ti sys/arm64/arm64 sys/geom/raid usr.bin/wc

2015-08-10 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Aug 11 03:12:09 2015
New Revision: 286615
URL: https://svnweb.freebsd.org/changeset/base/286615

Log:
  Clean out some externally visible more then grammar
  
  MFC after:3 days

Modified:
  head/sys/arm/ti/ti_hwmods.c
  head/sys/arm64/arm64/trap.c
  head/sys/geom/raid/md_intel.c
  head/sys/geom/raid/md_jmicron.c
  head/sys/geom/raid/md_nvidia.c
  head/sys/geom/raid/md_sii.c
  head/usr.bin/wc/wc.1

Modified: head/sys/arm/ti/ti_hwmods.c
==
--- head/sys/arm/ti/ti_hwmods.c Tue Aug 11 02:58:33 2015(r286614)
+++ head/sys/arm/ti/ti_hwmods.c Tue Aug 11 03:12:09 2015(r286615)
@@ -129,7 +129,7 @@ ti_hwmods_get_clock(device_t dev)
}
 
if (len  0)
-   device_printf(dev, WARNING: more then one ti,hwmod \n);
+   device_printf(dev, WARNING: more than one ti,hwmod \n);
 
free(buf, M_OFWPROP);
return (clk);

Modified: head/sys/arm64/arm64/trap.c
==
--- head/sys/arm64/arm64/trap.c Tue Aug 11 02:58:33 2015(r286614)
+++ head/sys/arm64/arm64/trap.c Tue Aug 11 03:12:09 2015(r286615)
@@ -119,7 +119,7 @@ cpu_fetch_syscall_args(struct thread *td
sa-narg = sa-callp-sy_narg;
memcpy(sa-args, ap, nap * sizeof(register_t));
if (sa-narg  nap)
-   panic(ARM64TODO: Could we have more then 8 args?);
+   panic(ARM64TODO: Could we have more than 8 args?);
 
td-td_retval[0] = 0;
td-td_retval[1] = 0;

Modified: head/sys/geom/raid/md_intel.c
==
--- head/sys/geom/raid/md_intel.c   Tue Aug 11 02:58:33 2015
(r286614)
+++ head/sys/geom/raid/md_intel.c   Tue Aug 11 03:12:09 2015
(r286615)
@@ -991,7 +991,7 @@ nofit:
if (olddisk == NULL)
panic(No disk at position %d!, disk_pos);
if (olddisk-d_state != G_RAID_DISK_S_OFFLINE) {
-   G_RAID_DEBUG1(1, sc, More then one disk for pos %d,
+   G_RAID_DEBUG1(1, sc, More than one disk for pos %d,
disk_pos);
g_raid_change_disk_state(disk, G_RAID_DISK_S_STALE);
return (0);

Modified: head/sys/geom/raid/md_jmicron.c
==
--- head/sys/geom/raid/md_jmicron.c Tue Aug 11 02:58:33 2015
(r286614)
+++ head/sys/geom/raid/md_jmicron.c Tue Aug 11 03:12:09 2015
(r286615)
@@ -494,7 +494,7 @@ nofit:
if (olddisk == NULL)
panic(No disk at position %d!, disk_pos);
if (olddisk-d_state != G_RAID_DISK_S_OFFLINE) {
-   G_RAID_DEBUG1(1, sc, More then one disk for pos %d,
+   G_RAID_DEBUG1(1, sc, More than one disk for pos %d,
disk_pos);
g_raid_change_disk_state(disk, G_RAID_DISK_S_STALE);
return (0);

Modified: head/sys/geom/raid/md_nvidia.c
==
--- head/sys/geom/raid/md_nvidia.c  Tue Aug 11 02:58:33 2015
(r286614)
+++ head/sys/geom/raid/md_nvidia.c  Tue Aug 11 03:12:09 2015
(r286615)
@@ -498,7 +498,7 @@ nofit:
if (olddisk == NULL)
panic(No disk at position %d!, disk_pos);
if (olddisk-d_state != G_RAID_DISK_S_OFFLINE) {
-   G_RAID_DEBUG1(1, sc, More then one disk for pos %d,
+   G_RAID_DEBUG1(1, sc, More than one disk for pos %d,
disk_pos);
g_raid_change_disk_state(disk, G_RAID_DISK_S_STALE);
return (0);

Modified: head/sys/geom/raid/md_sii.c
==
--- head/sys/geom/raid/md_sii.c Tue Aug 11 02:58:33 2015(r286614)
+++ head/sys/geom/raid/md_sii.c Tue Aug 11 03:12:09 2015(r286615)
@@ -549,7 +549,7 @@ nofit:
if (olddisk == NULL)
panic(No disk at position %d!, disk_pos);
if (olddisk-d_state != G_RAID_DISK_S_OFFLINE) {
-   G_RAID_DEBUG1(1, sc, More then one disk for pos %d,
+   G_RAID_DEBUG1(1, sc, More than one disk for pos %d,
disk_pos);
g_raid_change_disk_state(disk, G_RAID_DISK_S_STALE);
return (0);

Modified: head/usr.bin/wc/wc.1
==
--- head/usr.bin/wc/wc.1Tue Aug 11 02:58:33 2015(r286614)
+++ head/usr.bin/wc/wc.1Tue Aug 11 03:12:09 2015(r286615)
@@ 

svn commit: r286614 - in head/usr.bin/xlint: lint1 lint2

2015-08-10 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Aug 11 02:58:33 2015
New Revision: 286614
URL: https://svnweb.freebsd.org/changeset/base/286614

Log:
  xlint(1): Fix some typos in comments and translate some german
  
  No functional change.
  
  Obtained from:OpenBSD (where xlint is no more)

Modified:
  head/usr.bin/xlint/lint1/decl.c
  head/usr.bin/xlint/lint1/func.c
  head/usr.bin/xlint/lint1/init.c
  head/usr.bin/xlint/lint1/lint.h
  head/usr.bin/xlint/lint1/lint1.h
  head/usr.bin/xlint/lint1/scan.l
  head/usr.bin/xlint/lint1/tree.c
  head/usr.bin/xlint/lint2/read.c

Modified: head/usr.bin/xlint/lint1/decl.c
==
--- head/usr.bin/xlint/lint1/decl.c Tue Aug 11 02:30:54 2015
(r286613)
+++ head/usr.bin/xlint/lint1/decl.c Tue Aug 11 02:58:33 2015
(r286614)
@@ -127,7 +127,7 @@ initdecl(void)
 /*
  * Returns a shared type structure vor arithmetic types and void.
  *
- * It's important do duplicate this structure (using duptyp() or tdupdyp())
+ * It's important to duplicate this structure (using duptyp() or tdupdyp())
  * if it is to be modified (adding qualifiers or anything else).
  */
 type_t *
@@ -803,7 +803,7 @@ length(type_t *tp, const char *name)
 }
 
 /*
- * Get the alignment of the given Type in bits.
+ * Get the alignment of the given type in bits.
  */
 int
 getbound(type_t *tp)
@@ -984,8 +984,8 @@ decl1str(sym_t *dsym)
/*
 * bit field
 *
-* only unsigned und signed int are protable bit-field types
-*(at least in ANSI C, in traditional C only unsigned int)
+* only unsigned and signed int are portable bit-field types
+* (at least in ANSI C, in traditional C only unsigned int)
 */
if (t == CHAR || t == UCHAR || t == SCHAR ||
t == SHORT || t == USHORT || t == ENUM) {
@@ -1173,7 +1173,7 @@ mergepq(pqinf_t *p1, pqinf_t *p2)
  * Followint 3 functions extend the type of a declarator with
  * pointer, function and array types.
  *
- * The current type is the Type built by deftyp() (dcs-d_type) and
+ * The current type is the type built by deftyp() (dcs-d_type) and
  * pointer, function and array types already added for this
  * declarator. The new type extension is inserted between both.
  */
@@ -1559,7 +1559,7 @@ mktag(sym_t *tag, tspec_t kind, int decl
tp-t_enum = getblk(sizeof (enum_t));
tp-t_enum-etag = tag;
}
-   /* ist unvollstaendiger Typ */
+   /* is incomplete type */
setcompl(tp, 1);
}
 
@@ -1769,7 +1769,7 @@ decl1ext(sym_t *dsym, int initflg)
if (plibflg  llibflg 
dsym-s_type-t_tspec == FUNC  dsym-s_type-t_proto) {
/*
-* With both LINTLIBRARY and PROTOLIB the prototyp is
+* With both LINTLIBRARY and PROTOLIB the prototype is
 * written as a function definition to the output file.
 */
rval = dsym-s_type-t_subt-t_tspec != VOID;
@@ -1800,7 +1800,7 @@ decl1ext(sym_t *dsym, int initflg)
}
 
/*
-* Overtake the rememberd params if the new symbol
+* Overtake the remembered params if the new symbol
 * is not a prototype.
 */
if (rdsym-s_osdef  !dsym-s_type-t_proto) {
@@ -1912,7 +1912,7 @@ isredec(sym_t *dsym, int *warn)
return(0);
if (rsym-s_scl == EXTERN  rsym-s_def == DEF) {
/*
-* All cases except int a = 1; static int a; are catched
+* All cases except int a = 1; static int a; are caught
 * above with or without a warning
 */
/* redeclaration of %s */
@@ -2125,7 +2125,7 @@ chkosdef(sym_t *rdsym, sym_t *dsym)
 }
 
 /*
- * Complets a type by copying the dimension and prototype information
+ * Completes a type by copying the dimension and prototype information
  * from a second compatible type.
  *
  * Following lines are legal:
@@ -2150,7 +2150,7 @@ compltyp(sym_t *dsym, sym_t *ssym)
if (dst-t_dim == 0  src-t_dim != 0) {
*dstp = dst = duptyp(dst);
dst-t_dim = src-t_dim;
-   /* now a complete Typ */
+   /* now a complete type */
setcompl(dst, 0);
}
} else if (dst-t_tspec == FUNC) {
@@ -2229,7 +2229,7 @@ decl1arg(sym_t *sym, int initflg)
  * Does some checks for lint directives which apply to functions.
  * Processes arguments in old style function definitions which default
  * to int.
- * Checks compatiblility of old style function definition 

svn commit: r286531 - head/sys/sys

2015-08-09 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Aug  9 15:38:32 2015
New Revision: 286531
URL: https://svnweb.freebsd.org/changeset/base/286531

Log:
  cdefs: reduce code duplication

Modified:
  head/sys/sys/cdefs.h

Modified: head/sys/sys/cdefs.h
==
--- head/sys/sys/cdefs.hSun Aug  9 15:22:37 2015(r286530)
+++ head/sys/sys/cdefs.hSun Aug  9 15:38:32 2015(r286531)
@@ -227,16 +227,7 @@
 #define__unused
 /* XXX Find out what to do for __packed, __aligned and __section */
 #endif
-#if __GNUC_PREREQ__(2, 7)
-#define__dead2 __attribute__((__noreturn__))
-#define__pure2 __attribute__((__const__))
-#define__unused__attribute__((__unused__))
-#define__used  __attribute__((__used__))
-#define__packed__attribute__((__packed__))
-#define__aligned(x)__attribute__((__aligned__(x)))
-#define__section(x)__attribute__((__section__(x)))
-#endif
-#if defined(__INTEL_COMPILER)
+#if __GNUC_PREREQ__(2, 7) || defined(__INTEL_COMPILER)
 #define__dead2 __attribute__((__noreturn__))
 #define__pure2 __attribute__((__const__))
 #define__unused__attribute__((__unused__))
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286268 - head/usr.bin/wall

2015-08-03 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Aug  4 02:56:31 2015
New Revision: 286268
URL: https://svnweb.freebsd.org/changeset/base/286268

Log:
  Revert r286144 leaving the original fix to the buffer overflow.
  
  Some developers consider the new code unnecessarily obfuscated.
  There was also a benign off-by-one.
  
  Discussed with:   bde, vangyzen, jmallett

Modified:
  head/usr.bin/wall/ttymsg.c

Modified: head/usr.bin/wall/ttymsg.c
==
--- head/usr.bin/wall/ttymsg.c  Tue Aug  4 02:41:14 2015(r286267)
+++ head/usr.bin/wall/ttymsg.c  Tue Aug  4 02:56:31 2015(r286268)
@@ -62,7 +62,7 @@ ttymsg(struct iovec *iov, int iovcnt, co
struct iovec localiov[7];
ssize_t left, wret;
int cnt, fd;
-   char device[MAXNAMLEN];
+   char device[MAXNAMLEN] = _PATH_DEV;
static char errbuf[1024];
char *p;
int forked;
@@ -71,9 +71,8 @@ ttymsg(struct iovec *iov, int iovcnt, co
if (iovcnt  (int)(sizeof(localiov) / sizeof(localiov[0])))
return (too many iov's (change code in wall/ttymsg.c));
 
-   strlcpy(device, _PATH_DEV, sizeof(device));
+   strlcat(device, line, sizeof(device));
p = device + sizeof(_PATH_DEV) - 1;
-   strlcpy(p, line, sizeof(device) - sizeof(_PATH_DEV));
if (strncmp(p, pts/, 4) == 0)
p += 4;
if (strchr(p, '/') != NULL) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286144 - head/usr.bin/wall

2015-07-31 Thread Pedro F. Giffuni
Author: pfg
Date: Sat Aug  1 01:29:55 2015
New Revision: 286144
URL: https://svnweb.freebsd.org/changeset/base/286144

Log:
  Buffer overflow in wall(1).
  
  Revert r286102 and apply a cleaner fix.
  Tested for overflows by FORTIFY_SOURCE GSoC (with clang).
  
  Suggested by: bde
  Reviewed by:  Oliver Pinter
  Tested by:Oliver Pinter
  MFC after:3 days

Modified:
  head/usr.bin/wall/ttymsg.c

Modified: head/usr.bin/wall/ttymsg.c
==
--- head/usr.bin/wall/ttymsg.c  Fri Jul 31 23:40:18 2015(r286143)
+++ head/usr.bin/wall/ttymsg.c  Sat Aug  1 01:29:55 2015(r286144)
@@ -62,7 +62,7 @@ ttymsg(struct iovec *iov, int iovcnt, co
struct iovec localiov[7];
ssize_t left, wret;
int cnt, fd;
-   char device[MAXNAMLEN] = _PATH_DEV;
+   char device[MAXNAMLEN];
static char errbuf[1024];
char *p;
int forked;
@@ -71,8 +71,9 @@ ttymsg(struct iovec *iov, int iovcnt, co
if (iovcnt  (int)(sizeof(localiov) / sizeof(localiov[0])))
return (too many iov's (change code in wall/ttymsg.c));
 
-   strlcat(device, line, sizeof(device));
+   strlcpy(device, _PATH_DEV, sizeof(device));
p = device + sizeof(_PATH_DEV) - 1;
+   strlcpy(p, line, sizeof(device) - sizeof(_PATH_DEV));
if (strncmp(p, pts/, 4) == 0)
p += 4;
if (strchr(p, '/') != NULL) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r286074 - in head/contrib/gcc: . doc

2015-07-30 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Jul 30 14:31:09 2015
New Revision: 286074
URL: https://svnweb.freebsd.org/changeset/base/286074

Log:
  GCC: Add a new option -fstack-protector-strong
  
  This includes additional functions to be protected: those that
  have local array definitions, or have references to local frame
  addresses. This is a new option in GCC-4.9 that was relicensed
  by Han Shen from Google under GPLv2 for OpenBSD.
  
  Obtained from:OpenBSD (2014-01-14)
  MFC after:2 weeks

Modified:
  head/contrib/gcc/c-cppbuiltin.c
  head/contrib/gcc/cfgexpand.c
  head/contrib/gcc/common.opt
  head/contrib/gcc/doc/cpp.texi
  head/contrib/gcc/doc/gcc.1
  head/contrib/gcc/doc/invoke.texi
  head/contrib/gcc/gcc.c

Modified: head/contrib/gcc/c-cppbuiltin.c
==
--- head/contrib/gcc/c-cppbuiltin.c Thu Jul 30 14:20:36 2015
(r286073)
+++ head/contrib/gcc/c-cppbuiltin.c Thu Jul 30 14:31:09 2015
(r286074)
@@ -553,7 +553,9 @@ c_cpp_builtins (cpp_reader *pfile)
   /* Make the choice of the stack protector runtime visible to source code.
  The macro names and values here were chosen for compatibility with an
  earlier implementation, i.e. ProPolice.  */
-  if (flag_stack_protect == 2)
+  if (flag_stack_protect == 3)
+cpp_define (pfile, __SSP_STRONG__=3);
+  else if (flag_stack_protect == 2)
 cpp_define (pfile, __SSP_ALL__=2);
   else if (flag_stack_protect == 1)
 cpp_define (pfile, __SSP__=1);

Modified: head/contrib/gcc/cfgexpand.c
==
--- head/contrib/gcc/cfgexpand.cThu Jul 30 14:20:36 2015
(r286073)
+++ head/contrib/gcc/cfgexpand.cThu Jul 30 14:31:09 2015
(r286074)
@@ -810,6 +810,12 @@ clear_tree_used (tree block)
 clear_tree_used (t);
 }
 
+enum {
+  SPCT_FLAG_DEFAULT = 1,
+  SPCT_FLAG_ALL = 2,
+  SPCT_FLAG_STRONG = 3
+};
+
 /* Examine TYPE and determine a bit mask of the following features.  */
 
 #define SPCT_HAS_LARGE_CHAR_ARRAY  1
@@ -879,7 +885,8 @@ stack_protect_decl_phase (tree decl)
   if (bits  SPCT_HAS_SMALL_CHAR_ARRAY)
 has_short_buffer = true;
 
-  if (flag_stack_protect == 2)
+  if (flag_stack_protect == SPCT_FLAG_ALL
+  || flag_stack_protect == SPCT_FLAG_STRONG)
 {
   if ((bits  (SPCT_HAS_SMALL_CHAR_ARRAY | SPCT_HAS_LARGE_CHAR_ARRAY))
   !(bits  SPCT_HAS_AGGREGATE))
@@ -947,12 +954,36 @@ create_stack_guard (void)
   cfun-stack_protect_guard = guard;
 }
 
+/* Helper routine to check if a record or union contains an array field. */
+
+static int
+record_or_union_type_has_array_p (tree tree_type)
+{
+  tree fields = TYPE_FIELDS (tree_type);
+  tree f;
+
+  for (f = fields; f; f = TREE_CHAIN (f))
+if (TREE_CODE (f) == FIELD_DECL)
+  {
+   tree field_type = TREE_TYPE (f);
+   if ((TREE_CODE (field_type) == RECORD_TYPE
+|| TREE_CODE (field_type) == UNION_TYPE
+|| TREE_CODE (field_type) == QUAL_UNION_TYPE)
+record_or_union_type_has_array_p (field_type))
+ return 1;
+   if (TREE_CODE (field_type) == ARRAY_TYPE)
+ return 1;
+  }
+  return 0;
+}
+
 /* Expand all variables used in the function.  */
 
 static void
 expand_used_vars (void)
 {
   tree t, outer_block = DECL_INITIAL (current_function_decl);
+  bool gen_stack_protect_signal = false;
 
   /* Compute the phase of the stack frame for this function.  */
   {
@@ -972,6 +1003,29 @@ expand_used_vars (void)
   has_protected_decls = false;
   has_short_buffer = false;
 
+  if (flag_stack_protect == SPCT_FLAG_STRONG)
+for (t = cfun-unexpanded_var_list; t; t = TREE_CHAIN (t))
+  {
+   tree var = TREE_VALUE (t);
+   if (!is_global_var (var))
+ {
+   tree var_type = TREE_TYPE (var);
+   /* Examine local referenced variables that have their addresses
+* taken, contain an array, or are arrays. */
+   if (TREE_CODE (var) == VAR_DECL
+(TREE_CODE (var_type) == ARRAY_TYPE
+   || TREE_ADDRESSABLE (var)
+   || ((TREE_CODE (var_type) == RECORD_TYPE
+|| TREE_CODE (var_type) == UNION_TYPE
+|| TREE_CODE (var_type) == QUAL_UNION_TYPE)
+record_or_union_type_has_array_p (var_type
+ {
+   gen_stack_protect_signal = true;
+   break;
+ }
+ }
+  }
+
   /* At this point all variables on the unexpanded_var_list with TREE_USED
  set are not associated with any block scope.  Lay them out.  */
   for (t = cfun-unexpanded_var_list; t; t = TREE_CHAIN (t))
@@ -1032,12 +1086,26 @@ expand_used_vars (void)
dump_stack_var_partition ();
 }
 
-  /* There are several conditions under which we should create a
- stack guard: protect-all, alloca used, protected decls present.  */
-  if (flag_stack_protect == 2

svn commit: r286102 - head/usr.bin/wall

2015-07-30 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Jul 31 01:12:31 2015
New Revision: 286102
URL: https://svnweb.freebsd.org/changeset/base/286102

Log:
  Buffer overflow in wall(1).
  
  This affected syslogd, wall and talkd.
  Detected by FORTIFY_SOURCE GSoC (with clang).
  
  Submitted by: Oliver Pinter
  Differential Revision:https://reviews.freebsd.org/D3254
  Reviewed by:  delphij, jmg
  MFC after:3 days

Modified:
  head/usr.bin/wall/ttymsg.c

Modified: head/usr.bin/wall/ttymsg.c
==
--- head/usr.bin/wall/ttymsg.c  Fri Jul 31 00:31:52 2015(r286101)
+++ head/usr.bin/wall/ttymsg.c  Fri Jul 31 01:12:31 2015(r286102)
@@ -62,7 +62,7 @@ ttymsg(struct iovec *iov, int iovcnt, co
struct iovec localiov[7];
ssize_t left, wret;
int cnt, fd;
-   static char device[MAXNAMLEN] = _PATH_DEV;
+   char device[MAXNAMLEN] = _PATH_DEV;
static char errbuf[1024];
char *p;
int forked;
@@ -71,8 +71,8 @@ ttymsg(struct iovec *iov, int iovcnt, co
if (iovcnt  (int)(sizeof(localiov) / sizeof(localiov[0])))
return (too many iov's (change code in wall/ttymsg.c));
 
+   strlcat(device, line, sizeof(device));
p = device + sizeof(_PATH_DEV) - 1;
-   strlcpy(p, line, sizeof(device));
if (strncmp(p, pts/, 4) == 0)
p += 4;
if (strchr(p, '/') != NULL) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r285884 - in head: lib/libiconv_modules/BIG5 lib/libiconv_modules/EUC lib/libiconv_modules/EUCTW lib/libiconv_modules/UTF1632 lib/libiconv_modules/UTF7 lib/libiconv_modules/iconv_std us...

2015-07-25 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Jul 26 00:11:04 2015
New Revision: 285884
URL: https://svnweb.freebsd.org/changeset/base/285884

Log:
  Bump GCC max-inline-insns-single in libiconv_modules and grep
  
  This is required by our FORTIFY_SOURCE implementation as it
  does more inlining. As a rule of thumb, FORTIFY_SOURCE doubles
  the number  of inlines except that in grep inlining
  blows up for some reason.

Modified:
  head/lib/libiconv_modules/BIG5/Makefile
  head/lib/libiconv_modules/EUC/Makefile
  head/lib/libiconv_modules/EUCTW/Makefile
  head/lib/libiconv_modules/UTF1632/Makefile
  head/lib/libiconv_modules/UTF7/Makefile
  head/lib/libiconv_modules/iconv_std/Makefile
  head/usr.bin/grep/Makefile

Modified: head/lib/libiconv_modules/BIG5/Makefile
==
--- head/lib/libiconv_modules/BIG5/Makefile Sat Jul 25 20:17:19 2015
(r285883)
+++ head/lib/libiconv_modules/BIG5/Makefile Sun Jul 26 00:11:04 2015
(r285884)
@@ -2,6 +2,6 @@
 
 SHLIB= BIG5
 SRCS+= citrus_big5.c
-CFLAGS.gcc+= --param max-inline-insns-single=32
+CFLAGS.gcc+= --param max-inline-insns-single=64
 
 .include bsd.lib.mk

Modified: head/lib/libiconv_modules/EUC/Makefile
==
--- head/lib/libiconv_modules/EUC/Makefile  Sat Jul 25 20:17:19 2015
(r285883)
+++ head/lib/libiconv_modules/EUC/Makefile  Sun Jul 26 00:11:04 2015
(r285884)
@@ -2,6 +2,6 @@
 
 SHLIB= EUC
 SRCS+= citrus_euc.c
-CFLAGS.gcc+= --param max-inline-insns-single=32
+CFLAGS.gcc+= --param max-inline-insns-single=64
 
 .include bsd.lib.mk

Modified: head/lib/libiconv_modules/EUCTW/Makefile
==
--- head/lib/libiconv_modules/EUCTW/MakefileSat Jul 25 20:17:19 2015
(r285883)
+++ head/lib/libiconv_modules/EUCTW/MakefileSun Jul 26 00:11:04 2015
(r285884)
@@ -2,6 +2,6 @@
 
 SHLIB= EUCTW
 SRCS+= citrus_euctw.c
-CFLAGS.gcc+= --param max-inline-insns-single=32
+CFLAGS.gcc+= --param max-inline-insns-single=64
 
 .include bsd.lib.mk

Modified: head/lib/libiconv_modules/UTF1632/Makefile
==
--- head/lib/libiconv_modules/UTF1632/Makefile  Sat Jul 25 20:17:19 2015
(r285883)
+++ head/lib/libiconv_modules/UTF1632/Makefile  Sun Jul 26 00:11:04 2015
(r285884)
@@ -2,6 +2,6 @@
 
 SHLIB= UTF1632
 SRCS+= citrus_utf1632.c
-CFLAGS.gcc+= --param max-inline-insns-single=32
+CFLAGS.gcc+= --param max-inline-insns-single=64
 
 .include bsd.lib.mk

Modified: head/lib/libiconv_modules/UTF7/Makefile
==
--- head/lib/libiconv_modules/UTF7/Makefile Sat Jul 25 20:17:19 2015
(r285883)
+++ head/lib/libiconv_modules/UTF7/Makefile Sun Jul 26 00:11:04 2015
(r285884)
@@ -2,6 +2,6 @@
 
 SHLIB= UTF7
 SRCS+= citrus_utf7.c
-CFLAGS.gcc+= --param max-inline-insns-single=32
+CFLAGS.gcc+= --param max-inline-insns-single=64
 
 .include bsd.lib.mk

Modified: head/lib/libiconv_modules/iconv_std/Makefile
==
--- head/lib/libiconv_modules/iconv_std/MakefileSat Jul 25 20:17:19 
2015(r285883)
+++ head/lib/libiconv_modules/iconv_std/MakefileSun Jul 26 00:11:04 
2015(r285884)
@@ -2,6 +2,6 @@
 
 SHLIB= iconv_std
 SRCS+= citrus_iconv_std.c
-CFLAGS.gcc+= --param max-inline-insns-single=32
+CFLAGS.gcc+= --param max-inline-insns-single=64
 
 .include bsd.lib.mk

Modified: head/usr.bin/grep/Makefile
==
--- head/usr.bin/grep/Makefile  Sat Jul 25 20:17:19 2015(r285883)
+++ head/usr.bin/grep/Makefile  Sun Jul 26 00:11:04 2015(r285884)
@@ -20,6 +20,8 @@ SRCS= file.c grep.c queue.c util.c
 SRCS+= fastmatch.c hashtable.c tre-compile.c tre-fastmatch.c xmalloc.c
 CFLAGS+=-I${.CURDIR}/regex
 
+CFLAGS.gcc+= --param max-inline-insns-single=500
+
 .if ${MK_BSD_GREP} == yes
 LINKS= ${BINDIR}/grep ${BINDIR}/egrep \
${BINDIR}/grep ${BINDIR}/fgrep \
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r285719 - head/usr.sbin/bsnmpd/modules/snmp_hostres

2015-07-20 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Jul 20 16:08:01 2015
New Revision: 285719
URL: https://svnweb.freebsd.org/changeset/base/285719

Log:
  snmp_hostres(3): Fix buffer overflow.
  
  Actually just a typo. Detected by gcc + FORTIFY_SOURCE patches.
  
  CID:  1007594
  MFC after:3 days

Modified:
  head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_printer_tbl.c

Modified: head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_printer_tbl.c
==
--- head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_printer_tbl.c Mon Jul 
20 14:40:34 2015(r285718)
+++ head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_printer_tbl.c Mon Jul 
20 16:08:01 2015(r285719)
@@ -175,7 +175,7 @@ get_printer_status(const struct printer 
goto LABEL_DONE;
}
 
-   memset(fline[0], '\0', sizeof(line));
+   memset(fline[0], '\0', sizeof(fline));
if (fgets(fline, sizeof(fline) -1, f) == NULL) {
ps = PS_UNKNOWN;
goto LABEL_DONE;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r285720 - head/lib/libusb

2015-07-20 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Jul 20 16:15:56 2015
New Revision: 285720
URL: https://svnweb.freebsd.org/changeset/base/285720

Log:
  libusb: Fix minor cast-qual warning.
  
  Fix a warning triggered by the gcc + FORTIFY_SOURCE patches:
  
  In function 'libusb20_parse_config_desc': lib/libusb/libusb20_desc.c:141:
  warning: passing argument 1 of 'memcpy' discards qualifiers from pointer
  target type
  
  Submitted by: hselansky

Modified:
  head/lib/libusb/libusb20_desc.c

Modified: head/lib/libusb/libusb20_desc.c
==
--- head/lib/libusb/libusb20_desc.c Mon Jul 20 16:08:01 2015
(r285719)
+++ head/lib/libusb/libusb20_desc.c Mon Jul 20 16:15:56 2015
(r285720)
@@ -137,15 +137,13 @@ libusb20_parse_config_desc(const void *c
 * Make a copy of the config descriptor, so that the caller can free
 * the inital config descriptor pointer!
 */
-   ptr = (void *)(lub_endpoint + nendpoint);
-   memcpy(LIBUSB20_ADD_BYTES(ptr, 0), config_desc, pcdesc.len);
+   memcpy((void *)(lub_endpoint + nendpoint), config_desc, pcdesc.len);
+
+   ptr = (const void *)(lub_endpoint + nendpoint);
pcdesc.ptr = LIBUSB20_ADD_BYTES(ptr, 0);
-   config_desc = LIBUSB20_ADD_BYTES(ptr, 0);
 
/* init config structure */
 
-   ptr = config_desc;
-
LIBUSB20_INIT(LIBUSB20_CONFIG_DESC, lub_config-desc);
 
if (libusb20_me_decode(ptr, ptr[0], lub_config-desc)) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r285644 - head/contrib/sqlite3

2015-07-16 Thread Pedro F. Giffuni
Author: pfg
Date: Thu Jul 16 22:07:13 2015
New Revision: 285644
URL: https://svnweb.freebsd.org/changeset/base/285644

Log:
  sqlite: clean a couple of invocations of memcpy(3)
  
  Found almost accidentally by our native gcc when enhanced with
  FORTIFY_SOURCE.
  
  Submitted by: Oliver Pinter
  Sponosored by:Google Inc. GSoC 2015

Modified:
  head/contrib/sqlite3/sqlite3.c

Modified: head/contrib/sqlite3/sqlite3.c
==
--- head/contrib/sqlite3/sqlite3.c  Thu Jul 16 19:40:18 2015
(r285643)
+++ head/contrib/sqlite3/sqlite3.c  Thu Jul 16 22:07:13 2015
(r285644)
@@ -49487,9 +49487,9 @@ static void walIndexWriteHdr(Wal *pWal){
   pWal-hdr.isInit = 1;
   pWal-hdr.iVersion = WALINDEX_MAX_VERSION;
   walChecksumBytes(1, (u8*)pWal-hdr, nCksum, 0, pWal-hdr.aCksum);
-  memcpy((void *)aHdr[1], (void *)pWal-hdr, sizeof(WalIndexHdr));
+  memcpy((void *)aHdr[1], (const void *)pWal-hdr, sizeof(WalIndexHdr));
   walShmBarrier(pWal);
-  memcpy((void *)aHdr[0], (void *)pWal-hdr, sizeof(WalIndexHdr));
+  memcpy((void *)aHdr[0], (const void *)pWal-hdr, sizeof(WalIndexHdr));
 }
 
 /*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r285277 - head/include

2015-07-08 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Jul  8 16:21:10 2015
New Revision: 285277
URL: https://svnweb.freebsd.org/changeset/base/285277

Log:
  Use the __sentinel attribute.
  
  Start using the gcc sentinel attribute, which can be used to
  mark varargs function that need a NULL pointer to mark argument
  termination, like execl(3).
  
  Relnotes: yes

Modified:
  head/include/unistd.h

Modified: head/include/unistd.h
==
--- head/include/unistd.h   Wed Jul  8 16:20:20 2015(r285276)
+++ head/include/unistd.h   Wed Jul  8 16:21:10 2015(r285277)
@@ -327,9 +327,9 @@ int  close(int);
 voidclosefrom(int);
 int dup(int);
 int dup2(int, int);
-int execl(const char *, const char *, ...);
+int execl(const char *, const char *, ...) __sentinel;
 int execle(const char *, const char *, ...);
-int execlp(const char *, const char *, ...);
+int execlp(const char *, const char *, ...) __sentinel;
 int execv(const char *, char * const *);
 int execve(const char *, char * const *, char * const *);
 int execvp(const char *, char * const *);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r285278 - head/lib/libthr/thread

2015-07-08 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Jul  8 16:35:24 2015
New Revision: 285278
URL: https://svnweb.freebsd.org/changeset/base/285278

Log:
  cosmetic: whitespaces-tab before EOL
  
  Obtained from:cpi-llvm project

Modified:
  head/lib/libthr/thread/thr_create.c

Modified: head/lib/libthr/thread/thr_create.c
==
--- head/lib/libthr/thread/thr_create.c Wed Jul  8 16:21:10 2015
(r285277)
+++ head/lib/libthr/thread/thr_create.c Wed Jul  8 16:35:24 2015
(r285278)
@@ -165,7 +165,7 @@ _pthread_create(pthread_t * thread, cons
param.flags |= THR_SYSTEM_SCOPE;
if (new_thread-attr.sched_inherit == PTHREAD_INHERIT_SCHED)
param.rtp = NULL;
-   else {   
+   else {
sched_param.sched_priority = new_thread-attr.prio;
_schedparam_to_rtp(new_thread-attr.sched_policy,
sched_param, rtp);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r284913 - head/usr.sbin/dconschat

2015-06-28 Thread Pedro F. Giffuni
Author: pfg
Date: Sun Jun 28 20:32:03 2015
New Revision: 284913
URL: https://svnweb.freebsd.org/changeset/base/284913

Log:
  dconschat(8): Use NULL instead of 0 for the last argument in execl(3)
  
  Found while experimenting with the gcc sentinel attribute.
  
  MFC after:3 days

Modified:
  head/usr.sbin/dconschat/dconschat.c

Modified: head/usr.sbin/dconschat/dconschat.c
==
--- head/usr.sbin/dconschat/dconschat.c Sun Jun 28 16:43:07 2015
(r284912)
+++ head/usr.sbin/dconschat/dconschat.c Sun Jun 28 20:32:03 2015
(r284913)
@@ -229,7 +229,7 @@ dconschat_fork_gdb(struct dcons_state *d
snprintf(buf, 256, \n[fork %s]\n, com);
write(p-outfd, buf, strlen(buf));
 
-   execl(/bin/sh, /bin/sh, -c, com, 0);
+   execl(/bin/sh, /bin/sh, -c, com, NULL);
 
snprintf(buf, 256, \n[fork failed]\n);
write(p-outfd, buf, strlen(buf));
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r284917 - head/sys/sys

2015-06-28 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Jun 29 00:30:30 2015
New Revision: 284917
URL: https://svnweb.freebsd.org/changeset/base/284917

Log:
  Add a new __sentinel attribute.
  
  The sentinel attribute was originally implemented in OpenBSD's gcc and
  later adopted by upstream GCC 4.0 (and clang). From the OpenBSD's
  gcc-local manpage:
  
  -   gcc recognizes the extra attribute __sentinel__, which can be used to
  mark varargs function that need a NULL pointer to mark argument
  termination, like execl(3).  This exposes latent bugs for 64-bit
  architectures, where a terminating 0 will expand to a 32-bit int, and
  not a full-fledged 64-bits pointer.
  
  While here sort the visibility attributes.
  
  Hinted-by:OpenBSD

Modified:
  head/sys/sys/cdefs.h

Modified: head/sys/sys/cdefs.h
==
--- head/sys/sys/cdefs.hSun Jun 28 21:36:00 2015(r284916)
+++ head/sys/sys/cdefs.hMon Jun 29 00:30:30 2015(r284917)
@@ -469,11 +469,13 @@
 #endif
 
 #if __GNUC_PREREQ__(4, 0)
-#define__hidden__attribute__((__visibility__(hidden)))
+#define__sentinel  __attribute__((__sentinel__))
 #define__exported  __attribute__((__visibility__(default)))
+#define__hidden__attribute__((__visibility__(hidden)))
 #else
-#define__hidden
+#define__sentinel
 #define__exported
+#define__hidden
 #endif
 
 /*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r284890 - head/sys/sys

2015-06-27 Thread Pedro F. Giffuni
Author: pfg
Date: Sat Jun 27 15:13:14 2015
New Revision: 284890
URL: https://svnweb.freebsd.org/changeset/base/284890

Log:
  Change detection for the gnu_inline attribute.
  
  According to the GCC documentation:
  This attribute is available in GCC 4.1.3 and later. It is available
  if either of the preprocessor macros __GNUC_GNU_INLINE__ or
  __GNUC_STDC_INLINE__ are defined.
  
  We don't keep the gcc granularity up to the minor number so it's
  better to use the documented way. Current clang defines both
  macros.
  
  Reference:
  
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes

Modified:
  head/sys/sys/cdefs.h

Modified: head/sys/sys/cdefs.h
==
--- head/sys/sys/cdefs.hSat Jun 27 12:37:09 2015(r284889)
+++ head/sys/sys/cdefs.hSat Jun 27 15:13:14 2015(r284890)
@@ -542,7 +542,7 @@
  * using these but GCC-compatible compilers tend to support the extensions
  * well enough to use them in limited cases.
  */ 
-#if __GNUC_PREREQ__(4, 1)
+#if defined(__GNUC_GNU_INLINE__) || defined(__GNUC_STDC_INLINE__)
 #if __has_attribute(artificial) || __GNUC_PREREQ__(4, 3)
 #define__gnu_inline__attribute__((__gnu_inline__, __artificial__))
 #else
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r284462 - head/sys/kern

2015-06-16 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Jun 16 20:19:00 2015
New Revision: 284462
URL: https://svnweb.freebsd.org/changeset/base/284462

Log:
  Use nitems() macro instead of __arraycount()

Modified:
  head/sys/kern/stack_protector.c

Modified: head/sys/kern/stack_protector.c
==
--- head/sys/kern/stack_protector.c Tue Jun 16 20:01:01 2015
(r284461)
+++ head/sys/kern/stack_protector.c Tue Jun 16 20:19:00 2015
(r284462)
@@ -17,15 +17,14 @@ __stack_chk_fail(void)
panic(stack overflow detected; backtrace may be corrupted);
 }
 
-#define __arraycount(__x)  (sizeof(__x) / sizeof(__x[0]))
 static void
 __stack_chk_init(void *dummy __unused)
 {
size_t i;
-   long guard[__arraycount(__stack_chk_guard)];
+   long guard[nitems(__stack_chk_guard)];
 
arc4rand(guard, sizeof(guard), 0);
-   for (i = 0; i  __arraycount(guard); i++)
+   for (i = 0; i  nitems(guard); i++)
__stack_chk_guard[i] = guard[i];
 }
 SYSINIT(stack_chk, SI_SUB_RANDOM, SI_ORDER_ANY, __stack_chk_init, NULL);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r283669 - head/sys/fs/ext2fs

2015-05-28 Thread Pedro F. Giffuni
Author: pfg
Date: Thu May 28 21:06:59 2015
New Revision: 283669
URL: https://svnweb.freebsd.org/changeset/base/283669

Log:
  Provide VOP_GETPAGES_ASYNC() for extfs.
  
  Merge the filesystem specific part from r274914 to ext2fs.
  
  I only did regular testing with the change but UFS and our ext2fs
  are similar enough that the code should just work with the new
  sendfile.
  
  Discussed with:   glebius

Modified:
  head/sys/fs/ext2fs/ext2_vnops.c

Modified: head/sys/fs/ext2fs/ext2_vnops.c
==
--- head/sys/fs/ext2fs/ext2_vnops.c Thu May 28 20:56:11 2015
(r283668)
+++ head/sys/fs/ext2fs/ext2_vnops.c Thu May 28 21:06:59 2015
(r283669)
@@ -128,6 +128,7 @@ struct vop_vector ext2_vnodeops = {
.vop_create =   ext2_create,
.vop_fsync =ext2_fsync,
.vop_getpages = vnode_pager_local_getpages,
+   .vop_getpages_async =   vnode_pager_local_getpages_async,
.vop_getattr =  ext2_getattr,
.vop_inactive = ext2_inactive,
.vop_ioctl =ext2_ioctl,
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r283315 - head/sys/ddb

2015-05-23 Thread Pedro F. Giffuni
Author: pfg
Date: Sat May 23 14:59:27 2015
New Revision: 283315
URL: https://svnweb.freebsd.org/changeset/base/283315

Log:
  ddb:  de-register

Modified:
  head/sys/ddb/db_command.c
  head/sys/ddb/db_input.c
  head/sys/ddb/db_run.c
  head/sys/ddb/db_watch.c
  head/sys/ddb/db_write_cmd.c

Modified: head/sys/ddb/db_command.c
==
--- head/sys/ddb/db_command.c   Sat May 23 14:48:03 2015(r283314)
+++ head/sys/ddb/db_command.c   Sat May 23 14:59:27 2015(r283315)
@@ -311,7 +311,7 @@ db_cmd_search(char *name, struct command
 static void
 db_cmd_list(struct command_table *table)
 {
-   register struct command *cmd;
+   struct command  *cmd;
 
LIST_FOREACH(cmd, table, next) {
db_printf(%-16s, cmd-name);

Modified: head/sys/ddb/db_input.c
==
--- head/sys/ddb/db_input.c Sat May 23 14:48:03 2015(r283314)
+++ head/sys/ddb/db_input.c Sat May 23 14:59:27 2015(r283315)
@@ -97,7 +97,7 @@ db_delete(n, bwd)
int n;
int bwd;
 {
-   register char *p;
+   char *p;
 
if (bwd) {
db_lc -= n;
@@ -276,7 +276,7 @@ db_inputchar(c)
cnputc('\007');
}
else if (c = ' '  c = '~') {
-   register char *p;
+   char *p;
 
for (p = db_le; p  db_lc; p--)
*p = *(p-1);
@@ -348,7 +348,7 @@ db_readline(lstart, lsize)
 void
 db_check_interrupt(void)
 {
-   register intc;
+   int c;
 
c = cnmaygetc();
switch (c) {

Modified: head/sys/ddb/db_run.c
==
--- head/sys/ddb/db_run.c   Sat May 23 14:48:03 2015(r283314)
+++ head/sys/ddb/db_run.c   Sat May 23 14:59:27 2015(r283315)
@@ -80,8 +80,8 @@ db_breakpoint_t   db_taken_bkpt = 0;
 bool
 db_stop_at_pc(bool *is_breakpoint)
 {
-   register db_addr_t  pc;
-   register db_breakpoint_t bkpt;
+   db_addr_t   pc;
+   db_breakpoint_t bkpt;
 
pc = PC_REGS();
 #ifdef SOFTWARE_SSTEP
@@ -149,7 +149,7 @@ db_stop_at_pc(bool *is_breakpoint)
(!inst_return(ins) || --db_call_depth != 0)) {
if (db_sstep_print) {
if (inst_call(ins) || inst_return(ins)) {
-   register int i;
+   int i;
 
db_printf([after %6d] , db_inst_count);
for (i = db_call_depth; --i  0; )
@@ -181,7 +181,7 @@ db_stop_at_pc(bool *is_breakpoint)
 void
 db_restart_at_pc(bool watchpt)
 {
-   register db_addr_t  pc = PC_REGS();
+   db_addr_t   pc = PC_REGS();
 
if ((db_run_mode == STEP_COUNT) ||
(db_run_mode == STEP_RETURN) ||

Modified: head/sys/ddb/db_watch.c
==
--- head/sys/ddb/db_watch.c Sat May 23 14:48:03 2015(r283314)
+++ head/sys/ddb/db_watch.c Sat May 23 14:59:27 2015(r283315)
@@ -69,7 +69,7 @@ static void   db_set_watchpoint(vm_map_t 
 static db_watchpoint_t
 db_watchpoint_alloc(void)
 {
-   register db_watchpoint_twatch;
+   db_watchpoint_t watch;
 
if ((watch = db_free_watchpoints) != 0) {
db_free_watchpoints = watch-link;
@@ -95,7 +95,7 @@ db_watchpoint_free(db_watchpoint_t watch
 static void
 db_set_watchpoint(vm_map_t map, db_addr_t addr, vm_size_t size)
 {
-   register db_watchpoint_twatch;
+   db_watchpoint_t watch;
 
if (map == NULL) {
db_printf(No map.\n);
@@ -135,8 +135,8 @@ db_set_watchpoint(vm_map_t map, db_addr_
 static void
 db_delete_watchpoint(vm_map_t map, db_addr_t addr)
 {
-   register db_watchpoint_twatch;
-   register db_watchpoint_t*prev;
+   db_watchpoint_t watch;
+   db_watchpoint_t *prev;
 
for (prev = db_watchpoint_list;
 (watch = *prev) != 0;
@@ -155,7 +155,7 @@ db_delete_watchpoint(vm_map_t map, db_ad
 static void
 db_list_watchpoints(void)
 {
-   register db_watchpoint_twatch;
+   db_watchpoint_t watch;
 
if (db_watchpoint_list == 0) {
db_printf(No watchpoints set\n);
@@ -220,7 +220,7 @@ DB_SHOW_COMMAND(watches, db_listwatch_cm
 void
 db_set_watchpoints(void)
 {
-   register db_watchpoint_twatch;
+   db_watchpoint_t watch;
 
if (!db_watchpoints_inserted) {
for (watch = db_watchpoint_list;
@@ -245,7 +245,7 @@ db_clear_watchpoints(void)
 static bool
 db_find_watchpoint(vm_map_t map, db_addr_t addr, db_regs_t regs)
 {
-   register db_watchpoint_t watch;
+   db_watchpoint_t watch;
db_watchpoint_t found = 0;
 
for (watch = db_watchpoint_list;

Modified: 

svn commit: r283296 - head/sys/ddb

2015-05-22 Thread Pedro F. Giffuni
Author: pfg
Date: Fri May 22 19:04:06 2015
New Revision: 283296
URL: https://svnweb.freebsd.org/changeset/base/283296

Log:
  ddb:  Use NULL for pointers
  
  Hinted by:DragonflyBSD

Modified:
  head/sys/ddb/db_command.c

Modified: head/sys/ddb/db_command.c
==
--- head/sys/ddb/db_command.c   Fri May 22 18:31:26 2015(r283295)
+++ head/sys/ddb/db_command.c   Fri May 22 19:04:06 2015(r283296)
@@ -80,67 +80,67 @@ static db_cmdfcn_t  db_watchdog;
  */
 
 static struct command db_show_all_cmds[] = {
-   { trace,  db_stack_trace_all, 0,  0 },
+   { trace,  db_stack_trace_all, 0,  NULL },
 };
 struct command_table db_show_all_table =
 LIST_HEAD_INITIALIZER(db_show_all_table);
 
 static struct command db_show_cmds[] = {
{ all,0,  0,  db_show_all_table },
-   { registers,  db_show_regs,   0,  0 },
-   { breaks, db_listbreak_cmd,   0,  0 },
-   { threads,db_show_threads,0,  0 },
+   { registers,  db_show_regs,   0,  NULL },
+   { breaks, db_listbreak_cmd,   0,  NULL },
+   { threads,db_show_threads,0,  NULL },
 };
 struct command_table db_show_table = LIST_HEAD_INITIALIZER(db_show_table);
 
 static struct command db_cmds[] = {
-   { print,  db_print_cmd,   0,  0 },
-   { p,  db_print_cmd,   0,  0 },
-   { examine,db_examine_cmd, CS_SET_DOT, 0 },
-   { x,  db_examine_cmd, CS_SET_DOT, 0 },
-   { search, db_search_cmd,  CS_OWN|CS_SET_DOT, 0 },
-   { set,db_set_cmd, CS_OWN, 0 },
-   { write,  db_write_cmd,   CS_MORE|CS_SET_DOT, 0 },
-   { w,  db_write_cmd,   CS_MORE|CS_SET_DOT, 0 },
-   { delete, db_delete_cmd,  0,  0 },
-   { d,  db_delete_cmd,  0,  0 },
-   { dump,   db_dump,0,  0 },
-   { break,  db_breakpoint_cmd,  0,  0 },
-   { b,  db_breakpoint_cmd,  0,  0 },
-   { dwatch, db_deletewatch_cmd, 0,  0 },
-   { watch,  db_watchpoint_cmd,  CS_MORE,0 },
-   { dhwatch,db_deletehwatch_cmd,0,  0 },
-   { hwatch, db_hwatchpoint_cmd, 0,  0 },
-   { step,   db_single_step_cmd, 0,  0 },
-   { s,  db_single_step_cmd, 0,  0 },
-   { continue,   db_continue_cmd,0,  0 },
-   { c,  db_continue_cmd,0,  0 },
-   { until,  db_trace_until_call_cmd,0,  0 },
-   { next,   db_trace_until_matching_cmd,0,  0 },
-   { match,  db_trace_until_matching_cmd,0,  0 },
-   { trace,  db_stack_trace, CS_OWN, 0 },
-   { t,  db_stack_trace, CS_OWN, 0 },
+   { print,  db_print_cmd,   0,  NULL },
+   { p,  db_print_cmd,   0,  NULL },
+   { examine,db_examine_cmd, CS_SET_DOT, NULL },
+   { x,  db_examine_cmd, CS_SET_DOT, NULL },
+   { search, db_search_cmd,  CS_OWN|CS_SET_DOT, NULL },
+   { set,db_set_cmd, CS_OWN, NULL },
+   { write,  db_write_cmd,   CS_MORE|CS_SET_DOT, NULL },
+   { w,  db_write_cmd,   CS_MORE|CS_SET_DOT, NULL },
+   { delete, db_delete_cmd,  0,  NULL },
+   { d,  db_delete_cmd,  0,  NULL },
+   { dump,   db_dump,0,  NULL },
+   { break,  db_breakpoint_cmd,  0,  NULL },
+   { b,  db_breakpoint_cmd,  0,  NULL },
+   { dwatch, db_deletewatch_cmd, 0,  NULL },
+   { watch,  db_watchpoint_cmd,  CS_MORE,NULL },
+   { dhwatch,db_deletehwatch_cmd,0,  NULL },
+   { hwatch, db_hwatchpoint_cmd, 0,  NULL },
+   { step,   db_single_step_cmd, 0,  NULL },
+   { s,  db_single_step_cmd, 0,  NULL },
+   { continue,   db_continue_cmd,0,  NULL },
+   { c,  db_continue_cmd,0,  NULL },
+   { until,  db_trace_until_call_cmd,0,  NULL },
+   { next,   db_trace_until_matching_cmd,0,  NULL },
+   { match,  db_trace_until_matching_cmd,0,  NULL },
+   { trace,  db_stack_trace, CS_OWN, NULL },
+   { t,  db_stack_trace, CS_OWN, NULL },
/* XXX alias for all trace */
-   { alltrace,   db_stack_trace_all, 0,  0 },
-   { where,  db_stack_trace, CS_OWN, 0 },
-   { bt, db_stack_trace, CS_OWN, 0 },
-   { call,   db_fncall,  CS_OWN, 0 },
+   { alltrace,   db_stack_trace_all, 0,  NULL },
+   { where, 

svn commit: r283248 - in head/sys: amd64/amd64 arm/arm arm64/arm64 ddb i386/i386 kern mips/mips powerpc/powerpc sparc64/sparc64

2015-05-21 Thread Pedro F. Giffuni
Author: pfg
Date: Thu May 21 15:16:18 2015
New Revision: 283248
URL: https://svnweb.freebsd.org/changeset/base/283248

Log:
  ddb: finish converting boolean values.
  
  The replacement started at r283088 was necessarily incomplete without
  replacing boolean_t with bool.  This also involved cleaning some type
  mismatches and ansifying old C function declarations.
  
  Pointed out by:   bde
  Discussed with:   bde, ian, jhb

Modified:
  head/sys/amd64/amd64/db_disasm.c
  head/sys/arm/arm/db_disasm.c
  head/sys/arm64/arm64/db_disasm.c
  head/sys/ddb/db_access.c
  head/sys/ddb/db_access.h
  head/sys/ddb/db_break.c
  head/sys/ddb/db_capture.c
  head/sys/ddb/db_command.c
  head/sys/ddb/db_examine.c
  head/sys/ddb/db_expr.c
  head/sys/ddb/db_main.c
  head/sys/ddb/db_print.c
  head/sys/ddb/db_ps.c
  head/sys/ddb/db_run.c
  head/sys/ddb/db_script.c
  head/sys/ddb/db_sym.c
  head/sys/ddb/db_sym.h
  head/sys/ddb/db_textdump.c
  head/sys/ddb/db_thread.c
  head/sys/ddb/db_variables.c
  head/sys/ddb/db_watch.c
  head/sys/ddb/db_write_cmd.c
  head/sys/ddb/ddb.h
  head/sys/i386/i386/db_disasm.c
  head/sys/kern/subr_turnstile.c
  head/sys/kern/subr_witness.c
  head/sys/mips/mips/db_disasm.c
  head/sys/mips/mips/pmap.c
  head/sys/mips/mips/vm_machdep.c
  head/sys/powerpc/powerpc/db_disasm.c
  head/sys/sparc64/sparc64/db_disasm.c

Modified: head/sys/amd64/amd64/db_disasm.c
==
--- head/sys/amd64/amd64/db_disasm.cThu May 21 15:05:46 2015
(r283247)
+++ head/sys/amd64/amd64/db_disasm.cThu May 21 15:16:18 2015
(r283248)
@@ -1223,9 +1223,7 @@ db_disasm_esc(loc, inst, rex, short_addr
  * next instruction.
  */
 db_addr_t
-db_disasm(loc, altfmt)
-   db_addr_t   loc;
-   boolean_t   altfmt;
+db_disasm(db_addr_t loc, bool altfmt)
 {
int inst;
int size;

Modified: head/sys/arm/arm/db_disasm.c
==
--- head/sys/arm/arm/db_disasm.cThu May 21 15:05:46 2015
(r283247)
+++ head/sys/arm/arm/db_disasm.cThu May 21 15:16:18 2015
(r283248)
@@ -70,7 +70,7 @@ db_disasm_printaddr(u_int address)
 }
 
 vm_offset_t
-db_disasm(vm_offset_t loc, boolean_t altfmt)
+db_disasm(vm_offset_t loc, bool altfmt)
 {
 
return disasm(db_disasm_interface, loc, altfmt);

Modified: head/sys/arm64/arm64/db_disasm.c
==
--- head/sys/arm64/arm64/db_disasm.cThu May 21 15:05:46 2015
(r283247)
+++ head/sys/arm64/arm64/db_disasm.cThu May 21 15:16:18 2015
(r283248)
@@ -33,7 +33,7 @@ __FBSDID($FreeBSD$);
 #include ddb/ddb.h
 
 vm_offset_t
-db_disasm(vm_offset_t loc, boolean_t altfmt)
+db_disasm(vm_offset_t loc, bool altfmt)
 {
return 0;
 }

Modified: head/sys/ddb/db_access.c
==
--- head/sys/ddb/db_access.cThu May 21 15:05:46 2015(r283247)
+++ head/sys/ddb/db_access.cThu May 21 15:16:18 2015(r283248)
@@ -54,7 +54,7 @@ static unsigned db_extend[] = {   /* table
 #endif
 
 db_expr_t
-db_get_value(db_addr_t addr, int size, boolean_t is_signed)
+db_get_value(db_addr_t addr, int size, bool is_signed)
 {
chardata[sizeof(u_int64_t)];
register db_expr_t value;

Modified: head/sys/ddb/db_access.h
==
--- head/sys/ddb/db_access.hThu May 21 15:05:46 2015(r283247)
+++ head/sys/ddb/db_access.hThu May 21 15:16:18 2015(r283248)
@@ -36,7 +36,7 @@
 /*
  * Data access functions for debugger.
  */
-db_expr_t  db_get_value(db_addr_t addr, int size, boolean_t is_signed);
+db_expr_t  db_get_value(db_addr_t addr, int size, bool is_signed);
 void   db_put_value(db_addr_t addr, int size, db_expr_t value);
 
 #endif /* !_DDB_DB_ACCESS_H_ */

Modified: head/sys/ddb/db_break.c
==
--- head/sys/ddb/db_break.c Thu May 21 15:05:46 2015(r283247)
+++ head/sys/ddb/db_break.c Thu May 21 15:16:18 2015(r283248)
@@ -155,7 +155,7 @@ db_find_breakpoint_here(db_addr_t addr)
return db_find_breakpoint(db_map_addr(addr), addr);
 }
 
-static boolean_t   db_breakpoints_inserted = true;
+static booldb_breakpoints_inserted = true;
 
 #ifndef BKPT_WRITE
 #defineBKPT_WRITE(addr, storage)   \
@@ -267,7 +267,7 @@ db_list_breakpoints(void)
 /* Delete breakpoint */
 /*ARGSUSED*/
 void
-db_delete_cmd(db_expr_t addr, boolean_t have_addr, db_expr_t count, char 
*modif)
+db_delete_cmd(db_expr_t addr, bool have_addr, db_expr_t count, char *modif)
 {
db_delete_breakpoint(db_map_addr(addr), (db_addr_t)addr);
 }
@@ -275,8 +275,7 @@ db_delete_cmd(db_expr_t addr, boolean_t 
 /* 

svn commit: r283068 - head/lib/libc/db/hash

2015-05-18 Thread Pedro F. Giffuni
Author: pfg
Date: Mon May 18 16:28:13 2015
New Revision: 283068
URL: https://svnweb.freebsd.org/changeset/base/283068

Log:
  Drop some unnecessary casts.
  
  Reported by:  Clang static analyzer
  Obtained from:NetBSD

Modified:
  head/lib/libc/db/hash/hash.c

Modified: head/lib/libc/db/hash/hash.c
==
--- head/lib/libc/db/hash/hash.cMon May 18 16:18:04 2015
(r283067)
+++ head/lib/libc/db/hash/hash.cMon May 18 16:28:13 2015
(r283068)
@@ -808,7 +808,7 @@ __expand_table(HTAB *hashp)
hashp-DSIZE = dirsize  1;
}
if ((hashp-dir[new_segnum] =
-   (SEGMENT)calloc(hashp-SGSIZE, sizeof(SEGMENT))) == NULL)
+   calloc(hashp-SGSIZE, sizeof(SEGMENT))) == NULL)
return (-1);
hashp-exsegs++;
hashp-nsegs++;
@@ -877,7 +877,7 @@ alloc_segs(HTAB *hashp, int nsegs)
int save_errno;
 
if ((hashp-dir =
-   (SEGMENT *)calloc(hashp-DSIZE, sizeof(SEGMENT *))) == NULL) {
+   calloc(hashp-DSIZE, sizeof(SEGMENT *))) == NULL) {
save_errno = errno;
(void)hdestroy(hashp);
errno = save_errno;
@@ -887,8 +887,7 @@ alloc_segs(HTAB *hashp, int nsegs)
if (nsegs == 0)
return (0);
/* Allocate segments */
-   if ((store = (SEGMENT)calloc(nsegs  hashp-SSHIFT,
-   sizeof(SEGMENT))) == NULL) {
+   if ((store = calloc(nsegs  hashp-SSHIFT, sizeof(SEGMENT))) == NULL) {
save_errno = errno;
(void)hdestroy(hashp);
errno = save_errno;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


<    3   4   5   6   7   8   9   10   11   12   >