aboutsummaryrefslogtreecommitdiff
path: root/sys/i386/linux
diff options
context:
space:
mode:
Diffstat (limited to 'sys/i386/linux')
-rw-r--r--sys/i386/linux/linux.h7
-rw-r--r--sys/i386/linux/linux_misc.c66
-rw-r--r--sys/i386/linux/linux_proto.h12
-rw-r--r--sys/i386/linux/linux_syscall.h6
-rw-r--r--sys/i386/linux/linux_sysent.c6
5 files changed, 88 insertions, 9 deletions
diff --git a/sys/i386/linux/linux.h b/sys/i386/linux/linux.h
index d4cf4104ed7f..47987f70d8d6 100644
--- a/sys/i386/linux/linux.h
+++ b/sys/i386/linux/linux.h
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: linux.h,v 1.32 1999/08/13 14:44:13 marcel Exp $
+ * $Id: linux.h,v 1.33 1999/08/14 17:28:46 marcel Exp $
*/
#ifndef _I386_LINUX_LINUX_H_
@@ -723,4 +723,9 @@ struct linux_ifreq
#define LINUX_CDROM_LBA 0x01
#define LINUX_CDROM_MSF 0x02
+/* Scheduling policies */
+#define LINUX_SCHED_OTHER 0
+#define LINUX_SCHED_FIFO 1
+#define LINUX_SCHED_RR 2
+
#endif /* !_I386_LINUX_LINUX_H_ */
diff --git a/sys/i386/linux/linux_misc.c b/sys/i386/linux/linux_misc.c
index 7d88cb10196a..684a9fcdf7b4 100644
--- a/sys/i386/linux/linux_misc.c
+++ b/sys/i386/linux/linux_misc.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: linux_misc.c,v 1.61 1999/08/11 13:34:30 marcel Exp $
+ * $Id: linux_misc.c,v 1.62 1999/08/15 13:28:35 marcel Exp $
*/
#include "opt_compat.h"
@@ -62,6 +62,8 @@
#include <i386/linux/linux_proto.h>
#include <i386/linux/linux_util.h>
+#include <posix4/sched.h>
+
static unsigned int linux_to_bsd_resource[LINUX_RLIM_NLIMITS] =
{ RLIMIT_CPU, RLIMIT_FSIZE, RLIMIT_DATA, RLIMIT_STACK,
RLIMIT_CORE, RLIMIT_RSS, RLIMIT_NPROC, RLIMIT_NOFILE,
@@ -1254,3 +1256,65 @@ linux_getrlimit(p, uap)
bsd.rlp = uap->rlim;
return ogetrlimit(p, &bsd);
}
+
+int
+linux_sched_setscheduler(p, uap)
+ struct proc *p;
+ struct linux_sched_setscheduler_args *uap;
+{
+ struct sched_setscheduler_args bsd;
+
+#ifdef DEBUG
+ printf("Linux-emul(%ld): sched_setscheduler(%d, %d, %p)\n",
+ (long)p->p_pid, uap->pid, uap->policy, (void *)uap->param);
+#endif
+
+ switch (uap->policy) {
+ case LINUX_SCHED_OTHER:
+ bsd.policy = SCHED_OTHER;
+ break;
+ case LINUX_SCHED_FIFO:
+ bsd.policy = SCHED_FIFO;
+ break;
+ case LINUX_SCHED_RR:
+ bsd.policy = SCHED_RR;
+ break;
+ default:
+ return EINVAL;
+ }
+
+ bsd.pid = uap->pid;
+ bsd.param = uap->param;
+ return sched_setscheduler(p, &bsd);
+}
+
+int
+linux_sched_getscheduler(p, uap)
+ struct proc *p;
+ struct linux_sched_getscheduler_args *uap;
+{
+ struct sched_getscheduler_args bsd;
+ int error;
+
+#ifdef DEBUG
+ printf("Linux-emul(%ld): sched_getscheduler(%d)\n",
+ (long)p->p_pid, uap->pid);
+#endif
+
+ bsd.pid = uap->pid;
+ error = sched_getscheduler(p, &bsd);
+
+ switch (p->p_retval[0]) {
+ case SCHED_OTHER:
+ p->p_retval[0] = LINUX_SCHED_OTHER;
+ break;
+ case SCHED_FIFO:
+ p->p_retval[0] = LINUX_SCHED_FIFO;
+ break;
+ case SCHED_RR:
+ p->p_retval[0] = LINUX_SCHED_RR;
+ break;
+ }
+
+ return error;
+}
diff --git a/sys/i386/linux/linux_proto.h b/sys/i386/linux/linux_proto.h
index be5bc9f4e19a..e5aefb956188 100644
--- a/sys/i386/linux/linux_proto.h
+++ b/sys/i386/linux/linux_proto.h
@@ -2,7 +2,7 @@
* System call prototypes.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from Id: syscalls.master,v 1.20 1999/08/14 18:19:00 marcel Exp
+ * created from Id: syscalls.master,v 1.21 1999/08/15 17:25:56 marcel Exp
*/
#ifndef _LINUX_SYSPROTO_H_
@@ -388,6 +388,14 @@ struct linux_msync_args {
int len; char len_[PAD_(int)];
int fl; char fl_[PAD_(int)];
};
+struct linux_sched_setscheduler_args {
+ pid_t pid; char pid_[PAD_(pid_t)];
+ int policy; char policy_[PAD_(int)];
+ const struct sched_param * param; char param_[PAD_(const struct sched_param *)];
+};
+struct linux_sched_getscheduler_args {
+ pid_t pid; char pid_[PAD_(pid_t)];
+};
struct linux_mremap_args {
caddr_t addr; char addr_[PAD_(caddr_t)];
int old_len; char old_len_[PAD_(int)];
@@ -514,6 +522,8 @@ int linux_llseek __P((struct proc *, struct linux_llseek_args *));
int linux_getdents __P((struct proc *, struct linux_getdents_args *));
int linux_newselect __P((struct proc *, struct linux_newselect_args *));
int linux_msync __P((struct proc *, struct linux_msync_args *));
+int linux_sched_setscheduler __P((struct proc *, struct linux_sched_setscheduler_args *));
+int linux_sched_getscheduler __P((struct proc *, struct linux_sched_getscheduler_args *));
int linux_mremap __P((struct proc *, struct linux_mremap_args *));
int linux_rt_sigaction __P((struct proc *, struct linux_rt_sigaction_args *));
int linux_rt_sigprocmask __P((struct proc *, struct linux_rt_sigprocmask_args *));
diff --git a/sys/i386/linux/linux_syscall.h b/sys/i386/linux/linux_syscall.h
index 9948e9a74d06..963fab589570 100644
--- a/sys/i386/linux/linux_syscall.h
+++ b/sys/i386/linux/linux_syscall.h
@@ -2,7 +2,7 @@
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from Id: syscalls.master,v 1.20 1999/08/14 18:19:00 marcel Exp
+ * created from Id: syscalls.master,v 1.21 1999/08/15 17:25:56 marcel Exp
*/
#define LINUX_SYS_linux_setup 0
@@ -154,8 +154,8 @@
#define LINUX_SYS_munlockall 153
#define LINUX_SYS_sched_setparam 154
#define LINUX_SYS_sched_getparam 155
-#define LINUX_SYS_sched_setscheduler 156
-#define LINUX_SYS_sched_getscheduler 157
+#define LINUX_SYS_linux_sched_setscheduler 156
+#define LINUX_SYS_linux_sched_getscheduler 157
#define LINUX_SYS_sched_yield 158
#define LINUX_SYS_sched_get_priority_max 159
#define LINUX_SYS_sched_get_priority_min 160
diff --git a/sys/i386/linux/linux_sysent.c b/sys/i386/linux/linux_sysent.c
index 8ed6d78579d5..41cce486ee71 100644
--- a/sys/i386/linux/linux_sysent.c
+++ b/sys/i386/linux/linux_sysent.c
@@ -2,7 +2,7 @@
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from Id: syscalls.master,v 1.20 1999/08/14 18:19:00 marcel Exp
+ * created from Id: syscalls.master,v 1.21 1999/08/15 17:25:56 marcel Exp
*/
#include "opt_compat.h"
@@ -170,8 +170,8 @@ struct sysent linux_sysent[] = {
{ 0, (sy_call_t *)munlockall }, /* 153 = munlockall */
{ 2, (sy_call_t *)sched_setparam }, /* 154 = sched_setparam */
{ 2, (sy_call_t *)sched_getparam }, /* 155 = sched_getparam */
- { 3, (sy_call_t *)sched_setscheduler }, /* 156 = sched_setscheduler */
- { 1, (sy_call_t *)sched_getscheduler }, /* 157 = sched_getscheduler */
+ { 3, (sy_call_t *)linux_sched_setscheduler }, /* 156 = linux_sched_setscheduler */
+ { 1, (sy_call_t *)linux_sched_getscheduler }, /* 157 = linux_sched_getscheduler */
{ 0, (sy_call_t *)sched_yield }, /* 158 = sched_yield */
{ 1, (sy_call_t *)sched_get_priority_max }, /* 159 = sched_get_priority_max */
{ 1, (sy_call_t *)sched_get_priority_min }, /* 160 = sched_get_priority_min */