[PATCH] Add /proc/devices

Corinna Vinschen corinna-cygwin@cygwin.com
Thu Aug 18 19:56:00 GMT 2011

On Aug 18 13:50, Yaakov (Cygwin/X) wrote:
> On Thu, 2011-08-04 at 00:20 -0500, Yaakov (Cygwin/X) wrote:
> > This patchset implements /proc/devices[1]:
> > 
> > The question is how to handle /dev/tty and /dev/console as the
> > apparently vary now, per cgf's remarks on the main list.

/dev/tty, /dev/console and /dev/ptmx have fixed major and minor numbers.
But I see what you mean.  While `ls -l /dev/tty' on Linux always returns
with 5, 0 as major, minor, on Cygwin it returns with the major and minor
numbers of the actual tty it refers to:

  $ tty
  $ ls -l /dev/tty
  crw--w---- 1 corinna vinschen 136, 2 Aug 18 21:51 /dev/tty

Same for /dev/console.  Chris, is it tricky to return always the
real major, minor pairs 5, 0 and 5, 1 for /dev/tty and /dev/console?

> Here is a second version which adds the closely related /proc/misc[1] as
> well.
> Yaakov
> [1] http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s2-proc-misc.html

> 2011-08-18  Yaakov Selkowitz  <yselkowitz@...>
> 	* devices.h (fh_devices): Define DEV_MISC_MAJOR, DEV_MEM_MAJOR,
> 	DEV_SOUND_MAJOR.  Use throughout.
> 	* fhandler_proc.cc (proc_tab): Add /proc/devices and /proc/misc
> 	virtual files.
> 	(format_proc_devices): New function.
> 	(format_proc_misc): New function.

I think the patch is basically ok, but it's missing the "cons" entry
for consoles, equivalent to the "tty" entry.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

More information about the Cygwin-patches mailing list