RS_LOOKUP feature for libc functions that want to access servers.
let ipc talk to all USER processes and vice versa. pm sig wrapper notify has to be called from two files. actually install include files.
This commit is contained in:
parent
a5599efd9c
commit
32fa22fc2d
8 changed files with 54 additions and 9 deletions
|
@ -395,6 +395,7 @@ driver ipc
|
|||
TTY
|
||||
DS
|
||||
VM
|
||||
USER
|
||||
;
|
||||
vm
|
||||
REMAP
|
||||
|
|
|
@ -8,11 +8,11 @@ all::
|
|||
clean::
|
||||
|
||||
install::
|
||||
#-rm -rf $(INC)
|
||||
#mkdir -p $(INC)
|
||||
#cpdir . $(INC)
|
||||
#@chown -R bin $(INC)
|
||||
#@rm -f $(INC)/Makefile
|
||||
-rm -rf $(INC)
|
||||
mkdir -p $(INC)
|
||||
cpdir . $(INC)
|
||||
@chown -R bin $(INC)
|
||||
@rm -f $(INC)/Makefile
|
||||
|
||||
gcc: install
|
||||
SHELL=/bin/sh; if [ -f $(MKHEADERS343) ] ; then sh -e $(MKHEADERS343) ; fi
|
||||
|
|
|
@ -636,7 +636,7 @@
|
|||
* arguments are passed in
|
||||
* a struct rs_start
|
||||
*/
|
||||
#define RS_LOOKUP (DS_RQ_BASE + 8) /* lookup server name */
|
||||
#define RS_LOOKUP (RS_RQ_BASE + 8) /* lookup server name */
|
||||
|
||||
# define RS_CMD_ADDR m1_p1 /* command string */
|
||||
# define RS_CMD_LEN m1_i1 /* length of command */
|
||||
|
|
|
@ -90,6 +90,8 @@ _PROTOTYPE( int do_sigprocmask, (void) );
|
|||
_PROTOTYPE( int do_sigreturn, (void) );
|
||||
_PROTOTYPE( int do_sigsuspend, (void) );
|
||||
_PROTOTYPE( void check_pending, (struct mproc *rmp) );
|
||||
_PROTOTYPE( int, vm_notify_sig_wrapper(endpoint_t ep) );
|
||||
|
||||
|
||||
/* time.c */
|
||||
_PROTOTYPE( int do_stime, (void) );
|
||||
|
|
|
@ -306,7 +306,7 @@ PUBLIC int do_pause()
|
|||
return(SUSPEND);
|
||||
}
|
||||
|
||||
PRIVATE vm_notify_sig_wrapper(endpoint_t ep)
|
||||
PUBLIC vm_notify_sig_wrapper(endpoint_t ep)
|
||||
{
|
||||
/* get IPC's endpoint,
|
||||
* the reason that we directly get the endpoint
|
||||
|
|
|
@ -91,9 +91,9 @@ PUBLIC int main(void)
|
|||
continue;
|
||||
}
|
||||
|
||||
/* Only root can make calls to rs */
|
||||
/* Only root can make calls to rs. unless it's RS_LOOKUP. */
|
||||
euid= getpeuid(m.m_source);
|
||||
if (euid != 0)
|
||||
if (euid != 0 && call_nr != RS_LOOKUP)
|
||||
{
|
||||
printf("RS: got unauthorized request %d from endpoint %d\n",
|
||||
call_nr, m.m_source);
|
||||
|
@ -111,6 +111,7 @@ PUBLIC int main(void)
|
|||
case RS_RESTART: result = do_restart(&m); break;
|
||||
case RS_SHUTDOWN: result = do_shutdown(&m); break;
|
||||
case GETSYSINFO: result = do_getsysinfo(&m); break;
|
||||
case RS_LOOKUP: result = do_lookup(&m); break;
|
||||
default:
|
||||
printf("Warning, RS got unexpected request %d from %d\n",
|
||||
m.m_type, m.m_source);
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <minix/dmap.h>
|
||||
#include <minix/ds.h>
|
||||
#include <minix/endpoint.h>
|
||||
#include <minix/vm.h>
|
||||
#include <minix/rs.h>
|
||||
#include <lib.h>
|
||||
|
||||
|
@ -1420,3 +1421,42 @@ int endpoint;
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*===========================================================================*
|
||||
* do_lookup *
|
||||
*===========================================================================*/
|
||||
PUBLIC int do_lookup(m_ptr)
|
||||
message *m_ptr;
|
||||
{
|
||||
static char namebuf[100];
|
||||
int len, r;
|
||||
struct rproc *rrp;
|
||||
|
||||
len = m_ptr->RS_NAME_LEN;
|
||||
|
||||
if(len < 2 || len >= sizeof(namebuf)) {
|
||||
printf("RS: len too weird (%d)\n", len);
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if((r=sys_vircopy(m_ptr->m_source, D, (vir_bytes) m_ptr->RS_NAME,
|
||||
SELF, D, (vir_bytes) namebuf, len)) != OK) {
|
||||
printf("RS: name copy failed\n");
|
||||
return r;
|
||||
|
||||
}
|
||||
|
||||
namebuf[len] = '\0';
|
||||
|
||||
for (rrp=BEG_RPROC_ADDR; rrp<END_RPROC_ADDR; rrp++) {
|
||||
if (!(rrp->r_flags & RS_IN_USE))
|
||||
continue;
|
||||
if (!strcmp(rrp->r_label, namebuf)) {
|
||||
m_ptr->RS_ENDPOINT = rrp->r_proc_nr_e;
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
return ESRCH;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ _PROTOTYPE( int do_down, (message *m));
|
|||
_PROTOTYPE( int do_refresh, (message *m));
|
||||
_PROTOTYPE( int do_rescue, (message *m));
|
||||
_PROTOTYPE( int do_restart, (message *m));
|
||||
_PROTOTYPE( int do_lookup, (message *m));
|
||||
_PROTOTYPE( int do_shutdown, (message *m));
|
||||
_PROTOTYPE( void do_period, (message *m));
|
||||
_PROTOTYPE( void do_exit, (message *m));
|
||||
|
|
Loading…
Reference in a new issue