libpthread compiles, with empty stubs

This commit is contained in:
2017-06-19 01:05:41 +00:00
parent 9815ad49a1
commit 54a7d18c67
5 changed files with 195 additions and 3 deletions

View File

@@ -1330,6 +1330,7 @@ pthread__initmain(pthread_t *newt)
4 * pthread__pagesize / 1024);
*newt = pthread__main;
#if defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II) || !defined(__minix)
#if defined(_PTHREAD_GETTCB_EXT)
pthread__main->pt_tls = _PTHREAD_GETTCB_EXT();
#elif defined(__HAVE___LWP_GETTCB_FAST)
@@ -1338,6 +1339,7 @@ pthread__initmain(pthread_t *newt)
pthread__main->pt_tls = _lwp_getprivate();
#endif
pthread__main->pt_tls->tcb_pthread = pthread__main;
#endif /* defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II) || !defined(__minix) */
}
static signed int

View File

@@ -224,6 +224,7 @@ fcntl(int fd, int cmd, ...)
return retval;
}
#if !defined(__minix)
int
fdatasync(int d)
{
@@ -237,6 +238,7 @@ fdatasync(int d)
return retval;
}
#endif /* !defined(__minix) */
int
fsync(int d)

View File

@@ -70,6 +70,188 @@ __pthread_init(void)
__libc_thr_init();
}
#if defined(__minix)
lwpid_t
_lwp_self(void)
{
return NULL;
}
int
_lwp_create(const ucontext_t *, unsigned long, lwpid_t *)
{
return -1;
}
int
_lwp_exit(void)
{
return -1;
}
int
_lwp_wait(lwpid_t, lwpid_t *)
{
return -1;
}
int
_lwp_suspend(lwpid_t)
{
return -1;
}
int
_lwp_continue(lwpid_t)
{
return -1;
}
int
_lwp_wakeup(lwpid_t)
{
return -1;
}
void
_lwp_makecontext(ucontext_t *, void (*)(void *), void *, void *,
caddr_t, size_t)
{
return;
}
void *
_lwp_getprivate(void)
{
return NULL;
}
void
_lwp_setprivate(void *);
{
return;
}
int
_lwp_kill(lwpid_t, int)
{
return -1;
}
int
_lwp_detach(lwpid_t)
{
return -1;
}
int
_lwp_park(clockid_t, int, const struct timespec *, lwpid_t,
const void *, const void *)
{
return -1;
}
int
_lwp_unpark(lwpid_t, const void *)
{
return -1;
}
ssize_t
_lwp_unpark_all(const lwpid_t *, size_t, const void *)
{
return -1;
}
int
_lwp_setname(lwpid_t, const char *)
{
return -1;
}
int
_lwp_getname(lwpid_t, char *, size_t)
{
return -1;
}
int
_lwp_ctl(int, struct lwpctl **)
{
return -1;
}
#if 0
int
_sys_sched_yield(void)
{
return -1;
}
int
sched_yield(void)
{
return -1;
}
int
_sched_setaffinity(pid_t a, lwpid_t b, size_t c, const cpuset_t *d)
{
return -1;
}
int
_sched_getaffinity(pid_t a, lwpid_t b, size_t c, cpuset_t *d)
{
return -1;
}
int
_sched_setparam(pid_t a, lwpid_t b, int c, const struct sched_param *d)
{
return -1;
}
int
_sched_getparam(pid_t a, lwpid_t b, int *c, struct sched_param *d)
{
return -1;
}
int
_sys_aio_suspend(const struct aiocb * const a[], int b,
const struct timespec *c)
{
return -1;
}
int
_sys_mq_send(mqd_t a, const char *b, size_t c, unsigned d)
{
return -1;
}
ssize_t
_sys_mq_receive(mqd_t a, char *b, size_t c, unsigned *d)
{
return -1;
}
int
_sys_mq_timedsend(mqd_t a, const char *b, size_t c, unsigned d,
const struct timespec *e)
{
return -1;
}
ssize_t
_sys_mq_timedreceive(mqd_t a, char *b, size_t c, unsigned *d,
const struct timespec *e)
{
return -1;
}
#endif /* 0 */
#else
int
_lwp_kill(lwpid_t a, int b)
{
@@ -206,3 +388,4 @@ _sys_mq_timedreceive(mqd_t a, char *b, size_t c, unsigned *d,
return (ssize_t)syscall(SYS_mq_timedreceive, a, b, c, d, e);
}
#endif /* defined(__minix) */

View File

@@ -255,10 +255,11 @@ int pthread__find(pthread_t) PTHREAD_HIDE;
_INITCONTEXT_U_MD(ucp) \
} while (/*CONSTCOND*/0)
#if !defined(__minix)
#if !defined(__HAVE_TLS_VARIANT_I) && !defined(__HAVE_TLS_VARIANT_II)
#error Either __HAVE_TLS_VARIANT_I or __HAVE_TLS_VARIANT_II must be defined
#endif
#endif /* !defined(__minix) */
#ifdef _PTHREAD_GETTCB_EXT
struct tls_tcb *_PTHREAD_GETTCB_EXT(void);
@@ -267,6 +268,9 @@ struct tls_tcb *_PTHREAD_GETTCB_EXT(void);
static inline pthread_t __constfunc
pthread__self(void)
{
#if defined(__minix)
return NULL;
#else
#if defined(_PTHREAD_GETTCB_EXT)
struct tls_tcb * const tcb = _PTHREAD_GETTCB_EXT();
#elif defined(__HAVE___LWP_GETTCB_FAST)
@@ -275,6 +279,7 @@ pthread__self(void)
struct tls_tcb * const tcb = __lwp_getprivate_fast();
#endif
return (pthread_t)tcb->tcb_pthread;
#endif /* defined(__minix) */
}
#define pthread__abort() \

View File

@@ -4,10 +4,10 @@
#__MINIX:
# libbluetooth
# libobjc libposix libppath libpthread
# libobjc libposix libppath
# librt libtre semaphore
TESTS_SUBDIRS= csu libc libcrypt libcurses libevent libexecinfo \
libm libprop \
libm libprop libpthread \
libutil
.if (${MKRUMP} != "no") && !defined(BSD_MK_COMPAT_FILE)