Menu

#27 UpnpInit fails when process cannot alter its own scheduling

closed-duplicate
None
5
2010-03-21
2010-03-13
No

The ThreadPool management attempts to call sched_setscheduler() and pthread_setschedparam(), in order to set the thread scheduling priorities for the tasks in its various pools. It returns an error if the scheduling calls fail.

These calls do indeed fail with EPERM when running as non-root on FreeBSD (and, apparently, on Gnu Hurd although I don't have an installation of that one). According to POSIX it is implementation defined as to whether a process may be allowed to alter its own scheduling priorities and parameters. Linux apparently allows it; the others don't.

The result of this is that libupnp will only run as root on FreeBSD and cannot be used by a user application.

Quick way to test this is to do a "make check" as a non-root user, which will fail if the calls are not permitted.

I'm working on a patch to assume a good result if the scheduler calls return EPERM. It seems to me that, in this case, we will just fall back to our own three priority pools. Does this sound an OK workaround ?

Discussion

  • Nick Leverton

    Nick Leverton - 2010-03-13
    • summary: UpnpInit fails when process cannot alter its own priority --> UpnpInit fails when process cannot alter its own scheduling
     
  • Nick Leverton

    Nick Leverton - 2010-03-14

    Patch to allow scheduling calls to fail with EPERM

     
  • Nick Leverton

    Nick Leverton - 2010-03-14

    The attached patch seems to work and allows libupnp to run as non-root on freeBSD.

     
  • Nick Leverton

    Nick Leverton - 2010-03-19

    This patch now included in libupnp-1.8.0-bsd-v4.patch from issue https://sourceforge.net/support/tracker.php?aid=2969188

     
  • Marcelo Roberto Jimenez

    • assigned_to: nobody --> mroberto
    • status: open --> closed-duplicate
     
MongoDB Logo MongoDB