--- pthread.c 2002/10/23 14:04:00 1.60
+++ pthread.c 2002/10/24 15:21:14 1.61
@@ -80,7 +80,7 @@
pthread_initialize();
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if ((na = pth_attr_new()) == NULL)
return errno;
(*attr) = (pthread_attr_t)na;
@@ -92,7 +92,7 @@
pth_attr_t na;
if (attr == NULL || *attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
na = (pth_attr_t)(*attr);
pth_attr_destroy(na);
*attr = NULL;
@@ -102,71 +102,71 @@
int pthread_attr_setinheritsched(pthread_attr_t *attr, int inheritsched)
{
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
int pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inheritsched)
{
if (attr == NULL || inheritsched == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
int pthread_attr_setschedparam(pthread_attr_t *attr, struct sched_param *schedparam)
{
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
int pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *schedparam)
{
if (attr == NULL || schedparam == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
int pthread_attr_setschedpolicy(pthread_attr_t *attr, int schedpolicy)
{
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *schedpolicy)
{
if (attr == NULL || schedpolicy == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
int pthread_attr_setscope(pthread_attr_t *attr, int scope)
{
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
int pthread_attr_getscope(const pthread_attr_t *attr, int *scope)
{
if (attr == NULL || scope == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize)
{
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (!pth_attr_set((pth_attr_t)(*attr), PTH_ATTR_STACK_SIZE, (unsigned int)stacksize))
return errno;
return OK;
@@ -175,7 +175,7 @@
int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize)
{
if (attr == NULL || stacksize == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (!pth_attr_get((pth_attr_t)(*attr), PTH_ATTR_STACK_SIZE, (unsigned int *)stacksize))
return errno;
return OK;
@@ -184,7 +184,7 @@
int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr)
{
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (!pth_attr_set((pth_attr_t)(*attr), PTH_ATTR_STACK_ADDR, (char *)stackaddr))
return errno;
return OK;
@@ -193,7 +193,7 @@
int pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr)
{
if (attr == NULL || stackaddr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (!pth_attr_get((pth_attr_t)(*attr), PTH_ATTR_STACK_ADDR, (char **)stackaddr))
return errno;
return OK;
@@ -204,13 +204,13 @@
int s;
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (detachstate == PTHREAD_CREATE_DETACHED)
s = FALSE;
else if (detachstate == PTHREAD_CREATE_JOINABLE)
s = TRUE;
else
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (!pth_attr_set((pth_attr_t)(*attr), PTH_ATTR_JOINABLE, s))
return errno;
return OK;
@@ -221,7 +221,7 @@
int s;
if (attr == NULL || detachstate == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (!pth_attr_get((pth_attr_t)(*attr), PTH_ATTR_JOINABLE, &s))
return errno;
if (s == TRUE)
@@ -234,23 +234,23 @@
int pthread_attr_setguardsize(pthread_attr_t *attr, int stacksize)
{
if (attr == NULL || stacksize < 0)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
int pthread_attr_getguardsize(const pthread_attr_t *attr, int *stacksize)
{
if (attr == NULL || stacksize == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
int pthread_attr_setname_np(pthread_attr_t *attr, char *name)
{
if (attr == NULL || name == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (!pth_attr_set((pth_attr_t)(*attr), PTH_ATTR_NAME, name))
return errno;
return OK;
@@ -259,7 +259,7 @@
int pthread_attr_getname_np(const pthread_attr_t *attr, char **name)
{
if (attr == NULL || name == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (!pth_attr_get((pth_attr_t)(*attr), PTH_ATTR_NAME, name))
return errno;
return OK;
@@ -268,7 +268,7 @@
int pthread_attr_setprio_np(pthread_attr_t *attr, int prio)
{
if (attr == NULL || (prio < PTH_PRIO_MIN || prio > PTH_PRIO_MAX))
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (!pth_attr_set((pth_attr_t)(*attr), PTH_ATTR_PRIO, prio))
return errno;
return OK;
@@ -277,7 +277,7 @@
int pthread_attr_getprio_np(const pthread_attr_t *attr, int *prio)
{
if (attr == NULL || prio == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (!pth_attr_get((pth_attr_t)(*attr), PTH_ATTR_PRIO, prio))
return errno;
return OK;
@@ -295,16 +295,16 @@
pthread_initialize();
if (thread == NULL || start_routine == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (pth_ctrl(PTH_CTRL_GETTHREADS) >= PTHREAD_THREADS_MAX)
- return_errno(EAGAIN, EAGAIN);
+ return pth_error(EAGAIN, EAGAIN);
if (attr != NULL)
na = (pth_attr_t)(*attr);
else
na = PTH_ATTR_DEFAULT;
*thread = (pthread_t)pth_spawn(na, start_routine, arg);
if (*thread == NULL)
- return_errno(EAGAIN, EAGAIN);
+ return pth_error(EAGAIN, EAGAIN);
return OK;
}
@@ -313,7 +313,7 @@
pth_attr_t na;
if (thread == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if ((na = pth_attr_of((pth_t)thread)) == NULL)
return errno;
if (!pth_attr_set(na, PTH_ATTR_JOINABLE, FALSE))
@@ -363,7 +363,7 @@
{
pthread_initialize();
if (once_control == NULL || init_routine == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (*once_control != 1)
init_routine();
*once_control = 1;
@@ -403,7 +403,7 @@
int pthread_setconcurrency(int new_level)
{
if (new_level < 0)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
pthread_concurrency = new_level;
return OK;
}
@@ -515,13 +515,13 @@
int pthread_setschedparam(pthread_t pthread, int policy, const struct sched_param *param)
{
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
int pthread_getschedparam(pthread_t pthread, int *policy, struct sched_param *param)
{
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
/*
@@ -577,7 +577,7 @@
struct pthread_atfork_st *info;
if (pthread_atfork_idx > PTH_ATFORK_MAX-1)
- return_errno(ENOMEM, ENOMEM);
+ return pth_error(ENOMEM, ENOMEM);
info = &pthread_atfork_info[pthread_atfork_idx++];
info->prepare = prepare;
info->parent = parent;
@@ -597,7 +597,7 @@
{
pthread_initialize();
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* nothing to do for us */
return OK;
}
@@ -605,7 +605,7 @@
int pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
{
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* nothing to do for us */
return OK;
}
@@ -613,65 +613,65 @@
int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *attr, int prioceiling)
{
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
int pthread_mutexattr_getprioceiling(pthread_mutexattr_t *attr, int *prioceiling)
{
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr, int protocol)
{
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
int pthread_mutexattr_getprotocol(pthread_mutexattr_t *attr, int *protocol)
{
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared)
{
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
int pthread_mutexattr_getpshared(pthread_mutexattr_t *attr, int *pshared)
{
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type)
{
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
int pthread_mutexattr_gettype(pthread_mutexattr_t *attr, int *type)
{
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
/*
@@ -684,7 +684,7 @@
pthread_initialize();
if (mutex == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if ((m = (pth_mutex_t *)malloc(sizeof(pth_mutex_t))) == NULL)
return errno;
if (!pth_mutex_init(m))
@@ -696,7 +696,7 @@
int pthread_mutex_destroy(pthread_mutex_t *mutex)
{
if (mutex == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
free(*mutex);
*mutex = NULL;
return OK;
@@ -705,29 +705,29 @@
int pthread_mutex_setprioceiling(pthread_mutex_t *mutex, int prioceiling, int *old_ceiling)
{
if (mutex == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (*mutex == PTHREAD_MUTEX_INITIALIZER)
if (pthread_mutex_init(mutex, NULL) != OK)
return errno;
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
int pthread_mutex_getprioceiling(pthread_mutex_t *mutex, int *prioceiling)
{
if (mutex == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (*mutex == PTHREAD_MUTEX_INITIALIZER)
if (pthread_mutex_init(mutex, NULL) != OK)
return errno;
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
int pthread_mutex_lock(pthread_mutex_t *mutex)
{
if (mutex == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (*mutex == PTHREAD_MUTEX_INITIALIZER)
if (pthread_mutex_init(mutex, NULL) != OK)
return errno;
@@ -739,7 +739,7 @@
int pthread_mutex_trylock(pthread_mutex_t *mutex)
{
if (mutex == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (*mutex == PTHREAD_MUTEX_INITIALIZER)
if (pthread_mutex_init(mutex, NULL) != OK)
return errno;
@@ -751,7 +751,7 @@
int pthread_mutex_unlock(pthread_mutex_t *mutex)
{
if (mutex == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (*mutex == PTHREAD_MUTEX_INITIALIZER)
if (pthread_mutex_init(mutex, NULL) != OK)
return errno;
@@ -768,7 +768,7 @@
{
pthread_initialize();
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* nothing to do for us */
return OK;
}
@@ -776,7 +776,7 @@
int pthread_rwlockattr_destroy(pthread_rwlockattr_t *attr)
{
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* nothing to do for us */
return OK;
}
@@ -784,17 +784,17 @@
int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *attr, int pshared)
{
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *attr, int *pshared)
{
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
/*
@@ -807,7 +807,7 @@
pthread_initialize();
if (rwlock == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if ((rw = (pth_rwlock_t *)malloc(sizeof(pth_rwlock_t))) == NULL)
return errno;
if (!pth_rwlock_init(rw))
@@ -819,7 +819,7 @@
int pthread_rwlock_destroy(pthread_rwlock_t *rwlock)
{
if (rwlock == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
free(*rwlock);
*rwlock = NULL;
return OK;
@@ -828,7 +828,7 @@
int pthread_rwlock_rdlock(pthread_rwlock_t *rwlock)
{
if (rwlock == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
if (pthread_rwlock_init(rwlock, NULL) != OK)
return errno;
@@ -840,7 +840,7 @@
int pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock)
{
if (rwlock == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
if (pthread_rwlock_init(rwlock, NULL) != OK)
return errno;
@@ -852,7 +852,7 @@
int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock)
{
if (rwlock == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
if (pthread_rwlock_init(rwlock, NULL) != OK)
return errno;
@@ -864,7 +864,7 @@
int pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock)
{
if (rwlock == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
if (pthread_rwlock_init(rwlock, NULL) != OK)
return errno;
@@ -876,7 +876,7 @@
int pthread_rwlock_unlock(pthread_rwlock_t *rwlock)
{
if (rwlock == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (*rwlock == PTHREAD_RWLOCK_INITIALIZER)
if (pthread_rwlock_init(rwlock, NULL) != OK)
return errno;
@@ -893,7 +893,7 @@
{
pthread_initialize();
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* nothing to do for us */
return OK;
}
@@ -901,7 +901,7 @@
int pthread_condattr_destroy(pthread_condattr_t *attr)
{
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* nothing to do for us */
return OK;
}
@@ -909,17 +909,17 @@
int pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared)
{
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
int pthread_condattr_getpshared(pthread_condattr_t *attr, int *pshared)
{
if (attr == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
/* not supported */
- return_errno(ENOSYS, ENOSYS);
+ return pth_error(ENOSYS, ENOSYS);
}
/*
@@ -932,7 +932,7 @@
pthread_initialize();
if (cond == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if ((cn = (pth_cond_t *)malloc(sizeof(pth_cond_t))) == NULL)
return errno;
if (!pth_cond_init(cn))
@@ -944,7 +944,7 @@
int pthread_cond_destroy(pthread_cond_t *cond)
{
if (cond == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
free(*cond);
*cond = NULL;
return OK;
@@ -953,7 +953,7 @@
int pthread_cond_broadcast(pthread_cond_t *cond)
{
if (cond == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (*cond == PTHREAD_COND_INITIALIZER)
if (pthread_cond_init(cond, NULL) != OK)
return errno;
@@ -965,7 +965,7 @@
int pthread_cond_signal(pthread_cond_t *cond)
{
if (cond == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (*cond == PTHREAD_COND_INITIALIZER)
if (pthread_cond_init(cond, NULL) != OK)
return errno;
@@ -977,7 +977,7 @@
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
{
if (cond == NULL || mutex == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (*cond == PTHREAD_COND_INITIALIZER)
if (pthread_cond_init(cond, NULL) != OK)
return errno;
@@ -996,13 +996,13 @@
static pth_key_t ev_key = PTH_KEY_INIT;
if (cond == NULL || mutex == NULL || abstime == NULL)
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
#ifdef __amigaos__
if (abstime->ts_sec < 0 || abstime->ts_nsec < 0 || abstime->ts_nsec >= 1000000000)
#else
if (abstime->tv_sec < 0 || abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
#endif
- return_errno(EINVAL, EINVAL);
+ return pth_error(EINVAL, EINVAL);
if (*cond == PTHREAD_COND_INITIALIZER)
if (pthread_cond_init(cond, NULL) != OK)
return errno;
|