valgrind.patch 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. --- valgrind-1.0pre6.orig/vg_libpthread.c Sat Jul 13 06:59:27 2002
  2. +++ valgrind-1.0pre6/vg_libpthread.c Sat Jul 27 02:50:53 2002
  3. @@ -2821,6 +2821,7 @@
  4. /* I've no idea what these are, but they get called quite a lot.
  5. Anybody know? */
  6. +#ifndef __UCLIBC__
  7. #undef _IO_flockfile
  8. void _IO_flockfile ( _IO_FILE * file )
  9. @@ -2837,6 +2838,7 @@
  10. }
  11. weak_alias(_IO_funlockfile, funlockfile);
  12. +#endif
  13. /* This doesn't seem to be needed to simulate libpthread.so's external
  14. interface, but many people complain about its absence. */
  15. --- valgrind-1.0pre6.orig/vg_clientfuncs.c Mon Jul 15 19:44:21 2002
  16. +++ valgrind-1.0pre6/vg_clientfuncs.c Sat Jul 27 02:59:33 2002
  17. @@ -560,12 +560,14 @@
  18. void VG_(__libc_freeres_wrapper)( void )
  19. {
  20. int res;
  21. +#ifndef __UCLIBC__
  22. extern void __libc_freeres(void);
  23. __libc_freeres();
  24. VALGRIND_MAGIC_SEQUENCE(res, 0 /* default */,
  25. VG_USERREQ__LIBC_FREERES_DONE, 0, 0, 0, 0);
  26. /*NOTREACHED*/
  27. vg_assert(12345+54321 == 999999);
  28. +#endif
  29. }
  30. --- valgrind-1.0pre6.orig/vg_unsafe.h Thu Jun 13 10:02:37 2002
  31. +++ valgrind-1.0pre6/vg_unsafe.h Tue Jul 23 23:36:45 2002
  32. @@ -51,9 +51,13 @@
  33. #include <linux/isdn.h> /* for ISDN ioctls */
  34. #include <scsi/sg.h> /* for the SG_* ioctls */
  35. +#include <scsi/scsi.h> /* for a few SCSI ioctls */
  36. +#include <scsi/scsi_ioctl.h>/* for even more SCSI ioctls */
  37. #include <sched.h> /* for struct sched_param */
  38. #include <linux/sysctl.h> /* for struct __sysctl_args */
  39. #include <linux/cdrom.h> /* for cd-rom ioctls */
  40. +#include <linux/hdreg.h> /* for ide ioctls */
  41. +#include <sys/mtio.h> /* for tape drive junk */
  42. #define __USE_LARGEFILE64
  43. #include <sys/stat.h> /* for struct stat */
  44. --- valgrind-1.0pre6.orig/vg_syscall_mem.c Sat Jul 13 06:44:39 2002
  45. +++ valgrind-1.0pre6/vg_syscall_mem.c Tue Jul 23 23:44:39 2002
  46. @@ -2050,6 +2050,99 @@
  47. sizeof(struct cdrom_msf));
  48. KERNEL_DO_SYSCALL(tid,res);
  49. break;
  50. +
  51. + /* Stuff added by Erik Andersen for general device probing/handling */
  52. + case CDROM_DRIVE_STATUS:
  53. + KERNEL_DO_SYSCALL(tid,res);
  54. + break;
  55. +#define BLKSSZGET _IO(0x12,104)
  56. + case BLKSSZGET:
  57. + must_be_writable(tst, "ioctl(BLKSSZGET)", arg3, sizeof(int));
  58. + KERNEL_DO_SYSCALL(tid,res);
  59. + if (!VG_(is_kerror)(res) && res == 0)
  60. + make_readable (arg3, sizeof(int));
  61. + break;
  62. +#define BLKGETSIZE64 _IOR(0x12,114,sizeof(unsigned long long*))
  63. + case BLKGETSIZE64:
  64. + must_be_writable(tst, "ioctl(BLKGETSIZE64)", arg3, sizeof(unsigned long long));
  65. + KERNEL_DO_SYSCALL(tid,res);
  66. + if (!VG_(is_kerror)(res) && res == 0)
  67. + make_readable (arg3, sizeof(unsigned long long));
  68. + break;
  69. + case HDIO_GETGEO:
  70. + {
  71. + struct hd_geometry {
  72. + unsigned char heads;
  73. + unsigned char sectors;
  74. + unsigned short cylinders;
  75. + unsigned long start;
  76. + };
  77. +
  78. + must_be_writable(tst, "ioctl(HDIO_GETGEO)", arg3, sizeof(struct hd_geometry));
  79. + KERNEL_DO_SYSCALL(tid,res);
  80. + if (!VG_(is_kerror)(res) && res == 0)
  81. + make_readable (arg3, sizeof(struct hd_geometry));
  82. + }
  83. + break;
  84. + case HDIO_GET_IDENTITY:
  85. + must_be_writable(tst, "ioctl(HDIO_GET_IDENTITY)", arg3, sizeof(struct hd_driveid));
  86. + KERNEL_DO_SYSCALL(tid,res);
  87. + if (!VG_(is_kerror)(res) && res == 0)
  88. + make_readable (arg3, sizeof(struct hd_driveid));
  89. + break;
  90. + case SCSI_IOCTL_GET_IDLUN:
  91. + {
  92. + struct scsi_idlun
  93. + {
  94. + int mux4;
  95. + int host_unique_id;
  96. +
  97. + };
  98. + must_be_writable(tst, "ioctl(SCSI_IOCTL_GET_IDLUN)", arg3, sizeof(struct scsi_idlun));
  99. + KERNEL_DO_SYSCALL(tid,res);
  100. + if (!VG_(is_kerror)(res) && res == 0)
  101. + make_readable (arg3, sizeof(struct scsi_idlun));
  102. + }
  103. + break;
  104. + case SCSI_IOCTL_SEND_COMMAND:
  105. + must_be_writable(tst, "ioctl(SCSI_IOCTL_SEND_COMMAND)", arg3,
  106. + ((2 * sizeof(unsigned int)) + 6 + 512));
  107. + KERNEL_DO_SYSCALL(tid,res);
  108. + if (!VG_(is_kerror)(res) && res == 0)
  109. + make_readable (arg3, ((2 * sizeof(unsigned int)) + 6 + 512));
  110. + break;
  111. + case SCSI_IOCTL_GET_BUS_NUMBER:
  112. + must_be_writable(tst, "ioctl(SCSI_IOCTL_GET_BUS_NUMBER)", arg3, sizeof(int));
  113. + KERNEL_DO_SYSCALL(tid,res);
  114. + if (!VG_(is_kerror)(res) && res == 0)
  115. + make_readable (arg3, sizeof(int));
  116. + break;
  117. + case SCSI_IOCTL_PROBE_HOST:
  118. + {
  119. + int xxxx;
  120. + char *array = (char*)arg3;
  121. + xxxx = array[0] + (array[1]<<8) + (array[2]<<16) + (array[3]<<24);
  122. + must_be_writable(tst, "ioctl(SCSI_IOCTL_PROBE_HOST)", arg3, xxxx);
  123. + KERNEL_DO_SYSCALL(tid,res);
  124. + if (!VG_(is_kerror)(res) && res == 0)
  125. + make_readable (arg3, xxxx);
  126. + }
  127. + break;
  128. +#define BLKFLSBUF _IO(0x12,97)
  129. + case BLKFLSBUF:
  130. + KERNEL_DO_SYSCALL(tid,res);
  131. + break;
  132. +#define BLKRRPART _IO(0x12,95)
  133. + case BLKRRPART:
  134. + KERNEL_DO_SYSCALL(tid,res);
  135. + break;
  136. + case MTIOCTOP:
  137. + must_be_writable(tst, "ioctl(MTIOCTOP)", arg3, sizeof(struct mtop));
  138. + KERNEL_DO_SYSCALL(tid,res);
  139. + if (!VG_(is_kerror)(res) && res == 0)
  140. + make_readable (arg3, sizeof(struct mtop));
  141. + break;
  142. +
  143. /* We don't have any specific information on it, so
  144. try to do something reasonable based on direction and
  145. size bits. The encoding scheme is described in