This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: dumb question


   Date: Tue, 30 Jun 1998 08:45:46 -0400
   From: Zack Weinberg <zack@rabi.phys.columbia.edu>

   On Tue, 30 Jun 1998 09:50:52 +0200 (MET DST), Thorsten Kukuk wrote:
   >
   >
   >> On Mon, 29 Jun 1998 23:04:22 -0400, Roland McGrath wrote:
   >> >> anyone know what 'struct ucred' is?
   >> >
   >> >It's a common type in BSD kernels.  Where did you come across it?
   >
   >No, BSD kernels have cmsgcred or so for it, which has much more 
   >information then the Linux ucred struct (At least FreeBSD).

   Another gratuitous incompatibility?  It's not an interface that will
   ever get adopted if it's different all over the map...

   >> In some userspace code that seems to expect it's defined in
   >> sys/types.h.  Or maybe sys/socket.h.  There's a reference in
   >> sysdeps/.../linux/bits/socket.h (__SCM_CREDENTIALS), but the actual
   >> type is not defined anywhere.
   >
   >struct ucred should be definded in sys/socket.h. 
   >
   >Zack, for what do you need struct ucred ? Are you playing with
   >__SCM_CREDENTIALS in the moment ? I have some big problems with it,
   >which I couldn't solve. If I could see code which works, maybe
   >I could find my mistake.

   The code I'm looking at is Alexey Kuznetsov's TLI-over-sockets
   library, which I was trying to package as a glibc addon.  It was
   written to libc5 and assumes struct ucred is in sys/socket.h.  I have
   no idea if the code actually works.

   zw

The BSD's have a sys/ucred.h header file, which defines a struct
ucred.  Maybe we should add it to the Linux port of glibc.  However
the defenition of the BSD struct ucred is different from the Linux
struct ucred (more fields, different names, but no pid field), see  

    http://minnie.cs.adfa.oz.au/FreeBSD-srctree/newsrc/sys/ucred.h.html

The BSD cr_ prefix is more consistent with existing practice, so I
suggest adding it (the number of programs that use struct ucred is
extremely small, the TLI-over-sockets is the only one I known of)
because it more or less prevents namespace pollution (any standard
that defines struct ucred will probably allow additional entries with
a cr_ prefix).  There is however a small inconsistency.  The Linux
struct ucred uses kernel types for pid, uid and gid, and these differ
from the library types.

Mark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]