logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Linux::IO_Prio - Interface to Linux ioprio_set and ioprio_get via syscall or ionice wrapper.

Author

       Mark Hindley <mark@hindley.org.uk>

perl v5.40.1                                       2025-08-10                                Linux::IO_Prio(3pm)

Description

       Use ioprio_get(2) and ioprio_set(2) from Perl.  Only Linux is supported currently. Support for other
       unices will be added once the kernel capabilities are available.

Exports

       Nothing by default.

       The required exports can be specified individually or by tag:

       :ionice -- ionice ionice_data ionice_class
       :c_api -- ioprio_set ioprio_get
       :macro -- IOPRIO_PRIO_VALUE IOPRIO_PRIO_CLASS IOPRIO_PRIO_DATA
       :who -- IOPRIO_WHO_PROCESS IOPRIO_WHO_PGRP IOPRIO_WHO_USER
       :class -- IOPRIO_CLASS_NONE IOPRIO_CLASS_RT IOPRIO_CLASS_BE IOPRIO_CLASS_IDLE
       :all -- all the above

       ionice(), ionice_class() and ionice_data() are thin wrappers around the C API allowing conventient single
       function  calls.  All of the other exports have the same meaning and prototypes as the C API equivalents.
       See man ioprio_set(2) for further details.

   FunctionsCAPI

       $priority = ioprio_get($which, $who)
       $staus = ioprio_set($which, $who, $priority)

       Wrappers

       $status = ionice($which, $who, $class, $data)
       $class = ionice_class($which, $who)
       $data = ionice_data($which, $who)

   MACROS
       $priority = IOPRIO_PRIO_VALUE($class, $data)
       $class = IOPRIO_PRIO_CLASS($mask)
       $data = IOPRIO_PRIO_DATA ($mask)

   CONSTANTS
       IOPRIO_WHO_PROCESS
       IOPRIO_WHO_PGRP
       IOPRIO_WHO_USER
       IOPRIO_CLASS_NONE
       IOPRIO_CLASS_RT
       IOPRIO_CLASS_BE
       IOPRIO_CLASS_IDLE

Name

       Linux::IO_Prio - Interface to Linux ioprio_set and ioprio_get via syscall or ionice wrapper.

Synopsis

               use Linux::IO_Prio qw(:all);

               my $status = ioprio_set(IOPRIO_WHO_PROCESS, $$,
                       IOPRIO_PRIO_VALUE(IOPRIO_CLASS_IDLE, 0));

               my $status = ionice(IOPRIO_WHO_PROCESS, $$, IOPRIO_CLASS_IDLE, 0);

Warranty

       This is free software. IT COMES WITHOUT WARRANTY OF ANY KIND.

See Also