~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to system/lib/libc/musl/src/internal/libc.h

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
ImportĀ upstreamĀ versionĀ 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef LIBC_H
 
2
#define LIBC_H
 
3
 
 
4
#include <stdlib.h>
 
5
#include <stdio.h>
 
6
 
 
7
struct __libc {
 
8
        void *main_thread;
 
9
        int threaded;
 
10
        int secure;
 
11
        size_t *auxv;
 
12
        int (*atexit)(void (*)(void));
 
13
        void (*fini)(void);
 
14
        void (*ldso_fini)(void);
 
15
        volatile int threads_minus_1;
 
16
        int canceldisable;
 
17
        FILE *ofl_head;
 
18
        int ofl_lock[2];
 
19
        size_t tls_size;
 
20
};
 
21
 
 
22
extern size_t __hwcap;
 
23
 
 
24
#if !defined(__PIC__) || (100*__GNUC__+__GNUC_MINOR__ >= 303 && !defined(__PCC__))
 
25
 
 
26
#ifdef __PIC__
 
27
#if __GNUC__ < 4
 
28
#define BROKEN_VISIBILITY 1
 
29
#endif
 
30
#define ATTR_LIBC_VISIBILITY __attribute__((visibility("hidden")))
 
31
#else
 
32
#define ATTR_LIBC_VISIBILITY
 
33
#endif
 
34
 
 
35
extern struct __libc __libc ATTR_LIBC_VISIBILITY;
 
36
#define libc __libc
 
37
 
 
38
#else
 
39
 
 
40
#define USE_LIBC_ACCESSOR
 
41
#define ATTR_LIBC_VISIBILITY
 
42
extern struct __libc *__libc_loc(void) __attribute__((const));
 
43
#define libc (*__libc_loc())
 
44
 
 
45
#endif
 
46
 
 
47
 
 
48
/* Designed to avoid any overhead in non-threaded processes */
 
49
void __lock(volatile int *) ATTR_LIBC_VISIBILITY;
 
50
void __unlock(volatile int *) ATTR_LIBC_VISIBILITY;
 
51
int __lockfile(FILE *) ATTR_LIBC_VISIBILITY;
 
52
void __unlockfile(FILE *) ATTR_LIBC_VISIBILITY;
 
53
#define LOCK(x) (libc.threads_minus_1 ? (__lock(x),1) : ((void)(x),1))
 
54
#define UNLOCK(x) (libc.threads_minus_1 ? (__unlock(x),1) : ((void)(x),1))
 
55
 
 
56
void __synccall(void (*)(void *), void *);
 
57
int __setxid(int, int, int, int);
 
58
 
 
59
extern char **__environ;
 
60
 
 
61
#undef weak_alias
 
62
#define weak_alias(old, new) \
 
63
        extern __typeof(old) new __attribute__((weak, alias(#old)))
 
64
 
 
65
#undef LFS64_2
 
66
#define LFS64_2(x, y) weak_alias(x, y)
 
67
 
 
68
#undef LFS64
 
69
#define LFS64(x) LFS64_2(x, x##64)
 
70
 
 
71
#endif