Statistics
| Branch: | Revision:

root / linux-user / syscall_defs.h @ 31e31b8a

History | View | Annotate | Download (14.2 kB)

1 31e31b8a bellard
2 31e31b8a bellard
/* common syscall defines for all architectures */
3 31e31b8a bellard
4 31e31b8a bellard
#define SOCKOP_socket           1
5 31e31b8a bellard
#define SOCKOP_bind             2
6 31e31b8a bellard
#define SOCKOP_connect          3
7 31e31b8a bellard
#define SOCKOP_listen           4
8 31e31b8a bellard
#define SOCKOP_accept           5
9 31e31b8a bellard
#define SOCKOP_getsockname      6
10 31e31b8a bellard
#define SOCKOP_getpeername      7
11 31e31b8a bellard
#define SOCKOP_socketpair       8
12 31e31b8a bellard
#define SOCKOP_send             9
13 31e31b8a bellard
#define SOCKOP_recv             10
14 31e31b8a bellard
#define SOCKOP_sendto           11
15 31e31b8a bellard
#define SOCKOP_recvfrom         12
16 31e31b8a bellard
#define SOCKOP_shutdown         13
17 31e31b8a bellard
#define SOCKOP_setsockopt       14
18 31e31b8a bellard
#define SOCKOP_getsockopt       15
19 31e31b8a bellard
#define SOCKOP_sendmsg          16
20 31e31b8a bellard
#define SOCKOP_recvmsg          17
21 31e31b8a bellard
22 31e31b8a bellard
struct target_timeval {
23 31e31b8a bellard
    target_long tv_sec;
24 31e31b8a bellard
    target_long tv_usec;
25 31e31b8a bellard
};
26 31e31b8a bellard
27 31e31b8a bellard
struct target_iovec {
28 31e31b8a bellard
    target_long iov_base;   /* Starting address */
29 31e31b8a bellard
    target_long iov_len;   /* Number of bytes */
30 31e31b8a bellard
};
31 31e31b8a bellard
32 31e31b8a bellard
struct  target_rusage {
33 31e31b8a bellard
        struct target_timeval ru_utime;        /* user time used */
34 31e31b8a bellard
        struct target_timeval ru_stime;        /* system time used */
35 31e31b8a bellard
        target_long    ru_maxrss;              /* maximum resident set size */
36 31e31b8a bellard
        target_long    ru_ixrss;               /* integral shared memory size */
37 31e31b8a bellard
        target_long    ru_idrss;               /* integral unshared data size */
38 31e31b8a bellard
        target_long    ru_isrss;               /* integral unshared stack size */
39 31e31b8a bellard
        target_long    ru_minflt;              /* page reclaims */
40 31e31b8a bellard
        target_long    ru_majflt;              /* page faults */
41 31e31b8a bellard
        target_long    ru_nswap;               /* swaps */
42 31e31b8a bellard
        target_long    ru_inblock;             /* block input operations */
43 31e31b8a bellard
        target_long    ru_oublock;             /* block output operations */
44 31e31b8a bellard
        target_long    ru_msgsnd;              /* messages sent */
45 31e31b8a bellard
        target_long    ru_msgrcv;              /* messages received */
46 31e31b8a bellard
        target_long    ru_nsignals;            /* signals received */
47 31e31b8a bellard
        target_long    ru_nvcsw;               /* voluntary context switches */
48 31e31b8a bellard
        target_long    ru_nivcsw;              /* involuntary " */
49 31e31b8a bellard
};
50 31e31b8a bellard
51 31e31b8a bellard
typedef struct {
52 31e31b8a bellard
        int     val[2];
53 31e31b8a bellard
} kernel_fsid_t;
54 31e31b8a bellard
55 31e31b8a bellard
struct statfs {
56 31e31b8a bellard
        int f_type;
57 31e31b8a bellard
        int f_bsize;
58 31e31b8a bellard
        int f_blocks;
59 31e31b8a bellard
        int f_bfree;
60 31e31b8a bellard
        int f_bavail;
61 31e31b8a bellard
        int f_files;
62 31e31b8a bellard
        int f_ffree;
63 31e31b8a bellard
        kernel_fsid_t f_fsid;
64 31e31b8a bellard
        int f_namelen;
65 31e31b8a bellard
        int f_spare[6];
66 31e31b8a bellard
};
67 31e31b8a bellard
68 31e31b8a bellard
/* mostly generic signal stuff */
69 31e31b8a bellard
#define TARGET_SIG_DFL        ((target_long)0)        /* default signal handling */
70 31e31b8a bellard
#define TARGET_SIG_IGN        ((target_long)1)        /* ignore signal */
71 31e31b8a bellard
#define TARGET_SIG_ERR        ((target_long)-1)        /* error return from signal */
72 31e31b8a bellard
73 31e31b8a bellard
#ifdef TARGET_MIPS
74 31e31b8a bellard
#define TARGET_NSIG           128
75 31e31b8a bellard
#else
76 31e31b8a bellard
#define TARGET_NSIG           64
77 31e31b8a bellard
#endif
78 31e31b8a bellard
#define TARGET_NSIG_BPW           TARGET_LONG_BITS
79 31e31b8a bellard
#define TARGET_NSIG_WORDS  (TARGET_NSIG / TARGET_NSIG_BPW)
80 31e31b8a bellard
81 31e31b8a bellard
typedef struct {
82 31e31b8a bellard
    target_ulong sig[TARGET_NSIG_WORDS];
83 31e31b8a bellard
} target_sigset_t;
84 31e31b8a bellard
85 31e31b8a bellard
/* Networking ioctls */
86 31e31b8a bellard
#define TARGET_SIOCADDRT       0x890B          /* add routing table entry */
87 31e31b8a bellard
#define TARGET_SIOCDELRT       0x890C          /* delete routing table entry */
88 31e31b8a bellard
#define TARGET_SIOCGIFNAME     0x8910          /* get iface name               */
89 31e31b8a bellard
#define TARGET_SIOCSIFLINK     0x8911          /* set iface channel            */
90 31e31b8a bellard
#define TARGET_SIOCGIFCONF     0x8912          /* get iface list               */
91 31e31b8a bellard
#define TARGET_SIOCGIFFLAGS    0x8913          /* get flags                    */
92 31e31b8a bellard
#define TARGET_SIOCSIFFLAGS    0x8914          /* set flags                    */
93 31e31b8a bellard
#define TARGET_SIOCGIFADDR     0x8915          /* get PA address               */
94 31e31b8a bellard
#define TARGET_SIOCSIFADDR     0x8916          /* set PA address               */
95 31e31b8a bellard
#define TARGET_SIOCGIFDSTADDR  0x8917          /* get remote PA address        */
96 31e31b8a bellard
#define TARGET_SIOCSIFDSTADDR  0x8918          /* set remote PA address        */
97 31e31b8a bellard
#define TARGET_SIOCGIFBRDADDR  0x8919          /* get broadcast PA address     */
98 31e31b8a bellard
#define TARGET_SIOCSIFBRDADDR  0x891a          /* set broadcast PA address     */
99 31e31b8a bellard
#define TARGET_SIOCGIFNETMASK  0x891b          /* get network PA mask          */
100 31e31b8a bellard
#define TARGET_SIOCSIFNETMASK  0x891c          /* set network PA mask          */
101 31e31b8a bellard
#define TARGET_SIOCGIFMETRIC   0x891d          /* get metric                   */
102 31e31b8a bellard
#define TARGET_SIOCSIFMETRIC   0x891e          /* set metric                   */
103 31e31b8a bellard
#define TARGET_SIOCGIFMEM      0x891f          /* get memory address (BSD)     */
104 31e31b8a bellard
#define TARGET_SIOCSIFMEM      0x8920          /* set memory address (BSD)     */
105 31e31b8a bellard
#define TARGET_SIOCGIFMTU      0x8921          /* get MTU size                 */
106 31e31b8a bellard
#define TARGET_SIOCSIFMTU      0x8922          /* set MTU size                 */
107 31e31b8a bellard
#define TARGET_SIOCSIFHWADDR   0x8924          /* set hardware address (NI)    */
108 31e31b8a bellard
#define TARGET_SIOCGIFENCAP    0x8925          /* get/set slip encapsulation   */
109 31e31b8a bellard
#define TARGET_SIOCSIFENCAP    0x8926
110 31e31b8a bellard
#define TARGET_SIOCGIFHWADDR   0x8927          /* Get hardware address         */
111 31e31b8a bellard
#define TARGET_SIOCGIFSLAVE    0x8929          /* Driver slaving support       */
112 31e31b8a bellard
#define TARGET_SIOCSIFSLAVE    0x8930
113 31e31b8a bellard
#define TARGET_SIOCADDMULTI    0x8931          /* Multicast address lists      */
114 31e31b8a bellard
#define TARGET_SIOCDELMULTI    0x8932
115 31e31b8a bellard
116 31e31b8a bellard
/* Bridging control calls */
117 31e31b8a bellard
#define TARGET_SIOCGIFBR       0x8940          /* Bridging support             */
118 31e31b8a bellard
#define TARGET_SIOCSIFBR       0x8941          /* Set bridging options         */
119 31e31b8a bellard
120 31e31b8a bellard
#define TARGET_SIOCGIFTXQLEN   0x8942          /* Get the tx queue length      */
121 31e31b8a bellard
#define TARGET_SIOCSIFTXQLEN   0x8943          /* Set the tx queue length      */
122 31e31b8a bellard
123 31e31b8a bellard
/* ARP cache control calls. */
124 31e31b8a bellard
#define TARGET_OLD_SIOCDARP    0x8950          /* old delete ARP table entry   */
125 31e31b8a bellard
#define TARGET_OLD_SIOCGARP    0x8951          /* old get ARP table entry      */
126 31e31b8a bellard
#define TARGET_OLD_SIOCSARP    0x8952          /* old set ARP table entry      */
127 31e31b8a bellard
#define TARGET_SIOCDARP        0x8953          /* delete ARP table entry       */
128 31e31b8a bellard
#define TARGET_SIOCGARP        0x8954          /* get ARP table entry          */
129 31e31b8a bellard
#define TARGET_SIOCSARP        0x8955          /* set ARP table entry          */
130 31e31b8a bellard
131 31e31b8a bellard
/* RARP cache control calls. */
132 31e31b8a bellard
#define TARGET_SIOCDRARP       0x8960          /* delete RARP table entry      */
133 31e31b8a bellard
#define TARGET_SIOCGRARP       0x8961          /* get RARP table entry         */
134 31e31b8a bellard
#define TARGET_SIOCSRARP       0x8962          /* set RARP table entry         */
135 31e31b8a bellard
136 31e31b8a bellard
/* Driver configuration calls */
137 31e31b8a bellard
#define TARGET_SIOCGIFMAP      0x8970          /* Get device parameters        */
138 31e31b8a bellard
#define TARGET_SIOCSIFMAP      0x8971          /* Set device parameters        */
139 31e31b8a bellard
140 31e31b8a bellard
/* DLCI configuration calls */
141 31e31b8a bellard
#define TARGET_SIOCADDDLCI     0x8980          /* Create new DLCI device       */
142 31e31b8a bellard
#define TARGET_SIOCDELDLCI     0x8981          /* Delete DLCI device           */
143 31e31b8a bellard
144 31e31b8a bellard
145 31e31b8a bellard
/* From <linux/fs.h> */
146 31e31b8a bellard
147 31e31b8a bellard
#define TARGET_BLKROSET   TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */
148 31e31b8a bellard
#define TARGET_BLKROGET   TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */
149 31e31b8a bellard
#define TARGET_BLKRRPART  TARGET_IO(0x12,95) /* re-read partition table */
150 31e31b8a bellard
#define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */
151 31e31b8a bellard
#define TARGET_BLKFLSBUF  TARGET_IO(0x12,97) /* flush buffer cache */
152 31e31b8a bellard
#define TARGET_BLKRASET   TARGET_IO(0x12,98) /* Set read ahead for block device */
153 31e31b8a bellard
#define TARGET_BLKRAGET   TARGET_IO(0x12,99) /* get current read ahead setting */
154 31e31b8a bellard
#define TARGET_BLKFRASET  TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
155 31e31b8a bellard
#define TARGET_BLKFRAGET  TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
156 31e31b8a bellard
#define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
157 31e31b8a bellard
#define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
158 31e31b8a bellard
#define TARGET_BLKSSZGET  TARGET_IO(0x12,104)/* get block device sector size */
159 31e31b8a bellard
/* A jump here: 108-111 have been used for various private purposes. */
160 31e31b8a bellard
#define TARGET_BLKBSZGET  TARGET_IOR(0x12,112,sizeof(int))
161 31e31b8a bellard
#define TARGET_BLKBSZSET  TARGET_IOW(0x12,113,sizeof(int))
162 31e31b8a bellard
#define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,sizeof(uint64_t)) /* return device size in bytes (u64 *arg) */
163 31e31b8a bellard
#define TARGET_FIBMAP     TARGET_IO(0x00,1)  /* bmap access */
164 31e31b8a bellard
#define TARGET_FIGETBSZ   TARGET_IO(0x00,2)  /* get the block size used for bmap */
165 31e31b8a bellard
166 31e31b8a bellard
/* cdrom commands */
167 31e31b8a bellard
#define TARGET_CDROMPAUSE                0x5301 /* Pause Audio Operation */ 
168 31e31b8a bellard
#define TARGET_CDROMRESUME                0x5302 /* Resume paused Audio Operation */
169 31e31b8a bellard
#define TARGET_CDROMPLAYMSF                0x5303 /* Play Audio MSF (struct cdrom_msf) */
170 31e31b8a bellard
#define TARGET_CDROMPLAYTRKIND                0x5304 /* Play Audio Track/index 
171 31e31b8a bellard
                                           (struct cdrom_ti) */
