aboutsummaryrefslogtreecommitdiff
path: root/package/valgrind/valgrind-3.7.0-more-ioctls.patch
blob: fb583812019ac61e11c8d329bd789c2fbf390587 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
Add various ioctl()s

Patch initially written by Eric Andersen <andersen@codepoet.org>.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Index: valgrind-3.7.0/coregrind/m_syswrap/syswrap-linux.c
===================================================================
--- valgrind-3.7.0.orig/coregrind/m_syswrap/syswrap-linux.c	2011-10-27 12:55:05.000000000 +0200
+++ valgrind-3.7.0/coregrind/m_syswrap/syswrap-linux.c	2011-12-22 14:53:16.258126390 +0100
@@ -4058,7 +4058,33 @@
    case VKI_SG_GET_SG_TABLESIZE: /* 0x227f */
       PRE_MEM_WRITE( "ioctl(SG_GET_SG_TABLESIZE)", ARG3, sizeof(int) );
       break;
+   case VKI_SCSI_IOCTL_GET_IDLUN:
+      PRE_MEM_WRITE( "ioctl(SCSI_IOCTL_GET_IDLUN)", ARG3, sizeof(vki_scsi_idlun_t) );
+      break;
+   case VKI_SCSI_IOCTL_PROBE_HOST:
+      {
+	  int arraylen;
+	  char *array = (char*)ARG3;
+	  PRE_MEM_READ("ioctl(SCSI_IOCTL_PROBE_HOST)",  ARG3, sizeof(char)*4 );
+	  arraylen = array[0] + (array[1]<<8) + (array[2]<<16) + (array[3]<<24);
+	  PRE_MEM_WRITE( "ioctl(SCSI_IOCTL_PROBE_HOST)", ARG3, sizeof(char)*arraylen );
+      }
+      break;
+   case VKI_SCSI_IOCTL_GET_BUS_NUMBER:
+      PRE_MEM_WRITE( "ioctl(SCSI_IOCTL_GET_BUS_NUMBER)", ARG3, sizeof(int) );
+      break;
 
+   case VKI_FDRESET:
+      break;
+   case VKI_FDGETDRVTYP:
+      PRE_MEM_WRITE( "ioctl(FDGETDRVTYP)", ARG3, sizeof(char)*16 );
+      break;
+   case VKI_FDPOLLDRVSTAT:
+      PRE_MEM_WRITE( "ioctl(FDPOLLDRVSTAT)", ARG3, sizeof(vki_floppy_drive_struct_t) );
+      break;
+   case VKI_FDGETPRM:
+      PRE_MEM_WRITE( "ioctl(FDGETPRM)", ARG3, sizeof(vki_floppy_struct_t) );
+      break;
    case VKI_IIOCGETCPS:
       PRE_MEM_WRITE( "ioctl(IIOCGETCPS)", ARG3,
 		     VKI_ISDN_MAX_CHANNELS * 2 * sizeof(unsigned long) );
@@ -4373,6 +4399,8 @@
    case VKI_BLKROGET:
       PRE_MEM_WRITE( "ioctl(BLKROGET)", ARG3, sizeof(int));
       break;
+   case VKI_BLKRRPART:
+      break;
    case VKI_BLKGETSIZE:
       PRE_MEM_WRITE( "ioctl(BLKGETSIZE)", ARG3, sizeof(unsigned long));
       break;
@@ -4381,6 +4409,8 @@
    case VKI_BLKRAGET:
       PRE_MEM_WRITE( "ioctl(BLKRAGET)", ARG3, sizeof(long));
       break;
+   case VKI_BLKFLSBUF:
+      break;
    case VKI_BLKFRASET:
       break;
    case VKI_BLKFRAGET:
@@ -4447,6 +4477,8 @@
       PRE_MEM_WRITE( "ioctl(CDROMREADTOCENTRY)", ARG3, 
 		     sizeof(struct vki_cdrom_tocentry));
       break;
+   case VKI_CDROMEJECT:
+      break;
    case VKI_CDROMMULTISESSION: /* 0x5310 */
       PRE_MEM_WRITE( "ioctl(CDROMMULTISESSION)", ARG3,
 		     sizeof(struct vki_cdrom_multisession));
@@ -5321,7 +5353,28 @@
    case VKI_SG_GET_SG_TABLESIZE:
       POST_MEM_WRITE(ARG3, sizeof(int));
       break;      
+   case VKI_SCSI_IOCTL_GET_IDLUN:
+      POST_MEM_WRITE(ARG3, sizeof(vki_scsi_idlun_t));
+      break;
+   case VKI_SCSI_IOCTL_PROBE_HOST:
+      if (RES > 0 && ARG3 )
+	  POST_MEM_WRITE(ARG3, sizeof(char)*RES);
+      break;
+   case VKI_SCSI_IOCTL_GET_BUS_NUMBER:
+      POST_MEM_WRITE(ARG3, sizeof(int));
+      break;
 
+   case VKI_FDRESET:
+      break;
+   case VKI_FDGETDRVTYP:
+      POST_MEM_WRITE( ARG3, sizeof(char)*16 );
+      break;
+   case VKI_FDPOLLDRVSTAT:
+      POST_MEM_WRITE( ARG3, sizeof(vki_floppy_drive_struct_t) );
+      break;
+   case VKI_FDGETPRM:
+      POST_MEM_WRITE( ARG3, sizeof(vki_floppy_struct_t) );
+      break;
    case VKI_IIOCGETCPS:
       POST_MEM_WRITE( ARG3, VKI_ISDN_MAX_CHANNELS * 2 * sizeof(unsigned long) );
       break;
