Xinu7/man/man2/getmem.doc
GETMEM(2) Xinu Programmer's Manual GETMEM(2)
NAME
getmem, getstk - get a block of main memory
SYNOPSIS
char *getmem(nbytes)
int nbytes;
char *getstk(nbytes)
int nbytes;
DESCRIPTION
In either form, _g_e_t_m_e_m rounds the number of bytes, _n_b_y_t_e_s,
to an even-word multiple, and allocates a block of _n_b_y_t_e_s
bytes of memory for the caller. _G_e_t_m_e_m returns the lowest
word address in the allocated block; _g_e_t_s_t_k returns the
highest word address in the allocated block. If less than
_n_b_y_t_e_s bytes remain, the call returns SYSERR.
_G_e_t_m_e_m allocates memory starting with the end of the loaded
program. _G_e_t_s_t_k allocates memory from the stack area down-
ward. The routines cooperate so they never allocate over-
lapping regions.
SEE ALSO
freemem(2) getbuf(2), freebuf(2)
BUGS
There is no way to protect memory, so the active stack may
write into regions returned by either call; allocations
returned by _g_e_t_s_t_k are more prone to disaster because they
lie closest to the dynamic stack areas of other processes.
Version 6b Printed 1/12/87 1