Changeset 776a50c in rtems


Ignore:
Timestamp:
May 4, 2015, 7:32:00 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
b7cff7fe
Parents:
4a3c920
git-author:
Sebastian Huber <sebastian.huber@…> (05/04/15 07:32:00)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/19/15 10:00:44)
Message:

Filesystem: Thread life protection for env changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libcsupport/src/privateenv.c

    r4a3c920 r776a50c  
    2424
    2525#include <rtems/libio_.h>
    26 #include <rtems/score/threaddispatch.h>
     26#include <rtems/score/threadimpl.h>
    2727
    2828/**
     
    5151}
    5252
    53 static void free_user_env_protected(rtems_user_env_t *env)
    54 {
    55   _Thread_Disable_dispatch();
    56   rtems_libio_free_user_env(env);
    57   _Thread_Enable_dispatch();
    58 }
    59 
    6053rtems_status_code rtems_libio_set_private_env(void)
    6154{
     
    6558
    6659  if (uses_global_env) {
     60    bool life_protection = _Thread_Set_life_protection(true);
    6761    rtems_user_env_t *new_env = calloc(1, sizeof(*new_env));
    6862
     
    8478
    8579        if (eno == 0) {
    86           free_user_env_protected(old_env);
     80          rtems_libio_free_user_env(old_env);
    8781        } else {
    8882          sc = RTEMS_TOO_MANY;
     
    9892      sc = RTEMS_NO_MEMORY;
    9993    }
     94
     95    _Thread_Set_life_protection(life_protection);
    10096  }
    10197
     
    109105
    110106  if (uses_private_env) {
    111     free_user_env_protected(env);
     107    bool life_protection = _Thread_Set_life_protection(true);
     108
     109    rtems_libio_free_user_env(env);
    112110    pthread_setspecific(rtems_current_user_env_key, NULL);
     111
     112    _Thread_Set_life_protection(life_protection);
    113113  }
    114114}
Note: See TracChangeset for help on using the changeset viewer.