Driver Module compilation error message-implicit declaration of function 'kmalloc'

Source: Internet
Author: User

Re-compile a previous driver test module

Previously it was in fc9, but fc14 encountered the following compilation error,

Make: Entering directory '/usr/src/kernels/2.6.35.6-45. fc14.i686'
CC [m]/home/TY/development/driver/ch6/globalmem. o
/Home/TY/development/driver/ch6/globalmem. C: In function 'globalmem _ read ':
/Home/TY/development/driver/ch6/globalmem. c: 77: 7: Warning: format' % d' expects type 'int', but argument 3 has type 'long unsigned int'
/Home/TY/development/driver/ch6/globalmem. C: In function 'globalmem _ write ':
/Home/TY/development/driver/ch6/globalmem. c: 100: 7: Warning: format' % d' expects type 'int', but argument 3 has type 'long unsigned int'
/Home/TY/development/driver/ch6/globalmem. C: In function 'globalmem _ init ':
/Home/TY/development/driver/ch6/globalmem. C: 185: 3:Error: Implicit declaration of function 'kmalloc'

/Home/TY/development/driver/ch6/globalmem. C: 185: 18: Warning: Assignment makes pointer from integer without a cast
/Home/TY/development/driver/ch6/globalmem. C: In function 'globalmem _ exit ':
/Home/TY/development/driver/ch6/globalmem. C: 202: 3: Error: Implicit declaration of function 'kfree'

Make [1]: *** [/home/TY/development/driver/ch6/globalmem. O] Error 1
Make: *** [_ module _/home/TY/development/driver/ch6] Error 2
Make: Leaving directory '/usr/src/kernels/2.6.35.6-45. fc14.i686'

 

I found it online, but a header file is missing.

# Include <Linux/slab. h>

After adding it, there will be no problem.

DriverSource code

Http://blog.csdn.net/tiany524/archive/2010/09/14/5884535.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.