/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
*/
/*
* Copyright 2016 Joyent, Inc.
*/
/*
* Basic tests for aligned_alloc(3C). Note that we test ENOMEM failure by
* relying on the implementation of the current libc malloc. Specifically we go
* through and add a mapping so we can't expand the heap and then use it up. If
* the memory allocator is ever changed, this test will start failing, at which
* point, it may not be worth the cost of keeping it around.
*/
#include <stdlib.h>
#include <errno.h>
#include <libproc.h>
#include <sys/sysmacros.h>
int
main(void)
{
void *buf;
/*
* Alignment must be sizeof (void *) (word) aligned.
*/
/*
* Cause ENOMEM
*/
!=, (void *)-1);
for (;;) {
break;
}
for (;;) {
break;
}
return (0);
}