for vs while
This commit is contained in:
parent
236d33698b
commit
db8fb62e4d
5 changed files with 5 additions and 5 deletions
2
bio.c
2
bio.c
|
@ -39,7 +39,7 @@ getblk(uint dev, uint sector)
|
||||||
|
|
||||||
acquire(&buf_table_lock);
|
acquire(&buf_table_lock);
|
||||||
|
|
||||||
while(1){
|
for(;;){
|
||||||
for(b = bufhead.next; b != &bufhead; b = b->next)
|
for(b = bufhead.next; b != &bufhead; b = b->next)
|
||||||
if((b->flags & (B_BUSY|B_VALID)) && b->dev == dev && b->sector == sector)
|
if((b->flags & (B_BUSY|B_VALID)) && b->dev == dev && b->sector == sector)
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -58,7 +58,7 @@ cmain(void)
|
||||||
bad:
|
bad:
|
||||||
outw(0x8A00, 0x8A00);
|
outw(0x8A00, 0x8A00);
|
||||||
outw(0x8A00, 0x8E00);
|
outw(0x8A00, 0x8E00);
|
||||||
while(1)
|
for(;;)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
fs.c
2
fs.c
|
@ -479,7 +479,7 @@ namei(char *path, int mode, uint *ret_off, char **ret_last, struct inode **ret_i
|
||||||
while(*cp == '/')
|
while(*cp == '/')
|
||||||
cp++;
|
cp++;
|
||||||
|
|
||||||
while(1){
|
for(;;){
|
||||||
if(*cp == '\0'){
|
if(*cp == '\0'){
|
||||||
if(mode == NAMEI_LOOKUP)
|
if(mode == NAMEI_LOOKUP)
|
||||||
return dp;
|
return dp;
|
||||||
|
|
2
init.c
2
init.c
|
@ -20,7 +20,7 @@ main(void)
|
||||||
dup(0);
|
dup(0);
|
||||||
dup(0);
|
dup(0);
|
||||||
|
|
||||||
while(1){
|
for(;;){
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if(pid < 0){
|
if(pid < 0){
|
||||||
puts("init: fork failed\n");
|
puts("init: fork failed\n");
|
||||||
|
|
|
@ -62,7 +62,7 @@ checkstring(uint s)
|
||||||
char c;
|
char c;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
while(1){
|
for(;;){
|
||||||
if(fetchbyte(curproc[cpu()], s, &c) < 0)
|
if(fetchbyte(curproc[cpu()], s, &c) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if(c == '\0')
|
if(c == '\0')
|
||||||
|
|
Loading…
Reference in a new issue