Re: problems compiling a new syscall

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

 



On Tue, 2004-07-06 at 18:16 +0000, Cristina Rivera wrote:

Hi, Cristina!  Your brother, Chris, is my very good friend.

> I have created a new syscall which I've included in the mm directory but I 
> have some problems when compiling it.
> 
> In my syscall I use routines that have the source code on memory.c, so, in  
> my  .c file I define them like this
> extern void establish_pte(struct vm_area_struct *,unsigned long,pte_t 
> *,pte_t);
> extern int do_wp_page(struct mm_struct *,struct vm_area_struct *,unsigned 
> long,pte_t *,pte_t);
> extern int do_no_page(struct mm_struct *,struct vm_area_struct *,unsigned 
> long,int,pte_t *);
> 
> In order to indicate to the compiler that they are coded in an another file, 
> but when I compile my kernel by doing make bzImage I got three errors saying 
> that  there are references to this routines are not defined.
> 
> Does anybody have some idea about what I'm doing wrong?

The above functions are marked static and thus not exported.

You have a few options:

	(a) put your syscall in mm/memory.c
	(b) remove the 'static' modifier from the function definitions

(b) is probably not acceptable for the mainline kernel, but that is only
an issue if you intend to submit this syscall for official inclusion.

If you do use (b), do not use extern declarations as you did.  Instead,
put the declarations in a header file and include said file in _both_
mm/memory.c and wherever you use them.  This assures you that the
prototypes are in sync and correct.  Otherwise, the compiler cannot help
you.  And you should let it help you!

Personally, if (a) works, I would do that.

Best,

	Robert Love



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux