Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Mar 2004 14:40:50 -0500 (EST)
From:      Robert Watson <rwatson@freebsd.org>
To:        Kiss Tibor <grinder@pro.hu>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Strange problem with vnodes and sockets
Message-ID:  <Pine.NEB.3.96L.1040307143827.2700H-100000@fledge.watson.org>
In-Reply-To: <20040307175453.GA44645@PSY.tvnetwork.hu>

next in thread | previous in thread | raw e-mail | index | archive | help

On Sun, 7 Mar 2004, Kiss Tibor wrote:

> I want to create a small kernel module which logs the socket operations.
> So in my module I have a socket structure, and i want to know which
> process (thread) owns that. I try to solve this problem by this way: 

Sockets, as with files, can be referenced by more than one process at a
time.  While there is only one process that has created any given socket,
references to the socket can be inherited by processes forked from it, as
well as passed using UNIX domain sockets.  As such, there really isn't a
notion of "owner".  so_cred is a cached referenced to the process
credential of the process that created the socket...

> So how can the v_type 2048? v_type is an enum (vnode.h) with 10
> "options":  enum vtype { VNON, VREG, VDIR, VBLK, VCHR, VLNK, VSOCK,
> VFIFO, VBAD }; 
> 
> And the real problem is: why don't find that code any VSOCK type vnode
> in the active process list? And how can i find the proc struct for a
> socket? :) 

VSOCK vnodes are rendezvous points for UNIX domain socket communication,
not the actual communication vehicles themselves.  Very few UNIX domain
sockets are used in normal operation, but you might take a look at
/var/run/log, and the file descriptors that referenced various sockets to
the log subsystem.

Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
robert@fledge.watson.org      Senior Research Scientist, McAfee Research




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1040307143827.2700H-100000>