Skip to content

Commit

Permalink
Merge pull request #682 from uyjulian/iomanx_use_device_for_check
Browse files Browse the repository at this point in the history
iomanX use device instead of mode for allocation check
  • Loading branch information
fjtrujy authored Nov 28, 2024
2 parents 89d7ece + 990612c commit 0fa8842
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions iop/system/iomanx/src/iomanX.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,14 @@ static inline void handle_result_pre(int in_result, iomanX_iop_file_t *f, int op
{
if ( f )
{
f->mode = 0;
// Unofficial: don't clear mode
f->device = NULL;
}
}
if ( (op & HANDLE_RESULT_CLEAR_INFO_ON_ERROR) )
{
if ( f && (in_result < 0) )
{
// Unofficial: also clear mode
f->mode = 0;
f->device = NULL;
}
}
Expand Down Expand Up @@ -966,13 +964,13 @@ static iomanX_iop_file_t *new_iob(void)

CpuSuspendIntr(&state);
file_table_entry = file_table;
while ( (file_table_entry < &file_table[sizeof(file_table) / sizeof(file_table[0])]) && file_table_entry->mode )
while ( (file_table_entry < &file_table[sizeof(file_table) / sizeof(file_table[0])]) && file_table_entry->device )
file_table_entry += 1;
if ( file_table_entry >= &file_table[sizeof(file_table) / sizeof(file_table[0])] )
file_table_entry = NULL;
// fill in "mode" temporarily to mark the fd as allocated.
// fill in "device" temporarily to mark the fd as allocated.
if ( file_table_entry )
file_table_entry->mode = -20;
file_table_entry->device = (iomanX_iop_device_t *)(uiptr)0xFFFFFFEC;
CpuResumeIntr(state);
if ( !file_table_entry )
_ioabort("out of file descriptors", "[too many open]");
Expand Down

0 comments on commit 0fa8842

Please sign in to comment.