Missing includes in /usr/include/linux/*.h and /usr/include/asm.h 
Author Message
 Missing includes in /usr/include/linux/*.h and /usr/include/asm.h

hi all,

i am writing the code to control an optical polarimeter (IRQ 3) from
Linux.

somehow my system headers (/usr/include/asm/*.h and
/usr/include/asm/*.h) were all having problems of multiple includes
and missing includes. i solved most of them by including proper files
and commenting out duplicate includes (eg #include <time.h> and
#include<linux/timer.h> caused time_t to be defined twice).

but somehow i cant move further

kernel: 2.4.18, Red Hat 7.3
gcc version: 2.something

SAMPLE CODE TO TEST request_irq and free_irq (bug.c)

/* begin code */

#include <stdio.h>
#include <asm/irq.h>
#include <linux/signal.h>
#include <linux/sched.h>
#include <linux/interrupt.h>

int request_irq(unsigned int irq,
              void (*handler)(int, void *, struct pt_regs *),
              unsigned long irqflags, const char *devname,
              void *dev_id);
void free_irq(unsigned int irq, void *dev_id);

void my_handler(int irq, void *dev_id, struct pt_regs *regs)
{
        printf("Caught an interrupt\n");
        outb(0x20,0x0020);
        return;

Quote:
}

int main(void)
{
        int ret;
        char dummy;

        printf("Hello world\n");

        ret = request_irq(3, my_handler, SA_INTERRUPT, "/dev/foo", NULL);

        printf("It returned %d\n", ret);

        dummy = getchar();

        free_irq(3, NULL);

        return 0;

Quote:
}

/* end code */

Now when i compile

gcc -c bug.c

I get this among others

In file included from /usr/include/linux/interrupt.h:45,
                 from bug.c:5:
/usr/include/asm/softirq.h: In function `init_bh':
/usr/include/asm/softirq.h:83: `bh_base' undeclared (first use in this
function)
/usr/include/asm/softirq.h:83: (Each undeclared identifier is reported
only once
/usr/include/asm/softirq.h:83: for each function it appears in.)
/usr/include/asm/softirq.h:84: `bh_mask_count' undeclared (first use
in this function)
/usr/include/asm/softirq.h:86: `i386_bh_lock' undeclared (first use in
this function)
/usr/include/asm/softirq.h:87: `bh_mask' undeclared (first use in this
function)
/usr/include/asm/softirq.h: In function `remove_bh':
/usr/include/asm/softirq.h:95: `i386_bh_lock' undeclared (first use in
this function)
/usr/include/asm/softirq.h:96: `bh_mask' undeclared (first use in this
function)
/usr/include/asm/softirq.h:100: `bh_base' undeclared (first use in
this function)
/usr/include/asm/softirq.h: In function `mark_bh':
/usr/include/asm/softirq.h:105: `bh_active' undeclared (first use in
this function)
/usr/include/asm/softirq.h: In function `disable_bh':
/usr/include/asm/softirq.h:116: `i386_bh_lock' undeclared (first use
in this function)
/usr/include/asm/softirq.h:117: `bh_mask' undeclared (first use in
this function)
/usr/include/asm/softirq.h:118: `bh_mask_count' undeclared (first use
in this function)
/usr/include/asm/softirq.h: In function `enable_bh':
/usr/include/asm/softirq.h:127: `i386_bh_lock' undeclared (first use
in this function)
/usr/include/asm/softirq.h:128: `bh_mask_count' undeclared (first use
in this function)
/usr/include/asm/softirq.h:129: `bh_mask' undeclared (first use in
this function)

QUESTION 1: which header file defins these structures?

moreover:

In file included from bug.c:5:
/usr/include/linux/interrupt.h: At top level:
/usr/include/linux/interrupt.h:77: parse error before `('
/usr/include/linux/interrupt.h:78: parse error before `('
/usr/include/linux/interrupt.h:127: `CONFIG_X86_L1_CACHE_SHIFT'
undeclared here (not in a function)
/usr/include/linux/interrupt.h:127: requested alignment is not a
constant
/usr/include/linux/interrupt.h:154: parse error before `('
/usr/include/linux/interrupt.h:162: parse error before `('
/usr/include/linux/interrupt.h:224: parse error before
`global_bh_lock'
/usr/include/linux/interrupt.h:224: warning: data definition has no
type or storage class
/usr/include/linux/interrupt.h:227: warning: static declaration for
`mark_bh' follows non-static

QUESTION 2: I checked these lines, the error is due to

FASTCALL
and
CONFIG_X86_L1_CACHE_SHIFT symbols.

which header file defines these?

sincerely,

nitin



Tue, 28 Jun 2005 16:18:45 GMT  
 Missing includes in /usr/include/linux/*.h and /usr/include/asm.h

Quote:
> hi all,
> i am writing the code to control an optical polarimeter (IRQ 3) from
> Linux.
> somehow my system headers (/usr/include/asm/*.h and
> /usr/include/asm/*.h) were all having problems of multiple includes
> and missing includes. i solved most of them by including proper files
> and commenting out duplicate includes (eg #include <time.h> and
> #include<linux/timer.h> caused time_t to be defined twice).

None of this has anything to do with the C programming language. Please
ask in comp.unix.programmer or a Linux programming newsgroup.

--

| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste       W++ B OP+                     |
\----------------------------------------- Finland rules! ------------/
"I am lying."
   - Anon



Tue, 28 Jun 2005 16:50:10 GMT  
 Missing includes in /usr/include/linux/*.h and /usr/include/asm.h
[fu-t set]

in comp.lang.c i read:

Quote:
>i am writing the code to control an optical polarimeter (IRQ 3) from
>Linux.

>somehow my system headers (/usr/include/asm/*.h and
>/usr/include/asm/*.h) were all having problems

you need to discuss that with your vendor, or a group that supports your
vendor.

off hand it appears that you aren't including a necessary header.  *do not*
respond in this group asking which one.

--
bringing you boring signatures for 17 years



Wed, 29 Jun 2005 07:46:58 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. typedef struct { } __fd_set doesn't work /usr/include/bits/types.h

2. prototype for insertion sort function in /usr/include/g++-2

3. Fs* in /usr/include/sys/param.h

4. /usr/include/curses.h generates odd error(?)

5. HPUX /usr/include/*.h

6. include file of includes

7. source for included included files

8. How to include CRecordset without including MFC?

9. Why won't a include file get included some times and not other

10. #including your #include....

11. Program to convert C includes to ASM

12. Watcom included asm

 

 
Powered by phpBB® Forum Software