Syscall

marty Leisner.Henr at xerox.com
Wed Mar 1 07:05:00 AEST 1989


Geez, I never knew about syscall.

Recently I wanted to control the amount of ram my program had to work with
so I could see how it failed under various memory-short environments.

I wanted to move my stack to N bytes over my data area, so I had a heap N
bytes large (only in effect for this process) and I wanted N configurable
at run time.  I wrote my own sbrk which checked against the current stack
pointer to see whether or not to allocate space for malloc (which used
morecore).

Turns out sbrk and brk were in the same module -- so I had to unassemble
and synthesize my own brk system call (this was on an Opus board with a
National 32016 running Sys V.?).

If I knew about syscall, I support I could have just coded brk as:

brk(void *address)
{
	return (int) syscall(BRK_#, address)
}

instead of messing with assembler.  (It didn't take long anyway).

When I get back to playing with that piece of software, I'll try the
syscall apporach.

marty
ARPA:	leisner.henr at xerox.com
GV:  leisner.henr
NS:  martin leisner:wbst139:xerox
UUCP:  hplabs!arisia!leisner



More information about the Comp.unix.wizards mailing list