[BitVisor-devel:63] restrictシステムコールの名称変更
Takahiro Shinagawa
shina @ ecc.u-tokyo.ac.jp
2015年 11月 20日 (金) 12:59:00 JST
bitvisor-devel の皆様:
東京大学の品川です。お世話になっております。
最近の gcc は C99 の restrict キーワードに対応するようになっているの
ですが、これが bitvisor のプロセスのシステムコール名と競合します。
そこで、restrict システムコールの名称を setlimit に変更することを提
案します。特に異論がなければ bitbucket のレポジトリに push しておきます。
ご検討をよろしくお願い致します。
-------------- next part --------------
diff -r d72f66eb7a0b core/process.c
--- a/core/process.c Thu Nov 19 19:01:03 2015 +0900
+++ b/core/process.c Fri Nov 20 11:28:10 2015 +0900
@@ -71,7 +71,7 @@
int running;
struct msgdsc_data msgdsc[NUM_OF_MSGDSC];
bool exitflag;
- bool restrict;
+ bool setlimit;
int stacksize;
};
@@ -273,7 +273,7 @@
process[pid].mm_phys = phys;
process[pid].running = 0;
process[pid].exitflag = false;
- process[pid].restrict = false;
+ process[pid].setlimit = false;
process[pid].stacksize = PAGESIZE;
if (stacksize > PAGESIZE)
process[pid].stacksize = stacksize;
@@ -488,7 +488,7 @@
buf_user[i].premap_handle = 0;
}
stacksize = process[pid].stacksize;
- sp2 = mm_process_map_stack (stacksize, process[pid].restrict, true);
+ sp2 = mm_process_map_stack (stacksize, process[pid].setlimit, true);
if (!sp2) {
printf ("cannot allocate stack for process\n");
goto mapfail;
@@ -554,7 +554,7 @@
ulong
sys_msgsetfunc (ulong ip, ulong sp, ulong num, ulong si, ulong di)
{
- if (process[currentcpu->pid].restrict)
+ if (process[currentcpu->pid].setlimit)
return (ulong)-1L;
if (si >= 0 && si < NUM_OF_MSGDSC)
return (ulong)_msgsetfunc (currentcpu->pid, si, (void *)di);
@@ -602,7 +602,7 @@
if (!is_range_valid (si, MSG_NAMELEN))
return (ulong)-1L;
- if (process[currentcpu->pid].restrict)
+ if (process[currentcpu->pid].setlimit)
return (ulong)-1L;
memcpy (name, (void *)si, MSG_NAMELEN);
name[MSG_NAMELEN - 1] = '\0';
@@ -635,7 +635,7 @@
if (!is_range_valid (si, MSG_NAMELEN))
return (ulong)-1L;
- if (process[currentcpu->pid].restrict)
+ if (process[currentcpu->pid].setlimit)
return (ulong)-1L;
memcpy (name, (void *)si, MSG_NAMELEN);
name[MSG_NAMELEN - 1] = '\0';
@@ -755,7 +755,7 @@
ulong
sys_msgsenddesc (ulong ip, ulong sp, ulong num, ulong si, ulong di)
{
- if (process[currentcpu->pid].restrict)
+ if (process[currentcpu->pid].setlimit)
return (ulong)-1L;
return _msgsenddesc (currentcpu->pid, si, di);
}
@@ -799,7 +799,7 @@
{
char name[PROCESS_NAMELEN];
- if (process[currentcpu->pid].restrict)
+ if (process[currentcpu->pid].setlimit)
return (ulong)-1L;
memcpy (name, (void *)si, PROCESS_NAMELEN);
name[PROCESS_NAMELEN - 1] = '\0';
@@ -909,13 +909,13 @@
/* si=stack size di=maximum stack size */
static ulong
-sys_restrict (ulong ip, ulong sp, ulong num, ulong si, ulong di)
+sys_setlimit (ulong ip, ulong sp, ulong num, ulong si, ulong di)
{
int r = -1;
virt_t tmp;
spinlock_lock (&process_lock);
- if (process[currentcpu->pid].restrict)
+ if (process[currentcpu->pid].setlimit)
goto ret;
if (si < PAGESIZE)
si = PAGESIZE;
@@ -929,7 +929,7 @@
spinlock_unlock (&process_lock);
panic ("unmap stack failed");
}
- process[currentcpu->pid].restrict = true;
+ process[currentcpu->pid].setlimit = true;
process[currentcpu->pid].stacksize = si;
ret:
spinlock_unlock (&process_lock);
@@ -981,7 +981,7 @@
sys_msgsendbuf,
sys_msgunregister,
sys_exitprocess,
- sys_restrict,
+ sys_setlimit,
};
__attribute__ ((regparm (1))) void
diff -r d72f66eb7a0b process/idman.c
--- a/process/idman.c Thu Nov 19 19:01:03 2015 +0900
+++ b/process/idman.c Fri Nov 20 11:28:10 2015 +0900
@@ -172,7 +172,7 @@
printf ("idman init failed\n");
exitprocess (1);
}
- if (restrict (16384, 8 * 16384)) {
+ if (setlimit (16384, 8 * 16384)) {
printf ("idman restrict failed\n");
exitprocess (1);
}
diff -r d72f66eb7a0b process/lib/lib_syscalls.c
--- a/process/lib/lib_syscalls.c Thu Nov 19 19:01:03 2015 +0900
+++ b/process/lib/lib_syscalls.c Fri Nov 20 11:28:10 2015 +0900
@@ -44,7 +44,7 @@
#define SYS_MSGSENDBUF 11
#define SYS_MSGUNREGISTER 12
#define SYS_EXITPROCESS 13
-#define SYS_RESTRICT 14
+#define SYS_SETLIMIT 14
#ifdef __x86_64__
# define DOSYSCALL0(rb, ra) asm volatile \
@@ -188,10 +188,10 @@
}
int
-restrict (int stacksize, int maxstacksize)
+setlimit (int stacksize, int maxstacksize)
{
ulong tmp;
- DOSYSCALL2 (SYS_RESTRICT, stacksize, maxstacksize, tmp);
+ DOSYSCALL2 (SYS_SETLIMIT, stacksize, maxstacksize, tmp);
return (int)tmp;
}
diff -r d72f66eb7a0b process/lib/lib_syscalls.h
--- a/process/lib/lib_syscalls.h Thu Nov 19 19:01:03 2015 +0900
+++ b/process/lib/lib_syscalls.h Fri Nov 20 11:28:10 2015 +0900
@@ -72,4 +72,4 @@
int msgsendbuf (int desc, int data, struct msgbuf *buf, int bufcnt);
int msgunregister (int desc);
void exitprocess (int retval);
-int restrict (int stacksize, int maxstacksize);
+int setlimit (int stacksize, int maxstacksize);
diff -r d72f66eb7a0b process/storage.c
--- a/process/storage.c Thu Nov 19 19:01:03 2015 +0900
+++ b/process/storage.c Fri Nov 20 11:28:10 2015 +0900
@@ -46,7 +46,7 @@
tmp = alloc (buf[0].len);
memcpy (tmp, buf[0].base, buf[0].len);
storage_init (tmp);
- if (restrict (4096, 32 * 4096)) {
+ if (setlimit (4096, 32 * 4096)) {
printf ("storage restrict failed\n");
exitprocess (1);
}
diff -r d72f66eb7a0b process/vpn.c
--- a/process/vpn.c Thu Nov 19 19:01:03 2015 +0900
+++ b/process/vpn.c Fri Nov 20 11:28:10 2015 +0900
@@ -155,7 +155,7 @@
exitprocess (1);
printf ("vpn (user) init\n");
vpn_user_init (buf[0].base, buf[1].base, buf[1].len);
- if (restrict (16384, 8 * 16384)) { /* stack must be aligned to 16KiB */
+ if (setlimit (16384, 8 * 16384)) { /* stack must be aligned to 16KiB */
printf ("vpn restrict failed\n");
exitprocess (1);
}
BitVisor-devel メーリングリストの案内