uxfile.o:
uxfs.o:
- 00000000 b directory_pointers
- 00000004 b n_directory_pointers
+ 00000000 b directory_pointers locked
+ 00000004 b n_directory_pointers locked
+
+ OK. The directory_pointers table is managed much like the
+ channel_table and is locked up in the same way. (Just the
+ writers are required to serialize.)
uxio.o:
00000004 C OS_channel_table_size
*/
-#include "scheme.h"
+#include "prims.h"
#include "ux.h"
#include "osfs.h"
#include "osfile.h"
#ifndef FILE_TOUCH_OPEN_TRIES
# define FILE_TOUCH_OPEN_TRIES 5
#endif
+
+#ifdef ENABLE_SMP
+static pthread_mutex_t mutex = MUTEX_INITIALIZER;
+# ifdef ENABLE_DEBUGGING_TOOLS
+static bool locked_p = false;
+# endif
+#endif
\f
#define STAT_SYSTEM_CALL(name, expression, if_failure) \
do { \
static unsigned int
allocate_directory_pointer (DIR * pointer)
{
+ LOCK ();
if (n_directory_pointers == 0)
{
DIR ** pointers = ((DIR **) (UX_malloc ((sizeof (DIR *)) * 4)));
while (scan < end)
(*scan++) = 0;
}
+ UNLOCK();
return (0);
}
{
if ((*scan++) == 0)
{
(*--scan) = pointer;
+ UNLOCK();
return (scan - directory_pointers);
}
}
(UX_realloc (((void *) directory_pointers),
((sizeof (DIR *)) * n_pointers))));
if (pointers == 0)
- error_system_call (ENOMEM, syscall_realloc);
+ {
+ UNLOCK();
+ error_system_call (ENOMEM, syscall_realloc);
+ }
{
DIR ** scan = (pointers + result);
DIR ** end = (pointers + n_pointers);
}
directory_pointers = pointers;
n_directory_pointers = n_pointers;
+ UNLOCK();
return (result);
}
}
void
OS_directory_close (unsigned int index)
{
+ LOCK();
closedir (REFERENCE_DIRECTORY (index));
DEALLOCATE_DIRECTORY (index);
+ UNLOCK();
}