[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Problem including <asm/timex.h> (linux-kernel-headers 2.6.17)


I am trying to prepare packages for the new MaxDB release and
am having problems with a new piece of code in there.

The code in question looks like this and is known to work on Suse SLES9:

#ifdef LINUX
#   include     <sys/time.h>
typedef SAPDB_UInt8 u64;
#   include <asm/param.h>
#   include <asm/types.h>
#   include <asm/timex.h>
#   define HAS_GET_CYCLES

However when I try to compile this with linux-kernel-headers
( on my amd64 box I only get a host of error messages
starting like this:

RTESys_MicroTime.c fast
In file included from /usr/include/asm-x86_64/vsyscall.h:4,
                 from /usr/include/asm/vsyscall.h:8,
                 from /usr/include/asm-x86_64/timex.h:11,
                 from /usr/include/asm/timex.h:8,
                 from RTESys_MicroTime.c:76:
/usr/include/linux/seqlock.h:76: error: expected '=', ',', ';\
', 'asm' or '__attribute__' before 'unsigned'
/usr/include/linux/seqlock.h:91: error: expected '=', ',', ';\
', 'asm' or '__attribute__' before 'int'
In file included from /usr/include/linux/cpumask.h:86,
                 from /usr/include/asm-x86_64/processor.h:23,
                 from /usr/include/asm/processor.h:8,
                 from /usr/include/asm-x86_64/timex.h:14,
                 from /usr/include/asm/timex.h:8,
                 from RTESys_MicroTime.c:76:
/usr/include/linux/bitmap.h: In function 'bitmap_zero':
/usr/include/linux/bitmap.h:128: error: 'BITS_PER_LONG' undeclared \
(first use in this function)
/usr/include/linux/bitmap.h:128: error: (Each undeclared identifier is \
reported only once
... (I can provide the full output if required)

>From looking at the header files in /usr/include it seems that a lot of
types and macros used in those headers are only available to the kernel
(protected by #ifdef __KERNEL__) and to me it seems that <asm/timex.h>
cannot be successfully included by a user-space application.

I have no experience in this area, so I am just wondering: are
user-space applications not supposed to include any headers below
/usr/include/asm or is this a problem with the header files?

In any case, what MaxDB seems to try to do, is to use get_cycles() from
<asm/timex.h> for its internal timers. Is this a problem, and has it
been working for upstream just by accident, or is this ok and I should
try and get it to work on Debian?

Thanks for any help,


Reply to: