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

head     1.2;
access   ;
symbols  ;
locks    bin:1.2;
comment  @ * @;


1.2
date     92.02.14.21.13.32;  author bin;  state Exp;
branches ;
next	1.1;

1.1
date     92.02.14.21.11.12;  author bin;  state Exp;
branches ;
next	;


desc
@steve 2/14/92
Initial MWC RCS revision.
@


1.2
log
@Preserve errno on success.
@
text
@/*
 * libc/sys/i8086/sbrk.c
 * sbrk()
 * Grow memory in data segment by a specified increment.
 */

#include <stdio.h>
#include <sys/types.h>
#include <sys/malloc.h>

extern	char	*brk();
extern	int	errno;

char *
sbrk(incr) unsigned int incr;
{
	register vaddr_t send, rend;
	register int oerrno;
	
	rend = (vaddr_t)brk(NULL);
	if (incr == 0)
		return rend;
	send = rend + incr;
	if (send < rend)
		return BADSBRK;
	oerrno = errno;
	errno = 0;
	brk(send);
	if (errno)
		return BADSBRK;
	errno = oerrno;
	return rend;
}

/* end of libc/sys/i8086/sbrk.c */
@


1.1
log
@Initial revision
@
text
@d2 3
a4 2
 * Sbrk - grow memory in data segment by
 * a specified increment.
d6 1
d11 1
d15 1
a15 2
sbrk(incr)
unsigned int	incr;
d17 3
a19 4
	extern	char	*brk();
	register vaddr_t send,
			rend;

d22 1
a22 1
		return (rend);
d25 2
a26 1
		return (BADSBRK);
d30 3
a32 2
		return (BADSBRK);
	return (rend);
d34 2
@

unix.superglobalmegacorp.com

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