Browse Source

--- Merging r19832 into '.':
U packages/gdbint/gen-gdblib-inc.sh
--- Merging r20168 into '.':
G packages/gdbint/gen-gdblib-inc.sh
--- Merging r20650 into '.':
G packages/gdbint/gen-gdblib-inc.sh
--- Merging r20859 into '.':
U ide/Makefile.fpc
--- Merging r20900 into '.':
U rtl/bsd/ossysc.inc
--- Merging r20904 into '.':
U rtl/netbsd/ptypes.inc
--- Merging r20906 into '.':
C ide/Makefile
G ide/Makefile.fpc
Summary of conflicts:
Text conflicts: 1

# revisions: 19832,20168,20650,20859,20900,20904,20906
------------------------------------------------------------------------
r19832 | pierre | 2011-12-12 17:48:37 +0100 (Mon, 12 Dec 2011) | 1 line
Changed paths:
M /trunk/packages/gdbint/gen-gdblib-inc.sh

Try to improve script
------------------------------------------------------------------------
------------------------------------------------------------------------
r20168 | pierre | 2012-01-25 08:42:40 +0100 (Wed, 25 Jan 2012) | 7 lines
Changed paths:
M /trunk/packages/gdbint/gen-gdblib-inc.sh

+ Use MAKE and AWK variables to try to find GNU make and GNU awk
if available.
+ Add dexplicit building rule for libgdb.a
This library is not generated automatically anymore after 7.4 release.
+ Only handle '-l' if it is at start of argument.


------------------------------------------------------------------------
------------------------------------------------------------------------
r20650 | pierre | 2012-03-29 14:54:39 +0200 (Thu, 29 Mar 2012) | 1 line
Changed paths:
M /trunk/packages/gdbint/gen-gdblib-inc.sh

Adapt to OpenBSD
------------------------------------------------------------------------
------------------------------------------------------------------------
r20859 | pierre | 2012-04-13 23:53:22 +0200 (Fri, 13 Apr 2012) | 1 line
Changed paths:
M /trunk/ide/Makefile.fpc

+ Add -Xd option for FreeBSD OS
------------------------------------------------------------------------
------------------------------------------------------------------------
r20900 | pierre | 2012-04-16 17:43:44 +0200 (Mon, 16 Apr 2012) | 1 line
Changed paths:
M /trunk/rtl/bsd/ossysc.inc

* OpenBSD uses a special sigprocmask syscall
------------------------------------------------------------------------
------------------------------------------------------------------------
r20904 | pierre | 2012-04-17 17:25:29 +0200 (Tue, 17 Apr 2012) | 1 line
Changed paths:
M /trunk/rtl/netbsd/ptypes.inc

correct TStatFs for netbsd
------------------------------------------------------------------------
------------------------------------------------------------------------
r20906 | pierre | 2012-04-18 09:57:48 +0200 (Wed, 18 Apr 2012) | 1 line
Changed paths:
M /trunk/ide/Makefile
M /trunk/ide/Makefile.fpc

Add neednostdlib=1 for netbsd to avoid use of incompatble system libraries
------------------------------------------------------------------------

git-svn-id: branches/fixes_2_6@20999 -

marco 13 years ago
parent
commit
f205931bf1
5 changed files with 207 additions and 43 deletions
  1. 8 1
      ide/Makefile
  2. 7 0
      ide/Makefile.fpc
  3. 136 26
      packages/gdbint/gen-gdblib-inc.sh
  4. 21 1
      rtl/bsd/ossysc.inc
  5. 35 15
      rtl/netbsd/ptypes.inc

+ 8 - 1
ide/Makefile

@@ -1,5 +1,5 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2011/12/30]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2012/04/22]
 #
 #
 default: all
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
@@ -302,16 +302,23 @@ needlinkparam=1
 endif
 endif
 ifeq ($(OS_TARGET),freebsd)
 ifeq ($(OS_TARGET),freebsd)
 needusrlocallib=1
 needusrlocallib=1
