svn commit: r268450 - head/sys/netinet

2014-07-09 Thread Gleb Smirnoff
Author: glebius
Date: Wed Jul  9 07:48:05 2014
New Revision: 268450
URL: http://svnweb.freebsd.org/changeset/base/268450

Log:
  In several cases in ip_output() we obtain reference on ifa. Do not
  leak it.
  
  Together with:asomers, np
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/netinet/ip_output.c

Modified: head/sys/netinet/ip_output.c
==
--- head/sys/netinet/ip_output.cWed Jul  9 05:51:59 2014
(r268449)
+++ head/sys/netinet/ip_output.cWed Jul  9 07:48:05 2014
(r268450)
@@ -136,6 +136,7 @@ ip_output(struct mbuf *m, struct mbuf *o
struct rtentry *rte;/* cache for ro->ro_rt */
struct in_addr odst;
struct m_tag *fwd_tag = NULL;
+   int have_ia_ref;
 #ifdef IPSEC
int no_route_but_check_spd = 0;
 #endif
@@ -202,6 +203,7 @@ ip_output(struct mbuf *m, struct mbuf *o
gw = dst = (struct sockaddr_in *)&ro->ro_dst;
 again:
ia = NULL;
+   have_ia_ref = 0;
/*
 * If there is a cached route, check that it is to the same
 * destination and is still up.  If not, free it and try again.
@@ -238,6 +240,7 @@ again:
error = ENETUNREACH;
goto bad;
}
+   have_ia_ref = 1;
ip->ip_dst.s_addr = INADDR_BROADCAST;
dst->sin_addr = ip->ip_dst;
ifp = ia->ia_ifp;
@@ -250,6 +253,7 @@ again:
error = ENETUNREACH;
goto bad;
}
+   have_ia_ref = 1;
ifp = ia->ia_ifp;
ip->ip_ttl = 1;
isbroadcast = in_broadcast(dst->sin_addr, ifp);
@@ -261,6 +265,8 @@ again:
 */
ifp = imo->imo_multicast_ifp;
IFP_TO_IA(ifp, ia);
+   if (ia)
+   have_ia_ref = 1;
isbroadcast = 0;/* fool gcc */
} else {
/*
@@ -552,8 +558,11 @@ sendit:
 #endif
error = netisr_queue(NETISR_IP, m);
goto done;
-   } else
+   } else {
+   if (have_ia_ref)
+   ifa_free(&ia->ia_ifa);
goto again; /* Redo the routing table lookup. */
+   }
}
 
/* See if local, if yes, send it to netisr with IP_FASTFWD_OURS. */
@@ -582,6 +591,8 @@ sendit:
m->m_flags |= M_SKIP_FIREWALL;
m->m_flags &= ~M_IP_NEXTHOP;
m_tag_delete(m, fwd_tag);
+   if (have_ia_ref)
+   ifa_free(&ia->ia_ifa);
goto again;
}
 
@@ -694,6 +705,8 @@ passout:
 done:
if (ro == &iproute)
RO_RTFREE(ro);
+   if (have_ia_ref)
+   ifa_free(&ia->ia_ifa);
return (error);
 bad:
m_freem(m);
___
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: r268451 - head/sys/vm

2014-07-09 Thread Roger Pau Monné
Author: royger
Date: Wed Jul  9 08:12:58 2014
New Revision: 268451
URL: http://svnweb.freebsd.org/changeset/base/268451

Log:
  vm_phys: remove limitation on number of fictitious regions
  
  The number of vm fictitious regions was limited to 8 by default, but
  Xen will make heavy usage of those kind of regions in order to map
  memory from foreign domains, so instead of increasing the default
  number, change the implementation to use a red-black tree to track vm
  fictitious ranges.
  
  The public interface remains the same.
  
  Sponsored by: Citrix Systems R&D
  Reviewed by: kib, alc
  Approved by: gibbs
  
  vm/vm_phys.c:
   - Replace the vm fictitious static array with a red-black tree.
   - Use a rwlock instead of a mutex, since now we also need to take the
 lock in vm_phys_fictitious_to_vm_page, and it can be shared.

Modified:
  head/sys/vm/vm_phys.c

Modified: head/sys/vm/vm_phys.c
==
--- head/sys/vm/vm_phys.c   Wed Jul  9 07:48:05 2014(r268450)
+++ head/sys/vm/vm_phys.c   Wed Jul  9 08:12:58 2014(r268451)
@@ -52,8 +52,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -75,13 +77,25 @@ int vm_ndomains = 1;
 struct vm_phys_seg vm_phys_segs[VM_PHYSSEG_MAX];
 int vm_phys_nsegs;
 
-#define VM_PHYS_FICTITIOUS_NSEGS   8
-static struct vm_phys_fictitious_seg {
+struct vm_phys_fictitious_seg;
+static int vm_phys_fictitious_cmp(struct vm_phys_fictitious_seg *,
+struct vm_phys_fictitious_seg *);
+
+RB_HEAD(fict_tree, vm_phys_fictitious_seg) vm_phys_fictitious_tree =
+RB_INITIALIZER(_vm_phys_fictitious_tree);
+
+struct vm_phys_fictitious_seg {
+   RB_ENTRY(vm_phys_fictitious_seg) node;
+   /* Memory region data */
vm_paddr_t  start;
vm_paddr_t  end;
vm_page_t   first_page;
-} vm_phys_fictitious_segs[VM_PHYS_FICTITIOUS_NSEGS];
-static struct mtx vm_phys_fictitious_reg_mtx;
+};
+
+RB_GENERATE_STATIC(fict_tree, vm_phys_fictitious_seg, node,
+vm_phys_fictitious_cmp);
+
+static struct rwlock vm_phys_fictitious_reg_lock;
 MALLOC_DEFINE(M_FICT_PAGES, "vm_fictitious", "Fictitious VM pages");
 
 static struct vm_freelist
@@ -113,6 +127,47 @@ static int vm_phys_paddr_to_segind(vm_pa
 static void vm_phys_split_pages(vm_page_t m, int oind, struct vm_freelist *fl,
 int order);
 
+/*
+ * Red-black tree helpers for vm fictitious range management.
+ */
+static inline int
+vm_phys_fictitious_in_range(struct vm_phys_fictitious_seg *p,
+struct vm_phys_fictitious_seg *range)
+{
+
+   KASSERT(range->start != 0 && range->end != 0,
+   ("Invalid range passed on search for vm_fictitious page"));
+   if (p->start >= range->end)
+   return (1);
+   if (p->start < range->start)
+   return (-1);
+
+   return (0);
+}
+
+static int
+vm_phys_fictitious_cmp(struct vm_phys_fictitious_seg *p1,
+struct vm_phys_fictitious_seg *p2)
+{
+
+   /* Check if this is a search for a page */
+   if (p1->end == 0)
+   return (vm_phys_fictitious_in_range(p1, p2));
+
+   KASSERT(p2->end != 0,
+("Invalid range passed as second parameter to vm fictitious comparison"));
+
+   /* Searching to add a new range */
+   if (p1->end <= p2->start)
+   return (-1);
+   if (p1->start >= p2->end)
+   return (1);
+
+   panic("Trying to add overlapping vm fictitious ranges:\n"
+   "[%#jx:%#jx] and [%#jx:%#jx]", (uintmax_t)p1->start,
+   (uintmax_t)p1->end, (uintmax_t)p2->start, (uintmax_t)p2->end);
+}
+
 static __inline int
 vm_rr_selectdomain(void)
 {
@@ -353,7 +408,7 @@ vm_phys_init(void)
}
}
}
-   mtx_init(&vm_phys_fictitious_reg_mtx, "vmfctr", NULL, MTX_DEF);
+   rw_init(&vm_phys_fictitious_reg_lock, "vmfctr");
 }
 
 /*
@@ -517,20 +572,22 @@ vm_phys_paddr_to_vm_page(vm_paddr_t pa)
 vm_page_t
 vm_phys_fictitious_to_vm_page(vm_paddr_t pa)
 {
-   struct vm_phys_fictitious_seg *seg;
+   struct vm_phys_fictitious_seg tmp, *seg;
vm_page_t m;
-   int segind;
 
m = NULL;
-   for (segind = 0; segind < VM_PHYS_FICTITIOUS_NSEGS; segind++) {
-   seg = &vm_phys_fictitious_segs[segind];
-   if (pa >= seg->start && pa < seg->end) {
-   m = &seg->first_page[atop(pa - seg->start)];
-   KASSERT((m->flags & PG_FICTITIOUS) != 0,
-   ("%p not fictitious", m));
-   break;
-   }
-   }
+   tmp.start = pa;
+   tmp.end = 0;
+
+   rw_rlock(&vm_phys_fictitious_reg_lock);
+   seg = RB_FIND(fict_tree, &vm_phys_fictitious_tree, &tmp);
+   rw_runlock(&vm_phys_fictitious_reg_lock);
+   if (seg == NULL)
+   return (NULL);
+
+   m = &seg->first_page[atop(pa - seg->start)];

svn commit: r268456 - head/share/misc

2014-07-09 Thread Frederic Culot
Author: culot (ports committer)
Date: Wed Jul  9 09:15:08 2014
New Revision: 268456
URL: http://svnweb.freebsd.org/changeset/base/268456

Log:
  Update organization.dot to reflect current portmgr@

Modified:
  head/share/misc/organization.dot

Modified: head/share/misc/organization.dot
==
--- head/share/misc/organization.dotWed Jul  9 08:23:22 2014
(r268455)
+++ head/share/misc/organization.dotWed Jul  9 09:15:08 2014
(r268456)
@@ -30,8 +30,8 @@ coresecretary [label="Core Team Secretar
 doccommitters [label="Doc/www Committers\ndoc-committ...@freebsd.org"]
 doceng [label="Documentation Engineering Team\ndoc...@freebsd.org\ngjb, 
blackend,\ngabor, hrs"]
 portscommitters [label="Ports Committers\nports-committ...@freebsd.org"]
-portmgr [label="Port Management Team\nport...@freebsd.org\ntabthorpe, marcus, 
bapt,\nerwin, bdrewery,\nitetcu, miwi"]
-portmgrsecretary [label="Port Management Team 
Secretary\nportmgr-secret...@freebsd.org\ntabthorpe"]
+portmgr [label="Port Management Team\nport...@freebsd.org\nantoine, bapt, 
bdrewery,\ndecke, erwin, mat,\nmiwi, swills, tabthorpe"]
+portmgrsecretary [label="Port Management Team 
Secretary\nportmgr-secret...@freebsd.org\nculot"]
 re [label="Primary Release Engineering Team\n...@freebsd.org\nkib, blackend, 
jpaetzel, hrs, kensmith"]
 secteam [label="Security Team\nsect...@freebsd.org\nsimon, qingli, 
delphij,\nremko, philip, stas, cperciva,\ncsjp, rwatson, miwi, bz"]
 portssecteam [label="Ports Security Team\nports-sect...@freebsd.org\nmiwi, 
rea, swills, wxs,\njgh, sbz, eadler, zi, remko, simon"]
___
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: r268457 - head/usr.sbin/ctladm

2014-07-09 Thread Sergey Kandaurov
Author: pluknet
Date: Wed Jul  9 09:51:14 2014
New Revision: 268457
URL: http://svnweb.freebsd.org/changeset/base/268457

Log:
  Fix typos.

Modified:
  head/usr.sbin/ctladm/ctladm.8

Modified: head/usr.sbin/ctladm/ctladm.8
==
--- head/usr.sbin/ctladm/ctladm.8   Wed Jul  9 09:15:08 2014
(r268456)
+++ head/usr.sbin/ctladm/ctladm.8   Wed Jul  9 09:51:14 2014
(r268457)
@@ -499,7 +499,7 @@ Specify relative addressing for the star
 relative addressing, since it only works for linked commands, and CTL
 does not support linked commands.
 .It Fl i
-Tell the target to return status immediately after issuing the SYHCHRONIZE 
CACHE
+Tell the target to return status immediately after issuing the SYNCHRONIZE 
CACHE
 command rather than waiting for the cache to finish syncing.  CTL does not
 support this bit.
 .It Fl c Ar cdbsize
@@ -948,7 +948,7 @@ Specifies LUN revision string up to 4 ch
 .It Va scsiname
 Specifies LUN SCSI name string.
 .It Va eui
-Specifies LUN EUI-64 identified.
+Specifies LUN EUI-64 identifier.
 .It Va naa
 Specifies LUN NAA identifier.
 .It Va unmap
___
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: r268458 - head/share/misc

2014-07-09 Thread Gabor Pali
Author: pgj (doc,ports committer)
Date: Wed Jul  9 11:41:32 2014
New Revision: 268458
URL: http://svnweb.freebsd.org/changeset/base/268458

Log:
  - Update core members

Modified:
  head/share/misc/organization.dot

Modified: head/share/misc/organization.dot
==
--- head/share/misc/organization.dotWed Jul  9 09:51:14 2014
(r268457)
+++ head/share/misc/organization.dotWed Jul  9 11:41:32 2014
(r268458)
@@ -25,7 +25,7 @@ _misc [label="Miscellaneous Hats"]
 
 # Development teams go here alphabetically sorted
 
-core [label="Core Team\nc...@freebsd.org\ntabthorpe, gavin, jhb, 
kib,\ntheraven, hrs, peter, miwi"]
+core [label="Core Team\nc...@freebsd.org\nbapt, emaste, gavin,\nglebius, gnn, 
hrs,\npeter, rwatson, theraven"]
 coresecretary [label="Core Team Secretary\ncore-secret...@freebsd.org\npgj"]
 doccommitters [label="Doc/www Committers\ndoc-committ...@freebsd.org"]
 doceng [label="Documentation Engineering Team\ndoc...@freebsd.org\ngjb, 
blackend,\ngabor, hrs"]
___
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: r268459 - head/share/misc

2014-07-09 Thread Gabor Pali
Author: pgj (doc,ports committer)
Date: Wed Jul  9 13:37:24 2014
New Revision: 268459
URL: http://svnweb.freebsd.org/changeset/base/268459

Log:
  - Update core-secretary

Modified:
  head/share/misc/organization.dot

Modified: head/share/misc/organization.dot
==
--- head/share/misc/organization.dotWed Jul  9 11:41:32 2014
(r268458)
+++ head/share/misc/organization.dotWed Jul  9 13:37:24 2014
(r268459)
@@ -26,7 +26,7 @@ _misc [label="Miscellaneous Hats"]
 # Development teams go here alphabetically sorted
 
 core [label="Core Team\nc...@freebsd.org\nbapt, emaste, gavin,\nglebius, gnn, 
hrs,\npeter, rwatson, theraven"]
-coresecretary [label="Core Team Secretary\ncore-secret...@freebsd.org\npgj"]
+coresecretary [label="Core Team 
Secretary\ncore-secret...@freebsd.org\nmatthew"]
 doccommitters [label="Doc/www Committers\ndoc-committ...@freebsd.org"]
 doceng [label="Documentation Engineering Team\ndoc...@freebsd.org\ngjb, 
blackend,\ngabor, hrs"]
 portscommitters [label="Ports Committers\nports-committ...@freebsd.org"]
___
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"


Re: svn commit: r268376 - head/bin/rm

2014-07-09 Thread Bruce Evans

On Mon, 7 Jul 2014, Warner Losh wrote:


Log:
 rm -rf can fail sometimes with an error from fts_read. Make it honor
 fflag to ignore fts_read errors, but stop deleting from that directory
 because no further progress can be made.

 When building a kernel with a high -j value on a high core count
 machine, during the cleanobj phase we can wind up doing multiple rm
 -rf at the same time for modules that have subdirectories. This
 exposed this race (sometimes) as fts_read can return an error if the
 directory is removed by another rm -rf. Since the intent of the -f
 flag was to ignore errors, even if this was a bug in fts_read, we
 should ignore the error like we've been instructed to do.


This seems to be more broken than before.  Although the intent of using
-f is often to ignore errors, -f is supposed to only ignore ENOENT
errors except in some cases for complicated interactions with -i.


Modified: head/bin/rm/rm.c
==
--- head/bin/rm/rm.cMon Jul  7 23:21:15 2014(r268375)
+++ head/bin/rm/rm.cMon Jul  7 23:21:20 2014(r268376)
@@ -335,7 +335,7 @@ err:
warn("%s", p->fts_path);
eval = 1;
}
-   if (errno)
+   if (!fflag && errno)
err(1, "fts_read");
fts_close(fts);
}


The old code was broken too.  Apart from its style bug (boolean test for
non-boolean), it tests errno in all cases after leaving the loop, but
most of the loop exits are not for errors so the test is of the garbage
value last written to errno.

So the old and new code both defeat the more careful tests of fflag combined
with errno the loop.  Most are of the form (!fflag || p->fts_errno != ENOENT)
(then at least a warning if this fails).  It also seems wrong to use
errno outside the loop and p->fts_errno in the loop.  Of course, outside
the loop, p is usually invalid, but that means that errno is very stale.

%   while ((p = fts_read(fts)) != NULL) {

Normal loop exit is when this is NULL.  Then there is no error, and the
errno that is tested is pure garbage.   Fixing this alone might fix the
problem.  Otherwise, hopefully any error from things going away causes
an ENOENT error, so checking for that alone would fix the error handling.
That's a bit much to ask for -- if a whole subtree is removed then there
should be multiple ENOENT errors and probably other errors, and fts_read()
would find it hard to reduce to a single ENOENT without missing a more
serious error.

%   switch (p->fts_info) {
%   case FTS_DNR:
%   if (!fflag || p->fts_errno != ENOENT) {
%   warnx("%s: %s",
%   p->fts_path, strerror(p->fts_errno));
%   eval = 1;
%   }
%   continue;

Normal error handling.  We check for ENOENT and handle the error completely
and don't break out of the loop.

%   case FTS_ERR:
%   errx(1, "%s: %s", p->fts_path, strerror(p->fts_errno));

Exit for fatal errors.  I think POSIX doesn't allow this, but requires
contining to the next arg.  Exiting the loop should give that, unless
fts_close() fails.

%   case FTS_NS:
%   /*
%* Assume that since fts_read() couldn't stat the
%* file, it can't be unlinked.
%*/
%   if (!needstat)
%   break;

