UML kernel reads polling interval from a config file

This commit is contained in:
Gerard Wagener 2010-01-18 11:57:07 +01:00
parent f8290a30db
commit d8d6d4450a
5 changed files with 38 additions and 6 deletions

View file

@ -0,0 +1,12 @@
#ifndef __AHA_DEFS__
#define __AHA_DEFS__
/* Global variables used for the aha framework */
/* Polling delay for sys_execve. AHA polls the permissions for each system call.
* The delay must be expressed in ms
* This delay is read once in the main from the conf/polldelay file. Thus one
* write. Each sys_execve calls read then this global variable
*/
extern int __aha_poll_delay;
#define AHA_DEF_POLL_DELAY 100
#endif

View file

@ -1,6 +1,5 @@
#ifndef AHA
#define AHA
#define AHA_DEBUG
#include "linux/kernel.h" /* printk is declared there */
//#include "linux/gfp.h" /* GFP_KERNEL */
@ -18,7 +17,7 @@
//#include "skas.h"
#include "os.h"
#include "linux/delay.h"
#include "aha-defs.h"
/*FIXME use AHA name space */
#define MAX_DUMP_BUF 512
struct ReplyMessage{

View file

@ -170,9 +170,8 @@ void aha_get_reply_message(char* key, struct ReplyMessage *msg)
filename[0]=0;
snprintf((char*)filename,128,"in/%s",key);
/* Give AHA the time to write the reply */
msleep_interruptible(50);
msleep_interruptible(__aha_poll_delay);
fd = os_open_file(filename, of_read(OPENFLAGS()), 0);
if ( fd < 0 ) {
AHA_PRINTK("Could not open reply file: %s\n",filename);
@ -224,3 +223,4 @@ void aha_record_sys_clone(int pid, int ppid)
#undef filename__size
#undef buf__size
}

View file

@ -9,7 +9,7 @@ obj-y = aio.o elf_aux.o execvp.o file.o helper.o irq.o main.o mem.o process.o \
USER_OBJS := $(user-objs-y) aio.o elf_aux.o execvp.o file.o helper.o irq.o \
main.o mem.o process.o registers.o sigio.o signal.o start_up.o time.o \
tty.o tls.o uaccess.o umid.o util.o
tty.o tls.o uaccess.o umid.o util.o aha.o
CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH)

View file

@ -16,11 +16,13 @@
#include "kern_util.h"
#include "os.h"
#include "um_malloc.h"
#include "aha-defs.h"
#define PGD_BOUND (4 * 1024 * 1024)
#define STACKSIZE (8 * 1024 * 1024)
#define THREAD_NAME_LEN (256)
int __aha_poll_delay;
static void set_stklim(void)
{
struct rlimit lim;
@ -38,6 +40,24 @@ static void set_stklim(void)
}
}
/* Read the polling delay from the conf/polldelay file.
* On sucess the polling value is returned.
* On failure a hardcoded default value is returned.
*/
int aha_read_poll_delay(void)
{
FILE *fp;
int ret;
ret = AHA_DEF_POLL_DELAY;
fp = fopen("conf/polldelay","r");
if (fp){
if (fscanf(fp,"%d",(int*)&ret)<=0)
ret = AHA_DEF_POLL_DELAY;
fclose(fp);
}
return ret;
}
static __init void do_uml_initcalls(void)
{
initcall_t *call;
@ -47,6 +67,7 @@ static __init void do_uml_initcalls(void)
(*call)();
call++;
}
__aha_poll_delay=aha_read_poll_delay();
}
static void last_ditch_exit(int sig)