This commit is contained in:
Robert Morris 2019-10-16 12:27:08 -04:00
parent f2df0fa547
commit 2821d43cc9
2 changed files with 3 additions and 3 deletions

View file

@ -83,7 +83,7 @@ pipewrite(struct pipe *pi, uint64 addr, int n)
acquire(&pi->lock); acquire(&pi->lock);
for(i = 0; i < n; i++){ for(i = 0; i < n; i++){
while(pi->nwrite == pi->nread + PIPESIZE){ //DOC: pipewrite-full while(pi->nwrite == pi->nread + PIPESIZE){ //DOC: pipewrite-full
if(pi->readopen == 0 || myproc()->killed){ if(pi->readopen == 0 || pr->killed){
release(&pi->lock); release(&pi->lock);
return -1; return -1;
} }
@ -108,7 +108,7 @@ piperead(struct pipe *pi, uint64 addr, int n)
acquire(&pi->lock); acquire(&pi->lock);
while(pi->nread == pi->nwrite && pi->writeopen){ //DOC: pipe-empty while(pi->nread == pi->nwrite && pi->writeopen){ //DOC: pipe-empty
if(myproc()->killed){ if(pr->killed){
release(&pi->lock); release(&pi->lock);
return -1; return -1;
} }

View file

@ -116,7 +116,7 @@ found:
// Set up new context to start executing at forkret, // Set up new context to start executing at forkret,
// which returns to user space. // which returns to user space.
memset(&p->context, 0, sizeof p->context); memset(&p->context, 0, sizeof(p->context));
p->context.ra = (uint64)forkret; p->context.ra = (uint64)forkret;
p->context.sp = p->kstack + PGSIZE; p->context.sp = p->kstack + PGSIZE;