Commit Graph

1145 Commits

Author SHA1 Message Date
Arjun Hary b274a97840 Miscellaneous fixes from astyle tool. 2017-08-14 17:19:27 -06:00
Gregory Nutt 6579078287 Eliminate another warning. 2017-08-12 11:24:11 -06:00
Gregory Nutt baf4c0d011 Minor change to last PR: errno should not be modified if no error occurred. 2017-08-07 06:33:53 -06:00
Masayuki Ishikawa 4530a72379 sched/: Fix return value in sched_setaffinity() 2017-08-07 15:00:31 +09:00
Gregory Nutt 6b6d7ce9b9 sig_timedwait: Pending signal structure used after it has been releasd. From anonymous Bitbucket Issue 59. 2017-07-27 12:32:47 -06:00
Gregory Nutt 031fbfc6bc sched/: Remove dangling space at the end of lines. 2017-06-28 13:33:04 -06:00
Gregory Nutt 5e8037390c Fix problems in last commit noted by Jeongchan Kim: last change returned -EINVAL vs EINVAL; Treat the case where the mutex is already unlocked just like the case where the mutex is held by another thread -- return EPERM. 2017-06-22 06:26:00 -06:00
Gregory Nutt 0c3aef9591 Trivial typo fix 2017-06-21 06:48:13 -06:00
Gregory Nutt 6618336a39 pthread_mutex_unlock(): Missing check for the case where pthread_mutex_lock() is called when the mutex is not locked. In that case, it would increment the underlying semaphore avove 1. This is the fix for a problem noted by initialkjc@yahoo.com. 2017-06-21 06:40:09 -06:00
Gregory Nutt 2d4ba3ee3f IEEE 802.15.4 MAC: Add list management and prioritization logic that will permit the MAC layer to support bound multiple clients. 2017-06-18 11:00:47 -06:00
Gregory Nutt 2245dddaf9 Break up some long lines 2017-06-14 13:42:56 -06:00
Gregory Nutt 23a6ff5846 pthreads: Move pthread_barrier_init, pthread_barrier_destroy, and pthread_barrier_wait from sched/pthreads to libc/pthreads. This just coordinate other OS interface calls but are not a fundamental OS interfaces and, hence, do not belong within the OS. 2017-06-14 07:59:54 -06:00
Gregory Nutt ae168bffa0 pthreads: Move pthread_cond_init and pthread_cond_destory from sched/pthreads to libc/pthreads. This just coordinate other OS interface calls but are not a fundamental OS interfaces and, hence, do not belong within the OS. 2017-06-14 07:48:45 -06:00
Gregory Nutt 557fd6504f pthreads: Move pthread_once from sched/pthreads to libc/pthreads. pthread_once just coordinates other OS interface calls but is not a fundamental OS interface and, hence, does not belong within the OS. 2017-06-14 07:31:10 -06:00
Gregory Nutt 8ae5450268 pthreads: Move pthread_yield from sched/pthreads to libc/pthreads. it is a simple wrapper for sched_yield and does not belong within the OS. 2017-06-14 07:31:10 -06:00
Gregory Nutt 0fe9c2f3f9 pthread mutex: Remove bogus DEBUGASSERT. Problem noted by Jussi Kivilinna 2017-06-01 06:28:23 -06:00
Gregory Nutt 90dda9357e pthread robust mutexes: Fix memmory trashing problem: the main task may also use mutexes; need to check thread type before accessing pthread-specific mutex data structures. Problem noted by Jussi Kivilinna. 2017-05-31 10:55:37 -06:00
Gregory Nutt a8708424c2 pthread_trylock: Fixes a problem in pthread_trylock() noted by initialkjc@yahoo.com. When CONFIG_PTHREAD_MUTEX_UNSAFE=y, the special return value EAGAIN was not being detected due to differences in reporting of returned values. 2017-05-29 07:05:06 -06:00
Gregory Nutt 0de294a586 Fix lots of occurrences of 'the the', 'the there', 'the these', 'the then', 'the they. 2017-05-11 13:35:56 -06:00
Gregory Nutt ba12817f9c Upate some comments 2017-05-11 13:15:31 -06:00
EunBong Song 03bd3688bc pthread: Fix compilation error on pthread_cond_wait when CONFIG_CANCELLATION_POINTS and CONFIG_PTHREAD_MUTEX_UNSAFE are enabled. 2017-05-02 07:14:04 -06:00
Jussi Kivilinna e835803166 yslog: use monotonic clock for timestamp when available 2017-04-26 10:38:15 -06:00
Gregory Nutt d5207efb5a Be consistent... Use Name: consistent in function headers vs Function: 2017-04-21 16:33:14 -06:00
Jussi Kivilinna 33ddaa0b10 clock: add testing for 32-bit overflow of 64-bit system timer 2017-04-21 08:55:07 -06:00
Jussi Kivilinna c57d49f420 clock: Add new type ssystime_t for relative 64-bit ticks, change ticks<->time conversion functions to use ssystime_t 2017-04-21 08:51:31 -06:00
Jussi Kivilinna 325ba1a803 clock: add clock_resynchronize and use subseconds RTC
Add clock_resynchronize for better synchronization of CLOCK_REALTIME and CLOCK_MONOTONIC to match RTC after resume from low-power state.

