Thread: wheres teh semaphore.h and hardware.h

  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    192

    wheres teh semaphore.h and hardware.h

    Im compiling code that had asm/semaphore.h and asm/hardware.h as headers but i get the error that no such file or directory exist and i using a linux 2.6.30

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    semaphore.h is just a plain old header. I don't have a hardware.h that I can tell, but I don't do a lot of (i.e. any) fancy hardware programming.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Porting code from one OS to another is a minefield.

    Which OS was the code for to begin with?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    The semaphore.h in /usr/include involves the same library functions as the one in the kernel tree (pretty sure anyway), which that's probably what asm/ is referencing. There is a hardware.h in the tree too, but there's not just one "asm" subdirectory, you need to pick an architecture.

    You can find the kernel includes via /lib/modules/source/include.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  5. #5
    Registered User
    Join Date
    Aug 2009
    Posts
    192
    Okay well for semaphore i just did
    #include "linux/semaphore.h"
    and that didnt give me a compiler error so i guess tahts works but where would tehre be a generic hardware.h

  6. #6
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by kiros88 View Post
    Okay well for semaphore i just did
    #include "linux/semaphore.h"
    and that didnt give me a compiler error so i guess tahts works but where would tehre be a generic hardware.h
    I found one in 2.6.28.7, not much too it and definitely ain't generic:

    Code:
    /*
     * include/asm-xtensa/platform-iss/hardware.h
     *
     * This file is subject to the terms and conditions of the GNU General Public
     * License.  See the file "COPYING" in the main directory of this archive
     * for more details.
     *
     * Copyright (C) 2001 Tensilica Inc.
     */
    
    /*
     * This file contains the default configuration of ISS.
     */
    
    #ifndef _XTENSA_PLATFORM_ISS_HARDWARE_H
    #define _XTENSA_PLATFORM_ISS_HARDWARE_H
    
    /*
     * Memory configuration.
     */
    
    #define PLATFORM_DEFAULT_MEM_START      0x00000000
    #define PLATFORM_DEFAULT_MEM_SIZE       0x08000000
    
    /*
     * Interrupt configuration.
     */
    
    #endif /* _XTENSA_PLATFORM_ISS_HARDWARE_H */
    I have no idea what arch "xtensa" refers to.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed