Mateusz Guzik | 30 Oct 02:22 2014

struct filedesc0 eats > 1024 bytes

Since it is allocated from general slab and is > 1024 bytes in size, it
actually occupies 2048 bytes.

NDFILE is 20.

struct filedesc0 {
        struct filedesc fd_fd;
        SLIST_HEAD(, freetable) fd_free;
        struct  filedescent fd_dfiles[NDFILE];

(kgdb) p sizeof(struct filedesc)
$1 = 120
(kgdb) p sizeof(struct filedesc0)
$2 = 1096
(kgdb) p sizeof(struct filedescent)
$3 = 48

Unfotunately there is no way to reoder elements in included structs to
gain enough space (or at least I didn't find any).

Maybe it may be a good idea to reconsider going back to "capability fd"
which is an intermediate object in the future. Next allocation is at 32
fds and that eats over 1500 bytes.

In the meantime I propose decreasing NDFILE by 2. This gives sizeof = 1000
and leaves 24 bytes for possible future additions.

In linux they use 32 as their default, which would still keep us within this
(Continue reading)

Nidal Khalil | 28 Oct 03:50 2014

USB stack driver options for the receive side question

Hello All,
I am setting up usb to transfer 3 frames on the bulk read desriptor but all
I get is one frame transferred?
However if I use .short_frames_ok = 1, then the transfer will pend till the
three frames are received. This code is part of a network driver
I would like to receive the one buffer it i the only one availble and at
most three buffers at a time if the transfer is complete.
Is this a limitation of FreeBSD.
I searched all the drivers in the 9.3 release and I can not find a driver
that is setup to recieve multiple buffers?

Below is my sample code:


                .type      = UE_BULK,

                .endpoint  = UE_ADDR_ANY,

                .direction = UE_DIR_IN,

                .bufsize   = 2000 * HW_IN_PENDING_FRAMES,

                .flags     = {

                        .pipe_bof = 1, .short_xfer_ok = 1, .ext_buffer = 1


                .callback  = dbus_usbos_recv_callback,
(Continue reading)

Baptiste Daroussin | 26 Oct 21:48 2014

libminipkg in base?

Hi all,

I have been hacking on snmp_hostres.c to provide the list of packages again.

Because pkg is not in base and will never be I have been directly calling pkg
to gather the list it works pretty well:

after thinking again about it (and discussing with zi <at> ) about it. I start
thinking that a stable libminipkg that will only do the basic stuff which we
know are stable:
Parsing pkg.conf (to at least be able to discover where the local db should be
in case it is not in /var/db/pkg)
and provide basic query (name of packages, version, timestamp, etc).

So any application just willing to do some basic query (hear bsnmpd, net-snmp
and so) will be able to rely on a stable ABI/API.

For that I will need to import sqlite into base (which anyway is already there
hidden in 3 places svnlite, kerberos) and make it a private lib

Any thought?
Better idea?

Tiwei Bie | 26 Oct 14:47 2014

Questions with 'MPASS(ngrp <= ngroups_max)' assertion in kern_setgroups()

Hello, Mateusz!

The check in kern_setgroups's callers is:

	if (gidsetsize > ngroups_max + 1)
		return (EINVAL);

So, gidsetsize could be (ngroups_max + 1). And under this condition, the assertion

	MPASS(ngrp <= ngroups_max);

in kern_setgroups() will fail. One of them should be fixed.

Tiwei Bie

freebsd-hackers <at> mailing list
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe <at>"

Tiwei Bie | 26 Oct 14:28 2014

[PATCH] Finish the task 'Replace loginclass mutex with rwlock'

Hi, Mateusz!

I have finished the task: Replace loginclass mutex with rwlock [1].

Following is my patch:

diff --git a/sys/kern/kern_loginclass.c b/sys/kern/kern_loginclass.c
index b20f60b..1c2f81d 100644
--- a/sys/kern/kern_loginclass.c
+++ b/sys/kern/kern_loginclass.c
 <at>  <at>  -51,13 +51,13  <at>  <at>  __FBSDID("$FreeBSD$");
 #include <sys/lock.h>
 #include <sys/loginclass.h>
 #include <sys/malloc.h>
-#include <sys/mutex.h>
 #include <sys/types.h>
 #include <sys/priv.h>
 #include <sys/proc.h>
 #include <sys/queue.h>
 #include <sys/racct.h>
 #include <sys/refcount.h>
+#include <sys/rwlock.h>
 #include <sys/sysproto.h>
 #include <sys/systm.h>

 <at>  <at>  -68,8 +68,8  <at>  <at>  LIST_HEAD(, loginclass)	loginclasses;
  * Lock protecting loginclasses list.
-static struct mtx loginclasses_lock;
(Continue reading)

Tiwei Bie | 26 Oct 05:08 2014

[PATCH] Finish the task 'Temporary buffer in setgroups'

Hi, mjg!

I have finished the task: Temporary buffer in setgroups [1].

Following is my patch:

diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c
index f12468d..73f6ab7 100644
--- a/sys/kern/kern_prot.c
+++ b/sys/kern/kern_prot.c
 <at>  <at>  -806,17 +806,24  <at>  <at>  int
 sys_setgroups(struct thread *td, struct setgroups_args *uap)
 	gid_t *groups = NULL;
+	gid_t smallgroups[XU_NGROUPS];
+	u_int gidsetsize;
 	int error;

-	if (uap->gidsetsize > ngroups_max + 1)
+	gidsetsize = uap->gidsetsize;
+	if (gidsetsize > ngroups_max + 1)
 		return (EINVAL);
-	groups = malloc(uap->gidsetsize * sizeof(gid_t), M_TEMP, M_WAITOK);
-	error = copyin(uap->gidset, groups, uap->gidsetsize * sizeof(gid_t));
+	if (gidsetsize > XU_NGROUPS)
+		groups = malloc(gidsetsize * sizeof(gid_t), M_TEMP, M_WAITOK);
+	else
+		groups = smallgroups;
+	error = copyin(uap->gidset, groups, gidsetsize * sizeof(gid_t));
 	if (error)
(Continue reading)

Dan Langille | 25 Oct 18:56 2014

perl isvaliddate function

I’m coding up a sanity check for FreshPorts.  It will verify that field that should be dates are dates.

Feedback welcome.  The system is already using the DATE module, so I’m leveraging that.

Pasted at but included below, because.

$ cat

use Date::Parse qw( str2time );

sub IsValidDate($) {
  my ($string) =  <at> _;

  my $Date = str2time($string);

  return defined($Date);

my $a = '2014-11-30 unless *coin ports remain unfixed';

if (IsValidDate($a)) {
  print "'$a' is a valid date\n";
} else {
  print "'$a' is NOT a valid date\n";

my $b = '2014-02-30';

if (IsValidDate($b)) {
(Continue reading)

rank1seeker | 24 Oct 14:15 2014

tar behavior 9.* -> 10.*

freebsd-hackers <at> mailing list
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe <at>"

Zaphod Beeblebrox | 24 Oct 07:37 2014

ZFS errors on the array but not the disk.

What does it mean when checksum errors appear on the array (and the vdev)
but not on any of the disks?  See the paste below.  One would think that
there isn't some ephemeral data stored somewhere that is not one of the
disks, yet "cksum" errors show only on the vdev and the array lines.  Help?

[2:17:316]root <at> virtual:/vr2/torrent/in> zpool status
  pool: vr2
 state: ONLINE
status: One or more devices is currently being resilvered.  The pool will
        continue to function, possibly in a degraded state.
action: Wait for the resilver to complete.
  scan: resilver in progress since Thu Oct 23 23:11:29 2014
        1.53T scanned out of 22.6T at 62.4M/s, 98h23m to go
        119G resilvered, 6.79% done

        NAME               STATE     READ WRITE CKSUM
        vr2                ONLINE       0     0    36
          raidz1-0         ONLINE       0     0    72
            label/vr2-d0   ONLINE       0     0     0
            label/vr2-d1   ONLINE       0     0     0
            gpt/vr2-d2c    ONLINE       0     0     0  block size: 512B
configured, 4096B native  (resilvering)
            gpt/vr2-d3b    ONLINE       0     0     0  block size: 512B
configured, 4096B native
            gpt/vr2-d4a    ONLINE       0     0     0  block size: 512B
configured, 4096B native
            ada14          ONLINE       0     0     0
            label/vr2-d6   ONLINE       0     0     0
            label/vr2-d7c  ONLINE       0     0     0
(Continue reading)

by via freebsd-hackers | 23 Oct 06:41 2014

FreeBSD Home Page home page seems strange with "Production" and "Upcoming".

freebsd-hackers <at> mailing list
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe <at>"

Zaphod Beeblebrox | 23 Oct 06:08 2014

IPv6 provisioning for a FreeBSD ISP.

Besides the fact that the ngX interfaces appear to have a quirk (or maybe
it's mpd5 or quagga) where remote hosts can't talk to services residing on
the ngX host, A FreeBSD machine with mpd5 and quagga that talk to
freeradius and PostgreSQL serves as a really nice small ISP package.

I already support ipv6 for many users (and have, for some time) using
static gif tunnels.  This works, but it is annoyingly suboptimal.

Now my ISP doesn't allocate addresses from a pool.  I don't care that
people effectively have static addresses.  managing the addresses isn't
difficult and the average user is nailed up more than 98% of the time.  So
I assign a static IPv4 address in PostgreSQL.  Freeradius reads this and
sends it to mpd5 --- which hands out the static addresses ... and even
routed ipv4 netblocks via ipcp (or ipv4cp).

IPv6 works over my pppoe<-->l2tp links.  I can set static addresses on the
ngX connections at both ends, The traffic is passed.  What stops me from
implementing this is the equivalent of the
PostgreSQL->freeradius->mpd5->ipcp communication of the addresses and
settings.  mpd5 doesn't seem to have any builtin handling of the ipv6
addresses and I don't see what other solution will properly hand out static
addresses (and routed networks).

How is this supposed to go together?  DHCP6 doesn't seem to acknowledge
that the user has already logged in via l2tp/ppp.  rtsold doesn't seem to
address static addressing.
freebsd-hackers <at> mailing list
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe <at>"
(Continue reading)