Add restrict qualifiers to <pthread.h> function arguments.

This commit is contained in:
kleink 2005-03-21 17:55:07 +00:00
parent d1c67e4716
commit 9cf9c2316b
12 changed files with 81 additions and 65 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pthread.h,v 1.20 2004/12/29 00:59:57 nathanw Exp $ */
/* $NetBSD: pthread.h,v 1.21 2005/03/21 17:55:07 kleink Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -48,8 +48,9 @@
__BEGIN_DECLS
int pthread_atfork(void (*)(void), void (*)(void), void (*)(void));
int pthread_create(pthread_t *, const pthread_attr_t *,
void *(*)(void *), void *);
int pthread_create(pthread_t * __restrict,
const pthread_attr_t * __restrict, void *(*)(void *),
void * __restrict);
void pthread_exit(void *) __attribute__((__noreturn__));
int pthread_join(pthread_t, void **);
int pthread_equal(pthread_t, pthread_t);
@ -62,23 +63,30 @@ int pthread_setrrtimer_np(int);
int pthread_attr_init(pthread_attr_t *);
int pthread_attr_destroy(pthread_attr_t *);
int pthread_attr_get_np(pthread_t, pthread_attr_t *);
int pthread_attr_getguardsize(const pthread_attr_t *, size_t *);
int pthread_attr_getguardsize(const pthread_attr_t * __restrict,
size_t * __restrict);
int pthread_attr_setguardsize(pthread_attr_t *, size_t);
int pthread_attr_getinheritsched(const pthread_attr_t *, int *);
int pthread_attr_getinheritsched(const pthread_attr_t * __restrict,
int * __restrict);
int pthread_attr_setinheritsched(pthread_attr_t *, int);
int pthread_attr_getschedparam(const pthread_attr_t *,
struct sched_param *);
int pthread_attr_setschedparam(pthread_attr_t *,
const struct sched_param *);
int pthread_attr_getschedpolicy(const pthread_attr_t *, int *);
int pthread_attr_getschedparam(const pthread_attr_t * __restrict,
struct sched_param * __restrict);
int pthread_attr_setschedparam(pthread_attr_t * __restrict,
const struct sched_param * __restrict);
int pthread_attr_getschedpolicy(const pthread_attr_t * __restrict,
int * __restrict);
int pthread_attr_setschedpolicy(pthread_attr_t *, int);
int pthread_attr_getscope(const pthread_attr_t *, int *);
int pthread_attr_getscope(const pthread_attr_t * __restrict,
int * __restrict);
int pthread_attr_setscope(pthread_attr_t *, int);
int pthread_attr_getstack(const pthread_attr_t *, void **, size_t *);
int pthread_attr_getstack(const pthread_attr_t * __restrict,
void ** __restrict, size_t * __restrict);
int pthread_attr_setstack(pthread_attr_t *, void *, size_t);
int pthread_attr_getstacksize(const pthread_attr_t *, size_t *);
int pthread_attr_getstacksize(const pthread_attr_t * __restrict,
size_t * __restrict);
int pthread_attr_setstacksize(pthread_attr_t *, size_t);
int pthread_attr_getstackaddr(const pthread_attr_t *, void **);
int pthread_attr_getstackaddr(const pthread_attr_t * __restrict,
void ** __restrict);
int pthread_attr_setstackaddr(pthread_attr_t *, void *);
int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
int pthread_attr_setdetachstate(pthread_attr_t *, int);
@ -86,21 +94,25 @@ int pthread_attr_getname_np(const pthread_attr_t *, char *,
size_t, void **);
int pthread_attr_setname_np(pthread_attr_t *, const char *, void *);
int pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *);
int pthread_mutex_init(pthread_mutex_t * __restrict,
const pthread_mutexattr_t * __restrict);
int pthread_mutex_destroy(pthread_mutex_t *);
int pthread_mutex_lock(pthread_mutex_t *);
int pthread_mutex_trylock(pthread_mutex_t *);
int pthread_mutex_unlock(pthread_mutex_t *);
int pthread_mutexattr_init(pthread_mutexattr_t *);
int pthread_mutexattr_destroy(pthread_mutexattr_t *);
int pthread_mutexattr_gettype(const pthread_mutexattr_t *, int *);
int pthread_mutexattr_gettype(const pthread_mutexattr_t * __restrict,
int * __restrict);
int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int);
int pthread_cond_init(pthread_cond_t *, const pthread_condattr_t *);
int pthread_cond_init(pthread_cond_t * __restrict,
const pthread_condattr_t * __restrict);
int pthread_cond_destroy(pthread_cond_t *);
int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *);
int pthread_cond_timedwait(pthread_cond_t *, pthread_mutex_t *,
const struct timespec *);
int pthread_cond_wait(pthread_cond_t * __restrict,
pthread_mutex_t * __restrict);
int pthread_cond_timedwait(pthread_cond_t * __restrict,
pthread_mutex_t * __restrict, const struct timespec * __restrict);
int pthread_cond_signal(pthread_cond_t *);
int pthread_cond_broadcast(pthread_cond_t *);
int pthread_condattr_init(pthread_condattr_t *);
@ -147,29 +159,30 @@ int pthread_spin_lock(pthread_spinlock_t *);
int pthread_spin_trylock(pthread_spinlock_t *);
int pthread_spin_unlock(pthread_spinlock_t *);
int pthread_rwlock_init(pthread_rwlock_t *,
const pthread_rwlockattr_t *);
int pthread_rwlock_init(pthread_rwlock_t * __restrict,
const pthread_rwlockattr_t * __restrict);
int pthread_rwlock_destroy(pthread_rwlock_t *);
int pthread_rwlock_rdlock(pthread_rwlock_t *);
int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
int pthread_rwlock_wrlock(pthread_rwlock_t *);
int pthread_rwlock_trywrlock(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_timedrdlock(pthread_rwlock_t * __restrict,
const struct timespec * __restrict);
int pthread_rwlock_timedwrlock(pthread_rwlock_t * __restrict,
const struct timespec * __restrict);
int pthread_rwlock_unlock(pthread_rwlock_t *);
int pthread_rwlockattr_init(pthread_rwlockattr_t *);
int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
int pthread_barrier_init(pthread_barrier_t *,
const pthread_barrierattr_t *, unsigned int);
int pthread_barrier_init(pthread_barrier_t * __restrict,
const pthread_barrierattr_t * __restrict, unsigned int);
int pthread_barrier_wait(pthread_barrier_t *);
int pthread_barrier_destroy(pthread_barrier_t *);
int pthread_barrierattr_init(pthread_barrierattr_t *);
int pthread_barrierattr_destroy(pthread_barrierattr_t *);
int pthread_getschedparam(pthread_t, int *, struct sched_param *);
int pthread_getschedparam(pthread_t, int * __restrict,
struct sched_param * __restrict);
int pthread_setschedparam(pthread_t, int, const struct sched_param *);
int *pthread__errno(void);
@ -257,7 +270,7 @@ __END_DECLS
#ifndef __LIBPTHREAD_SOURCE__
__BEGIN_DECLS
int __libc_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *);
int __libc_mutex_init(pthread_mutex_t * __restrict, const pthread_mutexattr_t * __restrict);
int __libc_mutex_lock(pthread_mutex_t *);
int __libc_mutex_trylock(pthread_mutex_t *);
int __libc_mutex_unlock(pthread_mutex_t *);
@ -279,12 +292,14 @@ __END_DECLS
#define pthread_mutexattr_destroy __libc_mutexattr_destroy
__BEGIN_DECLS
int __libc_cond_init(pthread_cond_t *, const pthread_condattr_t *);
int __libc_cond_init(pthread_cond_t * __restrict,
const pthread_condattr_t * __restrict);
int __libc_cond_signal(pthread_cond_t *);
int __libc_cond_broadcast(pthread_cond_t *);
int __libc_cond_wait(pthread_cond_t *, pthread_mutex_t *);
int __libc_cond_timedwait(pthread_cond_t *, pthread_mutex_t *,
const struct timespec *);
int __libc_cond_wait(pthread_cond_t * __restrict,
pthread_mutex_t * __restrict);
int __libc_cond_timedwait(pthread_cond_t * __restrict,
pthread_mutex_t * __restrict, const struct timespec * __restrict);
int __libc_cond_destroy(pthread_cond_t *);
__END_DECLS
@ -296,7 +311,8 @@ __END_DECLS
#define pthread_cond_destroy __libc_cond_destroy
__BEGIN_DECLS
int __libc_rwlock_init(pthread_rwlock_t *, const pthread_rwlockattr_t *);
int __libc_rwlock_init(pthread_rwlock_t * __restrict,
const pthread_rwlockattr_t * __restrict);
int __libc_rwlock_rdlock(pthread_rwlock_t *);
int __libc_rwlock_wrlock(pthread_rwlock_t *);
int __libc_rwlock_tryrdlock(pthread_rwlock_t *);

View File

@ -1,4 +1,4 @@
.\" $NetBSD: pthread_attr.3,v 1.3 2003/06/26 10:01:18 wiz Exp $
.\" $NetBSD: pthread_attr.3,v 1.4 2005/03/21 17:55:07 kleink Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -87,15 +87,15 @@
./" .Ft int
./" .Fn pthread_attr_setstacksize "pthread_attr_t *attr" "size_t stacksize"
./" .Ft int
./" .Fn pthread_attr_getstacksize "const pthread_attr_t *attr" "size_t *stacksize"
./" .Fn pthread_attr_getstacksize "const pthread_attr_t * restrict attr" "size_t * restrict stacksize"
./" .Ft int
./" .Fn pthread_attr_setguardsize "pthread_attr_t *attr" "size_t guardsize"
./" .Ft int
./" .Fn pthread_attr_getguardsize "const pthread_attr_t *attr" "size_t *guardsize"
./" .Fn pthread_attr_getguardsize "const pthread_attr_t * restrict attr" "size_t * restrict guardsize"
./" .Ft int
./" .Fn pthread_attr_setstackaddr "pthread_attr_t *attr" "void *stackaddr"
./" .Ft int
./" .Fn pthread_attr_getstackaddr "const pthread_attr_t *attr" "void **stackaddr"
./" .Fn pthread_attr_getstackaddr "const pthread_attr_t * restrict attr" "void ** restrict stackaddr"
.Ft int
.Fn pthread_attr_setdetachstate "pthread_attr_t *attr" "int detachstate"
.Ft int
@ -103,19 +103,19 @@
./" .Ft int
./" .Fn pthread_attr_setinheritsched "pthread_attr_t *attr" "int inheritsched"
./" .Ft int
./" .Fn pthread_attr_getinheritsched "const pthread_attr_t *attr" "int *inheritsched"
./" .Fn pthread_attr_getinheritsched "const pthread_attr_t * restrict attr" "int * restrict inheritsched"
.Ft int
.Fn pthread_attr_setschedparam "pthread_attr_t *attr" "const struct sched_param *param"
.Fn pthread_attr_setschedparam "pthread_attr_t * restrict attr" "const struct sched_param * restrict param"
.Ft int
.Fn pthread_attr_getschedparam "const pthread_attr_t *attr" "struct sched_param *param"
.Fn pthread_attr_getschedparam "const pthread_attr_t * restrict attr" "struct sched_param * restrict param"
./" .Ft int
./" .Fn pthread_attr_setschedpolicy "pthread_attr_t *attr" "int policy"
./" .Ft int
./" .Fn pthread_attr_getschedpolicy "const pthread_attr_t *attr" "int *policy"
./" .Fn pthread_attr_getschedpolicy "const pthread_attr_t * restrict attr" "int * restrict policy"
./" .Ft int
./" .Fn pthread_attr_setscope "pthread_attr_t *attr" "int contentionscope"
./" .Ft int
./" .Fn pthread_attr_getscope "const pthread_attr_t *attr" "int *contentionscope"
./" .Fn pthread_attr_getscope "const pthread_attr_t * restrict attr" "int * restrict contentionscope"
.Sh DESCRIPTION
Thread attributes are used to specify parameters to
.Fn pthread_create .

View File

@ -1,4 +1,4 @@
.\" $NetBSD: pthread_barrier_init.3,v 1.5 2003/07/04 08:41:25 wiz Exp $
.\" $NetBSD: pthread_barrier_init.3,v 1.6 2005/03/21 17:55:07 kleink Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -36,7 +36,7 @@
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_barrier_init "pthread_barrier_t *barrier" "const pthread_barrierattr_t *attr" "unsigned int count"
.Fn pthread_barrier_init "pthread_barrier_t * restrict barrier" "const pthread_barrierattr_t * restrict attr" "unsigned int count"
.Sh DESCRIPTION
The
.Fn pthread_barrier_init

View File

@ -1,4 +1,4 @@
.\" $NetBSD: pthread_cond_init.3,v 1.4 2003/07/04 10:18:46 wiz Exp $
.\" $NetBSD: pthread_cond_init.3,v 1.5 2005/03/21 17:55:07 kleink Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -65,7 +65,7 @@
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_cond_init "pthread_cond_t *cond" "const pthread_condattr_t *attr"
.Fn pthread_cond_init "pthread_cond_t * restrict cond" "const pthread_condattr_t * restrict attr"
.Sh DESCRIPTION
The
.Fn pthread_cond_init

View File

@ -1,4 +1,4 @@
.\" $NetBSD: pthread_cond_wait.3,v 1.5 2003/07/04 10:19:42 wiz Exp $
.\" $NetBSD: pthread_cond_wait.3,v 1.6 2005/03/21 17:55:07 kleink Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -66,9 +66,9 @@
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_cond_wait "pthread_cond_t *cond" "pthread_mutex_t *mutex"
.Fn pthread_cond_wait "pthread_cond_t * restrict cond" "pthread_mutex_t * restrict mutex"
.Ft int
.Fn pthread_cond_timedwait "pthread_cond_t *cond" "pthread_mutex_t *mutex" "const struct timespec *abstime"
.Fn pthread_cond_timedwait "pthread_cond_t * restrict cond" "pthread_mutex_t * restrict mutex" "const struct timespec * restrict abstime"
.Sh DESCRIPTION
The
.Fn pthread_cond_wait

View File

@ -1,4 +1,4 @@
.\" $NetBSD: pthread_create.3,v 1.3 2003/07/04 11:48:59 wiz Exp $
.\" $NetBSD: pthread_create.3,v 1.4 2005/03/21 17:55:07 kleink Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -68,7 +68,7 @@
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_create "pthread_t *thread" "const pthread_attr_t *attr" "void *(*start_routine)(void *)" "void *arg"
.Fn pthread_create "pthread_t * restrict thread" "const pthread_attr_t * restrict attr" "void *(*start_routine)(void *)" "void * restrict arg"
.Sh DESCRIPTION
The
.Fn pthread_create

View File

@ -1,4 +1,4 @@
.\" $NetBSD: pthread_mutex_init.3,v 1.2 2003/06/08 06:44:32 thorpej Exp $
.\" $NetBSD: pthread_mutex_init.3,v 1.3 2005/03/21 17:55:07 kleink Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -65,7 +65,7 @@
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_mutex_init "pthread_mutex_t *mutex" "const pthread_mutexattr_t *attr"
.Fn pthread_mutex_init "pthread_mutex_t * restrict mutex" "const pthread_mutexattr_t * restrict attr"
.Sh DESCRIPTION
The
.Fn pthread_mutex_init

View File

@ -1,4 +1,4 @@
.\" $NetBSD: pthread_mutexattr.3,v 1.3 2003/07/04 08:36:06 wiz Exp $
.\" $NetBSD: pthread_mutexattr.3,v 1.4 2005/03/21 17:55:07 kleink Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -85,7 +85,7 @@
.Ft int
.Fn pthread_mutexattr_settype "pthread_mutexattr_t *attr" "int type"
.Ft int
.Fn pthread_mutexattr_gettype "pthread_mutexattr_t *attr" "int *type"
.Fn pthread_mutexattr_gettype "pthread_mutexattr_t * restrict attr" "int * restrict type"
.Sh DESCRIPTION
Mutex attributes are used to specify parameters to
.Fn pthread_mutex_init .

View File

@ -1,4 +1,4 @@
.\" $NetBSD: pthread_rwlock_init.3,v 1.5 2003/07/04 11:55:58 wiz Exp $
.\" $NetBSD: pthread_rwlock_init.3,v 1.6 2005/03/21 17:55:07 kleink Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -62,7 +62,7 @@
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_rwlock_init "pthread_rwlock_t *lock" "const pthread_rwlockattr_t *attr"
.Fn pthread_rwlock_init "pthread_rwlock_t * restrict lock" "const pthread_rwlockattr_t * restrict attr"
.Sh DESCRIPTION
The
.Fn pthread_rwlock_init

View File

@ -1,4 +1,4 @@
.\" $NetBSD: pthread_rwlock_rdlock.3,v 1.7 2003/07/04 11:57:58 wiz Exp $
.\" $NetBSD: pthread_rwlock_rdlock.3,v 1.8 2005/03/21 17:55:07 kleink Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -66,7 +66,7 @@
.Ft int
.Fn pthread_rwlock_rdlock "pthread_rwlock_t *lock"
.Ft int
.Fn pthread_rwlock_timedrdlock "pthread_rwlock_t *lock" "const struct timespec *abstime"
.Fn pthread_rwlock_timedrdlock "pthread_rwlock_t * restrict lock" "const struct timespec * restrict abstime"
.Ft int
.Fn pthread_rwlock_tryrdlock "pthread_rwlock_t *lock"
.Sh DESCRIPTION

View File

@ -1,4 +1,4 @@
.\" $NetBSD: pthread_rwlock_wrlock.3,v 1.5 2003/07/04 11:59:34 wiz Exp $
.\" $NetBSD: pthread_rwlock_wrlock.3,v 1.6 2005/03/21 17:55:07 kleink Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -66,7 +66,7 @@
.Ft int
.Fn pthread_rwlock_wrlock "pthread_rwlock_t *lock"
.Ft int
.Fn pthread_rwlock_timedwrlock "pthread_rwlock_t *lock" "const struct timespec *abstime"
.Fn pthread_rwlock_timedwrlock "pthread_rwlock_t * restrict lock" "const struct timespec * restrict abstime"
.Ft int
.Fn pthread_rwlock_trywrlock "pthread_rwlock_t *lock"
.Sh DESCRIPTION

View File

@ -1,4 +1,4 @@
.\" $NetBSD: pthread_schedparam.3,v 1.3 2003/07/04 08:43:33 wiz Exp $
.\" $NetBSD: pthread_schedparam.3,v 1.4 2005/03/21 17:55:07 kleink Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -67,7 +67,7 @@
.Ft int
.Fn pthread_setschedparam "pthread_t thread" "int policy" "const struct sched_param *param"
.Ft int
.Fn pthread_getschedparam "pthread_t thread" "int *policy" "struct sched_param *param"
.Fn pthread_getschedparam "pthread_t thread" "int * restrict policy" "struct sched_param * restrict param"
.Sh DESCRIPTION
The
.Fn pthread_setschedparam