[comp.sys.mac.programmer] Porting C from UNIX to LSC

knapp@cs.utexas.edu (Edgar Knapp) (05/09/91)

I am porting a rather large C program from UNIX to the Mac using
Lightspeed C V4.0.x.  After successful compilation the linker
complains about three unresolved references: fstat, sbrk, and times.
The first two are mentioned in Kernighan and Ritchie, I cannot find
any documentation on the third.

What are the Mac equivalents for these functions, and how do I
translate one into the other? I am not a C expert, so please be
specific in your answers.

Thank you for any assistance you can give me.

Edgar

(knapp@cs.utexas.edu)

PS: In case it matters, the functions are used in the following manner:

ADDRESS SysCalls_Alloc(ByteCount)
LONGINT ByteCount;
{
  return sbrk(ByteCount);
}

LONGINT SysCalls_Times()
{
  System_tms b;

  times(ADR(b));
  return (b.uTime + b.sTime) * 50 / 3;
}

static void CheckFlushLine(f)
IO_tFile f;
{
  System_stat buf;
  INTEGER i;

  fstat(f, ADR(buf));
  i = buf.StMode;
  BufferPool.A[f - -1].FlushLine = IN(CharacterSpecial, (BITSET)i);
}