LCOV - code coverage report
Current view: top level - lib/missing - ioprio.h (source / functions) Hit Total Coverage
Test: coverage.info.cleaned Lines: 2 2 100.0 %
Date: 2023-04-18 16:19:03 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /*
       2             :  * lwan - web server
       3             :  * Copyright (c) 2018 L. A. F. Pereira <l@tia.mat.br>
       4             :  *
       5             :  * This program is free software; you can redistribute it and/or
       6             :  * modify it under the terms of the GNU General Public License
       7             :  * as published by the Free Software Foundation; either version 2
       8             :  * of the License, or any later version.
       9             :  *
      10             :  * This program is distributed in the hope that it will be useful,
      11             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      12             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      13             :  * GNU General Public License for more details.
      14             :  *
      15             :  * You should have received a copy of the GNU General Public License
      16             :  * along with this program; if not, write to the Free Software
      17             :  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
      18             :  * USA.
      19             :  */
      20             : 
      21             : #pragma once
      22             : 
      23             : #include <sys/syscall.h>
      24             : #include <unistd.h>
      25             : 
      26             : #if defined(__linux__) && defined(SYS_ioprio_set)
      27             : 
      28             : #define IOPRIO_WHO_PROCESS 1
      29             : #define IOPRIO_CLASS_IDLE 3
      30             : #define IOPRIO_PRIO_VALUE(class, data) (((class) << 13) | (data))
      31             : 
      32         184 : static inline int ioprio_set(int which, int who, int ioprio)
      33             : {
      34         184 :     return (int)syscall(SYS_ioprio_set, which, who, ioprio);
      35             : }
      36             : 
      37             : #else
      38             : 
      39             : #define IOPRIO_WHO_PROCESS 0
      40             : #define IOPRIO_PRIO_VALUE(arg1, arg2) 0
      41             : #define IOPRIO_CLASS_IDLE 0
      42             : 
      43             : static inline int ioprio_set(int which __attribute__((unused)),
      44             :                              int who __attribute__((unused)),
      45             :                              int ioprio __attribute__((unused)))
      46             : {
      47             :     return 0;
      48             : }
      49             : 
      50             : #endif

Generated by: LCOV version 1.15-2-gb9d6727