Here we exit the loop for an assumed stat() error.  If this error is
anything other than ENOENT, then POSIX doesn't allow ignoring it but
it might allow quitting for the current arg.  If this error is
ENOENT, then the error handling seems to be even more broken.  We
shouldn't quit for the current arg on ENOENT, irrespective of fflag.

Permissions 000 on a file don't prevent stat'ing it, and I couldn't
find a simple example where this code is reached.

% ...
%   case FTS_DP:
%   /* Post-order: see if user skipped. */
%   if (p->fts_number == SKIPPED)
%   continue;
%   break;

Most other cases don't exit the loop.

% ...
%   }
%   if (!fflag && errno)

More broken than before.

%   err(1, "fts_read");

fts without FTS_NOCHDIR is fundamentally broken if the directory tree
can change underneath it, since (without more work by the caller) it
is impossible to get back to the original directory in fts_close()
or just up a level in the tree walk for small changes in the tree
(the caller cannot handle this with any reasonable anount of work).
FTS_NOCHDIR is only used by the following utilities in /usr/src/*bin:
cp, pax, gxip, find, grep, asf.  It is not used in chmod, rm, ls,
chflags, du, chown, ckdist, ctm, mtree, kldxref, setfmac.  Mixing
this flag gives the worse possible combination -- e

svn commit: r268460 - head/sys/dev/vt

2014-07-09 Thread Aleksandr Rybalko
Author: ray
Date: Wed Jul  9 14:36:03 2014
New Revision: 268460
URL: http://svnweb.freebsd.org/changeset/base/268460

Log:
  Fix inconsistent token parameters for kbd_allocate() and kbd_release() in 
vt(4).
  
  PR:   191306
  Submitted by: jau...@gmail.com
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/vt/vt_core.c

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Wed Jul  9 13:37:24 2014(r268459)
+++ head/sys/dev/vt/vt_core.c   Wed Jul  9 14:36:03 2014(r268460)
@@ -618,7 +618,7 @@ vt_kbdevent(keyboard_t *kbd, int event, 
case KBDIO_UNLOADING:
mtx_lock(&Giant);
vd->vd_keyboard = -1;
-   kbd_release(kbd, (void *)&vd->vd_keyboard);
+   kbd_release(kbd, (void *)vd);
mtx_unlock(&Giant);
return (0);
default:
@@ -1785,11 +1785,10 @@ skip_thunk:
return (EINVAL);
}
i = kbd_allocate(kbd->kb_name, kbd->kb_unit,
-   (void *)&vd->vd_keyboard, vt_kbdevent, vd);
+   (void *)vd, vt_kbdevent, vd);
if (i >= 0) {
if (vd->vd_keyboard != -1) {
-   kbd_release(kbd,
-   (void *)&vd->vd_keyboard);
+   kbd_release(kbd, (void *)vd);
}
kbd = kbd_get_keyboard(i);
vd->vd_keyboard = i;
@@ -1811,7 +1810,7 @@ skip_thunk:
mtx_unlock(&Giant);
return (EINVAL);
}
-   error = kbd_release(kbd, (void *)&vd->vd_keyboard);
+   error = kbd_release(kbd, (void *)vd);
if (error == 0) {
vd->vd_keyboard = -1;
}
___
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: r268461 - in head: . gnu/lib/libreadline gnu/lib/libreadline/history gnu/lib/libreadline/readline gnu/lib/libreadline/readline/doc gnu/usr.bin/gdb gnu/usr.bin/gdb/gdb gnu/usr.bin/gdb/gd...

2014-07-09 Thread Baptiste Daroussin
Author: bapt
Date: Wed Jul  9 15:52:30 2014
New Revision: 268461
URL: http://svnweb.freebsd.org/changeset/base/268461

Log:
  The GNU readline library is now an INTERNALLIB - that is, it is
  statically linked into consumers (GDB and variants) in the base
  system, and the shared library is no longer installed.
  
  That also allows ports to be able to use a modern version of readline
  
  PR:   162948
  Reviewed by:  emaste

Deleted:
  head/gnu/lib/libreadline/history/
  head/gnu/lib/libreadline/readline/doc/
Modified:
  head/ObsoleteFiles.inc
  head/UPDATING
  head/gnu/lib/libreadline/Makefile
  head/gnu/lib/libreadline/readline/Makefile
  head/gnu/usr.bin/gdb/Makefile.inc
  head/gnu/usr.bin/gdb/gdb/Makefile
  head/gnu/usr.bin/gdb/gdbtui/Makefile
  head/gnu/usr.bin/gdb/kgdb/Makefile
  head/share/mk/bsd.libnames.mk
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Wed Jul  9 14:36:03 2014(r268460)
+++ head/ObsoleteFiles.inc  Wed Jul  9 15:52:30 2014(r268461)
@@ -38,6 +38,25 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20140705: turn libreadline into an internal lib
+OLD_LIBS+=lib/libreadline.so.8
+OLD_FILES+=usr/lib/libreadline.a
+OLD_FILES+=usr/lib/libreadline_p.a
+OLD_FILES+=usr/lib/libreadline.so
+OLD_FILES+=usr/lib/libhistory.a
+OLD_FILES+=usr/lib/libhistory_p.a
+OLD_FILES+=usr/lib/libhistory.so
+OLD_LIBS+=usr/lib/libhistory.so.8
+OLD_FILES+=usr/include/readline/chardefs.h
+OLD_FILES+=usr/include/readline/history.h
+OLD_FILES+=usr/include/readline/keymaps.h
+OLD_FILES+=usr/include/readline/readline.h
+OLD_FILES+=usr/include/readline/rlconf.h
+OLD_FILES+=usr/include/readline/rlstdc.h
+OLD_FILES+=usr/include/readline/rltypedefs.h
+OLD_FILES+=usr/include/readline/rltypedefs.h
+OLD_FILES+=usr/share/info/readline.info.gz
+OLD_FILES+=usr/share/man/man3/readline.3.gz
 # 20140625: csup removal
 OLD_FILES+=usr/bin/csup
 OLD_FILES+=usr/bin/cpasswd

Modified: head/UPDATING
==
--- head/UPDATING   Wed Jul  9 14:36:03 2014(r268460)
+++ head/UPDATING   Wed Jul  9 15:52:30 2014(r268461)
@@ -31,6 +31,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20140708:
+   The GNU readline library is now an INTERNALLIB - that is, it is
+   statically linked into consumers (GDB and variants) in the base
+   system, and the shared library is no longer installed.  The
+   devel/readline port is available for third party software that
+   requires readline.
+
 20140702:
The Itanium architecture (ia64) has been removed from the list of
known architectures. This is the first step in the removal of the

Modified: head/gnu/lib/libreadline/Makefile
==
--- head/gnu/lib/libreadline/Makefile   Wed Jul  9 14:36:03 2014
(r268460)
+++ head/gnu/lib/libreadline/Makefile   Wed Jul  9 15:52:30 2014
(r268461)
@@ -1,5 +1,5 @@
 # $FreeBSD$
 
-SUBDIR = history readline
+SUBDIR = readline
 
 .include 

Modified: head/gnu/lib/libreadline/readline/Makefile
==
--- head/gnu/lib/libreadline/readline/Makefile  Wed Jul  9 14:36:03 2014
(r268460)
+++ head/gnu/lib/libreadline/readline/Makefile  Wed Jul  9 15:52:30 2014
(r268461)
@@ -1,10 +1,8 @@
 # $FreeBSD$
 
-SUBDIR= doc
-
 LIB=readline
-MAN=doc/readline.3
-SHLIBDIR?= /lib
+INTERNALLIB=   yes
+NO_MAN=yes
 
 TILDESRC= tilde.c
 SRCS= readline.c vi_mode.c funmap.c keymaps.c parens.c search.c \
@@ -15,13 +13,17 @@ SRCS= readline.c vi_mode.c funmap.c 
 INSTALLED_HEADERS= readline.h chardefs.h keymaps.h history.h tilde.h \
   rlstdc.h rlconf.h rltypedefs.h
 
-DPADD= ${LIBTERMCAP}
-LDADD= -ltermcap
-
-INCSDIR=${INCLUDEDIR}/readline
+CFLAGS+=   -I${.OBJDIR}/..
+SRCDIR=${.CURDIR}/../../../../contrib/libreadline
 
-.for hdr in ${INSTALLED_HEADERS}
-INCS+= ${SRCDIR}/${hdr}
+.for _h in ${INSTALLED_HEADERS}
+CLEANFILES+=   ${_h}
+DPSRCS+=   ${.OBJDIR}/${_h}
+${.OBJDIR}/${_h}:  ${SRCDIR}/${_h}
+   ${INSTALL} ${.ALLSRC} ${.TARGET}
 .endfor
 
+DPADD= ${LIBTERMCAP}
+LDADD= -ltermcap
+
 .include 

Modified: head/gnu/usr.bin/gdb/Makefile.inc
==
--- head/gnu/usr.bin/gdb/Makefile.inc   Wed Jul  9 14:36:03 2014
(r268460)
+++ head/gnu/usr.bin/gdb/Makefile.inc   Wed Jul  9 15:52:30 2014
(r268461)
@@ -15,6 +15,8 @@ CNTRB_RL= ${CNTRB_ROOT}/libreadline
 OBJ_ROOT= ${.OBJDIR}/../..
 OBJ_BU= ${OBJ_ROOT}/binutils
 OBJ_GDB= ${OBJ_ROOT}/gdb
+OBJ_RL= ${OBJ_ROOT}/../lib/libreadli

svn commit: r268462 - head/release/doc/en_US.ISO8859-1/relnotes

2014-07-09 Thread Glen Barber
Author: gjb
Date: Wed Jul  9 16:07:36 2014
New Revision: 268462
URL: http://svnweb.freebsd.org/changeset/base/268462

Log:
  Document r268461, readline(3) shlib no longer installed, and
  statically linked into consumers in the base system.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/release/doc/en_US.ISO8859-1/relnotes/article.xml

Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- head/release/doc/en_US.ISO8859-1/relnotes/article.xml   Wed Jul  9 
15:52:30 2014(r268461)
+++ head/release/doc/en_US.ISO8859-1/relnotes/article.xml   Wed Jul  9 
16:07:36 2014(r268462)
@@ -360,6 +360,11 @@
   /usr/local/etc/newsyslog.conf.d/
   directories by default for &man.newsyslog.8;.
 
+The &man.readline.3; library is now
+  statically linked in software within the base system, and the
+  shared library is no longer installed, allowing the Ports
+  Collection to use a modern version of the library.
+
 
   /etc/rc.d Scripts
 
___
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"


Re: svn commit: r268461 - in head: . gnu/lib/libreadline gnu/lib/libreadline/history gnu/lib/libreadline/readline gnu/lib/libreadline/readline/doc gnu/usr.bin/gdb gnu/usr.bin/gdb/gdb gnu/usr.bin/gdb/g

2014-07-09 Thread Pedro Giffuni


On 07/09/14 10:52, Baptiste Daroussin wrote:

Author: bapt
Date: Wed Jul  9 15:52:30 2014
New Revision: 268461
URL: http://svnweb.freebsd.org/changeset/base/268461

Log:
   The GNU readline library is now an INTERNALLIB - that is, it is
   statically linked into consumers (GDB and variants) in the base
   system, and the shared library is no longer installed.
   
   That also allows ports to be able to use a modern version of readline
  


Nice, thank you.
I guess libgnuregex is also a good candidate for such treatment :).

For a related reading:

http://dtrace.org/blogs/wesolows/2014/04/10/libsunw_ssl-or-how-smartos-avoids-sadness/

Cheers,

Pedro.
___
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"


Re: svn commit: r268461 - in head: . gnu/lib/libreadline gnu/lib/libreadline/history gnu/lib/libreadline/readline gnu/lib/libreadline/readline/doc gnu/usr.bin/gdb gnu/usr.bin/gdb/gdb gnu/usr.bin/gdb/g

2014-07-09 Thread Adrian Chadd
Hi,

By doing this you're actually making more work for the really embedded
people who have size constraints on things.

I dislike privatelib but it at least allows for code sharing where
before people would just statically link things into binaries.

I've had to actively undo this kind of dumb before in order to get
things to fit on very small flash root filesystems.

Shared libraries are good. Please stop assuming we have lots of disk
space and RAM to have duplicates of things floating around.

I request that if you're going to de-shareify things in the future you
at least bring it up with the embedded crowd to see if we can find a
way or two to make it work. The review list doesn't have anyone on it
even remotely caring about memory or storage pressures.



Thanks,



-a


On 9 July 2014 09:08, Pedro Giffuni  wrote:
>
> On 07/09/14 10:52, Baptiste Daroussin wrote:
>>
>> Author: bapt
>> Date: Wed Jul  9 15:52:30 2014
>> New Revision: 268461
>> URL: http://svnweb.freebsd.org/changeset/base/268461
>>
>> Log:
>>The GNU readline library is now an INTERNALLIB - that is, it is
>>statically linked into consumers (GDB and variants) in the base
>>system, and the shared library is no longer installed.
>>   That also allows ports to be able to use a modern version of
>> readline
>>
>
>
> Nice, thank you.
> I guess libgnuregex is also a good candidate for such treatment :).
>
> For a related reading:
>
> http://dtrace.org/blogs/wesolows/2014/04/10/libsunw_ssl-or-how-smartos-avoids-sadness/
>
> Cheers,
>
> Pedro.
>
___
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"


Re: svn commit: r268461 - in head: . gnu/lib/libreadline gnu/lib/libreadline/history gnu/lib/libreadline/readline gnu/lib/libreadline/readline/doc gnu/usr.bin/gdb gnu/usr.bin/gdb/gdb gnu/usr.bin/gdb/g

2014-07-09 Thread Baptiste Daroussin
On Wed, Jul 09, 2014 at 10:12:27AM -0700, Adrian Chadd wrote:
> Hi,
> 
> By doing this you're actually making more work for the really embedded
> people who have size constraints on things.
> 
> I dislike privatelib but it at least allows for code sharing where
> before people would just statically link things into binaries.

do you install gdb on your embedded environnement? because that is the only
user of libreadline.
> 
> I've had to actively undo this kind of dumb before in order to get
> things to fit on very small flash root filesystems.
> 
> Shared libraries are good. Please stop assuming we have lots of disk
> space and RAM to have duplicates of things floating around.

Facts:
Before
gdb + kgdb + gdbtui + libreadline.so.8 + libhistory.so.8 = 8976 k
After
gdb + kgdb + gdbtui = 8973 k

I don't think I have damaged too much your embedded system am I wrong?

Do I miss something?

(Yes I have checked that before turning into an internallib given my first
approach was to turn into a privatelib.

regards,
Bapt


pgp2r5pBe401R.pgp
Description: PGP signature


svn commit: r268463 - head/lib/libproc

2014-07-09 Thread Dimitry Andric
Author: dim
Date: Wed Jul  9 17:31:57 2014
New Revision: 268463
URL: http://svnweb.freebsd.org/changeset/base/268463

Log:
  In libproc, avoid calling __cxa_demangle(), and thus depending on either
  libcxxrt or libsupc++, if WITHOUT_CXX is defined.
  
  Noticed by:   sbruno
  MFC after:1 week

Modified:
  head/lib/libproc/Makefile
  head/lib/libproc/proc_sym.c

Modified: head/lib/libproc/Makefile
==
--- head/lib/libproc/Makefile   Wed Jul  9 16:07:36 2014(r268462)
+++ head/lib/libproc/Makefile   Wed Jul  9 17:31:57 2014(r268463)
@@ -15,7 +15,9 @@ INCS= libproc.h
 
 CFLAGS+=   -I${.CURDIR}
 
-.if ${MK_LIBCPLUSPLUS} != "no"
+.if ${MK_CXX} == "no"
+CFLAGS+=   -DNO_CXA_DEMANGLE
+.elif ${MK_LIBCPLUSPLUS} != "no"
 LDADD+=-lcxxrt
 DPADD+=${LIBCXXRT}
 .else

Modified: head/lib/libproc/proc_sym.c
==
--- head/lib/libproc/proc_sym.c Wed Jul  9 16:07:36 2014(r268462)
+++ head/lib/libproc/proc_sym.c Wed Jul  9 17:31:57 2014(r268463)
@@ -46,27 +46,34 @@
 
 #include "_libproc.h"
 
+#ifndef NO_CXA_DEMANGLE
 extern char *__cxa_demangle(const char *, char *, size_t *, int *);
+#endif /* NO_CXA_DEMANGLE */
 
 static voidproc_rdl2prmap(rd_loadobj_t *, prmap_t *);
 
 static void
 demangle(const char *symbol, char *buf, size_t len)
 {
+#ifndef NO_CXA_DEMANGLE
char *dembuf;
-   size_t demlen = len;
+   size_t demlen;
 
-   dembuf = malloc(len);
-   if (!dembuf)
-   goto fail;
-   dembuf = __cxa_demangle(symbol, dembuf, &demlen, NULL);
-   if (!dembuf)
-   goto fail;
-   strlcpy(buf, dembuf, len);
-   free(dembuf);
+   if (symbol[0] == '_' && symbol[1] == 'Z' && symbol[2]) {
+   dembuf = malloc(len);
+   if (!dembuf)
+   goto fail;
+   demlen = len;
+   dembuf = __cxa_demangle(symbol, dembuf, &demlen, NULL);
+   if (!dembuf)
+   goto fail;
+   strlcpy(buf, dembuf, len);
+   free(dembuf);
+   }
 
return;
 fail:
+#endif /* NO_CXA_DEMANGLE */
strlcpy(buf, symbol, len);
 }
 
