diff options
-rw-r--r-- | localedef/ChangeLog.eglibc | 5 | ||||
-rw-r--r-- | localedef/include/libc-internal.h | 27 | ||||
-rw-r--r-- | localedef/include/libc-mmap.h | 26 |
3 files changed, 58 insertions, 0 deletions
diff --git a/localedef/ChangeLog.eglibc b/localedef/ChangeLog.eglibc index a63708fa9..d62ce11b2 100644 --- a/localedef/ChangeLog.eglibc +++ b/localedef/ChangeLog.eglibc @@ -1,3 +1,8 @@ +2013-07-02 Joseph Myers <joseph@codesourcery.com> + + * include/libc-mmap.h: Copy from glibc. + * include/libc-internal.h: Copy from glibc (cut down). + 2013-03-06 Joseph Myers <joseph@codesourcery.com> * include/sys/cdefs.h (__attribute_malloc__): Define if not diff --git a/localedef/include/libc-internal.h b/localedef/include/libc-internal.h new file mode 100644 index 000000000..1afd9bd76 --- /dev/null +++ b/localedef/include/libc-internal.h @@ -0,0 +1,27 @@ +/* This file contains a number of internal prototype declarations that + don't fit anywhere else. */ + +#ifndef _LIBC_INTERNAL +# define _LIBC_INTERNAL 1 + +/* Align a value by rounding down to closest size. + e.g. Using size of 4096, we get this behavior: + {4095, 4096, 4097} = {0, 4096, 4096}. */ +#define ALIGN_DOWN(base, size) ((base) & -((__typeof__ (base)) (size))) + +/* Align a value by rounding up to closest size. + e.g. Using size of 4096, we get this behavior: + {4095, 4096, 4097} = {4096, 4096, 8192}. + + Note: The size argument has side effects (expanded multiple times). */ +#define ALIGN_UP(base, size) ALIGN_DOWN ((base) + (size) - 1, (size)) + +/* Same as ALIGN_DOWN(), but automatically casts when base is a pointer. */ +#define PTR_ALIGN_DOWN(base, size) \ + ((__typeof__ (base)) ALIGN_DOWN ((uintptr_t) (base), (size))) + +/* Same as ALIGN_UP(), but automatically casts when base is a pointer. */ +#define PTR_ALIGN_UP(base, size) \ + ((__typeof__ (base)) ALIGN_UP ((uintptr_t) (base), (size))) + +#endif /* _LIBC_INTERNAL */ diff --git a/localedef/include/libc-mmap.h b/localedef/include/libc-mmap.h new file mode 100644 index 000000000..0ddd20d42 --- /dev/null +++ b/localedef/include/libc-mmap.h @@ -0,0 +1,26 @@ +/* Internal logic for dealing with mmap quirks. + Copyright (C) 2013 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#ifndef _LIBC_MMAP_H +#define _LIBC_MMAP_H 1 + +/* Using MAP_FIXED with mmap sometimes requires larger alignment. */ +#include <sys/shm.h> +#define MAP_FIXED_ALIGNMENT SHMLBA + +#endif |