172 31e31b8a bellard
#define TARGET_CDROMREADTOCHDR                0x5305 /* Read TOC header 
173 31e31b8a bellard
                                           (struct cdrom_tochdr) */
174 31e31b8a bellard
#define TARGET_CDROMREADTOCENTRY        0x5306 /* Read TOC entry 
175 31e31b8a bellard
                                           (struct cdrom_tocentry) */
176 31e31b8a bellard
#define TARGET_CDROMSTOP                0x5307 /* Stop the cdrom drive */
177 31e31b8a bellard
#define TARGET_CDROMSTART                0x5308 /* Start the cdrom drive */
178 31e31b8a bellard
#define TARGET_CDROMEJECT                0x5309 /* Ejects the cdrom media */
179 31e31b8a bellard
#define TARGET_CDROMVOLCTRL                0x530a /* Control output volume 
180 31e31b8a bellard
                                           (struct cdrom_volctrl) */
181 31e31b8a bellard
#define TARGET_CDROMSUBCHNL                0x530b /* Read subchannel data 
182 31e31b8a bellard
                                           (struct cdrom_subchnl) */
183 31e31b8a bellard
#define TARGET_CDROMREADMODE2                0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes) 
184 31e31b8a bellard
                                           (struct cdrom_read) */
185 31e31b8a bellard
#define TARGET_CDROMREADMODE1                0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes)
186 31e31b8a bellard
                                           (struct cdrom_read) */
