2 * ioctl.c for mdb -- decode an IOCTL system call
5 #ifdef SYSCALLS_SUPPORT
11 #include <minix/type.h>
12 #include <minix/callnr.h>
13 #include <minix/com.h>
14 #include <sys/ioctl.h>
18 PRIVATE
int get_request
;
20 PRIVATE
char *rnames
[] = {
34 * send or receive = 'R' or 'S'
36 void decode_ioctl(sr
, m
)
44 int ispeed
, ospeed
, speed
, erase
, kill
;
45 int t_intrc
, t_quitc
, t_startc
, t_stopc
, t_brk
, t_eof
;
54 Printf("%c device=%d request=%c|%d m2_l1=%lx m2_l2=%lx\n",
56 (request
>> 8) & BYTE
,
61 if ( sr
== 'R') request
= get_request
;
66 rq
= (request
== TIOCGETP
) ? GETPNAME
: SETPNAME
;
68 get_request
= request
;
69 Printf( "Sending %s ",rnames
[rq
] );
70 if ( request
== TIOCGETP
) break;
73 if ( (sr
== 'R') && (request
== TIOCSETP
) ) break;
75 erase
= (spek
>> 8) & BYTE
;
77 flags
= flags
& 0xFFFF;
78 speed
= (spek
>> 16) & 0xFFFFL
;
79 ispeed
= speed
& BYTE
;
80 ospeed
= (speed
>> 8) & BYTE
;
81 Printf("%s erase=%d kill=%d speed=%d/%d flags=%lx ",
82 rnames
[rq
], erase
, kill
, ispeed
, ospeed
, flags
);
87 rq
= (request
== TIOCGETC
) ? GETCNAME
: SETCNAME
;
89 get_request
= request
;
90 Printf( "Sending %s ",rnames
[rq
] );
91 if ( request
== TIOCGETC
) break;
94 if ( (sr
== 'R') && (request
== TIOCSETC
) ) break;
96 t_intrc
= (spek
>> 24) & BYTE
;
97 t_quitc
= (spek
>> 16) & BYTE
;
98 t_startc
= (spek
>> 8) & BYTE
;
99 t_stopc
= (spek
>> 0) & BYTE
;
100 t_brk
= flags
& BYTE
;
101 t_eof
= (flags
>> 8 ) & BYTE
;
102 Printf("%s int %d quit %d start %d stop %d brk %d eof %d\n",
104 t_intrc
, t_quitc
, t_startc
, t_stopc
, t_brk
, t_eof
);
109 #ifdef __i86 /* 16 bit */
112 get_request
= request
;
115 Printf("Receiving ");
117 Printf("Other IOCTL device=%d request=%c|%d\n",
118 device
, (request
>> 8) & BYTE
, request
& BYTE
);
123 #ifdef __i386 /* 32 bit encoding */
125 Printf("Sending (%lx) ", request
);
126 get_request
= request
;
129 Printf("Receiving (%lx) ", request
);
131 high
= ( request
& 0xFFFF0000 ) >> 16 ;
132 request
&= _IOCTYPE_MASK
;
134 Printf("Other IOCTL device=%d request=%c|%d flags=%x size =%d\n",
135 device
, (request
>> 8) & BYTE
, request
& BYTE
,
136 (high
& ~_IOCPARM_MASK
),
137 (high
& _IOCPARM_MASK
)
146 #endif /* SYSCALLS_SUPPORT */