proc_addr() returns address based on location in proc array
- pproc_addr is not neccessary to get the address of a process if we know its number - local proc variables in system calls implementation (sys_task) conflicts with the global proc array of all process, therefore the variable were renamed to proc_nr as they hold the process number
This commit is contained in:
parent
3615d93383
commit
4fd433694f
7 changed files with 22 additions and 22 deletions
|
@ -198,7 +198,7 @@ struct proc {
|
||||||
#define NIL_PROC ((struct proc *) 0)
|
#define NIL_PROC ((struct proc *) 0)
|
||||||
#define NIL_SYS_PROC ((struct proc *) 1)
|
#define NIL_SYS_PROC ((struct proc *) 1)
|
||||||
#define cproc_addr(n) (&(proc + NR_TASKS)[(n)])
|
#define cproc_addr(n) (&(proc + NR_TASKS)[(n)])
|
||||||
#define proc_addr(n) (pproc_addr + NR_TASKS)[(n)]
|
#define proc_addr(n) (&(proc[NR_TASKS + (n)]))
|
||||||
#define proc_nr(p) ((p)->p_nr)
|
#define proc_nr(p) ((p)->p_nr)
|
||||||
|
|
||||||
#define isokprocn(n) ((unsigned) ((n) + NR_TASKS) < NR_PROCS + NR_TASKS)
|
#define isokprocn(n) ((unsigned) ((n) + NR_TASKS) < NR_PROCS + NR_TASKS)
|
||||||
|
|
|
@ -22,15 +22,15 @@ message *m_ptr; /* pointer to request message */
|
||||||
* signal it got with SYS_GETKSIG.
|
* signal it got with SYS_GETKSIG.
|
||||||
*/
|
*/
|
||||||
register struct proc *rp;
|
register struct proc *rp;
|
||||||
int proc;
|
int proc_nr;
|
||||||
|
|
||||||
/* Get process pointer and verify that it had signals pending. If the
|
/* Get process pointer and verify that it had signals pending. If the
|
||||||
* process is already dead its flags will be reset.
|
* process is already dead its flags will be reset.
|
||||||
*/
|
*/
|
||||||
if(!isokendpt(m_ptr->SIG_ENDPT, &proc))
|
if(!isokendpt(m_ptr->SIG_ENDPT, &proc_nr))
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
rp = proc_addr(proc);
|
rp = proc_addr(proc_nr);
|
||||||
if (!RTS_ISSET(rp, SIG_PENDING)) return(EINVAL);
|
if (!RTS_ISSET(rp, SIG_PENDING)) return(EINVAL);
|
||||||
|
|
||||||
/* PM has finished one kernel signal. Perhaps process is ready now? */
|
/* PM has finished one kernel signal. Perhaps process is ready now? */
|
||||||
|
|
|
@ -24,12 +24,12 @@ register message *m_ptr; /* pointer to request message */
|
||||||
register struct proc *rp;
|
register struct proc *rp;
|
||||||
phys_bytes phys_name;
|
phys_bytes phys_name;
|
||||||
char *np;
|
char *np;
|
||||||
int proc;
|
int proc_nr;
|
||||||
|
|
||||||
if(!isokendpt(m_ptr->PR_ENDPT, &proc))
|
if(!isokendpt(m_ptr->PR_ENDPT, &proc_nr))
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
rp = proc_addr(proc);
|
rp = proc_addr(proc_nr);
|
||||||
|
|
||||||
/* Save command name for debugging, ps(1) output, etc. */
|
/* Save command name for debugging, ps(1) output, etc. */
|
||||||
if(data_copy(who_e, (vir_bytes) m_ptr->PR_NAME_PTR,
|
if(data_copy(who_e, (vir_bytes) m_ptr->PR_NAME_PTR,
|
||||||
|
|
|
@ -137,7 +137,7 @@ irq_hook_t *hook;
|
||||||
* interrupts are transformed into messages to a driver. The IRQ line will be
|
* interrupts are transformed into messages to a driver. The IRQ line will be
|
||||||
* reenabled if the policy says so.
|
* reenabled if the policy says so.
|
||||||
*/
|
*/
|
||||||
int proc;
|
int proc_nr;
|
||||||
|
|
||||||
/* As a side-effect, the interrupt handler gathers random information by
|
/* As a side-effect, the interrupt handler gathers random information by
|
||||||
* timestamping the interrupt events. This is used for /dev/random.
|
* timestamping the interrupt events. This is used for /dev/random.
|
||||||
|
@ -148,14 +148,14 @@ irq_hook_t *hook;
|
||||||
* If it's dead, this should never happen, as processes that die
|
* If it's dead, this should never happen, as processes that die
|
||||||
* automatically get their interrupt hooks unhooked.
|
* automatically get their interrupt hooks unhooked.
|
||||||
*/
|
*/
|
||||||
if(!isokendpt(hook->proc_nr_e, &proc))
|
if(!isokendpt(hook->proc_nr_e, &proc_nr))
|
||||||
minix_panic("invalid interrupt handler", hook->proc_nr_e);
|
minix_panic("invalid interrupt handler", hook->proc_nr_e);
|
||||||
|
|
||||||
/* Add a bit for this interrupt to the process' pending interrupts. When
|
/* Add a bit for this interrupt to the process' pending interrupts. When
|
||||||
* sending the notification message, this bit map will be magically set
|
* sending the notification message, this bit map will be magically set
|
||||||
* as an argument.
|
* as an argument.
|
||||||
*/
|
*/
|
||||||
priv(proc_addr(proc))->s_int_pending |= (1 << hook->notify_id);
|
priv(proc_addr(proc_nr))->s_int_pending |= (1 << hook->notify_id);
|
||||||
|
|
||||||
/* Build notification message and return. */
|
/* Build notification message and return. */
|
||||||
lock_notify(HARDWARE, hook->proc_nr_e);
|
lock_notify(HARDWARE, hook->proc_nr_e);
|
||||||
|
|
|
@ -20,12 +20,12 @@ message *m_ptr; /* pointer to request message */
|
||||||
register struct proc *rp; /* process whose map is to be loaded */
|
register struct proc *rp; /* process whose map is to be loaded */
|
||||||
struct mem_map *map_ptr; /* virtual address of map inside caller */
|
struct mem_map *map_ptr; /* virtual address of map inside caller */
|
||||||
phys_bytes src_phys; /* physical address of map at the */
|
phys_bytes src_phys; /* physical address of map at the */
|
||||||
int proc;
|
int proc_nr;
|
||||||
|
|
||||||
map_ptr = (struct mem_map *) m_ptr->PR_MEM_PTR;
|
map_ptr = (struct mem_map *) m_ptr->PR_MEM_PTR;
|
||||||
if (! isokendpt(m_ptr->PR_ENDPT, &proc)) return(EINVAL);
|
if (! isokendpt(m_ptr->PR_ENDPT, &proc_nr)) return(EINVAL);
|
||||||
if (iskerneln(proc)) return(EPERM);
|
if (iskerneln(proc_nr)) return(EPERM);
|
||||||
rp = proc_addr(proc);
|
rp = proc_addr(proc_nr);
|
||||||
|
|
||||||
return newmap(rp, map_ptr);
|
return newmap(rp, map_ptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,11 +26,11 @@ message *m_ptr; /* pointer to request message */
|
||||||
*/
|
*/
|
||||||
struct sigcontext sc;
|
struct sigcontext sc;
|
||||||
register struct proc *rp;
|
register struct proc *rp;
|
||||||
int proc, r;
|
int proc_nr, r;
|
||||||
|
|
||||||
if (! isokendpt(m_ptr->SIG_ENDPT, &proc)) return(EINVAL);
|
if (! isokendpt(m_ptr->SIG_ENDPT, &proc_nr)) return(EINVAL);
|
||||||
if (iskerneln(proc)) return(EPERM);
|
if (iskerneln(proc_nr)) return(EPERM);
|
||||||
rp = proc_addr(proc);
|
rp = proc_addr(proc_nr);
|
||||||
|
|
||||||
/* Copy in the sigcontext structure. */
|
/* Copy in the sigcontext structure. */
|
||||||
if((r=data_copy(m_ptr->SIG_ENDPT, (vir_bytes) m_ptr->SIG_CTXT_PTR,
|
if((r=data_copy(m_ptr->SIG_ENDPT, (vir_bytes) m_ptr->SIG_CTXT_PTR,
|
||||||
|
|
|
@ -28,12 +28,12 @@ message *m_ptr; /* pointer to request message */
|
||||||
register struct proc *rp;
|
register struct proc *rp;
|
||||||
struct sigcontext sc, *scp;
|
struct sigcontext sc, *scp;
|
||||||
struct sigframe fr, *frp;
|
struct sigframe fr, *frp;
|
||||||
int proc, r;
|
int proc_nr, r;
|
||||||
phys_bytes ph;
|
phys_bytes ph;
|
||||||
|
|
||||||
if (!isokendpt(m_ptr->SIG_ENDPT, &proc)) return(EINVAL);
|
if (!isokendpt(m_ptr->SIG_ENDPT, &proc_nr)) return(EINVAL);
|
||||||
if (iskerneln(proc)) return(EPERM);
|
if (iskerneln(proc_nr)) return(EPERM);
|
||||||
rp = proc_addr(proc);
|
rp = proc_addr(proc_nr);
|
||||||
|
|
||||||
ph = umap_local(proc_addr(who_p), D, (vir_bytes) m_ptr->SIG_CTXT_PTR, sizeof(struct sigmsg));
|
ph = umap_local(proc_addr(who_p), D, (vir_bytes) m_ptr->SIG_CTXT_PTR, sizeof(struct sigmsg));
|
||||||
if(!ph) return EFAULT;
|
if(!ph) return EFAULT;
|
||||||
|
|
Loading…
Reference in a new issue