Message type for {PM,VFS,RS,DS}_GETSYSINFO

Change-Id: I64d89f8a1c4704d0d0f420eb1e434cc96fd6351a
This commit is contained in:
Lionel Sambuc 2014-05-19 11:37:26 +02:00
parent 948a5389f9
commit ec130c9b4b
7 changed files with 26 additions and 24 deletions

View file

@ -1226,15 +1226,6 @@
#define RTCDEV_Y2KBUG 0x01 /* Interpret 1980 as 2000 for RTC w/Y2K bug */
#define RTCDEV_CMOSREG 0x02 /* Also set the CMOS clock register bits. */
/*===========================================================================*
* Field names shared across several call codes *
*===========================================================================*/
/* Field names for the getsysinfo(2) call. */
#define SI_WHAT m1_i1 /* int */
#define SI_WHERE m1_p1 /* void */
#define SI_SIZE m1_i2 /* size_t */
/*===========================================================================*
* Internal codes used by several services *
*===========================================================================*/

View file

@ -680,6 +680,15 @@ typedef struct {
} mess_linputdriver_input_event;
_ASSERT_MSG_SIZE(mess_linputdriver_input_event);
typedef struct {
int what;
vir_bytes where;
size_t size;
uint8_t padding[44];
} mess_lsys_getsysinfo;
_ASSERT_MSG_SIZE(mess_lsys_getsysinfo);
typedef struct {
uint32_t flags;
endpoint_t endpoint;
@ -1364,6 +1373,8 @@ typedef struct {
mess_linputdriver_input_event m_linputdriver_input_event;
mess_lsys_getsysinfo m_lsys_getsysinfo;
mess_lsys_krn_schedctl m_lsys_krn_schedctl;
mess_lsys_krn_schedule m_lsys_krn_schedule;

View file

@ -25,8 +25,8 @@ int getsysinfo(
}
memset(&m, 0, sizeof(m));
m.SI_WHAT = what;
m.SI_WHERE = where;
m.SI_SIZE = size;
m.m_lsys_getsysinfo.what = what;
m.m_lsys_getsysinfo.where = where;
m.m_lsys_getsysinfo.size = size;
return _taskcall(who, call_nr, &m);
}

View file

@ -634,7 +634,7 @@ int do_getsysinfo(const message *m_ptr)
size_t length;
int s;
switch(m_ptr->SI_WHAT) {
switch(m_ptr->m_lsys_getsysinfo.what) {
case SI_DATA_STORE:
src_addr = (vir_bytes)ds_store;
length = sizeof(struct data_store) * NR_DS_KEYS;
@ -643,11 +643,11 @@ int do_getsysinfo(const message *m_ptr)
return EINVAL;
}
if (length != m_ptr->SI_SIZE)
if (length != m_ptr->m_lsys_getsysinfo.size)
return EINVAL;
if (OK != (s=sys_datacopy(SELF, src_addr,
m_ptr->m_source, (vir_bytes)m_ptr->SI_WHERE, length))) {
m_ptr->m_source, m_ptr->m_lsys_getsysinfo.where, length))) {
printf("DS: copy failed: %d\n", s);
return s;
}

View file

@ -139,7 +139,7 @@ int do_getsysinfo()
return EPERM;
}
switch(m_in.SI_WHAT) {
switch(m_in.m_lsys_getsysinfo.what) {
case SI_PROC_TAB: /* copy entire process table */
src_addr = (vir_bytes) mproc;
len = sizeof(struct mproc) * NR_PROCS;
@ -154,10 +154,10 @@ int do_getsysinfo()
return(EINVAL);
}
if (len != m_in.SI_SIZE)
if (len != m_in.m_lsys_getsysinfo.size)
return(EINVAL);
dst_addr = (vir_bytes) m_in.SI_WHERE;
dst_addr = m_in.m_lsys_getsysinfo.where;
return sys_datacopy(SELF, src_addr, who_e, dst_addr, len);
}

View file

@ -874,7 +874,7 @@ message *m_ptr;
if((s = check_call_permission(m_ptr->m_source, 0, NULL)) != OK)
return s;
switch(m_ptr->SI_WHAT) {
switch(m_ptr->m_lsys_getsysinfo.what) {
case SI_PROC_TAB:
src_addr = (vir_bytes) rproc;
len = sizeof(struct rproc) * NR_SYS_PROCS;
@ -887,11 +887,11 @@ message *m_ptr;
return(EINVAL);
}
if (len != m_ptr->SI_SIZE)
if (len != m_ptr->m_lsys_getsysinfo.size)
return(EINVAL);
dst_proc = m_ptr->m_source;
dst_addr = (vir_bytes) m_ptr->SI_WHERE;
dst_addr = m_ptr->m_lsys_getsysinfo.where;
return sys_datacopy(SELF, src_addr, dst_proc, dst_addr, len);
}

View file

@ -56,9 +56,9 @@ int do_getsysinfo(void)
size_t len, buf_size;
int what;
what = job_m_in.SI_WHAT;
dst_addr = (vir_bytes) job_m_in.SI_WHERE;
buf_size = (size_t) job_m_in.SI_SIZE;
what = job_m_in.m_lsys_getsysinfo.what;
dst_addr = job_m_in.m_lsys_getsysinfo.where;
buf_size = job_m_in.m_lsys_getsysinfo.size;
/* Only su may call do_getsysinfo. This call may leak information (and is not
* stable enough to be part of the API/ABI). In the future, requests from