@@ -297,10 +304,7 @@ proc_addr2sym(struct proc_handle *p, uin
if (addr >= rsym && addr < rsym + sym.st_size) {
s = elf_strptr(e, dynsymstridx, sym.st_name);
if (s) {
-   if (s[0] == '_' && s[1] == 'Z' && s[2])
-   demangle(s, name, namesz);
-   else
-   strlcpy(name, s, namesz);
+   demangle(s, name, namesz);
memcpy(symcopy, &sym, sizeof(sym));
/*
 * DTrace expects the st_value to contain
@@ -335,10 +339,7 @@ symtab:
if (addr >= rsym && addr < rsym + sym.st_size) {
s = elf_strptr(e, symtabstridx, sym.st_name);
if (s) {
-   if (s[0] == '_' && s[1] == 'Z' && s[2])
-   demangle(s, name, namesz);
-   else
-   strlcpy(name, s, namesz);
+   demangle(s, name, namesz);
memcpy(symcopy, &sym, sizeof(sym));
/*
 * DTrace expects the st_value to contain
___
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"


Fix private/internal lib (was Re: svn commit: r268461 - in head: . gnu/lib/libreadline) gnu/lib/libreadline/history gnu/lib/libreadline/readline gnu/lib/libreadline/readline/doc gnu/usr.bin/gdb gnu/us

2014-07-09 Thread Baptiste Daroussin
On Wed, Jul 09, 2014 at 11:08:04AM -0500, Pedro Giffuni wrote:
> 
> On 07/09/14 10:52, Baptiste Daroussin wrote:
> > Author: bapt
> > Date: Wed Jul  9 15:52:30 2014
> > New Revision: 268461
> > URL: http://svnweb.freebsd.org/changeset/base/268461
> >
> > Log:
> >The GNU readline library is now an INTERNALLIB - that is, it is
> >statically linked into consumers (GDB and variants) in the base
> >system, and the shared library is no longer installed.
> >
> >That also allows ports to be able to use a modern version of readline
> >   
> 
> Nice, thank you.
> I guess libgnuregex is also a good candidate for such treatment :).
> 
gnuregex is another beast it is used in at more places:
- GNU diff
- GNU grep
- BSD grep
- gdb
- kgdb
- gdbtui

That makes it more a candidate for privatellib, but private lib needs to be
fixed first, it has a couple of problems so far:
- it installs .so, .a and _p.a files while it shouldn't
- they are listed in bsd.libnames.mk so exposed to any bsd.*.mk users when it
  should only be internal of to out build system
- when a part of the system tries to link to a privatelib it links to
  ${DESTDIR}/usr/lib/private/${LIB}.so when it should link to the path on OBJDIR
  because the .so is not supposed to be installed into the target.

We need a framework internal to the build system (aka not installed in base)
that list the privatelib/internallib (looks at the ugly thing I have done in
gdb/Makefile.inc) and we need to link to the .so/a which it in the OBJDIR not in
the DESTDIR.

I have no idea how to do that right now (Warner any idea coming into your mind?)

regards,
Bapt


pgpJMwz6CaFsH.pgp
Description: PGP signature


Re: svn commit: r267424 - in head: share/mk tools/build/options

2014-07-09 Thread Warner Losh

On Jul 8, 2014, at 8:34 PM, Julio Merino  wrote:

> On Tue, Jul 8, 2014 at 10:32 PM, Glen Barber  wrote:
>> On Tue, Jul 08, 2014 at 10:28:25PM -0400, Julio Merino wrote:
>>> On Tue, Jul 8, 2014 at 9:07 PM, Glen Barber  wrote:
 This is one of the build failure cases:
 
 https://lists.freebsd.org/pipermail/freebsd-tinderbox/2014-June/014357.html
>>> 
>>> Am I reading that right in that this was on a 9.2-STABLE host building HEAD?
>> 
>> Yes.
>> 
>> (I have no idea why, to be honest.  The tinderbox are outside of the
>> cluster admins control.)
> 
> OK.  Regardless, I suppose that being able to build HEAD from the
> supported releases is supposed to work?  Even from 8.4?  Will
> investigate for 9.x.

The officially supported list is (and has been since FreeBSD 5 was current):

HEAD builds on “recent” -current systems, tip of the latest stable branch, 
latest stable branch latest release.

That’s the entire supported list.

What often works is: HEAD builds on any system back to the branch point of the 
most recent stable branch and any point on the stable branch. Frequently back 
one or two stable branches. We have people actively ensuring that most points 
on the latest stable branch (10) work, and at least one person who submits 
fixes for 9 and I don’t think we’ve broken 8 (there may be a person for that 
too, I haven’t seen any commits).

Currently, we can build on 8.4 (last time I checked), but that may change with 
the next clang import since 8.4 doesn’t have a compiler that can build it. We 
administratively block 7.x support and have removed it from our build system. 
Really old branches are impossible to test, so we balance GCing support for 
them with their usefulness.

Warner
___
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"


Re: svn commit: r268461 - in head: . gnu/lib/libreadline gnu/lib/libreadline/history gnu/lib/libreadline/readline gnu/lib/libreadline/readline/doc gnu/usr.bin/gdb gnu/usr.bin/gdb/gdb gnu/usr.bin/gdb/g

2014-07-09 Thread Adrian Chadd
On 9 July 2014 10:23, Baptiste Daroussin  wrote:
> On Wed, Jul 09, 2014 at 10:12:27AM -0700, Adrian Chadd wrote:
>> Hi,
>>
>> By doing this you're actually making more work for the really embedded
>> people who have size constraints on things.
>>
>> I dislike privatelib but it at least allows for code sharing where
>> before people would just statically link things into binaries.
>
> do you install gdb on your embedded environnement? because that is the only
> user of libreadline.

See below.

>>
>> I've had to actively undo this kind of dumb before in order to get
>> things to fit on very small flash root filesystems.
>>
>> Shared libraries are good. Please stop assuming we have lots of disk
>> space and RAM to have duplicates of things floating around.
>
> Facts:
> Before
> gdb + kgdb + gdbtui + libreadline.so.8 + libhistory.so.8 = 8976 k
> After
> gdb + kgdb + gdbtui = 8973 k
>
> I don't think I have damaged too much your embedded system am I wrong?
>
> Do I miss something?
>
> (Yes I have checked that before turning into an internallib given my first
> approach was to turn into a privatelib.

Sure, except for the people who have done things like rolled local
configuration/management telnet interfaces for these things. They're
also using libreadline (and things like the cisco UI library.)

And yeah, I do install gdb in there from time to time. Code sometimes
needs debugging. :-)



-a
___
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"


Re: svn commit: r268461 - in head: . gnu/lib/libreadline gnu/lib/libreadline/history gnu/lib/libreadline/readline gnu/lib/libreadline/readline/doc gnu/usr.bin/gdb gnu/usr.bin/gdb/gdb gnu/usr.bin/gdb/g

2014-07-09 Thread Konstantin Belousov
On Wed, Jul 09, 2014 at 11:05:29AM -0700, Adrian Chadd wrote:
> On 9 July 2014 10:23, Baptiste Daroussin  wrote:
> > On Wed, Jul 09, 2014 at 10:12:27AM -0700, Adrian Chadd wrote:
> >> Hi,
> >>
> >> By doing this you're actually making more work for the really embedded
> >> people who have size constraints on things.
> >>
> >> I dislike privatelib but it at least allows for code sharing where
> >> before people would just statically link things into binaries.
> >
> > do you install gdb on your embedded environnement? because that is the only
> > user of libreadline.
> 
> See below.
> 
> >>
> >> I've had to actively undo this kind of dumb before in order to get
> >> things to fit on very small flash root filesystems.
> >>
> >> Shared libraries are good. Please stop assuming we have lots of disk
> >> space and RAM to have duplicates of things floating around.
> >
> > Facts:
> > Before
> > gdb + kgdb + gdbtui + libreadline.so.8 + libhistory.so.8 = 8976 k
> > After
> > gdb + kgdb + gdbtui = 8973 k
> >
> > I don't think I have damaged too much your embedded system am I wrong?
> >
> > Do I miss something?
> >
> > (Yes I have checked that before turning into an internallib given my first
> > approach was to turn into a privatelib.
> 
> Sure, except for the people who have done things like rolled local
> configuration/management telnet interfaces for these things. They're
> also using libreadline (and things like the cisco UI library.)
> 
> And yeah, I do install gdb in there from time to time. Code sometimes
> needs debugging. :-)
> 

What Baptiste did is the only correct way to handle the ABI and API
un-stability issues with the third-party libraries.  The change is
good if only for this sole reason.  Private libraries still conflict
with the same library installed by other means, in the single process
image.

That said, if you do development directly on the tiny platforms, the
remote gdb server is probably better solution than the local gdb.
Also, WITH_SHARED_TOOLCHAIN probably would give you much bigger
savings both in disk space and used memory than libreadline and
libgnuregex.  I just abandoned a hope to flip this knob.


pgpQpu5I9XhHh.pgp
Description: PGP signature


svn commit: r268464 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2014-07-09 Thread Xin LI
Author: delphij
Date: Wed Jul  9 18:32:40 2014
New Revision: 268464
URL: http://svnweb.freebsd.org/changeset/base/268464

Log:
  MFV r268452:
  
  Explicitly mark file removal transactions as "presumed to result
  in a net free of space" so they will not fail with ENOSPC.
  
  Illumos issue:4950 files sometimes can't be removed from a full
filesystem
  MFC after:2 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c   Wed Jul  9 
17:31:57 2014(r268463)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c   Wed Jul  9 
18:32:40 2014(r268464)
@@ -672,6 +672,12 @@ dmu_free_long_range_impl(objset_t *os, d
dmu_tx_t *tx = dmu_tx_create(os);
dmu_tx_hold_free(tx, dn->dn_object,
chunk_begin, chunk_end - chunk_begin);
+
+   /*
+* Mark this transaction as typically resulting in a net
+* reduction in space used.
+*/
+   dmu_tx_mark_netfree(tx);
err = dmu_tx_assign(tx, TXG_WAIT);
if (err) {
dmu_tx_abort(tx);
@@ -723,6 +729,7 @@ dmu_free_long_object(objset_t *os, uint6
tx = dmu_tx_create(os);
dmu_tx_hold_bonus(tx, object);
dmu_tx_hold_free(tx, object, 0, DMU_OBJECT_END);
+   dmu_tx_mark_netfree(tx);
err = dmu_tx_assign(tx, TXG_WAIT);
if (err == 0) {
err = dmu_object_free(os, object, tx);

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.cWed Jul 
 9 17:31:57 2014(r268463)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.cWed Jul 
 9 18:32:40 2014(r268464)
@@ -21,7 +21,7 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2012, 2014 by Delphix. All rights reserved.
  */
 
 #include 
@@ -583,6 +583,32 @@ dmu_tx_count_free(dmu_tx_hold_t *txh, ui
txh->txh_space_tounref += unref;
 }
 
+/*
+ * This function marks the transaction as being a "net free".  The end
+ * result is that refquotas will be disabled for this transaction, and
+ * this transaction will be able to use half of the pool space overhead
+ * (see dsl_pool_adjustedsize()).  Therefore this function should only
+ * be called for transactions that we expect will not cause a net increase
+ * in the amount of space used (but it's OK if that is occasionally not true).
+ */
+void
+dmu_tx_mark_netfree(dmu_tx_t *tx)
+{
+   dmu_tx_hold_t *txh;
+
+   txh = dmu_tx_hold_object_impl(tx, tx->tx_objset,
+   DMU_NEW_OBJECT, THT_FREE, 0, 0);
+
+   /*
+* Pretend that this operation will free 1GB of space.  This
+* should be large enough to cancel out the largest write.
+* We don't want to use something like UINT64_MAX, because that would
+* cause overflows when doing math with these values (e.g. in
+* dmu_tx_try_assign()).
+*/
+   txh->txh_space_tofree = txh->txh_space_tounref = 1024 * 1024 * 1024;
+}
+
 void
 dmu_tx_hold_free(dmu_tx_t *tx, uint64_t object, uint64_t off, uint64_t len)
 {

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h   Wed Jul 
 9 17:31:57 2014(r268463)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h   Wed Jul 
 9 18:32:40 2014(r268464)
@@ -569,6 +569,7 @@ void dmu_tx_abort(dmu_tx_t *tx);
 int dmu_tx_assign(dmu_tx_t *tx, enum txg_how txg_how);
 void dmu_tx_wait(dmu_tx_t *tx);
 void dmu_tx_commit(dmu_tx_t *tx);
+void dmu_tx_mark_netfree(dmu_tx_t *tx);
 
 /*
  * To register a commit callback, dmu_tx_callback_register() must be called.

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs

Re: svn commit: r268461 - in head: . gnu/lib/libreadline gnu/lib/libreadline/history gnu/lib/libreadline/readline gnu/lib/libreadline/readline/doc gnu/usr.bin/gdb gnu/usr.bin/gdb/gdb gnu/usr.bin/gdb/g

2014-07-09 Thread Adrian Chadd
On 9 July 2014 11:27, Konstantin Belousov  wrote:
> On Wed, Jul 09, 2014 at 11:05:29AM -0700, Adrian Chadd wrote:
>> On 9 July 2014 10:23, Baptiste Daroussin  wrote:
>> > On Wed, Jul 09, 2014 at 10:12:27AM -0700, Adrian Chadd wrote:
>> >> Hi,
>> >>
>> >> By doing this you're actually making more work for the really embedded
>> >> people who have size constraints on things.
>> >>
>> >> I dislike privatelib but it at least allows for code sharing where
>> >> before people would just statically link things into binaries.
>> >
>> > do you install gdb on your embedded environnement? because that is the only
>> > user of libreadline.
>>
>> See below.
>>
>> >>
>> >> I've had to actively undo this kind of dumb before in order to get
>> >> things to fit on very small flash root filesystems.
>> >>
>> >> Shared libraries are good. Please stop assuming we have lots of disk
>> >> space and RAM to have duplicates of things floating around.
>> >
>> > Facts:
>> > Before
>> > gdb + kgdb + gdbtui + libreadline.so.8 + libhistory.so.8 = 8976 k
>> > After
>> > gdb + kgdb + gdbtui = 8973 k
>> >
>> > I don't think I have damaged too much your embedded system am I wrong?
>> >
>> > Do I miss something?
>> >
>> > (Yes I have checked that before turning into an internallib given my first
>> > approach was to turn into a privatelib.
>>
>> Sure, except for the people who have done things like rolled local
>> configuration/management telnet interfaces for these things. They're
>> also using libreadline (and things like the cisco UI library.)
>>
>> And yeah, I do install gdb in there from time to time. Code sometimes
>> needs debugging. :-)
>>
>
> What Baptiste did is the only correct way to handle the ABI and API
> un-stability issues with the third-party libraries.  The change is
> good if only for this sole reason.  Private libraries still conflict
> with the same library installed by other means, in the single process
> image.
>
> That said, if you do development directly on the tiny platforms, the
> remote gdb server is probably better solution than the local gdb.
> Also, WITH_SHARED_TOOLCHAIN probably would give you much bigger
> savings both in disk space and used memory than libreadline and
> libgnuregex.  I just abandoned a hope to flip this knob.

Alas, if only remote MIPS gdb for (at least kernel) worked.. :-)



-a
___
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: r268466 - head/sys/kern

2014-07-09 Thread Konstantin Belousov
Author: kib
Date: Wed Jul  9 19:11:57 2014
New Revision: 268466
URL: http://svnweb.freebsd.org/changeset/base/268466

Log:
  Current code in sysctl proc.vmmap, which intent is to calculate the
  amount of resident pages, in fact calculates the amount of installed
  pte entries in the region.  Resident pages which were not soft-faulted
  yet are not counted.
  
  Calculate the amount of resident pages by looking in the objects chain
  backing the region.
  
  Add a knob to disable the residency calculation at all.  For large
  sparce regions, either previous or updated algorithm runs for too long
  time, while several introspection tools do not need the (advisory) RSS
  value at all.
  
  PR:   kern/188911
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/kern_proc.c

Modified: head/sys/kern/kern_proc.c
==
--- head/sys/kern/kern_proc.c   Wed Jul  9 18:52:12 2014(r268465)
+++ head/sys/kern/kern_proc.c   Wed Jul  9 19:11:57 2014(r268466)
@@ -141,6 +141,10 @@ uma_zone_t proc_zone;
 int kstack_pages = KSTACK_PAGES;
 SYSCTL_INT(_kern, OID_AUTO, kstack_pages, CTLFLAG_RD, &kstack_pages, 0,
 "Kernel stack size in pages");
+static int vmmap_skip_res_cnt = 0;
+SYSCTL_INT(_kern, OID_AUTO, proc_vmmap_skip_resident_count, CTLFLAG_RW,
+&vmmap_skip_res_cnt, 0,
+"Skip calculation of the pages resident count in kern.proc.vmmap");
 
 CTASSERT(sizeof(struct kinfo_proc) == KINFO_PROC_SIZE);
 #ifdef COMPAT_FREEBSD32
@@ -2136,15 +2140,19 @@ int
 kern_proc_vmmap_out(struct proc *p, struct sbuf *sb)
 {
vm_map_entry_t entry, tmp_entry;
-   unsigned int last_timestamp;
+   struct vattr va;
+   vm_map_t map;
+   vm_page_t m;
+   vm_object_t obj, tobj, lobj;
char *fullpath, *freepath;
struct kinfo_vmentry *kve;
-   struct vattr va;
struct ucred *cred;
-   int error;
struct vnode *vp;
struct vmspace *vm;
-   vm_map_t map;
+   vm_pindex_t pindex;
+   vm_offset_t addr;
+   unsigned int last_timestamp;
+   int error;
 
PROC_LOCK_ASSERT(p, MA_OWNED);
 
@@ -2162,44 +2170,53 @@ kern_proc_vmmap_out(struct proc *p, stru
vm_map_lock_read(map);
for (entry = map->header.next; entry != &map->header;
entry = entry->next) {
-   vm_object_t obj, tobj, lobj;
-   vm_offset_t addr;
-   vm_paddr_t locked_pa;
-   int mincoreinfo;
-
if (entry->eflags & MAP_ENTRY_IS_SUB_MAP)
continue;
 
bzero(kve, sizeof(*kve));
-
-   kve->kve_private_resident = 0;
obj = entry->object.vm_object;
if (obj != NULL) {
-   VM_OBJECT_RLOCK(obj);
+   for (tobj = obj; tobj != NULL;
+   tobj = tobj->backing_object) {
+   VM_OBJECT_RLOCK(tobj);
+   lobj = tobj;
+   }
if (obj->shadow_count == 1)
kve->kve_private_resident =
obj->resident_page_count;
-   }
-   kve->kve_resident = 0;
-   addr = entry->start;
-   while (addr < entry->end) {
-   locked_pa = 0;
-   mincoreinfo = pmap_mincore(map->pmap, addr, &locked_pa);
-   if (locked_pa != 0)
-   vm_page_unlock(PHYS_TO_VM_PAGE(locked_pa));
-   if (mincoreinfo & MINCORE_INCORE)
-   kve->kve_resident++;
-   if (mincoreinfo & MINCORE_SUPER)
-   kve->kve_flags |= KVME_FLAG_SUPER;
-   addr += PAGE_SIZE;
-   }
-
-   for (lobj = tobj = obj; tobj; tobj = tobj->backing_object) {
-   if (tobj != obj)
-   VM_OBJECT_RLOCK(tobj);
-   if (lobj != obj)
-   VM_OBJECT_RUNLOCK(lobj);
-   lobj = tobj;
+   if (vmmap_skip_res_cnt)
+   goto skip_resident_count;
+   for (addr = entry->start; addr < entry->end;
+   addr += PAGE_SIZE) {
+   pindex = OFF_TO_IDX(entry->offset + addr -
+   entry->start);
+   for (tobj = obj;;) {
+   m = vm_page_lookup(tobj, pindex);
+   if (m != NULL)
+   break;
+   if (tobj->backing_object == NULL)
+   break;
+  

svn commit: r268467 - head/lib/libc/gen

2014-07-09 Thread Konstantin Belousov
Author: kib
Date: Wed Jul  9 19:12:18 2014
New Revision: 268467
URL: http://svnweb.freebsd.org/changeset/base/268467

Log:
  Implement sysconf(_SC_GETGR_R_SIZE_MAX) and sysconf(_SC_GETPW_R_SIZE_MAX).
  
  Reported by:  Dmitry Sivachenko 
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/lib/libc/gen/sysconf.c

Modified: head/lib/libc/gen/sysconf.c
==
--- head/lib/libc/gen/sysconf.c Wed Jul  9 19:11:57 2014(r268466)
+++ head/lib/libc/gen/sysconf.c Wed Jul  9 19:12:18 2014(r268467)
@@ -367,11 +367,17 @@ yesno:
 * _POSIX_FILE_LOCKING, so we can't answer this one.
 */
 #endif
-#if _POSIX_THREAD_SAFE_FUNCTIONS > -1
+
+   /*
+* SUSv4tc1 says the following about _SC_GETGR_R_SIZE_MAX and
+* _SC_GETPW_R_SIZE_MAX:
+* Note that sysconf(_SC_GETGR_R_SIZE_MAX) may return -1 if
+* there is no hard limit on the size of the buffer needed to
+* store all the groups returned.
+*/
case _SC_GETGR_R_SIZE_MAX:
case _SC_GETPW_R_SIZE_MAX:
-#error "somebody needs to implement this"
-#endif
+   return (-1);
case _SC_HOST_NAME_MAX:
return (MAXHOSTNAMELEN - 1); /* does not include \0 */
case _SC_LOGIN_NAME_MAX:
___
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: r268469 - head/cddl/contrib/opensolaris/lib/libzfs/common

2014-07-09 Thread Xin LI
Author: delphij
Date: Wed Jul  9 20:57:42 2014
New Revision: 268469
URL: http://svnweb.freebsd.org/changeset/base/268469

Log:
  MFV r268453:
  
  Diff reduction against Illumos.
  
  MFC after: 2 weeks

Modified:
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/lib/libzfs/   (props changed)

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.cWed Jul 
 9 20:40:36 2014(r268468)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.cWed Jul 
 9 20:57:42 2014(r268469)
@@ -22,7 +22,7 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
  * Copyright (c) 2012 DEY Storage Systems, Inc.  All rights reserved.
  * Copyright (c) 2011-2012 Pawel Jakub Dawidek .
  * All rights reserved.
@@ -3873,7 +3873,6 @@ zfs_rename(zfs_handle_t *zhp, const char
 strcmp(property, "none") == 0)) {
flags.nounmount = B_TRUE;
}
-
if (flags.recurse) {
 
parentname = zfs_strdup(zhp->zfs_hdl, zhp->zfs_name);
@@ -3888,8 +3887,7 @@ zfs_rename(zfs_handle_t *zhp, const char
ret = -1;
goto error;
}
-
-   } else {
+   } else if (zhp->zfs_type != ZFS_TYPE_SNAPSHOT) {
if ((cl = changelist_gather(zhp, ZFS_PROP_NAME,
flags.nounmount ? CL_GATHER_DONT_UNMOUNT : 0,
flags.forceunmount ? MS_FORCE : 0)) == NULL) {
@@ -3941,23 +3939,23 @@ zfs_rename(zfs_handle_t *zhp, const char
 * On failure, we still want to remount any filesystems that
 * were previously mounted, so we don't alter the system state.
 */
-   if (!flags.recurse)
+   if (cl != NULL)
(void) changelist_postfix(cl);
} else {
-   if (!flags.recurse) {
+   if (cl != NULL) {
changelist_rename(cl, zfs_get_name(zhp), target);
ret = changelist_postfix(cl);
}
}
 
 error:
-   if (parentname) {
+   if (parentname != NULL) {
free(parentname);
}
-   if (zhrp) {
+   if (zhrp != NULL) {
zfs_close(zhrp);
}
-   if (cl) {
+   if (cl != NULL) {
changelist_free(cl);
}
return (ret);

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
==
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c  Wed Jul 
 9 20:40:36 2014(r268468)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c  Wed Jul 
 9 20:57:42 2014(r268469)
@@ -21,6 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014 by Delphix. All rights reserved.
  */
 
 /*
@@ -736,16 +737,6 @@ zfs_share_proto(zfs_handle_t *zhp, zfs_s
if (!zfs_is_mountable(zhp, mountpoint, sizeof (mountpoint), NULL))
return (0);
 
-#ifdef sun
-   if ((ret = zfs_init_libshare(hdl, SA_INIT_SHARE_API)) != SA_OK) {
-   (void) zfs_error_fmt(hdl, EZFS_SHARENFSFAILED,
-   dgettext(TEXT_DOMAIN, "cannot share '%s': %s"),
-   zfs_get_name(zhp), _sa_errorstr != NULL ?
-   _sa_errorstr(ret) : "");
-   return (-1);
-   }
-#endif
-
for (curr_proto = proto; *curr_proto != PROTO_END; curr_proto++) {
/*
 * Return success if there are no share options.
@@ -756,6 +747,17 @@ zfs_share_proto(zfs_handle_t *zhp, zfs_s
strcmp(shareopts, "off") == 0)
continue;
 
+#ifdef illumos
+   ret = zfs_init_libshare(hdl, SA_INIT_SHARE_API);
+   if (ret != SA_OK) {
+   (void) zfs_error_fmt(hdl, EZFS_SHARENFSFAILED,
+   dgettext(TEXT_DOMAIN, "cannot share '%s': %s"),
+   zfs_get_name(zhp), _sa_errorstr != NULL ?
+   _sa_errorstr(ret) : "");
+   return (-1);
+   }
+#endif
+
/*
 * If the 'zoned' property is set, then zfs_is_mountable()
 * will have already bailed out if we are in the global zone.
___
svn-src-head

svn commit: r268470 - head/cddl/contrib/opensolaris/cmd/zpool

2014-07-09 Thread Xin LI
Author: delphij
Date: Wed Jul  9 21:07:20 2014
New Revision: 268470
URL: http://svnweb.freebsd.org/changeset/base/268470

Log:
  MFV r268454:
  
  Refresh zpool list for each interval in order to produce fresh
  output.
  
  Illumos issue: 4966 zpool list iterator does not update output
  
  MFC after: 2 weeks

Modified:
  head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
==
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.cWed Jul  9 
20:57:42 2014(r268469)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.cWed Jul  9 
21:07:20 2014(r268470)
@@ -3076,17 +3076,10 @@ zpool_do_list(int argc, char **argv)
if (zprop_get_list(g_zfs, props, &cb.cb_proplist, ZFS_TYPE_POOL) != 0)
usage(B_FALSE);
 
-   if ((list = pool_list_get(argc, argv, &cb.cb_proplist, &ret)) == NULL)
-   return (1);
-
-   if (argc == 0 && !cb.cb_scripted && pool_list_count(list) == 0) {
-   (void) printf(gettext("no pools available\n"));
-   zprop_free_list(cb.cb_proplist);
-   return (0);
-   }
-
for (;;) {
-   pool_list_update(list);
+   if ((list = pool_list_get(argc, argv, &cb.cb_proplist,
+   &ret)) == NULL)
+   return (1);
 
if (pool_list_count(list) == 0)
break;
@@ -3109,9 +3102,16 @@ zpool_do_list(int argc, char **argv)
if (count != 0 && --count == 0)
break;
 
+   pool_list_free(list);
(void) sleep(interval);
}
 
+   if (argc == 0 && !cb.cb_scripted && pool_list_count(list) == 0) {
+   (void) printf(gettext("no pools available\n"));
+   ret = 0;
+   }
+
+   pool_list_free(list);
zprop_free_list(cb.cb_proplist);
return (ret);
 }
___
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: r268471 - head/sys/amd64/amd64

2014-07-09 Thread Konstantin Belousov
Author: kib
Date: Wed Jul  9 21:39:40 2014
New Revision: 268471
URL: http://svnweb.freebsd.org/changeset/base/268471

Log:
  For safety, ensure that any consumer of the set_regs() and
  ptrace_set_pc() use the correct return to userspace using iret.
  
  The signal return, PT_CONTINUE (which in fact uses signal return path)
  set the pcb flag already.  The setcontext(2) enforces iret return when
  %rip is incorrect.  Due to this, the change is redundand, but is made
  to ensure that no path which modifies context, forgets to set
  PCB_FULL_IRET.
  
  Inspired by:  CVE-2014-4699
  Reviewed by:  jhb
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/amd64/amd64/machdep.c

Modified: head/sys/amd64/amd64/machdep.c
==
--- head/sys/amd64/amd64/machdep.c  Wed Jul  9 21:07:20 2014
(r268470)
+++ head/sys/amd64/amd64/machdep.c  Wed Jul  9 21:39:40 2014
(r268471)
@@ -2144,7 +2144,9 @@ makectx(struct trapframe *tf, struct pcb
 int
 ptrace_set_pc(struct thread *td, unsigned long addr)
 {
+
td->td_frame->tf_rip = addr;
+   set_pcb_flags(td->td_pcb, PCB_FULL_IRET);
return (0);
 }
 
@@ -2244,8 +2246,8 @@ set_regs(struct thread *td, struct reg *
tp->tf_fs = regs->r_fs;
tp->tf_gs = regs->r_gs;
tp->tf_flags = TF_HASSEGS;
-   set_pcb_flags(td->td_pcb, PCB_FULL_IRET);
}
+   set_pcb_flags(td->td_pcb, PCB_FULL_IRET);
return (0);
 }
 
___
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: r268472 - head/sys/dev/fb

2014-07-09 Thread Aleksandr Rybalko
Author: ray
Date: Wed Jul  9 21:55:34 2014
New Revision: 268472
URL: http://svnweb.freebsd.org/changeset/base/268472

Log:
  Should check fb_read method presence instead of double check for fb_write.
  
  Pointed by: emaste
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/fb/fbd.c

Modified: head/sys/dev/fb/fbd.c
==
--- head/sys/dev/fb/fbd.c   Wed Jul  9 21:39:40 2014(r268471)
+++ head/sys/dev/fb/fbd.c   Wed Jul  9 21:55:34 2014(r268472)
@@ -246,7 +246,7 @@ fb_probe(struct fb_info *info)
return (ENXIO);
 
if (info->fb_write != NULL) {
-   if (info->fb_write == NULL) {
+   if (info->fb_read == NULL) {
return (EINVAL);
}
info->fb_flags |= FB_FLAG_NOMMAP;
___
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: r268473 - in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zhack sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys

2014-07-09 Thread Xin LI
Author: delphij
Date: Wed Jul  9 23:14:59 2014
New Revision: 268473
URL: http://svnweb.freebsd.org/changeset/base/268473

Log:
  MFV r268455:
  
  Use reserved space for ZFS administrative commands.
  
  We reserve 1/2^spa_slop_shift = 1/32 or 3.125% of pool space (or 32MB at
  least) for system use.  Most ZPL operations, e.g. write(2), creat(2), will
  fail with ENOSPC if we fall below this.
  
  Certain operations, e.g. file removal and most administrative actions,
  still permitted until half of the slop space is used.  This would allow
  users to use these operations to free up space in the pool when pool is
  close to full but half of slop space is still free.
  
  A very restricted set of operations that frees up space or change quota
  are always permitted, regardless of the amount of free space.
  
  MFC after: 2 weeks

Modified:
  head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  head/cddl/contrib/opensolaris/cmd/zhack/zhack.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_bookmark.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/cmd/zfs/   (props changed)
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.cWed Jul  9 21:55:34 
2014(r268472)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.cWed Jul  9 23:14:59 
2014(r268473)
@@ -21,7 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
  * Copyright 2012 Milan Jurik. All rights reserved.
  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  * Copyright (c) 2011-2012 Pawel Jakub Dawidek .
@@ -6856,6 +6856,9 @@ zfs_do_bookmark(int argc, char **argv)
case ENOTSUP:
err_msg = "bookmark feature not enabled";
break;
+   case ENOSPC:
+   err_msg = "out of space";
+   break;
default:
err_msg = "unknown error";
break;
@@ -6864,7 +6867,7 @@ zfs_do_bookmark(int argc, char **argv)
dgettext(TEXT_DOMAIN, err_msg));
}
 
-   return (ret);
+   return (ret != 0);
 
 usage:
usage(B_FALSE);

Modified: head/cddl/contrib/opensolaris/cmd/zhack/zhack.c
==
--- head/cddl/contrib/opensolaris/cmd/zhack/zhack.c Wed Jul  9 21:55:34 
2014(r268472)
+++ head/cddl/contrib/opensolaris/cmd/zhack/zhack.c Wed Jul  9 23:14:59 
2014(r268473)
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
  */
 
@@ -362,7 +362,7 @@ zhack_do_feature_enable(int argc, char *
feature.fi_guid);
 
VERIFY0(dsl_sync_task(spa_name(spa), NULL,
-   zhack_feature_enable_sync, &feature, 5));
+   zhack_feature_enable_sync, &feature, 5, ZFS_SPACE_CHECK_NORMAL));
 
spa_close(spa, FTAG);
 
@@ -473,7 +473,8 @@ zhack_do_feature_ref(int argc, char **ar
}
 
VERIFY0(dsl_sync_task(spa_name(spa), NULL,
-   decr ? feature_decr_sync : feature_incr_sync, &feature, 5));
+   decr ? feature_decr_sync : feature_incr_sync, &feature,
+   5, ZFS_SPACE_CHECK_NORMAL));
 
spa_close(spa, FTAG);
 }

Modified: head/sys/cddl/contrib/opensolaris/uts/common

Re: svn commit: r268461 - in head: . gnu/lib/libreadline gnu/lib/libreadline/history gnu/lib/libreadline/readline gnu/lib/libreadline/readline/doc gnu/usr.bin/gdb gnu/usr.bin/gdb/gdb gnu/usr.bin/gdb/g

2014-07-09 Thread Baptiste Daroussin
On Wed, Jul 09, 2014 at 11:05:29AM -0700, Adrian Chadd wrote:
> On 9 July 2014 10:23, Baptiste Daroussin  wrote:
> > On Wed, Jul 09, 2014 at 10:12:27AM -0700, Adrian Chadd wrote:
> >> Hi,
> >>
> >> By doing this you're actually making more work for the really embedded
> >> people who have size constraints on things.
> >>
> >> I dislike privatelib but it at least allows for code sharing where
> >> before people would just statically link things into binaries.
> >
> > do you install gdb on your embedded environnement? because that is the only
> > user of libreadline.
> 
> See below.
> 
> >>
> >> I've had to actively undo this kind of dumb before in order to get
> >> things to fit on very small flash root filesystems.
> >>
> >> Shared libraries are good. Please stop assuming we have lots of disk
> >> space and RAM to have duplicates of things floating around.
> >
> > Facts:
> > Before
> > gdb + kgdb + gdbtui + libreadline.so.8 + libhistory.so.8 = 8976 k
> > After
> > gdb + kgdb + gdbtui = 8973 k
> >
> > I don't think I have damaged too much your embedded system am I wrong?
> >
> > Do I miss something?
> >
> > (Yes I have checked that before turning into an internallib given my first
> > approach was to turn into a privatelib.
> 
> Sure, except for the people who have done things like rolled local
> configuration/management telnet interfaces for these things. They're
> also using libreadline (and things like the cisco UI library.)
> 
> And yeah, I do install gdb in there from time to time. Code sometimes
> needs debugging. :-)
> 
They can in that case use libedit which exports a libreadline compatibility
interface in the base system (it is working well with the known cisco-like UI
things ;) so even in that case I save them space given libedit is required for
/bin/sh (the only known problem can happen if the are using unicode and from my
last test the cisco UI thing is not unicode friendly either so that should make
no difference here for them).

The other thing is there are a couple of ABI incompatibilities between the
libreadline version we have in base and newer libreadline which is getting more
and more use making it more complicated to manage ports that requires newer
readline.

regards,
Bapt


pgpw7vOB7Y7Dv.pgp
Description: PGP signature


Re: svn commit: r268461 - in head: . gnu/lib/libreadline gnu/lib/libreadline/history gnu/lib/libreadline/readline gnu/lib/libreadline/readline/doc gnu/usr.bin/gdb gnu/usr.bin/gdb/gdb gnu/usr.bin/gdb/g

2014-07-09 Thread Adrian Chadd
Sounds good. :)


-a


On 9 July 2014 16:25, Baptiste Daroussin  wrote:
> On Wed, Jul 09, 2014 at 11:05:29AM -0700, Adrian Chadd wrote:
>> On 9 July 2014 10:23, Baptiste Daroussin  wrote:
>> > On Wed, Jul 09, 2014 at 10:12:27AM -0700, Adrian Chadd wrote:
>> >> Hi,
>> >>
>> >> By doing this you're actually making more work for the really embedded
>> >> people who have size constraints on things.
>> >>
>> >> I dislike privatelib but it at least allows for code sharing where
>> >> before people would just statically link things into binaries.
>> >
>> > do you install gdb on your embedded environnement? because that is the only
>> > user of libreadline.
>>
>> See below.
>>
>> >>
>> >> I've had to actively undo this kind of dumb before in order to get
>> >> things to fit on very small flash root filesystems.
>> >>
>> >> Shared libraries are good. Please stop assuming we have lots of disk
>> >> space and RAM to have duplicates of things floating around.
>> >
>> > Facts:
>> > Before
>> > gdb + kgdb + gdbtui + libreadline.so.8 + libhistory.so.8 = 8976 k
>> > After
>> > gdb + kgdb + gdbtui = 8973 k
>> >
>> > I don't think I have damaged too much your embedded system am I wrong?
>> >
>> > Do I miss something?
>> >
>> > (Yes I have checked that before turning into an internallib given my first
>> > approach was to turn into a privatelib.
>>
>> Sure, except for the people who have done things like rolled local
>> configuration/management telnet interfaces for these things. They're
>> also using libreadline (and things like the cisco UI library.)
>>
>> And yeah, I do install gdb in there from time to time. Code sometimes
>> needs debugging. :-)
>>
> They can in that case use libedit which exports a libreadline compatibility
> interface in the base system (it is working well with the known cisco-like UI
> things ;) so even in that case I save them space given libedit is required for
> /bin/sh (the only known problem can happen if the are using unicode and from 
> my
> last test the cisco UI thing is not unicode friendly either so that should 
> make
> no difference here for them).
>
> The other thing is there are a couple of ABI incompatibilities between the
> libreadline version we have in base and newer libreadline which is getting 
> more
> and more use making it more complicated to manage ports that requires newer
> readline.
>
> regards,
> Bapt
___
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: r268475 - in head/sys/boot: i386/boot2 pc98/boot2

2014-07-09 Thread Warner Losh
Author: imp
Date: Thu Jul 10 00:15:42 2014
New Revision: 268475
URL: http://svnweb.freebsd.org/changeset/base/268475

Log:
  Make SERIAL support optional again. Enable it for i386 because a huge
  percentage of machines has a 16550. Disable it for pc98 since only a
  tiny fraction of them have one. These changes save 293 bytes when
  building with clang, but preserves the ability to build with serial if
  you really want.  We now have 92 bytes free (412 with the in-tree gcc).

Modified:
  head/sys/boot/i386/boot2/boot2.c
  head/sys/boot/pc98/boot2/boot2.c

Modified: head/sys/boot/i386/boot2/boot2.c
==
--- head/sys/boot/i386/boot2/boot2.cThu Jul 10 00:15:38 2014
(r268474)
+++ head/sys/boot/i386/boot2/boot2.cThu Jul 10 00:15:42 2014
(r268475)
@@ -34,9 +34,22 @@ __FBSDID("$FreeBSD$");
 #include "boot2.h"
 #include "lib.h"
 
+/* Define to 0 to omit serial support */
+#ifndef SERIAL
+#define SERIAL 1
+#endif
+
 #define IO_KEYBOARD1
 #define IO_SERIAL  2
 
+#if SERIAL
+#define DO_KBD (ioctrl & IO_KEYBOARD)
+#define DO_SIO (ioctrl & IO_SERIAL)
+#else
+#define DO_KBD (1)
+#define DO_SIO (0)
+#endif
+
 #define SECOND 18  /* Circa that many ticks in a second. */
 
 #define RBX_ASKNAME0x0 /* -a */
@@ -131,9 +144,11 @@ static struct dsk {
 static char cmd[512], cmddup[512], knamebuf[1024];
 static const char *kname;
 static uint32_t opts;
-static int comspeed = SIOSPD;
 static struct bootinfo bootinfo;
+#if SERIAL
+static int comspeed = SIOSPD;
 static uint8_t ioctrl = IO_KEYBOARD;
+#endif
 
 void exit(int);
 static void load(void);
@@ -276,7 +291,7 @@ main(void)
   "boot: ",
   dsk.drive & DRV_MASK, dev_nm[dsk.type], dsk.unit,
   'a' + dsk.part, kname);
-   if (ioctrl & IO_SERIAL)
+   if (DO_SIO)
sio_flush();
if (!autoboot || keyhit(3*SECOND))
getstr();
@@ -398,6 +413,7 @@ parse()
}
printf("Keyboard: %s\n", cp);
continue;
+#if SERIAL
} else if (c == 'S') {
j = 0;
while ((unsigned int)(i = *arg++ - '0') <= 9)
@@ -407,18 +423,21 @@ parse()
break;
}
/* Fall through to error below ('S' not in optstr[]). */
+#endif
}
for (i = 0; c != optstr[i]; i++)
if (i == NOPT - 1)
return -1;
opts ^= OPT_SET(flags[i]);
}
+#if SERIAL
ioctrl = OPT_CHECK(RBX_DUAL) ? (IO_SERIAL|IO_KEYBOARD) :
 OPT_CHECK(RBX_SERIAL) ? IO_SERIAL : IO_KEYBOARD;
-   if (ioctrl & IO_SERIAL) {
+   if (DO_SIO) {
if (sio_init(115200 / comspeed) != 0)
ioctrl &= ~IO_SERIAL;
}
+#endif
} else {
for (q = arg--; *q && *q != '('; q++);
if (*q) {
@@ -626,9 +645,9 @@ keyhit(unsigned ticks)
 static int
 xputc(int c)
 {
-if (ioctrl & IO_KEYBOARD)
+if (DO_KBD)
putc(c);
-if (ioctrl & IO_SERIAL)
+if (DO_SIO)
sio_putc(c);
 return c;
 }
@@ -648,9 +667,9 @@ xgetc(int fn)
 if (OPT_CHECK(RBX_NOINTR))
return 0;
 for (;;) {
-   if (ioctrl & IO_KEYBOARD && getc(1))
+   if (DO_KBD && getc(1))
return fn ? 1 : getc(0);
-   if (ioctrl & IO_SERIAL && sio_ischar())
+   if (DO_SIO && sio_ischar())
return fn ? 1 : sio_getc();
if (fn)
return 0;

Modified: head/sys/boot/pc98/boot2/boot2.c
==
--- head/sys/boot/pc98/boot2/boot2.cThu Jul 10 00:15:38 2014
(r268474)
+++ head/sys/boot/pc98/boot2/boot2.cThu Jul 10 00:15:42 2014
(r268475)
@@ -36,9 +36,22 @@ __FBSDID("$FreeBSD$");
 #include "boot2.h"
 #include "lib.h"
 
+/* Define to 0 to omit serial support */
+#ifndef SERIAL
+#define SERIAL 0
+#endif
+
 #define IO_KEYBOARD1
 #define IO_SERIAL  2
 
+#if SERIAL
+#define DO_KBD (ioctrl & IO_KEYBOARD)
+#define DO_SIO (ioctrl & IO_SERIAL)
+#else
+#define DO_KBD (1)
+#define DO_SIO (0)
+#endif
+
 #define SECOND 1   /* Circa that many ticks in a second. */
 
 #define RBX_ASKNAME0x0 /* -a */
@@ -133,9 +146,11 @@ static struct dsk {
 static char cmd[512], cmddup[512], knamebuf[1024];
 static const char *kname;
 static uint32_t opts;
-static int comspeed = SIOSPD;
 static struct bootinfo bootinfo;
+#if SERIAL
+static int comspeed = SIOSPD;
 static uint8_t ioctrl = IO_KEYBOARD;
+#endif
 
 void exit(int);
 static void load(void);
@@ -415,7 +430,7 @@ main(void)
   "boot: ",
   dsk.unit, dev_nm[dsk.type], dsk.unit,
   'a' + dsk.part, kname);
-   if (ioctrl & IO_SERIAL)
+   if (DO_SIO)
sio_flush();

svn commit: r268477 - head/share/mk

2014-07-09 Thread Warner Losh
Author: imp
Date: Thu Jul 10 00:15:55 2014
New Revision: 268477
URL: http://svnweb.freebsd.org/changeset/base/268477

Log:
  Now that pc98 no longer needs gcc to compile boot2, remove the special
  case and treat it just like i386.

Modified:
  head/share/mk/src.opts.mk

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Thu Jul 10 00:15:50 2014(r268476)
+++ head/share/mk/src.opts.mk   Thu Jul 10 00:15:55 2014(r268477)
@@ -205,14 +205,7 @@ __DEFAULT_NO_OPTIONS+=CLANG CLANG_FULL C
 .if ${__T} == "amd64" || ${__T} == "arm" || ${__T} == "armv6" || \
 ${__T} == "armv6hf" || ${__T} == "i386"
 __DEFAULT_YES_OPTIONS+=CLANG_IS_CC
-__DEFAULT_NO_OPTIONS+=GNUCXX
-# The pc98 bootloader requires gcc to build and so we must leave gcc enabled
-# for pc98 for now.
-.if ${__TT} == "pc98"
-__DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP
-.else
-__DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP
-.endif
+__DEFAULT_NO_OPTIONS+=GNUCXX GCC GCC_BOOTSTRAP
 .else
 # If clang is not cc, then build gcc by default
 __DEFAULT_NO_OPTIONS+=CLANG_IS_CC CLANG CLANG_BOOTSTRAP
___
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: r268474 - head/sys/boot/pc98/boot2

2014-07-09 Thread Warner Losh
Author: imp
Date: Thu Jul 10 00:15:38 2014
New Revision: 268474
URL: http://svnweb.freebsd.org/changeset/base/268474

Log:
  Merge the clang support from i386. Don't move to clang yet.

Modified:
  head/sys/boot/pc98/boot2/Makefile

Modified: head/sys/boot/pc98/boot2/Makefile
==
--- head/sys/boot/pc98/boot2/Makefile   Wed Jul  9 23:14:59 2014
(r268473)
+++ head/sys/boot/pc98/boot2/Makefile   Thu Jul 10 00:15:38 2014
(r268474)
@@ -26,10 +26,7 @@ BOOT2_UFS?=  UFS1_AND_UFS2
 #BOOT2_UFS?=   UFS1_ONLY
 
 CFLAGS=-Os \
-   -fno-guess-branch-probability \
-fomit-frame-pointer \
-   -fno-unit-at-a-time \
-   -mno-align-long-strings \
-mrtd \
-mregparm=3 \
-D${BOOT2_UFS} \
@@ -46,7 +43,10 @@ CFLAGS=  -Os \
-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
-Winline
 
-CFLAGS.gcc+=   --param max-inline-insns-single=100
+CFLAGS.gcc+=   -fno-guess-branch-probability \
+   -fno-unit-at-a-time \
+   -mno-align-long-strings \
+   --param max-inline-insns-single=100
 
 # Set machine type to PC98_SYSTEM_PARAMETER
 #CFLAGS+=  -DSET_MACHINE_TYPE
@@ -54,6 +54,8 @@ CFLAGS.gcc+=  --param max-inline-insns-si
 # Initialize the bi_bios_geom using the BIOS geometry
 #CFLAGS+=  -DGET_BIOSGEOM
 
+CFLAGS.clang+=${CLANG_OPT_SMALL}
+
 LD_FLAGS=-static -N --gc-sections
 
 # Pick up ../Makefile.inc early.
@@ -112,3 +114,6 @@ boot2.h: boot1.out
REL1=`printf "%d" ${REL1}` > ${.TARGET}
 
 .include 
+
+# XXX: clang integrated-as doesn't grok .codeNN directives yet
+CFLAGS+=   ${CLANG_NO_IAS}
___
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: r268476 - head/sys/boot/pc98/boot2

2014-07-09 Thread Warner Losh
Author: imp
Date: Thu Jul 10 00:15:50 2014
New Revision: 268476
URL: http://svnweb.freebsd.org/changeset/base/268476

Log:
  Compile boot2 with clang on pc98.

Modified:
  head/sys/boot/pc98/boot2/Makefile

Modified: head/sys/boot/pc98/boot2/Makefile
==
--- head/sys/boot/pc98/boot2/Makefile   Thu Jul 10 00:15:42 2014
(r268475)
+++ head/sys/boot/pc98/boot2/Makefile   Thu Jul 10 00:15:50 2014
(r268476)
@@ -3,8 +3,8 @@
 .include 
 
 # XXX: clang can compile the boot code just fine, but boot2 gets too big
-CC:=   gcc
-COMPILER_TYPE:=gcc
+#CC:=  gcc
+#COMPILER_TYPE:=   gcc
 
 NO_PIE=yes
 
___
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: r268479 - head/sys/netinet

2014-07-09 Thread Adrian Chadd
Author: adrian
Date: Thu Jul 10 03:10:56 2014
New Revision: 268479
URL: http://svnweb.freebsd.org/changeset/base/268479

Log:
  Implement the first stage of multi-bind listen sockets and RSS socket
  awareness.
  
  * Introduce IP_BINDMULTI - indicating that it's okay to bind multiple
sockets on the same bind details.
  
Although the PCB code has been taught about this (see below) this patch
doesn't introduce the rest of the PCB changes necessary to distribute
lookups among multiple PCB entries in the global wildcard table.
  
  * Introduce IP_RSS_LISTEN_BUCKET - placing an listen socket into the
given RSS bucket (and thus a single PCBGROUP hash.)
  
  * Modify the PCB add path to be aware of IP_BINDMULTI:
+ Only allow further PCB entries to be added if the owner credentials
  and IP_BINDMULTI has been specified.  Ie, only allow further
  IP_BINDMULTI sockets to appear if the first bind() was IP_BINDMULTI.
  
  * Teach the PCBGROUP code about IP_RSS_LISTE_BUCKET marked PCB entries.
Instead of using the wildcard logic and hashing, these sockets are
simply placed into the PCBGROUP and _not_ in the wildcard hash.
  
  * When doing a PCBGROUP lookup, also do a wildcard match as well.
This allows for an RSS bucket PCB entry to appear in a PCBGROUP
rather than having to exist in the wildcard list.
  
  Tested:
  
  * TCP IPv4 server testing with igb(4)
  * TCP IPv4 server testing with ix(4)
  
  TODO:
  
  * The pcbgroup lookup code duplicated the wildcard and wildcard-PCB
logic.  This could be refactored into a single function.
  
  * This doesn't yet work for IPv6 (The PCBGROUP code in netinet6/ doesn't
yet know about this); nor does it yet fully work for UDP.

Modified:
  head/sys/netinet/in.h
  head/sys/netinet/in_pcb.c
  head/sys/netinet/in_pcb.h
  head/sys/netinet/in_pcbgroup.c
  head/sys/netinet/ip_output.c

Modified: head/sys/netinet/in.h
==
--- head/sys/netinet/in.h   Thu Jul 10 02:15:16 2014(r268478)
+++ head/sys/netinet/in.h   Thu Jul 10 03:10:56 2014(r268479)
@@ -432,6 +432,8 @@ __END_DECLS
 
 #defineIP_ONESBCAST23   /* bool: send all-ones broadcast */
 #defineIP_BINDANY  24   /* bool: allow bind to any address 
*/
+#defineIP_BINDMULTI25   /* bool: allow multiple listeners 
on a tuple */
+#defineIP_RSS_LISTEN_BUCKET26   /* int; set RSS listen bucket */
 
 /*
  * Options for controlling the firewall and dummynet.

Modified: head/sys/netinet/in_pcb.c
==
--- head/sys/netinet/in_pcb.c   Thu Jul 10 02:15:16 2014(r268478)
+++ head/sys/netinet/in_pcb.c   Thu Jul 10 03:10:56 2014(r268479)
@@ -488,6 +488,36 @@ inp_so_options(const struct inpcb *inp)
 
 #ifdef INET
 /*
+ * Check if a new BINDMULTI socket is allowed to be created.
+ *
+ * ni points to the new inp.
+ * oi points to the exisitng inp.
+ *
+ * This checks whether the existing inp also has BINDMULTI and
+ * whether the credentials match.
+ */
+static int
+in_pcbbind_check_bindmulti(const struct inpcb *ni, const struct inpcb *oi)
+{
+   /* Check permissions match */
+   if ((ni->inp_flags2 & INP_BINDMULTI) &&
+   (ni->inp_cred->cr_uid !=
+   oi->inp_cred->cr_uid))
+   return (0);
+
+   /* Check the existing inp has BINDMULTI set */
+   if ((ni->inp_flags2 & INP_BINDMULTI) &&
+   ((oi->inp_flags2 & INP_BINDMULTI) == 0))
+   return (0);
+
+   /*
+* We're okay - either INP_BINDMULTI isn't set on ni, or
+* it is and it matches the checks.
+*/
+   return (1);
+}
+
+/*
  * Set up a bind operation on a PCB, performing port allocation
  * as required, but do not actually modify the PCB. Callers can
  * either complete the bind by setting inp_laddr/inp_lport and
@@ -589,6 +619,7 @@ in_pcbbind_setup(struct inpcb *inp, stru
 * This entire block sorely needs a rewrite.
 */
if (t &&
+   ((inp->inp_flags2 & INP_BINDMULTI) == 0) &&
((t->inp_flags & INP_TIMEWAIT) == 0) &&
(so->so_type != SOCK_STREAM ||
 ntohl(t->inp_faddr.s_addr) == INADDR_ANY) 
&&
@@ -598,6 +629,15 @@ in_pcbbind_setup(struct inpcb *inp, stru
(inp->inp_cred->cr_uid !=
 t->inp_cred->cr_uid))
return (EADDRINUSE);
+
+   /*
+* If the socket is a BINDMULTI socket, then
+* the credentials need to match and the
+* original socket also has to have been bound
+

svn commit: r268480 - head/sys/dev/virtio

2014-07-09 Thread Bryan Venteicher
Author: bryanv
Date: Thu Jul 10 05:26:01 2014
New Revision: 268480
URL: http://svnweb.freebsd.org/changeset/base/268480

Log:
  Add accessor to get the number of free descriptors in the virtqueue
  
  MFC after:1 month

Modified:
  head/sys/dev/virtio/virtqueue.c
  head/sys/dev/virtio/virtqueue.h

Modified: head/sys/dev/virtio/virtqueue.c
==
--- head/sys/dev/virtio/virtqueue.c Thu Jul 10 03:10:56 2014
(r268479)
+++ head/sys/dev/virtio/virtqueue.c Thu Jul 10 05:26:01 2014
(r268480)
@@ -375,6 +375,13 @@ virtqueue_size(struct virtqueue *vq)
 }
 
 int
+virtqueue_nfree(struct virtqueue *vq)
+{
+
+   return (vq->vq_free_cnt);
+}
+
+int
 virtqueue_empty(struct virtqueue *vq)
 {
 

Modified: head/sys/dev/virtio/virtqueue.h
==
--- head/sys/dev/virtio/virtqueue.h Thu Jul 10 03:10:56 2014
(r268479)
+++ head/sys/dev/virtio/virtqueue.h Thu Jul 10 05:26:01 2014
(r268480)
@@ -86,6 +86,7 @@ vm_paddr_t virtqueue_paddr(struct virtqu
 int virtqueue_full(struct virtqueue *vq);
 int virtqueue_empty(struct virtqueue *vq);
 int virtqueue_size(struct virtqueue *vq);
+int virtqueue_nfree(struct virtqueue *vq);
 int virtqueue_nused(struct virtqueue *vq);
 voidvirtqueue_notify(struct virtqueue *vq);
 voidvirtqueue_dump(struct virtqueue *vq);
___
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: r268481 - head/sys/dev/virtio/network

2014-07-09 Thread Bryan Venteicher
Author: bryanv
Date: Thu Jul 10 05:36:04 2014
New Revision: 268481
URL: http://svnweb.freebsd.org/changeset/base/268481

Log:
  Rework when the Tx queue completion interrupt is enabled
  
  The Tx interrupt is now kept disabled in the common case, only
  enabled when the number of free descriptors in the queue falls
  below a threshold. Transmitted frames are cleared from the VQ
  before subsequent transmit, or in the watchdog timer.
  
  This was a very big performance improvement for an experimental
  Netmap bhyve backend.
  
  MFC after:1 month

Modified:
  head/sys/dev/virtio/network/if_vtnet.c
  head/sys/dev/virtio/network/if_vtnetvar.h

Modified: head/sys/dev/virtio/network/if_vtnet.c
==
--- head/sys/dev/virtio/network/if_vtnet.c  Thu Jul 10 05:26:01 2014
(r268480)
+++ head/sys/dev/virtio/network/if_vtnet.c  Thu Jul 10 05:36:04 2014
(r268481)
@@ -128,6 +128,8 @@ static int  vtnet_rxq_eof(struct vtnet_rx
 static voidvtnet_rx_vq_intr(void *);
 static voidvtnet_rxq_tq_intr(void *, int);
 
+static int vtnet_txq_below_threshold(struct vtnet_txq *);
+static int vtnet_txq_notify(struct vtnet_txq *);
 static voidvtnet_txq_free_mbufs(struct vtnet_txq *);
 static int vtnet_txq_offload_ctx(struct vtnet_txq *, struct mbuf *,
int *, int *, int *);
@@ -149,7 +151,7 @@ static void vtnet_txq_tq_deferred(void *
 #endif
 static voidvtnet_txq_start(struct vtnet_txq *);
 static voidvtnet_txq_tq_intr(void *, int);
-static voidvtnet_txq_eof(struct vtnet_txq *);
+static int vtnet_txq_eof(struct vtnet_txq *);
 static voidvtnet_tx_vq_intr(void *);
 static voidvtnet_tx_start_all(struct vtnet_softc *);
 
@@ -206,6 +208,8 @@ static void vtnet_ifmedia_sts(struct ifn
 static voidvtnet_get_hwaddr(struct vtnet_softc *);
 static voidvtnet_set_hwaddr(struct vtnet_softc *);
 static voidvtnet_vlan_tag_remove(struct mbuf *);
+static voidvtnet_set_rx_process_limit(struct vtnet_softc *);
+static voidvtnet_set_tx_intr_threshold(struct vtnet_softc *);
 
 static voidvtnet_setup_rxq_sysctl(struct sysctl_ctx_list *,
struct sysctl_oid_list *, struct vtnet_rxq *);
@@ -241,19 +245,6 @@ TUNABLE_INT("hw.vtnet.mq_max_pairs", &vt
 static int vtnet_rx_process_limit = 512;
 TUNABLE_INT("hw.vtnet.rx_process_limit", &vtnet_rx_process_limit);
 
-/*
- * Reducing the number of transmit completed interrupts can improve
- * performance. To do so, the define below keeps the Tx vq interrupt
- * disabled and adds calls to vtnet_txeof() in the start and watchdog
- * paths. The price to pay for this is the m_free'ing of transmitted
- * mbufs may be delayed until the watchdog fires.
- *
- * BMV: Reintroduce this later as a run-time option, if it makes
- * sense after the EVENT_IDX feature is supported.
- *
- * #define VTNET_TX_INTR_MODERATION
- */
-
 static uma_zone_t vtnet_tx_header_zone;
 
 static struct virtio_feature_desc vtnet_feature_desc[] = {
@@ -903,7 +894,6 @@ vtnet_setup_interface(struct vtnet_softc
 {
device_t dev;
struct ifnet *ifp;
-   int limit;
 
dev = sc->vtnet_dev;
 
@@ -1002,11 +992,8 @@ vtnet_setup_interface(struct vtnet_softc
vtnet_unregister_vlan, sc, EVENTHANDLER_PRI_FIRST);
}
 
-   limit = vtnet_tunable_int(sc, "rx_process_limit",
-   vtnet_rx_process_limit);
-   if (limit < 0)
-   limit = INT_MAX;
-   sc->vtnet_rx_process_limit = limit;
+   vtnet_set_rx_process_limit(sc);
+   vtnet_set_tx_intr_threshold(sc);
 
return (0);
 }
@@ -1897,6 +1884,44 @@ vtnet_rxq_tq_intr(void *xrxq, int pendin
VTNET_RXQ_UNLOCK(rxq);
 }
 
+static int
+vtnet_txq_below_threshold(struct vtnet_txq *txq)
+{
+   struct vtnet_softc *sc;
+   struct virtqueue *vq;
+
+   sc = txq->vtntx_sc;
+   vq = txq->vtntx_vq;
+
+   return (virtqueue_nfree(vq) <= sc->vtnet_tx_intr_thresh);
+}
+
+static int
+vtnet_txq_notify(struct vtnet_txq *txq)
+{
+   struct virtqueue *vq;
+
+   vq = txq->vtntx_vq;
+
+   txq->vtntx_watchdog = VTNET_TX_TIMEOUT;
+   virtqueue_notify(vq);
+
+   if (vtnet_txq_enable_intr(txq) == 0)
+   return (0);
+
+   /*
+* Drain frames that were completed since last checked. If this
+* causes the queue to go above the threshold, the caller should
+* continue transmitting.
+*/
+   if (vtnet_txq_eof(txq) != 0 && vtnet_txq_below_threshold(txq) == 0) {
+   virtqueue_disable_intr(vq);
+   return (1);
+   }
+
+   return (0);
+}
+
 static void
 vtnet_txq_free_mbufs(struct vtnet_txq *txq)
 {
@@ -2171,11 +2196,11 @@ vtnet_start_locked(struct vtnet_txq *txq
struct vtnet_softc *sc;
struct virtqueue *vq;
struct mbuf *m0;
-   int enq;
+   int tries, enq;
 
sc = txq->vtntx_sc;
vq = txq->vtntx

Re: svn commit: r268461 - in head: . gnu/lib/libreadline gnu/lib/libreadline/history gnu/lib/libreadline/readline gnu/lib/libreadline/readline/doc gnu/usr.bin/gdb gnu/usr.bin/gdb/gdb gnu/usr.bin/gdb/g

2014-07-09 Thread Bruce Evans

On Wed, 9 Jul 2014, Konstantin Belousov wrote:


On Wed, Jul 09, 2014 at 11:05:29AM -0700, Adrian Chadd wrote:

On 9 July 2014 10:23, Baptiste Daroussin  wrote:

On Wed, Jul 09, 2014 at 10:12:27AM -0700, Adrian Chadd wrote:

Hi,

By doing this you're actually making more work for the really embedded
people who have size constraints on things.

I dislike privatelib but it at least allows for code sharing where
before people would just statically link things into binaries.


do you install gdb on your embedded environnement? because that is the only
user of libreadline.


See below.


I've had to actively undo this kind of dumb before in order to get
things to fit on very small flash root filesystems.

Shared libraries are good. Please stop assuming we have lots of disk
space and RAM to have duplicates of things floating around.


Shared libraries are not good.  They save a little disk space but cost an
enormous amount of RAM.  E.g.:

FreeBSD-~5.2 i386, statically linked:
  PID USERNAME  THR PRI NICE   SIZERES STATETIME   WCPU COMMAND
 1101 bde 1  760  1392K   780K RUN  0:00  0.00% top

FreeBSD-11 i386, dynamically linked:
  PID USERNAME   THR PRI NICE   SIZERES STATE   C   TIMEWCPU COMMAN
25085 bde  1  210 11260K  2432K STOP4   0:00   0.00% top

Here dynamic linkage and perhaps other bloat takes 3 times as much RAM (RES)
and 8 times as much virtual memory (SIZE).  For long-running programs, even
more RAM (or swap to the disk that you apparently don't have on embedded
systems), it is likely for more of the shared library virtual memory to
be written to so that it becomes physical.  This might explain the even
larger RAM uses in the following:

FreeBSD-~5.2 i386, statically linked:
  PID USERNAME  THR PRI NICE   SIZERES STATETIME   WCPU COMMAND
  681 root1  760  1676K  1132K select   0:00  0.00% sshd
  659 root1  44   r0   848K   536K select   0:00  0.00% ntpd
  688 root1  760  2084K  1796K select   0:00  0.00% sendmail

FreeBSD-11 i386, dynamically linked:
  PID USERNAME   THR PRI NICE   SIZERES STATE   C   TIMEWCPU COMMAN
25072 bde  1  200 17836K  6556K select  1   0:00   0.00% sshd
  693 root 1  200 12356K  4168K select  4   0:02   0.00% ntpd
  744 root 1  200 12868K  4752K select  0   0:01   0.00% sendma

Here dynamic sshd takes almost 6 times as much RAM; dynamic ntpd almost
8 times as much, but dymamic sendmail takes less than 3 times as much.

The output also shows misformatting of the USERNAME column in newer versions
of FreeBSD (lots of unused whitespace to kill the command name non-whitespace).

However, I would like the option to link any library shared, in case I
want to optimize disk space at the cost of RAM and runtime.


What Baptiste did is the only correct way to handle the ABI and API
un-stability issues with the third-party libraries.  The change is
good if only for this sole reason.  Private libraries still conflict
with the same library installed by other means, in the single process
image.


Works even better for libc :-).  Static libraries also insulate from
the latest bloat and security holes.  There main problem is that they
give old security holes instead.

Bruce
___
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"