Move scheduling functions from librt to libc.

Fixes PR/38657.
This commit is contained in:
rmind 2008-07-02 20:05:16 +00:00
parent 30dfdb2897
commit 2a94bd63c1
4 changed files with 55 additions and 18 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.190 2008/06/25 11:19:28 ad Exp $
# $NetBSD: Makefile.inc,v 1.191 2008/07/02 20:05:16 rmind Exp $
# @(#)Makefile.inc 8.3 (Berkeley) 10/24/94
# sys sources
@ -26,7 +26,7 @@ CLEANFILES+= ${_LSRC:MLintSys*.c}
.endif
# glue to offer userland wrappers for some syscalls
SRCS+= posix_fadvise.c posix_madvise.c sigtimedwait.c sigwait.c \
SRCS+= posix_fadvise.c posix_madvise.c sched.c sigtimedwait.c sigwait.c \
sigwaitinfo.c statvfs.c swapon.c
# glue to provide compatibility between GCC 1.X and 2.X and for compat

View File

@ -1,4 +1,4 @@
/* $NetBSD: sched.c,v 1.3 2008/02/09 17:07:54 yamt Exp $ */
/* $NetBSD: sched.c,v 1.1 2008/07/02 20:05:16 rmind Exp $ */
/*
* Copyright (c) 2008, Mindaugas Rasiukevicius <rmind at NetBSD org>
@ -27,14 +27,13 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: sched.c,v 1.3 2008/02/09 17:07:54 yamt Exp $");
__RCSID("$NetBSD: sched.c,v 1.1 2008/07/02 20:05:16 rmind Exp $");
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sched.h>
#include <sys/param.h>
#include <sys/pset.h>
#include <sys/types.h>
/* All LWPs in the process */
@ -120,6 +119,7 @@ sched_get_priority_min(int policy)
}
int
/*ARGSUSED*/
sched_rr_get_interval(pid_t pid, struct timespec *interval)
{
@ -127,14 +127,3 @@ sched_rr_get_interval(pid_t pid, struct timespec *interval)
interval->tv_nsec = sysconf(_SC_SCHED_RT_TS) * 1000;
return 0;
}
/*
* Processor-sets.
*/
int
pset_bind(psetid_t psid, idtype_t idtype, id_t id, psetid_t *opsid)
{
return _pset_bind(idtype, id, P_ALL_LWPS, psid, opsid);
}

View File

@ -1,11 +1,11 @@
# $NetBSD: Makefile,v 1.7 2008/03/10 19:00:21 rmind Exp $
# $NetBSD: Makefile,v 1.8 2008/07/02 20:05:16 rmind Exp $
#
WARNS= 2
LIB= rt
SRCS= sem.c
SRCS+= sched.c
SRCS+= pset.c
MAN+= aio_cancel.3 aio_error.3 aio_fsync.3 aio_read.3 aio_return.3 \
aio_suspend.3 aio_write.3 lio_listio.3 \

48
lib/librt/pset.c Normal file
View File

@ -0,0 +1,48 @@
/* $NetBSD: pset.c,v 1.1 2008/07/02 20:05:16 rmind Exp $ */
/*
* Copyright (c) 2008, Mindaugas Rasiukevicius <rmind at NetBSD org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: pset.c,v 1.1 2008/07/02 20:05:16 rmind Exp $");
#include <sched.h>
#include <sys/pset.h>
#include <sys/types.h>
/* All LWPs in the process */
#define P_ALL_LWPS 0
/*
* Processor-sets.
*/
int
pset_bind(psetid_t psid, idtype_t idtype, id_t id, psetid_t *opsid)
{
return _pset_bind(idtype, id, P_ALL_LWPS, psid, opsid);
}