This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Symlinks under /proc


On Tue, 1 Feb 2005, Christopher Faylor wrote:

> On Tue, Feb 01, 2005 at 02:07:28PM -0500, Igor Pechtchanski wrote:
> >On Tue, 1 Feb 2005, Christopher Faylor wrote:
> >
> >> On Mon, Jan 31, 2005 at 03:48:32PM -0500, Christopher Faylor wrote:
> >> >On Mon, Jan 31, 2005 at 09:30:25PM +0100, Corinna Vinschen wrote:
> >> >>On Jan 31 21:23, Corinna Vinschen wrote:
> >> >>> On Jan 31 15:11, Christopher Faylor wrote:
> >> >>>>On Mon, Jan 31, 2005 at 09:04:57PM +0100, Corinna Vinschen wrote:
> >> >>>>Have we reached the point yet where we can just get rid of
> >> >>>>special /dev handling entirely?  Maybe we could just add /dev
> >> >>>>population to setup.exe or even have cygwin1.dll itself run a
> >> >>>>program if it detects an unpopulated /dev, sort of like how udev
> >> >>>>is handled in linux now.
> >> >>>>
> >> >>>>My only reservation with doing things this way is that we'd be
> >> >>>>making cygwin perform a disk lookup every time someone wanted to
> >> >>>>get to open /dev/tty.
> >> >>>
> >> >>>I would not like to change that yet.  So far, the DLL is still
> >> >>>basically self-sufficient.  If you require on-disk devices, you
> >> >>>can't use the DLL anymore without having a minimal installation
> >> >>>process.  I can see the point where I'm getting convinced that
> >> >>>exactly that is a good idea, but right now...
> >> >>
> >> >>Actually, couldn't we just keep /dev/console, /dev/tty* and
> >> >>/dev/null handled internally?  Everything else seems rather
> >> >>non-critical.
> >> >
> >> >You don't even have to do that.  AFAICT, there is no reason for the
> >> >DLL to have to parse "/dev/tty*" or "/dev/null" when it could just
> >> >be relying on using major and minor device numbers.
> >> >
> >> >I just quickly hacked cygwin to stop parsing /dev entirely and it
> >> >seems to work ok, for the most part.  The one puzzler is that while
> >> >it deals ok with /dev/tty, it does not handle /dev/null correctly,
> >> >even after a /dev/null has been created.
> >>
> >> With the latest checkins, it seems to be possible to remove the /dev
> >> parsing entirely and rely on an on-disk populated /dev.
> >>
> >> Igor, could you repost your script for populating /dev?

Attached.

> >> I don't remember how intelligent it was but I suspect that it doesn't
> >> actually query the system to figure out what devices are available,
> >> right?
> >
> >No, it doesn't -- it just has a hard-coded list.  *Is* there a way to
> >query the devices available?
>
> I'm sure there is -- via some windows api or other.

Actually, at least the hard drive partitions are listed in
/proc/partitions.  However, I doubt it's the job of the script to do this.
In fact, I don't think it's necessary in any case, since attaching a new
device to the system shouldn't require re-populating /dev.  We should just
create a pre-defined set of devices that'd work on most systems (like
Linux does), and let advanced users tweak the script if necessary.

> >It would be good to test it first, though -- does the CVS HEAD still treat
> >/dev as a virtual directory?
>
> Yes.  You can turn this off with the (temporary) patch below.

It seems to work with non-virtual /dev populated by the attached script.

There are a few problems, though:
a) mknod cannot set the mode of many devices.
   Even though I run "mknod -m666" for all of them, everything except fd*,
   mem, port, sd*, and scd* has mode 600.  I've compared strace outputs
   for "mem" and "kmem", and chmod succeeds in both cases, but the mode
   for kmem is not changed.  Weird.
b) mkfifo doesn't work, so /dev/pipe isn't created.
c) The script cannot create /dev/com* (except /dev/com0).  Should /dev be
   a managed mount to boot, or do we just drop support for /dev/com1, etc?
d) (minor) Should the script try to change the owner of the device files?

Once the four problems above are resolved, I think this is good to go.
FWIW, however, I agree with Corinna's reservations about Cygwin requiring
a populated /dev to work...
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"The Sun will pass between the Earth and the Moon tonight for a total
Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT

Attachment: create_devices.sh
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]