187 31e31b8a bellard
#define TARGET_CDROMREADAUDIO                0x530e /* (struct cdrom_read_audio) */
188 31e31b8a bellard
#define TARGET_CDROMEJECT_SW                0x530f /* enable(1)/disable(0) auto-ejecting */
189 31e31b8a bellard
#define TARGET_CDROMMULTISESSION        0x5310 /* Obtain the start-of-last-session 
190 31e31b8a bellard
                                           address of multi session disks 
191 31e31b8a bellard
                                           (struct cdrom_multisession) */
192 31e31b8a bellard
#define TARGET_CDROM_GET_MCN                0x5311 /* Obtain the "Universal Product Code" 
193 31e31b8a bellard
                                           if available (struct cdrom_mcn) */
194 31e31b8a bellard
#define TARGET_CDROM_GET_UPC                TARGET_CDROM_GET_MCN  /* This one is depricated, 
195 31e31b8a bellard
                                          but here anyway for compatability */
196 31e31b8a bellard
#define TARGET_CDROMRESET                0x5312 /* hard-reset the drive */
197 31e31b8a bellard
#define TARGET_CDROMVOLREAD                0x5313 /* Get the drive's volume setting 
198 31e31b8a bellard
                                          (struct cdrom_volctrl) */
199 31e31b8a bellard
#define TARGET_CDROMREADRAW                0x5314        /* read data in raw mode (2352 Bytes)
200 31e31b8a bellard
                                           (struct cdrom_read) */
