summaryrefslogtreecommitdiffstats
path: root/lib/libc/posix1e/mac_get.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/posix1e/mac_get.c')
-rw-r--r--lib/libc/posix1e/mac_get.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/libc/posix1e/mac_get.c b/lib/libc/posix1e/mac_get.c
index 7c8f790..bbfe7ed 100644
--- a/lib/libc/posix1e/mac_get.c
+++ b/lib/libc/posix1e/mac_get.c
@@ -33,9 +33,7 @@
#include <sys/types.h>
#include <sys/mac.h>
-
-#include <errno.h>
-#include <stdlib.h>
+#include <sys/socket.h>
extern int __mac_get_fd(int fd, struct mac *mac_p);
extern int __mac_get_file(const char *path_p, struct mac *mac_p);
@@ -64,6 +62,15 @@ mac_get_link(const char *path, struct mac *label)
return (__mac_get_link(path, label));
}
+
+int
+mac_get_peer(int fd, struct mac *label)
+{
+ socklen_t len;
+
+ len = sizeof(*label);
+ return (getsockopt(fd, SOL_SOCKET, SO_PEERLABEL, label, &len));
+}
int
mac_get_pid(pid_t pid, struct mac *label)
{
OpenPOWER on IntegriCloud