/* This file is part of the KDE Project SPDX-FileCopyrightText: 2008 Sebastian Trueg Parts of this file are based on code from Strigi SPDX-FileCopyrightText: 2006-2007 Jos van den Oever SPDX-License-Identifier: LGPL-2.0-or-later */ #include "priority.h" #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include #include #include #include #ifndef _WIN32 #include #include #include #endif #ifdef SYS_ioprio_set namespace { #ifndef IOPRIO_CLASS_IDLE enum { IOPRIO_CLASS_NONE, IOPRIO_CLASS_RT, IOPRIO_CLASS_BE, IOPRIO_CLASS_IDLE, }; #endif #ifndef IOPRIO_WHO_PROCESS enum { IOPRIO_WHO_PROCESS = 1, IOPRIO_WHO_PGRP, IOPRIO_WHO_USER, }; #endif #ifndef IOPRIO_CLASS_SHIFT const int IOPRIO_CLASS_SHIFT = 13; #endif } #endif bool lowerIOPriority() { #ifdef SYS_ioprio_set if ( syscall( SYS_ioprio_set, IOPRIO_WHO_PROCESS, 0, IOPRIO_CLASS_IDLE<