Re: __NR__llseek undeclared

[email protected] (Wietse Venema) Mon, 9 Apr 2007 09:50:40 -0400 (EDT)
Newsgroups gmane.comp.security.forensics.tct
Message-ID <[email protected]>
Christian Perst:
> gcc -DLINUX2 -I../aux -O  -g   -c -o mylseek.o mylseek.c
> mylseek.c: In function '_llseek':
> mylseek.c:35: error: '__NR__llseek' undeclared (first use in this
> function)
> mylseek.c:35: error: (Each undeclared identifier is reported only once
> mylseek.c:35: error: for each function it appears in.)

This is part of a 64-bit workaround for Linux that is no longer
needed. Somewhat surprisingly this compiles without errors on FC5,
but breaks on FC4. Normally things break the other way around.

	Wietse

diff -cr /tmp/tct-1.17/src/fstools/fs_tools.h ./src/fstools/fs_tools.h
*** /tmp/tct-1.17/src/fstools/fs_tools.h	Thu Oct  2 09:13:50 2003
--- ./src/fstools/fs_tools.h	Mon Apr  9 09:30:32 2007
***************
*** 203,213 ****
  #define SUPPORTED
  #include <linux/ext2_fs.h>
  #define HAVE_EXT2FS
  #define USE_MYLSEEK
  #define HAVE_LLSEEK
- #define HAVE_DTIME
  #define LSEEK		mylseek
  #define OFF_T		long long
  #define STRTOUL		strtoul
  #define DADDR_T		__u32
  #define EXT2FS_TYPE	"ext2fs"
--- 203,218 ----
  #define SUPPORTED
  #include <linux/ext2_fs.h>
  #define HAVE_EXT2FS
+ #define HAVE_DTIME
+ #if (_FILE_OFFSET_BITS == 64)
+ #define LSEEK		lseek
+ #define OFF_T		off_t
+ #else
  #define USE_MYLSEEK
  #define HAVE_LLSEEK
  #define LSEEK		mylseek
  #define OFF_T		long long
+ #endif
  #define STRTOUL		strtoul
  #define DADDR_T		__u32
  #define EXT2FS_TYPE	"ext2fs"
diff -cr /tmp/tct-1.17/src/fstools/makedefs ./src/fstools/makedefs
*** /tmp/tct-1.17/src/fstools/makedefs	Wed Oct  1 21:03:58 2003
--- ./src/fstools/makedefs	Mon Apr  9 09:32:52 2007
***************
*** 29,37 ****
      SunOS.5*)	DEFS="-DSUNOS5 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
  		RANLIB=":"
  		;;
!   Linux.2.4*)   DEFS="-DLINUX2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
  		;;
!     Linux.2*)   DEFS="-DLINUX2"
  		;;
             *)   echo unsupported system: $SYSTEM.$RELEASE 1>&2; exit 1
  		;;
--- 29,37 ----
      SunOS.5*)	DEFS="-DSUNOS5 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
  		RANLIB=":"
  		;;
! Linux.2.[0-3].*)DEFS="-DLINUX2"
  		;;
!    Linux.2.*)   DEFS="-DLINUX2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"
  		;;
             *)   echo unsupported system: $SYSTEM.$RELEASE 1>&2; exit 1
  		;;