Last change
on this file since d6c5faa was
87b9332,
checked in by Andrew Beach <ajbeach@…>, 4 years ago
|
Moved 'examples/' to 'tests/zombies/'.
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[6be0cf9] | 1 | /* |
---|
| 2 | * Allocation functions (posix_malign) |
---|
| 3 | * |
---|
| 4 | * Copyright (c) 2014, 2015 Gregor Richards |
---|
| 5 | * |
---|
| 6 | * Permission to use, copy, modify, and/or distribute this software for any |
---|
| 7 | * purpose with or without fee is hereby granted, provided that the above |
---|
| 8 | * copyright notice and this permission notice appear in all copies. |
---|
| 9 | * |
---|
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
---|
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
---|
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY |
---|
| 13 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
---|
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION |
---|
| 15 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
---|
| 16 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
---|
| 17 | */ |
---|
| 18 | |
---|
| 19 | static void *allocPool(size_t size, int mustSucceed) |
---|
| 20 | { |
---|
| 21 | void *ret; |
---|
| 22 | if ((errno = posix_memalign(&ret, size, size))) { |
---|
| 23 | if (mustSucceed) { |
---|
| 24 | perror("posix_memalign"); |
---|
| 25 | abort(); |
---|
| 26 | } |
---|
| 27 | return NULL; |
---|
| 28 | } |
---|
| 29 | return ret; |
---|
| 30 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.