+neednostdlib=1
 endif
 endif
 ifeq ($(OS_TARGET),openbsd)
 ifeq ($(OS_TARGET),openbsd)
 needusrlocallib=1
 needusrlocallib=1
 endif
 endif
+ifeq ($(OS_TARGET),netbsd)
+neednostdlib=1
+endif
 ifdef needlinkparam
 ifdef needlinkparam
 override SPECIALLINK=-Xe -k--allow-multiple-definition
 override SPECIALLINK=-Xe -k--allow-multiple-definition
 endif
 endif
 ifdef needusrlocallib
 ifdef needusrlocallib
 override SPECIALLINK+=-Fl/usr/local/lib
 override SPECIALLINK+=-Fl/usr/local/lib
 endif
 endif
+ifdef neednostdlib
+override SPECIALLINK+=-Xd
+endif
 ifdef GDBLIBDIR
 ifdef GDBLIBDIR
 override LIBGDBFILE:=$(firstword $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR))))
 override LIBGDBFILE:=$(firstword $(wildcard $(addsuffix /libgdb.a,$(GDBLIBDIR))))
 endif
 endif

+ 7 - 0
ide/Makefile.fpc

@@ -56,10 +56,14 @@ endif
 
 
 ifeq ($(OS_TARGET),freebsd)
 ifeq ($(OS_TARGET),freebsd)
 needusrlocallib=1
 needusrlocallib=1
+neednostdlib=1
 endif
 endif
 ifeq ($(OS_TARGET),openbsd)
 ifeq ($(OS_TARGET),openbsd)
 needusrlocallib=1
 needusrlocallib=1
 endif
 endif
+ifeq ($(OS_TARGET),netbsd)
+neednostdlib=1
+endif
 
 
 ifdef needlinkparam
 ifdef needlinkparam
 override SPECIALLINK=-Xe -k--allow-multiple-definition
 override SPECIALLINK=-Xe -k--allow-multiple-definition
@@ -68,6 +72,9 @@ endif
 ifdef needusrlocallib
 ifdef needusrlocallib
 override SPECIALLINK+=-Fl/usr/local/lib
 override SPECIALLINK+=-Fl/usr/local/lib
 endif
 endif
+ifdef neednostdlib
+override SPECIALLINK+=-Xd
+endif
 # Try to find GDB library
 # Try to find GDB library
 # Look for a valid GDBLIBDIR environment variable
 # Look for a valid GDBLIBDIR environment variable
 ifdef GDBLIBDIR
 ifdef GDBLIBDIR

+ 136 - 26
packages/gdbint/gen-gdblib-inc.sh

@@ -1,7 +1,8 @@
 #!/usr/bin/env bash
 #!/usr/bin/env bash
 
 
