/usr/include/xenomai/asm-generic/current.h is in libxenomai-dev 2.6.4+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | /*
* Copyright (C) 2009 Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
#ifndef _XENO_ASM_GENERIC_CURRENT_H
#define _XENO_ASM_GENERIC_CURRENT_H
#include <pthread.h>
#include <nucleus/thread.h>
extern pthread_key_t xeno_current_mode_key;
xnhandle_t xeno_slow_get_current(void);
unsigned long xeno_slow_get_current_mode(void);
void xeno_current_warn_old(void);
#ifdef HAVE___THREAD
extern __thread __attribute__ ((tls_model ("initial-exec")))
xnhandle_t xeno_current;
extern __thread __attribute__ ((tls_model ("initial-exec")))
unsigned long *xeno_current_mode;
static inline xnhandle_t xeno_get_current(void)
{
return xeno_current;
}
#define xeno_get_current_fast() xeno_get_current()
static inline unsigned long xeno_get_current_mode(void)
{
return xeno_current_mode ? *xeno_current_mode : XNRELAX;
}
#else /* ! HAVE___THREAD */
extern pthread_key_t xeno_current_key;
xnhandle_t xeno_slow_get_current(void);
unsigned long xeno_slow_get_current_mode(void);
static inline xnhandle_t xeno_get_current(void)
{
void *val = pthread_getspecific(xeno_current_key);
return (xnhandle_t)val ?: xeno_slow_get_current();
}
/* syscall-free, but unreliable in TSD destructor context */
static inline xnhandle_t xeno_get_current_fast(void)
{
void *val = pthread_getspecific(xeno_current_key);
return (xnhandle_t)val ?: XN_NO_HANDLE;
}
static inline unsigned long xeno_get_current_mode(void)
{
unsigned long *mode;
mode = pthread_getspecific(xeno_current_mode_key);
return mode ? *mode : XNRELAX;
}
#endif /* ! HAVE___THREAD */
void xeno_init_current_keys(void);
void xeno_set_current(void);
void xeno_set_current_mode(unsigned long offset);
#endif /* _XENO_ASM_GENERIC_CURRENT_H */
|