* 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.
This commit is contained in:
parent
c8a66289e4
commit
07797cc0d8
@ -1,3 +1,12 @@
|
||||
2011-08-19 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
|
||||
|
||||
* 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.
|
||||
|
||||
2011-08-19 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||
|
||||
* dtable.cc: Mark some const variables as static.
|
||||
|
@ -44,8 +44,9 @@ enum fh_devices
|
||||
DEV_SERIAL_MAJOR = 117,
|
||||
FH_SERIAL = FHDEV (117, 0), /* /dev/ttyS? */
|
||||
|
||||
FH_WINDOWS = FHDEV (13, 255),
|
||||
FH_CLIPBOARD=FHDEV (13, 254),
|
||||
DEV_MISC_MAJOR = 13,
|
||||
FH_WINDOWS = FHDEV (DEV_MISC_MAJOR, 255),
|
||||
FH_CLIPBOARD=FHDEV (DEV_MISC_MAJOR, 254),
|
||||
|
||||
/* begin /proc directories */
|
||||
|
||||
@ -225,16 +226,19 @@ enum fh_devices
|
||||
FH_SDDW = FHDEV (DEV_SD7_MAJOR, 224),
|
||||
FH_SDDX = FHDEV (DEV_SD7_MAJOR, 240),
|
||||
|
||||
FH_MEM = FHDEV (1, 1),
|
||||
FH_KMEM = FHDEV (1, 2), /* not implemented yet */
|
||||
FH_NULL = FHDEV (1, 3),
|
||||
FH_PORT = FHDEV (1, 4),
|
||||
FH_ZERO = FHDEV (1, 5),
|
||||
FH_FULL = FHDEV (1, 7),
|
||||
FH_RANDOM = FHDEV (1, 8),
|
||||
FH_URANDOM = FHDEV (1, 9),
|
||||
FH_KMSG = FHDEV (1, 11),
|
||||
FH_OSS_DSP = FHDEV (14, 3),
|
||||
DEV_MEM_MAJOR = 1,
|
||||
FH_MEM = FHDEV (DEV_MEM_MAJOR, 1),
|
||||
FH_KMEM = FHDEV (DEV_MEM_MAJOR, 2), /* not implemented yet */
|
||||
FH_NULL = FHDEV (DEV_MEM_MAJOR, 3),
|
||||
FH_PORT = FHDEV (DEV_MEM_MAJOR, 4),
|
||||
FH_ZERO = FHDEV (DEV_MEM_MAJOR, 5),
|
||||
FH_FULL = FHDEV (DEV_MEM_MAJOR, 7),
|
||||
FH_RANDOM = FHDEV (DEV_MEM_MAJOR, 8),
|
||||
FH_URANDOM = FHDEV (DEV_MEM_MAJOR, 9),
|
||||
FH_KMSG = FHDEV (DEV_MEM_MAJOR, 11),
|
||||
|
||||
DEV_SOUND_MAJOR = 14,
|
||||
FH_OSS_DSP = FHDEV (DEV_SOUND_MAJOR, 3),
|
||||
|
||||
DEV_CYGDRIVE_MAJOR = 98,
|
||||
FH_CYGDRIVE= FHDEV (DEV_CYGDRIVE_MAJOR, 0),
|
||||
|
@ -46,15 +46,19 @@ static _off64_t format_proc_self (void *, char *&);
|
||||
static _off64_t format_proc_mounts (void *, char *&);
|
||||
static _off64_t format_proc_filesystems (void *, char *&);
|
||||
static _off64_t format_proc_swaps (void *, char *&);
|
||||
static _off64_t format_proc_devices (void *, char *&);
|
||||
static _off64_t format_proc_misc (void *, char *&);
|
||||
|
||||
/* names of objects in /proc */
|
||||
static const virt_tab_t proc_tab[] = {
|
||||
{ _VN ("."), FH_PROC, virt_directory, NULL },
|
||||
{ _VN (".."), FH_PROC, virt_directory, NULL },
|
||||
{ _VN ("cpuinfo"), FH_PROC, virt_file, format_proc_cpuinfo },
|
||||
{ _VN ("devices"), FH_PROC, virt_file, format_proc_devices },
|
||||
{ _VN ("filesystems"), FH_PROC, virt_file, format_proc_filesystems },
|
||||
{ _VN ("loadavg"), FH_PROC, virt_file, format_proc_loadavg },
|
||||
{ _VN ("meminfo"), FH_PROC, virt_file, format_proc_meminfo },
|
||||
{ _VN ("misc"), FH_PROC, virt_file, format_proc_misc },
|
||||
{ _VN ("mounts"), FH_PROC, virt_symlink, format_proc_mounts },
|
||||
{ _VN ("net"), FH_PROCNET, virt_directory, NULL },
|
||||
{ _VN ("partitions"), FH_PROC, virt_file, format_proc_partitions },
|
||||
@ -1335,4 +1339,65 @@ format_proc_swaps (void *, char *&destbuf)
|
||||
return bufptr - buf;
|
||||
}
|
||||
|
||||
static _off64_t
|
||||
format_proc_devices (void *, char *&destbuf)
|
||||
{
|
||||
tmp_pathbuf tp;
|
||||
char *buf = tp.c_get ();
|
||||
char *bufptr = buf;
|
||||
|
||||
bufptr += __small_sprintf (bufptr,
|
||||
"Character devices:\n"
|
||||
"%3d mem\n"
|
||||
"%3d cons\n"
|
||||
"%3d /dev/tty\n"
|
||||
"%3d /dev/console\n"
|
||||
"%3d /dev/ptmx\n"
|
||||
"%3d st\n"
|
||||
"%3d misc\n"
|
||||
"%3d sound\n"
|
||||
"%3d ttyS\n"
|
||||
"%3d tty\n"
|
||||
"\n"
|
||||
"Block devices:\n"
|
||||
"%3d fd\n"
|
||||
"%3d sd\n"
|
||||
"%3d sr\n"
|
||||
"%3d sd\n"
|
||||
"%3d sd\n"
|
||||
"%3d sd\n"
|
||||
"%3d sd\n"
|
||||
"%3d sd\n"
|
||||
"%3d sd\n"
|
||||
"%3d sd\n",
|
||||
DEV_MEM_MAJOR, DEV_CONS_MAJOR, _major (FH_TTY),
|
||||
_major (FH_CONSOLE), _major (FH_PTYM),
|
||||
DEV_TAPE_MAJOR, DEV_MISC_MAJOR, DEV_SOUND_MAJOR,
|
||||
DEV_SERIAL_MAJOR, DEV_TTYS_MAJOR, DEV_FLOPPY_MAJOR,
|
||||
DEV_SD_MAJOR, DEV_CDROM_MAJOR, DEV_SD1_MAJOR,
|
||||
DEV_SD2_MAJOR, DEV_SD3_MAJOR, DEV_SD4_MAJOR,
|
||||
DEV_SD5_MAJOR, DEV_SD6_MAJOR, DEV_SD7_MAJOR);
|
||||
|
||||
destbuf = (char *) crealloc_abort (destbuf, bufptr - buf);
|
||||
memcpy (destbuf, buf, bufptr - buf);
|
||||
return bufptr - buf;
|
||||
}
|
||||
|
||||
static _off64_t
|
||||
format_proc_misc (void *, char *&destbuf)
|
||||
{
|
||||
tmp_pathbuf tp;
|
||||
char *buf = tp.c_get ();
|
||||
char *bufptr = buf;
|
||||
|
||||
bufptr += __small_sprintf (bufptr,
|
||||
"%3d clipboard\n"
|
||||
"%3d windows\n",
|
||||
_minor (FH_CLIPBOARD), _minor (FH_WINDOWS));
|
||||
|
||||
destbuf = (char *) crealloc_abort (destbuf, bufptr - buf);
|
||||
memcpy (destbuf, buf, bufptr - buf);
|
||||
return bufptr - buf;
|
||||
}
|
||||
|
||||
#undef print
|
||||
|
Loading…
Reference in New Issue
Block a user