public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* LDD examples
@ 2010-08-27 22:32 Someone Something
  2010-09-03 18:01 ` Randy Dunlap
  0 siblings, 1 reply; 4+ messages in thread
From: Someone Something @ 2010-08-27 22:32 UTC (permalink / raw)
  To: linux-kernel

I downloaded the LDD examples
(http://examples.oreilly.com/9780596005900/), and I unzipped the file
and just tried building it with make just to see if it built properly
and here are the errors I get:
setlevel.c:30: error: expected declaration specifiers or '...' before 'type'
setlevel.c:30: error: expected declaration specifiers or '...' before 'bufp'
setlevel.c:30: error: expected declaration specifiers or '...' before 'len'
setlevel.c:30: warning: data definition has no type or storage class
setlevel.c:30: warning: type defaults to 'int' in declaration of '_syscall3'
setlevel.c: In function 'main':
setlevel.c:41: warning: implicit declaration of function 'syslog'

have any of use experienced these errors? Is this book out of date?
Alternatives?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: LDD examples
  2010-08-27 22:32 LDD examples Someone Something
@ 2010-09-03 18:01 ` Randy Dunlap
  2010-09-04 17:44   ` Jonathan Corbet
  0 siblings, 1 reply; 4+ messages in thread
From: Randy Dunlap @ 2010-09-03 18:01 UTC (permalink / raw)
  To: Someone Something; +Cc: linux-kernel, gregkh, corbet

On Fri, 27 Aug 2010 18:32:03 -0400 Someone Something wrote:

> I downloaded the LDD examples
> (http://examples.oreilly.com/9780596005900/), and I unzipped the file
> and just tried building it with make just to see if it built properly
> and here are the errors I get:
> setlevel.c:30: error: expected declaration specifiers or '...' before 'type'
> setlevel.c:30: error: expected declaration specifiers or '...' before 'bufp'
> setlevel.c:30: error: expected declaration specifiers or '...' before 'len'
> setlevel.c:30: warning: data definition has no type or storage class
> setlevel.c:30: warning: type defaults to 'int' in declaration of '_syscall3'
> setlevel.c: In function 'main':
> setlevel.c:41: warning: implicit declaration of function 'syslog'
> 
> have any of use experienced these errors? Is this book out of date?
> Alternatives?
> --

The examples are certainly out of date.


'man 2 _syscall' says that it is obsolete and deprecated.

Fixing the userspace programs is easy.  E.g., for setlevel.c, just
#include <unistd.h> 
and change this line:

-_syscall3(int, syslog, int, type, char *, bufp, int, len);
+#define syslog(type, bufp, len)	syscall(8, type, bufp, len)


For the kernel modules, remove
#include <linux/config.h>
from all of them and change CFLAGS to EXTRA_CFLAGS in all Makefiles.

The biggest remaining problem with the kernel modules is scheduled_work
usage and its changing API.


---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: LDD examples
  2010-09-03 18:01 ` Randy Dunlap
@ 2010-09-04 17:44   ` Jonathan Corbet
  2010-09-05 21:04     ` Avi Kivity
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Corbet @ 2010-09-04 17:44 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Someone Something, linux-kernel, gregkh

On Fri, 3 Sep 2010 11:01:58 -0700
Randy Dunlap <rdunlap@xenotime.net> wrote:

> The examples are certainly out of date.

The entire book is out of date - it's from 2.6.10!

We are (very slowly) pondering ways to update it; I hope to get
something going in the near future.  Stay tuned...

jon

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: LDD examples
  2010-09-04 17:44   ` Jonathan Corbet
@ 2010-09-05 21:04     ` Avi Kivity
  0 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2010-09-05 21:04 UTC (permalink / raw)
  To: Jonathan Corbet; +Cc: Randy Dunlap, Someone Something, linux-kernel, gregkh

  On 09/04/2010 08:44 PM, Jonathan Corbet wrote:
>> The examples are certainly out of date.
> The entire book is out of date - it's from 2.6.10!
>
> We are (very slowly) pondering ways to update it; I hope to get
> something going in the near future.  Stay tuned...
>

Merge it into Documentation/books/, and have kbuild build all the examples?

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-09-05 21:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-27 22:32 LDD examples Someone Something
2010-09-03 18:01 ` Randy Dunlap
2010-09-04 17:44   ` Jonathan Corbet
2010-09-05 21:04     ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox