summaryrefslogtreecommitdiffstats
path: root/c/src/exec/libcsupport/src
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2001-01-25 15:59:58 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2001-01-25 15:59:58 +0000
commit2a929cc87152fc499715d43a808e7cb78c2e01cf (patch)
treecfde4180861d5364a822da07e6bbd6a8d8ae5be0 /c/src/exec/libcsupport/src
parent2001-01-25 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-2a929cc87152fc499715d43a808e7cb78c2e01cf.tar.bz2
2001-01-25 Fernando Ruiz <fernando.ruiz@ctv.es>
* Alternate email is correo@fernando-ruiz.com * libc/privateenv.c: New file. * include/rtems/libio_.h, libc/Makefile.am, libc/base_fs.c, libc/unmount.c: Moved default umask, current working directory, root, and links followed count into a structure "user environment" that can then be treated as a unit. This enable giving unique copies of these to individual threads or collection of threads.
Diffstat (limited to 'c/src/exec/libcsupport/src')
-rw-r--r--c/src/exec/libcsupport/src/Makefile.am2
-rw-r--r--c/src/exec/libcsupport/src/base_fs.c6
-rw-r--r--c/src/exec/libcsupport/src/privateenv.c37
-rw-r--r--c/src/exec/libcsupport/src/unmount.c1
4 files changed, 40 insertions, 6 deletions
diff --git a/c/src/exec/libcsupport/src/Makefile.am b/c/src/exec/libcsupport/src/Makefile.am
index c26efcc92a..2c68aa9377 100644
--- a/c/src/exec/libcsupport/src/Makefile.am
+++ b/c/src/exec/libcsupport/src/Makefile.am
@@ -12,7 +12,7 @@ ERROR_C_FILES = error.c
ASSOCIATION_C_FILES = assoc.c assocnamebad.c
BASE_FS_C_FILES = base_fs.c mount.c unmount.c libio.c \
- libio_sockets.c eval.c fs_null_handlers.c
+ libio_sockets.c eval.c fs_null_handlers.c privateenv.c
TERMIOS_C_FILES = cfgetispeed.c cfgetospeed.c cfsetispeed.c cfsetospeed.c \
tcgetattr.c tcsetattr.c tcdrain.c tcflow.c tcflush.c tcgetprgrp.c \
diff --git a/c/src/exec/libcsupport/src/base_fs.c b/c/src/exec/libcsupport/src/base_fs.c
index 93c5a60d85..4132d52b6d 100644
--- a/c/src/exec/libcsupport/src/base_fs.c
+++ b/c/src/exec/libcsupport/src/base_fs.c
@@ -23,15 +23,13 @@
* Global information for the base file system.
*/
-rtems_filesystem_location_info_t rtems_filesystem_current;
-rtems_filesystem_location_info_t rtems_filesystem_root;
-nlink_t rtems_filesystem_link_counts;
+rtems_user_env_t rtems_global_user_env;
+rtems_user_env_t * rtems_current_user_env = &rtems_global_user_env;
/*
* Default mode for created files.
*/
-mode_t rtems_filesystem_umask;
/*
* rtems_filesystem_initialize
diff --git a/c/src/exec/libcsupport/src/privateenv.c b/c/src/exec/libcsupport/src/privateenv.c
new file mode 100644
index 0000000000..4dc0144acc
--- /dev/null
+++ b/c/src/exec/libcsupport/src/privateenv.c
@@ -0,0 +1,37 @@
+/*
+ * Instantatiate a private user environment for the calling thread.
+ *
+ * Submitted by: fernando.ruiz@ctv.es (correo@fernando-ruiz.com)
+ *
+ * COPYRIGHT (c) 1989-2000.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems.h>
+#include <rtems/libio.h>
+#include <rtems/libio_.h>
+
+rtems_status_code rtems_libio_set_private_env(void) {
+ rtems_status_code sc;
+
+ sc = rtems_task_variable_add(RTEMS_SELF,(void*)&rtems_current_user_env,free);
+ if (sc != RTEMS_SUCCESSFUL)
+ return sc;
+
+ rtems_current_user_env = malloc(sizeof(rtems_user_env_t));
+ if (!rtems_current_user_env)
+ return RTEMS_NO_MEMORY;
+
+ *rtems_current_user_env = rtems_global_user_env;
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/exec/libcsupport/src/unmount.c b/c/src/exec/libcsupport/src/unmount.c
index 33c6f25bee..dfd1797112 100644
--- a/c/src/exec/libcsupport/src/unmount.c
+++ b/c/src/exec/libcsupport/src/unmount.c
@@ -37,7 +37,6 @@
*/
extern Chain_Control rtems_filesystem_mount_table_control;
-extern rtems_filesystem_location_info_t rtems_filesystem_current;
int search_mt_for_mount_point(
rtems_filesystem_location_info_t *location_of_mount_point