-
-if [ "$1" == "--help" ]; then
+# Function to display help
+usage ()
+{
   echo "Script used to easily create collection of libraries needed"
   echo "Script used to easily create collection of libraries needed"
   echo "to generate a Free Pascal IDE with debugger support."
   echo "to generate a Free Pascal IDE with debugger support."
   echo "Usage: Copy this script to the directory where you just compile"
   echo "Usage: Copy this script to the directory where you just compile"
@@ -11,14 +12,76 @@ if [ "$1" == "--help" ]; then
   echo "with a single parameter specifying to which directory the libraries"
   echo "with a single parameter specifying to which directory the libraries"
   echo "should be copied."
   echo "should be copied."
   echo "Possible parameters for this script:"
   echo "Possible parameters for this script:"
-  echo "implicitlibs=\"space separated list if system librairies used\""
+  echo "--forcestatic, to convert all -lname into $LINKLIB libname.a"
+  echo "implicitlibs=\"space separated list of used system libraries\""
+  echo "libdir=\"space separated list of library directories\""
+}
 
 
+# Try to find GNU make and GNU awk
+MAKE=`which gmake 2> /dev/null`
+AWK=`which gawk 2> /dev/null`
+# Assume make is OK if gmake is not found
+if [ "${MAKE}" == "" ]; then
+  MAKE=make
+fi
+# Assume awk is OK if gawk is not found
+if [ "${AWK}" == "" ]; then
+  AWK=awk
+fi
+# Possible extra option to pass when rebuilding gdb executable below
+MAKEOPT=
+
+if [ "$1" == "--help" ]; then
+  usage
+  exit
+fi
+
+
+forcestatic=0
+
+# Function to treat all command line option
+handle_option ()
+{
+opt_handled=0
+if [ "$1" == "" ] ; then
+  return
+fi
+
+if [ "$1" == "--forcestatic" ]; then
+  echo "Using only static libraries in gdblib.inc"
+  forcestatic=1
+  MAKEOPT="LDFLAGS=-static"
+  opt_handled=1
 fi
 fi
 
 
 if [ "${1#implicitlibs=}" != "$1" ]; then
 if [ "${1#implicitlibs=}" != "$1" ]; then
   implicitlibs=${1#implicitlibs=}
   implicitlibs=${1#implicitlibs=}
   echo "Also adding implicit libs \"$implicitlibs\""
   echo "Also adding implicit libs \"$implicitlibs\""
+  opt_handled=1
 fi
 fi
+
+if [ "${1#libdir=}" != "$1" ]; then
+  libdir=${1#libdir=}
+  echo "libdir is set to \"$libdir\""
+  opt_handled=1
+fi
+}
+
+# Try to handle all command line options
+opt_handled=1
+while [ $opt_handled -eq 1 ]
+do
+  handle_option $1
+  if [ $opt_handled -eq 1 ] ; then
+    shift
+  fi
+done
+
+if [ "$1" != "" ]; then
+  echo "Unrecognized option \"$1\""
+  usage
+fi
+
 if [ "${PATHEXT}" != "" ]; then
 if [ "${PATHEXT}" != "" ]; then
   EXEEXT=.exe
   EXEEXT=.exe
   if [ "${DJDIR}" != "" ]; then
   if [ "${DJDIR}" != "" ]; then
@@ -28,20 +91,31 @@ if [ "${PATHEXT}" != "" ]; then
   fi
   fi
 else
 else
   EXEEXT=
   EXEEXT=
-  libdir=/lib
+  if [ "$libdir" == "" ]; then
+    libdir=/lib
+  fi
+fi
+
+if [ "$OSTYPE" == "msys" ]; then
+  echo "MSYS system detected"
+  in_msys=1
+else
+  in_msys=0
 fi
 fi
 
 
 echo "Deleting gdb${EXEEXT} to force recompile"
 echo "Deleting gdb${EXEEXT} to force recompile"
 rm -f gdb${EXEEXT}
 rm -f gdb${EXEEXT}
 echo "Rebuilding gdb${EXEEXT}"
 echo "Rebuilding gdb${EXEEXT}"
-MAKE=`which gmake 2> /dev/null`
 
 
-if [ "${MAKE}" == "" ]; then
-  MAKE=make
-fi
+${MAKE} gdb${EXEEXT} ${MAKEOPT} | tee make.log
 
 
-${MAKE} gdb${EXEEXT} | tee make.log
+# libgdb.a will not be built automatically anymore after
+# GDB release 7.4, so we need to explicitly make it.
+echo "Rebuilding GDB library if needed"
+${MAKE} libgdb.a ${MAKEOPT}
 
 
+# version.c is an automatically generated file from gdb/version.in
+# We extract GDB version from that file.
 gdb_full_version=`sed -n "s:.*version.*\"\(.*\)\".*:\1:p" version.c`
 gdb_full_version=`sed -n "s:.*version.*\"\(.*\)\".*:\1:p" version.c`
 gdbcvs=`sed -n "s:.*version.*\"\(.*\)cvs\(.*\)\".*:\1cvs\2:p" version.c`
 gdbcvs=`sed -n "s:.*version.*\"\(.*\)cvs\(.*\)\".*:\1cvs\2:p" version.c`
 gdb_version1=`sed -n "s:.*version.*\"\([0-9]*\)\.\([0-9]*\).*:\1:p" version.c`
 gdb_version1=`sed -n "s:.*version.*\"\([0-9]*\)\.\([0-9]*\).*:\1:p" version.c`
@@ -56,7 +130,7 @@ else
   gdbversion=${gdb_version1}${gdb_version2}
   gdbversion=${gdb_version1}${gdb_version2}
 fi
 fi
 
 
-cat make.log | gawk '
+cat make.log | ${AWK} '
 BEGIN {
 BEGIN {
 doprint=0
 doprint=0
 }
 }
@@ -77,14 +151,36 @@ gcccompiler=`sed -n "s:\([A-Za-z0-9_-]*gcc\) .*:\1:p" comp-cmd.log`
 if [ "$gcccompiler" != "" ]; then
 if [ "$gcccompiler" != "" ]; then
   gcclibs=`$gcccompiler -print-search-dirs | sed -n "s#.*libraries: =\(.*\)#\1#p" `
   gcclibs=`$gcccompiler -print-search-dirs | sed -n "s#.*libraries: =\(.*\)#\1#p" `
   if [ "$gcclibs" != "" ]; then
   if [ "$gcclibs" != "" ]; then
-    libdir=${gcclibs//:/ }
+    if [ $in_msys -eq 1 ]; then
+      # If we are on msys, gcc is mingw, so that it uses c:/dir
+      # while find is an msys utility that needs /c/dir path
+      # we do this conversion below
+      for let in a b c d e f g h i j k l m n o p q r s t u v w x y z; do
+        gcclibs=${gcclibs//$let:/\/$let}
+      done
+      for let in A B C D E F G H I J K L M N O P Q R S T U V W X Y Z; do
+        gcclibs=${gcclibs//$let:/\/$let}
+      done
+      libdir="$libdir ${gcclibs//;/ }"
+    else
+      # if ; is present in gcclibs,assume this is the separator instead of :
+      if [ "${gcclibs//;/ }" != "${gcclibs}" ]; then
+	if [ "${gcclibs// /_}" != "${gccclibs}" ]; then
+          # list also contains spaces, convert ' ' into '\ '
+          gcclibs=${gcclibs// /\\ }
+        fi
+        libdir="$libdir ${gcclibs//;/ }"
+      else
+        libdir="$libdir ${gcclibs//:/ }"
+      fi
+    fi
     echo "gcc libs are \"$libdir\""
     echo "gcc libs are \"$libdir\""
   fi
   fi
 fi
 fi
 
 
 # Try to locate all libraries
 # Try to locate all libraries
 echo Creating ./copy-libs.sh script
 echo Creating ./copy-libs.sh script
-cat comp-cmd.log | gawk -v libdir="${libdir}" -v implibs="${implicitlibs}" '
+cat comp-cmd.log | ${AWK} -v libdir="${libdir}" -v implibs="${implicitlibs}" '
 BEGIN {
 BEGIN {
   print "#!/usr/bin/env bash"
   print "#!/usr/bin/env bash"
   print "# copy-libs.sh generated by awk script"
   print "# copy-libs.sh generated by awk script"
@@ -102,7 +198,7 @@ BEGIN {
   print "  exit"
   print "  exit"
   print "fi"
   print "fi"
   print "# Copy gdblib.inc file"
   print "# Copy gdblib.inc file"
-  print "cp gdblib.inc ${destdir}"
+  print "cp -p gdblib.inc ${destdir}"
 }
 }
 
 
 {
 {
@@ -110,19 +206,21 @@ BEGIN {
 
 
   for (i=1; i<=nb; i++) {
   for (i=1; i<=nb; i++) {
     if ( list[i] ~ /lib[^ ]*\.a/ ) {
     if ( list[i] ~ /lib[^ ]*\.a/ ) {
+      print "# Looking for static libs"
       staticlib = gensub (/([^ ]*)(lib[^ ]*\.a)/,"\\1\\2 ","g",list[i]);
       staticlib = gensub (/([^ ]*)(lib[^ ]*\.a)/,"\\1\\2 ","g",list[i]);
-      print "cp " staticlib " ${destdir}";
+      print "cp -p " staticlib " ${destdir}";
     }
     }
     if ( list[i] ~ /lib[^ ]*\.so/ ) {
     if ( list[i] ~ /lib[^ ]*\.so/ ) {
       dynamiclib = gensub (/([^ ]*)(lib[^ ]*\.so)/,"\\1\\2 ","g",list[i]);
       dynamiclib = gensub (/([^ ]*)(lib[^ ]*\.so)/,"\\1\\2 ","g",list[i]);
       print "echo " dynamiclib " found";
       print "echo " dynamiclib " found";
     }
     }
-    if ( list[i] ~ /-l/ ) {
+    if ( list[i] ~ /^-l/ ) {
+      print "#Looking for shared libs"
       systemlib = gensub (/-l([^ ]*)/,"lib\\1.a ","g",list[i]);
       systemlib = gensub (/-l([^ ]*)/,"lib\\1.a ","g",list[i]);
-      print "systemlib=`find " libdir " -name " systemlib " 2> /dev/null `" ;
+      print "systemlib=`find " libdir " -iname " systemlib " -print 2> /dev/null `" ;
       print "if [ \"${systemlib}\" != \"\" ]; then";
       print "if [ \"${systemlib}\" != \"\" ]; then";
-      print "  echo System lib found: ${systemlib}";
-      print "  cp ${systemlib} ${destdir}";
+      print "  echo System lib found: ${systemlib%%[$IFS]*}";
+      print "  cp -p ${systemlib%%[$IFS]*} ${destdir}";
       print "else";
       print "else";
       print "  echo Library " systemlib " not found, shared library assumed";
       print "  echo Library " systemlib " not found, shared library assumed";
       print "fi";
       print "fi";
@@ -134,10 +232,10 @@ END {
   for (i=1;i<=nb; i++) {
   for (i=1;i<=nb; i++) {
     systemlib = "lib" list[i] ".a";
     systemlib = "lib" list[i] ".a";
     print "echo Adding system library " systemlib;
     print "echo Adding system library " systemlib;
-    print "systemlib=`find " libdir " -name " systemlib " 2> /dev/null `" ;
+    print "systemlib=`find " libdir " -iname " systemlib " -print 2> /dev/null `" ;
     print "if [ \"${systemlib}\" != \"\" ]; then";
     print "if [ \"${systemlib}\" != \"\" ]; then";
-    print "  echo System lib found: ${systemlib}";
-    print "  cp ${systemlib} ${destdir}";
+    print "  echo System lib found: ${systemlib%%[$IFS]*}";
+    print "  cp -p ${systemlib%%[$IFS]*} ${destdir}";
     print "else";
     print "else";
     print "  echo Library " systemlib " not found, shared library assumed";
     print "  echo Library " systemlib " not found, shared library assumed";
     print "fi";
     print "fi";
@@ -149,8 +247,8 @@ chmod u+x ./copy-libs.sh
 
 
 echo Creating ./gdblib.inc file
 echo Creating ./gdblib.inc file
 # Generate gdblib.inc file
 # Generate gdblib.inc file
-cat comp-cmd.log |gawk -v gdbcvs=${gdbcvs} -v implibs="${implicitlibs}" \
-  -v gdbversion=${gdbversion} '
+cat comp-cmd.log |${AWK} -v gdbcvs=${gdbcvs} -v implibs="${implicitlibs}" \
+  -v gdbversion=${gdbversion} -v forcestatic=${forcestatic} '
 BEGIN {
 BEGIN {
   use_mingw=0;
   use_mingw=0;
   print "{ libgdb.inc file generated by awk script }"
   print "{ libgdb.inc file generated by awk script }"
@@ -182,15 +280,27 @@ BEGIN {
     print librarypath;
     print librarypath;
   }
   }
   if ( list[i] ~ /-l/ ) {
   if ( list[i] ~ /-l/ ) {
-    systemlib = gensub (/-l([^ ]*)/,"{$LINKLIB \\1} { with -l gcc option}","g",list[i]);
-    print systemlib;
+    systemlib = gensub (/-l([^ ]*)/,"\\1","g",list[i]);
+    if (forcestatic == 1) {
+      systemlib="lib" systemlib ".a"
+    }
+    print "{$LINKLIB " systemlib "} { with -l gcc option}";
   }
   }
   }
   }
 }
 }
 END {
 END {
   nb = split (implibs,list);
   nb = split (implibs,list);
   for (i=1;i<=nb; i++) {
   for (i=1;i<=nb; i++) {
-    print "{$LINKLIB " list[i] "} { implicit library } "
+    if ( list[i] ~ /lib.*\.a/ ) {
+      lib=list[i];
+    } else {
+      if ( forcestatic == 1 ) {
+        lib="lib" list[i] ".a";
+      } else {
+        lib=list[i];
+      }
+    }
+    print "{$LINKLIB " lib "} { implicit library } "
   }
   }
   print "{$endif COMPILING_GDBINT_UNIT }"
   print "{$endif COMPILING_GDBINT_UNIT }"
   print "{$undef NotImplemented}"
   print "{$undef NotImplemented}"

+ 21 - 1
rtl/bsd/ossysc.inc

@@ -480,8 +480,28 @@ function FPSigProcMask(how:cint;nset : psigset;oset : psigset):cint; [public, al
   if OldSSet is non-null, the old set will be saved there.
   if OldSSet is non-null, the old set will be saved there.
 }
 }
 
 
-begin
+{$ifdef OpenBSD}
+  { OpenBSD sigprocmask signal uses
+    sigset_t that are cint type
+    the value of nset^[0] must be passed as second parameter
+    the old mask value is in return value }
+  { How do we know if the call failed... PM }
+{$define OS_SIGPROCMASK_RETURNS_OVAL}
+{$endif}
+{$ifdef OS_SIGPROCMASK_RETURNS_OVAL}
+  var
+    res : cint;
+{$endif OS_SIGPROCMASK_RETURNS_OVAL}
+begin
+{$ifdef OS_SIGPROCMASK_RETURNS_OVAL}
+  res:=do_syscall(syscall_nr_sigprocmask,tsysparam(how),TSysParam(nset^[0]));
+  if assigned(oset) then
+    oset^[0]:=res;
+  FPsigprocmask:=0;
+
+{$else OS_SIGPROCMASK_RETURNS_OVAL}
   FPsigprocmask:=do_syscall(syscall_nr_sigprocmask,tsysparam(how),TSysParam(nset),TSysParam(oset));
   FPsigprocmask:=do_syscall(syscall_nr_sigprocmask,tsysparam(how),TSysParam(nset),TSysParam(oset));
+{$endif OS_SIGPROCMASK_RETURNS_OVAL}
 end;
 end;
 {$user BLA!}
 {$user BLA!}
 Function FpNanoSleep(req : ptimespec;rem : ptimespec) : cint; [public, alias : 'FPC_SYSC_NANOSLEEP'];
 Function FpNanoSleep(req : ptimespec;rem : ptimespec) : cint; [public, alias : 'FPC_SYSC_NANOSLEEP'];

+ 35 - 15
rtl/netbsd/ptypes.inc

@@ -96,16 +96,40 @@ type
     pSocklen = ^socklen_t;
     pSocklen = ^socklen_t;
 
 
 Const
 Const
-{$warning Check me, I'am from FreeBSD}
-    MNAMLEN   = 80;      // slightly machine specific.
-    MFSNamLen = 16;	
+    MNAMELEN   = 90;      // found in sys/mount.h
+    MNAMLEN = MNAMELEN; // Keep all constant name.
+    MFSNAMELEN = 16;// found in sys/compat/sys/mount.h	
+    MFSNamLen = MFSNAMELEN;	
 type
 type
-{$warning Check me, I'am from FreeBSD}
-    fsid_t  = array[0..1] of cint;
+{ Checked, found in sys/fstypes.h }
+    fsid_t  = array[0..1] of cint32;
     // Kernel statfs
     // Kernel statfs
-{$warning Check me, I'am from FreeBSD}
-    TStatfs = packed record
-      spare2,            { place holder}
+{ Checked, in sys/compat/sys/mount.h header }
+(*
+struct statfs12 {
+	short	f_type;			/* type of file system */
+	u_short	f_oflags;		/* deprecated copy of mount flags */
+	long	f_bsize;		/* fundamental file system block size */
+	long	f_iosize;		/* optimal transfer block size */
+	long	f_blocks;		/* total data blocks in file system */
+	long	f_bfree;		/* free blocks in fs */
+	long	f_bavail;		/* free blocks avail to non-superuser */
+	long	f_files;		/* total file nodes in file system */
+	long	f_ffree;		/* free file nodes in fs */
+	fsid_t	f_fsid;			/* file system id */
+	uid_t	f_owner;		/* user that mounted the file system */
+	long	f_flags;		/* copy of mount flags */
+	long	f_syncwrites;		/* count of sync writes since mount */
+	long	f_asyncwrites;		/* count of async writes since mount */
+	long	f_spare[1];		/* spare for later */
+	char	f_fstypename[MFSNAMELEN]; /* fs type name */
+	char	f_mntonname[MNAMELEN];	  /* directory on which mounted */
+	char	f_mntfromname[MNAMELEN];  /* mounted file system */
+};
+*)
+    TStatfs12 = record
+      f_type : shortint;
+      f_oflags : word;
       bsize,             { fundamental block size}
       bsize,             { fundamental block size}
       iosize,            { optimal block size }
       iosize,            { optimal block size }
       blocks,            {  total blocks}
       blocks,            {  total blocks}
@@ -115,19 +139,15 @@ type
       ffree          : clong ;    { file nodes free}
       ffree          : clong ;    { file nodes free}
       fsid           : fsid_t;
       fsid           : fsid_t;
       fowner         : tuid; {mounter uid}
       fowner         : tuid; {mounter uid}
-      ftype          : cint;
-      fflags         : cint; {copy of mount flags}
+      fflags         : clong; {copy of mount flags}
       fsyncwrites,
       fsyncwrites,
       fasyncwrites   : clong;
       fasyncwrites   : clong;
+      fspare0        : array [0..0] of clong;
       fstypename     : array[0..MFSNamLen-1] of char;
       fstypename     : array[0..MFSNamLen-1] of char;
       mountpoint     : array[0..MNAMLEN-1] of char;
       mountpoint     : array[0..MNAMLEN-1] of char;
-      fsyncreads,            { count of sync reads since mount }
-      fasyncreads    : clong;
-      fspares1       : cshort;
       mnfromname     : array[0..MNAMLEN-1] of char;
       mnfromname     : array[0..MNAMLEN-1] of char;
-      fspares2       : cshort;
-      fspare3        : array[0..1] of clong;
     end;
     end;
+    TStatFS = TStatFS12;   
     PStatFS=^TStatFS;
     PStatFS=^TStatFS;
     timeval = packed record
     timeval = packed record
                 tv_sec,
                 tv_sec,