* sysdeps/unix/bsd/bsd4.4/bits/socket.h (struct cmsgcred): New type.
authorRoland McGrath <roland@gnu.org>
Sun, 24 Mar 2002 03:44:57 +0000 (03:44 +0000)
committerRoland McGrath <roland@gnu.org>
Sun, 24 Mar 2002 03:44:57 +0000 (03:44 +0000)
(CMGROUP_MAX): New macro.

ChangeLog
sysdeps/unix/bsd/bsd4.4/bits/socket.h

index dfa2951..ae24014 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2002-03-18  Roland McGrath  <roland@frob.com>
+
+       * sysdeps/unix/bsd/bsd4.4/bits/socket.h (struct cmsgcred): New type.
+       (CMGROUP_MAX): New macro.
+
 2002-03-23  Roland McGrath  <roland@frob.com>
 
        * sysdeps/posix/shm_open.c (SHMDIR): /var/run/shm -> /dev/shm
index 8d442aa..40131d2 100644 (file)
@@ -1,5 +1,5 @@
 /* System-specific socket constants and types.  4.4 BSD version.
-   Copyright (C) 1991,92,1994-1999,2000,2001 Free Software Foundation, Inc.
+   Copyright (C) 1991,92,1994-1999,2000,01,02 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -255,10 +255,30 @@ enum
 #define SCM_RIGHTS SCM_RIGHTS
     SCM_TIMESTAMP = 0x02,      /* Timestamp (struct timeval).  */
 #define SCM_TIMESTAMP SCM_TIMESTAMP
-    SCM_CREDS = 0x03           /* Process creds (strcm cmsgcred).  */
+    SCM_CREDS = 0x03           /* Process creds (struct cmsgcred).  */
 #define SCM_CREDS SCM_CREDS
   };
 
+/* Unfortunately, BSD practice dictates this structure be of fixed size.
+   If there are more than CMGROUP_MAX groups, the list is truncated.
+   (On GNU systems, the `cmcred_euid' field is just the first in the
+   list of effective UIDs.)  */
+#define CMGROUP_MAX    16
+
+/* Structure delivered by SCM_CREDS.  This describes the identity of the
+   sender of the data simultaneously received on the socket.  By BSD
+   convention, this is included only when a sender on a AF_LOCAL socket
+   sends cmsg data of this type and size; the sender's structure is
+   ignored, and the system fills in the various IDs of the sender process.  */
+struct cmsgcred
+  {
+    __pid_t cmcred_pid;
+    __uid_t cmcred_uid;
+    __uid_t cmcred_euid;
+    __gid_t cmcred_gid;
+    int cmcred_ngroups;
+    __gid_t cmcred_groups[CMGROUP_MAX];
+  };
 
 /* Protocol number used to manipulate socket-level options
    with `getsockopt' and `setsockopt'.  */