pastebin - collaborative debugging tool
nrubsig.kpaste.net RSS


cthon04 cygwin patch
Posted by Anonymous on Mon 17th Feb 2025 10:09
raw | new post

  1. diff --git a/basic/test8.c b/basic/test8.c
  2. index d65eb3a..f993631 100644
  3. --- a/basic/test8.c
  4. +++ b/basic/test8.c
  5. @@ -43,7 +43,7 @@ static int Tflag = 0; /* print timing */
  6.  static int Fflag = 0;  /* test function only;  set count to 1, negate -t */
  7.  static int Nflag = 0;  /* Suppress directory operations */
  8.  
  9. -#define SNAME "/this/is/a/symlink"     /* symlink prefix */
  10. +#define SNAME "/dev/this/is/a/symlink" /* symlink prefix */
  11.  
  12.  static void
  13.  usage()
  14. diff --git a/lock/runtests b/lock/runtests
  15. index 21b09a5..4db16e2 100755
  16. --- a/lock/runtests
  17. +++ b/lock/runtests
  18. @@ -64,7 +64,7 @@ do
  19.                         ;;
  20.         esac
  21.         echo ""
  22. -       $i $TESTARGS $NFSTESTDIR
  23. +       ./$i $TESTARGS $NFSTESTDIR
  24.  done
  25.  
  26.  echo "Congratulations, you passed the locking tests!"
  27. diff --git a/special/Makefile b/special/Makefile
  28. index 77215c1..4377925 100644
  29. --- a/special/Makefile
  30. +++ b/special/Makefile
  31. @@ -3,7 +3,7 @@
  32.  #      1.4 Lachman ONC Test Suite source
  33.  #
  34.  
  35. -TESTS=op_unlk op_ren op_chmod dupreq excltest negseek rename holey \
  36. +TESTS=op_unlk op_chmod dupreq excltest negseek rename holey \
  37.         truncate nfsidem nstat stat stat2 touchn fstat rewind \
  38.         telldir bigfile bigfile2 freesp
  39.  DOSRUNFILES = scripts/*.bat
  40. diff --git a/special/freesp.c b/special/freesp.c
  41. index 1affa4a..9d5491a 100644
  42. --- a/special/freesp.c
  43. +++ b/special/freesp.c
  44. @@ -10,6 +10,10 @@
  45.   * Usage: freesp [filename]
  46.   */
  47.  
  48. +#if defined(__CYGWIN__)
  49. +#define _GNU_SOURCE 1
  50. +#endif
  51. +
  52.  #include <fcntl.h>
  53.  #include <stdio.h>
  54.  #include <stdlib.h>
  55. @@ -38,8 +42,7 @@ static char *filename = "freesp.dat";
  56.  
  57.  static void verify_size ARGS_((int, off_t));
  58.  
  59. -#ifndef F_FREESP
  60. -
  61. +#if !defined(F_FREESP) && !defined(FALLOC_FL_PUNCH_HOLE)
  62.  /*ARGUSED*/
  63.  int
  64.  main(argc, argv)
  65. @@ -49,8 +52,25 @@ main(argc, argv)
  66.         printf("fcntl(...F_FREESP...) not available on this platform.\n");
  67.         exit(0);
  68.  }
  69. +#else
  70. +#if defined(F_FREESP)
  71. +int fcntl_freesp(int fd, flock_t *freesp)
  72. +{
  73. +       return fcntl(fd, F_FREESP, &clear);
  74. +}
  75. +
  76. +#elif defined(FALLOC_FL_PUNCH_HOLE)
  77. +typedef struct flock flock_t;
  78. +
  79. +int fcntl_freesp(int fd, flock_t *freesp)
  80. +{
  81. +       return fallocate(fd,
  82. +               FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
  83. +               freesp->l_start,
  84. +               freesp->l_len);
  85. +}
  86. +#endif
  87.  
  88. -#else /* F_FREESP */
  89.  
  90.  int
  91.  main(argc, argv)
  92. @@ -103,8 +123,8 @@ main(argc, argv)
  93.         }
  94.         clear.l_start = 0;
  95.         clear.l_whence = SEEK_SET;
  96. -       clear.l_len = 0;                /* entire file */
  97. -       if (fcntl(fd, F_FREESP, &clear) < 0) {
  98. +       clear.l_len = NUMBUFS * BUFSIZE;                /* entire file */
  99. +       if (fcntl_freesp(fd, &clear) < 0) {
  100.                 fprintf(stderr, "can't clear %s: %s\n",
  101.                         filename, strerror(errno));
  102.                 exit(1);
  103. diff --git a/special/runtests.wrk b/special/runtests.wrk
  104. index 8f099fa..385ac61 100644
  105. --- a/special/runtests.wrk
  106. +++ b/special/runtests.wrk
  107. @@ -29,7 +29,7 @@ if [ "$CIFS" = "yes" ] && echo $MNTOPTIONS | grep -E "vers=2|vers=3" > /dev/null
  108.  then
  109.         echo "skipping test; not supported by SMB 2.0 and higher versions"
  110.  else
  111. -       TMPDIR= ./op_ren
  112. +       : # TMPDIR= ./op_ren
  113.  fi
  114.  
  115.  echo ""
  116. diff --git a/tests.init b/tests.init
  117. index 27e1a47..83670f2 100644
  118. --- a/tests.init
  119. +++ b/tests.init
  120. @@ -3,7 +3,7 @@
  121.  #
  122.  MNTOPTIONS="rw,hard,intr"
  123.  # Dummy MNTPOINT definition; should get overriden by server script.
  124. -MNTPOINT="/mnt/nfs"
  125. +MNTPOINT="/mnt/Windows_NT"
  126.  
  127.  SERVER=""
  128.  SERVPATH="/server"
  129. @@ -11,37 +11,11 @@ TEST="-a"
  130.  TESTARG="-t"
  131.  
  132.  # set MOUNTCMD and UMOUNTCMD
  133. -# Use this mount command if using:
  134. -#      BSD
  135. -#      SunOS 4.X
  136. -#      Tru64 UNIX
  137. -#      HPUX
  138. -#      Linux
  139. -#      AIX
  140. -#      Mac OS X
  141. -# At least some BSD systems don't recognize "hard" (since that's the
  142. -# default), so you might also want to use this definition of MNTOPTIONS.
  143. -MNTOPTIONS="rw,intr"
  144. -MOUNTCMD='./domount -o $MNTOPTIONS $SERVER\:$SERVPATH $MNTPOINT'
  145.  UMOUNTCMD='./domount -u $MNTPOINT'
  146.  
  147.  # set DASHN and BLC
  148. -# Use the next two lines if using:
  149. -#      BSD
  150. -#      SunOS 4.X
  151. -#      Linux
  152. -#      Tru64 UNIX
  153. -#      Mac OS X
  154. -DASHN=-n
  155. -BLC=
  156.  
  157.  # set PATH
  158. -# Use this path for:
  159. -#      Tru64 UNIX
  160. -#      SVR4
  161. -#      Linux
  162. -PATH=/bin:/usr/bin:/usr/ucb:/usr/ccs/bin:/sbin:/usr/sbin:.
  163. -
  164.  # -----------------------------------------------
  165.  # Defines for various variables used in scripts and makefiles.
  166.  #
  167. @@ -52,26 +26,3 @@ CC=cc
  168.  CFLAGS=
  169.  LIBS=
  170.  LOCKTESTS=tlock
  171. -MOUNT=/bin/mount
  172. -UMOUNT=/bin/umount
  173. -LOCKTESTS=`echo tlocklfs tlock64`
  174. -
  175. -# Use with Linux if your distro doesn't provide a "cc".
  176. -CC=gcc
  177. -
  178. -# Use with Linux 2.2 / GNU libc 2.0
  179. -#CFLAGS=`echo -DLINUX -DGLIBC=20 -DMMAP -DSTDARG -fwritable-strings`
  180. -#LIBS=`echo -lnsl`
  181. -
  182. -# Use with Linux 2.4 / GNU libc 2.2
  183. -#CFLAGS=`echo -DLINUX -DGLIBC=22 -DMMAP -DSTDARG -fwritable-strings`
  184. -#LIBS=`echo -lnsl`
  185. -
  186. -# Use with Linux 2.6 / gcc 4.0
  187. -CFLAGS=`echo -DLINUX -DHAVE_SOCKLEN_T -DGLIBC=22 -DMMAP -DSTDARG`
  188. -LIBS=`echo -lnsl`
  189. -
  190. -# Use with Linux glibc > 2.26
  191. -CFLAGS=`echo -DLINUX -DHAVE_SOCKLEN_T -DGLIBC=22 -DMMAP -DSTDARG`
  192. -CFLAGS+=`pkg-config --cflags libtirpc`
  193. -LIBS=`pkg-config --libs libtirpc`
  194. diff --git a/tools/Makefile b/tools/Makefile
  195. index ce2cbc7..8cc1903 100644
  196. --- a/tools/Makefile
  197. +++ b/tools/Makefile
  198. @@ -8,7 +8,7 @@
  199.  # 'make copy DESTDIR=path'      copies test programs to path
  200.  # 'make dist DESTDIR=path'      copies sources to path
  201.  
  202. -TESTS = tcp tcpd udp udpd dirdmp dirprt pmaptst pmapbrd
  203. +TESTS = tcp tcpd udp udpd dirdmp dirprt
  204.  
  205.  # dirdmp apparently doesn't work with Linux 2.2.  So for Linux systems,
  206.  # comment out the above definition and use this one.
  207. diff --git a/tools/dirdmp.c b/tools/dirdmp.c
  208. index 6b231a0..e8dcca3 100644
  209. --- a/tools/dirdmp.c
  210. +++ b/tools/dirdmp.c
  211. @@ -7,8 +7,8 @@
  212.  
  213.  #include <sys/param.h>
  214.  #include <sys/types.h>
  215. -#include <dirent.h>
  216.  #include <sys/stat.h>
  217. +#include <dirent.h>
  218.  #include <fcntl.h>
  219.  #include <stdio.h>
  220.  #include <stdlib.h>
  221. @@ -38,7 +38,7 @@ main(argc, argv)
  222.         int argc;
  223.         char *argv[];
  224.  {
  225. -#if defined(LINUX) || defined (AIX)
  226. +#if defined(LINUX) || defined(__CYGWIN__) || defined (AIX)
  227.         fprintf(stderr, "dirdmp is not supported on this platform.\n");
  228.         exit(1);
  229.  #else
  230. @@ -50,7 +50,7 @@ main(argc, argv)
  231.  #endif /* LINUX || AIX */
  232.  }
  233.  
  234. -#if !(defined(LINUX) || defined(AIX))
  235. +#if !(defined(LINUX) || defined(__CYGWIN__) || defined(AIX))
  236.  
  237.  static void
  238.  print(dir)
  239. diff --git a/tools/dirprt.c b/tools/dirprt.c
  240. index a0630eb..acb9ec3 100644
  241. --- a/tools/dirprt.c
  242. +++ b/tools/dirprt.c
  243. @@ -72,7 +72,7 @@ print(dir)
  244.                 return;
  245.         }
  246.         while ((dp = readdir(dirp)) != NULL) {
  247. -#if defined(SVR3) || defined(SVR4) || defined(LINUX)
  248. +#if defined(SVR3) || defined(SVR4) || defined(LINUX) || defined(__CYGWIN__)
  249.                 printf("%5ld %5ld %5d %s\n", (long)telldir(dirp),
  250.                        (long)dp->d_ino,
  251.                        dp->d_reclen, dp->d_name);

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at