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


On 30 Jun 1998 07:54:04 -0700, Ulrich Drepper wrote:
>Zack Weinberg <zack@rabi.phys.columbia.edu> writes:
>
>> 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.
>
>Yeah,, this is a problem I'm about to correct these days.  The only
>problem I have is whether the struct shall be defined correctly (using
>user-level types) or using kernel types and maybe the subject of
>changes.  In the former case we might be able to intercept the
>function calls using this struct.

It's only used by sendmsg()/recvmsg(), and we only have to wrap
recvmsg() if I understand this correctly.  The kernel ignores the
cmsg_data for SCM_CREDS (I think).  On the output side it'll write a
struct ucred into cmsg_data, which we grab and modify.  I think the
code will look like

for(h = CMSG_FIRSTHDR(m); h; h = CMSG_NXTHDR(h, m))
  if(h->cmsg_type == SCM_CREDS)
  {
     struct __kernel_ucred u;
     memcpy (u, CMSG_DATA(h), sizeof(struct __kernel_ucred))
     /* and then copy it back but the way userland expects */
  }

I want to use the BSD definition for the user-visible structure -- no
reason to introduce incompatibilities.

I'll try to get you a patch sometime today.

zw


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