[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: r1073 - trunk/glibc-2.3-head/sysdeps/kfreebsd



On Wed, Jan 18, 2006 at 11:27:24PM +0000, Robert Millan wrote:
> Author: rmh
> Date: 2006-01-18 23:27:24 +0000 (Wed, 18 Jan 2006)
> New Revision: 1073
> 
> Modified:
>    trunk/glibc-2.3-head/sysdeps/kfreebsd/uname.c
> Log:
> Rewrite uname.c to use SYS_uname.  Runs 1.54 faster.
> 

This is the comment in the FreeBSD kernel, file sys/kern/kern_xxx.c

/*
 * This is the FreeBSD-1.1 compatable uname(2) interface.  These
 * days it is done in libc as a wrapper around a bunch of sysctl's.
 * This must maintain the old 1.1 binary ABI.
 */

Then if you look at the code corresponding to the syscall, you will see 
that the syscall correspond to a call to the corresponding sysctl, but
truncated:
	
        ...

        name[0] = CTL_KERN;
        name[1] = KERN_OSTYPE;
        len = sizeof (uap->name->sysname);
        mtx_lock(&Giant);
        error = userland_sysctl(td, name, 2, uap->name->sysname, &len,
                1, 0, 0, 0);
        if (error)
                goto done2;
        subyte( uap->name->sysname + sizeof(uap->name->sysname) - 1, 0);

        ...


So, in short the current implementation in our glibc is the correct one.

Bye,
Aurelien

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net



Reply to: