Merge "Move several FreeBSD functions to OpenBSD."
This commit is contained in:
		@@ -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 \
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
@@ -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 <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
abs(j)
 | 
			
		||||
	int j;
 | 
			
		||||
abs(int j)
 | 
			
		||||
{
 | 
			
		||||
	return(j < 0 ? -j : j);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,5 +1,7 @@
 | 
			
		||||
/*	$OpenBSD: imaxabs.c,v 1.1 2006/01/13 17:58:09 millert Exp $	*/
 | 
			
		||||
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
 | 
			
		||||
 * 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 <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include <inttypes.h>
 | 
			
		||||
 | 
			
		||||
intmax_t
 | 
			
		||||
@@ -1,7 +1,11 @@
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
 | 
			
		||||
/*	$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 <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
#include <inttypes.h>		/* imaxdiv_t */
 | 
			
		||||
 | 
			
		||||
#include <inttypes.h>
 | 
			
		||||
 | 
			
		||||
/* 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);
 | 
			
		||||
}
 | 
			
		||||
@@ -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 <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
long
 | 
			
		||||
labs(j)
 | 
			
		||||
	long j;
 | 
			
		||||
labs(long j)
 | 
			
		||||
{
 | 
			
		||||
	return(j < 0 ? -j : j);
 | 
			
		||||
}
 | 
			
		||||
@@ -1,5 +1,7 @@
 | 
			
		||||
/*	$OpenBSD: llabs.c,v 1.3 2007/01/08 19:39:25 deraadt Exp $	*/
 | 
			
		||||
 | 
			
		||||
/*-
 | 
			
		||||
 * Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
 | 
			
		||||
 * 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 <sys/cdefs.h>
 | 
			
		||||
__FBSDID("$FreeBSD$");
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
long long
 | 
			
		||||
		Reference in New Issue
	
	Block a user