@@ -5542,6 +5595,8 @@
    case VKI_BLKROGET:
       POST_MEM_WRITE(ARG3, sizeof(int));
       break;
+   case VKI_BLKRRPART:
+      break;
    case VKI_BLKGETSIZE:
       POST_MEM_WRITE(ARG3, sizeof(unsigned long));
       break;
@@ -5550,6 +5605,8 @@
    case VKI_BLKRAGET:
       POST_MEM_WRITE(ARG3, sizeof(long));
       break;
+   case VKI_BLKFLSBUF:
+      break;
    case VKI_BLKFRASET:
       break;
    case VKI_BLKFRAGET:
@@ -5591,6 +5648,8 @@
    case VKI_CDROMREADTOCENTRY:
       POST_MEM_WRITE(ARG3, sizeof(struct vki_cdrom_tocentry));
       break;
+   case VKI_CDROMEJECT:
+      break;
    case VKI_CDROMMULTISESSION:
       POST_MEM_WRITE(ARG3, sizeof(struct vki_cdrom_multisession));
       break;
Index: valgrind-3.7.0/include/vki/vki-linux.h
===================================================================
--- valgrind-3.7.0.orig/include/vki/vki-linux.h	2011-10-26 23:24:31.000000000 +0200
+++ valgrind-3.7.0/include/vki/vki-linux.h	2011-12-22 14:53:16.258126390 +0100
@@ -1654,7 +1654,9 @@
 
 #define VKI_BLKROSET   _VKI_IO(0x12,93)	/* set device read-only (0 = read-write) */
 #define VKI_BLKROGET   _VKI_IO(0x12,94)	/* get read-only status (0 = read_write) */
+#define VKI_BLKRRPART  _VKI_IO(0x12,95) /* re-read partition table */
 #define VKI_BLKGETSIZE _VKI_IO(0x12,96) /* return device size /512 (long *arg) */
+#define VKI_BLKFLSBUF  _VKI_IO(0x12,97) /* flush buffer cache */
 #define VKI_BLKRASET   _VKI_IO(0x12,98)	/* set read ahead for block device */
 #define VKI_BLKRAGET   _VKI_IO(0x12,99)	/* get current read ahead setting */
 #define VKI_BLKFRASET  _VKI_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
@@ -1729,6 +1731,53 @@
 //#define SG_GET_COMMAND_Q 0x2270   /* Yields 0 (queuing off) or 1 (on) */
 #define VKI_SG_SET_COMMAND_Q 0x2271   /* Change queuing state with 0 or 1 */
 
+typedef struct vki_scsi_idlun
+{
+    int mux4;
+    int host_unique_id;
+
+} vki_scsi_idlun_t;
+#define VKI_SCSI_IOCTL_GET_IDLUN 0x5382		/* Gets a struct vki_scsi_idlun */
+#define VKI_SCSI_IOCTL_PROBE_HOST 0x5385	/* Gets an arrary describing the SCSI host */
+#define VKI_SCSI_IOCTL_GET_BUS_NUMBER 0x5386	/* Get the bus number for a device */
+
+//----------------------------------------------------------------------
+// From linux-2.6.8.1/include/linux/fd.h
+//----------------------------------------------------------------------
+#define VKI_FDRESET 0x254		/* Takes an int by value */
+#define VKI_FDGETDRVTYP 0x20f	/* Returns char floppy_drive_name[16] */
+typedef struct vki_floppy_drive_struct {
+	unsigned long flags;
+	unsigned long spinup_date;
+	unsigned long select_date;
+	unsigned long first_read_date;
+	short probed_format;
+	short track;
+	short maxblock;
+	short maxtrack;
+	int generation;
+	int keep_data;
+	int fd_ref;
+	int fd_device;
+	unsigned long last_checked;
+	char *dmabuf;
+	int bufblocks;
+} vki_floppy_drive_struct_t;
+#define VKI_FDPOLLDRVSTAT 0x213	    /* returns a struct floppy_drive_struct */
+typedef struct vki_floppy_struct {
+	unsigned int	size;
+	unsigned int	sect;
+	unsigned int	head;
+	unsigned int	track;
+	unsigned int	stretch;
+	unsigned char	gap;
+	unsigned char	rate;
+	unsigned char	spec1;
+	unsigned char	fmt_gap;
+	const char	* name;
+} vki_floppy_struct_t;
+#define VKI_FDGETPRM 0x204	    /* returns a struct floppy_struct */
+
 //----------------------------------------------------------------------
 // From linux-2.6.8.1/include/linux/cdrom.h
 //----------------------------------------------------------------------
@@ -1738,6 +1787,7 @@
                                            (struct cdrom_tochdr) */
 #define VKI_CDROMREADTOCENTRY	0x5306 /* Read TOC entry 
                                            (struct cdrom_tocentry) */
+#define VKI_CDROMEJECT		0x5309 /* Eject cdrom media */
 #define VKI_CDROMSUBCHNL	0x530b /* Read subchannel data 
                                            (struct cdrom_subchnl) */
 #define VKI_CDROMREADMODE2	0x530c /* Read CDROM mode 2 data (2336 Bytes)