diff --git a/include/pthread.h b/include/pthread.h index 438ec2805f..67851fd013 100644 --- a/include/pthread.h +++ b/include/pthread.h @@ -1,7 +1,7 @@ /******************************************************************************** * include/pthread.h * - * Copyright (C) 2007-2009, 2011-2012, 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2012, 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -259,14 +259,10 @@ typedef struct pthread_barrier_s pthread_barrier_t; typedef bool pthread_once_t; #define __PTHREAD_ONCE_T_DEFINED 1 -/* Forware references */ +/* Forward references */ struct sched_param; /* Defined in sched.h */ -/******************************************************************************** - * Public Data - ********************************************************************************/ - /******************************************************************************** * Public Function Prototypes ********************************************************************************/ diff --git a/include/sys/syscall.h b/include/sys/syscall.h index c7d9b086c4..198b27c953 100644 --- a/include/sys/syscall.h +++ b/include/sys/syscall.h @@ -2,7 +2,7 @@ * include/sys/syscall.h * This file contains the system call numbers. * - * Copyright (C) 2011-2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -377,13 +377,21 @@ # define SYS_pthread_setspecific (__SYS_pthread+26) # define SYS_pthread_yield (__SYS_pthread+27) -# ifndef CONFIG_DISABLE_SIGNALS -# define SYS_pthread_cond_timedwait (__SYS_pthread+28) -# define SYS_pthread_kill (__SYS_pthread+29) -# define SYS_pthread_sigmask (__SYS_pthread+30) -# define __SYS_mqueue (__SYS_pthread+31) +# ifndef CONFIG_SMP +# define SYS_pthread_setaffinity_np (__SYS_pthread+28) +# define SYS_pthread_getaffinity_np (__SYS_pthread+29) +# define __SYS_pthread_signals (__SYS_pthread+30) # else -# define __SYS_mqueue (__SYS_pthread+28) +# define __SYS_pthread_signals (__SYS_pthread+28) +# endif + +# ifndef CONFIG_DISABLE_SIGNALS +# define SYS_pthread_cond_timedwait (__SYS_pthread_signals+0) +# define SYS_pthread_kill (__SYS_pthread_signals+1) +# define SYS_pthread_sigmask (__SYS_pthread_signals+2) +# define __SYS_mqueue (__SYS_pthread_signals+3) +# else +# define __SYS_mqueue __SYS_pthread_signals # endif #else diff --git a/sched/pthread/Make.defs b/sched/pthread/Make.defs index be0c9c1ae2..d27938aa37 100644 --- a/sched/pthread/Make.defs +++ b/sched/pthread/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # sched/pthread/Make.defs # -# Copyright (C) 2014 Gregory Nutt. All rights reserved. +# Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without diff --git a/syscall/syscall.csv b/syscall/syscall.csv index b20a2aca97..a7d8121535 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -72,6 +72,7 @@ "pthread_create","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_t*","FAR const pthread_attr_t*","pthread_startroutine_t","pthread_addr_t" "pthread_detach","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t" "pthread_exit","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","void","pthread_addr_t" +"pthread_getaffinity_np","pthread.h","!defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_SMP)","int","pthread_t","size_t","FAR cpu_set_t*" "pthread_getschedparam","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t","FAR int*","FAR struct sched_param*" "pthread_getspecific","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","FAR void*","pthread_key_t" "pthread_join","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t","FAR pthread_addr_t*" @@ -84,6 +85,7 @@ "pthread_mutex_trylock","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutex_t*" "pthread_mutex_unlock","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutex_t*" "pthread_once","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_once_t*","CODE void (*)(void)" +"pthread_setaffinity_np","pthread.h","!defined(CONFIG_DISABLE_PTHREAD) && defined(CONFIG_SMP)","int","pthread_t","size_t","FAR const cpu_set_t*" "pthread_setcancelstate","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","int","FAR int*" "pthread_setschedparam","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t","int","FAR const struct sched_param*" "pthread_setschedprio","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t","int" diff --git a/syscall/syscall_lookup.h b/syscall/syscall_lookup.h index 6ad246ba5b..8fb2f507b0 100644 --- a/syscall/syscall_lookup.h +++ b/syscall/syscall_lookup.h @@ -1,7 +1,7 @@ /**************************************************************************** * syscall/syscall_lookup.h * - * Copyright (C) 2011, 2013-2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -278,6 +278,10 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert) SYSCALL_LOOKUP(pthread_setschedprio, 2, STUB_pthread_setschedprio) SYSCALL_LOOKUP(pthread_setspecific, 2, STUB_pthread_setspecific) SYSCALL_LOOKUP(pthread_yield, 0, STUB_pthread_yield) +# ifdef CONFIG_SMP + SYSCALL_LOOKUP(pthread_setaffinity, 3, STUB_pthread_setaffinity) + SYSCALL_LOOKUP(pthread_getaffinity, 3, STUB_pthread_getaffinity) +# endif # ifndef CONFIG_DISABLE_SIGNALS SYSCALL_LOOKUP(pthread_cond_timedwait, 3, STUB_pthread_cond_timedwait) SYSCALL_LOOKUP(pthread_kill, 2, STUB_pthread_kill) diff --git a/syscall/syscall_stublookup.c b/syscall/syscall_stublookup.c index ed151d246b..63af75eb40 100644 --- a/syscall/syscall_stublookup.c +++ b/syscall/syscall_stublookup.c @@ -1,7 +1,7 @@ /**************************************************************************** * syscall/syscall_stublookup.c * - * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2013, 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -290,6 +290,11 @@ uintptr_t STUB_pthread_setspecific(int nbr, uintptr_t parm1, uintptr_t parm2); uintptr_t STUB_pthread_yield(int nbr); +uintptr_t STUB_pthread_setaffinity(int nbr, uintptr_t parm1, + uintptr_t parm2, uintptr_t parm3); +uintptr_t STUB_pthread_getaffinity(int nbr, uintptr_t parm1, + uintptr_t parm2, uintptr_t parm3); + uintptr_t STUB_pthread_cond_timedwait(int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t parm3); uintptr_t STUB_pthread_kill(int nbr, uintptr_t parm1, uintptr_t parm2);