1. 16 Aug, 2021 1 commit
  2. 11 Dec, 2020 1 commit
    • Philippe Gerum's avatar
      lib: remove remaining likely/unlikely branch annotations · d9ff7382
      Philippe Gerum authored and Jan Kiszka's avatar Jan Kiszka committed
      In user-space at least, we'd be better off trusting the CPU's branch
      predictor, instead of relying on our limited perception when it comes
      to determining the likeliness of a condition, or every compiler to do
      the right thing with respect to efficient branching.
      We only have a few unlikely predictions in-tree on straightforward
      conditions, which we can remove safely:
      - POSIX condvars wait/signal loops on x86, arm and arm64 showed no
        observable performance penalty.
      - other callers from the thread cancellation path, or debug
        instrumentation are slow paths in essence anyway.
      Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
      Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
  3. 10 Apr, 2019 2 commits
  4. 03 Jul, 2018 2 commits
  5. 17 Jul, 2017 1 commit
  6. 15 Apr, 2017 1 commit
  7. 12 Feb, 2016 1 commit
    • Philippe Gerum's avatar
      cobalt/registry: return -EAGAIN upon lack of registry slot · 364a91b4
      Philippe Gerum authored
      -ENOMEM is confusing in this case, does not actually reflect the error
      condition, and does not match the error code commonly returned by
      POSIX services for denoting a (temporary) lack of resources.
      Besides, this source of error was not even mentioned in the
      documentation of the affected services.
      All error codes must be detected, and any program that might have
      specifically checked for -ENOMEM during error recovery in the affected
      services was potentially confused, so this change does not introduce a
      significant ABI variation.
  8. 17 Nov, 2015 1 commit
  9. 15 Oct, 2015 2 commits
  10. 03 Oct, 2015 1 commit
    • Gilles Chanteperdrix's avatar
      posix/mutex: fix autoinit · dfa9ad71
      Gilles Chanteperdrix authored
      If several threads call simultaneously pthread_mutex_lock() on a mutex
      initialized with PTHREAD_MUTEX_INITIALIZER, the current automatic
      intialization may result in several initializations of the mutex.
      Serialize the automatic initialization with a global mutex to avoid
      This can be done only for automatic initialization, as
      pthread_mutex_init() may be called from a non Xenomai thread, which
      could not sleep on a cobalt mutex, and serializing with a plain Linux
      mutex would cause a switch to secondary mode for pthread_mutex_lock() in
      case of automatic initialization.
      Using a condition variable would create a cancellation point, whereas
      pthread_mutex_lock() and pthread_mutex_unlock() can not be cancellation
  11. 02 Oct, 2015 1 commit
  12. 01 Oct, 2015 1 commit
  13. 16 May, 2015 1 commit
    • Philippe Gerum's avatar
      cobalt/mutex, lib/cobalt: detect attempts to sleep while holding a mutex · e3153cf2
      Philippe Gerum authored
      Going to sleep intentionally while holding a mutex is an application
      issue. When user consistency checks are enabled (XENO_OPT_DEBUG_USER),
      any attempt to do so will trigger a SIGDEBUG signal to the offending
      thread, conveying the SIGDEBUG_RESCNT_SLEEP code.
      This change implicitly disables fast locking optimizations for
      user-space threads when XENO_OPT_DEBUG_USER is enabled. Since the
      debugging code present or future may already add some overhead, this
      seems acceptable anyway.
  14. 11 May, 2015 1 commit
    • Philippe Gerum's avatar
      lib: share the common setup and bootstrap code · 83b0f189
      Philippe Gerum authored
      Make pure POSIX applications and Copperplate-based ones share the same
      auto-init mechanism. This means that all applications now
      automatically recognize a set of base common options, which is
      --cpu-affinity=<cpuset>, --[no-]sanity, --quiet[=level], --silent and
      Applications which do not want Xenomai to interpose on the main()
      routine transparently for handling these options and bootstrapping the
      service libraries may disable this feature by passing the
      --no-auto-init switch to xeno-config when collecting the linker
      flags. In this configuration, the system must be bootstrapped manually
      by a call to xenomai_init() from the application code though.
      This change is C++ friendly, since it also enables the Xenomai high
      level services (e.g. VxWorks, pSOS) before the static constructors
      run, by default.
  15. 26 Mar, 2015 1 commit
  16. 25 Oct, 2014 1 commit
  17. 08 Sep, 2014 1 commit
    • Philippe Gerum's avatar
      cobalt/kernel, lib/cobalt: introduce built-in drivers for user-mapped heaps · 79d53fb8
      Philippe Gerum authored
      We change the way application processes bind to the private and shared
      memory heaps used in fastsync support. Aside of an obscure and
      outdated implementation, using /dev/rtheap for this purpose led to a
      couple of nasty issues:
      - the requirement for abusing mmap()'s offset argument in the no-MMU
        case, so that different processes can map in distinct private heap
      - as a consequence of the previous point, the exposure of kernel
        addresses to userland (passed as differenciating "area" tags in the
        mapping offset) creates an issue with mixed 32/64bit ABI models.
      To fix this, we introduce built-in, RTDM-based memory device drivers
      in the Cobalt kernel (aka "UMM" for user-mapped memory), which expose
      mmap() interfaces for binding to the proper private or shared
      heap. The drivers are called by lib/cobalt when initializing a new
      application process, to perform all the necessary mappings.
      In addition, a third built-in driver honors (read-only) requests to
      get status information about the system heap.
  18. 03 Sep, 2014 1 commit
  19. 21 Aug, 2014 1 commit
  20. 28 Jun, 2014 1 commit
  21. 22 Jun, 2014 1 commit
  22. 15 Jun, 2014 1 commit
  23. 12 Jun, 2014 1 commit
  24. 02 Jun, 2014 1 commit
  25. 20 Feb, 2014 1 commit
  26. 17 Jan, 2014 1 commit
  27. 05 Nov, 2013 1 commit
  28. 09 Sep, 2013 1 commit
    • Philippe Gerum's avatar
      lib/cobalt: switch pthread_create() caller back to primary mode · cea1f8a3
      Philippe Gerum authored
      In addition, cleanup a few wrapped calls to make them unambiguous,
      __COBALT()/__RT() => route to lib/cobalt implementation
      __STD() => route to glibc implementation
      __WRAP() => route to real-time API implementation, defaulting to lib/cobalt
      The latter makes sense as an API may override the lib/cobalt
      implementation of a set of services.
  29. 06 Jul, 2013 2 commits
  30. 03 Jul, 2013 1 commit
  31. 29 Jun, 2013 2 commits
    • Philippe Gerum's avatar
      cobalt/kernel: drop <asm/xenomai/atomic.h> · b251b887
      Philippe Gerum authored
      We define no arch-specific implementations for atomic operations
      anymore. We use the regular linux helpers in kernel code, and generic
      GCC atomic builtins in userland.
      <asm-generic/xenomai/atomic.h> becomes a userland only header.
    • Philippe Gerum's avatar
      cobalt: introduce uapi headers · d928926f
      Philippe Gerum authored
      Following the uapi introduction in recent kernels, this jumbo patch
      splits the former Xenomai POSIX headers into kernel and userland
      counterparts, privatizing the former into the kernel section when
      This change is aimed at centralizing the shared API types and
      definitions used in system calls, making it easier to track changes to
      the APIs that the kernel presents to user space, and solving inclusion
      dependency issues the right way.
      Headers defining the API bits shared between the Cobalt kernel and the
      support libraries in userland are available from include/cobalt/uapi,
      organized as follows:
      - uapi/*.h => Cobalt/POSIX interface bits
      - uapi/rtdm => RTDM bits
      - uapi/sys/*.h => Low-level Cobalt kernel bits
      As a consequence of this split, files below include/cobalt/kernel
      become kernel-only headers, and POSIX headers in include/cobalt are
      exclusively reserved for inclusion in user-space builds.
      As an added benefit, this change significantly reduces the number of
      headers to be installed for building Xenomai applications.
  32. 18 Jun, 2013 2 commits
    • Philippe Gerum's avatar
      lib/cobalt: fix naming for consistency · 12047c2d
      Philippe Gerum authored
      xeno_* identifiers, and all extern symbols become cobalt_*.
      In addition, hidden global variables are prefixed by a double
      This change causes the UAPI level to be increased, due to renaming
      xeno_sigwinch_handler() to cobalt_sigshadow_handler().
    • Philippe Gerum's avatar
      kernel/cobalt: reorganize file hierachy · 629fa126
      Philippe Gerum authored
      The main changes introduced are as follows:
      - Xenomai/cobalt core (nucleus) moved at top level, with the arch-dep
      bits, POSIX and RTDM personalities in sub-directories.
      - Renamed include/cobalt/nucleus to include/cobalt/kernel.
      - include/asm-* directories moved to include/cobalt/.
      - Removal of asm-<arch>/bits, with most code reintroduced as regular
        implementation files into lib/cobalt/sysdeps/<arch>/.
  33. 12 Jun, 2013 2 commits
    • Philippe Gerum's avatar
      cobalt/nucleus: introduce SCHED_WEAK scheduling class · 3667859d
      Philippe Gerum authored
      This code enables support for binding threads from the Linux
      SCHED_FIFO/RR scheduling classes to the Xenomai domain as members of
      the SCHED_WEAK class, with up to 100 priority levels from [0..99]
      included.  When enabled, SCHED_WEAK is the low priority class of the
      Xenomai system, providing no real-time guarantee.
      Members from the SCHED_WEAK class are weakly scheduled by Xenomai,
      only for the purpose of synchronizing with real-time threads from
      other scheduling classes.  However, they cannot compete for CPU
      resources with real-time threads, and leave the primary domain upon
      return from Xenomai syscalls automatically (*).
      This feature is an extension of Xenomai's special handling of
      SCHED_OTHER threads, to the SCHED_FIFO/RR POSIX classes from a regular
      Linux kernel. If disabled, SCHED_WEAK is interpreted as an alias to
      SCHED_OTHER by the Xenomai scheduler, restricted to priority
      0. Conversely, SCHED_OTHER threads are eventually members of Xenomai's
      SCHED_WEAK class at priority 0, when this feature is enabled.
      In the wake of the SCHED_WEAK introduction, automatic propagation of
      updates to the Xenomai scheduling parameters to linux/libc via the
      SIGSHADOW_RENICE signal has been removed.
      (*) Like with SCHED_OTHER, Xenomai assumes no real-time requirement
      for SCHED_WEAK threads. Therefore, they are automatically moved back
      to secondary mode upon return from a Xenomai syscall, unless they hold
      a mutex, which would defer the transition until the mutex is released.
    • Philippe Gerum's avatar
      lib/cobalt: allow for overriding Cobalt service implementation · 1a190ca3
      Philippe Gerum authored
      We provide a mean for overriding Cobalt wrapper routines with
      user-provided routines.
      Each "foo" Cobalt routine shadowing a POSIX service may then appear
      __real_foo() => Original POSIX implementation.
      __cobalt_foo() => Cobalt implementation.
      __wrap_foo() => Weak alias to __cobalt_foo(). May be overriden
      by some extension library.
      Extension libraries overriding some of the shadowed POSIX routines
      shall provide:
      * Their own implementation of the POSIX service as __wrap_foo()
      * An entry for the "foo" symbol in some override definition file, to
      be installed in $(prefix)/lib, and named after the interface. This
      file must have the same format than lib/cobalt/cobalt.wrappers.
      E.g. a new interface "foo" overriding POSIX symbols should install a
      file named $(prefix)/lib/foo.wrappers. This file will be picked
      automatically by the xeno-config script when built for the Cobalt
      The Cobalt implementation of any overriden "foo" routine is still
      callable as __COBALT(foo(args...)). Any call reference to foo() will
      branch to the user-defined implementation overriding Cobalt's.
      e.g. Library "foo" wants to provide its own implementation of service
      		--wrap sched_yield
      		int __wrap_sched_yield(void)
      			/* Eventually branch to Cobalt's version. */
      			return __COBALT(sched_yield());
      A Makefile rule should install lib/foo/foo.wrappers into $(prefix)/lib.
      $ cd buildir
      $ .../xenomai/configure --with-cobalt-override=.../lib/overlib/overlib.wrappers
      NOTE: for pratical reasons, xeno-config and wrap-link.sh scripts
      expect all POSIX wrapper files to match the "*.wrappers" glob pattern.