X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fcompat%2Fsocket.h;fp=src%2Fcommon%2Fcompat%2Fsocket.h;h=464678292b95eed68afa5cc2d9e0311bd6843b41;hp=a510473c35fbdeb4e78e245b35732c7f52e1dca9;hb=ba66a850c5f540a0c3f61ce9344fd7127b567676;hpb=ddd915a3dd0eeb1667286051cc1e17017436fe5e 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);