- Fixed a bug when running out of priv structures.

- Tell VM about VM calls for every new service instance.
This commit is contained in:
Cristiano Giuffrida 2010-05-11 20:49:42 +00:00
parent 7c5e1d1b29
commit 23204787d5

View file

@ -461,8 +461,7 @@ struct rproc *rp;
if ((s = sys_privctl(child_proc_nr_e, SYS_PRIV_SET_SYS, &rp->r_priv)) != OK if ((s = sys_privctl(child_proc_nr_e, SYS_PRIV_SET_SYS, &rp->r_priv)) != OK
|| (s = sys_getpriv(&rp->r_priv, child_proc_nr_e)) != OK) { || (s = sys_getpriv(&rp->r_priv, child_proc_nr_e)) != OK) {
printf("unable to set privilege structure: %d\n", s); printf("unable to set privilege structure: %d\n", s);
rp->r_flags |= RS_EXITING; cleanup_service(rp);
terminate_service(rp);
return ENOMEM; return ENOMEM;
} }
@ -478,19 +477,23 @@ struct rproc *rp;
} }
else { else {
if ((s = read_exec(rp)) != OK) { if ((s = read_exec(rp)) != OK) {
return kill_service(rp, "read_exec failed", s); printf("read_exec failed: %d\n", s);
cleanup_service(rp);
return s;
} }
} }
if(rs_verbose) if(rs_verbose)
printf("RS: execing child with srv_execve()...\n"); printf("RS: execing child with srv_execve()...\n");
s = srv_execve(child_proc_nr_e, rp->r_exec, rp->r_exec_len, rp->r_argv, s = srv_execve(child_proc_nr_e, rp->r_exec, rp->r_exec_len, rp->r_argv,
environ); environ);
if (s != OK) { if (s != OK) {
return kill_service(rp, "srv_execve failed", s); printf("srv_execve failed: %d\n", s);
cleanup_service(rp);
return s;
} }
if(!use_copy) { if(!use_copy) {
free_exec(rp); free_exec(rp);
} }
/* The purpose of non-blocking forks is to avoid involving VFS in the forking /* The purpose of non-blocking forks is to avoid involving VFS in the forking
@ -519,6 +522,7 @@ struct rproc *rp;
{ {
/* Clone the given system service instance. */ /* Clone the given system service instance. */
struct rproc *replica_rp; struct rproc *replica_rp;
struct rprocpub *replica_rpub;
int r; int r;
if(rs_verbose) if(rs_verbose)
@ -540,6 +544,16 @@ struct rproc *rp;
return r; return r;
} }
/* Tell VM about allowed calls, if any. */
replica_rpub = replica_rp->r_pub;
if(replica_rpub->vm_call_mask[0]) {
r = vm_set_priv(replica_rpub->endpoint, &replica_rpub->vm_call_mask[0]);
if (r != OK) {
rp->r_next_rp = NULL;
return kill_service(replica_rp, "vm_set_priv call failed", r);
}
}
return OK; return OK;
} }
@ -677,10 +691,10 @@ struct rproc *rp;
/* Create and make active. */ /* Create and make active. */
r = create_service(rp); r = create_service(rp);
activate_service(rp, NULL);
if(r != OK) { if(r != OK) {
return r; return r;
} }
activate_service(rp, NULL);
/* Publish service properties. */ /* Publish service properties. */
r = publish_service(rp); r = publish_service(rp);