201 31e31b8a bellard
/* 
202 31e31b8a bellard
 * These ioctls are used only used in aztcd.c and optcd.c
203 31e31b8a bellard
 */
204 31e31b8a bellard
#define TARGET_CDROMREADCOOKED                0x5315        /* read data in cooked mode */
205 31e31b8a bellard
#define TARGET_CDROMSEEK                0x5316  /* seek msf address */
206 31e31b8a bellard
  
207 31e31b8a bellard
/*
208 31e31b8a bellard
 * This ioctl is only used by the scsi-cd driver.  
209 31e31b8a bellard
   It is for playing audio in logical block addressing mode.
210 31e31b8a bellard
 */
211 31e31b8a bellard
#define TARGET_CDROMPLAYBLK                0x5317        /* (struct cdrom_blk) */
212 31e31b8a bellard
213 31e31b8a bellard
/* 
214 31e31b8a bellard
 * These ioctls are only used in optcd.c
215 31e31b8a bellard
 */
216 31e31b8a bellard
#define TARGET_CDROMREADALL                0x5318        /* read all 2646 bytes */
217 31e31b8a bellard
218 31e31b8a bellard
/* 
219 31e31b8a bellard
 * These ioctls are (now) only in ide-cd.c for controlling 
220 31e31b8a bellard
 * drive spindown time.  They should be implemented in the
221 31e31b8a bellard
 * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10,
222 31e31b8a bellard
 * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE...
223 31e31b8a bellard
 *  -Erik
224 31e31b8a bellard
 */
