Don't use kernel responses in servers
This commit is contained in:
parent
491efeead9
commit
498d7d8a4c
@ -114,7 +114,6 @@ extern int errno; /* place where the error numbers go */
|
||||
*/
|
||||
#define ELOCKED (_SIGN 101) /* can't send message due to deadlock */
|
||||
#define EBADCALL (_SIGN 102) /* illegal system call number */
|
||||
#define EBADSRCDST (_SIGN 103) /* bad source or destination process */
|
||||
#define ECALLDENIED (_SIGN 104) /* no permission for system call */
|
||||
#define EDEADSRCDST (_SIGN 105) /* source or destination is not alive */
|
||||
#define ENOTREADY (_SIGN 106) /* source or destination is not ready */
|
||||
@ -122,4 +121,8 @@ extern int errno; /* place where the error numbers go */
|
||||
#define ETRAPDENIED (_SIGN 110) /* IPC trap not allowed */
|
||||
#define EDONTREPLY (_SIGN 201) /* pseudo-code: don't send a reply */
|
||||
|
||||
/* The following are non-POSIX server responses */
|
||||
#define EBADEPT (_SIGN 301) /* specified endpoint is bad */
|
||||
#define EDEADEPT (_SIGN 302) /* specified endpoint is not alive */
|
||||
|
||||
#endif /* _ERRNO_H */
|
||||
|
@ -184,7 +184,7 @@ PUBLIC int block_dev_io(
|
||||
driver_e = driver_endpoints[(dev >> MAJOR) & BYTE].driver_e;
|
||||
|
||||
/* See if driver is roughly valid. */
|
||||
if (driver_e == NONE) return(EDEADSRCDST);
|
||||
if (driver_e == NONE) return(EDEADEPT);
|
||||
|
||||
/* The io vector copying relies on this I/O being for FS itself. */
|
||||
if(proc_e != SELF_E) {
|
||||
@ -214,7 +214,7 @@ PUBLIC int block_dev_io(
|
||||
|
||||
/* Call the task. */
|
||||
r = sendrec(driver_e, &m);
|
||||
if(r == OK && m.REP_STATUS == ERESTART) r = EDEADSRCDST;
|
||||
if(r == OK && m.REP_STATUS == ERESTART) r = EDEADEPT;
|
||||
|
||||
/* As block I/O never SUSPENDs, safe cleanup must be done whether
|
||||
* the I/O succeeded or not. */
|
||||
@ -226,7 +226,7 @@ PUBLIC int block_dev_io(
|
||||
* - VFS sends the new driver endp for the FS proc and the request again
|
||||
*/
|
||||
if (r != OK) {
|
||||
if (r == EDEADSRCDST) {
|
||||
if (r == EDEADSRCDST || r == EDEADEPT) {
|
||||
printf("ISOFS(%d) dead driver %d\n", SELF_E, driver_e);
|
||||
driver_endpoints[(dev >> MAJOR) & BYTE].driver_e = NONE;
|
||||
return(r);
|
||||
@ -299,9 +299,9 @@ message *mess_ptr; /* pointer to message for task */
|
||||
proc_e = mess_ptr->IO_ENDPT;
|
||||
|
||||
r = sendrec(task_nr, mess_ptr);
|
||||
if(r == OK && mess_ptr->REP_STATUS == ERESTART) r = EDEADSRCDST;
|
||||
if(r == OK && mess_ptr->REP_STATUS == ERESTART) r = EDEADEPT;
|
||||
if (r != OK) {
|
||||
if (r == EDEADSRCDST) {
|
||||
if (r == EDEADSRCDST || r == EDEADEPT) {
|
||||
printf("fs: dead driver %d\n", task_nr);
|
||||
panic("should handle crashed drivers");
|
||||
/* dmap_unmap_by_endpt(task_nr); */
|
||||
|
@ -175,7 +175,7 @@ PUBLIC int block_dev_io(
|
||||
/* See if driver is roughly valid. */
|
||||
if (driver_e == NONE) {
|
||||
printf("MFS(%d) block_dev_io: no driver for dev %x\n", SELF_E, dev);
|
||||
return(EDEADSRCDST);
|
||||
return(EDEADEPT);
|
||||
}
|
||||
|
||||
/* The io vector copying relies on this I/O being for FS itself. */
|
||||
@ -205,7 +205,7 @@ PUBLIC int block_dev_io(
|
||||
|
||||
/* Call the task. */
|
||||
r = sendrec(driver_e, &m);
|
||||
if(r == OK && m.REP_STATUS == ERESTART) r = EDEADSRCDST;
|
||||
if(r == OK && m.REP_STATUS == ERESTART) r = EDEADEPT;
|
||||
|
||||
/* As block I/O never SUSPENDs, safe cleanup must be done whether
|
||||
* the I/O succeeded or not. */
|
||||
@ -217,7 +217,7 @@ PUBLIC int block_dev_io(
|
||||
* - VFS sends the new driver endp for the FS proc and the request again
|
||||
*/
|
||||
if (r != OK) {
|
||||
if (r == EDEADSRCDST) {
|
||||
if (r == EDEADSRCDST || r == EDEADEPT) {
|
||||
printf("MFS(%d) dead driver %d\n", SELF_E, driver_e);
|
||||
driver_endpoints[major(dev)].driver_e = NONE;
|
||||
return(r);
|
||||
@ -331,10 +331,10 @@ PRIVATE int gen_io(
|
||||
|
||||
r = sendrec(task_nr, mess_ptr);
|
||||
if(r == OK && mess_ptr->REP_STATUS == ERESTART)
|
||||
r = EDEADSRCDST;
|
||||
r = EDEADEPT;
|
||||
|
||||
if (r != OK) {
|
||||
if (r == EDEADSRCDST) {
|
||||
if (r == EDEADSRCDST || r == EDEADEPT) {
|
||||
printf("fs: dead driver %d\n", task_nr);
|
||||
panic("should handle crashed drivers");
|
||||
return(r);
|
||||
|
@ -222,14 +222,14 @@ PUBLIC int process_ksig(endpoint_t proc_nr_e, int signo)
|
||||
|
||||
if(pm_isokendpt(proc_nr_e, &proc_nr) != OK || proc_nr < 0) {
|
||||
printf("PM: process_ksig: %d?? not ok\n", proc_nr_e);
|
||||
return EDEADSRCDST; /* process is gone. */
|
||||
return EDEADEPT; /* process is gone. */
|
||||
}
|
||||
rmp = &mproc[proc_nr];
|
||||
if ((rmp->mp_flags & (IN_USE | EXITING)) != IN_USE) {
|
||||
#if 0
|
||||
printf("PM: process_ksig: %d?? exiting / not in use\n", proc_nr_e);
|
||||
#endif
|
||||
return EDEADSRCDST; /* process is gone. */
|
||||
return EDEADEPT; /* process is gone. */
|
||||
}
|
||||
proc_id = rmp->mp_pid;
|
||||
mp = &mproc[0]; /* pretend signals are from PM */
|
||||
@ -287,7 +287,7 @@ PUBLIC int process_ksig(endpoint_t proc_nr_e, int signo)
|
||||
return OK; /* signal has been delivered */
|
||||
}
|
||||
else {
|
||||
return EDEADSRCDST; /* process is gone */
|
||||
return EDEADEPT; /* process is gone */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,9 +111,9 @@ PUBLIC int pm_isokendpt(int endpoint, int *proc)
|
||||
if(*proc < -NR_TASKS || *proc >= NR_PROCS)
|
||||
return EINVAL;
|
||||
if(*proc >= 0 && endpoint != mproc[*proc].mp_endpoint)
|
||||
return EDEADSRCDST;
|
||||
return EDEADEPT;
|
||||
if(*proc >= 0 && !(mproc[*proc].mp_flags & IN_USE))
|
||||
return EDEADSRCDST;
|
||||
return EDEADEPT;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
@ -526,7 +526,7 @@ PRIVATE int sef_cb_signal_manager(endpoint_t target, int signo)
|
||||
|
||||
/* Don't bother if a termination signal has already been processed. */
|
||||
if((rp->r_flags & RS_TERMINATED) && !(rp->r_flags & RS_EXITING)) {
|
||||
return EDEADSRCDST; /* process is gone */
|
||||
return EDEADEPT; /* process is gone */
|
||||
}
|
||||
|
||||
/* Ignore external signals for inactive service instances. */
|
||||
@ -551,7 +551,7 @@ PRIVATE int sef_cb_signal_manager(endpoint_t target, int signo)
|
||||
rp->r_flags |= RS_TERMINATED;
|
||||
terminate_service(rp);
|
||||
|
||||
return EDEADSRCDST; /* process is now gone */
|
||||
return EDEADEPT; /* process is now gone */
|
||||
}
|
||||
|
||||
/* Translate every non-termination signal into a message. */
|
||||
|
@ -857,7 +857,7 @@ PUBLIC void terminate_service(struct rproc *rp)
|
||||
}
|
||||
|
||||
/* See if a late reply has to be sent. */
|
||||
r = (rp->r_caller_request == RS_DOWN ? OK : EDEADSRCDST);
|
||||
r = (rp->r_caller_request == RS_DOWN ? OK : EDEADEPT);
|
||||
late_reply(rp, r);
|
||||
|
||||
/* Unpublish the service. */
|
||||
|
@ -35,7 +35,7 @@ PUBLIC int do_noquantum(message *m_ptr)
|
||||
if (sched_isokendpt(m_ptr->m_source, &proc_nr_n) != OK) {
|
||||
printf("SCHED: WARNING: got an invalid endpoint in OOQ msg %u.\n",
|
||||
m_ptr->m_source);
|
||||
return EBADSRCDST;
|
||||
return EBADEPT;
|
||||
}
|
||||
|
||||
rmp = &schedproc[proc_nr_n];
|
||||
@ -64,7 +64,7 @@ PUBLIC int do_stop_scheduling(message *m_ptr)
|
||||
if (sched_isokendpt(m_ptr->SCHEDULING_ENDPOINT, &proc_nr_n) != OK) {
|
||||
printf("SCHED: WARNING: got an invalid endpoint in OOQ msg %u.\n",
|
||||
m_ptr->SCHEDULING_ENDPOINT);
|
||||
return EBADSRCDST;
|
||||
return EBADEPT;
|
||||
}
|
||||
|
||||
rmp = &schedproc[proc_nr_n];
|
||||
@ -168,7 +168,7 @@ PUBLIC int do_nice(message *m_ptr)
|
||||
if (sched_isokendpt(m_ptr->SCHEDULING_ENDPOINT, &proc_nr_n) != OK) {
|
||||
printf("SCHED: WARNING: got an invalid endpoint in OOQ msg %u.\n",
|
||||
m_ptr->SCHEDULING_ENDPOINT);
|
||||
return EBADSRCDST;
|
||||
return EBADEPT;
|
||||
}
|
||||
|
||||
rmp = &schedproc[proc_nr_n];
|
||||
|
@ -32,13 +32,13 @@ PUBLIC int sched_isokendpt(int endpoint, int *proc)
|
||||
{
|
||||
*proc = _ENDPOINT_P(endpoint);
|
||||
if (*proc < 0)
|
||||
return (EBADSRCDST); /* Don't schedule tasks */
|
||||
return (EBADEPT); /* Don't schedule tasks */
|
||||
if(*proc >= NR_PROCS)
|
||||
return (EINVAL);
|
||||
if(endpoint != schedproc[*proc].endpoint)
|
||||
return (EDEADSRCDST);
|
||||
return (EDEADEPT);
|
||||
if(!(schedproc[*proc].flags & IN_USE))
|
||||
return (EDEADSRCDST);
|
||||
return (EDEADEPT);
|
||||
return (OK);
|
||||
}
|
||||
|
||||
@ -49,11 +49,11 @@ PUBLIC int sched_isemtyendpt(int endpoint, int *proc)
|
||||
{
|
||||
*proc = _ENDPOINT_P(endpoint);
|
||||
if (*proc < 0)
|
||||
return (EBADSRCDST); /* Don't schedule tasks */
|
||||
return (EBADEPT); /* Don't schedule tasks */
|
||||
if(*proc >= NR_PROCS)
|
||||
return (EINVAL);
|
||||
if(schedproc[*proc].flags & IN_USE)
|
||||
return (EDEADSRCDST);
|
||||
return (EDEADEPT);
|
||||
return (OK);
|
||||
}
|
||||
|
||||
|
@ -159,10 +159,10 @@ PUBLIC void dev_status(message *m)
|
||||
int r;
|
||||
st.m_type = DEV_STATUS;
|
||||
r = sendrec(m->m_source, &st);
|
||||
if(r == OK && st.REP_STATUS == ERESTART) r = EDEADSRCDST;
|
||||
if(r == OK && st.REP_STATUS == ERESTART) r = EDEADEPT;
|
||||
if (r != OK) {
|
||||
printf("DEV_STATUS failed to %d: %d\n", m->m_source, r);
|
||||
if (r == EDEADSRCDST) return;
|
||||
if (r == EDEADSRCDST || r == EDEADEPT) return;
|
||||
panic("couldn't sendrec for DEV_STATUS: %d", r);
|
||||
}
|
||||
|
||||
@ -625,9 +625,9 @@ message *mess_ptr; /* pointer to message for task */
|
||||
|
||||
proc_e = mess_ptr->IO_ENDPT;
|
||||
r = sendrec(task_nr, mess_ptr);
|
||||
if(r == OK && mess_ptr->REP_STATUS == ERESTART) r = EDEADSRCDST;
|
||||
if(r == OK && mess_ptr->REP_STATUS == ERESTART) r = EDEADEPT;
|
||||
if (r != OK) {
|
||||
if (r == EDEADSRCDST) {
|
||||
if (r == EDEADSRCDST || r == EDEADEPT) {
|
||||
printf("fs: dead driver %d\n", task_nr);
|
||||
dmap_unmap_by_endpt(task_nr);
|
||||
return(r);
|
||||
|
@ -115,7 +115,7 @@ PUBLIC int isokendpt_f(char *file, int line, endpoint_t endpoint, int *proc, int
|
||||
if(failed && fatal)
|
||||
panic("isokendpt_f failed");
|
||||
|
||||
return(failed ? EDEADSRCDST : OK);
|
||||
return(failed ? EDEADEPT : OK);
|
||||
}
|
||||
|
||||
|
||||
|
@ -127,9 +127,9 @@ PUBLIC int vm_isokendpt(endpoint_t endpoint, int *proc)
|
||||
if(*proc < 0 || *proc >= NR_PROCS)
|
||||
return EINVAL;
|
||||
if(*proc >= 0 && endpoint != vmproc[*proc].vm_endpoint)
|
||||
return EDEADSRCDST;
|
||||
return EDEADEPT;
|
||||
if(*proc >= 0 && !(vmproc[*proc].vm_flags & VMF_INUSE))
|
||||
return EDEADSRCDST;
|
||||
return EDEADEPT;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user