From 2a929cc87152fc499715d43a808e7cb78c2e01cf Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 25 Jan 2001 15:59:58 +0000 Subject: 2001-01-25 Fernando Ruiz * 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. --- cpukit/libcsupport/src/privateenv.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 cpukit/libcsupport/src/privateenv.c (limited to 'cpukit/libcsupport/src/privateenv.c') diff --git a/cpukit/libcsupport/src/privateenv.c b/cpukit/libcsupport/src/privateenv.c new file mode 100644 index 0000000000..4dc0144acc --- /dev/null +++ b/cpukit/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 +#include +#include + +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; +} -- cgit v1.2.3