225 31e31b8a bellard
#define TARGET_CDROMGETSPINDOWN        0x531d
226 31e31b8a bellard
#define TARGET_CDROMSETSPINDOWN        0x531e
227 31e31b8a bellard
228 31e31b8a bellard
/* 
229 31e31b8a bellard
 * These ioctls are implemented through the uniform CD-ROM driver
230 31e31b8a bellard
 * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM
231 31e31b8a bellard
 * drivers are eventually ported to the uniform CD-ROM driver interface.
232 31e31b8a bellard
 */
233 31e31b8a bellard
#define TARGET_CDROMCLOSETRAY                0x5319        /* pendant of CDROMEJECT */
234 31e31b8a bellard
#define TARGET_CDROM_SET_OPTIONS        0x5320  /* Set behavior options */
235 31e31b8a bellard
#define TARGET_CDROM_CLEAR_OPTIONS        0x5321  /* Clear behavior options */
236 31e31b8a bellard
#define TARGET_CDROM_SELECT_SPEED        0x5322  /* Set the CD-ROM speed */
237 31e31b8a bellard
#define TARGET_CDROM_SELECT_DISC        0x5323  /* Select disc (for juke-boxes) */
238 31e31b8a bellard
#define TARGET_CDROM_MEDIA_CHANGED        0x5325  /* Check is media changed  */
239 31e31b8a bellard
#define TARGET_CDROM_DRIVE_STATUS        0x5326  /* Get tray position, etc. */
240 31e31b8a bellard
#define TARGET_CDROM_DISC_STATUS        0x5327  /* Get disc type, etc. */
241 31e31b8a bellard
#define TARGET_CDROM_CHANGER_NSLOTS    0x5328  /* Get number of slots */
242 31e31b8a bellard
#define TARGET_CDROM_LOCKDOOR                0x5329  /* lock or unlock door */
243 31e31b8a bellard
#define TARGET_CDROM_DEBUG                0x5330        /* Turn debug messages on/off */
244 31e31b8a bellard
#define TARGET_CDROM_GET_CAPABILITY        0x5331        /* get capabilities */
245 31e31b8a bellard
246 31e31b8a bellard
/* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386.
247 31e31b8a bellard
 * Future CDROM ioctls should be kept below 0x537F
248 31e31b8a bellard
 */
