diff --git a/newlib/libc/include/malloc.h b/newlib/libc/include/malloc.h index 41b5efd..5915391 100644 --- a/newlib/libc/include/malloc.h +++ b/newlib/libc/include/malloc.h @@ -30,7 +30,7 @@ struct mallinfo { size_t uordblks; /* total allocated space */ size_t fordblks; /* total non-inuse space */ size_t keepcost; /* top-most, releasable (via malloc_trim) space */ -}; +}; /* The routines. */ @@ -61,7 +61,13 @@ extern _PTR _realloc_r _PARAMS ((struct _reent *, _PTR, size_t)); extern _PTR calloc _PARAMS ((size_t, size_t)); #ifdef __CYGWIN__ #undef _calloc_r -#define _calloc_r(r, s1, s2) calloc (s1, s2); +/* ---------------------------------------------------------------------------*/ +/* bareflank: start */ +/* ---------------------------------------------------------------------------*/ +#define _calloc_r(r, s1, s2) calloc (s1, s2) +/* ---------------------------------------------------------------------------*/ +/* bareflank: end */ +/* ---------------------------------------------------------------------------*/ #else extern _PTR _calloc_r _PARAMS ((struct _reent *, size_t, size_t)); #endif @@ -69,7 +75,13 @@ extern _PTR _calloc_r _PARAMS ((struct _reent *, size_t, size_t)); extern _PTR memalign _PARAMS ((size_t, size_t)); #ifdef __CYGWIN__ #undef _memalign_r -#define _memalign_r(r, s1, s2) memalign (s1, s2); +/* ---------------------------------------------------------------------------*/ +/* bareflank: start */ +/* ---------------------------------------------------------------------------*/ +#define _memalign_r(r, s1, s2) memalign (s1, s2) +/* ---------------------------------------------------------------------------*/ +/* bareflank: end */ +/* ---------------------------------------------------------------------------*/ #else extern _PTR _memalign_r _PARAMS ((struct _reent *, size_t, size_t)); #endif @@ -151,10 +163,10 @@ extern _VOID _mstats_r _PARAMS ((struct _reent *, char *)); #define M_KEEP 4 /* UNUSED in this malloc */ /* mallopt options that actually do something */ - + #define M_TRIM_THRESHOLD -1 #define M_TOP_PAD -2 -#define M_MMAP_THRESHOLD -3 +#define M_MMAP_THRESHOLD -3 #define M_MMAP_MAX -4 #ifndef __CYGWIN__ diff --git a/newlib/libc/include/pthread.h b/newlib/libc/include/pthread.h index 516131d..8a6ef94 100644 --- a/newlib/libc/include/pthread.h +++ b/newlib/libc/include/pthread.h @@ -1,456 +1,207 @@ +/* ---------------------------------------------------------------------------*/ +/* bareflank: start */ +/* ---------------------------------------------------------------------------*/ +/* POSIX compliant pthread header */ + /* - * Written by Joel Sherrill . + * Bareflank Hypervisor + * + * Copyright (C) 2015 Assured Information Security, Inc. + * Author: Rian Quinn + * Author: Brendan Kerrigan * - * COPYRIGHT (c) 1989-2013, 2015. - * On-Line Applications Research Corporation (OAR). + * This 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. * - * Permission to use, copy, modify, and distribute this software for any - * purpose without fee is hereby granted, provided that this entire notice - * is included in all copies of any software which is or includes a copy - * or modification of this software. + * This 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. * - * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION - * OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS - * SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef __PTHREAD_h -#define __PTHREAD_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#if defined(_POSIX_THREADS) +#ifndef PTHREAD_H +#define PTHREAD_H #include -#include -#include -#include - -struct _pthread_cleanup_context { - void (*_routine)(void *); - void *_arg; - int _canceltype; - struct _pthread_cleanup_context *_previous; -}; - -/* Register Fork Handlers */ -int _EXFUN(pthread_atfork,(void (*prepare)(void), void (*parent)(void), - void (*child)(void))); - -/* Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81 */ - -int _EXFUN(pthread_mutexattr_init, (pthread_mutexattr_t *__attr)); -int _EXFUN(pthread_mutexattr_destroy, (pthread_mutexattr_t *__attr)); -int _EXFUN(pthread_mutexattr_getpshared, - (_CONST pthread_mutexattr_t *__attr, int *__pshared)); -int _EXFUN(pthread_mutexattr_setpshared, - (pthread_mutexattr_t *__attr, int __pshared)); - -#if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES) - -/* Single UNIX Specification 2 Mutex Attributes types */ - -int _EXFUN(pthread_mutexattr_gettype, - (_CONST pthread_mutexattr_t *__attr, int *__kind)); -int _EXFUN(pthread_mutexattr_settype, - (pthread_mutexattr_t *__attr, int __kind)); +#ifdef __cplusplus +extern "C" { #endif -/* Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87 */ - -int _EXFUN(pthread_mutex_init, - (pthread_mutex_t *__mutex, _CONST pthread_mutexattr_t *__attr)); -int _EXFUN(pthread_mutex_destroy, (pthread_mutex_t *__mutex)); - -/* This is used to statically initialize a pthread_mutex_t. Example: - - pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; - */ - -#define PTHREAD_MUTEX_INITIALIZER _PTHREAD_MUTEX_INITIALIZER - -/* Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93 - NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29 */ - -int _EXFUN(pthread_mutex_lock, (pthread_mutex_t *__mutex)); -int _EXFUN(pthread_mutex_trylock, (pthread_mutex_t *__mutex)); -int _EXFUN(pthread_mutex_unlock, (pthread_mutex_t *__mutex)); - -#if defined(_POSIX_TIMEOUTS) - -int _EXFUN(pthread_mutex_timedlock, - (pthread_mutex_t *__mutex, _CONST struct timespec *__timeout)); - -#endif /* _POSIX_TIMEOUTS */ - -/* Condition Variable Initialization Attributes, P1003.1c/Draft 10, p. 96 */ - -int _EXFUN(pthread_condattr_init, (pthread_condattr_t *__attr)); -int _EXFUN(pthread_condattr_destroy, (pthread_condattr_t *__attr)); - -int _EXFUN(pthread_condattr_getclock, - (const pthread_condattr_t *__restrict __attr, - clockid_t *__restrict __clock_id)); -int _EXFUN(pthread_condattr_setclock, - (pthread_condattr_t *__attr, clockid_t __clock_id)); - -int _EXFUN(pthread_condattr_getpshared, - (_CONST pthread_condattr_t *__attr, int *__pshared)); -int _EXFUN(pthread_condattr_setpshared, - (pthread_condattr_t *__attr, int __pshared)); - -/* Initializing and Destroying a Condition Variable, P1003.1c/Draft 10, p. 87 */ - -int _EXFUN(pthread_cond_init, - (pthread_cond_t *__cond, _CONST pthread_condattr_t *__attr)); -int _EXFUN(pthread_cond_destroy, (pthread_cond_t *__mutex)); - -/* This is used to statically initialize a pthread_cond_t. Example: - - pthread_cond_t cond = PTHREAD_COND_INITIALIZER; +/* + * constants */ - -#define PTHREAD_COND_INITIALIZER _PTHREAD_COND_INITIALIZER - -/* Broadcasting and Signaling a Condition, P1003.1c/Draft 10, p. 101 */ - -int _EXFUN(pthread_cond_signal, (pthread_cond_t *__cond)); -int _EXFUN(pthread_cond_broadcast, (pthread_cond_t *__cond)); - -/* Waiting on a Condition, P1003.1c/Draft 10, p. 105 */ - -int _EXFUN(pthread_cond_wait, - (pthread_cond_t *__cond, pthread_mutex_t *__mutex)); - -int _EXFUN(pthread_cond_timedwait, - (pthread_cond_t *__cond, pthread_mutex_t *__mutex, - _CONST struct timespec *__abstime)); - -#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) - -/* Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120 */ - -int _EXFUN(pthread_attr_setscope, - (pthread_attr_t *__attr, int __contentionscope)); -int _EXFUN(pthread_attr_getscope, - (_CONST pthread_attr_t *__attr, int *__contentionscope)); -int _EXFUN(pthread_attr_setinheritsched, - (pthread_attr_t *__attr, int __inheritsched)); -int _EXFUN(pthread_attr_getinheritsched, - (_CONST pthread_attr_t *__attr, int *__inheritsched)); -int _EXFUN(pthread_attr_setschedpolicy, - (pthread_attr_t *__attr, int __policy)); -int _EXFUN(pthread_attr_getschedpolicy, - (_CONST pthread_attr_t *__attr, int *__policy)); - -#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */ - -int _EXFUN(pthread_attr_setschedparam, - (pthread_attr_t *__attr, _CONST struct sched_param *__param)); -int _EXFUN(pthread_attr_getschedparam, - (_CONST pthread_attr_t *__attr, struct sched_param *__param)); - -#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) - -/* Dynamic Thread Scheduling Parameters Access, P1003.1c/Draft 10, p. 124 */ - -int _EXFUN(pthread_getschedparam, - (pthread_t __pthread, int *__policy, struct sched_param *__param)); -int _EXFUN(pthread_setschedparam, - (pthread_t __pthread, int __policy, struct sched_param *__param)); - -/* Set Scheduling Priority of a Thread */ -int _EXFUN(pthread_setschedprio, (pthread_t thread, int prio)); - -#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */ - -#if __GNU_VISIBLE -int pthread_getname_np(pthread_t, char *, size_t) __nonnull(2); - -int pthread_setname_np(pthread_t, const char *) __nonnull(2); -#endif - -#if defined(_POSIX_THREAD_PRIO_INHERIT) || defined(_POSIX_THREAD_PRIO_PROTECT) +#define PTHREAD_BARRIER_SERIAL_THREAD 0x00000001U +#define PTHREAD_CANCEL_ASYNCHRONOUS 0x00000001U +#define PTHREAD_CANCEL_ENABLE 0x00000002U +#define PTHREAD_CANCEL_DEFERRED 0x00000004U +#define PTHREAD_CANCEL_DISABLE 0x00000008U +#define PTHREAD_CANCELED 0x00000001U +#define PTHREAD_CREATE_DETACHED 0x00000001U +#define PTHREAD_CREATE_JOINABLE 0x00000002U -/* Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128 */ - -int _EXFUN(pthread_mutexattr_setprotocol, - (pthread_mutexattr_t *__attr, int __protocol)); -int _EXFUN(pthread_mutexattr_getprotocol, - (_CONST pthread_mutexattr_t *__attr, int *__protocol)); -int _EXFUN(pthread_mutexattr_setprioceiling, - (pthread_mutexattr_t *__attr, int __prioceiling)); -int _EXFUN(pthread_mutexattr_getprioceiling, - (_CONST pthread_mutexattr_t *__attr, int *__prioceiling)); +#define PTHREAD_EXPLICIT_SCHED 0x00000001U /* [TPS] */ +#define PTHREAD_INHERIT_SCHED 0x00000002U /* [TPS] */ -#endif /* _POSIX_THREAD_PRIO_INHERIT || _POSIX_THREAD_PRIO_PROTECT */ +#define PTHREAD_MUTEX_DEFAULT 0x00000001U +#define PTHREAD_MUTEX_ERRORCHECK 0x00000002U +#define PTHREAD_MUTEX_NORMAL 0x00000004U +#define PTHREAD_MUTEX_RECURSIVE 0x00000008U +#define PTHREAD_MUTEX_ROBUST 0x00000010U +#define PTHREAD_MUTEX_STALLED 0x00000020U +#define PTHREAD_ONCE_INIT 0x00000000U -#if defined(_POSIX_THREAD_PRIO_PROTECT) +#define PTHREAD_PRIO_INHERIT 0x00000001U /* [RPI|TPI] */ -/* Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131 */ +#define PTHREAD_PRIO_NONE 0x00000002U /* [MC1] */ -int _EXFUN(pthread_mutex_setprioceiling, - (pthread_mutex_t *__mutex, int __prioceiling, int *__old_ceiling)); -int _EXFUN(pthread_mutex_getprioceiling, - (pthread_mutex_t *__mutex, int *__prioceiling)); +#define PTHREAD_PRIO_PROTECT 0x00000004U /* [RPP|TPP] */ -#endif /* _POSIX_THREAD_PRIO_PROTECT */ +#define PTHREAD_PROCESS_SHARED 0x00000001U +#define PTHREAD_PROCESS_PRIVATE 0x00000002U -/* Thread Creation Attributes, P1003.1c/Draft 10, p, 140 */ +#define PTHREAD_SCOPE_PROCESS 0x00000001U /* [TPS] */ +#define PTHREAD_SCOPE_SYSTEM 0x00000002U /* [TPS] */ -int _EXFUN(pthread_attr_init, (pthread_attr_t *__attr)); -int _EXFUN(pthread_attr_destroy, (pthread_attr_t *__attr)); -int _EXFUN(pthread_attr_setstack, (pthread_attr_t *attr, - void *__stackaddr, size_t __stacksize)); -int _EXFUN(pthread_attr_getstack, (_CONST pthread_attr_t *attr, - void **__stackaddr, size_t *__stacksize)); -int _EXFUN(pthread_attr_getstacksize, - (_CONST pthread_attr_t *__attr, size_t *__stacksize)); -int _EXFUN(pthread_attr_setstacksize, - (pthread_attr_t *__attr, size_t __stacksize)); -int _EXFUN(pthread_attr_getstackaddr, - (_CONST pthread_attr_t *__attr, void **__stackaddr)); -int _EXFUN(pthread_attr_setstackaddr, - (pthread_attr_t *__attr, void *__stackaddr)); -int _EXFUN(pthread_attr_getdetachstate, - (_CONST pthread_attr_t *__attr, int *__detachstate)); -int _EXFUN(pthread_attr_setdetachstate, - (pthread_attr_t *__attr, int __detachstate)); -int _EXFUN(pthread_attr_getguardsize, - (_CONST pthread_attr_t *__attr, size_t *__guardsize)); -int _EXFUN(pthread_attr_setguardsize, - (pthread_attr_t *__attr, size_t __guardsize)); - -/* POSIX thread APIs beyond the POSIX standard but provided - * in GNU/Linux. They may be provided by other OSes for - * compatibility. +/* + * initializers */ -#if __GNU_VISIBLE -#if defined(__rtems__) -int _EXFUN(pthread_attr_setaffinity_np, - (pthread_attr_t *__attr, size_t __cpusetsize, - const cpu_set_t *__cpuset)); -int _EXFUN(pthread_attr_getaffinity_np, - (const pthread_attr_t *__attr, size_t __cpusetsize, - cpu_set_t *__cpuset)); - -int _EXFUN(pthread_setaffinity_np, - (pthread_t __id, size_t __cpusetsize, const cpu_set_t *__cpuset)); -int _EXFUN(pthread_getaffinity_np, - (const pthread_t __id, size_t __cpusetsize, cpu_set_t *__cpuset)); - -int _EXFUN(pthread_getattr_np, - (pthread_t __id, pthread_attr_t *__attr)); -#endif /* defined(__rtems__) */ -#endif /* __GNU_VISIBLE */ - -/* Thread Creation, P1003.1c/Draft 10, p. 144 */ - -int _EXFUN(pthread_create, - (pthread_t *__pthread, _CONST pthread_attr_t *__attr, - void *(*__start_routine)( void * ), void *__arg)); - -/* Wait for Thread Termination, P1003.1c/Draft 10, p. 147 */ - -int _EXFUN(pthread_join, (pthread_t __pthread, void **__value_ptr)); - -/* Detaching a Thread, P1003.1c/Draft 10, p. 149 */ - -int _EXFUN(pthread_detach, (pthread_t __pthread)); - -/* Thread Termination, p1003.1c/Draft 10, p. 150 */ +#define PTHREAD_COND_INITIALIZER 0x00000000U +#define PTHREAD_MUTEX_INITIALIZER 0x00000000U +#define PTHREAD_RWLOCK_INITIALIZER 0x00000000U -void _EXFUN(pthread_exit, (void *__value_ptr)) __dead2; - -/* Get Calling Thread's ID, p1003.1c/Draft 10, p. XXX */ - -pthread_t _EXFUN(pthread_self, (void)); - -/* Compare Thread IDs, p1003.1c/Draft 10, p. 153 */ - -int _EXFUN(pthread_equal, (pthread_t __t1, pthread_t __t2)); - -/* Retrieve ID of a Thread's CPU Time Clock */ -int _EXFUN(pthread_getcpuclockid, - (pthread_t thread, clockid_t *clock_id)); - -/* Get/Set Current Thread's Concurrency Level */ -int _EXFUN(pthread_setconcurrency, (int new_level)); -int _EXFUN(pthread_getconcurrency, (void)); - -#if __BSD_VISIBLE || __GNU_VISIBLE -void _EXFUN(pthread_yield, (void)); -#endif - -/* Dynamic Package Initialization */ - -/* This is used to statically initialize a pthread_once_t. Example: - - pthread_once_t once = PTHREAD_ONCE_INIT; - - NOTE: This is named inconsistently -- it should be INITIALIZER. */ - -#define PTHREAD_ONCE_INIT _PTHREAD_ONCE_INIT - -int _EXFUN(pthread_once, - (pthread_once_t *__once_control, void (*__init_routine)(void))); - -/* Thread-Specific Data Key Create, P1003.1c/Draft 10, p. 163 */ - -int _EXFUN(pthread_key_create, - (pthread_key_t *__key, void (*__destructor)( void * ))); - -/* Thread-Specific Data Management, P1003.1c/Draft 10, p. 165 */ - -int _EXFUN(pthread_setspecific, - (pthread_key_t __key, _CONST void *__value)); -void * _EXFUN(pthread_getspecific, (pthread_key_t __key)); - -/* Thread-Specific Data Key Deletion, P1003.1c/Draft 10, p. 167 */ - -int _EXFUN(pthread_key_delete, (pthread_key_t __key)); - -/* Execution of a Thread, P1003.1c/Draft 10, p. 181 */ - -#define PTHREAD_CANCEL_ENABLE 0 -#define PTHREAD_CANCEL_DISABLE 1 - -#define PTHREAD_CANCEL_DEFERRED 0 -#define PTHREAD_CANCEL_ASYNCHRONOUS 1 - -#define PTHREAD_CANCELED ((void *) -1) - -int _EXFUN(pthread_cancel, (pthread_t __pthread)); - -/* Setting Cancelability State, P1003.1c/Draft 10, p. 183 */ - -int _EXFUN(pthread_setcancelstate, (int __state, int *__oldstate)); -int _EXFUN(pthread_setcanceltype, (int __type, int *__oldtype)); -void _EXFUN(pthread_testcancel, (void)); - -/* Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184 */ - -void _EXFUN(_pthread_cleanup_push, - (struct _pthread_cleanup_context *_context, - void (*_routine)(void *), void *_arg)); - -void _EXFUN(_pthread_cleanup_pop, - (struct _pthread_cleanup_context *_context, - int _execute)); - -/* It is intentional to open and close the scope in two different macros */ -#define pthread_cleanup_push(_routine, _arg) \ - do { \ - struct _pthread_cleanup_context _pthread_clup_ctx; \ - _pthread_cleanup_push(&_pthread_clup_ctx, (_routine), (_arg)) - -#define pthread_cleanup_pop(_execute) \ - _pthread_cleanup_pop(&_pthread_clup_ctx, (_execute)); \ - } while (0) - -#if __GNU_VISIBLE -void _EXFUN(_pthread_cleanup_push_defer, - (struct _pthread_cleanup_context *_context, - void (*_routine)(void *), void *_arg)); - -void _EXFUN(_pthread_cleanup_pop_restore, - (struct _pthread_cleanup_context *_context, - int _execute)); - -/* It is intentional to open and close the scope in two different macros */ -#define pthread_cleanup_push_defer_np(_routine, _arg) \ - do { \ - struct _pthread_cleanup_context _pthread_clup_ctx; \ - _pthread_cleanup_push_defer(&_pthread_clup_ctx, (_routine), (_arg)) - -#define pthread_cleanup_pop_restore_np(_execute) \ - _pthread_cleanup_pop_restore(&_pthread_clup_ctx, (_execute)); \ - } while (0) -#endif /* __GNU_VISIBLE */ - -#if defined(_POSIX_THREAD_CPUTIME) - -/* Accessing a Thread CPU-time Clock, P1003.4b/D8, p. 58 */ - -int _EXFUN(pthread_getcpuclockid, - (pthread_t __pthread_id, clockid_t *__clock_id)); - -#endif /* defined(_POSIX_THREAD_CPUTIME) */ - - -#endif /* defined(_POSIX_THREADS) */ - -#if defined(_POSIX_BARRIERS) - -int _EXFUN(pthread_barrierattr_init, (pthread_barrierattr_t *__attr)); -int _EXFUN(pthread_barrierattr_destroy, (pthread_barrierattr_t *__attr)); -int _EXFUN(pthread_barrierattr_getpshared, - (_CONST pthread_barrierattr_t *__attr, int *__pshared)); -int _EXFUN(pthread_barrierattr_setpshared, - (pthread_barrierattr_t *__attr, int __pshared)); - -#define PTHREAD_BARRIER_SERIAL_THREAD -1 - -int _EXFUN(pthread_barrier_init, - (pthread_barrier_t *__barrier, - _CONST pthread_barrierattr_t *__attr, unsigned __count)); -int _EXFUN(pthread_barrier_destroy, (pthread_barrier_t *__barrier)); -int _EXFUN(pthread_barrier_wait,(pthread_barrier_t *__barrier)); - -#endif /* defined(_POSIX_BARRIERS) */ - -#if defined(_POSIX_SPIN_LOCKS) - -int _EXFUN(pthread_spin_init, - (pthread_spinlock_t *__spinlock, int __pshared)); -int _EXFUN(pthread_spin_destroy, (pthread_spinlock_t *__spinlock)); -int _EXFUN(pthread_spin_lock, (pthread_spinlock_t *__spinlock)); -int _EXFUN(pthread_spin_trylock, (pthread_spinlock_t *__spinlock)); -int _EXFUN(pthread_spin_unlock, (pthread_spinlock_t *__spinlock)); - -#endif /* defined(_POSIX_SPIN_LOCKS) */ - -#if defined(_POSIX_READER_WRITER_LOCKS) - -/* This is used to statically initialize a pthread_rwlock_t. Example: - - pthread_mutex_t mutex = PTHREAD_RWLOCK_INITIALIZER; +/* + * types */ - -#define PTHREAD_RWLOCK_INITIALIZER _PTHREAD_RWLOCK_INITIALIZER - -int _EXFUN(pthread_rwlockattr_init, (pthread_rwlockattr_t *__attr)); -int _EXFUN(pthread_rwlockattr_destroy, (pthread_rwlockattr_t *__attr)); -int _EXFUN(pthread_rwlockattr_getpshared, - (_CONST pthread_rwlockattr_t *__attr, int *__pshared)); -int _EXFUN(pthread_rwlockattr_setpshared, - (pthread_rwlockattr_t *__attr, int __pshared)); - -int _EXFUN(pthread_rwlock_init, - (pthread_rwlock_t *__rwlock, _CONST pthread_rwlockattr_t *__attr)); -int _EXFUN(pthread_rwlock_destroy, (pthread_rwlock_t *__rwlock)); -int _EXFUN(pthread_rwlock_rdlock,(pthread_rwlock_t *__rwlock)); -int _EXFUN(pthread_rwlock_tryrdlock,(pthread_rwlock_t *__rwlock)); -int _EXFUN(pthread_rwlock_timedrdlock, - (pthread_rwlock_t *__rwlock, _CONST struct timespec *__abstime)); -int _EXFUN(pthread_rwlock_unlock,(pthread_rwlock_t *__rwlock)); -int _EXFUN(pthread_rwlock_wrlock,(pthread_rwlock_t *__rwlock)); -int _EXFUN(pthread_rwlock_trywrlock,(pthread_rwlock_t *__rwlock)); -int _EXFUN(pthread_rwlock_timedwrlock, - (pthread_rwlock_t *__rwlock, _CONST struct timespec *__abstime)); - -#endif /* defined(_POSIX_READER_WRITER_LOCKS) */ - +typedef int64_t pthread_attr_t; /* Used to identify a thread attribute object. */ +typedef int64_t pthread_barrier_t; /* Used to identify a barrier. */ +typedef int64_t pthread_barrierattr_t; /* Used to define a barrier attributes object. */ +typedef int64_t pthread_cond_t; /* Used for condition variables. */ +typedef int64_t pthread_condattr_t; /* Used to identify a condition attribute object. */ +typedef int64_t pthread_key_t; /* Used for thread-specific data keys. */ +typedef int64_t pthread_mutex_t; /* Used for mutexes. */ +typedef int64_t pthread_mutexattr_t; /* Used to identify a mutex attribute object. */ +typedef int64_t pthread_once_t; /* Used for dynamic package initialization. */ +typedef int64_t pthread_rwlock_t; /* Used for read-write locks. */ +typedef int64_t pthread_rwlockattr_t; /* Used for read-write lock attributes. */ +typedef int64_t pthread_spinlock_t; /* Used to identify a spin lock. */ +typedef int64_t pthread_t; /* Used to identify a thread. */ + +/* __BEGIN_DECLS */ + +int pthread_atfork(void (*)(void), void (*)(void),void(*)(void)); +int pthread_attr_destroy(pthread_attr_t *); +int pthread_attr_getdetachstate(const pthread_attr_t *, int *); +int pthread_attr_getguardsize(const pthread_attr_t *, size_t *); +int pthread_attr_getinheritsched(const pthread_attr_t *, int *); /* [TPS] */ +int pthread_attr_getschedparam(const pthread_attr_t *, struct sched_param *); +int pthread_attr_getschedpolicy(const pthread_attr_t *, int *); /* [TPS] */ +int pthread_attr_getscope(const pthread_attr_t *, int *); /* [TPS] */ +int pthread_attr_getstack(const pthread_attr_t *, void **, size_t *); /* [TSA TSS] */ +int pthread_attr_getstacksize(const pthread_attr_t *, size_t *); /* [TSS] */ +int pthread_attr_init(pthread_attr_t *); +int pthread_attr_setdetachstate(pthread_attr_t *, int); +int pthread_attr_setguardsize(pthread_attr_t *, size_t); +int pthread_attr_setinheritsched(pthread_attr_t *, int); /* [TPS] */ +int pthread_attr_setschedparam(pthread_attr_t *, const struct sched_param *); +int pthread_attr_setschedpolicy(pthread_attr_t *, int); /* [TPS] */ +int pthread_attr_setscope(pthread_attr_t *, int); /* [TPS] */ +int pthread_attr_setstack(pthread_attr_t *, void *, size_t); /* [TSA TSS] */ +int pthread_attr_setstacksize(pthread_attr_t *, size_t); /* [TSS] */ +int pthread_barrier_destroy(pthread_barrier_t *); +int pthread_barrier_init(pthread_barrier_t *, const pthread_barrierattr_t *, unsigned); +int pthread_barrier_wait(pthread_barrier_t *); +int pthread_barrierattr_destroy(pthread_barrierattr_t *); +int pthread_barrierattr_getpshared(const pthread_barrierattr_t *, int *); /* [TSH] */ +int pthread_barrierattr_init(pthread_barrierattr_t *); +int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int); /* [TSH] */ +int pthread_cancel(pthread_t); +int pthread_cond_broadcast(pthread_cond_t *); +int pthread_cond_destroy(pthread_cond_t *); +int pthread_cond_init(pthread_cond_t *,const pthread_condattr_t *); +int pthread_cond_signal(pthread_cond_t *); +int pthread_cond_timedwait(pthread_cond_t *, pthread_mutex_t *, const struct timespec *); +int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *); +int pthread_condattr_destroy(pthread_condattr_t *); +int pthread_condattr_getclock(const pthread_condattr_t *, clockid_t *); +int pthread_condattr_getpshared(const pthread_condattr_t *, int *); /* [TSH] */ +int pthread_condattr_init(pthread_condattr_t *); +int pthread_condattr_setclock(pthread_condattr_t *, clockid_t); +int pthread_condattr_setpshared(pthread_condattr_t *, int); /* [TSH] */ +int pthread_create(pthread_t *, const pthread_attr_t *, void *(*)(void*), void *); +int pthread_detach(pthread_t); +int pthread_equal(pthread_t, pthread_t); +void pthread_exit(void *); +int pthread_getconcurrency(void); /* [OB XSI] */ +int pthread_getcpuclockid(pthread_t, clockid_t *); /* [TCT] */ +int pthread_getschedparam(pthread_t, int *, struct sched_param *); /* [TPS] */ +void *pthread_getspecific(pthread_key_t); +int pthread_join(pthread_t, void **); +int pthread_key_create(pthread_key_t *, void (*)(void*)); +int pthread_key_delete(pthread_key_t); +int pthread_mutex_consistent(pthread_mutex_t *); +int pthread_mutex_destroy(pthread_mutex_t *); +int pthread_mutex_getprioceiling(const pthread_mutex_t *, int *); /* [RPP|TPP] */ +int pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *); +int pthread_mutex_lock(pthread_mutex_t *); +int pthread_mutex_setprioceiling(pthread_mutex_t *, int, int *); /* [RPP|TPP] */ +int pthread_mutex_timedlock(pthread_mutex_t *, const struct timespec *); +int pthread_mutex_trylock(pthread_mutex_t *); +int pthread_mutex_unlock(pthread_mutex_t *); +int pthread_mutexattr_destroy(pthread_mutexattr_t *); +int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *, int *); /* [RPP|TPP] */ +int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *, int *); /* [MC1] */ +int pthread_mutexattr_getpshared(const pthread_mutexattr_t *, int *); /* [TSH] */ +int pthread_mutexattr_getrobust(const pthread_mutexattr_t *, int *); +int pthread_mutexattr_gettype(const pthread_mutexattr_t *, int *); +int pthread_mutexattr_init(pthread_mutexattr_t *); +int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int); /* [RPP|TPP] */ +int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int); /* [MC1] */ +int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int); /* [TSH] */ +int pthread_mutexattr_setrobust(pthread_mutexattr_t *, int); +int pthread_mutexattr_settype(pthread_mutexattr_t *, int); +int pthread_once(pthread_once_t *, void (*)(void)); +int pthread_rwlock_destroy(pthread_rwlock_t *); +int pthread_rwlock_init(pthread_rwlock_t *, const pthread_rwlockattr_t *); +int pthread_rwlock_rdlock(pthread_rwlock_t *); +int pthread_rwlock_timedrdlock(pthread_rwlock_t *, const struct timespec *); +int pthread_rwlock_timedwrlock(pthread_rwlock_t *, const struct timespec *); +int pthread_rwlock_tryrdlock(pthread_rwlock_t *); +int pthread_rwlock_trywrlock(pthread_rwlock_t *); +int pthread_rwlock_unlock(pthread_rwlock_t *); +int pthread_rwlock_wrlock(pthread_rwlock_t *); +int pthread_rwlockattr_destroy(pthread_rwlockattr_t *); +int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *, int *); /* [TSH] */ +int pthread_rwlockattr_init(pthread_rwlockattr_t *); +int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int); /* [TSH] */ +pthread_t pthread_self(void); +int pthread_setcancelstate(int, int *); +int pthread_setcanceltype(int, int *); +int pthread_setconcurrency(int); /* [OB XSI] */ +int pthread_setschedparam(pthread_t, int, const struct sched_param *); /* [TPS] */ +int pthread_setschedprio(pthread_t, int); /* [TPS] */ +int pthread_setspecific(pthread_key_t, const void *); +int pthread_spin_destroy(pthread_spinlock_t *); +int pthread_spin_init(pthread_spinlock_t *, int); +int pthread_spin_lock(pthread_spinlock_t *); +int pthread_spin_trylock(pthread_spinlock_t *); +int pthread_spin_unlock(pthread_spinlock_t *); +void pthread_testcancel(void); + +/* __END_DECLS */ #ifdef __cplusplus } #endif #endif -/* end of include file */ + +/* ---------------------------------------------------------------------------*/ +/* bareflank: end */ +/* ---------------------------------------------------------------------------*/ \ No newline at end of file diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h index 097b0f6..e680d96 100644 --- a/newlib/libc/include/stdio.h +++ b/newlib/libc/include/stdio.h @@ -274,7 +274,13 @@ int _EXFUN(vscanf, (const char *, __VALIST) int _EXFUN(vsscanf, (const char *__restrict, const char *__restrict, __VALIST) _ATTRIBUTE ((__format__ (__scanf__, 2, 0)))); #endif -#if __GNU_VISIBLE +/* ---------------------------------------------------------------------------*/ +/* bareflank: start */ +/* ---------------------------------------------------------------------------*/ +#if 1 +/* ---------------------------------------------------------------------------*/ +/* bareflank: end */ +/* ---------------------------------------------------------------------------*/ int _EXFUN(asprintf, (char **__restrict, const char *__restrict, ...) _ATTRIBUTE ((__format__ (__printf__, 2, 3)))); int _EXFUN(vasprintf, (char **, const char *, __VALIST) @@ -645,7 +651,7 @@ FILE *_EXFUN(_fopencookie_r,(struct _reent *, void *__cookie, #ifndef __CUSTOM_FILE_IO__ /* - * The __sfoo macros are here so that we can + * The __sfoo macros are here so that we can * define function versions in the C library. */ #define __sgetc_raw_r(__ptr, __f) (--(__f)->_r < 0 ? __srget_r(__ptr, __f) : (int)(*(__f)->_p++)) @@ -654,7 +660,7 @@ FILE *_EXFUN(_fopencookie_r,(struct _reent *, void *__cookie, /* For a platform with CR/LF, additional logic is required by __sgetc_r which would otherwise simply be a macro; therefore we use an inlined function. The function is only meant to be inlined - in place as used and the function body should never be emitted. + in place as used and the function body should never be emitted. There are two possible means to this end when compiling with GCC, one when compiling with a standard C99 compiler, and for other diff --git a/newlib/libc/misc/fini.c b/newlib/libc/misc/fini.c index ab4203b..ed1ca07 100644 --- a/newlib/libc/misc/fini.c +++ b/newlib/libc/misc/fini.c @@ -13,7 +13,13 @@ /* Handle ELF .{pre_init,init,fini}_array sections. */ #include -#ifdef HAVE_INITFINI_ARRAY +/* ---------------------------------------------------------------------------*/ +/* bareflank: start */ +/* ---------------------------------------------------------------------------*/ +#if 0 +/* ---------------------------------------------------------------------------*/ +/* bareflank: end */ +/* ---------------------------------------------------------------------------*/ extern void (*__fini_array_start []) (void) __attribute__((weak)); extern void (*__fini_array_end []) (void) __attribute__((weak)); diff --git a/newlib/libc/misc/init.c b/newlib/libc/misc/init.c index c85d602..2bad555 100644 --- a/newlib/libc/misc/init.c +++ b/newlib/libc/misc/init.c @@ -13,7 +13,13 @@ /* Handle ELF .{pre_init,init,fini}_array sections. */ #include -#ifdef HAVE_INITFINI_ARRAY +/* ---------------------------------------------------------------------------*/ +/* bareflank: start */ +/* ---------------------------------------------------------------------------*/ +#if 0 +/* ---------------------------------------------------------------------------*/ +/* bareflank: end */ +/* ---------------------------------------------------------------------------*/ /* These magic symbols are provided by the linker. */ extern void (*__preinit_array_start []) (void) __attribute__((weak)); diff --git a/newlib/libc/stdlib/calloc.c b/newlib/libc/stdlib/calloc.c index 4415c65..a820104 100644 --- a/newlib/libc/stdlib/calloc.c +++ b/newlib/libc/stdlib/calloc.c @@ -1,5 +1,11 @@ #ifdef MALLOC_PROVIDED -int _dummy_calloc = 1; +/* ---------------------------------------------------------------------------*/ +/* bareflank: start */ +/* ---------------------------------------------------------------------------*/ +/* int _dummy_calloc = 1; */ +/* ---------------------------------------------------------------------------*/ +/* bareflank: end */ +/* ---------------------------------------------------------------------------*/ #else /* FUNCTION diff --git a/newlib/libc/stdlib/malloc.c b/newlib/libc/stdlib/malloc.c index 160a13e..58ed7b9 100644 --- a/newlib/libc/stdlib/malloc.c +++ b/newlib/libc/stdlib/malloc.c @@ -10,7 +10,13 @@ #ifdef MALLOC_PROVIDED -int _dummy_malloc = 1; +/* ---------------------------------------------------------------------------*/ +/* bareflank: start */ +/* ---------------------------------------------------------------------------*/ +/* int _dummy_malloc = 1; */ +/* ---------------------------------------------------------------------------*/ +/* bareflank: end */ +/* ---------------------------------------------------------------------------*/ #else diff --git a/newlib/libc/stdlib/mallocr.c b/newlib/libc/stdlib/mallocr.c index ecc445f..ddda178 100644 --- a/newlib/libc/stdlib/mallocr.c +++ b/newlib/libc/stdlib/mallocr.c @@ -1,5 +1,11 @@ #ifdef MALLOC_PROVIDED -int _dummy_mallocr = 1; +/* ---------------------------------------------------------------------------*/ +/* bareflank: start */ +/* ---------------------------------------------------------------------------*/ +/* int _dummy_mallocr = 1; */ +/* ---------------------------------------------------------------------------*/ +/* bareflank: end */ +/* ---------------------------------------------------------------------------*/ #else /* ---------- To make a malloc.h, start cutting here ------------ */ diff --git a/newlib/libc/stdlib/realloc.c b/newlib/libc/stdlib/realloc.c index 2caa6e4..90b2806 100644 --- a/newlib/libc/stdlib/realloc.c +++ b/newlib/libc/stdlib/realloc.c @@ -1,5 +1,11 @@ #ifdef MALLOC_PROVIDED -int _dummy_calloc = 1; +/* ---------------------------------------------------------------------------*/ +/* bareflank: start */ +/* ---------------------------------------------------------------------------*/ +/* int _dummy_calloc = 1; */ +/* ---------------------------------------------------------------------------*/ +/* bareflank: end */ +/* ---------------------------------------------------------------------------*/ #else /* realloc.c -- a wrapper for realloc_r. */ diff --git a/newlib/libc/string/memcpy.c b/newlib/libc/string/memcpy.c index 5f27bca..5b83639 100644 --- a/newlib/libc/string/memcpy.c +++ b/newlib/libc/string/memcpy.c @@ -1,3 +1,7 @@ +/* ---------------------------------------------------------------------------*/ +/* bareflank: start */ +/* ---------------------------------------------------------------------------*/ +#if 0 /* FUNCTION <>---copy memory regions @@ -109,3 +113,7 @@ _DEFUN (memcpy, (dst0, src0, len0), return dst0; #endif /* not PREFER_SIZE_OVER_SPEED */ } +#endif +/* ---------------------------------------------------------------------------*/ +/* bareflank: end */ +/* ---------------------------------------------------------------------------*/ diff --git a/newlib/libc/string/memset.c b/newlib/libc/string/memset.c index b84e155..2375499 100644 --- a/newlib/libc/string/memset.c +++ b/newlib/libc/string/memset.c @@ -1,3 +1,7 @@ +/* ---------------------------------------------------------------------------*/ +/* bareflank: start */ +/* ---------------------------------------------------------------------------*/ +#if 0 /* FUNCTION <>---set an area of memory @@ -102,3 +106,7 @@ _DEFUN (memset, (m, c, n), return m; } +#endif +/* ---------------------------------------------------------------------------*/ +/* bareflank: end */ +/* ---------------------------------------------------------------------------*/