Commit c7dade09 authored by Florian Bezdeka's avatar Florian Bezdeka Committed by Jan Kiszka
Browse files

testsuite/smokey/leaks: Adding checks for procfs exports

Make sure that named semaphores as well as mqueues are exported to the
Signed-off-by: default avatarFlorian Bezdeka <>
[Jan: delay procfs_exists to account for asynchronous /proc update]
Signed-off-by: Jan Kiszka's avatarJan Kiszka <>
parent 818a7e0a
......@@ -28,6 +28,7 @@
#include <pthread.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <semaphore.h>
#include <mqueue.h>
#include <signal.h>
......@@ -71,6 +72,27 @@ const char *memdev[] = {
static int memdevfd[3];
static int procfs_exists(const char *type, const char *name)
struct stat s;
char path[128];
int ret;
/* Ignore if the kernel seems to be compiled without procfs support */
if (stat("/proc/xenomai", &s) || !S_ISDIR(s.st_mode))
return 0;
/* Give the core some time to populate /proc with the new entry */
ret = snprintf(path, 128, "%s/%s/%s", "/proc/xenomai/registry/posix",
type, &name[1]);
if (ret < 0)
return -EINVAL;
return smokey_check_errno(stat(path, &s));
static unsigned long long get_used(void)
struct cobalt_memdev_stat statbuf;
......@@ -121,6 +143,10 @@ static inline int subprocess_leak(void)
if (ret)
return ret;
ret = procfs_exists("sem", SEM_NAME);
if (ret)
return ret;
sevt.sigev_notify = SIGEV_THREAD_ID;
sevt.sigev_signo = SIGALRM;
sevt.sigev_notify_thread_id = syscall(__NR_gettid);
......@@ -132,6 +158,10 @@ static inline int subprocess_leak(void)
if (ret < 0)
return ret;
ret = procfs_exists("mqueue", MQ_NAME);
if (ret)
return ret;
return 0;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment