File:  [MW Coherent from dump] / coherent / d / lib / libc / sys / i8086 / old / sbrk.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:37 2019 UTC (7 years, 2 months ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

/*
 * Sbrk - grow memory in data segment by
 * a specified increment.
 */
#include <stdio.h>
#include <sys/types.h>
#include <sys/malloc.h>

extern	int	errno;

char *
sbrk(incr)
unsigned int	incr;
{
	extern	char	*brk();
	register vaddr_t send,
			rend;

	rend = (vaddr_t)brk(NULL);
	if (incr == 0)
		return (rend);
	send = rend + incr;
	if (send < rend)
		return (BADSBRK);
	errno = 0;
	brk(send);
	if (errno)
		return (BADSBRK);
	return (rend);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.