[BusyBox] Removed a few warnings and some errors.

mihir mathuria mathuria at usc.edu
Thu Jan 30 16:05:05 UTC 2003


Hi All,

I have tried to fix few warnings and some errors (for Solaris).

When I first tried to build the system I got the foll warnings.

ar -r editors/editors.a ./editors/sed.o
ar: creating editors/editors.a
gcc -I./include -Wall -Wstrict-prototypes -Wshadow  -fomit-frame-pointer -D_GNU_SOURCE     -c -o fileutils/chgrp.o fileutils/chgrp.c
In file included from include/busybox.h:43,
                 from fileutils/chgrp.c:28:
include/libbb.h:58: warning: redefinition of `socklen_t'
/usr/include/sys/socket.h:61: warning: `socklen_t' previously declared here
In file included from fileutils/chgrp.c:28:
include/busybox.h:98:1: warning: "NBBY" redefined
In file included from /auto/usc/gnu/gcc/3.1/lib/gcc-lib/sparc-sun-solaris2.8/3.1/include/sys/types.h:573,
                 from /usr/include/unistd.h:20,
                 from fileutils/chgrp.c:27:
/usr/include/sys/select.h:56:1: warning: this is the location of the previous definition
gcc -I./include -Wall -Wstrict-prototypes -Wshadow  -fomit-frame-pointer -D_GNU_SOURCE     -c -o fileutils/chmod.o fileutils/chmod.c
In file included from include/busybox.h:43,
                 from fileutils/chmod.c:32:
include/libbb.h:58: warning: redefinition of `socklen_t'
/usr/include/sys/socket.h:61: warning: `socklen_t' previously declared here
In file included from fileutils/chmod.c:32:
include/busybox.h:98:1: warning: "NBBY" redefined
In file included from /auto/usc/gnu/gcc/3.1/lib/gcc-lib/sparc-sun-solaris2.8/3.1/include/sys/types.h:573,
                 from /usr/include/unistd.h:20,
                 from fileutils/chmod.c:30:
/usr/include/sys/select.h:56:1: warning: this is the location of the previous definition
gcc -I./include -Wall -Wstrict-prototypes -Wshadow  -fomit-frame-pointer -D_GNU_SOURCE     -c -o fileutils/chown.o fileutils/chown.c
In file included from include/busybox.h:43,
                 from fileutils/chown.c:28:
include/libbb.h:58: warning: redefinition of `socklen_t'
/usr/include/sys/socket.h:61: warning: `socklen_t' previously declared here
In file included from fileutils/chown.c:28:
include/busybox.h:98:1: warning: "NBBY" redefined
In file included from /auto/usc/gnu/gcc/3.1/lib/gcc-lib/sparc-sun-solaris2.8/3.1/include/sys/types.h:573,
                 from /usr/include/unistd.h:20,
                 from fileutils/chown.c:27:
/usr/include/sys/select.h:56:1: warning: this is the location of the previous definition
fileutils/chown.c:38: parse error before "__uid_t"
fileutils/chown.c:38: warning: function declaration isn't a prototype
make: *** [fileutils/chown.o] Error 1



NOTE:- Users need to remove the -o option used in the ar command from the Makefile.in file in various subdirectories.

1.socklen_t is already defined in /usr/include/sys/socket.h file.  Putting the declaration within #ifndef _SOCKLEN_T does the trick.

 #if (__GNU_LIBRARY__ < 5) && (!defined __dietlibc__)
  /* libc5 doesn't define socklen_t */
+ #ifndef _SOCKLEN_T
+ #define _SOCKLEN_T
  typedef unsigned int socklen_t;
+ #endif
  /* libc5 doesn't implement BSD 4.4 daemon() */
  extern int daemon (int nochdir, int noclose);
  /* libc5 doesn't implement strtok_r */


2. Similarly putting the declaration for NBBY within #ifndef removes the warning.

  /* Bit map related macros -- libc5 doens't provide these... sigh.  */
  #ifndef setbit
+ #ifndef NBBY
  #define NBBY            CHAR_BIT
+ #endif
  #define setbit(a,i)     ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
  #define clrbit(a,i)     ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
  #define isset(a,i)      ((a)[(i)/NBBY] & (1<<((i)%NBBY)))


3. The parse error was taken care by removing the underscores from the __uid_t and __gid_t, since I assumed they were uid_t and gid_t defined in unistd.h file.

  static long uid;
  static long gid;
! static int (*chown_func)(const char *, __uid_t, __gid_t) = chown;
  static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
  {
        if (chown_func(fileName, uid, (gid == -1) ? statbuf->st_gid : gid) == 0) {
--- 34,40 ----
  
  static long uid;
  static long gid;
! static int (*chown_func)(const char *, uid_t, gid_t) = chown;
  static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
  {


Correct me if I am wrong at any place. Happy Coding :)

Regards,
Mihir.




More information about the busybox mailing list