/*
 * Copyright (c) 1997-1998 by Sun Microsystems, Inc.
 * All rights reserved.
 */

/* LINTLIBRARY */
/* PROTOLIB1 */

#pragma ident	"@(#)llib-lthread	1.1	98/01/15 SMI"

#include "libthread.h"

/* common directory */
/* cancel.c */
void __pthread_cleanup_pop(int, _cleanup_t *);
void __pthread_cleanup_push(void (*)(void *), void *, caddr_t,
                                                _cleanup_t *);
int _pthread_cancel(thread_t);
int _pthread_setcancelstate(int, int *);
int _pthread_setcanceltype(int, int *);
void _pthread_testcancel(void);

/* condvar.c */
int _cond_broadcast(cond_t *);
int _cond_destroy(cond_t *);
int _cond_init(cond_t *, int, void *);
int _cond_signal(cond_t *);
int _cond_timedwait(cond_t *, mutex_t *, timestruc_t *);
int _cond_timedwait_cancel(cond_t *, mutex_t *, timestruc_t *);
int _cond_wait(cond_t *, mutex_t *);
int _cond_wait_cancel(cond_t *, mutex_t  *);
int _pthread_cond_timedwait(pthread_cond_t *,
			pthread_mutex_t *, struct timespec *);
int _pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *);

/* mutex.c */
int _mutex_destroy(mutex_t *);
int _mutex_held(mutex_t *);
int _mutex_init(mutex_t *, int, void *);
int _mutex_lock(mutex_t *);
int _mutex_trylock(mutex_t *);
int _mutex_unlock(mutex_t *);

/* pthr_attr.c */
int _pthread_attr_destroy(pthread_attr_t *);
int _pthread_attr_getdetachstate(const pthread_attr_t *, int *);
int _pthread_attr_getinheritsched(const pthread_attr_t *, int *);
int _pthread_attr_getschedparam(const pthread_attr_t *, struct sched_param *);
int _pthread_attr_getschedpolicy(const pthread_attr_t *, int *);
int _pthread_attr_getscope(const pthread_attr_t *, int *);
int _pthread_attr_getstackaddr(const pthread_attr_t *, void **);
int _pthread_attr_getstacksize(const pthread_attr_t *, size_t *);
int _pthread_attr_init(pthread_attr_t *);
int _pthread_attr_setdetachstate(pthread_attr_t *, int);
int _pthread_attr_setinheritsched(pthread_attr_t *, int);
int _pthread_attr_setschedparam(pthread_attr_t *, const struct sched_param *);
int _pthread_attr_setschedpolicy(pthread_attr_t *, int);
int _pthread_attr_setscope(pthread_attr_t *, int);
int _pthread_attr_setstackaddr(pthread_attr_t *, void *);
int _pthread_attr_setstacksize(pthread_attr_t *, size_t);

/* pthr_cond.c */
int _pthread_cond_init(pthread_cond_t *, const pthread_condattr_t *);
int _pthread_condattr_destroy(pthread_condattr_t *);
int _pthread_condattr_getpshared(const pthread_condattr_t *, int *);
int _pthread_condattr_init(pthread_condattr_t *);
int _pthread_condattr_setpshared(pthread_condattr_t *, int);

/* pthr_mutex.c */
int _pthread_mutex_getprioceiling(const pthread_mutex_t *, int *);
int _pthread_mutex_init(pthread_mutex_t *, pthread_mutexattr_t *);
int _pthread_mutex_setprioceiling(pthread_mutex_t *, int, int *);
int _pthread_mutexattr_destroy(pthread_mutexattr_t *);
int _pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *, int *);
int _pthread_mutexattr_getprotocol(const pthread_mutexattr_t *, int *);
int _pthread_mutexattr_getpshared(const pthread_mutexattr_t *, int *);
int _pthread_mutexattr_init(pthread_mutexattr_t *);
int _pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
int _pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
int _pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);

