diff --git a/libc/Android.mk b/libc/Android.mk index 85caa3e4f..a8c66fa99 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -264,12 +264,7 @@ libc_upstream_freebsd_src_files := \ upstream-freebsd/lib/libc/gen/ldexp.c \ upstream-freebsd/lib/libc/gen/sleep.c \ upstream-freebsd/lib/libc/gen/usleep.c \ - upstream-freebsd/lib/libc/stdlib/abs.c \ upstream-freebsd/lib/libc/stdlib/getopt_long.c \ - upstream-freebsd/lib/libc/stdlib/imaxabs.c \ - upstream-freebsd/lib/libc/stdlib/imaxdiv.c \ - upstream-freebsd/lib/libc/stdlib/labs.c \ - upstream-freebsd/lib/libc/stdlib/llabs.c \ upstream-freebsd/lib/libc/stdlib/qsort.c \ upstream-freebsd/lib/libc/stdlib/quick_exit.c \ upstream-freebsd/lib/libc/stdlib/realpath.c \ @@ -497,11 +492,16 @@ libc_upstream_openbsd_ndk_src_files := \ upstream-openbsd/lib/libc/stdio/wprintf.c \ upstream-openbsd/lib/libc/stdio/wscanf.c \ upstream-openbsd/lib/libc/stdio/wsetup.c \ + upstream-openbsd/lib/libc/stdlib/abs.c \ upstream-openbsd/lib/libc/stdlib/atoi.c \ upstream-openbsd/lib/libc/stdlib/atol.c \ upstream-openbsd/lib/libc/stdlib/atoll.c \ upstream-openbsd/lib/libc/stdlib/getenv.c \ upstream-openbsd/lib/libc/stdlib/insque.c \ + upstream-openbsd/lib/libc/stdlib/imaxabs.c \ + upstream-openbsd/lib/libc/stdlib/imaxdiv.c \ + upstream-openbsd/lib/libc/stdlib/labs.c \ + upstream-openbsd/lib/libc/stdlib/llabs.c \ upstream-openbsd/lib/libc/stdlib/lsearch.c \ upstream-openbsd/lib/libc/stdlib/reallocarray.c \ upstream-openbsd/lib/libc/stdlib/remque.c \ diff --git a/libc/upstream-freebsd/android/include/spinlock.h b/libc/upstream-freebsd/android/include/spinlock.h deleted file mode 100644 index f5c378511..000000000 --- a/libc/upstream-freebsd/android/include/spinlock.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef _BIONIC_FREEBSD_SPINLOCK_H_included -#define _BIONIC_FREEBSD_SPINLOCK_H_included - -/* TODO: until we have the FreeBSD findfp.c, this is useless. */ - -#endif diff --git a/libc/upstream-freebsd/lib/libc/stdlib/abs.c b/libc/upstream-openbsd/lib/libc/stdlib/abs.c similarity index 84% rename from libc/upstream-freebsd/lib/libc/stdlib/abs.c rename to libc/upstream-openbsd/lib/libc/stdlib/abs.c index 87589474e..5d2fbae69 100644 --- a/libc/upstream-freebsd/lib/libc/stdlib/abs.c +++ b/libc/upstream-openbsd/lib/libc/stdlib/abs.c @@ -1,6 +1,7 @@ +/* $OpenBSD: abs.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */ /*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,17 +28,10 @@ * SUCH DAMAGE. */ -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)abs.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD$"); - #include int -abs(j) - int j; +abs(int j) { return(j < 0 ? -j : j); } diff --git a/libc/upstream-freebsd/lib/libc/stdlib/imaxabs.c b/libc/upstream-openbsd/lib/libc/stdlib/imaxabs.c similarity index 72% rename from libc/upstream-freebsd/lib/libc/stdlib/imaxabs.c rename to libc/upstream-openbsd/lib/libc/stdlib/imaxabs.c index 35e3dee79..b7e910eef 100644 --- a/libc/upstream-freebsd/lib/libc/stdlib/imaxabs.c +++ b/libc/upstream-openbsd/lib/libc/stdlib/imaxabs.c @@ -1,5 +1,7 @@ +/* $OpenBSD: imaxabs.c,v 1.1 2006/01/13 17:58:09 millert Exp $ */ + /*- - * Copyright (c) 2001 Mike Barcroft + * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -10,11 +12,14 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) @@ -24,9 +29,6 @@ * SUCH DAMAGE. */ -#include -__FBSDID("$FreeBSD$"); - #include intmax_t diff --git a/libc/upstream-freebsd/lib/libc/stdlib/imaxdiv.c b/libc/upstream-openbsd/lib/libc/stdlib/imaxdiv.c similarity index 59% rename from libc/upstream-freebsd/lib/libc/stdlib/imaxdiv.c rename to libc/upstream-openbsd/lib/libc/stdlib/imaxdiv.c index 7dae4675e..0515a94b9 100644 --- a/libc/upstream-freebsd/lib/libc/stdlib/imaxdiv.c +++ b/libc/upstream-openbsd/lib/libc/stdlib/imaxdiv.c @@ -1,7 +1,11 @@ -/*- - * Copyright (c) 2001 Mike Barcroft +/* $OpenBSD: imaxdiv.c,v 1.1 2006/01/13 17:58:09 millert Exp $ */ +/* + * Copyright (c) 1990 Regents of the University of California. * All rights reserved. * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -10,11 +14,14 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) @@ -24,22 +31,20 @@ * SUCH DAMAGE. */ -#include -__FBSDID("$FreeBSD$"); +#include /* imaxdiv_t */ -#include - -/* See comments in div.c for implementation details. */ imaxdiv_t -imaxdiv(intmax_t numer, intmax_t denom) +imaxdiv(intmax_t num, intmax_t denom) { - imaxdiv_t retval; + imaxdiv_t r; - retval.quot = numer / denom; - retval.rem = numer % denom; - if (numer >= 0 && retval.rem < 0) { - retval.quot++; - retval.rem -= denom; + /* see div.c for comments */ + + r.quot = num / denom; + r.rem = num % denom; + if (num >= 0 && r.rem < 0) { + r.quot++; + r.rem -= denom; } - return (retval); + return (r); } diff --git a/libc/upstream-freebsd/lib/libc/stdlib/labs.c b/libc/upstream-openbsd/lib/libc/stdlib/labs.c similarity index 83% rename from libc/upstream-freebsd/lib/libc/stdlib/labs.c rename to libc/upstream-openbsd/lib/libc/stdlib/labs.c index 816370eee..ca60b9aba 100644 --- a/libc/upstream-freebsd/lib/libc/stdlib/labs.c +++ b/libc/upstream-openbsd/lib/libc/stdlib/labs.c @@ -1,6 +1,7 @@ +/* $OpenBSD: labs.c,v 1.5 2005/08/08 08:05:36 espie Exp $ */ /*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,17 +28,10 @@ * SUCH DAMAGE. */ -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)labs.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD$"); - #include long -labs(j) - long j; +labs(long j) { return(j < 0 ? -j : j); } diff --git a/libc/upstream-freebsd/lib/libc/stdlib/llabs.c b/libc/upstream-openbsd/lib/libc/stdlib/llabs.c similarity index 72% rename from libc/upstream-freebsd/lib/libc/stdlib/llabs.c rename to libc/upstream-openbsd/lib/libc/stdlib/llabs.c index 2bfbada80..fc2cd8261 100644 --- a/libc/upstream-freebsd/lib/libc/stdlib/llabs.c +++ b/libc/upstream-openbsd/lib/libc/stdlib/llabs.c @@ -1,5 +1,7 @@ +/* $OpenBSD: llabs.c,v 1.3 2007/01/08 19:39:25 deraadt Exp $ */ + /*- - * Copyright (c) 2001 Mike Barcroft + * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -10,11 +12,14 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) @@ -24,9 +29,6 @@ * SUCH DAMAGE. */ -#include -__FBSDID("$FreeBSD$"); - #include long long