1*b3d52618Swiz /* $NetBSD: sched.h,v 1.15 2022/08/01 15:16:05 wiz Exp $ */ 2da143054Sthorpej 3da143054Sthorpej /*- 4da143054Sthorpej * Copyright (c) 2001 The NetBSD Foundation, Inc. 5da143054Sthorpej * All rights reserved. 6da143054Sthorpej * 7da143054Sthorpej * This code is derived from software contributed to The NetBSD Foundation 808fd7e9bSthorpej * by Nathan J. Williams. 9da143054Sthorpej * 10da143054Sthorpej * Redistribution and use in source and binary forms, with or without 11da143054Sthorpej * modification, are permitted provided that the following conditions 12da143054Sthorpej * are met: 13da143054Sthorpej * 1. Redistributions of source code must retain the above copyright 14da143054Sthorpej * notice, this list of conditions and the following disclaimer. 15da143054Sthorpej * 2. Redistributions in binary form must reproduce the above copyright 16da143054Sthorpej * notice, this list of conditions and the following disclaimer in the 17da143054Sthorpej * documentation and/or other materials provided with the distribution. 18da143054Sthorpej * 19da143054Sthorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20da143054Sthorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21da143054Sthorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22da143054Sthorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23da143054Sthorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24da143054Sthorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25da143054Sthorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26da143054Sthorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27da143054Sthorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28da143054Sthorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29da143054Sthorpej * POSSIBILITY OF SUCH DAMAGE. 30da143054Sthorpej */ 31da143054Sthorpej 32da143054Sthorpej #ifndef _SCHED_H_ 33da143054Sthorpej #define _SCHED_H_ 34da143054Sthorpej 3508fd7e9bSthorpej #include <sys/cdefs.h> 364be7a2dcSbjh21 #include <sys/featuretest.h> 37da143054Sthorpej #include <sys/sched.h> 38da143054Sthorpej 3908fd7e9bSthorpej /* Required by POSIX 1003.1, section 13.1, lines 12-13. */ 4008fd7e9bSthorpej #include <time.h> 4108fd7e9bSthorpej 4208fd7e9bSthorpej __BEGIN_DECLS 4304392e7fSitojun int sched_setparam(pid_t, const struct sched_param *); 4404392e7fSitojun int sched_getparam(pid_t, struct sched_param *); 4504392e7fSitojun int sched_setscheduler(pid_t, int, const struct sched_param *); 4604392e7fSitojun int sched_getscheduler(pid_t); 4704392e7fSitojun int sched_get_priority_max(int); 4804392e7fSitojun int sched_get_priority_min(int); 4950728e78Schristos #ifndef __LIBC12_SOURCE__ 5050728e78Schristos int sched_rr_get_interval(pid_t, struct timespec *) 5150728e78Schristos __RENAME(__sched_rr_get_interval50); 5250728e78Schristos #endif 5308fd7e9bSthorpej 5408fd7e9bSthorpej int sched_yield(void); 5530b299d9Snathanw int __libc_thr_yield(void); 5608fd7e9bSthorpej __END_DECLS 5708fd7e9bSthorpej 580eaa8971Snathanw #ifndef __LIBPTHREAD_SOURCE__ 590eaa8971Snathanw #define sched_yield __libc_thr_yield 600eaa8971Snathanw #endif /* __LIBPTHREAD_SOURCE__ */ 610eaa8971Snathanw 6208fd7e9bSthorpej __BEGIN_DECLS 639b24696cSrmind 64da319759Swiz #if defined(_NETBSD_SOURCE) 65da319759Swiz 669b24696cSrmind /* Process affinity functions (not portable) */ 679b24696cSrmind int sched_getaffinity_np(pid_t, size_t, cpuset_t *); 689b24696cSrmind int sched_setaffinity_np(pid_t, size_t, cpuset_t *); 699b24696cSrmind 70da319759Swiz #endif /* _NETBSD_SOURCE */ 71da319759Swiz 72da319759Swiz #if defined(_GNU_SOURCE) 73da319759Swiz 74d7c5f8bdSwiz /* 75d7c5f8bdSwiz * Historical functions, not defined in standard 76*b3d52618Swiz * Linux man page documents clone() as only available when 77d7c5f8bdSwiz * _GNU_SOURCE is defined 78d7c5f8bdSwiz */ 7919b7469aSperry pid_t clone(int (*)(void *), void *, int, void *); 80*b3d52618Swiz #endif /* _GNU_SOURCE */ 81*b3d52618Swiz 82*b3d52618Swiz #if defined(_NETBSD_SOURCE) 83*b3d52618Swiz 8419b7469aSperry pid_t __clone(int (*)(void *), void *, int, void *); 859b24696cSrmind 86*b3d52618Swiz #endif /* _NETBSD_SOURCE */ 87da143054Sthorpej 88da319759Swiz __END_DECLS 89da143054Sthorpej 90da143054Sthorpej #endif /* _SCHED_H_ */ 91