249 31e31b8a bellard
250 31e31b8a bellard
/* This ioctl is only used by sbpcd at the moment */
251 31e31b8a bellard
#define TARGET_CDROMAUDIOBUFSIZ        0x5382        /* set the audio buffer size */
252 31e31b8a bellard
                                        /* conflict with SCSI_IOCTL_GET_IDLUN */
253 31e31b8a bellard
254 31e31b8a bellard
/* DVD-ROM Specific ioctls */
255 31e31b8a bellard
#define TARGET_DVD_READ_STRUCT                0x5390  /* Read structure */
256 31e31b8a bellard
#define TARGET_DVD_WRITE_STRUCT        0x5391  /* Write structure */
257 31e31b8a bellard
#define TARGET_DVD_AUTH                0x5392  /* Authentication */
258 31e31b8a bellard
259 31e31b8a bellard
#define TARGET_CDROM_SEND_PACKET        0x5393        /* send a packet to the drive */
260 31e31b8a bellard
#define TARGET_CDROM_NEXT_WRITABLE        0x5394        /* get next writable block */
261 31e31b8a bellard
#define TARGET_CDROM_LAST_WRITTEN        0x5395        /* get last block written on disc */
262 31e31b8a bellard
263 31e31b8a bellard
/* HD commands */
264 31e31b8a bellard
265 31e31b8a bellard
/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
266 31e31b8a bellard
#define TARGET_HDIO_GETGEO            0x0301  /* get device geometry */
267 31e31b8a bellard
#define TARGET_HDIO_GET_UNMASKINTR    0x0302  /* get current unmask setting */
268 31e31b8a bellard
#define TARGET_HDIO_GET_MULTCOUNT     0x0304  /* get current IDE blockmode setting */
269 31e31b8a bellard
#define TARGET_HDIO_GET_IDENTITY      0x0307  /* get IDE identification info */
270 31e31b8a bellard
#define TARGET_HDIO_GET_KEEPSETTINGS  0x0308  /* get keep-settings-on-reset flag */
271 31e31b8a bellard
#define TARGET_HDIO_GET_32BIT         0x0309  /* get current io_32bit setting */
272 31e31b8a bellard
#define TARGET_HDIO_GET_NOWERR        0x030a  /* get ignore-write-error flag */
273 31e31b8a bellard
#define TARGET_HDIO_GET_DMA           0x030b  /* get use-dma flag */
274 31e31b8a bellard
#define TARGET_HDIO_DRIVE_CMD         0x031f  /* execute a special drive command */
275 31e31b8a bellard
276 31e31b8a bellard
/* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
277 31e31b8a bellard
#define TARGET_HDIO_SET_MULTCOUNT     0x0321  /* change IDE blockmode */
278 31e31b8a bellard
#define TARGET_HDIO_SET_UNMASKINTR    0x0322  /* permit other irqs during I/O */
279 31e31b8a bellard
#define TARGET_HDIO_SET_KEEPSETTINGS  0x0323  /* keep ioctl settings on reset */
280 31e31b8a bellard
#define TARGET_HDIO_SET_32BIT         0x0324  /* change io_32bit flags */
281 31e31b8a bellard
#define TARGET_HDIO_SET_NOWERR        0x0325  /* change ignore-write-error flag */
282 31e31b8a bellard
#define TARGET_HDIO_SET_DMA           0x0326  /* change use-dma flag */
283 31e31b8a bellard
#define TARGET_HDIO_SET_PIO_MODE      0x0327  /* reconfig interface to new speed */