Hello,
gfleury, le dim. 19 juil. 2026 18:34:57 +0200, a ecrit:
> +kern_return_t
> +S_io_mod_owner (struct sock_user *user, pid_t owner)
> +{
> + if (!user)
> + return EOPNOTSUPP;
> + else
You can drop "else", since we return in the "then" part.
> + {
> + user->sock->owner == owner;
> + return 0;
> + }
> +}
> +
> +kern_return_t
> +S_io_get_owner (struct sock_user *user, pid_t *owner)
> +{
> + if (!user)
> + return EOPNOTSUPP;
> + else
Same here.
> + {
> + *owner = user->sock->owner;
> + return 0;
> + }
> +}
> diff --git a/pflocal/sock.h b/pflocal/sock.h
> index 6a724d4..8e6b888 100644
> --- a/pflocal/sock.h
> +++ b/pflocal/sock.h
> @@ -85,6 +85,9 @@ struct sock
> /* Effective identity of the creator of the socket */
> uid_t uid;
> gid_t gid;
> +
> + /* This store the owner of file descriptor */
> + pid_t owner;
> };
I don't think we want to store the owner in the socket itself? As
mentioned in the comment, the "owner" is related to the file descriptor,
not to the socket. So it'd rather be the sock_user.
Samuel