home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsc!cbfsb!att-out!rutgers!bagate!cbmvax!jesup
- From: jesup@cbmvax.commodore.com (Randell Jesup)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Debugging a filesystem handler...
- Message-ID: <34877@cbmvax.commodore.com>
- Date: 4 Sep 92 00:33:45 GMT
- References: <1992Aug31.061928.18053@softway.sw.oz.au>
- Reply-To: jesup@cbmvax.commodore.com (Randell Jesup)
- Organization: Commodore, West Chester, PA
- Lines: 61
-
- peterc@suite.sw.oz.au (Peter Chubb) writes:
- >I'm trying to write a new filesystem handler. Example code that I've
- >looked at (RAW and the disk-handler from earlier Fish disks) debug by
- >opening a CON: window, then sending CMD_WRITE messages to the
- >console's message port. This worked under WB1.3 (last time I tried).
- >
- >This no longer seems to work under WB2.05. Instead the console device
- >appears to hang -- no new consoles can be opened.
- >I'm using SAS C 5.10a. The code looks something like:
-
- > debugFH = Open("CON:0/0/640/200/Handler Debug", MODE_NEWFILE);
- >
- > fsmsg = taskwait();
-
- 2.0 introduced some new internal locking mechanisms to avoid some
- old bugs that the system had had since 1.0, such as two copies of the same
- filesystem getting started if two things tried to use it at once.
-
- This is handled internally by semaphores. The side-effect is that
- you may NOT do any IO which may require starting another filesystem before
- replying your initial packet. If you do, you will deadlock (as you found
- out).
-
- There is one other solution for those that must: mount with a globvec
- of -2, and then use Forbid-locking around setting dol_Task. WARNING: 2.04
- mount doesn't handle globvec correctly, it always sets it to 0 or -1. You'll
- have to make it mount some other way, or make something that modifies the
- entry Mount creates. The locking should look like this:
-
- Forbid();
- mustexit = FALSE;
- if (!(dev->dol_Task) || (ks_version < 37))
- dev->dol_Task = FindTask(NULL);
- else
- mustexit = TRUE;
- Permit();
- ...
- ReplyMsg(msg);
-
- ...
- if (mustexit)
- return;
-
-
- Note that even if another process beats you to setting dol_Task, you return
- success in the packet. Before V37, dos used your process port for the first
- packet instead of taking it from dol_Task, so you _must_ not exit.
-
- Also, under V37 and above, you can use a port other than your process
- message port for everything but the startup message, even for a handler
- that doesn't set dol_Task. When you reply the startup packet, set dp_Arg4
- to the port to send messages to, and all messages will go there, allowing you
- to do normal Dos I/O in your handler.
-
- --
- "Rev on the redline, you're on your own; seems like a lifetime, but soon it's
- gone..." Foreigner
- -
- Randell Jesup, Jack-of-quite-a-few-trades, Commodore Engineering.
- {uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.cbm.commodore.com BIX: rjesup
- Disclaimer: Nothing I say is anything other than my personal opinion.
-