Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 04 Feb 2021 04:13:41 +0000
From:      bugzilla-noreply@freebsd.org
To:        emulation@FreeBSD.org
Subject:   [Bug 249469] [linuxlator] linux_sched_setscheduler fails: Operation not permitted
Message-ID:  <bug-249469-4077-xidGr5Qx1y@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-249469-4077@https.bugs.freebsd.org/bugzilla/>
References:  <bug-249469-4077@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D249469

--- Comment #3 from Alex S <iwtcex@gmail.com> ---
(In reply to Edward Tomasz Napierala from comment #2)

% cat sched.c=20
#define _GNU_SOURCE

#include <assert.h>
#include <pthread.h>
#include <sched.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>

void* thread_start(void* arg) {
  return 0;
}

int main() {

  {
    pthread_attr_t attr;
    assert(pthread_attr_init(&attr) =3D=3D 0);
    assert(pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED) =3D=
=3D 0);

    pthread_t t;
    int err =3D pthread_create(&t, &attr, &thread_start, NULL);
    if (err !=3D 0) {
      fprintf(stderr, "pthread_create: %s\n", strerror(err));
    }

    pthread_attr_destroy(&attr);
  }

  {
    struct sched_param p;
    p.sched_priority =3D 0;
    if (sched_setscheduler(0, SCHED_RESET_ON_FORK, &p) =3D=3D -1) {
      perror("sched_setscheduler");
    }
  }

  {
    struct rlimit rl;
    int err =3D getrlimit(RLIMIT_RTTIME, &rl);
    if (err =3D=3D -1) {
      perror("rlimit");
    }
  }

  return 0;
}
% /compat/linux/bin/gcc sched.c -pthread -o sched
% ./sched=20
pthread_create: Operation not permitted
sched_setscheduler: Invalid argument
rlimit: Invalid argument

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-249469-4077-xidGr5Qx1y>