Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/tls.c

    r63f8966 r31399f3  
    4242#include <str.h>
    4343#include <align.h>
     44#include <unistd.h>
    4445
    4546/** Create TLS (Thread Local Storage) data structures.
     
    5051 * @return Pointer to TCB.
    5152 */
    52 tcb_t *__make_tls(void)
     53tcb_t *tls_make(void)
    5354{
    5455        void *data;
     
    5657        size_t tls_size = &_tbss_end - &_tdata_start;
    5758       
    58         tcb = __alloc_tls(&data, tls_size);
     59        tcb = tls_alloc_arch(&data, tls_size);
     60        if (!tcb)
     61                return NULL;
    5962       
    6063        /*
     
    7174}
    7275
    73 void __free_tls(tcb_t *tcb)
     76void tls_free(tcb_t *tcb)
    7477{
    7578        size_t tls_size = &_tbss_end - &_tdata_start;
    76         __free_tls_arch(tcb, tls_size);
     79        tls_free_arch(tcb, tls_size);
    7780}
    7881
     
    8992
    9093        result = malloc(sizeof(tcb_t) + size);
     94        if (!result)
     95                return NULL;
    9196        *data = ((void *)result) + sizeof(tcb_t);
     97
    9298        return result;
    9399}
     
    118124        size = ALIGN_UP(size, &_tls_alignment);
    119125        *data = memalign((uintptr_t) &_tls_alignment, sizeof(tcb_t) + size);
    120 
     126        if (!*data)
     127                return NULL;
    121128        tcb = (tcb_t *) (*data + size);
    122129        tcb->self = tcb;
Note: See TracChangeset for help on using the changeset viewer.