From d33005aaee6af52c80428b59b52aee522c002492 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Thu, 15 Feb 2018 09:54:34 +0100 Subject: [PATCH] Add missing restrict qualifiers in POSIX function definitions/declarations. This creates no further -Wrestrict warnings with gcc80 in buildworld. --- contrib/tre/lib/regcomp.c | 3 +- contrib/tre/lib/regerror.c | 3 +- contrib/tre/lib/regexec.c | 4 +- include/dirent.h | 3 +- include/netdb.h | 9 +- include/pthread.h | 109 +++++++++++++--------- include/spawn.h | 13 +-- include/string.h | 3 +- include/time.h | 6 +- include/xlocale/_monetary.h | 4 +- include/xlocale/_string.h | 3 +- lib/libc/gen/posix_spawn.c | 14 +-- lib/libc/gen/readdir.c | 3 +- lib/libc/net/getaddrinfo.c | 4 +- lib/libc/net/getnameinfo.c | 5 +- lib/libc/stdtime/asctime.c | 2 +- lib/libc/stdtime/localtime.c | 4 +- lib/libc/string/strtok.c | 3 +- lib/libc/tre-regex/regex.h | 11 ++- lib/libc_r/uthread/uthread_attr_getinheritsched.c | 4 +- lib/libc_r/uthread/uthread_attr_getschedparam.c | 4 +- lib/libc_r/uthread/uthread_attr_getschedpolicy.c | 4 +- lib/libc_r/uthread/uthread_attr_getscope.c | 4 +- lib/libc_r/uthread/uthread_attr_getstacksize.c | 4 +- lib/libc_r/uthread/uthread_attr_setschedparam.c | 4 +- lib/libc_r/uthread/uthread_cond.c | 12 ++- lib/libc_r/uthread/uthread_create.c | 6 +- lib/libc_r/uthread/uthread_getschedparam.c | 5 +- lib/libc_r/uthread/uthread_mattr_kind_np.c | 3 +- lib/libc_r/uthread/uthread_mutex.c | 4 +- lib/libc_r/uthread/uthread_mutex_prioceiling.c | 12 +-- lib/libc_r/uthread/uthread_mutex_protocol.c | 4 +- lib/libc_r/uthread/uthread_rwlock.c | 4 +- lib/libc_r/uthread/uthread_rwlockattr.c | 5 +- lib/libc_r/uthread/uthread_sem.c | 2 +- lib/librt/aio.c | 4 +- lib/libthread_xu/thread/thr_attr.c | 21 +++-- lib/libthread_xu/thread/thr_barrier.c | 4 +- lib/libthread_xu/thread/thr_barrierattr.c | 4 +- lib/libthread_xu/thread/thr_cond.c | 11 ++- lib/libthread_xu/thread/thr_condattr.c | 8 +- lib/libthread_xu/thread/thr_create.c | 5 +- lib/libthread_xu/thread/thr_getschedparam.c | 4 +- lib/libthread_xu/thread/thr_mutex.c | 16 ++-- lib/libthread_xu/thread/thr_mutexattr.c | 13 ++- lib/libthread_xu/thread/thr_rwlock.c | 8 +- lib/libthread_xu/thread/thr_rwlockattr.c | 4 +- sys/sys/aio.h | 3 +- sys/sys/semaphore.h | 2 +- sys/sys/socket.h | 11 ++- sys/sys/stat.h | 6 +- sys/sys/time.h | 5 +- 52 files changed, 234 insertions(+), 182 deletions(-) diff --git a/contrib/tre/lib/regcomp.c b/contrib/tre/lib/regcomp.c index fefd429bcd..1a5eaeda82 100644 --- a/contrib/tre/lib/regcomp.c +++ b/contrib/tre/lib/regcomp.c @@ -122,7 +122,8 @@ tre_regcomp_l(regex_t *preg, const char *regex, int cflags, locale_t loc) } int -tre_regcomp(regex_t *preg, const char *regex, int cflags) +tre_regcomp(regex_t * __restrict preg, const char * __restrict regex, + int cflags) { return tre_regcomp_l(preg, regex, cflags, __get_locale()); } diff --git a/contrib/tre/lib/regerror.c b/contrib/tre/lib/regerror.c index 298bf46056..55b91ea587 100644 --- a/contrib/tre/lib/regerror.c +++ b/contrib/tre/lib/regerror.c @@ -54,7 +54,8 @@ static const char *tre_error_messages[] = }; size_t -tre_regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size) +tre_regerror(int errcode, const regex_t * __restrict preg, + char * __restrict errbuf, size_t errbuf_size) { const char *err; size_t err_len; diff --git a/contrib/tre/lib/regexec.c b/contrib/tre/lib/regexec.c index 135746c2bc..a65fdb1eda 100644 --- a/contrib/tre/lib/regexec.c +++ b/contrib/tre/lib/regexec.c @@ -339,8 +339,8 @@ tre_regnexec(const regex_t *preg, const char *str, size_t len, } int -tre_regexec(const regex_t *preg, const char *str, - size_t nmatch, regmatch_t pmatch[], int eflags) +tre_regexec(const regex_t * __restrict preg, const char * __restrict str, + size_t nmatch, regmatch_t pmatch[__restrict_arr], int eflags) { return tre_regnexec(preg, str, (size_t)-1, nmatch, pmatch, eflags); } diff --git a/include/dirent.h b/include/dirent.h index b81a869664..e476797272 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -73,7 +73,8 @@ struct dirent * void rewinddir(DIR *); int closedir(DIR *); #if __POSIX_VISIBLE >= 199506 -int readdir_r(DIR *, struct dirent *, struct dirent **); +int readdir_r(DIR * __restrict, struct dirent * __restrict, + struct dirent ** __restrict); #endif #if __POSIX_VISIBLE >= 200809 int alphasort(const struct dirent **, const struct dirent **); diff --git a/include/netdb.h b/include/netdb.h index 76ab263c14..0ac7922978 100644 --- a/include/netdb.h +++ b/include/netdb.h @@ -261,11 +261,12 @@ void sethostent(int); /* void sethostfile(const char *); */ void setnetent(int); void setprotoent(int); -int getaddrinfo(const char *, const char *, - const struct addrinfo *, struct addrinfo **); +int getaddrinfo(const char * __restrict, const char * __restrict, + const struct addrinfo * __restrict, + struct addrinfo ** __restrict); /* XXX nodeLen and serviceLen should be socklen_t */ -int getnameinfo(const struct sockaddr *, socklen_t, char *, - size_t, char *, size_t, int); +int getnameinfo(const struct sockaddr * __restrict, socklen_t, + char * __restrict, size_t, char * __restrict, size_t, int); void freeaddrinfo(struct addrinfo *); const char *gai_strerror(int); void setservent(int); diff --git a/include/pthread.h b/include/pthread.h index dba7b30304..118b5d226e 100644 --- a/include/pthread.h +++ b/include/pthread.h @@ -139,10 +139,11 @@ __BEGIN_DECLS int pthread_atfork(void (*)(void), void (*)(void), void (*)(void)); int pthread_attr_destroy(pthread_attr_t *); int pthread_attr_getguardsize(const pthread_attr_t * __restrict, - size_t *); + size_t * __restrict); int pthread_attr_getstack(const pthread_attr_t * __restrict, void ** __restrict, size_t * __restrict); -int pthread_attr_getstacksize(const pthread_attr_t *, size_t *); +int pthread_attr_getstacksize(const pthread_attr_t * __restrict, + size_t * __restrict); #if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE < 200809) int pthread_attr_getstackaddr(const pthread_attr_t *, void **); #endif @@ -157,11 +158,12 @@ int pthread_attr_setstack(pthread_attr_t *, void *, size_t); int pthread_attr_setdetachstate(pthread_attr_t *, int); int pthread_barrier_destroy(pthread_barrier_t *); -int pthread_barrier_init(pthread_barrier_t *, - const pthread_barrierattr_t *, unsigned); +int pthread_barrier_init(pthread_barrier_t * __restrict, + const pthread_barrierattr_t * __restrict, unsigned); int pthread_barrier_wait(pthread_barrier_t *); int pthread_barrierattr_destroy(pthread_barrierattr_t *); -int pthread_barrierattr_getpshared(const pthread_barrierattr_t *, int *); +int pthread_barrierattr_getpshared(const pthread_barrierattr_t * __restrict, + int * __restrict); int pthread_barrierattr_init(pthread_barrierattr_t *); int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int); @@ -169,25 +171,28 @@ void pthread_cleanup_pop(int); void pthread_cleanup_push(void (*) (void *), void *); int pthread_condattr_destroy(pthread_condattr_t *); -int pthread_condattr_getclock(const pthread_condattr_t *, clockid_t *) - __nonnull(2); -int pthread_condattr_getpshared(const pthread_condattr_t *, int *) - __nonnull(2); +int pthread_condattr_getclock(const pthread_condattr_t * __restrict, + clockid_t * __restrict) __nonnull(2); +int pthread_condattr_getpshared(const pthread_condattr_t * __restrict, + int * __restrict) __nonnull(2); int pthread_condattr_init(pthread_condattr_t *) __nonnull(1); int pthread_condattr_setclock(pthread_condattr_t *, clockid_t); int pthread_condattr_setpshared(pthread_condattr_t *, int); int pthread_cond_broadcast(pthread_cond_t *) __nonnull(1); int pthread_cond_destroy(pthread_cond_t *); -int pthread_cond_init(pthread_cond_t *, const pthread_condattr_t *) - __nonnull(1); +int pthread_cond_init(pthread_cond_t * __restrict, + const pthread_condattr_t * __restrict) __nonnull(1); int pthread_cond_signal(pthread_cond_t *) __nonnull(1); -int pthread_cond_timedwait(pthread_cond_t *, pthread_mutex_t *, - const struct timespec *) __nonnull(2); -int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *) __nonnull(1, 2); - -int pthread_create(pthread_t *, const pthread_attr_t *, - void *(*) (void *), void *) __nonnull(1, 3); +int pthread_cond_timedwait(pthread_cond_t * __restrict, + pthread_mutex_t * __restrict, const struct timespec * __restrict) + __nonnull(2); +int pthread_cond_wait(pthread_cond_t * __restrict, + pthread_mutex_t * __restrict) __nonnull(1, 2); + +int pthread_create(pthread_t * __restrict, + const pthread_attr_t * __restrict, void *(*) (void *), + void * __restrict) __nonnull(1, 3); int pthread_detach(pthread_t); int pthread_equal(pthread_t, pthread_t); void pthread_exit(void *) __dead2; @@ -199,37 +204,39 @@ int pthread_key_delete(pthread_key_t); int pthread_mutexattr_init(pthread_mutexattr_t *) __nonnull(1); int pthread_mutexattr_destroy(pthread_mutexattr_t *); -int pthread_mutexattr_getpshared(const pthread_mutexattr_t *, int *) - __nonnull(2); -int pthread_mutexattr_gettype(pthread_mutexattr_t *, int *) __nonnull(2); +int pthread_mutexattr_getpshared(const pthread_mutexattr_t * __restrict, + int * __restrict) __nonnull(2); +int pthread_mutexattr_gettype(pthread_mutexattr_t * __restrict, + int * __restrict) __nonnull(2); int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int); int pthread_mutexattr_settype(pthread_mutexattr_t *, int); int pthread_mutex_destroy(pthread_mutex_t *); -int pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *) - __nonnull(1); +int pthread_mutex_init(pthread_mutex_t * __restrict, + const pthread_mutexattr_t * __restrict) __nonnull(1); int pthread_mutex_lock(pthread_mutex_t *); -int pthread_mutex_timedlock(pthread_mutex_t *, const struct timespec *); +int pthread_mutex_timedlock(pthread_mutex_t * __restrict, + const struct timespec * __restrict); int pthread_mutex_trylock(pthread_mutex_t *) __nonnull(1); int pthread_mutex_unlock(pthread_mutex_t *); int pthread_once(pthread_once_t *, void (*) (void)) __nonnull(1); int pthread_rwlock_destroy(pthread_rwlock_t *); -int pthread_rwlock_init(pthread_rwlock_t *, const pthread_rwlockattr_t *) - __nonnull(1); +int pthread_rwlock_init(pthread_rwlock_t * __restrict, + const pthread_rwlockattr_t * __restrict) __nonnull(1); int pthread_rwlock_rdlock(pthread_rwlock_t *) __nonnull(1); -int pthread_rwlock_timedrdlock(pthread_rwlock_t *, const struct timespec *) - __nonnull(1, 2); -int pthread_rwlock_timedwrlock(pthread_rwlock_t *, const struct timespec *) - __nonnull(1, 2); +int pthread_rwlock_timedrdlock(pthread_rwlock_t * __restrict, + const struct timespec * __restrict) __nonnull(1, 2); +int pthread_rwlock_timedwrlock(pthread_rwlock_t * __restrict, + const struct timespec * __restrict) __nonnull(1, 2); int pthread_rwlock_tryrdlock(pthread_rwlock_t *); int pthread_rwlock_trywrlock(pthread_rwlock_t *); int pthread_rwlock_unlock(pthread_rwlock_t *); int pthread_rwlock_wrlock(pthread_rwlock_t *) __nonnull(1); int pthread_rwlockattr_destroy(pthread_rwlockattr_t *); -int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *, int *) - __nonnull(1, 2); +int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t * __restrict, + int * __restrict) __nonnull(1, 2); int pthread_rwlockattr_init(pthread_rwlockattr_t *); int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int) __nonnull(1); @@ -253,24 +260,34 @@ int pthread_setprio(pthread_t, int); void pthread_yield(void); #endif -int pthread_mutexattr_getprioceiling(pthread_mutexattr_t *, int *); +int pthread_mutexattr_getprioceiling(pthread_mutexattr_t * __restrict, + int * __restrict); int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int); -int pthread_mutexattr_getprotocol(pthread_mutexattr_t *, int *); +int pthread_mutexattr_getprotocol(pthread_mutexattr_t * __restrict, + int * __restrict); int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int); -int pthread_mutex_getprioceiling(pthread_mutex_t *, int *); -int pthread_mutex_setprioceiling(pthread_mutex_t *, int, 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_mutex_getprioceiling(pthread_mutex_t * __restrict, + int * __restrict); +int pthread_mutex_setprioceiling(pthread_mutex_t * __restrict, int, + int * __restrict); + +int pthread_attr_getinheritsched(const pthread_attr_t * __restict, + int * __restrict); +int pthread_attr_getschedparam(const pthread_attr_t * __restrict, + struct sched_param * __restrict); +int pthread_attr_getschedpolicy(const pthread_attr_t * __restrict, + int * __restrict); +int pthread_attr_getscope(const pthread_attr_t * __restrict, + int * __restrict); int pthread_attr_setinheritsched(pthread_attr_t *, int); -int pthread_attr_setschedparam(pthread_attr_t *, const struct sched_param *); +int pthread_attr_setschedparam(pthread_attr_t * __restrict, + const struct sched_param * __restrict); int pthread_attr_setschedpolicy(pthread_attr_t *, int); int pthread_attr_setscope(pthread_attr_t *, int); -int pthread_getschedparam(pthread_t pthread, 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 *) __nonnull(3); #if __XSI_VISIBLE @@ -279,4 +296,12 @@ int pthread_setconcurrency(int); #endif __END_DECLS +#if 0 +int pthread_mutex_consistent(pthread_mutex_t *); +int pthread_mutexattr_getrobust(const pthread_mutexattr_t * __restrict, + int * __restrict); +int pthread_mutexattr_setrobust(pthread_mutexattr_t *, int); +int pthread_setschedprio(pthread_t, int); +#endif + #endif diff --git a/include/spawn.h b/include/spawn.h index 02c75644d4..38c785d430 100644 --- a/include/spawn.h +++ b/include/spawn.h @@ -58,18 +58,15 @@ typedef struct __posix_spawn_file_actions *posix_spawn_file_actions_t; __BEGIN_DECLS /* * Spawn routines - * - * XXX both arrays should be __restrict, but this does not work when GCC - * is invoked with -std=c99. */ int posix_spawn(pid_t * __restrict, const char * __restrict, const posix_spawn_file_actions_t *, - const posix_spawnattr_t * __restrict, char * const [], - char * const []); + const posix_spawnattr_t * __restrict, + char * const [__restrict_arr], char * const [__restrict_arr]); int posix_spawnp(pid_t * __restrict, const char * __restrict, const posix_spawn_file_actions_t *, - const posix_spawnattr_t * __restrict, char * const [], - char * const []); + const posix_spawnattr_t * __restrict, + char * const [__restrict_arr], char * const [__restrict_arr]); /* * File descriptor actions @@ -99,7 +96,7 @@ int posix_spawnattr_getschedpolicy(const posix_spawnattr_t * __restrict, int posix_spawnattr_getsigdefault(const posix_spawnattr_t * __restrict, sigset_t * __restrict); int posix_spawnattr_getsigmask(const posix_spawnattr_t * __restrict, - sigset_t * __restrict sigmask); + sigset_t * __restrict); int posix_spawnattr_setflags(posix_spawnattr_t *, short); int posix_spawnattr_setpgroup(posix_spawnattr_t *, pid_t); diff --git a/include/string.h b/include/string.h index 29b5f91b50..6539e42a36 100644 --- a/include/string.h +++ b/include/string.h @@ -139,7 +139,8 @@ char *strstr(const char *, const char *) __pure; #endif char *strtok(char * __restrict, const char * __restrict); #if __POSIX_VISIBLE >= 199506 -char *strtok_r(char *, const char *, char **); +char *strtok_r(char * __restrict, const char * __restrict, + char ** __restrict); #endif size_t strxfrm(char * __restrict, const char * __restrict, size_t); #if __BSD_VISIBLE diff --git a/include/time.h b/include/time.h index 63e6ae790f..5f9998154b 100644 --- a/include/time.h +++ b/include/time.h @@ -180,10 +180,10 @@ int nanosleep(const struct timespec *, struct timespec *); #endif /* __POSIX_VISIBLE >= 199309 */ #if __POSIX_VISIBLE >= 199506 -char *asctime_r(const struct tm *, char *); +char *asctime_r(const struct tm * __restrict, char * __restrict); char *ctime_r(const time_t *, char *); -struct tm *gmtime_r(const time_t *, struct tm *); -struct tm *localtime_r(const time_t *, struct tm *); +struct tm *gmtime_r(const time_t * __restrict, struct tm * __restrict); +struct tm *localtime_r(const time_t * __restrict, struct tm * __restrict); #endif #if __POSIX_VISIBLE >= 200112 diff --git a/include/xlocale/_monetary.h b/include/xlocale/_monetary.h index 9af20978d0..d77d09b0c1 100644 --- a/include/xlocale/_monetary.h +++ b/include/xlocale/_monetary.h @@ -38,8 +38,8 @@ typedef struct _xlocale *locale_t; #ifndef _XLOCALE_MONETARY_H #define _XLOCALE_MONETARY_H -ssize_t strfmon_l(char *, size_t, locale_t, const char *, ...) - __strfmonlike(4, 5); +ssize_t strfmon_l(char * __restrict, size_t, locale_t, const char * __restrict, + ...) __strfmonlike(4, 5); #endif /* _XLOCALE_MONETARY_H */ #endif /* __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_) */ diff --git a/include/xlocale/_string.h b/include/xlocale/_string.h index 2362cf59db..fc3aa11c80 100644 --- a/include/xlocale/_string.h +++ b/include/xlocale/_string.h @@ -44,7 +44,8 @@ typedef struct _xlocale *locale_t; * POSIX2008 functions */ int strcoll_l(const char *, const char *, locale_t); -size_t strxfrm_l(char *, const char *, size_t, locale_t); +size_t strxfrm_l(char * __restrict, const char * __restrict, size_t, + locale_t); #endif /* _XLOCALE_STRING1_H */ /* diff --git a/lib/libc/gen/posix_spawn.c b/lib/libc/gen/posix_spawn.c index 5dd704f798..99e36af7b4 100644 --- a/lib/libc/gen/posix_spawn.c +++ b/lib/libc/gen/posix_spawn.c @@ -225,17 +225,19 @@ do_posix_spawn(pid_t *pid, const char *path, } int -posix_spawn(pid_t *pid, const char *path, const posix_spawn_file_actions_t *fa, - const posix_spawnattr_t *sa, char * const argv[], - char * const envp[]) +posix_spawn(pid_t * __restrict pid, const char * __restrict path, + const posix_spawn_file_actions_t *fa, + const posix_spawnattr_t * __restrict sa, char * const argv[__restrict_arr], + char * const envp[__restrict_arr]) { return do_posix_spawn(pid, path, fa, sa, argv, envp, 0); } int -posix_spawnp(pid_t *pid, const char *path, const posix_spawn_file_actions_t *fa, - const posix_spawnattr_t *sa, char * const argv[], - char * const envp[]) +posix_spawnp(pid_t * __restrict pid, const char * __restrict path, + const posix_spawn_file_actions_t *fa, + const posix_spawnattr_t * __restrict sa, char * const argv[__restrict_arr], + char * const envp[__restrict_arr]) { return do_posix_spawn(pid, path, fa, sa, argv, envp, 1); } diff --git a/lib/libc/gen/readdir.c b/lib/libc/gen/readdir.c index b8f9dba19e..f705ca89ec 100644 --- a/lib/libc/gen/readdir.c +++ b/lib/libc/gen/readdir.c @@ -96,7 +96,8 @@ readdir(DIR *dirp) } int -readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) +readdir_r(DIR * __restrict dirp, struct dirent * __restrict entry, + struct dirent ** __restrict result) { struct dirent *dp; int saved_errno; diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c index 8f6be31efb..227d2cee8d 100644 --- a/lib/libc/net/getaddrinfo.c +++ b/lib/libc/net/getaddrinfo.c @@ -350,8 +350,8 @@ str2number(const char *p, int *portp) } int -getaddrinfo(const char *hostname, const char *servname, - const struct addrinfo *hints, struct addrinfo **res) +getaddrinfo(const char * __restrict hostname, const char * __restrict servname, + const struct addrinfo * __restrict hints, struct addrinfo ** __restrict res) { struct addrinfo sentinel; struct addrinfo *cur; diff --git a/lib/libc/net/getnameinfo.c b/lib/libc/net/getnameinfo.c index 76a7b1f6ad..1c265a62dc 100644 --- a/lib/libc/net/getnameinfo.c +++ b/lib/libc/net/getnameinfo.c @@ -71,8 +71,9 @@ static int getnameinfo_link(const struct sockaddr *, socklen_t, char *, static int hexname(const u_int8_t *, size_t, char *, size_t); int -getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, - size_t hostlen, char *serv, size_t servlen, int flags) +getnameinfo(const struct sockaddr * __restrict sa, socklen_t salen, + char * __restrict host, size_t hostlen, char * __restrict serv, + size_t servlen, int flags) { switch (sa->sa_family) { diff --git a/lib/libc/stdtime/asctime.c b/lib/libc/stdtime/asctime.c index 973ec819a1..3e7df01a61 100644 --- a/lib/libc/stdtime/asctime.c +++ b/lib/libc/stdtime/asctime.c @@ -72,7 +72,7 @@ static char buf_asctime[MAX_ASCTIME_BUF_SIZE]; */ char * -asctime_r(const struct tm *timeptr, char *buf) +asctime_r(const struct tm * __restrict timeptr, char * __restrict buf) { static const char wday_name[][3] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" diff --git a/lib/libc/stdtime/localtime.c b/lib/libc/stdtime/localtime.c index 34ade3aba5..ace0935a0c 100644 --- a/lib/libc/stdtime/localtime.c +++ b/lib/libc/stdtime/localtime.c @@ -1391,7 +1391,7 @@ localtime(const time_t * const timep) */ struct tm * -localtime_r(const time_t * const timep, struct tm *tmp) +localtime_r(const time_t * __restrict const timep, struct tm * __restrict tmp) { _RWLOCK_RDLOCK(&lcl_rwlock); tzset_basic(1); @@ -1471,7 +1471,7 @@ gmtime(const time_t * const timep) */ struct tm * -gmtime_r(const time_t * timep, struct tm * tmp) +gmtime_r(const time_t * __restrict timep, struct tm * __restrict tmp) { return gmtsub(timep, 0L, tmp); } diff --git a/lib/libc/string/strtok.c b/lib/libc/string/strtok.c index 2358dc312b..ed7eeefe2e 100644 --- a/lib/libc/string/strtok.c +++ b/lib/libc/string/strtok.c @@ -44,7 +44,8 @@ char *__strtok_r(char *, const char *, char **); char * -__strtok_r(char *s, const char *delim, char **last) +__strtok_r(char * __restrict s, const char * __restrict delim, + char ** __restrict last) { char *spanp, *tok; int c, sc; diff --git a/lib/libc/tre-regex/regex.h b/lib/libc/tre-regex/regex.h index b3843a393e..ecb0dbf888 100644 --- a/lib/libc/tre-regex/regex.h +++ b/lib/libc/tre-regex/regex.h @@ -164,15 +164,16 @@ __BEGIN_DECLS /* The POSIX.2 regexp functions */ int -tre_regcomp(regex_t *preg, const char *regex, int cflags); +tre_regcomp(regex_t * __restrict preg, const char * __restrict regex, + int cflags); int -tre_regexec(const regex_t *preg, const char *string, size_t nmatch, - regmatch_t pmatch[], int eflags); +tre_regexec(const regex_t * __restrict preg, const char * __restrict string, + size_t nmatch, regmatch_t pmatch[__restrict_arr], int eflags); size_t -tre_regerror(int errcode, const regex_t *preg, char *errbuf, - size_t errbuf_size); +tre_regerror(int errcode, const regex_t * __restrict preg, + char * __restrict errbuf, size_t errbuf_size); void tre_regfree(regex_t *preg); diff --git a/lib/libc_r/uthread/uthread_attr_getinheritsched.c b/lib/libc_r/uthread/uthread_attr_getinheritsched.c index e7ca124514..98243595bc 100644 --- a/lib/libc_r/uthread/uthread_attr_getinheritsched.c +++ b/lib/libc_r/uthread/uthread_attr_getinheritsched.c @@ -30,14 +30,14 @@ * SUCH DAMAGE. * * $FreeBSD: src/lib/libc_r/uthread/uthread_attr_getinheritsched.c,v 1.4.2.1 2002/10/22 14:44:02 fjoe Exp $ - * $DragonFly: src/lib/libc_r/uthread/uthread_attr_getinheritsched.c,v 1.3 2005/05/30 20:50:53 joerg Exp $ */ #include #include #include "pthread_private.h" int -_pthread_attr_getinheritsched(const pthread_attr_t *attr, int *sched_inherit) +_pthread_attr_getinheritsched(const pthread_attr_t * __restrict attr, + int * __restrict sched_inherit) { int ret = 0; diff --git a/lib/libc_r/uthread/uthread_attr_getschedparam.c b/lib/libc_r/uthread/uthread_attr_getschedparam.c index 201a3ac317..5f764a12b7 100644 --- a/lib/libc_r/uthread/uthread_attr_getschedparam.c +++ b/lib/libc_r/uthread/uthread_attr_getschedparam.c @@ -30,14 +30,14 @@ * SUCH DAMAGE. * * $FreeBSD: src/lib/libc_r/uthread/uthread_attr_getschedparam.c,v 1.4.2.1 2002/10/22 14:44:02 fjoe Exp $ - * $DragonFly: src/lib/libc_r/uthread/uthread_attr_getschedparam.c,v 1.3 2005/05/30 20:50:53 joerg Exp $ */ #include #include #include "pthread_private.h" int -_pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *param) +_pthread_attr_getschedparam(const pthread_attr_t * __restrict attr, + struct sched_param * __restrict param) { int ret = 0; diff --git a/lib/libc_r/uthread/uthread_attr_getschedpolicy.c b/lib/libc_r/uthread/uthread_attr_getschedpolicy.c index f0d0e81cc0..df7340454e 100644 --- a/lib/libc_r/uthread/uthread_attr_getschedpolicy.c +++ b/lib/libc_r/uthread/uthread_attr_getschedpolicy.c @@ -30,14 +30,14 @@ * SUCH DAMAGE. * * $FreeBSD: src/lib/libc_r/uthread/uthread_attr_getschedpolicy.c,v 1.4.2.1 2002/10/22 14:44:02 fjoe Exp $ - * $DragonFly: src/lib/libc_r/uthread/uthread_attr_getschedpolicy.c,v 1.3 2005/05/30 20:50:53 joerg Exp $ */ #include #include #include "pthread_private.h" int -_pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy) +_pthread_attr_getschedpolicy(const pthread_attr_t * __restrict attr, + int * __restrict policy) { int ret = 0; diff --git a/lib/libc_r/uthread/uthread_attr_getscope.c b/lib/libc_r/uthread/uthread_attr_getscope.c index b2d2af1333..1eafafb756 100644 --- a/lib/libc_r/uthread/uthread_attr_getscope.c +++ b/lib/libc_r/uthread/uthread_attr_getscope.c @@ -30,14 +30,14 @@ * SUCH DAMAGE. * * $FreeBSD: src/lib/libc_r/uthread/uthread_attr_getscope.c,v 1.4.2.1 2002/10/22 14:44:02 fjoe Exp $ - * $DragonFly: src/lib/libc_r/uthread/uthread_attr_getscope.c,v 1.3 2005/05/30 20:50:53 joerg Exp $ */ #include #include #include "pthread_private.h" int -_pthread_attr_getscope(const pthread_attr_t *attr, int *contentionscope) +_pthread_attr_getscope(const pthread_attr_t * __restrict attr, + int * __restrict contentionscope) { int ret = 0; diff --git a/lib/libc_r/uthread/uthread_attr_getstacksize.c b/lib/libc_r/uthread/uthread_attr_getstacksize.c index 2bd05eae63..2b1693584c 100644 --- a/lib/libc_r/uthread/uthread_attr_getstacksize.c +++ b/lib/libc_r/uthread/uthread_attr_getstacksize.c @@ -30,14 +30,14 @@ * SUCH DAMAGE. * * $FreeBSD: src/lib/libc_r/uthread/uthread_attr_getstacksize.c,v 1.3.2.2 2002/10/22 14:44:02 fjoe Exp $ - * $DragonFly: src/lib/libc_r/uthread/uthread_attr_getstacksize.c,v 1.3 2005/05/30 20:50:53 joerg Exp $ */ #include #include #include "pthread_private.h" int -_pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize) +_pthread_attr_getstacksize(const pthread_attr_t * __restrict attr, + size_t * __restrict stacksize) { int ret; diff --git a/lib/libc_r/uthread/uthread_attr_setschedparam.c b/lib/libc_r/uthread/uthread_attr_setschedparam.c index 212c7c68d1..e5382f28ed 100644 --- a/lib/libc_r/uthread/uthread_attr_setschedparam.c +++ b/lib/libc_r/uthread/uthread_attr_setschedparam.c @@ -30,14 +30,14 @@ * SUCH DAMAGE. * * $FreeBSD: src/lib/libc_r/uthread/uthread_attr_setschedparam.c,v 1.4.2.3 2002/10/22 14:44:02 fjoe Exp $ - * $DragonFly: src/lib/libc_r/uthread/uthread_attr_setschedparam.c,v 1.3 2005/05/30 20:50:53 joerg Exp $ */ #include #include #include "pthread_private.h" int -_pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param) +_pthread_attr_setschedparam(pthread_attr_t * __restrict attr, + const struct sched_param * __restrict param) { int ret = 0; diff --git a/lib/libc_r/uthread/uthread_cond.c b/lib/libc_r/uthread/uthread_cond.c index 07732e16cf..2c778c198c 100644 --- a/lib/libc_r/uthread/uthread_cond.c +++ b/lib/libc_r/uthread/uthread_cond.c @@ -30,7 +30,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/lib/libc_r/uthread/uthread_cond.c,v 1.22.2.8 2002/10/22 14:44:02 fjoe Exp $ - * $DragonFly: src/lib/libc_r/uthread/uthread_cond.c,v 1.3 2005/05/30 20:50:53 joerg Exp $ */ #include #include @@ -71,7 +70,8 @@ _cond_reinit(pthread_cond_t *cond) } int -_pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *cond_attr) +_pthread_cond_init(pthread_cond_t * __restrict cond, + const pthread_condattr_t * __restrict cond_attr) { enum pthread_cond_type type; pthread_cond_t pcond; @@ -158,7 +158,8 @@ _pthread_cond_destroy(pthread_cond_t *cond) } int -_pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) +_pthread_cond_wait(pthread_cond_t * __restrict cond, + pthread_mutex_t * __restrict mutex) { struct pthread *curthread = _get_curthread(); int rval = 0; @@ -317,8 +318,9 @@ _pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) } int -_pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * mutex, - const struct timespec * abstime) +_pthread_cond_timedwait(pthread_cond_t * __restrict cond, + pthread_mutex_t * __restrict mutex, + const struct timespec * __restrict abstime) { struct pthread *curthread = _get_curthread(); int rval = 0; diff --git a/lib/libc_r/uthread/uthread_create.c b/lib/libc_r/uthread/uthread_create.c index 26537604b1..45c747f259 100644 --- a/lib/libc_r/uthread/uthread_create.c +++ b/lib/libc_r/uthread/uthread_create.c @@ -30,7 +30,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/lib/libc_r/uthread/uthread_create.c,v 1.24.2.6 2003/01/08 05:04:26 fjoe Exp $ - * $DragonFly: src/lib/libc_r/uthread/uthread_create.c,v 1.6 2005/05/30 20:50:53 joerg Exp $ */ #include #include @@ -60,8 +59,9 @@ int _thread_PS_RUNNING_value = PS_RUNNING; int _thread_PS_DEAD_value = PS_DEAD; int -_pthread_create(pthread_t *thread, const pthread_attr_t *attr, - void *(*start_routine) (void *), void *arg) +_pthread_create(pthread_t * __restrict thread, + const pthread_attr_t * __restrict attr, void *(*start_routine) (void *), + void * __restrict arg) { struct pthread *curthread = _get_curthread(); struct itimerval itimer; diff --git a/lib/libc_r/uthread/uthread_getschedparam.c b/lib/libc_r/uthread/uthread_getschedparam.c index 163203e2a1..bd56a05a23 100644 --- a/lib/libc_r/uthread/uthread_getschedparam.c +++ b/lib/libc_r/uthread/uthread_getschedparam.c @@ -30,15 +30,14 @@ * SUCH DAMAGE. * * $FreeBSD: src/lib/libc_r/uthread/uthread_getschedparam.c,v 1.4.2.2 2002/10/22 14:44:03 fjoe Exp $ - * $DragonFly: src/lib/libc_r/uthread/uthread_getschedparam.c,v 1.3 2005/05/30 20:50:53 joerg Exp $ */ #include #include #include "pthread_private.h" int -_pthread_getschedparam(pthread_t pthread, int *policy, - struct sched_param *param) +_pthread_getschedparam(pthread_t pthread, int * __restrict policy, + struct sched_param * __restrict param) { int ret; diff --git a/lib/libc_r/uthread/uthread_mattr_kind_np.c b/lib/libc_r/uthread/uthread_mattr_kind_np.c index d54867c37c..9414a825c5 100644 --- a/lib/libc_r/uthread/uthread_mattr_kind_np.c +++ b/lib/libc_r/uthread/uthread_mattr_kind_np.c @@ -77,7 +77,8 @@ _pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type) } int -_pthread_mutexattr_gettype(pthread_mutexattr_t *attr, int *type) +_pthread_mutexattr_gettype(pthread_mutexattr_t * __restrict attr, + int * __restrict type) { int ret; diff --git a/lib/libc_r/uthread/uthread_mutex.c b/lib/libc_r/uthread/uthread_mutex.c index f3d80a4572..af5e77f533 100644 --- a/lib/libc_r/uthread/uthread_mutex.c +++ b/lib/libc_r/uthread/uthread_mutex.c @@ -105,8 +105,8 @@ _mutex_reinit(pthread_mutex_t * mutex) } int -_pthread_mutex_init(pthread_mutex_t * mutex, - const pthread_mutexattr_t * mutex_attr) +_pthread_mutex_init(pthread_mutex_t * __restrict mutex, + const pthread_mutexattr_t * __restrict mutex_attr) { enum pthread_mutextype type; int protocol; diff --git a/lib/libc_r/uthread/uthread_mutex_prioceiling.c b/lib/libc_r/uthread/uthread_mutex_prioceiling.c index 86d339c2a6..1f1c7e376e 100644 --- a/lib/libc_r/uthread/uthread_mutex_prioceiling.c +++ b/lib/libc_r/uthread/uthread_mutex_prioceiling.c @@ -30,7 +30,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/lib/libc_r/uthread/uthread_mutex_prioceiling.c,v 1.3.2.1 2002/10/22 14:44:03 fjoe Exp $ - * $DragonFly: src/lib/libc_r/uthread/uthread_mutex_prioceiling.c,v 1.3 2005/05/30 20:50:53 joerg Exp $ */ #include #include @@ -39,7 +38,8 @@ #include "pthread_private.h" int -_pthread_mutexattr_getprioceiling(pthread_mutexattr_t *mattr, int *prioceiling) +_pthread_mutexattr_getprioceiling(pthread_mutexattr_t * __restrict mattr, + int * __restrict prioceiling) { int ret = 0; @@ -69,8 +69,8 @@ _pthread_mutexattr_setprioceiling(pthread_mutexattr_t *mattr, int prioceiling) } int -_pthread_mutex_getprioceiling(pthread_mutex_t *mutex, - int *prioceiling) +_pthread_mutex_getprioceiling(pthread_mutex_t * __restrict mutex, + int * __restrict prioceiling) { int ret; @@ -85,8 +85,8 @@ _pthread_mutex_getprioceiling(pthread_mutex_t *mutex, } int -_pthread_mutex_setprioceiling(pthread_mutex_t *mutex, - int prioceiling, int *old_ceiling) +_pthread_mutex_setprioceiling(pthread_mutex_t * __restrict mutex, + int prioceiling, int * __restrict old_ceiling) { int ret = 0; diff --git a/lib/libc_r/uthread/uthread_mutex_protocol.c b/lib/libc_r/uthread/uthread_mutex_protocol.c index 4bd1cb9f26..21be9143d0 100644 --- a/lib/libc_r/uthread/uthread_mutex_protocol.c +++ b/lib/libc_r/uthread/uthread_mutex_protocol.c @@ -30,7 +30,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/lib/libc_r/uthread/uthread_mutex_protocol.c,v 1.3.2.1 2002/10/22 14:44:03 fjoe Exp $ - * $DragonFly: src/lib/libc_r/uthread/uthread_mutex_protocol.c,v 1.3 2005/05/30 20:50:53 joerg Exp $ */ #include #include @@ -39,7 +38,8 @@ #include "pthread_private.h" int -_pthread_mutexattr_getprotocol(pthread_mutexattr_t *mattr, int *protocol) +_pthread_mutexattr_getprotocol(pthread_mutexattr_t * __restrict mattr, + int * __restrict protocol) { int ret = 0; diff --git a/lib/libc_r/uthread/uthread_rwlock.c b/lib/libc_r/uthread/uthread_rwlock.c index 072d265338..5bf5f4a41b 100644 --- a/lib/libc_r/uthread/uthread_rwlock.c +++ b/lib/libc_r/uthread/uthread_rwlock.c @@ -24,7 +24,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/lib/libc_r/uthread/uthread_rwlock.c,v 1.4.2.2 2002/10/22 14:44:03 fjoe Exp $ - * $DragonFly: src/lib/libc_r/uthread/uthread_rwlock.c,v 1.3 2005/05/30 20:50:53 joerg Exp $ */ #include @@ -84,7 +83,8 @@ _pthread_rwlock_destroy (pthread_rwlock_t *rwlock) } int -_pthread_rwlock_init (pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr) +_pthread_rwlock_init (pthread_rwlock_t * __restrict rwlock, + const pthread_rwlockattr_t * __restrict attr) { pthread_rwlock_t prwlock; int ret; diff --git a/lib/libc_r/uthread/uthread_rwlockattr.c b/lib/libc_r/uthread/uthread_rwlockattr.c index 28ce2bf359..99d472e3a3 100644 --- a/lib/libc_r/uthread/uthread_rwlockattr.c +++ b/lib/libc_r/uthread/uthread_rwlockattr.c @@ -24,7 +24,6 @@ * SUCH DAMAGE. * * $FreeBSD: src/lib/libc_r/uthread/uthread_rwlockattr.c,v 1.5.2.1 2002/10/22 14:44:03 fjoe Exp $ - * $DragonFly: src/lib/libc_r/uthread/uthread_rwlockattr.c,v 1.3 2005/05/30 20:50:53 joerg Exp $ */ #include @@ -52,8 +51,8 @@ _pthread_rwlockattr_destroy(pthread_rwlockattr_t *rwlockattr) } int -_pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *rwlockattr, - int *pshared) +_pthread_rwlockattr_getpshared(const pthread_rwlockattr_t * __restrict rwlockattr, + int * __restrict pshared) { *pshared = (*rwlockattr)->pshared; diff --git a/lib/libc_r/uthread/uthread_sem.c b/lib/libc_r/uthread/uthread_sem.c index 76ed4fcd7c..272a8c0de0 100644 --- a/lib/libc_r/uthread/uthread_sem.c +++ b/lib/libc_r/uthread/uthread_sem.c @@ -230,7 +230,7 @@ _sem_post(sem_t *sem) } int -_sem_getvalue(sem_t *sem, int *sval) +_sem_getvalue(sem_t * __restrict sem, int * __restrict sval) { int retval; diff --git a/lib/librt/aio.c b/lib/librt/aio.c index 8408b93ba0..e766e8697d 100644 --- a/lib/librt/aio.c +++ b/lib/librt/aio.c @@ -152,8 +152,8 @@ aio_fsync(int op, struct aiocb *ap) } int -lio_listio(int mode, struct aiocb *const apv[], int nent, - struct sigevent *sigevp) +lio_listio(int mode, struct aiocb * __restrict const apv[__restrict_arr], + int nent, struct sigevent * __restrict sigevp) { int i; diff --git a/lib/libthread_xu/thread/thr_attr.c b/lib/libthread_xu/thread/thr_attr.c index cb8d5a380b..9eeecf66f0 100644 --- a/lib/libthread_xu/thread/thr_attr.c +++ b/lib/libthread_xu/thread/thr_attr.c @@ -150,7 +150,8 @@ _pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate) __strong_reference(_pthread_attr_getdetachstate, pthread_attr_getdetachstate); int -_pthread_attr_getguardsize(const pthread_attr_t *attr, size_t *guardsize) +_pthread_attr_getguardsize(const pthread_attr_t * __restrict attr, + size_t * __restrict guardsize) { int ret; @@ -168,7 +169,8 @@ _pthread_attr_getguardsize(const pthread_attr_t *attr, size_t *guardsize) __strong_reference(_pthread_attr_getguardsize, pthread_attr_getguardsize); int -_pthread_attr_getinheritsched(const pthread_attr_t *attr, int *sched_inherit) +_pthread_attr_getinheritsched(const pthread_attr_t * __restrict attr, + int * __restrict sched_inherit) { int ret = 0; @@ -183,7 +185,8 @@ _pthread_attr_getinheritsched(const pthread_attr_t *attr, int *sched_inherit) __strong_reference(_pthread_attr_getinheritsched, pthread_attr_getinheritsched); int -_pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *param) +_pthread_attr_getschedparam(const pthread_attr_t * __restrict attr, + struct sched_param * __restrict param) { int ret = 0; @@ -198,7 +201,8 @@ _pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *para __strong_reference(_pthread_attr_getschedparam, pthread_attr_getschedparam); int -_pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy) +_pthread_attr_getschedpolicy(const pthread_attr_t * __restrict attr, + int * __restrict policy) { int ret = 0; @@ -213,7 +217,8 @@ _pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy) __strong_reference(_pthread_attr_getschedpolicy, pthread_attr_getschedpolicy); int -_pthread_attr_getscope(const pthread_attr_t *attr, int *contentionscope) +_pthread_attr_getscope(const pthread_attr_t * __restrict attr, + int * __restrict contentionscope) { int ret = 0; @@ -271,7 +276,8 @@ _pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr) __strong_reference(_pthread_attr_getstackaddr, pthread_attr_getstackaddr); int -_pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize) +_pthread_attr_getstacksize(const pthread_attr_t * __restrict attr, + size_t * __restrict stacksize) { int ret; @@ -420,7 +426,8 @@ _pthread_attr_setinheritsched(pthread_attr_t *attr, int sched_inherit) __strong_reference(_pthread_attr_setinheritsched, pthread_attr_setinheritsched); int -_pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param) +_pthread_attr_setschedparam(pthread_attr_t * __restrict attr, + const struct sched_param * __restrict param) { int policy; diff --git a/lib/libthread_xu/thread/thr_barrier.c b/lib/libthread_xu/thread/thr_barrier.c index d592176dcd..51065de9ae 100644 --- a/lib/libthread_xu/thread/thr_barrier.c +++ b/lib/libthread_xu/thread/thr_barrier.c @@ -52,8 +52,8 @@ _pthread_barrier_destroy(pthread_barrier_t *barrier) } int -_pthread_barrier_init(pthread_barrier_t *barrier, - const pthread_barrierattr_t *attr __unused, unsigned count) +_pthread_barrier_init(pthread_barrier_t * __restrict barrier, + const pthread_barrierattr_t * __restrict attr __unused, unsigned count) { pthread_barrier_t bar; diff --git a/lib/libthread_xu/thread/thr_barrierattr.c b/lib/libthread_xu/thread/thr_barrierattr.c index 0f621e5ab0..c3d8609ecc 100644 --- a/lib/libthread_xu/thread/thr_barrierattr.c +++ b/lib/libthread_xu/thread/thr_barrierattr.c @@ -48,8 +48,8 @@ _pthread_barrierattr_destroy(pthread_barrierattr_t *attr) } int -_pthread_barrierattr_getpshared(const pthread_barrierattr_t *attr, - int *pshared) +_pthread_barrierattr_getpshared(const pthread_barrierattr_t * __restrict attr, + int * __restrict pshared) { if (attr == NULL || *attr == NULL) diff --git a/lib/libthread_xu/thread/thr_cond.c b/lib/libthread_xu/thread/thr_cond.c index 563d8f854c..c7585bec53 100644 --- a/lib/libthread_xu/thread/thr_cond.c +++ b/lib/libthread_xu/thread/thr_cond.c @@ -143,7 +143,8 @@ init_static(struct pthread *thread, pthread_cond_t *cond) } int -_pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *cond_attr) +_pthread_cond_init(pthread_cond_t * __restrict cond, + const pthread_condattr_t * __restrict cond_attr) { *cond = NULL; return cond_init(cond, cond_attr); @@ -327,14 +328,16 @@ _pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) } int -__pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) +__pthread_cond_wait(pthread_cond_t * __restrict cond, + pthread_mutex_t * __restrict mutex) { return (cond_wait_common(cond, mutex, NULL, 1)); } int -_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, - const struct timespec * abstime) +_pthread_cond_timedwait(pthread_cond_t * __restrict cond, + pthread_mutex_t * __restrict mutex, + const struct timespec * __restrict abstime) { if (abstime == NULL || abstime->tv_sec < 0 || abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000) diff --git a/lib/libthread_xu/thread/thr_condattr.c b/lib/libthread_xu/thread/thr_condattr.c index 58f1004a12..fd495284f9 100644 --- a/lib/libthread_xu/thread/thr_condattr.c +++ b/lib/libthread_xu/thread/thr_condattr.c @@ -70,8 +70,8 @@ _pthread_condattr_destroy(pthread_condattr_t *attr) } int -_pthread_condattr_getclock(const pthread_condattr_t *attr, - clockid_t *clock_id) +_pthread_condattr_getclock(const pthread_condattr_t * __restrict attr, + clockid_t * __restrict clock_id) { if (attr == NULL || *attr == NULL) return (EINVAL); @@ -94,8 +94,8 @@ _pthread_condattr_setclock(pthread_condattr_t *attr, } int -_pthread_condattr_getpshared(const pthread_condattr_t *attr, - int *pshared) +_pthread_condattr_getpshared(const pthread_condattr_t * __restrict attr, + int * __restrict pshared) { if (attr == NULL || *attr == NULL) return (EINVAL); diff --git a/lib/libthread_xu/thread/thr_create.c b/lib/libthread_xu/thread/thr_create.c index 2ddfa2405a..271d589c6c 100644 --- a/lib/libthread_xu/thread/thr_create.c +++ b/lib/libthread_xu/thread/thr_create.c @@ -48,8 +48,9 @@ static int create_stack(struct pthread_attr *pattr); static void thread_start(void *); int -_pthread_create(pthread_t * thread, const pthread_attr_t * attr, - void *(*start_routine) (void *), void *arg) +_pthread_create(pthread_t * __restrict thread, + const pthread_attr_t * __restrict attr, void *(*start_routine) (void *), + void * __restrict arg) { struct lwp_params create_params; void *stack; diff --git a/lib/libthread_xu/thread/thr_getschedparam.c b/lib/libthread_xu/thread/thr_getschedparam.c index 89d97856e7..167d55698d 100644 --- a/lib/libthread_xu/thread/thr_getschedparam.c +++ b/lib/libthread_xu/thread/thr_getschedparam.c @@ -40,8 +40,8 @@ #include "thr_private.h" int -_pthread_getschedparam(pthread_t pthread, int *policy, - struct sched_param *param) +_pthread_getschedparam(pthread_t pthread, int * __restrict policy, + struct sched_param * __restrict param) { struct pthread *curthread = tls_get_curthread(); int ret = 0; diff --git a/lib/libthread_xu/thread/thr_mutex.c b/lib/libthread_xu/thread/thr_mutex.c index 5fc54e12ee..2c4dabd592 100644 --- a/lib/libthread_xu/thread/thr_mutex.c +++ b/lib/libthread_xu/thread/thr_mutex.c @@ -243,8 +243,8 @@ init_static_private(struct pthread *thread, pthread_mutex_t *mutex) } int -_pthread_mutex_init(pthread_mutex_t *mutex, - const pthread_mutexattr_t *mutex_attr) +_pthread_mutex_init(pthread_mutex_t * __restrict mutex, + const pthread_mutexattr_t * __restrict mutex_attr) { return mutex_init(mutex, mutex_attr, 1); } @@ -491,8 +491,8 @@ _pthread_mutex_lock(pthread_mutex_t *m) } int -__pthread_mutex_timedlock(pthread_mutex_t *m, - const struct timespec *abs_timeout) +__pthread_mutex_timedlock(pthread_mutex_t * __restrict m, + const struct timespec * __restrict abs_timeout) { struct pthread *curthread; int ret; @@ -680,8 +680,8 @@ mutex_unlock_common(pthread_mutex_t *mutex) } int -_pthread_mutex_getprioceiling(pthread_mutex_t *mutex, - int *prioceiling) +_pthread_mutex_getprioceiling(pthread_mutex_t * __restrict mutex, + int * __restrict prioceiling) { if ((mutex == NULL) || (*mutex == NULL)) return (EINVAL); @@ -692,8 +692,8 @@ _pthread_mutex_getprioceiling(pthread_mutex_t *mutex, } int -_pthread_mutex_setprioceiling(pthread_mutex_t *mutex, - int prioceiling, int *old_ceiling) +_pthread_mutex_setprioceiling(pthread_mutex_t * __restrict mutex, + int prioceiling, int * __restrict old_ceiling) { int ret = 0; int tmp; diff --git a/lib/libthread_xu/thread/thr_mutexattr.c b/lib/libthread_xu/thread/thr_mutexattr.c index 5d4b0a626b..84fc86b15a 100644 --- a/lib/libthread_xu/thread/thr_mutexattr.c +++ b/lib/libthread_xu/thread/thr_mutexattr.c @@ -101,7 +101,8 @@ _pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type) } int -_pthread_mutexattr_gettype(pthread_mutexattr_t *attr, int *type) +_pthread_mutexattr_gettype(pthread_mutexattr_t * __restrict attr, + int * __restrict type) { int ret; @@ -130,8 +131,8 @@ _pthread_mutexattr_destroy(pthread_mutexattr_t *attr) } int -_pthread_mutexattr_getpshared(const pthread_mutexattr_t *attr, - int *pshared) +_pthread_mutexattr_getpshared(const pthread_mutexattr_t * __restrict attr, + int * __restrict pshared) { if (attr == NULL || *attr == NULL) @@ -155,7 +156,8 @@ _pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared) } int -_pthread_mutexattr_getprotocol(pthread_mutexattr_t *mattr, int *protocol) +_pthread_mutexattr_getprotocol(pthread_mutexattr_t * __restrict mattr, + int * __restrict protocol) { int ret = 0; @@ -183,7 +185,8 @@ _pthread_mutexattr_setprotocol(pthread_mutexattr_t *mattr, int protocol) } int -_pthread_mutexattr_getprioceiling(pthread_mutexattr_t *mattr, int *prioceiling) +_pthread_mutexattr_getprioceiling(pthread_mutexattr_t * __restrict mattr, + int * __restrict prioceiling) { int ret = 0; diff --git a/lib/libthread_xu/thread/thr_rwlock.c b/lib/libthread_xu/thread/thr_rwlock.c index 8c95c0d8b1..000fcd452b 100644 --- a/lib/libthread_xu/thread/thr_rwlock.c +++ b/lib/libthread_xu/thread/thr_rwlock.c @@ -277,8 +277,8 @@ _pthread_rwlock_rdlock (pthread_rwlock_t *rwlock) } int -_pthread_rwlock_timedrdlock (pthread_rwlock_t *rwlock, - const struct timespec *abstime) +_pthread_rwlock_timedrdlock (pthread_rwlock_t * __restrict rwlock, + const struct timespec * __restrict abstime) { return (rwlock_rdlock_common(rwlock, abstime)); } @@ -495,8 +495,8 @@ _pthread_rwlock_wrlock (pthread_rwlock_t *rwlock) } int -_pthread_rwlock_timedwrlock (pthread_rwlock_t *rwlock, - const struct timespec *abstime) +_pthread_rwlock_timedwrlock (pthread_rwlock_t * __restrict rwlock, + const struct timespec * __restrict abstime) { return (rwlock_wrlock_common (rwlock, abstime)); } diff --git a/lib/libthread_xu/thread/thr_rwlockattr.c b/lib/libthread_xu/thread/thr_rwlockattr.c index ae1643bd0c..e5d3b5cd3d 100644 --- a/lib/libthread_xu/thread/thr_rwlockattr.c +++ b/lib/libthread_xu/thread/thr_rwlockattr.c @@ -49,8 +49,8 @@ _pthread_rwlockattr_destroy(pthread_rwlockattr_t *rwlockattr) } int -_pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *rwlockattr, - int *pshared) +_pthread_rwlockattr_getpshared(const pthread_rwlockattr_t * __restrict rwlockattr, + int * __restrict pshared) { *pshared = (*rwlockattr)->pshared; return (0); diff --git a/sys/sys/aio.h b/sys/sys/aio.h index affae2c23e..aca1f5a55d 100644 --- a/sys/sys/aio.h +++ b/sys/sys/aio.h @@ -99,7 +99,8 @@ int aio_write(struct aiocb *); * "acb_list" is an array of "nacb_listent" I/O control blocks. * when all I/Os are complete, the optional signal "sig" is sent. */ -int lio_listio(int, struct aiocb * const [], int, struct sigevent *); +int lio_listio(int, struct aiocb * __restrict const[__restrict_arr], int, + struct sigevent * __restrict); /* * Get completion status diff --git a/sys/sys/semaphore.h b/sys/sys/semaphore.h index badf99f2d5..292ecc8bf2 100644 --- a/sys/sys/semaphore.h +++ b/sys/sys/semaphore.h @@ -60,7 +60,7 @@ int sem_wait (sem_t *); int sem_trywait (sem_t *); int sem_timedwait (sem_t * __restrict, const struct timespec * __restrict); int sem_post (sem_t *); -int sem_getvalue (sem_t *, int *); +int sem_getvalue (sem_t * __restrict, int * __restrict); __END_DECLS #endif diff --git a/sys/sys/socket.h b/sys/sys/socket.h index 7d839f388f..5ff5a76238 100644 --- a/sys/sys/socket.h +++ b/sys/sys/socket.h @@ -482,18 +482,19 @@ struct sf_hdtr { #if !defined(_KERNEL) || defined(_KERNEL_VIRTUAL) __BEGIN_DECLS -int accept(int, struct sockaddr *, socklen_t *); +int accept(int, struct sockaddr * __restrict, socklen_t * __restrict); int accept4(int, struct sockaddr *, socklen_t *, int); int extaccept(int, int, struct sockaddr *, socklen_t *); int bind(int, const struct sockaddr *, socklen_t); int connect(int, const struct sockaddr *, socklen_t); int extconnect(int, int, struct sockaddr *, socklen_t); -int getpeername(int, struct sockaddr *, socklen_t *); -int getsockname(int, struct sockaddr *, socklen_t *); -int getsockopt(int, int, int, void *, socklen_t *); +int getpeername(int, struct sockaddr * __restrict, socklen_t * __restrict); +int getsockname(int, struct sockaddr * __restrict, socklen_t * __restrict); +int getsockopt(int, int, int, void * __restrict, socklen_t * __restrict); int listen(int, int); ssize_t recv(int, void *, size_t, int); -ssize_t recvfrom(int, void *, size_t, int, struct sockaddr *, socklen_t *); +ssize_t recvfrom(int, void * __restrict, size_t, int, + struct sockaddr * __restrict, socklen_t * __restrict); ssize_t recvmsg(int, struct msghdr *, int); ssize_t send(int, const void *, size_t, int); ssize_t sendto(int, const void *, diff --git a/sys/sys/stat.h b/sys/sys/stat.h index 83c73abd99..ad7152b40e 100644 --- a/sys/sys/stat.h +++ b/sys/sys/stat.h @@ -263,7 +263,7 @@ int utimensat(int, const char *, const struct timespec *, int); #endif int fstat(int, struct stat *); #if __POSIX_VISIBLE >= 199506 -int lstat(const char *, struct stat *); +int lstat(const char * __restrict, struct stat * __restrict); #endif int mkdir(const char *, mode_t); int mkfifo(const char *, mode_t); @@ -271,10 +271,10 @@ int mkfifo(const char *, mode_t); int mknod(const char *, mode_t, dev_t); #define _MKNOD_DECLARED #endif -int stat(const char *, struct stat *); +int stat(const char * __restrict, struct stat * __restrict); mode_t umask(mode_t); #if __POSIX_VISIBLE >= 200809 -int fstatat(int, const char *, struct stat *, int); +int fstatat(int, const char * __restrict, struct stat * __restrict, int); int mkdirat(int, const char *, mode_t); int mkfifoat(int, const char *, mode_t); #endif diff --git a/sys/sys/time.h b/sys/sys/time.h index 2a101d46a1..d3c9ed59d2 100644 --- a/sys/sys/time.h +++ b/sys/sys/time.h @@ -246,8 +246,9 @@ int settimeofday(const struct timeval *, const struct timezone *); #if __XSI_VISIBLE int getitimer(int, struct itimerval *); -int gettimeofday(struct timeval *, struct timezone *); -int setitimer(int, const struct itimerval *, struct itimerval *); +int gettimeofday(struct timeval * __restrict, struct timezone * __restrict); +int setitimer(int, const struct itimerval * __restrict, + struct itimerval * __restrict); int utimes(const char *, const struct timeval *); #endif -- 2.11.4.GIT