Author image Mark Hindley
and 1 contributors

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);

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.

Functions

C API

$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

COPYRIGHT

This module is Copyright (c) 2011 Mark Hindley

All rights reserved.

You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file. If you need more liberal licensing terms, please contact the maintainer.

WARRANTY

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

AUTHOR

Mark Hindley <mark@hindley.org.uk>