Gentoo Archives: gentoo-commits

From: "gecos missing (solar)" <solar@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo commit in src/patchsets/uclibc/0.9.28.3: 10_all_uClibc-svn-r11188-posix_memalign.patch
Date: Fri, 21 Sep 2007 00:20:53
Message-Id: E1IYW8d-0005sF-SP@stork.gentoo.org
1 solar 07/09/21 00:12:55
2
3 Added: 10_all_uClibc-svn-r11188-posix_memalign.patch
4 Log:
5 - backport posix_memalign
6
7 Revision Changes Path
8 1.1 src/patchsets/uclibc/0.9.28.3/10_all_uClibc-svn-r11188-posix_memalign.patch
9
10 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/uclibc/0.9.28.3/10_all_uClibc-svn-r11188-posix_memalign.patch?rev=1.1&view=markup
11 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/uclibc/0.9.28.3/10_all_uClibc-svn-r11188-posix_memalign.patch?rev=1.1&content-type=text/plain
12
13 Index: 10_all_uClibc-svn-r11188-posix_memalign.patch
14 ===================================================================
15 Index: libc/stdlib/Makefile
16 ===================================================================
17 --- libc/stdlib/Makefile (revision 11187)
18 +++ libc/stdlib/Makefile (revision 11188)
19 @@ -1,7 +1,7 @@
20 # Makefile for uClibc
21 #
22 # Copyright (C) 2000 by Lineo, inc.
23 -# Copyright (C) 2000,2001 Erik Andersen <andersen@××××××.org>
24 +# Copyright (C) 2000-2005 Erik Andersen <andersen@××××××.org>
25 #
26 # This program is free software; you can redistribute it and/or modify it under
27 # the terms of the GNU Library General Public License as published by the Free
28 @@ -86,7 +86,7 @@
29 getpt.c ptsname.c grantpt.c unlockpt.c gcvt.c drand48-iter.c jrand48.c \
30 jrand48_r.c lrand48.c lrand48_r.c mrand48.c mrand48_r.c nrand48.c \
31 nrand48_r.c rand_r.c srand48.c srand48_r.c seed48.c seed48_r.c \
32 - valloc.c
33 + valloc.c posix_memalign.c
34 ifeq ($(UCLIBC_HAS_FLOATS),y)
35 CSRC += drand48.c drand48_r.c erand48.c erand48_r.c
36 endif
37 Index: libc/stdlib/posix_memalign.c
38 ===================================================================
39 --- libc/stdlib/posix_memalign.c (revision 0)
40 +++ libc/stdlib/posix_memalign.c (revision 11188)
41 @@ -0,0 +1,42 @@
42 +/* vi: set sw=4 ts=4: */
43 +/* posix_memalign for uClibc
44 + *
45 + * Copyright (C) 1996-2002, 2003, 2004, 2005 Free Software Foundation, Inc.
46 + * Copyright (C) 2005 by Erik Andersen <andersen@××××××.org>
47 + *
48 + * This program is free software; you can redistribute it and/or modify it
49 + * under the terms of the GNU Library General Public License as published by
50 + * the Free Software Foundation; either version 2 of the License, or (at your
51 + * option) any later version.
52 + *
53 + * This program is distributed in the hope that it will be useful, but WITHOUT
54 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
55 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
56 + * for more details.
57 + *
58 + * You should have received a copy of the GNU Library General Public License
59 + * along with this program; if not, write to the Free Software Foundation,
60 + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
61 + *
62 + */
63 +
64 +#include <stdlib.h>
65 +#include <malloc.h>
66 +#include <sys/types.h>
67 +#include <errno.h>
68 +#include <sys/param.h>
69 +
70 +int posix_memalign(void **memptr, size_t alignment, size_t size)
71 +{
72 + /* Make sure alignment is correct. */
73 + if (alignment % sizeof(void *) != 0)
74 + /* Skip these checks because the memalign() func does them for us
75 + || !powerof2(alignment / sizeof(void *)) != 0
76 + || alignment == 0
77 + */
78 + return EINVAL;
79 +
80 + *memptr = memalign(alignment, size);
81 +
82 + return (*memptr != NULL ? 0 : ENOMEM);
83 +}
84
85
86
87 --
88 gentoo-commits@g.o mailing list