PAPI 7.1.0.0
Loading...
Searching...
No Matches
linux-common.h
Go to the documentation of this file.
1#ifndef _LINUX_COMMON_H
2#define _LINUX_COMMON_H
3
4#define LINUX_VERSION(a,b,c) ( ((a&0xff)<<24) | ((b&0xff)<<16) | ((c&0xff) << 8))
5
6#define min(x, y) ({ \
7 typeof(x) _min1 = (x); \
8 typeof(y) _min2 = (y); \
9 (void) (&_min1 == &_min2); \
10 _min1 < _min2 ? _min1 : _min2; })
11
12static inline pid_t
13mygettid( void )
14{
15#if defined(__NEC__)
16 return 0;
17#else
18#ifdef SYS_gettid
19 return syscall( SYS_gettid );
20#elif defined(__NR_gettid)
21 return syscall( __NR_gettid );
22#else
23#error "cannot find gettid"
24#endif
25#endif
26}
27
28#ifndef F_SETOWN_EX
29 #define F_SETOWN_EX 15
30 #define F_GETOWN_EX 16
31
32 #define F_OWNER_TID 0
33 #define F_OWNER_PID 1
34 #define F_OWNER_PGRP 2
35
36 struct f_owner_ex {
37 int type;
38 pid_t pid;
39 };
40#endif
41
43
44#if HAVE_SCHED_GETCPU
45#include <sched.h>
46/* If possible, pick the processors the code is currently running on. */
47#define _papi_getcpu() sched_getcpu()
48#else
49/* Just map to processor 0 if sched_getcpu() is not available. */
50#define _papi_getcpu() 0
51
52#endif
53
54#endif
int _linux_detect_nmi_watchdog()
Definition: linux-common.c:768
static pid_t mygettid(void)
Definition: linux-common.h:13