Path: utzoo!attcan!uunet!lll-winken!ames!haven!adm!xadmx!Leisner.Henr@xerox.com From: Leisner.Henr@xerox.com (marty) Newsgroups: comp.unix.wizards Subject: Re: Syscall Message-ID: <18480@adm.BRL.MIL> Date: 28 Feb 89 21:05:00 GMT Sender: news@adm.BRL.MIL Lines: 32 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@xerox.com GV: leisner.henr NS: martin leisner:wbst139:xerox UUCP: hplabs!arisia!leisner