[comp.protocols.appletalk] Change in FCB structure in Sys 7?

alexis@panix.uucp (Alexis Rosen) (12/16/90)

In an article posted a few weeks ago I groused rather severely about the limit
on open files under MacOS, and asked if (as I vaguely reaclled) there was
going to be a change as of System 7.0.

Dean Yu (who posts here often) and Rod McGregor (who doesn't- he wrote SoftPC
and parts of DataClub) both told me that they also remembered that System 7
would change things, but weren't sure.

So I did what I should have all along... wrote a bit of code to test things
out. I came up with some excellent news! On my IIfx, I could open about 340
simultaneous files! This is still not in a leauge with a "real" OS, but it's
a damn sight closer than 86 files (or 160 on AppleShare). It's quite possible
that with more RAM, I'd have even more files. Anyone care to run this on an
fx with 16, 20, or 32 MB under System 7, and tell us?

I also turned up something else interesting. DataClub ameliorates the problem
a bit, without solving it, by providing "virtual open files" to clients (files
are open on client, closed on server, and when clients requests data, another
open file gets closed and the first re-opened). Only 100 in the first release,
but Rod says that they will up this to a very large number in the next.

Since the code is so short, I'm including it here for your amusement. A few
notes:
1) I used the wimpy high-level Pascal calls, rather than setting up a
   paramblock. And the style sucks. So shoot me.
2) I couldn't get the following to work:
	Paramtext(s,'','','');
	a:=Alert(128,Nil);
   so I used ModalDialog instead (this is in ShowMsg). I know I'm doing
   something really dumb, but what? (I _did_ have an ALRT 128.)
3) The only resource you need is a DLOG 128  (and DITL 128) which has an
   OK button as item #1 and an empty static text area as item #2.

------
Program CountOpen;
{This program counts the number of possible open files, roughly, on a given Mac}

 Var
  where: Point;
  prompt: Str255;
  outReply: SFReply;
  outCount: Integer;
  outName, fail: Str255;
  i, j, err: Integer;
  refs: Array[1..1000] Of Integer;
  dlog: DialogPtr;
  itemtype: Integer;
  itemH: Handle;
  box: Rect;
  item: Integer;

 Procedure ShowMsg (s: str255);
 Begin
  dlog := GetNewDialog(128, Nil, Pointer(-1));
  GetDItem(dlog, 2, itemtype, itemH, box);
  SetIText(itemH, s);
  ModalDialog(Nil, item);
  DisposDialog(dlog);
 End;

Begin
 outCount := 1;
 outName := 'Count Test';
 prompt := 'Save files starting with:';
 SetPt(where, (screenbits.bounds.right - 344) Div 2, (screenbits.bounds.bottom - 260) Div 2 - 10);
 SFPutFile(where, prompt, outName, Nil, outReply);
 If outReply.good Then Begin
  err := NoErr;
  i := 0;
  fail := 'Opening';
  outName := outReply.fname;
  While (i < 1000) And (err = NoErr) Do Begin
   i := i + 1;
   err := Create(Concat(outName, Stringof(i : 1)), outReply.vRefNum, 'tEsT', 'tEsT');
   If err = NoErr Then
    err := FSOpen(Concat(outName, Stringof(i : 1)), outReply.vRefNum, refs[i])
   Else
    fail := 'Creating'
  End;
  If err = NoErr Then { must be System 7 or special INIT! }
   ShowMsg('1000 Opens Succeeded!')
  Else
   ShowMsg(Concat('Failed while ', fail, ' file #', Stringof(i : 1)));
  For j := 1 To i Do Begin
   err := FSClose(refs[j]);
   err := FSDelete(Concat(outName, Stringof(j : 1)), outReply.vRefNum)
  End
 End
End.


---
Alexis Rosen
Owner/Sysadmin, PANIX Public Access Unix, NY
{cmcl2,apple}!panix!alexis