X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fcompat%2Fsocket.h;fp=src%2Fcommon%2Fcompat%2Fsocket.h;h=464678292b95eed68afa5cc2d9e0311bd6843b41;hp=a510473c35fbdeb4e78e245b35732c7f52e1dca9;hb=bb17eb585257d944c7857d9400a4db247c49dcc1;hpb=810072601178ab06e866a74d11e6e06ccbc90f63 diff --git a/src/common/compat/socket.h b/src/common/compat/socket.h index a510473c3..464678292 100644 --- a/src/common/compat/socket.h +++ b/src/common/compat/socket.h @@ -117,6 +117,7 @@ typedef struct ucred lttng_sock_cred; struct lttng_sock_cred { uid_t uid; gid_t gid; + pid_t pid; }; typedef struct lttng_sock_cred lttng_sock_cred; @@ -155,7 +156,7 @@ typedef struct lttng_sock_cred lttng_sock_cred; #include static inline -int getpeereid(int s, uid_t *euid, gid_t *gid) +int getpeereid(int s, uid_t *euid, gid_t *gid, pid_t *pid) { int ret = 0; ucred_t *ucred = NULL; @@ -176,6 +177,13 @@ int getpeereid(int s, uid_t *euid, gid_t *gid) goto free; } *gid = ret; + + ret = ucred_getpid(ucred); + if (ret == -1) { + goto free; + } + *pid = ret; + ret = 0; free: ucred_free(ucred);