Re: PROPOSAL: /proc/dev

Richard Gooch (rgooch@atnf.CSIRO.AU)
Tue, 6 Jan 1998 00:24:49 +1100


Michael Elizabeth Chastain writes:
> Hi Richard et al,
>
> > You could specify with dev_register() that when a device/inode is opened,
> > the ownership should be set to the process that opened it "first". When
> > the device is closed for the last time (before someone else uses the
> > pty at a later time), the ownership reverts back to the default.
>
> Yes, you could do this in the devfs layer. But you could also add
> "last close" hooks to the existing code.
>
> > BTW: These automatic ownership changes wouldn't be preserved across
> > reboots via the boot/shutdown mechanism.
>
> What about this use case:
>
> user opens device
> hourly cron job snapshots owners and modes in /dev
> system crashes
> system reboots
> init-job restores owners and modes in /dev

Good point. Yeah, you probably really want open_pty() instead. But, as
I said, this is a separate issue. Writing devfs is not about fixing
pty creation, but better management of *all* devices. And ptys are
somewhat different than other devices in Unix: they are not really
shared resources, in general. It's probably about time someone threw
away pty devices and implemented open_pty(). Any takers ;-)

Regards,

Richard....