From eb07f8c343ba7cdce21bc750c6eaa3f7a4804ab2 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 20 Apr 2005 04:26:34 +0000 Subject: [PATCH] * fhandler-tut.txt: Update description to cygwin 1.5.13 --- winsup/doc/ChangeLog | 4 ++++ winsup/doc/fhandler-tut.txt | 31 +++++++++++++++++++++---------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/winsup/doc/ChangeLog b/winsup/doc/ChangeLog index 44720a021..704918bbd 100644 --- a/winsup/doc/ChangeLog +++ b/winsup/doc/ChangeLog @@ -1,3 +1,7 @@ +2005-04-20 Gerd Spalink + + * fhandler-tut.txt: Update description to cygwin 1.5.13 + 2005-04-19 Corinna Vinschen * cygwinenv.sgml: Mention that check_case is deprecated. diff --git a/winsup/doc/fhandler-tut.txt b/winsup/doc/fhandler-tut.txt index 213b32b20..00a3b4b94 100644 --- a/winsup/doc/fhandler-tut.txt +++ b/winsup/doc/fhandler-tut.txt @@ -6,7 +6,7 @@ showing an example of /dev/zero. Files to note: fhandler.h - must define a new derived class here and FH_* -path.cc - to notice "/dev/zero" and mark it +devices.in - to notice "/dev/zero" and mark it fhandler_zero.cc - new dtable.cc - to create the fhandler instance @@ -27,23 +27,34 @@ simulating everything. Thus: handle of -1, which (1) maps swap memory, and (2) zeros it out for us (at least, on NT). -OK, let's start with fhandler.h. +OK, let's start with devices.h. -First, update the comment about which files are where. We're adding -fhandler_dev_zero as FH_DEV_ZERO. We're adding this as a "fast" -device (it will never block) so we have to adjust FH_NDEV also. +We have to create a new entry in the enum fh_devices. The new +devices must get a major and a minor ID. As a rule of thumb, just +copy the ones that are used on a linux system. -Later in that file, we'll copy fhandler_dev_null and edit it to be +Now, let's continue with fhandler.h. + +First, update the fhandler_union near the end of the file with a +line for the new device. Use existing members, in this case __dev_null +as a template. This union is sorted alphabetically. + +Earlier in that file, we'll copy fhandler_dev_null and edit it to be fhandler_dev_zero. I chose that one because it's small, but we'll add more members as we go (since we're simulating the whole thing). In fact, let's copy the I/O methods from fhandler_windows since we'll need all those anyway, even though we'll go through the full list later. -OK, next we need to edit path.cc to recognize when the user is trying -to open "/dev/zero". Look in get_device_number; there's a long list -of cases, just add one (I added one after "null"). Also remember to -add an entry to the windows_device_names list in the right spot. +OK, next we need to edit devices.in. There is a section where each device +is listed with its cygwin path, its structure and its windows path. +"/dev/zero", FH_ZERO, "\\dev\\zero" +This is needed to recognize when the user is trying to open "/dev/zero". +You have to build devices.cc from devices.in now. +There is a script 'gendevices' in the winsup/cygwin directory which may +be called at some time in the future if you use 'make' to build the DLL. +This should rebuild the devices.cc file. You have to have shilka +available to do that; this is part of the cygwin cocom package. To go along with that change, we'll need to change dtable.cc. Look for FH_NULL and add a case for FH_ZERO as well.