/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include "lint.h"
#include <synch.h>
#include <errno.h>
#include <sys/isa_defs.h>
#include <sys/sysmacros.h>
#include <inttypes.h>
#include <unistd.h>
#include "mtlib.h"
#include "libc.h"
extern intptr_t _brk_unlocked(void *);
extern void *_sbrk_unlocked(intptr_t);
/*
* The break must always be at least 8-byte aligned
*/
#if (_MAX_ALIGNMENT < 8)
#else
#endif
void *
{
void *result;
if (!primary_link_map) {
return ((void *)-1);
}
return (result);
}
/*
* _sbrk_unlocked() aligns the old break, adds the addend, aligns
* the new break, and calls _brk_unlocked() to set the new break.
* We must align the old break because _nd may begin life misaligned.
* The addend can be either positive or negative, so there are two
*
* - the addend is negative and brk + addend < 0.
* - the addend is positive and brk + addend > ULONG_MAX
*/
void *
{
/*
* Start of the data segment hasn't been calculated yet.
* Use brk(0) to gather it from the kernel.
*/
_nd = (void *)_brk_unlocked(0);
}
return ((void *)-1);
}
if (_brk_unlocked(new_brk) != 0)
return ((void *)-1);
return (old_brk);
}
/*
* _sbrk_grow_aligned() aligns the old break to a low_align boundry,
* adds min_size, aligns to a high_align boundry, and calls _brk_unlocked()
* to set the new break. The low_aligned-aligned value is returned, and
* the actual space allocated is returned through actual_size.
*
* Unlike sbrk(2), _sbrk_grow_aligned takes an unsigned size, and does
* not allow shrinking the heap.
*/
void *
{
int brk_result;
if (!primary_link_map) {
return ((void *)-1);
}
return ((void *)-1);
}
/*
* Start of the data segment hasn't been calculated yet.
* Use brk(0) to gather it from the kernel.
*/
_nd = (void *)_brk_unlocked(0);
}
/*
* Check for overflow
*/
return ((void *)-1);
}
if (brk_result != 0)
return ((void *)-1);
if (actual_size != NULL)
return ((void *)ret_brk);
}
int
{
if (!primary_link_map) {
return (-1);
}
/*
* Return what a call to brk(0) not going through the special path
* would return.
*/
return (-1);
}
/*
* Need to align this here; _brk_unlocked won't do it for us.
*/
return ((int)result);
}