/* pthread.c */
void __pthread_init(void);
int _pthread_atfork(void (*)(void), void (*)(void), void (*)(void));
int _pthread_create(pthread_t *, const pthread_attr_t *, void * (*)(void *),
                                        void *);
int _pthread_equal(pthread_t, pthread_t);
int _pthread_getschedparam(pthread_t, int *, struct sched_param *);
void *_pthread_getspecific(pthread_key_t);
int _pthread_join(pthread_t, void **);
int _pthread_once(pthread_once_t *, void (*)(void));
int _pthread_setschedparam(pthread_t, int , const struct sched_param *);

/* rwlock.c */
int _rw_rdlock(rwlock_t *);
int _rw_read_held(rwlock_t *);
int _rw_tryrdlock(rwlock_t *);
int _rw_trywrlock(rwlock_t *);
int _rw_unlock(rwlock_t *);
int _rw_write_held(rwlock_t *);
int _rw_wrlock(rwlock_t *);
int _rwlock_destroy(rwlock_t *);
int _rwlock_init(rwlock_t *, int, void *);

/* schedctl.c */
int __thr_door_unbind(void);

/* sema.c */
int _sema_destroy(sema_t *);
int _sema_held(sema_t *);
int _sema_init(sema_t *, unsigned int, int, void *);
int _sema_post(sema_t *);
int _sema_trywait(sema_t *);
int _sema_wait(sema_t *);
int _sema_wait_cancel(sema_t *);

/* sig.c */
void _resume_ret(uthread_t *);
void _sigon(void);
void _sigoff(void);

/* subr.c */
int _assfail(char *, char *, int);

/* thread.c */
ulong_t __gettsp(thread_t);
void _pthread_exit(void *);
int _pthread_setcleanupinit(void (*)(void));
int _thr_continue(thread_t);
int _thr_create(void *, size_t, void *(*)(void *),
                        void *, long, thread_t *);
int _thr_detach(thread_t);
int *_thr_errnop(void);
void _thr_exit(void *);
int _thr_getconcurrency(void);
int _thr_getprio(thread_t, int *);
int _thr_join(thread_t, thread_t *, void **);
int _thr_kill(thread_t, int);
int _thr_main(void);
size_t _thr_min_stack(void);
thread_t _thr_self(void);
int _thr_setconcurrency(int);
int _thr_setprio(thread_t, int);
int _thr_sigsetmask(int, const sigset_t *, sigset_t *);
int _thr_stksegment(stack_t *);
int _thr_suspend(thread_t);
void _thr_yield(void);
lwpid_t lwp_self(void);

/* thread_interface.c */
int _thr_libthread(void);

/* tsd.c */
int _thr_keycreate(thread_key_t *, PFrV);
int _thr_key_delete(thread_key_t);
int _thr_setspecific(unsigned int, void *);
void thr_probe_setup(void *);

/* underscore.h */
void _close(int);
int _open(caddr_t, int);

/* sys/common directory */
/* fcntl.c */
int fcntl(int, int, ...);

/* fork.c */
pid_t _fork(void);
pid_t _fork1(void);

/* setitimer.c */
unsigned _alarm(unsigned);
int _setitimer(int, const struct itimerval *, struct itimerval *);

/* sigaction.c */
int _kill(pid_t, int);
int _sigaction(int, const struct sigaction *, struct sigaction *);
int _sigprocmask(int, sigset_t *, sigset_t *);
int setcontext(const ucontext_t *);

/* sigpending.c */
int sigpending(sigset_t *);

/* sigsuspend.c */
int _sigsuspend(const sigset_t *);

/* sigwait.c */
int __sigtimedwait(const sigset_t *, siginfo_t *, const struct timespec *);
int _sigwait(const sigset_t *);

/* sleep.c */
unsigned _sleep(unsigned);

extern int creat(const char *, mode_t);
extern pid_t fork(void);
extern int fsync(int);
extern int msync(caddr_t, size_t, int);
extern int pause(void);
