mirror of
https://github.com/fluencelabs/musl
synced 2025-06-14 07:21:40 +00:00
clean up sloppy nested inclusion from pthread_impl.h
this mirrors the stdio_impl.h cleanup. one header which is not strictly needed, errno.h, is left in pthread_impl.h, because since pthread functions return their error codes rather than using errno, nearly every single pthread function needs the errno constants. in a few places, rather than bringing in string.h to use memset, the memset was replaced by direct assignment. this seems to generate much better code anyway, and makes many functions which were previously non-leaf functions into leaf functions (possibly eliminating a great deal of bloat on some platforms where non-leaf functions require ugly prologue and/or epilogue).
This commit is contained in:
@ -1,5 +1,8 @@
|
|||||||
#include <aio.h>
|
#include <aio.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <limits.h>
|
||||||
#include "pthread_impl.h"
|
#include "pthread_impl.h"
|
||||||
|
|
||||||
static void dummy(void)
|
static void dummy(void)
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
#include <aio.h>
|
#include <aio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
#include "pthread_impl.h"
|
#include "pthread_impl.h"
|
||||||
|
|
||||||
struct lio_state {
|
struct lio_state {
|
||||||
|
2
src/env/__init_tls.c
vendored
2
src/env/__init_tls.c
vendored
@ -1,5 +1,7 @@
|
|||||||
#include <elf.h>
|
#include <elf.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <string.h>
|
||||||
#include "pthread_impl.h"
|
#include "pthread_impl.h"
|
||||||
#include "libc.h"
|
#include "libc.h"
|
||||||
#include "atomic.h"
|
#include "atomic.h"
|
||||||
|
@ -2,17 +2,9 @@
|
|||||||
#define _PTHREAD_IMPL_H
|
#define _PTHREAD_IMPL_H
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <sched.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <inttypes.h>
|
|
||||||
#include <setjmp.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <time.h>
|
|
||||||
#include <locale.h>
|
|
||||||
#include "libc.h"
|
#include "libc.h"
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
#include "atomic.h"
|
#include "atomic.h"
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
#include "libc.h"
|
#include "libc.h"
|
||||||
#include "pthread_impl.h"
|
#include "pthread_impl.h"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
#include "pthread_impl.h"
|
#include "pthread_impl.h"
|
||||||
#include "libc.h"
|
#include "libc.h"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "stdio_impl.h"
|
#include "stdio_impl.h"
|
||||||
#include "pthread_impl.h"
|
#include "pthread_impl.h"
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
int ftrylockfile(FILE *f)
|
int ftrylockfile(FILE *f)
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
#include "stdio_impl.h"
|
#include "stdio_impl.h"
|
||||||
#include "pthread_impl.h"
|
#include "pthread_impl.h"
|
||||||
#include "syscall.h"
|
#include "syscall.h"
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "pthread_impl.h"
|
#include "pthread_impl.h"
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
void __wake(volatile int *addr, int cnt, int priv)
|
void __wake(volatile int *addr, int cnt, int priv)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#include "pthread_impl.h"
|
#include "pthread_impl.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
int pthread_attr_init(pthread_attr_t *a)
|
int pthread_attr_init(pthread_attr_t *a)
|
||||||
{
|
{
|
||||||
memset(a, 0, sizeof *a);
|
*a = (pthread_attr_t){0};
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
int pthread_barrierattr_init(pthread_barrierattr_t *a)
|
int pthread_barrierattr_init(pthread_barrierattr_t *a)
|
||||||
{
|
{
|
||||||
memset(a, 0, sizeof *a);
|
*a = (pthread_barrierattr_t){0};
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
int pthread_cond_init(pthread_cond_t *restrict c, const pthread_condattr_t *restrict a)
|
int pthread_cond_init(pthread_cond_t *restrict c, const pthread_condattr_t *restrict a)
|
||||||
{
|
{
|
||||||
memset(c, 0, sizeof *c);
|
*c = (pthread_cond_t){0};
|
||||||
if (a) {
|
if (a) {
|
||||||
c->_c_clock = *a & 0x7fffffff;
|
c->_c_clock = *a & 0x7fffffff;
|
||||||
if (*a>>31) c->_c_mutex = (void *)-1;
|
if (*a>>31) c->_c_mutex = (void *)-1;
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
int pthread_condattr_init(pthread_condattr_t *a)
|
int pthread_condattr_init(pthread_condattr_t *a)
|
||||||
{
|
{
|
||||||
memset(a, 0, sizeof *a);
|
*a = (pthread_condattr_t){0};
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "pthread_impl.h"
|
#include "pthread_impl.h"
|
||||||
#include "stdio_impl.h"
|
#include "stdio_impl.h"
|
||||||
|
#include <sys/mman.h>
|
||||||
|
|
||||||
static void dummy_0()
|
static void dummy_0()
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "pthread_impl.h"
|
#include "pthread_impl.h"
|
||||||
|
#include <sys/mman.h>
|
||||||
|
|
||||||
static void dummy(void *p)
|
static void dummy(void *p)
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
int pthread_mutex_init(pthread_mutex_t *restrict m, const pthread_mutexattr_t *restrict a)
|
int pthread_mutex_init(pthread_mutex_t *restrict m, const pthread_mutexattr_t *restrict a)
|
||||||
{
|
{
|
||||||
memset(m, 0, sizeof *m);
|
*m = (pthread_mutex_t){0};
|
||||||
if (a) m->_m_type = *a & 7;
|
if (a) m->_m_type = *a & 7;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
int pthread_mutexattr_init(pthread_mutexattr_t *a)
|
int pthread_mutexattr_init(pthread_mutexattr_t *a)
|
||||||
{
|
{
|
||||||
memset(a, 0, sizeof *a);
|
*a = (pthread_mutexattr_t){0};
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
int pthread_rwlock_init(pthread_rwlock_t *restrict rw, const pthread_rwlockattr_t *restrict a)
|
int pthread_rwlock_init(pthread_rwlock_t *restrict rw, const pthread_rwlockattr_t *restrict a)
|
||||||
{
|
{
|
||||||
memset(rw, 0, sizeof *rw);
|
*rw = (pthread_rwlock_t){0};
|
||||||
if (a) {
|
if (a) {
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
int pthread_rwlockattr_init(pthread_rwlockattr_t *a)
|
int pthread_rwlockattr_init(pthread_rwlockattr_t *a)
|
||||||
{
|
{
|
||||||
memset(a, 0, sizeof *a);
|
*a = (pthread_rwlockattr_t){0};
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "pthread_impl.h"
|
#include "pthread_impl.h"
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
static struct chain {
|
static struct chain {
|
||||||
struct chain *next;
|
struct chain *next;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <setjmp.h>
|
||||||
#include "pthread_impl.h"
|
#include "pthread_impl.h"
|
||||||
|
|
||||||
struct ksigevent {
|
struct ksigevent {
|
||||||
|
Reference in New Issue
Block a user