Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Nov 2000 23:36:55 -0800 (PST)
From:      Luigi Rizzo <rizzo@aciri.org>
To:        bschwand@dvart.com (bruno schwander)
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: close call in a device ?
Message-ID:  <200011080736.XAA02080@iguana.aciri.org>
In-Reply-To: <3A08BDBD.575A6AA4@dvart.com> from bruno schwander at "Nov 7, 2000  6:43: 9 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
> Hi,
> 
> The reason I am doing this, is precisely because I need to virtualize accesses
> from several processes to _one_  _predefined_ device. I have no control over that
> device name from the client process point of view, so I can not have multiple
> devices.  I pretty much need to be able to lie to the process, telling it that it
> has full control of the device it wants, and actually allow other processes to
> open and use the device in the same way at the same time.

you could do something like this:
+ open allocates a descriptor which stores the PID of the process requesting
  access to the "device"
+ each I/O operation uses the descriptor matching the PID passed to the
  read/write/ioctl
+ you could implement an ioctl() to dispose the storage, a "well behaved"
  process would have to invoke this ioctl before terminating;
+ and a timeout as you suggested could be used to purge entries that have
  been idle for some time, or you could also purge them basing on usage
  patterns assumning there are clearly identifiable ones.

> Did I miss something in your suggestion ? Or were you suggesting that I can
> create same name device entries, differing only by their minor number ? But then

you cannot use the same name unless the entries are in different
directories. My suggestion was to use /dev/foo.00 /dev/foo.01 /dev/foo.02
and so on.

	cheers
	luigi

----------------------------------+-----------------------------------------
 Luigi RIZZO, luigi@iet.unipi.it  . ACIRI/ICSI (on leave from Univ. di Pisa)
 http://www.iet.unipi.it/~luigi/  . 1947 Center St, Berkeley CA 94704
 Phone: (510) 666 2927
----------------------------------+-----------------------------------------


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?200011080736.XAA02080>