ppc64: Arguments to iselInt128Expr_to_32x4 should be initialized.
[valgrind.git] / memcheck / tests / solaris / scalar_ioctl.c
blobe9e70eee56a262e095c5bcc5505e63703594be5d
1 /* Basic ioctl scalar tests. */
3 #define __EXTENSIONS__ 1
5 #include "scalar.h"
7 #include <net/if.h>
8 #include <sys/crypto/ioctl.h>
9 #include <sys/dditypes.h>
10 #include <sys/devinfo_impl.h>
11 #include <sys/dtrace.h>
12 #include <sys/filio.h>
13 #include <sys/stat.h> /* for _ST_FSTYPSZ */
14 #include <sys/mntio.h>
15 #include <sys/mnttab.h>
16 #include <sys/pool_impl.h>
17 #include <sys/sockio.h>
18 #include <sys/stropts.h>
19 #include <sys/termios.h>
21 /* pools */
22 __attribute__((noinline))
23 static void sys_ioctl_POOL_STATUSQ(void)
25 GO(SYS_ioctl, "(POOL_STATUSQ) 3s 1m");
26 SY(SYS_ioctl, x0 - 1, x0 + POOL_STATUSQ, x0); FAIL;
29 /* mntio */
30 __attribute__((noinline))
31 static void sys_ioctl_MNTIOC_GETEXTMNTENT(void)
33 GO(SYS_ioctl, "(MNTIOC_GETEXTMNTENT) 3s 1m");
34 SY(SYS_ioctl, x0 - 1, x0 + MNTIOC_GETEXTMNTENT, x0 + 1); FAIL;
37 __attribute__((noinline))
38 static void sys_ioctl_MNTIOC_GETEXTMNTENT_2(void)
40 struct mntentbuf embuf;
42 embuf.mbuf_emp = (void *) (x0 + 1);
43 embuf.mbuf_buf = (void *) (x0 + 1);
44 embuf.mbuf_bufsize = x0 + 1;
46 GO(SYS_ioctl, "(MNTIOC_GETEXTMNTENT) 4s 2m");
47 SY(SYS_ioctl, x0 - 1, x0 + MNTIOC_GETEXTMNTENT, &embuf + x0); FAIL;
50 __attribute__((noinline))
51 static void sys_ioctl_MNTIOC_GETEXTMNTENT_3(void)
53 struct extmnttab mnt;
54 struct mntentbuf embuf;
56 mnt.mnt_special = (void *) (x0 + 1);
57 mnt.mnt_mountp = (void *) (x0 + 1);
58 mnt.mnt_fstype = (void *) (x0 + 1);
59 mnt.mnt_mntopts = (void *) (x0 + 1);
60 mnt.mnt_time = (void *) (x0 + 1);
62 embuf.mbuf_emp = x0 + &mnt;
63 embuf.mbuf_buf = (void *) (x0 + 1);
64 embuf.mbuf_bufsize = x0 + 1;
66 GO(SYS_ioctl, "(MNTIOC_GETEXTMNTENT) 5s 6m");
67 SY(SYS_ioctl, x0 - 1, x0 + MNTIOC_GETEXTMNTENT, &embuf + x0); FAIL;
70 __attribute__((noinline))
71 static void sys_ioctl_MNTIOC_GETMNTANY(void)
73 GO(SYS_ioctl, "(MNTIOC_GETMNTANY) 3s 1m");
74 SY(SYS_ioctl, x0 - 1, x0 + MNTIOC_GETMNTANY, x0 + 1); FAIL;
77 __attribute__((noinline))
78 static void sys_ioctl_MNTIOC_GETMNTANY_2(void)
80 struct mntentbuf embuf;
82 embuf.mbuf_emp = (void *) (x0 + 1);
83 embuf.mbuf_buf = (void *) (x0 + 1);
84 embuf.mbuf_bufsize = x0 + 1;
86 GO(SYS_ioctl, "(MNTIOC_GETMNTANY) 4s 2m");
87 SY(SYS_ioctl, x0 - 1, x0 + MNTIOC_GETMNTANY, &embuf + x0); FAIL;
90 __attribute__((noinline))
91 static void sys_ioctl_MNTIOC_GETMNTANY_3(void)
93 struct mnttab mnt;
94 struct mntentbuf embuf;
96 mnt.mnt_special = (void *) (x0 + 1);
97 mnt.mnt_mountp = (void *) (x0 + 1);
98 mnt.mnt_fstype = (void *) (x0 + 1);
99 mnt.mnt_mntopts = (void *) (x0 + 1);
100 mnt.mnt_time = (void *) (x0 + 1);
102 embuf.mbuf_emp = x0 + (struct extmnttab *) &mnt;
103 embuf.mbuf_buf = (void *) (x0 + 1);
104 embuf.mbuf_bufsize = x0 + 1;
106 GO(SYS_ioctl, "(MNTIOC_GETMNTANY) 5s 6m");
107 SY(SYS_ioctl, x0 - 1, x0 + MNTIOC_GETMNTANY, &embuf + x0); FAIL;
110 /* termio/termios */
111 __attribute__((noinline))
112 static void sys_ioctl_TCGETA(void)
114 GO(SYS_ioctl, "(TCGETA) 3s 1m");
115 SY(SYS_ioctl, x0 - 1, x0 + TCGETA, x0); FAIL;
118 __attribute__((noinline))
119 static void sys_ioctl_TCGETS(void)
121 GO(SYS_ioctl, "(TCGETS) 3s 1m");
122 SY(SYS_ioctl, x0 - 1, x0 + TCGETS, x0); FAIL;
125 __attribute__((noinline))
126 static void sys_ioctl_TCSETS(void)
128 GO(SYS_ioctl, "(TCSETS) 3s 1m");
129 SY(SYS_ioctl, x0 - 1, x0 + TCSETS, x0); FAIL;
132 __attribute__((noinline))
133 static void sys_ioctl_TCSETSW(void)
135 GO(SYS_ioctl, "(TCSETSW) 3s 1m");
136 SY(SYS_ioctl, x0 - 1, x0 + TCSETSW, x0); FAIL;
139 __attribute__((noinline))
140 static void sys_ioctl_TCSETSF(void)
142 GO(SYS_ioctl, "(TCSETSF) 3s 1m");
143 SY(SYS_ioctl, x0 - 1, x0 + TCSETSF, x0); FAIL;
146 __attribute__((noinline))
147 static void sys_ioctl_TIOCGWINSZ(void)
149 GO(SYS_ioctl, "(TIOCGWINSZ) 3s 1m");
150 SY(SYS_ioctl, x0 - 1, x0 + TIOCGWINSZ, x0); FAIL;
153 __attribute__((noinline))
154 static void sys_ioctl_TIOCSWINSZ(void)
156 GO(SYS_ioctl, "(TIOCSWINSZ) 3s 1m");
157 SY(SYS_ioctl, x0 - 1, x0 + TIOCSWINSZ, x0); FAIL;
160 __attribute__((noinline))
161 static void sys_ioctl_TIOCGPGRP(void)
163 GO(SYS_ioctl, "(TIOCGPGRP) 3s 1m");
164 SY(SYS_ioctl, x0 - 1, x0 + TIOCGPGRP, x0); FAIL;
167 __attribute__((noinline))
168 static void sys_ioctl_TIOCSPGRP(void)
170 GO(SYS_ioctl, "(TIOCSPGRP) 3s 1m");
171 SY(SYS_ioctl, x0 - 1, x0 + TIOCSPGRP, x0); FAIL;
174 __attribute__((noinline))
175 static void sys_ioctl_TIOCGSID(void)
177 GO(SYS_ioctl, "(TIOCGSID) 3s 1m");
178 SY(SYS_ioctl, x0 - 1, x0 + TIOCGSID, x0); FAIL;
181 __attribute__((noinline))
182 static void sys_ioctl_TIOCNOTTY(void)
184 GO(SYS_ioctl, "(TIOCNOTTY) 2s 0m");
185 SY(SYS_ioctl, x0 - 1, x0 + TIOCNOTTY); FAIL;
188 __attribute__((noinline))
189 static void sys_ioctl_TIOCSCTTY(void)
191 GO(SYS_ioctl, "(TIOCSCTTY) 2s 0m");
192 SY(SYS_ioctl, x0 - 1, x0 + TIOCSCTTY); FAIL;
195 /* STREAMS */
196 __attribute__((noinline))
197 static void sys_ioctl_I_PUSH(void)
199 GO(SYS_ioctl, "(I_PUSH) 3s 1m");
200 SY(SYS_ioctl, x0 - 1, x0 + I_PUSH, x0 + 1); FAIL;
203 __attribute__((noinline))
204 static void sys_ioctl_I_FLUSH(void)
206 GO(SYS_ioctl, "(I_FLUSH) 3s 0m");
207 SY(SYS_ioctl, x0 - 1, x0 + I_FLUSH, x0 + FLUSHR); FAIL;
210 __attribute__((noinline))
211 static void sys_ioctl_I_STR(void)
213 GO(SYS_ioctl, "(I_STR) 3s 1m");
214 SY(SYS_ioctl, x0 - 1, x0 + I_STR, x0 + 1); FAIL;
217 __attribute__((noinline))
218 static void sys_ioctl_I_STR_2(void)
220 struct strioctl str;
222 str.ic_cmd = x0;
223 str.ic_timout = x0;
224 str.ic_len = x0 + 1;
225 str.ic_dp = (void *) (x0 + 1);
227 GO(SYS_ioctl, "(I_STR) 4s 1m");
228 SY(SYS_ioctl, x0 - 1, x0 + I_STR, &str + x0); FAIL;
231 __attribute__((noinline))
232 static void sys_ioctl_I_FIND(void)
234 GO(SYS_ioctl, "(I_FIND) 3s 1m");
235 SY(SYS_ioctl, x0 - 1, x0 + I_FIND, x0 + 1); FAIL;
238 __attribute__((noinline))
239 static void sys_ioctl_I_PEEK(void)
241 GO(SYS_ioctl, "(I_PEEK) 3s 7m");
242 SY(SYS_ioctl, x0 - 1, x0 + I_PEEK, x0 + 1); FAIL;
245 __attribute__((noinline))
246 static void sys_ioctl_I_PEEK_2(void)
248 struct strpeek peek;
250 peek.ctlbuf.maxlen = x0 + 1;
251 peek.ctlbuf.len = x0;
252 peek.ctlbuf.buf = (void*)(x0 + 1);
253 peek.databuf.maxlen = x0 + 1;
254 peek.databuf.len = x0;
255 peek.databuf.buf = (void*)(x0 + 1);
256 peek.flags = x0;
258 GO(SYS_ioctl, "(I_PEEK) 3s 7m");
259 SY(SYS_ioctl, x0 - 1, x0 + I_PEEK, &peek + x0); FAIL;
262 __attribute__((noinline))
263 static void sys_ioctl_I_CANPUT(void)
265 GO(SYS_ioctl, "(I_CANPUT) 3s 0m");
266 SY(SYS_ioctl, x0 - 1, x0 + I_CANPUT, x0); FAIL;
269 /* sockio */
270 __attribute__((noinline))
271 static void sys_ioctl_SIOCGIFCONF(void)
273 GO(SYS_ioctl, "(SIOCGIFCONF), 3s 2m");
274 SY(SYS_ioctl, x0 - 1, x0 + SIOCGIFCONF, x0 - 1); FAIL;
277 __attribute__((noinline))
278 static void sys_ioctl_SIOCGIFCONF_2(void)
280 struct ifconf ifc;
281 char buf[] = "";
283 ifc.ifc_len = x0 + 1;
284 ifc.ifc_buf = (void *) (x0 + buf);
286 GO(SYS_ioctl, "(SIOCGIFCONF), 5s 0m");
287 SY(SYS_ioctl, x0 - 1, x0 + SIOCGIFCONF, &ifc + x0); FAIL;
290 __attribute__((noinline))
291 static void sys_ioctl_SIOCGIFFLAGS(void)
293 GO(SYS_ioctl, "(SIOCGIFFLAGS) 3s 2m");
294 SY(SYS_ioctl, x0 - 1, x0 + SIOCGIFFLAGS, x0 - 1); FAIL;
297 __attribute__((noinline))
298 static void sys_ioctl_SIOCGIFFLAGS_2(void)
300 struct ifreq ifr;
302 ifr.ifr_name[0] = x0 + 'l';
303 ifr.ifr_name[1] = x0 + 'o';
304 ifr.ifr_name[2] = x0 + '0';
305 ifr.ifr_name[3] = x0 + '\0';
307 GO(SYS_ioctl, "(SIOCGIFFLAGS), 4s 0m");
308 SY(SYS_ioctl, x0 - 1, x0 + SIOCGIFFLAGS, &ifr + x0); FAIL;
311 __attribute__((noinline))
312 static void sys_ioctl_SIOCGIFNETMASK(void)
314 GO(SYS_ioctl, "(SIOCGIFNETMASK) 3s 2m");
315 SY(SYS_ioctl, x0 - 1, x0 + SIOCGIFNETMASK, x0 - 1); FAIL;
318 __attribute__((noinline))
319 static void sys_ioctl_SIOCGIFNETMASK_2(void)
321 struct ifreq ifr;
323 ifr.ifr_name[0] = x0 + 'l';
324 ifr.ifr_name[1] = x0 + 'o';
325 ifr.ifr_name[2] = x0 + '0';
326 ifr.ifr_name[3] = x0 + '\0';
328 GO(SYS_ioctl, "(SIOCGIFNETMASK), 4s 0m");
329 SY(SYS_ioctl, x0 - 1, x0 + SIOCGIFNETMASK, &ifr + x0); FAIL;
332 __attribute__((noinline))
333 static void sys_ioctl_SIOCGIFNUM(void)
335 int ifnum;
337 GO(SYS_ioctl, "(SIOCGIFNUM) 3s 0m");
338 SY(SYS_ioctl, x0 - 1, x0 + SIOCGIFNUM, &ifnum + x0); FAIL;
341 __attribute__((noinline))
342 static void sys_ioctl_SIOCGIFNUM_2(void)
344 GO(SYS_ioctl, "(SIOCGIFNUM) 3s 1m");
345 SY(SYS_ioctl, x0 - 1, x0 + SIOCGIFNUM, x0 - 1); FAIL;
348 __attribute__((noinline))
349 static void sys_ioctl_SIOCGLIFBRDADDR(void)
351 GO(SYS_ioctl, "(SIOCGLIFBRDADDR) 3s 2m");
352 SY(SYS_ioctl, x0 - 1, x0 + SIOCGLIFBRDADDR, x0 - 1); FAIL;
355 __attribute__((noinline))
356 static void sys_ioctl_SIOCGLIFBRDADDR_2(void)
358 struct lifreq lifr;
360 lifr.lifr_name[0] = x0 + 'l';
361 lifr.lifr_name[1] = x0 + 'o';
362 lifr.lifr_name[2] = x0 + '0';
363 lifr.lifr_name[3] = x0 + '\0';
365 GO(SYS_ioctl, "(SIOCGLIFBRDADDR), 4s 0m");
366 SY(SYS_ioctl, x0 - 1, x0 + SIOCGLIFBRDADDR, &lifr + x0); FAIL;
369 __attribute__((noinline))
370 static void sys_ioctl_SIOCGLIFCONF(void)
372 GO(SYS_ioctl, "(SIOCGLIFCONF), 3s 4m");
373 SY(SYS_ioctl, x0 - 1, x0 + SIOCGLIFCONF, x0 - 1); FAIL;
376 __attribute__((noinline))
377 static void sys_ioctl_SIOCGLIFCONF_2(void)
379 struct lifconf lifc;
380 char buf[] = "";
382 lifc.lifc_len = x0 + 1;
383 lifc.lifc_buf = (void *) (x0 + buf);
384 lifc.lifc_family = x0 + 1;
385 lifc.lifc_flags = x0 + 0;
387 GO(SYS_ioctl, "(SIOCGLIFCONF), 7s 0m");
388 SY(SYS_ioctl, x0 - 1, x0 + SIOCGLIFCONF, &lifc + x0); FAIL;
391 __attribute__((noinline))
392 static void sys_ioctl_SIOCGLIFFLAGS(void)
394 GO(SYS_ioctl, "(SIOCGLIFFLAGS) 3s 2m");
395 SY(SYS_ioctl, x0 - 1, x0 + SIOCGLIFFLAGS, x0 - 1); FAIL;
398 __attribute__((noinline))
399 static void sys_ioctl_SIOCGLIFFLAGS_2(void)
401 struct lifreq lifr;
403 lifr.lifr_name[0] = x0 + 'l';
404 lifr.lifr_name[1] = x0 + 'o';
405 lifr.lifr_name[2] = x0 + '0';
406 lifr.lifr_name[3] = x0 + '\0';
408 GO(SYS_ioctl, "(SIOCGLIFFLAGS), 4s 0m");
409 SY(SYS_ioctl, x0 - 1, x0 + SIOCGLIFFLAGS, &lifr + x0); FAIL;
412 __attribute__((noinline))
413 static void sys_ioctl_SIOCGLIFNETMASK(void)
415 GO(SYS_ioctl, "(SIOCGLIFNETMASK) 3s 2m");
416 SY(SYS_ioctl, x0 - 1, x0 + SIOCGLIFNETMASK, x0 - 1); FAIL;
419 __attribute__((noinline))
420 static void sys_ioctl_SIOCGLIFNETMASK_2(void)
422 struct lifreq lifr;
424 lifr.lifr_name[0] = x0 + 'l';
425 lifr.lifr_name[1] = x0 + 'o';
426 lifr.lifr_name[2] = x0 + '0';
427 lifr.lifr_name[3] = x0 + '\0';
429 GO(SYS_ioctl, "(SIOCGLIFNETMASK), 4s 0m");
430 SY(SYS_ioctl, x0 - 1, x0 + SIOCGLIFNETMASK, &lifr + x0); FAIL;
433 __attribute__((noinline))
434 static void sys_ioctl_SIOCGLIFNUM(void)
436 struct lifnum lifn;
438 lifn.lifn_family = x0;
439 lifn.lifn_flags = x0;
441 GO(SYS_ioctl, "(SIOCGLIFNUM) 4s 0m");
442 SY(SYS_ioctl, x0 - 1, x0 + SIOCGLIFNUM, &lifn + x0); FAIL;
445 /* filio */
446 __attribute__((noinline))
447 static void sys_ioctl_FIOSETOWN(void)
449 pid_t pid;
451 GO(SYS_ioctl, "(FIOSETOWN) 4s 0m");
452 SY(SYS_ioctl, x0 - 1, x0 + FIOSETOWN, &pid + x0); FAIL;
455 __attribute__((noinline))
456 static void sys_ioctl_FIOGETOWN(void)
458 GO(SYS_ioctl, "(FIOGETOWN) 3s 1m");
459 SY(SYS_ioctl, x0 - 1, x0 + FIOGETOWN, x0 + 1); FAIL;
462 /* crypto */
463 __attribute__((noinline))
464 static void sys_ioctl_CRYPTO_GET_PROVIDER_LIST(void)
466 GO(SYS_ioctl, "(CRYPTO_GET_PROVIDER_LIST) 3s 1m");
467 SY(SYS_ioctl, x0 - 1, x0 + CRYPTO_GET_PROVIDER_LIST, x0 + 1); FAIL;
470 __attribute__((noinline))
471 static void sys_ioctl_CRYPTO_GET_PROVIDER_LIST_2(void)
473 crypto_get_provider_list_t pl;
475 pl.pl_count = x0 + 1;
477 GO(SYS_ioctl, "(CRYPTO_GET_PROVIDER_LIST) 4s 0m");
478 SY(SYS_ioctl, x0 - 1, x0 + CRYPTO_GET_PROVIDER_LIST, &pl + x0); FAIL;
481 /* dtrace */
482 __attribute__((noinline))
483 static void sys_ioctl_DTRACEHIOC_REMOVE(void)
485 GO(SYS_ioctl, "(DTRACEHIOC_REMOVE) 3s 0m");
486 SY(SYS_ioctl, x0 - 1, x0 + DTRACEHIOC_REMOVE, x0); FAIL;
489 __attribute__((noinline))
490 static void sys_ioctl_DTRACEHIOC_ADDDOF(void)
492 dof_helper_t dh;
494 dh.dofhp_mod[0] = x0 + 'D';
495 dh.dofhp_mod[1] = x0 + '\0';
496 dh.dofhp_addr = x0;
497 dh.dofhp_dof = x0;
499 GO(SYS_ioctl, "(DTRACEHIOC_ADDDOF) 6s 0m");
500 SY(SYS_ioctl, x0 - 1, x0 + DTRACEHIOC_ADDDOF, x0 + &dh); FAIL;
503 __attribute__((noinline))
504 static void sys_ioctl_DINFOUSRLD(void)
506 GO(SYS_ioctl, "(DINFOUSRLD) 3s 0m");
507 SY(SYS_ioctl, x0 - 1, x0 + DINFOUSRLD, x0 + 1); FAIL;
510 __attribute__((noinline))
511 static void sys_ioctl_DINFOIDENT(void)
513 GO(SYS_ioctl, "(DINFOIDENT) 2s 0m");
514 SY(SYS_ioctl, x0 - 1, x0 + DINFOIDENT); FAIL;
517 int main(void)
519 /* Uninitialised, but we know px[0] is 0x0. */
520 long *px = malloc(sizeof(long));
521 x0 = px[0];
523 /* pools */
524 sys_ioctl_POOL_STATUSQ();
526 /* mntio */
527 sys_ioctl_MNTIOC_GETEXTMNTENT();
528 sys_ioctl_MNTIOC_GETEXTMNTENT_2();
529 sys_ioctl_MNTIOC_GETEXTMNTENT_3();
530 sys_ioctl_MNTIOC_GETMNTANY();
531 sys_ioctl_MNTIOC_GETMNTANY_2();
532 sys_ioctl_MNTIOC_GETMNTANY_3();
534 /* termio/termios */
535 sys_ioctl_TCGETA();
536 sys_ioctl_TCGETS();
537 sys_ioctl_TCSETS();
538 sys_ioctl_TCSETSW();
539 sys_ioctl_TCSETSF();
540 sys_ioctl_TIOCGWINSZ();
541 sys_ioctl_TIOCSWINSZ();
542 sys_ioctl_TIOCGPGRP();
543 sys_ioctl_TIOCSPGRP();
544 sys_ioctl_TIOCGSID();
545 sys_ioctl_TIOCNOTTY();
546 sys_ioctl_TIOCSCTTY();
548 /* STREAMS */
549 sys_ioctl_I_PUSH();
550 sys_ioctl_I_FLUSH();
551 sys_ioctl_I_STR();
552 sys_ioctl_I_STR_2();
553 sys_ioctl_I_FIND();
554 sys_ioctl_I_PEEK();
555 sys_ioctl_I_PEEK_2();
556 sys_ioctl_I_CANPUT();
558 /* sockio */
559 sys_ioctl_SIOCGIFCONF();
560 sys_ioctl_SIOCGIFCONF_2();
561 sys_ioctl_SIOCGIFFLAGS();
562 sys_ioctl_SIOCGIFFLAGS_2();
563 sys_ioctl_SIOCGIFNETMASK();
564 sys_ioctl_SIOCGIFNETMASK_2();
565 sys_ioctl_SIOCGIFNUM();
566 sys_ioctl_SIOCGIFNUM_2();
567 sys_ioctl_SIOCGLIFBRDADDR();
568 sys_ioctl_SIOCGLIFBRDADDR_2();
569 sys_ioctl_SIOCGLIFCONF();
570 sys_ioctl_SIOCGLIFCONF_2();
571 sys_ioctl_SIOCGLIFFLAGS();
572 sys_ioctl_SIOCGLIFFLAGS_2();
573 sys_ioctl_SIOCGLIFNETMASK();
574 sys_ioctl_SIOCGLIFNETMASK_2();
575 sys_ioctl_SIOCGLIFNUM();
577 /* filio */
578 sys_ioctl_FIOSETOWN();
579 sys_ioctl_FIOGETOWN();
581 /* crypto */
582 sys_ioctl_CRYPTO_GET_PROVIDER_LIST();
583 sys_ioctl_CRYPTO_GET_PROVIDER_LIST_2();
585 /* dtrace */
586 sys_ioctl_DTRACEHIOC_REMOVE();
587 sys_ioctl_DTRACEHIOC_ADDDOF();
589 /* devinfo */
590 sys_ioctl_DINFOUSRLD();
591 sys_ioctl_DINFOIDENT();
593 return 0;