Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Mar 2017 20:05:31 -0700
From:      John Baldwin <jhb@freebsd.org>
To:        Slawa Olhovchenkov <slw@zxy.spb.ru>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   Re: svn commit: r313450 - in stable/11: lib/libc/gen lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys
Message-ID:  <18428734.CRRuMZqGsJ@ralph.baldwin.cx>
In-Reply-To: <20170315143053.GW15630@zxy.spb.ru>
References:  <201702081832.v18IWZlC001828@repo.freebsd.org> <20170315143053.GW15630@zxy.spb.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday, March 15, 2017 05:30:53 PM Slawa Olhovchenkov wrote:
> On Wed, Feb 08, 2017 at 06:32:35PM +0000, John Baldwin wrote:
> 
> > Author: jhb
> > Date: Wed Feb  8 18:32:35 2017
> > New Revision: 313450
> > URL: https://svnweb.freebsd.org/changeset/base/313450
> > 
> > Log:
> >   MFC 310638:
> >   Rename the 'flags' argument to getfsstat() to 'mode' and validate it.
> >   
> >   This argument is not a bitmask of flags, but only accepts a single value.
> >   Fail with EINVAL if an invalid value is passed to 'flag'.  Rename the
> >   'flags' argument to getmntinfo(3) to 'mode' as well to match.
> >   
> >   This is a followup to r308088.
> 
> >  kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize,
> > -    size_t *countp, enum uio_seg bufseg, int flags)
> > +    size_t *countp, enum uio_seg bufseg, int mode)
> >  {
> >  	struct mount *mp, *nmp;
> >  	struct statfs *sfsp, *sp, *sptmp, *tofree;
> >  	size_t count, maxcount;
> >  	int error;
> >  
> > +	switch (mode) {
> > +	case MNT_WAIT:
> > +	case MNT_NOWAIT:
> > +		break;
> > +	default:
> > +		return (EINVAL);
> > +	}
> >  restart:
> 
> This is break net-snmp UCD-SNMP-MIB::dskTable oid:
> 
>  82434 snmpd    CALL  getfsstat(0,0,<invalid=0>)
>  82434 snmpd    RET   getfsstat -1 errno 22 Invalid argument
>  82434 snmpd    CALL  getfsstat(0,0xfffffffffffffe28,MNT_NOWAIT)
>  82434 snmpd    RET   getfsstat -1 errno 22 Invalid argument
>  82434 snmpd    CALL  write(0x9,0x800f162ea,0x1)

This doesn't seem to match the code in the port:

void
Init_HR_FileSys(void)
{
#if HAVE_GETFSSTAT
#if defined(HAVE_STATVFS) && defined(__NetBSD__)
    fscount = getvfsstat(NULL, 0, ST_NOWAIT);
#else
    fscount = getfsstat(NULL, 0, MNT_NOWAIT);
#endif
    if (fsstats)
        free((char *) fsstats);
    fsstats = NULL;
    fsstats = malloc(fscount * sizeof(*fsstats));
#if defined(HAVE_STATVFS) && defined(__NetBSD__)
    getvfsstat(fsstats, fscount * sizeof(*fsstats), ST_NOWAIT);
#else
    getfsstat(fsstats, fscount * sizeof(*fsstats), MNT_NOWAIT);
#endif
    HRFS_index = 0;

(Here it always calls with MNT_NOWAIT)  This is for net-snmp 5.7.3,
but it seems like that code hasn't changed in quite a while.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?18428734.CRRuMZqGsJ>