mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-13 05:41:26 +01:00
Add sched_getcpu()
for compatibility with Linux. Reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32901
This commit is contained in:
parent
43736b71dd
commit
77b2c2f814
@ -47,6 +47,7 @@ __BEGIN_DECLS
|
||||
#if __BSD_VISIBLE
|
||||
int sched_getaffinity(pid_t pid, size_t cpusetsz, cpuset_t *cpuset);
|
||||
int sched_setaffinity(int pid, size_t cpusetsz, const cpuset_t *cpuset);
|
||||
int sched_getcpu(void);
|
||||
#endif /* __BSD_VISIBLE */
|
||||
__END_DECLS
|
||||
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
MIASM:= ${MIASM:Nfreebsd[467]_*}
|
||||
|
||||
SRCS+= __vdso_gettc.c
|
||||
SRCS+= __vdso_gettc.c \
|
||||
sched_getcpu_gen.c
|
||||
|
||||
MDASM= cerror.S \
|
||||
syscall.S \
|
||||
|
@ -1,6 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
SRCS+= __vdso_gettc.c
|
||||
SRCS+= __vdso_gettc.c \
|
||||
sched_getcpu_gen.c
|
||||
|
||||
MDASM= Ovfork.S cerror.S syscall.S
|
||||
|
||||
|
@ -438,6 +438,7 @@ FBSD_1.6 {
|
||||
FBSD_1.7 {
|
||||
sched_getaffinity;
|
||||
sched_setaffinity;
|
||||
sched_getcpu;
|
||||
};
|
||||
|
||||
FBSDprivate_1.0 {
|
||||
|
36
lib/libc/gen/sched_getcpu_gen.c
Normal file
36
lib/libc/gen/sched_getcpu_gen.c
Normal file
@ -0,0 +1,36 @@
|
||||
/*-
|
||||
* Copyright (c) 2021 The FreeBSD Foundation
|
||||
*
|
||||
* This software were developed by Konstantin Belousov <kib@FreeBSD.org>
|
||||
* under sponsorship from the FreeBSD Foundation.
|
||||
*
|
||||
* 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 AUTHOR 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 AUTHOR 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 <sched.h>
|
||||
#include "libc_private.h"
|
||||
|
||||
int
|
||||
sched_getcpu(void)
|
||||
{
|
||||
return (__sys_sched_getcpu());
|
||||
}
|
@ -371,6 +371,7 @@ __ssize_t __sys_recv(int, void *, __size_t, int);
|
||||
__ssize_t __sys_recvfrom(int, void *, __size_t, int, struct sockaddr *,
|
||||
__socklen_t *);
|
||||
__ssize_t __sys_recvmsg(int, struct msghdr *, int);
|
||||
int __sys_sched_getcpu(void);
|
||||
int __sys_select(int, struct fd_set *, struct fd_set *,
|
||||
struct fd_set *, struct timeval *);
|
||||
__ssize_t __sys_sendmsg(int, const struct msghdr *, int);
|
||||
|
@ -1,6 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
SRCS+= trivial-vdso_tc.c
|
||||
SRCS+= trivial-vdso_tc.c \
|
||||
sched_getcpu_gen.c
|
||||
|
||||
MDASM= Ovfork.S cerror.S syscall.S
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $FreeBSD$
|
||||
|
||||
SRCS+= __vdso_gettc.c
|
||||
SRCS+= __vdso_gettc.c \
|
||||
sched_getcpu_gen.c
|
||||
|
||||
MDASM+= cerror.S
|
||||
|
@ -1,4 +1,6 @@
|
||||
# $FreeBSD$
|
||||
|
||||
SRCS+= __vdso_gettc.c
|
||||
SRCS+= __vdso_gettc.c \
|
||||
sched_getcpu_gen.c
|
||||
|
||||
MDASM+= cerror.S
|
||||
|
@ -1,6 +1,7 @@
|
||||
# $FreeBSD$
|
||||
|
||||
SRCS+= __vdso_gettc.c
|
||||
SRCS+= __vdso_gettc.c \
|
||||
sched_getcpu_gen.c
|
||||
|
||||
MDASM= cerror.S \
|
||||
syscall.S \
|
||||
|
@ -36,6 +36,9 @@ SRCS+= \
|
||||
|
||||
SRCS+= getdents.c lstat.c mknod.c stat.c
|
||||
|
||||
NOASM+= sched_getcpu.o
|
||||
PSEUDO+= _sched_getcpu.o
|
||||
|
||||
SRCS+= fstat.c fstatat.c fstatfs.c getfsstat.c statfs.c
|
||||
NOASM+= fstat.o fstatat.o fstatfs.o getfsstat.o statfs.o
|
||||
PSEUDO+= _fstat.o _fstatat.o _fstatfs.o _getfsstat.o _statfs.o
|
||||
|
@ -4,7 +4,8 @@
|
||||
|
||||
SRCS+= \
|
||||
__vdso_gettc.c \
|
||||
pkru.c
|
||||
pkru.c \
|
||||
sched_getcpu_gen.c
|
||||
|
||||
MAN+= \
|
||||
pkru.3
|
||||
|
@ -567,6 +567,7 @@ sbrk
|
||||
##
|
||||
sched_get_priority_max
|
||||
sched_get_priority_min
|
||||
sched_getcpu
|
||||
|
||||
##
|
||||
## Allow various thread/process scheduler operations.
|
||||
|
@ -1181,5 +1181,5 @@
|
||||
const struct spacectl_range32 *rqsr, \
|
||||
int flags, \
|
||||
struct spacectl_range32 *rmsr); }
|
||||
|
||||
581 AUE_NULL NOPROTO { int sched_getcpu(void); }
|
||||
; vim: syntax=off
|
||||
|
@ -686,3 +686,10 @@ sys_yield(struct thread *td, struct yield_args *uap)
|
||||
td->td_retval[0] = 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
sys_sched_getcpu(struct thread *td, struct sched_getcpu_args *uap)
|
||||
{
|
||||
td->td_retval[0] = td->td_oncpu;
|
||||
return (0);
|
||||
}
|
||||
|
@ -3261,6 +3261,9 @@
|
||||
_Out_opt_ struct spacectl_range *rmsr,
|
||||
);
|
||||
}
|
||||
581 AUE_NULL STD|CAPENABLED {
|
||||
int sched_getcpu(void);
|
||||
}
|
||||
|
||||
; Please copy any additions and changes to the following compatability tables:
|
||||
; sys/compat/freebsd32/syscalls.master
|
||||
|
Loading…
Reference in New Issue
Block a user