Bug 78062

Summary: Sample Echo Pseudo-Device Driver for FreeBSD 4.X doesn't compile
Product: Documentation Reporter: ALeine <aleine>
Component: Books & ArticlesAssignee: freebsd-doc (Nobody) <doc>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description ALeine 2005-02-25 11:10:38 UTC

A `typedef' is missing.

Fix: 

#define MIN(a,b) (((a) < (b)) ? (a) : (b))
@@ -225,7 +227,7 @@
        -1
 };

-struct s_echo {
+typedef struct s_echo {
        char msg[BUFFERSIZE];
        int len;
 } t_echo;



___________________________________________________________________
WebMail FREE http://mail.austrosearch.net--htCIAKuGeR73NRkREHe9IA0hjKonRVi1OBfPuVpgvvw5trcC
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- en_US.ISO8859-1/books/arch-handbook/driverbasics/chapter.sgml.old    Thu Feb 24 \
16:25:19 2005
+++ en_US.ISO8859-1/books/arch-handbook/driverbasics/chapter.sgml        Thu Feb 24 \
16:27:34 2005
@@ -185,6 +185,8 @@
  * Simple `echo' pseudo-device KLD
  *
  * Murray Stokely
+ *
+ * Corrected by ALeine
  */
How-To-Repeat: 

# cc -O -pipe -D_KERNEL -Wall -Wredundant-decls -Wnested-externs \
 -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline \
 -Wcast-qual -fformat-extensions -ansi -DKLD_MODULE -nostdinc -I- \
 -I. -I@ -I@/../include -mpreferred-stack-boundary=2 -Wall \
 -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
 -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
 -fformat-extensions -ansi -c echodev.c

echodev.c:54: syntax error before `*'
echodev.c:54: warning: type defaults to `int' in declaration of `echomsg'
echodev.c:54: warning: data definition has no type or storage class
echodev.c: In function `echo_loader':
echodev.c:78: syntax error before `)'
echodev.c: In function `echo_read':
echodev.c:125: request for member `len' in something not a structure or union
echodev.c:126: request for member `len' in something not a structure or union
echodev.c:126: request for member `len' in something not a structure or union
echodev.c:126: request for member `len' in something not a structure or union
echodev.c:127: request for member `msg' in something not a structure or union
echodev.c:119: warning: `amt' might be used uninitialized in this function
echodev.c: In function `echo_write':
echodev.c:144: request for member `msg' in something not a structure or union
echodev.c:148: request for member `msg' in something not a structure or union
echodev.c:149: request for member `len' in something not a structure or union
echodev.c: At top level:
echodev.c:52: warning: `len' defined but not used
*** Error code 1
Comment 1 Maxim Konovalov freebsd_committer freebsd_triage 2006-04-14 12:15:05 UTC
State Changed
From-To: open->closed

Committed.  Thanks!