|
|
@ -6,7 +6,7 @@ |
|
|
|
* Copyright (c) 1994, Regents of the University of California |
|
|
|
* Copyright (c) 1994, Regents of the University of California |
|
|
|
* |
|
|
|
* |
|
|
|
* IDENTIFICATION |
|
|
|
* IDENTIFICATION |
|
|
|
* $Id: fd.c,v 1.10 1996/12/04 03:05:58 bryanh Exp $ |
|
|
|
* $Id: fd.c,v 1.11 1996/12/27 22:57:51 bryanh Exp $ |
|
|
|
* |
|
|
|
* |
|
|
|
* NOTES: |
|
|
|
* NOTES: |
|
|
|
* |
|
|
|
* |
|
|
@ -169,7 +169,9 @@ static char Sep_char = '\\'; |
|
|
|
* AssertLruRoom - make sure that there is a free fd. |
|
|
|
* AssertLruRoom - make sure that there is a free fd. |
|
|
|
* |
|
|
|
* |
|
|
|
* the Last Recently Used ring is a doubly linked list that begins and |
|
|
|
* the Last Recently Used ring is a doubly linked list that begins and |
|
|
|
* ends on element zero. |
|
|
|
* ends on element zero. Element zero is special -- it doesn't represent |
|
|
|
|
|
|
|
* a file and its "fd" field always == VFD_CLOSED. Element zero is just an |
|
|
|
|
|
|
|
* anchor that shows us the beginning/end of the ring. |
|
|
|
* |
|
|
|
* |
|
|
|
* example: |
|
|
|
* example: |
|
|
|
* |
|
|
|
* |
|
|
@ -373,6 +375,10 @@ AssertLruRoom() |
|
|
|
FreeFd)); |
|
|
|
FreeFd)); |
|
|
|
|
|
|
|
|
|
|
|
if (FreeFd <= 0 || nfile >= MAXFILES) { |
|
|
|
if (FreeFd <= 0 || nfile >= MAXFILES) { |
|
|
|
|
|
|
|
/* We supposedly are using more vfds than we want to be. First
|
|
|
|
|
|
|
|
assert that there is at least one used vfd in the ring.
|
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
Assert(VfdCache[0].lruMoreRecently ! 0); |
|
|
|
LruDelete(VfdCache[0].lruMoreRecently); |
|
|
|
LruDelete(VfdCache[0].lruMoreRecently); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -521,6 +527,7 @@ FileAccess(File file) |
|
|
|
void |
|
|
|
void |
|
|
|
FileInvalidate(File file) |
|
|
|
FileInvalidate(File file) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
Assert(file > 0); |
|
|
|
if (!FileIsNotOpen(file)) { |
|
|
|
if (!FileIsNotOpen(file)) { |
|
|
|
LruDelete(file); |
|
|
|
LruDelete(file); |
|
|
|
} |
|
|
|
} |
|
|
@ -879,7 +886,8 @@ void |
|
|
|
closeAllVfds() |
|
|
|
closeAllVfds() |
|
|
|
{ |
|
|
|
{ |
|
|
|
int i; |
|
|
|
int i; |
|
|
|
for (i=0; i<SizeVfdCache; i++) { |
|
|
|
Assert (FileIsNotOpen(0)); /* Make sure ring not corrupted */ |
|
|
|
|
|
|
|
for (i=1; i<SizeVfdCache; i++) { |
|
|
|
if (!FileIsNotOpen(i)) |
|
|
|
if (!FileIsNotOpen(i)) |
|
|
|
LruDelete(i); |
|
|
|
LruDelete(i); |
|
|
|
} |
|
|
|
} |
|
|
|