Add pthread_setcanceltype() and pthread_testcancel() as system calls.

This commit is contained in:
Gregory Nutt 2016-12-10 07:12:11 -06:00
parent a0f567f4a3
commit 1b2135a90a
5 changed files with 29 additions and 9 deletions

13
TODO
View File

@ -1530,7 +1530,18 @@ o Libraries (libc/, libm/)
Description: There are many things implemented within the kernel (for example
under sched/pthread) that probably should be migrated in the
C library where it belongs.
Status: Ope
I would really like to see a little flavor of a micro-kernel
at the OS interface: I would like to see more primitive OS
system calls with more higher level logic in the C library.
One awkard thing is the incompatibility of KERNEL vs FLAT
builds: In the kernel build, it would be nice to move many
of the thread-specific data items out of the TCB and into
the process address environment where they belong. It is
difficult to make this compatible with the FLAT build,
however.
Status: Open
Priority: Low
o File system / Generic drivers (fs/, drivers/)

View File

@ -401,17 +401,19 @@
# define SYS_pthread_mutex_unlock (__SYS_pthread+21)
# define SYS_pthread_once (__SYS_pthread+22)
# define SYS_pthread_setcancelstate (__SYS_pthread+23)
# define SYS_pthread_setschedparam (__SYS_pthread+24)
# define SYS_pthread_setschedprio (__SYS_pthread+25)
# define SYS_pthread_setspecific (__SYS_pthread+26)
# define SYS_pthread_yield (__SYS_pthread+27)
# define SYS_Pthread_setcanceltype (__SYS_pthread+24)
# define SYS_pthread_setschedparam (__SYS_pthread+25)
# define SYS_pthread_setschedprio (__SYS_pthread+26)
# define SYS_pthread_setspecific (__SYS_pthread+27)
# define SYS_pthread_testcancel (__SYS_pthread+28)
# define SYS_pthread_yield (__SYS_pthread+29)
# ifdef 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)
# define SYS_pthread_setaffinity_np (__SYS_pthread+30)
# define SYS_pthread_getaffinity_np (__SYS_pthread+31)
# define __SYS_pthread_signals (__SYS_pthread+32)
# else
# define __SYS_pthread_signals (__SYS_pthread+28)
# define __SYS_pthread_signals (__SYS_pthread+30)
# endif
# ifndef CONFIG_DISABLE_SIGNALS

View File

@ -90,10 +90,12 @@
"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_setcanceltype","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"
"pthread_setspecific","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_key_t","FAR const void*"
"pthread_sigmask","pthread.h","!defined(CONFIG_DISABLE_SIGNALS) && !defined(CONFIG_DISABLE_PTHREAD)","int","int","FAR const sigset_t*","FAR sigset_t*"
"pthread_testcancel","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","void"
"pthread_yield","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","void"
"putenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int","FAR const char*"
"read","unistd.h","CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0","ssize_t","int","FAR void*","size_t"

Can't render this file because it has a wrong number of fields in line 2.

View File

@ -291,9 +291,11 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert)
SYSCALL_LOOKUP(pthread_mutex_unlock, 1, STUB_pthread_mutex_unlock)
SYSCALL_LOOKUP(pthread_once, 2, STUB_pthread_once)
SYSCALL_LOOKUP(pthread_setcancelstate, 2, STUB_pthread_setcancelstate)
SYSCALL_LOOKUP(pthread_setcanceltype, 2, STUB_pthread_setcanceltype)
SYSCALL_LOOKUP(pthread_setschedparam, 3, STUB_pthread_setschedparam)
SYSCALL_LOOKUP(pthread_setschedprio, 2, STUB_pthread_setschedprio)
SYSCALL_LOOKUP(pthread_setspecific, 2, STUB_pthread_setspecific)
SYSCALL_LOOKUP(pthread_testcancel, 0, STUB_pthread_testcancel)
SYSCALL_LOOKUP(pthread_yield, 0, STUB_pthread_yield)
# ifdef CONFIG_SMP
SYSCALL_LOOKUP(pthread_setaffinity, 3, STUB_pthread_setaffinity)

View File

@ -292,12 +292,15 @@ uintptr_t STUB_pthread_mutex_unlock(int nbr, uintptr_t parm1);
uintptr_t STUB_pthread_once(int nbr, uintptr_t parm1, uintptr_t parm2);
uintptr_t STUB_pthread_setcancelstate(int nbr, uintptr_t parm1,
uintptr_t parm2);
uintptr_t STUB_pthread_setcanceltype(int nbr, uintptr_t parm1,
uintptr_t parm2);
uintptr_t STUB_pthread_setschedparam(int nbr, uintptr_t parm1,
uintptr_t parm2, uintptr_t parm3);
uintptr_t STUB_pthread_setschedprio(int nbr, uintptr_t parm1,
uintptr_t parm2);
uintptr_t STUB_pthread_setspecific(int nbr, uintptr_t parm1,
uintptr_t parm2);
uintptr_t STUB_pthread_testcancel(int nbr);
uintptr_t STUB_pthread_yield(int nbr);
uintptr_t STUB_pthread_setaffinity(int nbr, uintptr_t parm1,