Low latency / Realtime programming

Hey, I saw that there will be a PREEMT_RT Kernel for Ubuntu Core and i wondered if it is possible to use realtime priorities with SCHED_FIFO in a strict confined snap.

So I came up with a minimal example which just sets a relatime priority and waits for a user input:

src/prio-test.c:

#include <errno.h>
#include <pthread.h>
#include <stdio.h>

#define TARGET_RT_PRIO 5

int main() {
  printf("setting rt prio: ");
  struct sched_param schedParam;
  schedParam.sched_priority = -1;
  int policy = -1;
  if (pthread_getschedparam(pthread_self(), &policy, &schedParam) != 0) {
    printf("could not get scheduling params, errno: %i\n", errno);
    return -1;
  }

  schedParam.sched_priority = TARGET_RT_PRIO;
  int targetPolicy = SCHED_FIFO;
  if (pthread_setschedparam(pthread_self(), targetPolicy, &schedParam) != 0) {
    printf("failed to set scheduling params, errno: %i\n", errno);
    return -1;
  }

  printf("success!\n");
  printf("you can now examine the priorities (e.g via htop). Press any key to "
         "quit.\n");
  getchar();

  return 0;
}

src/CMakeLists.txt

project("prio-test")
add_executable(prio-test prio-test.c)
install(TARGETS prio-test)

snap/snapcraft.yml:

name: rtprio-test 
base: core20 
version: '0.1' 
summary: realtime priority test
description: "realtime priority test"
grade: stable
confinement: strict 
apps:
  rtprio-test:
    command: usr/bin/prio-test
    plugs:
      - process-control

parts:
  rtprio-test:
    plugin: cmake
    source: src
    cmake-parameters:
      - -DCMAKE_INSTALL_PREFIX=/usr
    build-packages:
      - g++

When i run this with sudo (or even without sudo), it first seems that everything works fine (pthread_setschedparam returns 0, indicating success) but inspecting the process with htop reveals, that the processes priority is not actually 5 (-6 in htop respectively) but still the normal 0 (20 in htop respectively).

I guess the fact that pthread_setschedparam returns success indicates that apparmor is filtering this? I could not find an interface for using realtime priorities. As you can see in the snapcraft.yml, I tried process-control but that does not seem to make a difference.

So is there any way to use realtime priorities in a strict confined snap?