Add up_rtc_getdatetime_with_subseconds under CONFIG_ARCH_HAVE_RTC_SUBSECONDS to allow initializing (and resynchronizing) system clock with subseconds accuracy RTC.
2017-04-21 08:45:57 -06:00
Nobutaka Toyoshima 150036eb8b sched: Fix tg_flags check with GROUP_FLAG_NOCLDWAIT
Jira: PDFW15IS-208
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2017-04-14 14:50:44 +09:00
Juha Niskanen (Haltian) b4747286b1 Add logic to disable cancellation points within the OS. This is useful when an internal OS function that is NOT a cancellation point calls an OS function which is a cancellation point. In that case, irrecoverable states may occur if the cancellation is within the OS. 2017-04-11 11:03:25 -06:00
Gregory Nutt c08ba10d32 include/: Add some definitions needed by apps/wireless/wapi 2017-04-10 14:56:23 -06:00
Gregory Nutt c36bf090f0 pthread: Minor logic fix in pthread_mutex_consistent. Updat some comments. 2017-04-10 10:10:41 -06:00
Gregory Nutt 948332ca34 pthreads: Backed most of last pthread changes. Found the 'real' root poblem. A one like error in pthread_mutex.c. 2017-04-10 09:51:03 -06:00
Gregory Nutt b51b72b2db pthreads: Re-order some operations so that mutexes are placed in the inconsistent state BEFORE the clean-up callbacks are called. 2017-04-10 08:11:16 -06:00
Jussi Kivilinna dffb8a67e3 Add entropy pool and strong random number generator
Entropy pool gathers environmental noise from device drivers, user-space, etc., and returns good random numbers, suitable for cryptographic use. Based on entropy pool design from *BSDs and uses BLAKE2Xs algorithm for CSPRNG output.

Patch also adds /dev/urandom support for using entropy pool RNG and new 'getrandom' system call for getting randomness without file-descriptor usage (thus avoiding file-descriptor exhaustion attacks). The 'getrandom' interface is similar as 'getentropy' and 'getrandom' available on OpenBSD and Linux respectively.
2017-03-30 07:38:37 -06:00
Gregory Nutt eb344d7260 Fix an assertion noted by Jussi Kivilinna.
This was a consequence of the recent robust mutex changes.  If robust mutexes are selected, then each mutex that a thread takes is retained in a list in threads TCB.  If the thread exits and that list is not empty, then we know that the thread exitted while holding mutexes.  And, in that case, each will be marked as inconsistent and the any waiter for the thread is awakened.

For the case of pthread_mutex_trywait(), the mutex was not being added to the list!  while not usually a fatal error, this was caught by an assertion when pthread_mutex_unlock() was called:  It tried to remove the mutex from the TCB list and it was not there when, of course, it shoule be.

The fix was to add pthread_mutex_trytake() which does sem_trywait() and if successful, does correctly add the mutext to the TCB list.  This should eliminated the assertion.
2017-03-29 07:50:40 -06:00
Gregory Nutt 941360bf12 Correct some spacing 2017-03-27 10:49:41 -06:00
Gregory Nutt b07d3fc305 Rename CONFIG_MUTEX_TYPES to CONFIG_PTHREAD_MUTEX_TYPES 2017-03-27 09:08:14 -06:00
Gregory Nutt f2f798cb29 pthread mutexes: Finish logic to support configuration mutex robustness. 2017-03-27 08:50:45 -06:00
Gregory Nutt 666208cf23 pthread mutexes: Add option to support both unsafe and robust mutexes via pthread_mutexattr_get/setrobust(). 2017-03-26 18:37:24 -06:00
Gregory Nutt 8b3c554e45 pthreads: Add a configuration option to disable robust mutexes and revert to the traditional unsafe mutexes. 2017-03-26 17:37:28 -06:00
Gregory Nutt 86ab384d77 Forget to add some files in previous commits 2017-03-26 15:46:19 -06:00
Gregory Nutt 8b23c16b90 pthreads: pthread_mutex_consistent() needs to clear flags. 2017-03-26 14:44:57 -06:00
Gregory Nutt 34c5e1c18f Minor cleanup from recent changes. 2017-03-26 14:04:07 -06:00
Gregory Nutt 5a69453e16 pthreads: Add some assertions. 2017-03-26 13:54:43 -06:00
Gregory Nutt fe03ef02c4 when pthread exits or is cancelled, mutexes held by thread are marked inconsistent and the highest priority thread waiting for the mutex is awakened. 2017-03-26 13:37:05 -06:00
Gregory Nutt 6e623ce06f pthreads: Partial implementation of final part of robust mutexes: Keep list of all mutexes held by a thread in a list in the TCB. 2017-03-26 12:46:57 -06:00
Gregory Nutt 2c37d369ab pthread: Fix return value of pthread_give/takesemaphore(). Add option to pthread_takesemaphore to ignore EINTR or not. 2017-03-26 11:22:17 -06:00
Gregory Nutt 363403fb1f pthreads: Add more robustness characteristics: pthread_mutex_lock() and trylock() will now return EOWNERDEAD if the mutex is locked by a thread that no longer exists. Add pthread_mutex_consistent() to recover from this situation. 2017-03-26 10:35:23 -06:00
Gregory Nutt 5fb85451cb Update some comments 2017-03-22 08:08:43 -06:00
Gregory Nutt f5a957158d Review of last PR: Setting CONFIG_SMP_NCPUS=1 should only be permitted in a debug configuration. 2017-03-22 06:29:38 -06:00
Masayuki Ishikawa a1f0802855 Kconfig: Change the minimum SMP_NCPUS to 1 2017-03-22 10:04:37 +09:00