Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Per customer requirements, I installed CentOS 5.6 with the default kernel. With this kernel installed, the time.h file includes the #define CLOCK_MONOTONIC.

Now, a real-time kernel was installed along with the kernel-devel and our code would like to use CLOCK_MONOTONIC_RAW. It does exist as a part of the kernel's header files, but when I compile our code, it does not find it in the standard userspace includes.

My question is, what is the proper procedure to including/replacing the time.h found by default with the real-time kernel? From my research, it looks like symlinks are bad, so how should it be handled? What is the procedure or process? Upgrading to CentOS 6.0 or 5.7 is not an option per customer requirements.

share|improve this question
    
Are you planning on inserting this module into the default CentOS kernel? –  bahamat Jul 18 '12 at 16:11

3 Answers 3

You just need to #include <linux/time.h>

share|improve this answer
    
Thank you for the response. I checked the linux/time.h location and it too does not have a reference to "RAW". I am running an updated real-time kernel, but I just need to understand how to transfer the new kernel's headers that does have a reference to "RAW" into the userspace header files. Am I making any sense or is my approach correct? Thank you again for the help. –  cabanaboy Jan 5 '12 at 16:05
    
@cabanaboy, I'm not sure where you are looking or where the file came from, but linux/time.h most certainly should define CLOCK_MONOTONIC_RAW. It also doesn't matter whether you are running a real-time kernel or not; the headers are the same. –  psusi Jan 5 '12 at 21:47
3  
@cabanaboy, wait... you're running an old os that must have shipped with a kernel older than 2.6.28 when that was added. How did you get the new kernel installed? If you built it from source yourself, then you need to make install_headers. If you got an updated kernel package, then you need to get the corresponding updated kernel_headers package. –  psusi Jan 5 '12 at 21:53

The headers that your distribution installs are not the ones in the kernel, they are sanitzed/"userspaced" versions. You'd have to get a copy of the headers in include/linux in the kernel sources and set up so they are used in preference to the ones in /usr/include/linux (need to frob the -I flag for gcc). And check if nothing misfires.

share|improve this answer

I would make sure I'm building against the headers that came with the new kernel. CLOCK_MONOTONIC_RAW should be defined in linux/time.h. First find out which headers you are using, and check how its defined in the file. You can define it in your code ( only as a check ) to see what happens.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.