From patchwork Wed Aug 5 21:47:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 40220 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 35350386103B; Wed, 5 Aug 2020 21:47:44 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from hera.aquilenet.fr (hera.aquilenet.fr [185.233.100.1]) by sourceware.org (Postfix) with ESMTPS id 9004D3861001 for ; Wed, 5 Aug 2020 21:47:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9004D3861001 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=samuel.thibault@ens-lyon.org Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id A2F1E10CB5; Wed, 5 Aug 2020 23:47:38 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SBhqfCoII0qD; Wed, 5 Aug 2020 23:47:37 +0200 (CEST) Received: from function (lfbn-bor-1-797-11.w86-234.abo.wanadoo.fr [86.234.239.11]) by hera.aquilenet.fr (Postfix) with ESMTPSA id C5AED10AFD; Wed, 5 Aug 2020 23:47:37 +0200 (CEST) Received: from samy by function with local (Exim 4.94) (envelope-from ) id 1k3RG4-001cX3-O2; Wed, 05 Aug 2020 23:47:36 +0200 From: Samuel Thibault To: libc-alpha@sourceware.org Subject: [hurd,commited] hurd: Implement basic sched_get/setscheduler Date: Wed, 5 Aug 2020 23:47:36 +0200 Message-Id: <20200805214736.386404-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_PASS, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: commit-hurd@gnu.org Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" * sysdeps/mach/hurd/sched_gets.c: New file. * sysdeps/mach/hurd/sched_sets.c: New file. --- sysdeps/mach/hurd/sched_gets.c | 30 +++++++++++++++++++++++ sysdeps/mach/hurd/sched_sets.c | 45 ++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 sysdeps/mach/hurd/sched_gets.c create mode 100644 sysdeps/mach/hurd/sched_sets.c diff --git a/sysdeps/mach/hurd/sched_gets.c b/sysdeps/mach/hurd/sched_gets.c new file mode 100644 index 0000000000..9fe31ce79e --- /dev/null +++ b/sysdeps/mach/hurd/sched_gets.c @@ -0,0 +1,30 @@ +/* Copyright (C) 2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include + + +/* Retrieve scheduling algorithm for a particular purpose. */ +int +__sched_getscheduler (pid_t pid) +{ + return SCHED_OTHER; +} +weak_alias (__sched_getscheduler, sched_getscheduler) diff --git a/sysdeps/mach/hurd/sched_sets.c b/sysdeps/mach/hurd/sched_sets.c new file mode 100644 index 0000000000..54d368abf5 --- /dev/null +++ b/sysdeps/mach/hurd/sched_sets.c @@ -0,0 +1,45 @@ +/* Copyright (C) 1996-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include + + +/* Set scheduling algorithm and/or parameters for a process. */ +int +__sched_setscheduler (pid_t pid, int policy, const struct sched_param *param) +{ + switch (policy) + { + case SCHED_OTHER: + if (param->sched_priority != 0) + return __hurd_fail (EINVAL); + break; + + case SCHED_FIFO: + case SCHED_RR: + return __hurd_fail (ENOTSUP); + + default: + return EINVAL; + } + return 0; +} +libc_hidden_def (__sched_setscheduler) +weak_alias (__sched_setscheduler, sched_setscheduler)