trysopeercred.c (356B)
1 /* ISC license. */ 2 3 #undef _POSIX_C_SOURCE 4 #undef _XOPEN_SOURCE 5 6 #ifndef _XPG4_2 7 #define _XPG4_2 8 #endif 9 10 #ifndef _GNU_SOURCE 11 #define _GNU_SOURCE 12 #endif 13 14 #include <sys/socket.h> 15 #include <sys/un.h> 16 17 int main (void) 18 { 19 int s ; 20 struct ucred dummy ; 21 socklen_t len = sizeof(struct ucred) ; 22 return getsockopt(s, SOL_SOCKET, SO_PEERCRED, &dummy, &len) ; 23 }