1. 17 Oct, 2018 1 commit
    • Jan Kiszka's avatar
      cobalt/posix/mqueue: Fix crash after failing registration · 4924717e
      Jan Kiszka authored
      If xnregistry_enter in mq_open fails, the new entry will not be added to
      cobalt_mqq. But the cleanup path taken afterwards will nevertheless try
      to remove it from there. That will cause a crash because the mq->link is
      uninitialized. Fix that by initializing it as list head so that list
      removal becomes harmless, even when the entry is not on any list..
      Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
  2. 05 Dec, 2017 1 commit
    • Greg Gallagher's avatar
      cobalt/rtdm: Split rtdm_fd_enter up · 03b70fea
      Greg Gallagher authored
      split rtdm_fd_enter, move the functionality where we store the fd
      until after the open() call succeeds.  Calls where open() fail a fd is
      left in the tree even after the cleanup code is executed.  If this fd
      number is used again we will fail the call to open until a different
      fd is used.  This patch addresses this situation by not adding the fd
      into the tree until open has succeeded and the fd is valid.
  3. 02 Mar, 2016 1 commit
  4. 29 Feb, 2016 1 commit
  5. 18 Mar, 2015 1 commit
  6. 18 Feb, 2015 1 commit
    • Philippe Gerum's avatar
      cobalt/kernel: sanitize usage of internal copy_to/from helpers · cc47a310
      Philippe Gerum authored
      Unless explicitly paired with access_w/rok() checks, all copy to/from
      helpers should implement the safe form, testing for the basic sanity
      of the address range.
      cobalt_copy_to/from_user() implement the safe call form in replacement
      of __xn_safe_copy_to/from_user(). __xn_copy_to/from_user() still
      implement the unchecked variant, assuming the address range will be
      checked separately.
      Drivers should stick with the rtdm_copy_to/from_user() helpers.
  7. 17 Feb, 2015 1 commit
  8. 13 Feb, 2015 1 commit
  9. 29 Oct, 2014 1 commit
  10. 28 Oct, 2014 1 commit
  11. 17 Oct, 2014 1 commit
  12. 22 Sep, 2014 1 commit
  13. 21 Sep, 2014 2 commits
    • Philippe Gerum's avatar
      cobalt/rtdm, lib/cobalt: unify file descriptor management · 90f104d2
      Philippe Gerum authored
      Use regular kernel file descriptors for all kinds of connection
      handles, referring to regular file objects:
      - connection to devnode => filp on chrdev inode
      - socket => filp on anon inode
      User and kernel-originated connection handles are no more
      The former procfs interface for RTDM is now entirely gone, as all file
      descriptors are now visible from /proc/<pid>/fd.
      Obtaining the list of all named devices can be done this way:
      $ grep named /sys/class/rtdm/*/flags
      Similarly, the list of all protocol devices can be obtained this way:
      $ grep protocol /sys/class/rtdm/*/flags
      Force closing a stuck file descriptor (formerly done by writing to
      rtdm/open_fildes) makes no sense anymore. Either the owner is a
      userland process and all file handles it holds will be automatically
      dropped at exit, or it is a kernel driver, in which case the driver
      direly needs fixing.
    • Philippe Gerum's avatar
      cobalt/rtdm/fd: assume current context is target for all fd ops · 41374b4f
      Philippe Gerum authored
      Except in the only weird case of forcing a close on any random
      kernel-originated connection through the procfs interface
      (open_fildes), but this case is on its way out.
      For the sake of mental sanity, we really want to assume that only the
      current thread may affect its own file table, which is what this patch
      The rtdm_fd cleanup thread is a non-issue, as we are not supposed to
      run any fd ops recursively on behalf of a ->close() handler anyway.
      This change also fixes a rampant inconsistency where a Cobalt user
      thread running some driver code would actually look up into the wrong
      RTDM file table when using the rt_dev_* interface
      (i.e. __xnsys_global_ppd would not be the right context in such a
  14. 09 Sep, 2014 1 commit
  15. 03 Sep, 2014 1 commit
  16. 21 Aug, 2014 1 commit
  17. 14 Aug, 2014 1 commit
  18. 12 Jun, 2014 1 commit
  19. 30 May, 2014 1 commit
    • Philippe Gerum's avatar
      cobalt: include headers explicitly when needed · 75d61004
      Philippe Gerum authored
      include/asm-generic/xenomai/wrappers.h was pulling in all sorts of
      unrelated header files, which have become useless as we dropped most
      This caused a bunch of implementation files to rely on implicit
      inclusion of some common kernel headers, which is wrong. Fix this.
  20. 29 May, 2014 1 commit
  21. 27 May, 2014 1 commit
  22. 16 May, 2014 2 commits
  23. 12 May, 2014 1 commit
  24. 07 Apr, 2014 1 commit
  25. 03 Oct, 2013 2 commits
    • Philippe Gerum's avatar
      cobalt/posix/mq: implement pipelined message allocation · afa6a812
      Philippe Gerum authored
      Message slots released from the receive side are directly transferred
      to threads waiting for them on the send side.
    • Philippe Gerum's avatar
      cobalt/thread: rework thread cancellation handling · 42eb9298
      Philippe Gerum authored
      With the rebasing of Xenomai kernel threads over the regular Linux
      kthreads, we just can't guarantee synchronous deletion with
      xnthread_thread_cancel() anymore. The killed thread will have to reach
      a cancellation point later for the request to be actually fulfilled,
      so that it may wrap up and exit gracefully linux-wise.
      This is actually safer, because kernel threads may associate data to
      the wait context before suspending, and certainly don't want to be
      wiped out, without being allowed to do the wrap up, thus potentially
      leaving stale data.
      e.g. we should allow this:
      list_add(&myself, &some_q);
      To this end, this patch removes all cancellation points from
      xnthread_suspend(), expecting the Xenomai kernel threads to check for
      pending termination requests via a call to xnthread_test_cancel(),
      from within their work loop.
      In addition, the xnthread_prepare/finish_wait() calls have been
      replaced by the xnthread_prepare/complete_wait() pattern, to be used
      as follows:
      	info = xnsynch_sleep_on(&sync, ...);
      	if (info) {
      	   /* process XNRMID, XNBREAK, XNTIMEO as usual. */
      	} else {
      	      * Resource obtained. In addition,
      	      * xnthread_wait_complete_p(&wc) may be called to make
      	      * sure xnthread_complete_wait(wc) was issued for the
      	      * wait context, assuming forced unblocks may happen,
      	      * independently of XNRMID|XNBREAK|XNTIMEO
      	      * (not recommended though).
      	thread = xnsynch_wakeup_one_sleeper(&synch);
      	wc = xnthread_get_wait_context(thread);
      	/* Post resource. */
  26. 28 Sep, 2013 1 commit
  27. 13 Sep, 2013 2 commits
    • Philippe Gerum's avatar
      cobalt/mq: pipeline incoming messages directly to pending waiters · 0140904e
      Philippe Gerum authored
      If the message queue is pended, pass any incoming message directly to
      the first waiter without going through the queue (aka "pipelined
    • Philippe Gerum's avatar
      cobalt/signal: implement thread group sending · 80030246
      Philippe Gerum authored
      When a signal is sent via the kill() interface and the destination
      thread is not waiting for that signal, we try to deliver it to any of
      the threads which belong to the same process. If no thread is waiting
      for this signal, it is queued for the destination thread as usual.
      This change does not affect the behavior of pthread_kill(), which
      remains strictly thread-targeted.
  28. 09 Sep, 2013 2 commits
  29. 10 Aug, 2013 1 commit
    • Philippe Gerum's avatar
      cobalt/kernel: remove pod abstraction entirely · b569cd72
      Philippe Gerum authored
      We don't have full-fledged in-kernel APIs going in and out selectively
      anymore, we now have a stable set of API services (i.e. core, POSIX
      and RTDM), with optional limited extensions through Xenomai
      For this reason, the former "pod" abstraction, as a mean to group
      multiple API siblings in a common generic container is not much
      relevant anymore.
      The ongoing design simplification now allows to drop the pod-related
      services, dispatching them to the other existing abstractions.
      The renaming involved are fairly straightforward for the most part,
      * Former thread-directed ops:
        xnpod_<action>_thread() => xnthread_<action>()
      * Former scheduler-related ops:
        xnpod_<action>() => xnsched_<action>()
      Hint: xnpod_schedule() became xnsched_run() (although xnsched_ule()
      would have been delighting).
  30. 25 Jul, 2013 1 commit
    • Philippe Gerum's avatar
      cobalt/signal: do selective copy of the relevant siginfo bits · 98882071
      Philippe Gerum authored
      struct siginfo is large enough so that we don't want to copy it over
      entirely several times, regardless of the amount of data actually
      conveyed by the relevant si_code.
      This patch limits such copy to the relevant siginfo bits depending on
      the si_code, and makes sure that no more than two copies are required
      for transferring those bits from a sender in kernel space to the
      waiter in user-space.
      To this end, the ->signal_copyinfo() handler is introduced in the
      Cobalt extension ops, for transferring any non-standard bits.
      At this chance, we also fixed the return values of sigwaitinfo() and
      sigtimedwait(), to return the signal number as expected.
  31. 24 Jul, 2013 1 commit
    • Philippe Gerum's avatar
      cobalt: introduce internal extension interface · 76d70338
      Philippe Gerum authored
      Drivers from the RTDM_COBALT class are specifically designed for
      extending the Cobalt/POSIX services. We need a way to expose
      extension-specific handlers in the latter, so that the former may
      change the default behavior at well-defined locations.
      This extension mechanism should not cause any overhead when disabled,
      which is the most common situation. For this reason, the extension
      mechanism is compiled out when CONFIG_XENO_OPT_COBALT_EXTENSION is
      This patch introduces the cobalt_extension abstraction, aimed at
      exposing a series of extension handlers as described previously, on
      a per-thread basis.  Extension drivers should invoke the
      cobalt_thread_extend() and cobalt_thread_restrict() services to
      respectively enable and disable the handlers.
      At this chance, the private data field moved from the core thread
      object (xnthread) to the cobalt_thread structure, since this facility
      is intended for use by Cobalt extension code.
      Cobalt extension drivers should include <rtdm/cobalt.h>, which will
      read in the appropriate kernel headers, useful for implementing the
      add-on features, and interposing on the existing Cobalt services via
      the internal interface. Since these headers a not part of the public
      kernel API, drivers should mention "-Ikernel" in the ccflags-y
      variable from their Kbuild Makefile frag.
  32. 15 Jul, 2013 1 commit
    • Philippe Gerum's avatar
      cobalt: introduce basic support for real-time signals · 7a3f83a2
      Philippe Gerum authored
      This patch introduces basic signal support for real-time threads,
      fully operating from primary mode. Only Xenomai threads can receive
      signals issued by the Cobalt core.
      The following restrictions currently apply:
      - Cobalt-originated signals are always thread-directed. Because Cobalt
        timer services now raise Cobalt signals, timer notification types
        shall be SIGEV_THREAD_ID when specified in a valid sigevent
      - Recipient threads must call sigwait(), sigwaitinfo() or
        sigtimedwait() explicitly to receive signals. There is no support
        for asynchronous handling (i.e. SIGEV_SIGNAL). For this reason, we
        currently don't intercept sigaction(), which still only applies to
        regular linux signals. The same way, signal masking does not apply
        to Cobalt-originated signals since threads must wait for signals for
        receiving them.
      In addition to POSIX timer services, mq_notify() and pthread_kill()
      calls have been rebased over the Cobalt signaling mechanism.
  33. 29 Jun, 2013 1 commit
    • 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.
  34. 21 Jun, 2013 1 commit
  35. 18 Jun, 2013 1 commit
    • 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>/.