about summary refs log tree commit diff
path: root/sysdeps/unix/bsd/bsd4.4
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-03-24 03:44:57 +0000
committerRoland McGrath <roland@gnu.org>2002-03-24 03:44:57 +0000
commit4e6117f3996680e521527e6b4bdac1d306a2ddcf (patch)
tree47ad03a55cb5243bf189de72b36e813c8f5d556e /sysdeps/unix/bsd/bsd4.4
parent4caf4f3c256ebb79f08880d3d5176d16b9936671 (diff)
downloadglibc-4e6117f3996680e521527e6b4bdac1d306a2ddcf.tar.gz
glibc-4e6117f3996680e521527e6b4bdac1d306a2ddcf.tar.xz
glibc-4e6117f3996680e521527e6b4bdac1d306a2ddcf.zip
* sysdeps/unix/bsd/bsd4.4/bits/socket.h (struct cmsgcred): New type.
	(CMGROUP_MAX): New macro.
Diffstat (limited to 'sysdeps/unix/bsd/bsd4.4')
-rw-r--r--sysdeps/unix/bsd/bsd4.4/bits/socket.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/sysdeps/unix/bsd/bsd4.4/bits/socket.h b/sysdeps/unix/bsd/bsd4.4/bits/socket.h
index 8d442aadd4..40131d2e6b 100644
--- a/sysdeps/unix/bsd/bsd4.4/bits/socket.h
+++ b/sysdeps/unix/bsd/bsd4.4/bits/socket.h
@@ -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'.  */