Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Jan 2003 20:39:58 +0000
From:      David Malone <dwmalone@maths.tcd.ie>
To:        Jim Faucette <jimf@awod.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: SCM_CREDS
Message-ID:  <20030101203958.GA22069@walton.maths.tcd.ie>
In-Reply-To: <3E124700.54A4BE5F@awod.com>
References:  <3E124700.54A4BE5F@awod.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Dec 31, 2002 at 08:40:16PM -0500, Jim Faucette wrote:
> I'm trying to get a connecting process' PID that's using a UNIX socket.
> recvmsg makes it appear possible, but so far no good.
> 
> Has anyone done this before? Can you supply a code sippet???

In the FreeBSD implimentation, the sender must attach a message of
type SCM_CREDS and the kernel will correctly fill in the fields.

FreeBSD also supports a socketoption which returns a structure
containing the credentials of the process at the far end. It is
used to impliment getpeereid - have a look at:

http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/gen/getpeereid.c?rev=1.4.2.2

for an example.

	David.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030101203958.GA22069>