make -C /lib/modules/4.13.0-36-generic/build M=/home/kdt/LDD/ch8 modules
make[1]: Entering directory '/usr/src/linux-headers-4.13.0-36-generic'
  CC [M]  /home/kdt/LDD/ch8/globalfifo.o
/home/kdt/LDD/ch8/globalfifo.c: In function ‘globalfifo_read’:
/home/kdt/LDD/ch8/globalfifo.c:108:7: error: implicit declaration of function ‘signal_pending’ [-Werror=implicit-function-declaration]
   if (signal_pending(current)) {
       ^
In file included from ./include/linux/printk.h:6:0,
                 from ./include/linux/kernel.h:13,
                 from ./include/linux/list.h:8,
                 from ./include/linux/module.h:9,
                 from /home/kdt/LDD/ch8/globalfifo.c:9:
./include/linux/kern_levels.h:4:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘size_t {aka long unsigned int}’ [-Wformat=]
 #define KERN_SOH "\001"  /* ASCII Start Of Header */
                  ^
./include/linux/kern_levels.h:13:19: note: in expansion of macro ‘KERN_SOH’
 #define 

解决方案 »

  1.   

    几个错误啊,没用过LDD,来学习下
      

  2.   

    #include <linux/sched.h>  包含此头文件试下
      

  3.   

    这不提示了吗?不兼容,编译额时候加上-Werror=implicit-function-declaration 试试, 
      

  4.   

    根据报错信息,你的内核版本是4.13.0 。这对于LDD3中的例程来说太新了。LDD3代码的时代,我印象里是内核2.X;我当时参照3.18.24的内核看的,就已经有很多函数/结构体不同了。
    除非有对应版本的内核,否则不建议去编译LDD3的例程(因为内核版本不同,根本编不过)
    我曾经看的时候,书中的接口,都是去较新的内核代码中去找找,学习一下新的怎么用。LDD3对于现在来说,内容还是不错的,就是老了点~
      

  5.   


    -Wno-implicit-function-declaration?