2
0

syscall_defs.h 82 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579
  1. /* common syscall defines for all architectures */
  2. /* Note: although the syscall numbers change between architectures,
  3. most of them stay the same, so we handle it by putting ifdefs if
  4. necessary */
  5. #ifndef SYSCALL_DEFS_H
  6. #define SYSCALL_DEFS_H 1
  7. #include "syscall_nr.h"
  8. #define SOCKOP_socket 1
  9. #define SOCKOP_bind 2
  10. #define SOCKOP_connect 3
  11. #define SOCKOP_listen 4
  12. #define SOCKOP_accept 5
  13. #define SOCKOP_getsockname 6
  14. #define SOCKOP_getpeername 7
  15. #define SOCKOP_socketpair 8
  16. #define SOCKOP_send 9
  17. #define SOCKOP_recv 10
  18. #define SOCKOP_sendto 11
  19. #define SOCKOP_recvfrom 12
  20. #define SOCKOP_shutdown 13
  21. #define SOCKOP_setsockopt 14
  22. #define SOCKOP_getsockopt 15
  23. #define SOCKOP_sendmsg 16
  24. #define SOCKOP_recvmsg 17
  25. #define SOCKOP_accept4 18
  26. #define IPCOP_semop 1
  27. #define IPCOP_semget 2
  28. #define IPCOP_semctl 3
  29. #define IPCOP_semtimedop 4
  30. #define IPCOP_msgsnd 11
  31. #define IPCOP_msgrcv 12
  32. #define IPCOP_msgget 13
  33. #define IPCOP_msgctl 14
  34. #define IPCOP_shmat 21
  35. #define IPCOP_shmdt 22
  36. #define IPCOP_shmget 23
  37. #define IPCOP_shmctl 24
  38. /*
  39. * The following is for compatibility across the various Linux
  40. * platforms. The i386 ioctl numbering scheme doesn't really enforce
  41. * a type field. De facto, however, the top 8 bits of the lower 16
  42. * bits are indeed used as a type field, so we might just as well make
  43. * this explicit here. Please be sure to use the decoding macros
  44. * below from now on.
  45. */
  46. #define TARGET_IOC_NRBITS 8
  47. #define TARGET_IOC_TYPEBITS 8
  48. #if defined(TARGET_I386) || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \
  49. || defined(TARGET_SPARC) \
  50. || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS)
  51. /* 16 bit uid wrappers emulation */
  52. #define USE_UID16
  53. #define target_id uint16_t
  54. #else
  55. #define target_id uint32_t
  56. #endif
  57. #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \
  58. || defined(TARGET_M68K) || defined(TARGET_CRIS) || defined(TARGET_UNICORE32) \
  59. || defined(TARGET_S390X) || defined(TARGET_OPENRISC)
  60. #define TARGET_IOC_SIZEBITS 14
  61. #define TARGET_IOC_DIRBITS 2
  62. #define TARGET_IOC_NONE 0U
  63. #define TARGET_IOC_WRITE 1U
  64. #define TARGET_IOC_READ 2U
  65. #elif defined(TARGET_PPC) || defined(TARGET_ALPHA) || \
  66. defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) || \
  67. defined(TARGET_MIPS)
  68. #define TARGET_IOC_SIZEBITS 13
  69. #define TARGET_IOC_DIRBITS 3
  70. #define TARGET_IOC_NONE 1U
  71. #define TARGET_IOC_READ 2U
  72. #define TARGET_IOC_WRITE 4U
  73. #else
  74. #error unsupported CPU
  75. #endif
  76. #define TARGET_IOC_NRMASK ((1 << TARGET_IOC_NRBITS)-1)
  77. #define TARGET_IOC_TYPEMASK ((1 << TARGET_IOC_TYPEBITS)-1)
  78. #define TARGET_IOC_SIZEMASK ((1 << TARGET_IOC_SIZEBITS)-1)
  79. #define TARGET_IOC_DIRMASK ((1 << TARGET_IOC_DIRBITS)-1)
  80. #define TARGET_IOC_NRSHIFT 0
  81. #define TARGET_IOC_TYPESHIFT (TARGET_IOC_NRSHIFT+TARGET_IOC_NRBITS)
  82. #define TARGET_IOC_SIZESHIFT (TARGET_IOC_TYPESHIFT+TARGET_IOC_TYPEBITS)
  83. #define TARGET_IOC_DIRSHIFT (TARGET_IOC_SIZESHIFT+TARGET_IOC_SIZEBITS)
  84. #define TARGET_IOC(dir,type,nr,size) \
  85. (((dir) << TARGET_IOC_DIRSHIFT) | \
  86. ((type) << TARGET_IOC_TYPESHIFT) | \
  87. ((nr) << TARGET_IOC_NRSHIFT) | \
  88. ((size) << TARGET_IOC_SIZESHIFT))
  89. /* used to create numbers */
  90. #define TARGET_IO(type,nr) TARGET_IOC(TARGET_IOC_NONE,(type),(nr),0)
  91. #define TARGET_IOR(type,nr,size) TARGET_IOC(TARGET_IOC_READ,(type),(nr),sizeof(size))
  92. #define TARGET_IOW(type,nr,size) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),sizeof(size))
  93. #define TARGET_IOWR(type,nr,size) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),sizeof(size))
  94. /* the size is automatically computed for these defines */
  95. #define TARGET_IORU(type,nr) TARGET_IOC(TARGET_IOC_READ,(type),(nr),TARGET_IOC_SIZEMASK)
  96. #define TARGET_IOWU(type,nr) TARGET_IOC(TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
  97. #define TARGET_IOWRU(type,nr) TARGET_IOC(TARGET_IOC_READ|TARGET_IOC_WRITE,(type),(nr),TARGET_IOC_SIZEMASK)
  98. struct target_sockaddr {
  99. uint16_t sa_family;
  100. uint8_t sa_data[14];
  101. };
  102. struct target_sock_filter {
  103. abi_ushort code;
  104. uint8_t jt;
  105. uint8_t jf;
  106. abi_uint k;
  107. };
  108. struct target_sock_fprog {
  109. abi_ushort len;
  110. abi_ulong filter;
  111. };
  112. struct target_in_addr {
  113. uint32_t s_addr; /* big endian */
  114. };
  115. struct target_ip_mreq {
  116. struct target_in_addr imr_multiaddr;
  117. struct target_in_addr imr_address;
  118. };
  119. struct target_ip_mreqn {
  120. struct target_in_addr imr_multiaddr;
  121. struct target_in_addr imr_address;
  122. abi_long imr_ifindex;
  123. };
  124. struct target_ip_mreq_source {
  125. /* big endian */
  126. uint32_t imr_multiaddr;
  127. uint32_t imr_interface;
  128. uint32_t imr_sourceaddr;
  129. };
  130. struct target_timeval {
  131. abi_long tv_sec;
  132. abi_long tv_usec;
  133. };
  134. struct target_timespec {
  135. abi_long tv_sec;
  136. abi_long tv_nsec;
  137. };
  138. struct target_itimerval {
  139. struct target_timeval it_interval;
  140. struct target_timeval it_value;
  141. };
  142. struct target_itimerspec {
  143. struct target_timespec it_interval;
  144. struct target_timespec it_value;
  145. };
  146. typedef abi_long target_clock_t;
  147. #define TARGET_HZ 100
  148. struct target_tms {
  149. target_clock_t tms_utime;
  150. target_clock_t tms_stime;
  151. target_clock_t tms_cutime;
  152. target_clock_t tms_cstime;
  153. };
  154. struct target_utimbuf {
  155. abi_long actime;
  156. abi_long modtime;
  157. };
  158. struct target_sel_arg_struct {
  159. abi_long n;
  160. abi_long inp, outp, exp;
  161. abi_long tvp;
  162. };
  163. struct target_iovec {
  164. abi_long iov_base; /* Starting address */
  165. abi_long iov_len; /* Number of bytes */
  166. };
  167. struct target_msghdr {
  168. abi_long msg_name; /* Socket name */
  169. int msg_namelen; /* Length of name */
  170. abi_long msg_iov; /* Data blocks */
  171. abi_long msg_iovlen; /* Number of blocks */
  172. abi_long msg_control; /* Per protocol magic (eg BSD file descriptor passing) */
  173. abi_long msg_controllen; /* Length of cmsg list */
  174. unsigned int msg_flags;
  175. };
  176. struct target_cmsghdr {
  177. abi_long cmsg_len;
  178. int cmsg_level;
  179. int cmsg_type;
  180. };
  181. #define TARGET_CMSG_DATA(cmsg) ((unsigned char *) ((struct target_cmsghdr *) (cmsg) + 1))
  182. #define TARGET_CMSG_NXTHDR(mhdr, cmsg) __target_cmsg_nxthdr (mhdr, cmsg)
  183. #define TARGET_CMSG_ALIGN(len) (((len) + sizeof (abi_long) - 1) \
  184. & (size_t) ~(sizeof (abi_long) - 1))
  185. #define TARGET_CMSG_SPACE(len) (TARGET_CMSG_ALIGN (len) \
  186. + TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)))
  187. #define TARGET_CMSG_LEN(len) (TARGET_CMSG_ALIGN (sizeof (struct target_cmsghdr)) + (len))
  188. static __inline__ struct target_cmsghdr *
  189. __target_cmsg_nxthdr (struct target_msghdr *__mhdr, struct target_cmsghdr *__cmsg)
  190. {
  191. struct target_cmsghdr *__ptr;
  192. __ptr = (struct target_cmsghdr *)((unsigned char *) __cmsg
  193. + TARGET_CMSG_ALIGN (tswapal(__cmsg->cmsg_len)));
  194. if ((unsigned long)((char *)(__ptr+1) - (char *)(size_t)tswapal(__mhdr->msg_control))
  195. > tswapal(__mhdr->msg_controllen))
  196. /* No more entries. */
  197. return (struct target_cmsghdr *)0;
  198. return __cmsg;
  199. }
  200. struct target_mmsghdr {
  201. struct target_msghdr msg_hdr; /* Message header */
  202. unsigned int msg_len; /* Number of bytes transmitted */
  203. };
  204. struct target_rusage {
  205. struct target_timeval ru_utime; /* user time used */
  206. struct target_timeval ru_stime; /* system time used */
  207. abi_long ru_maxrss; /* maximum resident set size */
  208. abi_long ru_ixrss; /* integral shared memory size */
  209. abi_long ru_idrss; /* integral unshared data size */
  210. abi_long ru_isrss; /* integral unshared stack size */
  211. abi_long ru_minflt; /* page reclaims */
  212. abi_long ru_majflt; /* page faults */
  213. abi_long ru_nswap; /* swaps */
  214. abi_long ru_inblock; /* block input operations */
  215. abi_long ru_oublock; /* block output operations */
  216. abi_long ru_msgsnd; /* messages sent */
  217. abi_long ru_msgrcv; /* messages received */
  218. abi_long ru_nsignals; /* signals received */
  219. abi_long ru_nvcsw; /* voluntary context switches */
  220. abi_long ru_nivcsw; /* involuntary " */
  221. };
  222. typedef struct {
  223. int val[2];
  224. } kernel_fsid_t;
  225. struct kernel_statfs {
  226. int f_type;
  227. int f_bsize;
  228. int f_blocks;
  229. int f_bfree;
  230. int f_bavail;
  231. int f_files;
  232. int f_ffree;
  233. kernel_fsid_t f_fsid;
  234. int f_namelen;
  235. int f_spare[6];
  236. };
  237. struct target_dirent {
  238. abi_long d_ino;
  239. abi_long d_off;
  240. unsigned short d_reclen;
  241. char d_name[];
  242. };
  243. struct target_dirent64 {
  244. uint64_t d_ino;
  245. int64_t d_off;
  246. unsigned short d_reclen;
  247. unsigned char d_type;
  248. char d_name[256];
  249. };
  250. /* mostly generic signal stuff */
  251. #define TARGET_SIG_DFL ((abi_long)0) /* default signal handling */
  252. #define TARGET_SIG_IGN ((abi_long)1) /* ignore signal */
  253. #define TARGET_SIG_ERR ((abi_long)-1) /* error return from signal */
  254. #ifdef TARGET_MIPS
  255. #define TARGET_NSIG 128
  256. #else
  257. #define TARGET_NSIG 64
  258. #endif
  259. #define TARGET_NSIG_BPW TARGET_ABI_BITS
  260. #define TARGET_NSIG_WORDS (TARGET_NSIG / TARGET_NSIG_BPW)
  261. typedef struct {
  262. abi_ulong sig[TARGET_NSIG_WORDS];
  263. } target_sigset_t;
  264. #ifdef BSWAP_NEEDED
  265. static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
  266. {
  267. int i;
  268. for(i = 0;i < TARGET_NSIG_WORDS; i++)
  269. d->sig[i] = tswapal(s->sig[i]);
  270. }
  271. #else
  272. static inline void tswap_sigset(target_sigset_t *d, const target_sigset_t *s)
  273. {
  274. *d = *s;
  275. }
  276. #endif
  277. static inline void target_siginitset(target_sigset_t *d, abi_ulong set)
  278. {
  279. int i;
  280. d->sig[0] = set;
  281. for(i = 1;i < TARGET_NSIG_WORDS; i++)
  282. d->sig[i] = 0;
  283. }
  284. void host_to_target_sigset(target_sigset_t *d, const sigset_t *s);
  285. void target_to_host_sigset(sigset_t *d, const target_sigset_t *s);
  286. void host_to_target_old_sigset(abi_ulong *old_sigset,
  287. const sigset_t *sigset);
  288. void target_to_host_old_sigset(sigset_t *sigset,
  289. const abi_ulong *old_sigset);
  290. struct target_sigaction;
  291. int do_sigaction(int sig, const struct target_sigaction *act,
  292. struct target_sigaction *oact);
  293. #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \
  294. || defined(TARGET_PPC) || defined(TARGET_MIPS) || defined(TARGET_SH4) \
  295. || defined(TARGET_M68K) || defined(TARGET_ALPHA) || defined(TARGET_CRIS) \
  296. || defined(TARGET_MICROBLAZE) || defined(TARGET_UNICORE32) \
  297. || defined(TARGET_S390X) || defined(TARGET_OPENRISC)
  298. #if defined(TARGET_SPARC)
  299. #define TARGET_SA_NOCLDSTOP 8u
  300. #define TARGET_SA_NOCLDWAIT 0x100u
  301. #define TARGET_SA_SIGINFO 0x200u
  302. #define TARGET_SA_ONSTACK 1u
  303. #define TARGET_SA_RESTART 2u
  304. #define TARGET_SA_NODEFER 0x20u
  305. #define TARGET_SA_RESETHAND 4u
  306. #elif defined(TARGET_MIPS)
  307. #define TARGET_SA_NOCLDSTOP 0x00000001
  308. #define TARGET_SA_NOCLDWAIT 0x00010000
  309. #define TARGET_SA_SIGINFO 0x00000008
  310. #define TARGET_SA_ONSTACK 0x08000000
  311. #define TARGET_SA_NODEFER 0x40000000
  312. #define TARGET_SA_RESTART 0x10000000
  313. #define TARGET_SA_RESETHAND 0x80000000
  314. #if !defined(TARGET_ABI_MIPSN32) && !defined(TARGET_ABI_MIPSN64)
  315. #define TARGET_SA_RESTORER 0x04000000 /* Only for O32 */
  316. #endif
  317. #elif defined(TARGET_OPENRISC)
  318. #define TARGET_SA_NOCLDSTOP 0x00000001
  319. #define TARGET_SA_NOCLDWAIT 0x00000002
  320. #define TARGET_SA_SIGINFO 0x00000004
  321. #define TARGET_SA_ONSTACK 0x08000000
  322. #define TARGET_SA_RESTART 0x10000000
  323. #define TARGET_SA_NODEFER 0x40000000
  324. #define TARGET_SA_RESETHAND 0x80000000
  325. #elif defined(TARGET_ALPHA)
  326. #define TARGET_SA_ONSTACK 0x00000001
  327. #define TARGET_SA_RESTART 0x00000002
  328. #define TARGET_SA_NOCLDSTOP 0x00000004
  329. #define TARGET_SA_NODEFER 0x00000008
  330. #define TARGET_SA_RESETHAND 0x00000010
  331. #define TARGET_SA_NOCLDWAIT 0x00000020 /* not supported yet */
  332. #define TARGET_SA_SIGINFO 0x00000040
  333. #else
  334. #define TARGET_SA_NOCLDSTOP 0x00000001
  335. #define TARGET_SA_NOCLDWAIT 0x00000002 /* not supported yet */
  336. #define TARGET_SA_SIGINFO 0x00000004
  337. #define TARGET_SA_ONSTACK 0x08000000
  338. #define TARGET_SA_RESTART 0x10000000
  339. #define TARGET_SA_NODEFER 0x40000000
  340. #define TARGET_SA_RESETHAND 0x80000000
  341. #define TARGET_SA_RESTORER 0x04000000
  342. #endif
  343. #if defined(TARGET_ALPHA)
  344. #define TARGET_SIGHUP 1
  345. #define TARGET_SIGINT 2
  346. #define TARGET_SIGQUIT 3
  347. #define TARGET_SIGILL 4
  348. #define TARGET_SIGTRAP 5
  349. #define TARGET_SIGABRT 6
  350. #define TARGET_SIGSTKFLT 7 /* actually SIGEMT */
  351. #define TARGET_SIGFPE 8
  352. #define TARGET_SIGKILL 9
  353. #define TARGET_SIGBUS 10
  354. #define TARGET_SIGSEGV 11
  355. #define TARGET_SIGSYS 12
  356. #define TARGET_SIGPIPE 13
  357. #define TARGET_SIGALRM 14
  358. #define TARGET_SIGTERM 15
  359. #define TARGET_SIGURG 16
  360. #define TARGET_SIGSTOP 17
  361. #define TARGET_SIGTSTP 18
  362. #define TARGET_SIGCONT 19
  363. #define TARGET_SIGCHLD 20
  364. #define TARGET_SIGTTIN 21
  365. #define TARGET_SIGTTOU 22
  366. #define TARGET_SIGIO 23
  367. #define TARGET_SIGXCPU 24
  368. #define TARGET_SIGXFSZ 25
  369. #define TARGET_SIGVTALRM 26
  370. #define TARGET_SIGPROF 27
  371. #define TARGET_SIGWINCH 28
  372. #define TARGET_SIGPWR 29 /* actually SIGINFO */
  373. #define TARGET_SIGUSR1 30
  374. #define TARGET_SIGUSR2 31
  375. #define TARGET_SIGRTMIN 32
  376. #define TARGET_SIG_BLOCK 1
  377. #define TARGET_SIG_UNBLOCK 2
  378. #define TARGET_SIG_SETMASK 3
  379. #elif defined(TARGET_SPARC)
  380. #define TARGET_SIGHUP 1
  381. #define TARGET_SIGINT 2
  382. #define TARGET_SIGQUIT 3
  383. #define TARGET_SIGILL 4
  384. #define TARGET_SIGTRAP 5
  385. #define TARGET_SIGABRT 6
  386. #define TARGET_SIGIOT 6
  387. #define TARGET_SIGSTKFLT 7 /* actually EMT */
  388. #define TARGET_SIGFPE 8
  389. #define TARGET_SIGKILL 9
  390. #define TARGET_SIGBUS 10
  391. #define TARGET_SIGSEGV 11
  392. #define TARGET_SIGSYS 12
  393. #define TARGET_SIGPIPE 13
  394. #define TARGET_SIGALRM 14
  395. #define TARGET_SIGTERM 15
  396. #define TARGET_SIGURG 16
  397. #define TARGET_SIGSTOP 17
  398. #define TARGET_SIGTSTP 18
  399. #define TARGET_SIGCONT 19
  400. #define TARGET_SIGCHLD 20
  401. #define TARGET_SIGTTIN 21
  402. #define TARGET_SIGTTOU 22
  403. #define TARGET_SIGIO 23
  404. #define TARGET_SIGXCPU 24
  405. #define TARGET_SIGXFSZ 25
  406. #define TARGET_SIGVTALRM 26
  407. #define TARGET_SIGPROF 27
  408. #define TARGET_SIGWINCH 28
  409. #define TARGET_SIGPWR 29
  410. #define TARGET_SIGUSR1 30
  411. #define TARGET_SIGUSR2 31
  412. #define TARGET_SIGRTMIN 32
  413. #define TARGET_SIG_BLOCK 0x01 /* for blocking signals */
  414. #define TARGET_SIG_UNBLOCK 0x02 /* for unblocking signals */
  415. #define TARGET_SIG_SETMASK 0x04 /* for setting the signal mask */
  416. #elif defined(TARGET_MIPS)
  417. #define TARGET_SIGHUP 1 /* Hangup (POSIX). */
  418. #define TARGET_SIGINT 2 /* Interrupt (ANSI). */
  419. #define TARGET_SIGQUIT 3 /* Quit (POSIX). */
  420. #define TARGET_SIGILL 4 /* Illegal instruction (ANSI). */
  421. #define TARGET_SIGTRAP 5 /* Trace trap (POSIX). */
  422. #define TARGET_SIGIOT 6 /* IOT trap (4.2 BSD). */
  423. #define TARGET_SIGABRT TARGET_SIGIOT /* Abort (ANSI). */
  424. #define TARGET_SIGEMT 7
  425. #define TARGET_SIGSTKFLT 7 /* XXX: incorrect */
  426. #define TARGET_SIGFPE 8 /* Floating-point exception (ANSI). */
  427. #define TARGET_SIGKILL 9 /* Kill, unblockable (POSIX). */
  428. #define TARGET_SIGBUS 10 /* BUS error (4.2 BSD). */
  429. #define TARGET_SIGSEGV 11 /* Segmentation violation (ANSI). */
  430. #define TARGET_SIGSYS 12
  431. #define TARGET_SIGPIPE 13 /* Broken pipe (POSIX). */
  432. #define TARGET_SIGALRM 14 /* Alarm clock (POSIX). */
  433. #define TARGET_SIGTERM 15 /* Termination (ANSI). */
  434. #define TARGET_SIGUSR1 16 /* User-defined signal 1 (POSIX). */
  435. #define TARGET_SIGUSR2 17 /* User-defined signal 2 (POSIX). */
  436. #define TARGET_SIGCHLD 18 /* Child status has changed (POSIX). */
  437. #define TARGET_SIGCLD TARGET_SIGCHLD /* Same as TARGET_SIGCHLD (System V). */
  438. #define TARGET_SIGPWR 19 /* Power failure restart (System V). */
  439. #define TARGET_SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */
  440. #define TARGET_SIGURG 21 /* Urgent condition on socket (4.2 BSD). */
  441. #define TARGET_SIGIO 22 /* I/O now possible (4.2 BSD). */
  442. #define TARGET_SIGPOLL TARGET_SIGIO /* Pollable event occurred (System V). */
  443. #define TARGET_SIGSTOP 23 /* Stop, unblockable (POSIX). */
  444. #define TARGET_SIGTSTP 24 /* Keyboard stop (POSIX). */
  445. #define TARGET_SIGCONT 25 /* Continue (POSIX). */
  446. #define TARGET_SIGTTIN 26 /* Background read from tty (POSIX). */
  447. #define TARGET_SIGTTOU 27 /* Background write to tty (POSIX). */
  448. #define TARGET_SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */
  449. #define TARGET_SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */
  450. #define TARGET_SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */
  451. #define TARGET_SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */
  452. #define TARGET_SIGRTMIN 32
  453. #define TARGET_SIG_BLOCK 1 /* for blocking signals */
  454. #define TARGET_SIG_UNBLOCK 2 /* for unblocking signals */
  455. #define TARGET_SIG_SETMASK 3 /* for setting the signal mask */
  456. #else
  457. /* OpenRISC Using the general signals */
  458. #define TARGET_SIGHUP 1
  459. #define TARGET_SIGINT 2
  460. #define TARGET_SIGQUIT 3
  461. #define TARGET_SIGILL 4
  462. #define TARGET_SIGTRAP 5
  463. #define TARGET_SIGABRT 6
  464. #define TARGET_SIGIOT 6
  465. #define TARGET_SIGBUS 7
  466. #define TARGET_SIGFPE 8
  467. #define TARGET_SIGKILL 9
  468. #define TARGET_SIGUSR1 10
  469. #define TARGET_SIGSEGV 11
  470. #define TARGET_SIGUSR2 12
  471. #define TARGET_SIGPIPE 13
  472. #define TARGET_SIGALRM 14
  473. #define TARGET_SIGTERM 15
  474. #define TARGET_SIGSTKFLT 16
  475. #define TARGET_SIGCHLD 17
  476. #define TARGET_SIGCONT 18
  477. #define TARGET_SIGSTOP 19
  478. #define TARGET_SIGTSTP 20
  479. #define TARGET_SIGTTIN 21
  480. #define TARGET_SIGTTOU 22
  481. #define TARGET_SIGURG 23
  482. #define TARGET_SIGXCPU 24
  483. #define TARGET_SIGXFSZ 25
  484. #define TARGET_SIGVTALRM 26
  485. #define TARGET_SIGPROF 27
  486. #define TARGET_SIGWINCH 28
  487. #define TARGET_SIGIO 29
  488. #define TARGET_SIGPWR 30
  489. #define TARGET_SIGSYS 31
  490. #define TARGET_SIGRTMIN 32
  491. #define TARGET_SIG_BLOCK 0 /* for blocking signals */
  492. #define TARGET_SIG_UNBLOCK 1 /* for unblocking signals */
  493. #define TARGET_SIG_SETMASK 2 /* for setting the signal mask */
  494. #endif
  495. #if defined(TARGET_ALPHA)
  496. struct target_old_sigaction {
  497. abi_ulong _sa_handler;
  498. abi_ulong sa_mask;
  499. int32_t sa_flags;
  500. };
  501. struct target_rt_sigaction {
  502. abi_ulong _sa_handler;
  503. abi_ulong sa_flags;
  504. target_sigset_t sa_mask;
  505. };
  506. /* This is the struct used inside the kernel. The ka_restorer
  507. field comes from the 5th argument to sys_rt_sigaction. */
  508. struct target_sigaction {
  509. abi_ulong _sa_handler;
  510. abi_ulong sa_flags;
  511. target_sigset_t sa_mask;
  512. abi_ulong sa_restorer;
  513. };
  514. #elif defined(TARGET_MIPS)
  515. struct target_sigaction {
  516. uint32_t sa_flags;
  517. #if defined(TARGET_ABI_MIPSN32)
  518. uint32_t _sa_handler;
  519. #else
  520. abi_ulong _sa_handler;
  521. #endif
  522. target_sigset_t sa_mask;
  523. };
  524. #else
  525. struct target_old_sigaction {
  526. abi_ulong _sa_handler;
  527. abi_ulong sa_mask;
  528. abi_ulong sa_flags;
  529. abi_ulong sa_restorer;
  530. };
  531. struct target_sigaction {
  532. abi_ulong _sa_handler;
  533. abi_ulong sa_flags;
  534. abi_ulong sa_restorer;
  535. target_sigset_t sa_mask;
  536. };
  537. #endif
  538. typedef union target_sigval {
  539. int sival_int;
  540. abi_ulong sival_ptr;
  541. } target_sigval_t;
  542. #if 0
  543. #if defined (TARGET_SPARC)
  544. typedef struct {
  545. struct {
  546. abi_ulong psr;
  547. abi_ulong pc;
  548. abi_ulong npc;
  549. abi_ulong y;
  550. abi_ulong u_regs[16]; /* globals and ins */
  551. } si_regs;
  552. int si_mask;
  553. } __siginfo_t;
  554. typedef struct {
  555. unsigned long si_float_regs [32];
  556. unsigned long si_fsr;
  557. unsigned long si_fpqdepth;
  558. struct {
  559. unsigned long *insn_addr;
  560. unsigned long insn;
  561. } si_fpqueue [16];
  562. } __siginfo_fpu_t;
  563. #endif
  564. #endif
  565. #define TARGET_SI_MAX_SIZE 128
  566. #define TARGET_SI_PAD_SIZE ((TARGET_SI_MAX_SIZE/sizeof(int)) - 3)
  567. typedef struct target_siginfo {
  568. #ifdef TARGET_MIPS
  569. int si_signo;
  570. int si_code;
  571. int si_errno;
  572. #else
  573. int si_signo;
  574. int si_errno;
  575. int si_code;
  576. #endif
  577. union {
  578. int _pad[TARGET_SI_PAD_SIZE];
  579. /* kill() */
  580. struct {
  581. pid_t _pid; /* sender's pid */
  582. uid_t _uid; /* sender's uid */
  583. } _kill;
  584. /* POSIX.1b timers */
  585. struct {
  586. unsigned int _timer1;
  587. unsigned int _timer2;
  588. } _timer;
  589. /* POSIX.1b signals */
  590. struct {
  591. pid_t _pid; /* sender's pid */
  592. uid_t _uid; /* sender's uid */
  593. target_sigval_t _sigval;
  594. } _rt;
  595. /* SIGCHLD */
  596. struct {
  597. pid_t _pid; /* which child */
  598. uid_t _uid; /* sender's uid */
  599. int _status; /* exit code */
  600. target_clock_t _utime;
  601. target_clock_t _stime;
  602. } _sigchld;
  603. /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
  604. struct {
  605. abi_ulong _addr; /* faulting insn/memory ref. */
  606. } _sigfault;
  607. /* SIGPOLL */
  608. struct {
  609. int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
  610. int _fd;
  611. } _sigpoll;
  612. } _sifields;
  613. } target_siginfo_t;
  614. /*
  615. * si_code values
  616. * Digital reserves positive values for kernel-generated signals.
  617. */
  618. #define TARGET_SI_USER 0 /* sent by kill, sigsend, raise */
  619. #define TARGET_SI_KERNEL 0x80 /* sent by the kernel from somewhere */
  620. #define TARGET_SI_QUEUE -1 /* sent by sigqueue */
  621. #define TARGET_SI_TIMER -2 /* sent by timer expiration */
  622. #define TARGET_SI_MESGQ -3 /* sent by real time mesq state change */
  623. #define TARGET_SI_ASYNCIO -4 /* sent by AIO completion */
  624. #define TARGET_SI_SIGIO -5 /* sent by queued SIGIO */
  625. /*
  626. * SIGILL si_codes
  627. */
  628. #define TARGET_ILL_ILLOPC (1) /* illegal opcode */
  629. #define TARGET_ILL_ILLOPN (2) /* illegal operand */
  630. #define TARGET_ILL_ILLADR (3) /* illegal addressing mode */
  631. #define TARGET_ILL_ILLTRP (4) /* illegal trap */
  632. #define TARGET_ILL_PRVOPC (5) /* privileged opcode */
  633. #define TARGET_ILL_PRVREG (6) /* privileged register */
  634. #define TARGET_ILL_COPROC (7) /* coprocessor error */
  635. #define TARGET_ILL_BADSTK (8) /* internal stack error */
  636. /*
  637. * SIGFPE si_codes
  638. */
  639. #define TARGET_FPE_INTDIV (1) /* integer divide by zero */
  640. #define TARGET_FPE_INTOVF (2) /* integer overflow */
  641. #define TARGET_FPE_FLTDIV (3) /* floating point divide by zero */
  642. #define TARGET_FPE_FLTOVF (4) /* floating point overflow */
  643. #define TARGET_FPE_FLTUND (5) /* floating point underflow */
  644. #define TARGET_FPE_FLTRES (6) /* floating point inexact result */
  645. #define TARGET_FPE_FLTINV (7) /* floating point invalid operation */
  646. #define TARGET_FPE_FLTSUB (8) /* subscript out of range */
  647. #define TARGET_NSIGFPE 8
  648. /*
  649. * SIGSEGV si_codes
  650. */
  651. #define TARGET_SEGV_MAPERR (1) /* address not mapped to object */
  652. #define TARGET_SEGV_ACCERR (2) /* invalid permissions for mapped object */
  653. /*
  654. * SIGBUS si_codes
  655. */
  656. #define TARGET_BUS_ADRALN (1) /* invalid address alignment */
  657. #define TARGET_BUS_ADRERR (2) /* non-existent physical address */
  658. #define TARGET_BUS_OBJERR (3) /* object specific hardware error */
  659. /*
  660. * SIGTRAP si_codes
  661. */
  662. #define TARGET_TRAP_BRKPT (1) /* process breakpoint */
  663. #define TARGET_TRAP_TRACE (2) /* process trace trap */
  664. #endif /* defined(TARGET_I386) || defined(TARGET_ARM) */
  665. struct target_rlimit {
  666. abi_ulong rlim_cur;
  667. abi_ulong rlim_max;
  668. };
  669. #if defined(TARGET_ALPHA)
  670. #define TARGET_RLIM_INFINITY 0x7fffffffffffffffull
  671. #elif defined(TARGET_MIPS) || (defined(TARGET_SPARC) && TARGET_ABI_BITS == 32)
  672. #define TARGET_RLIM_INFINITY 0x7fffffffUL
  673. #else
  674. #define TARGET_RLIM_INFINITY ((abi_ulong)-1)
  675. #endif
  676. #if defined(TARGET_MIPS)
  677. #define TARGET_RLIMIT_CPU 0
  678. #define TARGET_RLIMIT_FSIZE 1
  679. #define TARGET_RLIMIT_DATA 2
  680. #define TARGET_RLIMIT_STACK 3
  681. #define TARGET_RLIMIT_CORE 4
  682. #define TARGET_RLIMIT_RSS 7
  683. #define TARGET_RLIMIT_NPROC 8
  684. #define TARGET_RLIMIT_NOFILE 5
  685. #define TARGET_RLIMIT_MEMLOCK 9
  686. #define TARGET_RLIMIT_AS 6
  687. #define TARGET_RLIMIT_LOCKS 10
  688. #define TARGET_RLIMIT_SIGPENDING 11
  689. #define TARGET_RLIMIT_MSGQUEUE 12
  690. #define TARGET_RLIMIT_NICE 13
  691. #define TARGET_RLIMIT_RTPRIO 14
  692. #else
  693. #define TARGET_RLIMIT_CPU 0
  694. #define TARGET_RLIMIT_FSIZE 1
  695. #define TARGET_RLIMIT_DATA 2
  696. #define TARGET_RLIMIT_STACK 3
  697. #define TARGET_RLIMIT_CORE 4
  698. #define TARGET_RLIMIT_RSS 5
  699. #if defined(TARGET_SPARC)
  700. #define TARGET_RLIMIT_NOFILE 6
  701. #define TARGET_RLIMIT_NPROC 7
  702. #else
  703. #define TARGET_RLIMIT_NPROC 6
  704. #define TARGET_RLIMIT_NOFILE 7
  705. #endif
  706. #define TARGET_RLIMIT_MEMLOCK 8
  707. #define TARGET_RLIMIT_AS 9
  708. #define TARGET_RLIMIT_LOCKS 10
  709. #define TARGET_RLIMIT_SIGPENDING 11
  710. #define TARGET_RLIMIT_MSGQUEUE 12
  711. #define TARGET_RLIMIT_NICE 13
  712. #define TARGET_RLIMIT_RTPRIO 14
  713. #endif
  714. struct target_pollfd {
  715. int fd; /* file descriptor */
  716. short events; /* requested events */
  717. short revents; /* returned events */
  718. };
  719. /* virtual terminal ioctls */
  720. #define TARGET_KIOCSOUND 0x4B2F /* start sound generation (0 for off) */
  721. #define TARGET_KDMKTONE 0x4B30 /* generate tone */
  722. #define TARGET_KDGKBTYPE 0x4b33
  723. #define TARGET_KDSETMODE 0x4b3a
  724. #define TARGET_KDGKBMODE 0x4b44
  725. #define TARGET_KDSKBMODE 0x4b45
  726. #define TARGET_KDGKBENT 0x4B46 /* gets one entry in translation table */
  727. #define TARGET_KDGKBSENT 0x4B48 /* gets one function key string entry */
  728. #define TARGET_KDGKBLED 0x4B64 /* get led flags (not lights) */
  729. #define TARGET_KDSKBLED 0x4B65 /* set led flags (not lights) */
  730. #define TARGET_KDGETLED 0x4B31 /* return current led state */
  731. #define TARGET_KDSETLED 0x4B32 /* set led state [lights, not flags] */
  732. #define TARGET_SIOCATMARK 0x8905
  733. /* Networking ioctls */
  734. #define TARGET_SIOCADDRT 0x890B /* add routing table entry */
  735. #define TARGET_SIOCDELRT 0x890C /* delete routing table entry */
  736. #define TARGET_SIOCGIFNAME 0x8910 /* get iface name */
  737. #define TARGET_SIOCSIFLINK 0x8911 /* set iface channel */
  738. #define TARGET_SIOCGIFCONF 0x8912 /* get iface list */
  739. #define TARGET_SIOCGIFFLAGS 0x8913 /* get flags */
  740. #define TARGET_SIOCSIFFLAGS 0x8914 /* set flags */
  741. #define TARGET_SIOCGIFADDR 0x8915 /* get PA address */
  742. #define TARGET_SIOCSIFADDR 0x8916 /* set PA address */
  743. #define TARGET_SIOCGIFDSTADDR 0x8917 /* get remote PA address */
  744. #define TARGET_SIOCSIFDSTADDR 0x8918 /* set remote PA address */
  745. #define TARGET_SIOCGIFBRDADDR 0x8919 /* get broadcast PA address */
  746. #define TARGET_SIOCSIFBRDADDR 0x891a /* set broadcast PA address */
  747. #define TARGET_SIOCGIFNETMASK 0x891b /* get network PA mask */
  748. #define TARGET_SIOCSIFNETMASK 0x891c /* set network PA mask */
  749. #define TARGET_SIOCGIFMETRIC 0x891d /* get metric */
  750. #define TARGET_SIOCSIFMETRIC 0x891e /* set metric */
  751. #define TARGET_SIOCGIFMEM 0x891f /* get memory address (BSD) */
  752. #define TARGET_SIOCSIFMEM 0x8920 /* set memory address (BSD) */
  753. #define TARGET_SIOCGIFMTU 0x8921 /* get MTU size */
  754. #define TARGET_SIOCSIFMTU 0x8922 /* set MTU size */
  755. #define TARGET_SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */
  756. #define TARGET_SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */
  757. #define TARGET_SIOCSIFENCAP 0x8926
  758. #define TARGET_SIOCGIFHWADDR 0x8927 /* Get hardware address */
  759. #define TARGET_SIOCGIFSLAVE 0x8929 /* Driver slaving support */
  760. #define TARGET_SIOCSIFSLAVE 0x8930
  761. #define TARGET_SIOCADDMULTI 0x8931 /* Multicast address lists */
  762. #define TARGET_SIOCDELMULTI 0x8932
  763. /* Bridging control calls */
  764. #define TARGET_SIOCGIFBR 0x8940 /* Bridging support */
  765. #define TARGET_SIOCSIFBR 0x8941 /* Set bridging options */
  766. #define TARGET_SIOCGIFTXQLEN 0x8942 /* Get the tx queue length */
  767. #define TARGET_SIOCSIFTXQLEN 0x8943 /* Set the tx queue length */
  768. /* ARP cache control calls. */
  769. #define TARGET_OLD_SIOCDARP 0x8950 /* old delete ARP table entry */
  770. #define TARGET_OLD_SIOCGARP 0x8951 /* old get ARP table entry */
  771. #define TARGET_OLD_SIOCSARP 0x8952 /* old set ARP table entry */
  772. #define TARGET_SIOCDARP 0x8953 /* delete ARP table entry */
  773. #define TARGET_SIOCGARP 0x8954 /* get ARP table entry */
  774. #define TARGET_SIOCSARP 0x8955 /* set ARP table entry */
  775. /* RARP cache control calls. */
  776. #define TARGET_SIOCDRARP 0x8960 /* delete RARP table entry */
  777. #define TARGET_SIOCGRARP 0x8961 /* get RARP table entry */
  778. #define TARGET_SIOCSRARP 0x8962 /* set RARP table entry */
  779. /* Driver configuration calls */
  780. #define TARGET_SIOCGIFMAP 0x8970 /* Get device parameters */
  781. #define TARGET_SIOCSIFMAP 0x8971 /* Set device parameters */
  782. /* DLCI configuration calls */
  783. #define TARGET_SIOCADDDLCI 0x8980 /* Create new DLCI device */
  784. #define TARGET_SIOCDELDLCI 0x8981 /* Delete DLCI device */
  785. /* From <linux/wireless.h> */
  786. #define TARGET_SIOCGIWNAME 0x8B01 /* get name == wireless protocol */
  787. /* From <linux/fs.h> */
  788. #define TARGET_BLKROSET TARGET_IO(0x12,93) /* set device read-only (0 = read-write) */
  789. #define TARGET_BLKROGET TARGET_IO(0x12,94) /* get read-only status (0 = read_write) */
  790. #define TARGET_BLKRRPART TARGET_IO(0x12,95) /* re-read partition table */
  791. #define TARGET_BLKGETSIZE TARGET_IO(0x12,96) /* return device size /512 (long *arg) */
  792. #define TARGET_BLKFLSBUF TARGET_IO(0x12,97) /* flush buffer cache */
  793. #define TARGET_BLKRASET TARGET_IO(0x12,98) /* Set read ahead for block device */
  794. #define TARGET_BLKRAGET TARGET_IO(0x12,99) /* get current read ahead setting */
  795. #define TARGET_BLKFRASET TARGET_IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
  796. #define TARGET_BLKFRAGET TARGET_IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
  797. #define TARGET_BLKSECTSET TARGET_IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
  798. #define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
  799. #define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */
  800. #define TARGET_BLKPG TARGET_IO(0x12,105)/* Partition table and disk geometry handling */
  801. /* A jump here: 108-111 have been used for various private purposes. */
  802. #define TARGET_BLKBSZGET TARGET_IOR(0x12, 112, abi_ulong)
  803. #define TARGET_BLKBSZSET TARGET_IOW(0x12, 113, abi_ulong)
  804. #define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong)
  805. /* return device size in bytes
  806. (u64 *arg) */
  807. #define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */
  808. #define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */
  809. #define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap)
  810. /* cdrom commands */
  811. #define TARGET_CDROMPAUSE 0x5301 /* Pause Audio Operation */
  812. #define TARGET_CDROMRESUME 0x5302 /* Resume paused Audio Operation */
  813. #define TARGET_CDROMPLAYMSF 0x5303 /* Play Audio MSF (struct cdrom_msf) */
  814. #define TARGET_CDROMPLAYTRKIND 0x5304 /* Play Audio Track/index
  815. (struct cdrom_ti) */
  816. #define TARGET_CDROMREADTOCHDR 0x5305 /* Read TOC header
  817. (struct cdrom_tochdr) */
  818. #define TARGET_CDROMREADTOCENTRY 0x5306 /* Read TOC entry
  819. (struct cdrom_tocentry) */
  820. #define TARGET_CDROMSTOP 0x5307 /* Stop the cdrom drive */
  821. #define TARGET_CDROMSTART 0x5308 /* Start the cdrom drive */
  822. #define TARGET_CDROMEJECT 0x5309 /* Ejects the cdrom media */
  823. #define TARGET_CDROMVOLCTRL 0x530a /* Control output volume
  824. (struct cdrom_volctrl) */
  825. #define TARGET_CDROMSUBCHNL 0x530b /* Read subchannel data
  826. (struct cdrom_subchnl) */
  827. #define TARGET_CDROMREADMODE2 0x530c /* Read TARGET_CDROM mode 2 data (2336 Bytes)
  828. (struct cdrom_read) */
  829. #define TARGET_CDROMREADMODE1 0x530d /* Read TARGET_CDROM mode 1 data (2048 Bytes)
  830. (struct cdrom_read) */
  831. #define TARGET_CDROMREADAUDIO 0x530e /* (struct cdrom_read_audio) */
  832. #define TARGET_CDROMEJECT_SW 0x530f /* enable(1)/disable(0) auto-ejecting */
  833. #define TARGET_CDROMMULTISESSION 0x5310 /* Obtain the start-of-last-session
  834. address of multi session disks
  835. (struct cdrom_multisession) */
  836. #define TARGET_CDROM_GET_MCN 0x5311 /* Obtain the "Universal Product Code"
  837. if available (struct cdrom_mcn) */
  838. #define TARGET_CDROM_GET_UPC TARGET_CDROM_GET_MCN /* This one is depricated,
  839. but here anyway for compatibility */
  840. #define TARGET_CDROMRESET 0x5312 /* hard-reset the drive */
  841. #define TARGET_CDROMVOLREAD 0x5313 /* Get the drive's volume setting
  842. (struct cdrom_volctrl) */
  843. #define TARGET_CDROMREADRAW 0x5314 /* read data in raw mode (2352 Bytes)
  844. (struct cdrom_read) */
  845. /*
  846. * These ioctls are used only used in aztcd.c and optcd.c
  847. */
  848. #define TARGET_CDROMREADCOOKED 0x5315 /* read data in cooked mode */
  849. #define TARGET_CDROMSEEK 0x5316 /* seek msf address */
  850. /*
  851. * This ioctl is only used by the scsi-cd driver.
  852. It is for playing audio in logical block addressing mode.
  853. */
  854. #define TARGET_CDROMPLAYBLK 0x5317 /* (struct cdrom_blk) */
  855. /*
  856. * These ioctls are only used in optcd.c
  857. */
  858. #define TARGET_CDROMREADALL 0x5318 /* read all 2646 bytes */
  859. /*
  860. * These ioctls are (now) only in ide-cd.c for controlling
  861. * drive spindown time. They should be implemented in the
  862. * Uniform driver, via generic packet commands, GPCMD_MODE_SELECT_10,
  863. * GPCMD_MODE_SENSE_10 and the GPMODE_POWER_PAGE...
  864. * -Erik
  865. */
  866. #define TARGET_CDROMGETSPINDOWN 0x531d
  867. #define TARGET_CDROMSETSPINDOWN 0x531e
  868. /*
  869. * These ioctls are implemented through the uniform CD-ROM driver
  870. * They _will_ be adopted by all CD-ROM drivers, when all the CD-ROM
  871. * drivers are eventually ported to the uniform CD-ROM driver interface.
  872. */
  873. #define TARGET_CDROMCLOSETRAY 0x5319 /* pendant of CDROMEJECT */
  874. #define TARGET_CDROM_SET_OPTIONS 0x5320 /* Set behavior options */
  875. #define TARGET_CDROM_CLEAR_OPTIONS 0x5321 /* Clear behavior options */
  876. #define TARGET_CDROM_SELECT_SPEED 0x5322 /* Set the CD-ROM speed */
  877. #define TARGET_CDROM_SELECT_DISC 0x5323 /* Select disc (for juke-boxes) */
  878. #define TARGET_CDROM_MEDIA_CHANGED 0x5325 /* Check is media changed */
  879. #define TARGET_CDROM_DRIVE_STATUS 0x5326 /* Get tray position, etc. */
  880. #define TARGET_CDROM_DISC_STATUS 0x5327 /* Get disc type, etc. */
  881. #define TARGET_CDROM_CHANGER_NSLOTS 0x5328 /* Get number of slots */
  882. #define TARGET_CDROM_LOCKDOOR 0x5329 /* lock or unlock door */
  883. #define TARGET_CDROM_DEBUG 0x5330 /* Turn debug messages on/off */
  884. #define TARGET_CDROM_GET_CAPABILITY 0x5331 /* get capabilities */
  885. /* Note that scsi/scsi_ioctl.h also uses 0x5382 - 0x5386.
  886. * Future CDROM ioctls should be kept below 0x537F
  887. */
  888. /* This ioctl is only used by sbpcd at the moment */
  889. #define TARGET_CDROMAUDIOBUFSIZ 0x5382 /* set the audio buffer size */
  890. /* conflict with SCSI_IOCTL_GET_IDLUN */
  891. /* DVD-ROM Specific ioctls */
  892. #define TARGET_DVD_READ_STRUCT 0x5390 /* Read structure */
  893. #define TARGET_DVD_WRITE_STRUCT 0x5391 /* Write structure */
  894. #define TARGET_DVD_AUTH 0x5392 /* Authentication */
  895. #define TARGET_CDROM_SEND_PACKET 0x5393 /* send a packet to the drive */
  896. #define TARGET_CDROM_NEXT_WRITABLE 0x5394 /* get next writable block */
  897. #define TARGET_CDROM_LAST_WRITTEN 0x5395 /* get last block written on disc */
  898. /* HD commands */
  899. /* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
  900. #define TARGET_HDIO_GETGEO 0x0301 /* get device geometry */
  901. #define TARGET_HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */
  902. #define TARGET_HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */
  903. #define TARGET_HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */
  904. #define TARGET_HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */
  905. #define TARGET_HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */
  906. #define TARGET_HDIO_GET_DMA 0x030b /* get use-dma flag */
  907. #define TARGET_HDIO_GET_IDENTITY 0x030d /* get IDE identification info */
  908. #define TARGET_HDIO_DRIVE_CMD 0x031f /* execute a special drive command */
  909. /* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
  910. #define TARGET_HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */
  911. #define TARGET_HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */
  912. #define TARGET_HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */
  913. #define TARGET_HDIO_SET_32BIT 0x0324 /* change io_32bit flags */
  914. #define TARGET_HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */
  915. #define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */
  916. #define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */
  917. /* loop ioctls */
  918. #define TARGET_LOOP_SET_FD 0x4C00
  919. #define TARGET_LOOP_CLR_FD 0x4C01
  920. #define TARGET_LOOP_SET_STATUS 0x4C02
  921. #define TARGET_LOOP_GET_STATUS 0x4C03
  922. #define TARGET_LOOP_SET_STATUS64 0x4C04
  923. #define TARGET_LOOP_GET_STATUS64 0x4C05
  924. #define TARGET_LOOP_CHANGE_FD 0x4C06
  925. /* fb ioctls */
  926. #define TARGET_FBIOGET_VSCREENINFO 0x4600
  927. #define TARGET_FBIOPUT_VSCREENINFO 0x4601
  928. #define TARGET_FBIOGET_FSCREENINFO 0x4602
  929. #define TARGET_FBIOGETCMAP 0x4604
  930. #define TARGET_FBIOPUTCMAP 0x4605
  931. #define TARGET_FBIOPAN_DISPLAY 0x4606
  932. #define TARGET_FBIOGET_CON2FBMAP 0x460F
  933. #define TARGET_FBIOPUT_CON2FBMAP 0x4610
  934. /* vt ioctls */
  935. #define TARGET_VT_OPENQRY 0x5600
  936. #define TARGET_VT_GETSTATE 0x5603
  937. #define TARGET_VT_ACTIVATE 0x5606
  938. #define TARGET_VT_WAITACTIVE 0x5607
  939. #define TARGET_VT_LOCKSWITCH 0x560b
  940. #define TARGET_VT_UNLOCKSWITCH 0x560c
  941. #define TARGET_VT_GETMODE 0x5601
  942. #define TARGET_VT_SETMODE 0x5602
  943. #define TARGET_VT_RELDISP 0x5605
  944. #define TARGET_VT_DISALLOCATE 0x5608
  945. /* device mapper */
  946. #define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00)
  947. #define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01)
  948. #define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02)
  949. #define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03)
  950. #define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04)
  951. #define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05)
  952. #define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06)
  953. #define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07)
  954. #define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08)
  955. #define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09)
  956. #define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a)
  957. #define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b)
  958. #define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c)
  959. #define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d)
  960. #define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e)
  961. #define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f)
  962. /* from asm/termbits.h */
  963. #define TARGET_NCC 8
  964. struct target_termio {
  965. unsigned short c_iflag; /* input mode flags */
  966. unsigned short c_oflag; /* output mode flags */
  967. unsigned short c_cflag; /* control mode flags */
  968. unsigned short c_lflag; /* local mode flags */
  969. unsigned char c_line; /* line discipline */
  970. unsigned char c_cc[TARGET_NCC]; /* control characters */
  971. };
  972. struct target_winsize {
  973. unsigned short ws_row;
  974. unsigned short ws_col;
  975. unsigned short ws_xpixel;
  976. unsigned short ws_ypixel;
  977. };
  978. #include "termbits.h"
  979. #if defined(TARGET_MIPS)
  980. #define TARGET_PROT_SEM 0x10
  981. #else
  982. #define TARGET_PROT_SEM 0x08
  983. #endif
  984. /* Common */
  985. #define TARGET_MAP_SHARED 0x01 /* Share changes */
  986. #define TARGET_MAP_PRIVATE 0x02 /* Changes are private */
  987. #define TARGET_MAP_TYPE 0x0f /* Mask for type of mapping */
  988. /* Target specific */
  989. #if defined(TARGET_MIPS)
  990. #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
  991. #define TARGET_MAP_ANONYMOUS 0x0800 /* don't use a file */
  992. #define TARGET_MAP_GROWSDOWN 0x1000 /* stack-like segment */
  993. #define TARGET_MAP_DENYWRITE 0x2000 /* ETXTBSY */
  994. #define TARGET_MAP_EXECUTABLE 0x4000 /* mark it as an executable */
  995. #define TARGET_MAP_LOCKED 0x8000 /* pages are locked */
  996. #define TARGET_MAP_NORESERVE 0x0400 /* don't check for reservations */
  997. #define TARGET_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */
  998. #define TARGET_MAP_NONBLOCK 0x20000 /* do not block on IO */
  999. #elif defined(TARGET_PPC)
  1000. #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
  1001. #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */
  1002. #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */
  1003. #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */
  1004. #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */
  1005. #define TARGET_MAP_LOCKED 0x0080 /* pages are locked */
  1006. #define TARGET_MAP_NORESERVE 0x0040 /* don't check for reservations */
  1007. #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
  1008. #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */
  1009. #elif defined(TARGET_ALPHA)
  1010. #define TARGET_MAP_ANONYMOUS 0x10 /* don't use a file */
  1011. #define TARGET_MAP_FIXED 0x100 /* Interpret addr exactly */
  1012. #define TARGET_MAP_GROWSDOWN 0x01000 /* stack-like segment */
  1013. #define TARGET_MAP_DENYWRITE 0x02000 /* ETXTBSY */
  1014. #define TARGET_MAP_EXECUTABLE 0x04000 /* mark it as an executable */
  1015. #define TARGET_MAP_LOCKED 0x08000 /* lock the mapping */
  1016. #define TARGET_MAP_NORESERVE 0x10000 /* no check for reservations */
  1017. #define TARGET_MAP_POPULATE 0x20000 /* pop (prefault) pagetables */
  1018. #define TARGET_MAP_NONBLOCK 0x40000 /* do not block on IO */
  1019. #else
  1020. #define TARGET_MAP_FIXED 0x10 /* Interpret addr exactly */
  1021. #define TARGET_MAP_ANONYMOUS 0x20 /* don't use a file */
  1022. #define TARGET_MAP_GROWSDOWN 0x0100 /* stack-like segment */
  1023. #define TARGET_MAP_DENYWRITE 0x0800 /* ETXTBSY */
  1024. #define TARGET_MAP_EXECUTABLE 0x1000 /* mark it as an executable */
  1025. #define TARGET_MAP_LOCKED 0x2000 /* pages are locked */
  1026. #define TARGET_MAP_NORESERVE 0x4000 /* don't check for reservations */
  1027. #define TARGET_MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
  1028. #define TARGET_MAP_NONBLOCK 0x10000 /* do not block on IO */
  1029. #define TARGET_MAP_UNINITIALIZED 0x4000000 /* for anonymous mmap, memory could be uninitialized */
  1030. #endif
  1031. #if (defined(TARGET_I386) && defined(TARGET_ABI32)) \
  1032. || (defined(TARGET_ARM) && defined(TARGET_ABI32)) \
  1033. || defined(TARGET_CRIS) || defined(TARGET_UNICORE32)
  1034. struct target_stat {
  1035. unsigned short st_dev;
  1036. unsigned short __pad1;
  1037. abi_ulong st_ino;
  1038. unsigned short st_mode;
  1039. unsigned short st_nlink;
  1040. unsigned short st_uid;
  1041. unsigned short st_gid;
  1042. unsigned short st_rdev;
  1043. unsigned short __pad2;
  1044. abi_ulong st_size;
  1045. abi_ulong st_blksize;
  1046. abi_ulong st_blocks;
  1047. abi_ulong target_st_atime;
  1048. abi_ulong __unused1;
  1049. abi_ulong target_st_mtime;
  1050. abi_ulong __unused2;
  1051. abi_ulong target_st_ctime;
  1052. abi_ulong __unused3;
  1053. abi_ulong __unused4;
  1054. abi_ulong __unused5;
  1055. };
  1056. /* This matches struct stat64 in glibc2.1, hence the absolutely
  1057. * insane amounts of padding around dev_t's.
  1058. */
  1059. #define TARGET_HAS_STRUCT_STAT64
  1060. struct target_stat64 {
  1061. unsigned short st_dev;
  1062. unsigned char __pad0[10];
  1063. #define TARGET_STAT64_HAS_BROKEN_ST_INO 1
  1064. abi_ulong __st_ino;
  1065. unsigned int st_mode;
  1066. unsigned int st_nlink;
  1067. abi_ulong st_uid;
  1068. abi_ulong st_gid;
  1069. unsigned short st_rdev;
  1070. unsigned char __pad3[10];
  1071. long long st_size;
  1072. abi_ulong st_blksize;
  1073. abi_ulong st_blocks; /* Number 512-byte blocks allocated. */
  1074. abi_ulong __pad4; /* future possible st_blocks high bits */
  1075. abi_ulong target_st_atime;
  1076. abi_ulong __pad5;
  1077. abi_ulong target_st_mtime;
  1078. abi_ulong __pad6;
  1079. abi_ulong target_st_ctime;
  1080. abi_ulong __pad7; /* will be high 32 bits of ctime someday */
  1081. unsigned long long st_ino;
  1082. } QEMU_PACKED;
  1083. #ifdef TARGET_ARM
  1084. #define TARGET_HAS_STRUCT_STAT64
  1085. struct target_eabi_stat64 {
  1086. unsigned long long st_dev;
  1087. unsigned int __pad1;
  1088. abi_ulong __st_ino;
  1089. unsigned int st_mode;
  1090. unsigned int st_nlink;
  1091. abi_ulong st_uid;
  1092. abi_ulong st_gid;
  1093. unsigned long long st_rdev;
  1094. unsigned int __pad2[2];
  1095. long long st_size;
  1096. abi_ulong st_blksize;
  1097. unsigned int __pad3;
  1098. unsigned long long st_blocks;
  1099. abi_ulong target_st_atime;
  1100. abi_ulong target_st_atime_nsec;
  1101. abi_ulong target_st_mtime;
  1102. abi_ulong target_st_mtime_nsec;
  1103. abi_ulong target_st_ctime;
  1104. abi_ulong target_st_ctime_nsec;
  1105. unsigned long long st_ino;
  1106. } QEMU_PACKED;
  1107. #endif
  1108. #elif defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
  1109. struct target_stat {
  1110. unsigned int st_dev;
  1111. abi_ulong st_ino;
  1112. unsigned int st_mode;
  1113. unsigned int st_nlink;
  1114. unsigned int st_uid;
  1115. unsigned int st_gid;
  1116. unsigned int st_rdev;
  1117. abi_long st_size;
  1118. abi_long target_st_atime;
  1119. abi_long target_st_mtime;
  1120. abi_long target_st_ctime;
  1121. abi_long st_blksize;
  1122. abi_long st_blocks;
  1123. abi_ulong __unused4[2];
  1124. };
  1125. #define TARGET_HAS_STRUCT_STAT64
  1126. struct target_stat64 {
  1127. unsigned char __pad0[6];
  1128. unsigned short st_dev;
  1129. uint64_t st_ino;
  1130. uint64_t st_nlink;
  1131. unsigned int st_mode;
  1132. unsigned int st_uid;
  1133. unsigned int st_gid;
  1134. unsigned char __pad2[6];
  1135. unsigned short st_rdev;
  1136. int64_t st_size;
  1137. int64_t st_blksize;
  1138. unsigned char __pad4[4];
  1139. unsigned int st_blocks;
  1140. abi_ulong target_st_atime;
  1141. abi_ulong __unused1;
  1142. abi_ulong target_st_mtime;
  1143. abi_ulong __unused2;
  1144. abi_ulong target_st_ctime;
  1145. abi_ulong __unused3;
  1146. abi_ulong __unused4[3];
  1147. };
  1148. #elif defined(TARGET_SPARC)
  1149. struct target_stat {
  1150. unsigned short st_dev;
  1151. abi_ulong st_ino;
  1152. unsigned short st_mode;
  1153. short st_nlink;
  1154. unsigned short st_uid;
  1155. unsigned short st_gid;
  1156. unsigned short st_rdev;
  1157. abi_long st_size;
  1158. abi_long target_st_atime;
  1159. abi_ulong __unused1;
  1160. abi_long target_st_mtime;
  1161. abi_ulong __unused2;
  1162. abi_long target_st_ctime;
  1163. abi_ulong __unused3;
  1164. abi_long st_blksize;
  1165. abi_long st_blocks;
  1166. abi_ulong __unused4[2];
  1167. };
  1168. #define TARGET_HAS_STRUCT_STAT64
  1169. struct target_stat64 {
  1170. unsigned char __pad0[6];
  1171. unsigned short st_dev;
  1172. uint64_t st_ino;
  1173. unsigned int st_mode;
  1174. unsigned int st_nlink;
  1175. unsigned int st_uid;
  1176. unsigned int st_gid;
  1177. unsigned char __pad2[6];
  1178. unsigned short st_rdev;
  1179. unsigned char __pad3[8];
  1180. int64_t st_size;
  1181. unsigned int st_blksize;
  1182. unsigned char __pad4[8];
  1183. unsigned int st_blocks;
  1184. unsigned int target_st_atime;
  1185. unsigned int __unused1;
  1186. unsigned int target_st_mtime;
  1187. unsigned int __unused2;
  1188. unsigned int target_st_ctime;
  1189. unsigned int __unused3;
  1190. unsigned int __unused4;
  1191. unsigned int __unused5;
  1192. };
  1193. #elif defined(TARGET_PPC)
  1194. struct target_stat {
  1195. abi_ulong st_dev;
  1196. abi_ulong st_ino;
  1197. #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
  1198. abi_ulong st_nlink;
  1199. unsigned int st_mode;
  1200. #else
  1201. unsigned int st_mode;
  1202. unsigned short st_nlink;
  1203. #endif
  1204. unsigned int st_uid;
  1205. unsigned int st_gid;
  1206. abi_ulong st_rdev;
  1207. abi_ulong st_size;
  1208. abi_ulong st_blksize;
  1209. abi_ulong st_blocks;
  1210. abi_ulong target_st_atime;
  1211. abi_ulong target_st_atime_nsec;
  1212. abi_ulong target_st_mtime;
  1213. abi_ulong target_st_mtime_nsec;
  1214. abi_ulong target_st_ctime;
  1215. abi_ulong target_st_ctime_nsec;
  1216. abi_ulong __unused4;
  1217. abi_ulong __unused5;
  1218. #if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
  1219. abi_ulong __unused6;
  1220. #endif
  1221. };
  1222. #if !defined(TARGET_PPC64) || defined(TARGET_ABI32)
  1223. #define TARGET_HAS_STRUCT_STAT64
  1224. struct QEMU_PACKED target_stat64 {
  1225. unsigned long long st_dev;
  1226. unsigned long long st_ino;
  1227. unsigned int st_mode;
  1228. unsigned int st_nlink;
  1229. unsigned int st_uid;
  1230. unsigned int st_gid;
  1231. unsigned long long st_rdev;
  1232. unsigned long long __pad0;
  1233. long long st_size;
  1234. int st_blksize;
  1235. unsigned int __pad1;
  1236. long long st_blocks; /* Number 512-byte blocks allocated. */
  1237. int target_st_atime;
  1238. unsigned int target_st_atime_nsec;
  1239. int target_st_mtime;
  1240. unsigned int target_st_mtime_nsec;
  1241. int target_st_ctime;
  1242. unsigned int target_st_ctime_nsec;
  1243. unsigned int __unused4;
  1244. unsigned int __unused5;
  1245. };
  1246. #endif
  1247. #elif defined(TARGET_MICROBLAZE)
  1248. struct target_stat {
  1249. abi_ulong st_dev;
  1250. abi_ulong st_ino;
  1251. unsigned int st_mode;
  1252. unsigned short st_nlink;
  1253. unsigned int st_uid;
  1254. unsigned int st_gid;
  1255. abi_ulong st_rdev;
  1256. abi_ulong st_size;
  1257. abi_ulong st_blksize;
  1258. abi_ulong st_blocks;
  1259. abi_ulong target_st_atime;
  1260. abi_ulong target_st_atime_nsec;
  1261. abi_ulong target_st_mtime;
  1262. abi_ulong target_st_mtime_nsec;
  1263. abi_ulong target_st_ctime;
  1264. abi_ulong target_st_ctime_nsec;
  1265. abi_ulong __unused4;
  1266. abi_ulong __unused5;
  1267. };
  1268. /* FIXME: Microblaze no-mmu user-space has a difference stat64 layout... */
  1269. #define TARGET_HAS_STRUCT_STAT64
  1270. struct QEMU_PACKED target_stat64 {
  1271. uint64_t st_dev;
  1272. #define TARGET_STAT64_HAS_BROKEN_ST_INO 1
  1273. uint32_t pad0;
  1274. uint32_t __st_ino;
  1275. uint32_t st_mode;
  1276. uint32_t st_nlink;
  1277. uint32_t st_uid;
  1278. uint32_t st_gid;
  1279. uint64_t st_rdev;
  1280. uint64_t __pad1;
  1281. int64_t st_size;
  1282. int32_t st_blksize;
  1283. uint32_t __pad2;
  1284. int64_t st_blocks; /* Number 512-byte blocks allocated. */
  1285. int target_st_atime;
  1286. unsigned int target_st_atime_nsec;
  1287. int target_st_mtime;
  1288. unsigned int target_st_mtime_nsec;
  1289. int target_st_ctime;
  1290. unsigned int target_st_ctime_nsec;
  1291. uint64_t st_ino;
  1292. };
  1293. #elif defined(TARGET_M68K)
  1294. struct target_stat {
  1295. unsigned short st_dev;
  1296. unsigned short __pad1;
  1297. abi_ulong st_ino;
  1298. unsigned short st_mode;
  1299. unsigned short st_nlink;
  1300. unsigned short st_uid;
  1301. unsigned short st_gid;
  1302. unsigned short st_rdev;
  1303. unsigned short __pad2;
  1304. abi_ulong st_size;
  1305. abi_ulong st_blksize;
  1306. abi_ulong st_blocks;
  1307. abi_ulong target_st_atime;
  1308. abi_ulong __unused1;
  1309. abi_ulong target_st_mtime;
  1310. abi_ulong __unused2;
  1311. abi_ulong target_st_ctime;
  1312. abi_ulong __unused3;
  1313. abi_ulong __unused4;
  1314. abi_ulong __unused5;
  1315. };
  1316. /* This matches struct stat64 in glibc2.1, hence the absolutely
  1317. * insane amounts of padding around dev_t's.
  1318. */
  1319. #define TARGET_HAS_STRUCT_STAT64
  1320. struct target_stat64 {
  1321. unsigned long long st_dev;
  1322. unsigned char __pad1[2];
  1323. #define TARGET_STAT64_HAS_BROKEN_ST_INO 1
  1324. abi_ulong __st_ino;
  1325. unsigned int st_mode;
  1326. unsigned int st_nlink;
  1327. abi_ulong st_uid;
  1328. abi_ulong st_gid;
  1329. unsigned long long st_rdev;
  1330. unsigned char __pad3[2];
  1331. long long st_size;
  1332. abi_ulong st_blksize;
  1333. abi_ulong __pad4; /* future possible st_blocks high bits */
  1334. abi_ulong st_blocks; /* Number 512-byte blocks allocated. */
  1335. abi_ulong target_st_atime;
  1336. abi_ulong target_st_atime_nsec;
  1337. abi_ulong target_st_mtime;
  1338. abi_ulong target_st_mtime_nsec;
  1339. abi_ulong target_st_ctime;
  1340. abi_ulong target_st_ctime_nsec;
  1341. unsigned long long st_ino;
  1342. } QEMU_PACKED;
  1343. #elif defined(TARGET_ABI_MIPSN64)
  1344. /* The memory layout is the same as of struct stat64 of the 32-bit kernel. */
  1345. struct target_stat {
  1346. unsigned int st_dev;
  1347. unsigned int st_pad0[3]; /* Reserved for st_dev expansion */
  1348. abi_ulong st_ino;
  1349. unsigned int st_mode;
  1350. unsigned int st_nlink;
  1351. int st_uid;
  1352. int st_gid;
  1353. unsigned int st_rdev;
  1354. unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */
  1355. abi_ulong st_size;
  1356. /*
  1357. * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
  1358. * but we don't have it under Linux.
  1359. */
  1360. unsigned int target_st_atime;
  1361. unsigned int target_st_atime_nsec;
  1362. unsigned int target_st_mtime;
  1363. unsigned int target_st_mtime_nsec;
  1364. unsigned int target_st_ctime;
  1365. unsigned int target_st_ctime_nsec;
  1366. unsigned int st_blksize;
  1367. unsigned int st_pad2;
  1368. abi_ulong st_blocks;
  1369. };
  1370. #elif defined(TARGET_ABI_MIPSN32)
  1371. struct target_stat {
  1372. unsigned st_dev;
  1373. int st_pad1[3]; /* Reserved for network id */
  1374. unsigned int st_ino;
  1375. unsigned int st_mode;
  1376. unsigned int st_nlink;
  1377. int st_uid;
  1378. int st_gid;
  1379. unsigned st_rdev;
  1380. unsigned int st_pad2[2];
  1381. unsigned int st_size;
  1382. unsigned int st_pad3;
  1383. /*
  1384. * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
  1385. * but we don't have it under Linux.
  1386. */
  1387. unsigned int target_st_atime;
  1388. unsigned int target_st_atime_nsec;
  1389. unsigned int target_st_mtime;
  1390. unsigned int target_st_mtime_nsec;
  1391. unsigned int target_st_ctime;
  1392. unsigned int target_st_ctime_nsec;
  1393. unsigned int st_blksize;
  1394. unsigned int st_blocks;
  1395. unsigned int st_pad4[14];
  1396. };
  1397. /*
  1398. * This matches struct stat64 in glibc2.1, hence the absolutely insane
  1399. * amounts of padding around dev_t's. The memory layout is the same as of
  1400. * struct stat of the 64-bit kernel.
  1401. */
  1402. #define TARGET_HAS_STRUCT_STAT64
  1403. struct target_stat64 {
  1404. unsigned int st_dev;
  1405. unsigned int st_pad0[3]; /* Reserved for st_dev expansion */
  1406. target_ulong st_ino;
  1407. unsigned int st_mode;
  1408. unsigned int st_nlink;
  1409. int st_uid;
  1410. int st_gid;
  1411. unsigned int st_rdev;
  1412. unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */
  1413. int st_size;
  1414. /*
  1415. * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
  1416. * but we don't have it under Linux.
  1417. */
  1418. int target_st_atime;
  1419. unsigned int target_st_atime_nsec; /* Reserved for st_atime expansion */
  1420. int target_st_mtime;
  1421. unsigned int target_st_mtime_nsec; /* Reserved for st_mtime expansion */
  1422. int target_st_ctime;
  1423. unsigned int target_st_ctime_nsec; /* Reserved for st_ctime expansion */
  1424. unsigned int st_blksize;
  1425. unsigned int st_pad2;
  1426. int st_blocks;
  1427. };
  1428. #elif defined(TARGET_ABI_MIPSO32)
  1429. struct target_stat {
  1430. unsigned st_dev;
  1431. abi_long st_pad1[3]; /* Reserved for network id */
  1432. abi_ulong st_ino;
  1433. unsigned int st_mode;
  1434. unsigned int st_nlink;
  1435. int st_uid;
  1436. int st_gid;
  1437. unsigned st_rdev;
  1438. abi_long st_pad2[2];
  1439. abi_long st_size;
  1440. abi_long st_pad3;
  1441. /*
  1442. * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
  1443. * but we don't have it under Linux.
  1444. */
  1445. abi_long target_st_atime;
  1446. abi_long target_st_atime_nsec;
  1447. abi_long target_st_mtime;
  1448. abi_long target_st_mtime_nsec;
  1449. abi_long target_st_ctime;
  1450. abi_long target_st_ctime_nsec;
  1451. abi_long st_blksize;
  1452. abi_long st_blocks;
  1453. abi_long st_pad4[14];
  1454. };
  1455. /*
  1456. * This matches struct stat64 in glibc2.1, hence the absolutely insane
  1457. * amounts of padding around dev_t's. The memory layout is the same as of
  1458. * struct stat of the 64-bit kernel.
  1459. */
  1460. #define TARGET_HAS_STRUCT_STAT64
  1461. struct target_stat64 {
  1462. abi_ulong st_dev;
  1463. abi_ulong st_pad0[3]; /* Reserved for st_dev expansion */
  1464. uint64_t st_ino;
  1465. unsigned int st_mode;
  1466. unsigned int st_nlink;
  1467. int st_uid;
  1468. int st_gid;
  1469. abi_ulong st_rdev;
  1470. abi_ulong st_pad1[3]; /* Reserved for st_rdev expansion */
  1471. int64_t st_size;
  1472. /*
  1473. * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
  1474. * but we don't have it under Linux.
  1475. */
  1476. abi_long target_st_atime;
  1477. abi_ulong target_st_atime_nsec; /* Reserved for st_atime expansion */
  1478. abi_long target_st_mtime;
  1479. abi_ulong target_st_mtime_nsec; /* Reserved for st_mtime expansion */
  1480. abi_long target_st_ctime;
  1481. abi_ulong target_st_ctime_nsec; /* Reserved for st_ctime expansion */
  1482. abi_ulong st_blksize;
  1483. abi_ulong st_pad2;
  1484. int64_t st_blocks;
  1485. };
  1486. #elif defined(TARGET_ALPHA)
  1487. struct target_stat {
  1488. unsigned int st_dev;
  1489. unsigned int st_ino;
  1490. unsigned int st_mode;
  1491. unsigned int st_nlink;
  1492. unsigned int st_uid;
  1493. unsigned int st_gid;
  1494. unsigned int st_rdev;
  1495. abi_long st_size;
  1496. abi_ulong target_st_atime;
  1497. abi_ulong target_st_mtime;
  1498. abi_ulong target_st_ctime;
  1499. unsigned int st_blksize;
  1500. unsigned int st_blocks;
  1501. unsigned int st_flags;
  1502. unsigned int st_gen;
  1503. };
  1504. #define TARGET_HAS_STRUCT_STAT64
  1505. struct target_stat64 {
  1506. abi_ulong st_dev;
  1507. abi_ulong st_ino;
  1508. abi_ulong st_rdev;
  1509. abi_long st_size;
  1510. abi_ulong st_blocks;
  1511. unsigned int st_mode;
  1512. unsigned int st_uid;
  1513. unsigned int st_gid;
  1514. unsigned int st_blksize;
  1515. unsigned int st_nlink;
  1516. unsigned int __pad0;
  1517. abi_ulong target_st_atime;
  1518. abi_ulong target_st_atime_nsec;
  1519. abi_ulong target_st_mtime;
  1520. abi_ulong target_st_mtime_nsec;
  1521. abi_ulong target_st_ctime;
  1522. abi_ulong target_st_ctime_nsec;
  1523. abi_long __unused[3];
  1524. };
  1525. #elif defined(TARGET_SH4)
  1526. struct target_stat {
  1527. abi_ulong st_dev;
  1528. abi_ulong st_ino;
  1529. unsigned short st_mode;
  1530. unsigned short st_nlink;
  1531. unsigned short st_uid;
  1532. unsigned short st_gid;
  1533. abi_ulong st_rdev;
  1534. abi_ulong st_size;
  1535. abi_ulong st_blksize;
  1536. abi_ulong st_blocks;
  1537. abi_ulong target_st_atime;
  1538. abi_ulong target_st_atime_nsec;
  1539. abi_ulong target_st_mtime;
  1540. abi_ulong target_st_mtime_nsec;
  1541. abi_ulong target_st_ctime;
  1542. abi_ulong target_st_ctime_nsec;
  1543. abi_ulong __unused4;
  1544. abi_ulong __unused5;
  1545. };
  1546. /* This matches struct stat64 in glibc2.1, hence the absolutely
  1547. * insane amounts of padding around dev_t's.
  1548. */
  1549. #define TARGET_HAS_STRUCT_STAT64
  1550. struct QEMU_PACKED target_stat64 {
  1551. unsigned long long st_dev;
  1552. unsigned char __pad0[4];
  1553. #define TARGET_STAT64_HAS_BROKEN_ST_INO 1
  1554. abi_ulong __st_ino;
  1555. unsigned int st_mode;
  1556. unsigned int st_nlink;
  1557. abi_ulong st_uid;
  1558. abi_ulong st_gid;
  1559. unsigned long long st_rdev;
  1560. unsigned char __pad3[4];
  1561. long long st_size;
  1562. abi_ulong st_blksize;
  1563. unsigned long long st_blocks; /* Number 512-byte blocks allocated. */
  1564. abi_ulong target_st_atime;
  1565. abi_ulong target_st_atime_nsec;
  1566. abi_ulong target_st_mtime;
  1567. abi_ulong target_st_mtime_nsec;
  1568. abi_ulong target_st_ctime;
  1569. abi_ulong target_st_ctime_nsec;
  1570. unsigned long long st_ino;
  1571. };
  1572. #elif defined(TARGET_I386) && !defined(TARGET_ABI32)
  1573. struct target_stat {
  1574. abi_ulong st_dev;
  1575. abi_ulong st_ino;
  1576. abi_ulong st_nlink;
  1577. unsigned int st_mode;
  1578. unsigned int st_uid;
  1579. unsigned int st_gid;
  1580. unsigned int __pad0;
  1581. abi_ulong st_rdev;
  1582. abi_long st_size;
  1583. abi_long st_blksize;
  1584. abi_long st_blocks; /* Number 512-byte blocks allocated. */
  1585. abi_ulong target_st_atime;
  1586. abi_ulong target_st_atime_nsec;
  1587. abi_ulong target_st_mtime;
  1588. abi_ulong target_st_mtime_nsec;
  1589. abi_ulong target_st_ctime;
  1590. abi_ulong target_st_ctime_nsec;
  1591. abi_long __unused[3];
  1592. };
  1593. #elif defined(TARGET_S390X)
  1594. struct target_stat {
  1595. abi_ulong st_dev;
  1596. abi_ulong st_ino;
  1597. abi_ulong st_nlink;
  1598. unsigned int st_mode;
  1599. unsigned int st_uid;
  1600. unsigned int st_gid;
  1601. unsigned int __pad1;
  1602. abi_ulong st_rdev;
  1603. abi_ulong st_size;
  1604. abi_ulong target_st_atime;
  1605. abi_ulong target_st_atime_nsec;
  1606. abi_ulong target_st_mtime;
  1607. abi_ulong target_st_mtime_nsec;
  1608. abi_ulong target_st_ctime;
  1609. abi_ulong target_st_ctime_nsec;
  1610. abi_ulong st_blksize;
  1611. abi_long st_blocks;
  1612. abi_ulong __unused[3];
  1613. };
  1614. #elif defined(TARGET_AARCH64)
  1615. struct target_stat {
  1616. abi_ulong st_dev;
  1617. abi_ulong st_ino;
  1618. unsigned int st_mode;
  1619. unsigned int st_nlink;
  1620. unsigned int st_uid;
  1621. unsigned int st_gid;
  1622. abi_ulong st_rdev;
  1623. abi_ulong _pad1;
  1624. abi_long st_size;
  1625. int st_blksize;
  1626. int __pad2;
  1627. abi_long st_blocks;
  1628. abi_long target_st_atime;
  1629. abi_ulong target_st_atime_nsec;
  1630. abi_long target_st_mtime;
  1631. abi_ulong target_st_mtime_nsec;
  1632. abi_long target_st_ctime;
  1633. abi_ulong target_st_ctime_nsec;
  1634. unsigned int __unused[2];
  1635. };
  1636. #elif defined(TARGET_OPENRISC)
  1637. /* These are the asm-generic versions of the stat and stat64 structures */
  1638. struct target_stat {
  1639. abi_ulong st_dev;
  1640. abi_ulong st_ino;
  1641. unsigned int st_mode;
  1642. unsigned int st_nlink;
  1643. unsigned int st_uid;
  1644. unsigned int st_gid;
  1645. abi_ulong st_rdev;
  1646. abi_ulong __pad1;
  1647. abi_long st_size;
  1648. int st_blksize;
  1649. int __pad2;
  1650. abi_long st_blocks;
  1651. abi_long target_st_atime;
  1652. abi_ulong target_st_atime_nsec;
  1653. abi_long target_st_mtime;
  1654. abi_ulong target_st_mtime_nsec;
  1655. abi_long target_st_ctime;
  1656. abi_ulong target_st_ctime_nsec;
  1657. unsigned int __unused4;
  1658. unsigned int __unused5;
  1659. };
  1660. #define TARGET_HAS_STRUCT_STAT64
  1661. struct target_stat64 {
  1662. uint64_t st_dev;
  1663. uint64_t st_ino;
  1664. unsigned int st_mode;
  1665. unsigned int st_nlink;
  1666. unsigned int st_uid;
  1667. unsigned int st_gid;
  1668. uint64_t st_rdev;
  1669. uint64_t __pad1;
  1670. int64_t st_size;
  1671. int st_blksize;
  1672. int __pad2;
  1673. int64_t st_blocks;
  1674. int target_st_atime;
  1675. unsigned int target_st_atime_nsec;
  1676. int target_st_mtime;
  1677. unsigned int target_st_mtime_nsec;
  1678. int target_st_ctime;
  1679. unsigned int target_st_ctime_nsec;
  1680. unsigned int __unused4;
  1681. unsigned int __unused5;
  1682. };
  1683. #else
  1684. #error unsupported CPU
  1685. #endif
  1686. typedef struct {
  1687. int val[2];
  1688. } target_fsid_t;
  1689. #ifdef TARGET_MIPS
  1690. #ifdef TARGET_ABI_MIPSN32
  1691. struct target_statfs {
  1692. int32_t f_type;
  1693. int32_t f_bsize;
  1694. int32_t f_frsize; /* Fragment size - unsupported */
  1695. int32_t f_blocks;
  1696. int32_t f_bfree;
  1697. int32_t f_files;
  1698. int32_t f_ffree;
  1699. int32_t f_bavail;
  1700. /* Linux specials */
  1701. target_fsid_t f_fsid;
  1702. int32_t f_namelen;
  1703. int32_t f_spare[6];
  1704. };
  1705. #else
  1706. struct target_statfs {
  1707. abi_long f_type;
  1708. abi_long f_bsize;
  1709. abi_long f_frsize; /* Fragment size - unsupported */
  1710. abi_long f_blocks;
  1711. abi_long f_bfree;
  1712. abi_long f_files;
  1713. abi_long f_ffree;
  1714. abi_long f_bavail;
  1715. /* Linux specials */
  1716. target_fsid_t f_fsid;
  1717. abi_long f_namelen;
  1718. abi_long f_spare[6];
  1719. };
  1720. #endif
  1721. struct target_statfs64 {
  1722. uint32_t f_type;
  1723. uint32_t f_bsize;
  1724. uint32_t f_frsize; /* Fragment size - unsupported */
  1725. uint32_t __pad;
  1726. uint64_t f_blocks;
  1727. uint64_t f_bfree;
  1728. uint64_t f_files;
  1729. uint64_t f_ffree;
  1730. uint64_t f_bavail;
  1731. target_fsid_t f_fsid;
  1732. uint32_t f_namelen;
  1733. uint32_t f_spare[6];
  1734. };
  1735. #elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \
  1736. defined(TARGET_SPARC64) || defined(TARGET_AARCH64)) && \
  1737. !defined(TARGET_ABI32)
  1738. struct target_statfs {
  1739. abi_long f_type;
  1740. abi_long f_bsize;
  1741. abi_long f_blocks;
  1742. abi_long f_bfree;
  1743. abi_long f_bavail;
  1744. abi_long f_files;
  1745. abi_long f_ffree;
  1746. target_fsid_t f_fsid;
  1747. abi_long f_namelen;
  1748. abi_long f_frsize;
  1749. abi_long f_spare[5];
  1750. };
  1751. struct target_statfs64 {
  1752. abi_long f_type;
  1753. abi_long f_bsize;
  1754. abi_long f_blocks;
  1755. abi_long f_bfree;
  1756. abi_long f_bavail;
  1757. abi_long f_files;
  1758. abi_long f_ffree;
  1759. target_fsid_t f_fsid;
  1760. abi_long f_namelen;
  1761. abi_long f_frsize;
  1762. abi_long f_spare[5];
  1763. };
  1764. #elif defined(TARGET_S390X)
  1765. struct target_statfs {
  1766. int32_t f_type;
  1767. int32_t f_bsize;
  1768. abi_long f_blocks;
  1769. abi_long f_bfree;
  1770. abi_long f_bavail;
  1771. abi_long f_files;
  1772. abi_long f_ffree;
  1773. kernel_fsid_t f_fsid;
  1774. int32_t f_namelen;
  1775. int32_t f_frsize;
  1776. int32_t f_spare[5];
  1777. };
  1778. struct target_statfs64 {
  1779. int32_t f_type;
  1780. int32_t f_bsize;
  1781. abi_long f_blocks;
  1782. abi_long f_bfree;
  1783. abi_long f_bavail;
  1784. abi_long f_files;
  1785. abi_long f_ffree;
  1786. kernel_fsid_t f_fsid;
  1787. int32_t f_namelen;
  1788. int32_t f_frsize;
  1789. int32_t f_spare[5];
  1790. };
  1791. #else
  1792. struct target_statfs {
  1793. uint32_t f_type;
  1794. uint32_t f_bsize;
  1795. uint32_t f_blocks;
  1796. uint32_t f_bfree;
  1797. uint32_t f_bavail;
  1798. uint32_t f_files;
  1799. uint32_t f_ffree;
  1800. target_fsid_t f_fsid;
  1801. uint32_t f_namelen;
  1802. uint32_t f_frsize;
  1803. uint32_t f_spare[5];
  1804. };
  1805. struct target_statfs64 {
  1806. uint32_t f_type;
  1807. uint32_t f_bsize;
  1808. uint64_t f_blocks;
  1809. uint64_t f_bfree;
  1810. uint64_t f_bavail;
  1811. uint64_t f_files;
  1812. uint64_t f_ffree;
  1813. target_fsid_t f_fsid;
  1814. uint32_t f_namelen;
  1815. uint32_t f_frsize;
  1816. uint32_t f_spare[5];
  1817. };
  1818. #endif
  1819. #define TARGET_F_DUPFD 0 /* dup */
  1820. #define TARGET_F_GETFD 1 /* get close_on_exec */
  1821. #define TARGET_F_SETFD 2 /* set/clear close_on_exec */
  1822. #define TARGET_F_GETFL 3 /* get file->f_flags */
  1823. #define TARGET_F_SETFL 4 /* set file->f_flags */
  1824. #if defined(TARGET_ALPHA)
  1825. #define TARGET_F_GETLK 7
  1826. #define TARGET_F_SETLK 8
  1827. #define TARGET_F_SETLKW 9
  1828. #define TARGET_F_SETOWN 5 /* for sockets. */
  1829. #define TARGET_F_GETOWN 6 /* for sockets. */
  1830. #define TARGET_F_RDLCK 1
  1831. #define TARGET_F_WRLCK 2
  1832. #define TARGET_F_UNLCK 8
  1833. #define TARGET_F_EXLCK 16
  1834. #define TARGET_F_SHLCK 32
  1835. #elif defined(TARGET_MIPS)
  1836. #define TARGET_F_GETLK 14
  1837. #define TARGET_F_SETLK 6
  1838. #define TARGET_F_SETLKW 7
  1839. #define TARGET_F_SETOWN 24 /* for sockets. */
  1840. #define TARGET_F_GETOWN 25 /* for sockets. */
  1841. #else
  1842. #define TARGET_F_GETLK 5
  1843. #define TARGET_F_SETLK 6
  1844. #define TARGET_F_SETLKW 7
  1845. #define TARGET_F_SETOWN 8 /* for sockets. */
  1846. #define TARGET_F_GETOWN 9 /* for sockets. */
  1847. #endif
  1848. #define TARGET_F_SETOWN_EX 15
  1849. #define TARGET_F_GETOWN_EX 16
  1850. #ifndef TARGET_F_RDLCK
  1851. #define TARGET_F_RDLCK 0
  1852. #define TARGET_F_WRLCK 1
  1853. #define TARGET_F_UNLCK 2
  1854. #endif
  1855. #ifndef TARGET_F_EXLCK
  1856. #define TARGET_F_EXLCK 4
  1857. #define TARGET_F_SHLCK 8
  1858. #endif
  1859. #define TARGET_F_SETSIG 10 /* for sockets. */
  1860. #define TARGET_F_GETSIG 11 /* for sockets. */
  1861. #if defined(TARGET_MIPS)
  1862. #define TARGET_F_GETLK64 33 /* using 'struct flock64' */
  1863. #define TARGET_F_SETLK64 34
  1864. #define TARGET_F_SETLKW64 35
  1865. #else
  1866. #define TARGET_F_GETLK64 12 /* using 'struct flock64' */
  1867. #define TARGET_F_SETLK64 13
  1868. #define TARGET_F_SETLKW64 14
  1869. #endif
  1870. #define TARGET_F_LINUX_SPECIFIC_BASE 1024
  1871. #define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0)
  1872. #define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1)
  1873. #define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6)
  1874. #define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2)
  1875. #if defined(TARGET_ALPHA)
  1876. #define TARGET_O_NONBLOCK 04
  1877. #define TARGET_O_APPEND 010
  1878. #define TARGET_O_CREAT 01000 /* not fcntl */
  1879. #define TARGET_O_TRUNC 02000 /* not fcntl */
  1880. #define TARGET_O_EXCL 04000 /* not fcntl */
  1881. #define TARGET_O_NOCTTY 010000 /* not fcntl */
  1882. #define TARGET_O_DSYNC 040000
  1883. #define TARGET_O_LARGEFILE 0 /* not necessary, always 64-bit */
  1884. #define TARGET_O_DIRECTORY 0100000 /* must be a directory */
  1885. #define TARGET_O_NOFOLLOW 0200000 /* don't follow links */
  1886. #define TARGET_O_DIRECT 02000000 /* direct disk access hint */
  1887. #define TARGET_O_NOATIME 04000000
  1888. #define TARGET_O_CLOEXEC 010000000
  1889. #define TARGET___O_SYNC 020000000
  1890. #define TARGET_O_PATH 040000000
  1891. #elif defined(TARGET_ARM) || defined(TARGET_M68K)
  1892. #define TARGET_O_DIRECTORY 040000 /* must be a directory */
  1893. #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
  1894. #define TARGET_O_DIRECT 0200000 /* direct disk access hint */
  1895. #define TARGET_O_LARGEFILE 0400000
  1896. #elif defined(TARGET_MIPS)
  1897. #define TARGET_O_APPEND 0x0008
  1898. #define TARGET_O_DSYNC 0x0010
  1899. #define TARGET_O_NONBLOCK 0x0080
  1900. #define TARGET_O_CREAT 0x0100 /* not fcntl */
  1901. #define TARGET_O_TRUNC 0x0200 /* not fcntl */
  1902. #define TARGET_O_EXCL 0x0400 /* not fcntl */
  1903. #define TARGET_O_NOCTTY 0x0800 /* not fcntl */
  1904. #define TARGET_FASYNC 0x1000 /* fcntl, for BSD compatibility */
  1905. #define TARGET_O_LARGEFILE 0x2000 /* allow large file opens */
  1906. #define TARGET___O_SYNC 0x4000
  1907. #define TARGET_O_DIRECT 0x8000 /* direct disk access hint */
  1908. #elif defined (TARGET_PPC)
  1909. #define TARGET_O_DIRECTORY 040000 /* must be a directory */
  1910. #define TARGET_O_NOFOLLOW 0100000 /* don't follow links */
  1911. #define TARGET_O_LARGEFILE 0200000
  1912. #define TARGET_O_DIRECT 0400000 /* direct disk access hint */
  1913. #elif defined (TARGET_SPARC)
  1914. #define TARGET_O_APPEND 0x0008
  1915. #define TARGET_FASYNC 0x0040 /* fcntl, for BSD compatibility */
  1916. #define TARGET_O_CREAT 0x0200 /* not fcntl */
  1917. #define TARGET_O_TRUNC 0x0400 /* not fcntl */
  1918. #define TARGET_O_EXCL 0x0800 /* not fcntl */
  1919. #define TARGET_O_DSYNC 0x2000
  1920. #define TARGET_O_NONBLOCK 0x4000
  1921. # ifdef TARGET_SPARC64
  1922. # define TARGET_O_NDELAY 0x0004
  1923. # else
  1924. # define TARGET_O_NDELAY (0x0004 | TARGET_O_NONBLOCK)
  1925. # endif
  1926. #define TARGET_O_NOCTTY 0x8000 /* not fcntl */
  1927. #define TARGET_O_LARGEFILE 0x40000
  1928. #define TARGET_O_DIRECT 0x100000 /* direct disk access hint */
  1929. #define TARGET_O_NOATIME 0x200000
  1930. #define TARGET_O_CLOEXEC 0x400000
  1931. #define TARGET___O_SYNC 0x800000
  1932. #define TARGET_O_PATH 0x1000000
  1933. #endif
  1934. /* <asm-generic/fcntl.h> values follow. */
  1935. #define TARGET_O_ACCMODE 0003
  1936. #define TARGET_O_RDONLY 00
  1937. #define TARGET_O_WRONLY 01
  1938. #define TARGET_O_RDWR 02
  1939. #ifndef TARGET_O_CREAT
  1940. #define TARGET_O_CREAT 0100 /* not fcntl */
  1941. #endif
  1942. #ifndef TARGET_O_EXCL
  1943. #define TARGET_O_EXCL 0200 /* not fcntl */
  1944. #endif
  1945. #ifndef TARGET_O_NOCTTY
  1946. #define TARGET_O_NOCTTY 0400 /* not fcntl */
  1947. #endif
  1948. #ifndef TARGET_O_TRUNC
  1949. #define TARGET_O_TRUNC 01000 /* not fcntl */
  1950. #endif
  1951. #ifndef TARGET_O_APPEND
  1952. #define TARGET_O_APPEND 02000
  1953. #endif
  1954. #ifndef TARGET_O_NONBLOCK
  1955. #define TARGET_O_NONBLOCK 04000
  1956. #endif
  1957. #ifndef TARGET_O_DSYNC
  1958. #define TARGET_O_DSYNC 010000
  1959. #endif
  1960. #ifndef TARGET_FASYNC
  1961. #define TARGET_FASYNC 020000 /* fcntl, for BSD compatibility */
  1962. #endif
  1963. #ifndef TARGET_O_DIRECT
  1964. #define TARGET_O_DIRECT 040000 /* direct disk access hint */
  1965. #endif
  1966. #ifndef TARGET_O_LARGEFILE
  1967. #define TARGET_O_LARGEFILE 0100000
  1968. #endif
  1969. #ifndef TARGET_O_DIRECTORY
  1970. #define TARGET_O_DIRECTORY 0200000 /* must be a directory */
  1971. #endif
  1972. #ifndef TARGET_O_NOFOLLOW
  1973. #define TARGET_O_NOFOLLOW 0400000 /* don't follow links */
  1974. #endif
  1975. #ifndef TARGET_O_NOATIME
  1976. #define TARGET_O_NOATIME 01000000
  1977. #endif
  1978. #ifndef TARGET_O_CLOEXEC
  1979. #define TARGET_O_CLOEXEC 02000000
  1980. #endif
  1981. #ifndef TARGET___O_SYNC
  1982. #define TARGET___O_SYNC 04000000
  1983. #endif
  1984. #ifndef TARGET_O_PATH
  1985. #define TARGET_O_PATH 010000000
  1986. #endif
  1987. #ifndef TARGET_O_NDELAY
  1988. #define TARGET_O_NDELAY TARGET_O_NONBLOCK
  1989. #endif
  1990. #ifndef TARGET_O_SYNC
  1991. #define TARGET_O_SYNC (TARGET___O_SYNC | TARGET_O_DSYNC)
  1992. #endif
  1993. struct target_flock {
  1994. short l_type;
  1995. short l_whence;
  1996. abi_ulong l_start;
  1997. abi_ulong l_len;
  1998. int l_pid;
  1999. };
  2000. struct target_flock64 {
  2001. short l_type;
  2002. short l_whence;
  2003. #if defined(TARGET_PPC) || defined(TARGET_X86_64) || defined(TARGET_MIPS) || defined(TARGET_SPARC) || defined(TARGET_HPPA) || defined (TARGET_MICROBLAZE)
  2004. int __pad;
  2005. #endif
  2006. unsigned long long l_start;
  2007. unsigned long long l_len;
  2008. int l_pid;
  2009. } QEMU_PACKED;
  2010. #ifdef TARGET_ARM
  2011. struct target_eabi_flock64 {
  2012. short l_type;
  2013. short l_whence;
  2014. int __pad;
  2015. unsigned long long l_start;
  2016. unsigned long long l_len;
  2017. int l_pid;
  2018. } QEMU_PACKED;
  2019. #endif
  2020. struct target_f_owner_ex {
  2021. int type; /* Owner type of ID. */
  2022. int pid; /* ID of owner. */
  2023. };
  2024. /* soundcard defines */
  2025. /* XXX: convert them all to arch indepedent entries */
  2026. #define TARGET_SNDCTL_COPR_HALT TARGET_IOWR('C', 7, int);
  2027. #define TARGET_SNDCTL_COPR_LOAD 0xcfb04301
  2028. #define TARGET_SNDCTL_COPR_RCODE 0xc0144303
  2029. #define TARGET_SNDCTL_COPR_RCVMSG 0x8fa44309
  2030. #define TARGET_SNDCTL_COPR_RDATA 0xc0144302
  2031. #define TARGET_SNDCTL_COPR_RESET 0x00004300
  2032. #define TARGET_SNDCTL_COPR_RUN 0xc0144306
  2033. #define TARGET_SNDCTL_COPR_SENDMSG 0xcfa44308
  2034. #define TARGET_SNDCTL_COPR_WCODE 0x40144305
  2035. #define TARGET_SNDCTL_COPR_WDATA 0x40144304
  2036. #define TARGET_SNDCTL_DSP_RESET TARGET_IO('P', 0)
  2037. #define TARGET_SNDCTL_DSP_SYNC TARGET_IO('P', 1)
  2038. #define TARGET_SNDCTL_DSP_SPEED TARGET_IOWR('P', 2, int)
  2039. #define TARGET_SNDCTL_DSP_STEREO TARGET_IOWR('P', 3, int)
  2040. #define TARGET_SNDCTL_DSP_GETBLKSIZE TARGET_IOWR('P', 4, int)
  2041. #define TARGET_SNDCTL_DSP_SETFMT TARGET_IOWR('P', 5, int)
  2042. #define TARGET_SNDCTL_DSP_CHANNELS TARGET_IOWR('P', 6, int)
  2043. #define TARGET_SOUND_PCM_WRITE_FILTER TARGET_IOWR('P', 7, int)
  2044. #define TARGET_SNDCTL_DSP_POST TARGET_IO('P', 8)
  2045. #define TARGET_SNDCTL_DSP_SUBDIVIDE TARGET_IOWR('P', 9, int)
  2046. #define TARGET_SNDCTL_DSP_SETFRAGMENT TARGET_IOWR('P',10, int)
  2047. #define TARGET_SNDCTL_DSP_GETFMTS TARGET_IOR('P', 11, int)
  2048. #define TARGET_SNDCTL_DSP_GETOSPACE TARGET_IORU('P',12)
  2049. #define TARGET_SNDCTL_DSP_GETISPACE TARGET_IORU('P',13)
  2050. #define TARGET_SNDCTL_DSP_GETCAPS TARGET_IOR('P', 15, int)
  2051. #define TARGET_SNDCTL_DSP_GETTRIGGER TARGET_IOR('P',16, int)
  2052. #define TARGET_SNDCTL_DSP_GETIPTR TARGET_IORU('P',17)
  2053. #define TARGET_SNDCTL_DSP_GETOPTR TARGET_IORU('P',18)
  2054. #define TARGET_SNDCTL_DSP_MAPINBUF TARGET_IORU('P', 19)
  2055. #define TARGET_SNDCTL_DSP_MAPOUTBUF TARGET_IORU('P', 20)
  2056. #define TARGET_SNDCTL_DSP_NONBLOCK 0x0000500e
  2057. #define TARGET_SNDCTL_DSP_SAMPLESIZE 0xc0045005
  2058. #define TARGET_SNDCTL_DSP_SETDUPLEX 0x00005016
  2059. #define TARGET_SNDCTL_DSP_SETSYNCRO 0x00005015
  2060. #define TARGET_SNDCTL_DSP_SETTRIGGER 0x40045010
  2061. #define TARGET_SNDCTL_FM_4OP_ENABLE 0x4004510f
  2062. #define TARGET_SNDCTL_FM_LOAD_INSTR 0x40285107
  2063. #define TARGET_SNDCTL_MIDI_INFO 0xc074510c
  2064. #define TARGET_SNDCTL_MIDI_MPUCMD 0xc0216d02
  2065. #define TARGET_SNDCTL_MIDI_MPUMODE 0xc0046d01
  2066. #define TARGET_SNDCTL_MIDI_PRETIME 0xc0046d00
  2067. #define TARGET_SNDCTL_PMGR_ACCESS 0xcfb85110
  2068. #define TARGET_SNDCTL_PMGR_IFACE 0xcfb85001
  2069. #define TARGET_SNDCTL_SEQ_CTRLRATE 0xc0045103
  2070. #define TARGET_SNDCTL_SEQ_GETINCOUNT 0x80045105
  2071. #define TARGET_SNDCTL_SEQ_GETOUTCOUNT 0x80045104
  2072. #define TARGET_SNDCTL_SEQ_NRMIDIS 0x8004510b
  2073. #define TARGET_SNDCTL_SEQ_NRSYNTHS 0x8004510a
  2074. #define TARGET_SNDCTL_SEQ_OUTOFBAND 0x40085112
  2075. #define TARGET_SNDCTL_SEQ_PANIC 0x00005111
  2076. #define TARGET_SNDCTL_SEQ_PERCMODE 0x40045106
  2077. #define TARGET_SNDCTL_SEQ_RESET 0x00005100
  2078. #define TARGET_SNDCTL_SEQ_RESETSAMPLES 0x40045109
  2079. #define TARGET_SNDCTL_SEQ_SYNC 0x00005101
  2080. #define TARGET_SNDCTL_SEQ_TESTMIDI 0x40045108
  2081. #define TARGET_SNDCTL_SEQ_THRESHOLD 0x4004510d
  2082. #define TARGET_SNDCTL_SEQ_TRESHOLD 0x4004510d
  2083. #define TARGET_SNDCTL_SYNTH_INFO 0xc08c5102
  2084. #define TARGET_SNDCTL_SYNTH_MEMAVL 0xc004510e
  2085. #define TARGET_SNDCTL_TMR_CONTINUE 0x00005404
  2086. #define TARGET_SNDCTL_TMR_METRONOME 0x40045407
  2087. #define TARGET_SNDCTL_TMR_SELECT 0x40045408
  2088. #define TARGET_SNDCTL_TMR_SOURCE 0xc0045406
  2089. #define TARGET_SNDCTL_TMR_START 0x00005402
  2090. #define TARGET_SNDCTL_TMR_STOP 0x00005403
  2091. #define TARGET_SNDCTL_TMR_TEMPO 0xc0045405
  2092. #define TARGET_SNDCTL_TMR_TIMEBASE 0xc0045401
  2093. #define TARGET_SOUND_PCM_READ_RATE 0x80045002
  2094. #define TARGET_SOUND_PCM_READ_CHANNELS 0x80045006
  2095. #define TARGET_SOUND_PCM_READ_BITS 0x80045005
  2096. #define TARGET_SOUND_PCM_READ_FILTER 0x80045007
  2097. #define TARGET_SOUND_MIXER_INFO TARGET_IOR ('M', 101, mixer_info)
  2098. #define TARGET_SOUND_MIXER_ACCESS 0xc0804d66
  2099. #define TARGET_SOUND_MIXER_PRIVATE1 TARGET_IOWR('M', 111, int)
  2100. #define TARGET_SOUND_MIXER_PRIVATE2 TARGET_IOWR('M', 112, int)
  2101. #define TARGET_SOUND_MIXER_PRIVATE3 TARGET_IOWR('M', 113, int)
  2102. #define TARGET_SOUND_MIXER_PRIVATE4 TARGET_IOWR('M', 114, int)
  2103. #define TARGET_SOUND_MIXER_PRIVATE5 TARGET_IOWR('M', 115, int)
  2104. #define TARGET_MIXER_READ(dev) TARGET_IOR('M', dev, int)
  2105. #define TARGET_SOUND_MIXER_READ_VOLUME TARGET_MIXER_READ(SOUND_MIXER_VOLUME)
  2106. #define TARGET_SOUND_MIXER_READ_BASS TARGET_MIXER_READ(SOUND_MIXER_BASS)
  2107. #define TARGET_SOUND_MIXER_READ_TREBLE TARGET_MIXER_READ(SOUND_MIXER_TREBLE)
  2108. #define TARGET_SOUND_MIXER_READ_SYNTH TARGET_MIXER_READ(SOUND_MIXER_SYNTH)
  2109. #define TARGET_SOUND_MIXER_READ_PCM TARGET_MIXER_READ(SOUND_MIXER_PCM)
  2110. #define TARGET_SOUND_MIXER_READ_SPEAKER TARGET_MIXER_READ(SOUND_MIXER_SPEAKER)
  2111. #define TARGET_SOUND_MIXER_READ_LINE TARGET_MIXER_READ(SOUND_MIXER_LINE)
  2112. #define TARGET_SOUND_MIXER_READ_MIC TARGET_MIXER_READ(SOUND_MIXER_MIC)
  2113. #define TARGET_SOUND_MIXER_READ_CD TARGET_MIXER_READ(SOUND_MIXER_CD)
  2114. #define TARGET_SOUND_MIXER_READ_IMIX TARGET_MIXER_READ(SOUND_MIXER_IMIX)
  2115. #define TARGET_SOUND_MIXER_READ_ALTPCM TARGET_MIXER_READ(SOUND_MIXER_ALTPCM)
  2116. #define TARGET_SOUND_MIXER_READ_RECLEV TARGET_MIXER_READ(SOUND_MIXER_RECLEV)
  2117. #define TARGET_SOUND_MIXER_READ_IGAIN TARGET_MIXER_READ(SOUND_MIXER_IGAIN)
  2118. #define TARGET_SOUND_MIXER_READ_OGAIN TARGET_MIXER_READ(SOUND_MIXER_OGAIN)
  2119. #define TARGET_SOUND_MIXER_READ_LINE1 TARGET_MIXER_READ(SOUND_MIXER_LINE1)
  2120. #define TARGET_SOUND_MIXER_READ_LINE2 TARGET_MIXER_READ(SOUND_MIXER_LINE2)
  2121. #define TARGET_SOUND_MIXER_READ_LINE3 TARGET_MIXER_READ(SOUND_MIXER_LINE3)
  2122. /* Obsolete macros */
  2123. #define TARGET_SOUND_MIXER_READ_MUTE TARGET_MIXER_READ(SOUND_MIXER_MUTE)
  2124. #define TARGET_SOUND_MIXER_READ_ENHANCE TARGET_MIXER_READ(SOUND_MIXER_ENHANCE)
  2125. #define TARGET_SOUND_MIXER_READ_LOUD TARGET_MIXER_READ(SOUND_MIXER_LOUD)
  2126. #define TARGET_SOUND_MIXER_READ_RECSRC TARGET_MIXER_READ(SOUND_MIXER_RECSRC)
  2127. #define TARGET_SOUND_MIXER_READ_DEVMASK TARGET_MIXER_READ(SOUND_MIXER_DEVMASK)
  2128. #define TARGET_SOUND_MIXER_READ_RECMASK TARGET_MIXER_READ(SOUND_MIXER_RECMASK)
  2129. #define TARGET_SOUND_MIXER_READ_STEREODEVS TARGET_MIXER_READ(SOUND_MIXER_STEREODEVS)
  2130. #define TARGET_SOUND_MIXER_READ_CAPS TARGET_MIXER_READ(SOUND_MIXER_CAPS)
  2131. #define TARGET_MIXER_WRITE(dev) TARGET_IOWR('M', dev, int)
  2132. #define TARGET_SOUND_MIXER_WRITE_VOLUME TARGET_MIXER_WRITE(SOUND_MIXER_VOLUME)
  2133. #define TARGET_SOUND_MIXER_WRITE_BASS TARGET_MIXER_WRITE(SOUND_MIXER_BASS)
  2134. #define TARGET_SOUND_MIXER_WRITE_TREBLE TARGET_MIXER_WRITE(SOUND_MIXER_TREBLE)
  2135. #define TARGET_SOUND_MIXER_WRITE_SYNTH TARGET_MIXER_WRITE(SOUND_MIXER_SYNTH)
  2136. #define TARGET_SOUND_MIXER_WRITE_PCM TARGET_MIXER_WRITE(SOUND_MIXER_PCM)
  2137. #define TARGET_SOUND_MIXER_WRITE_SPEAKER TARGET_MIXER_WRITE(SOUND_MIXER_SPEAKER)
  2138. #define TARGET_SOUND_MIXER_WRITE_LINE TARGET_MIXER_WRITE(SOUND_MIXER_LINE)
  2139. #define TARGET_SOUND_MIXER_WRITE_MIC TARGET_MIXER_WRITE(SOUND_MIXER_MIC)
  2140. #define TARGET_SOUND_MIXER_WRITE_CD TARGET_MIXER_WRITE(SOUND_MIXER_CD)
  2141. #define TARGET_SOUND_MIXER_WRITE_IMIX TARGET_MIXER_WRITE(SOUND_MIXER_IMIX)
  2142. #define TARGET_SOUND_MIXER_WRITE_ALTPCM TARGET_MIXER_WRITE(SOUND_MIXER_ALTPCM)
  2143. #define TARGET_SOUND_MIXER_WRITE_RECLEV TARGET_MIXER_WRITE(SOUND_MIXER_RECLEV)
  2144. #define TARGET_SOUND_MIXER_WRITE_IGAIN TARGET_MIXER_WRITE(SOUND_MIXER_IGAIN)
  2145. #define TARGET_SOUND_MIXER_WRITE_OGAIN TARGET_MIXER_WRITE(SOUND_MIXER_OGAIN)
  2146. #define TARGET_SOUND_MIXER_WRITE_LINE1 TARGET_MIXER_WRITE(SOUND_MIXER_LINE1)
  2147. #define TARGET_SOUND_MIXER_WRITE_LINE2 TARGET_MIXER_WRITE(SOUND_MIXER_LINE2)
  2148. #define TARGET_SOUND_MIXER_WRITE_LINE3 TARGET_MIXER_WRITE(SOUND_MIXER_LINE3)
  2149. /* Obsolete macros */
  2150. #define TARGET_SOUND_MIXER_WRITE_MUTE TARGET_MIXER_WRITE(SOUND_MIXER_MUTE)
  2151. #define TARGET_SOUND_MIXER_WRITE_ENHANCE TARGET_MIXER_WRITE(SOUND_MIXER_ENHANCE)
  2152. #define TARGET_SOUND_MIXER_WRITE_LOUD TARGET_MIXER_WRITE(SOUND_MIXER_LOUD)
  2153. #define TARGET_SOUND_MIXER_WRITE_RECSRC TARGET_MIXER_WRITE(SOUND_MIXER_RECSRC)
  2154. /* vfat ioctls */
  2155. #define TARGET_VFAT_IOCTL_READDIR_BOTH TARGET_IORU('r', 1)
  2156. #define TARGET_VFAT_IOCTL_READDIR_SHORT TARGET_IORU('r', 2)
  2157. #define TARGET_MTIOCTOP TARGET_IOW('m', 1, struct mtop)
  2158. #define TARGET_MTIOCGET TARGET_IOR('m', 2, struct mtget)
  2159. #define TARGET_MTIOCPOS TARGET_IOR('m', 3, struct mtpos)
  2160. struct target_sysinfo {
  2161. abi_long uptime; /* Seconds since boot */
  2162. abi_ulong loads[3]; /* 1, 5, and 15 minute load averages */
  2163. abi_ulong totalram; /* Total usable main memory size */
  2164. abi_ulong freeram; /* Available memory size */
  2165. abi_ulong sharedram; /* Amount of shared memory */
  2166. abi_ulong bufferram; /* Memory used by buffers */
  2167. abi_ulong totalswap; /* Total swap space size */
  2168. abi_ulong freeswap; /* swap space still available */
  2169. unsigned short procs; /* Number of current processes */
  2170. unsigned short pad; /* explicit padding for m68k */
  2171. abi_ulong totalhigh; /* Total high memory size */
  2172. abi_ulong freehigh; /* Available high memory size */
  2173. unsigned int mem_unit; /* Memory unit size in bytes */
  2174. char _f[20-2*sizeof(abi_long)-sizeof(int)]; /* Padding: libc5 uses this.. */
  2175. };
  2176. struct linux_dirent {
  2177. long d_ino;
  2178. unsigned long d_off;
  2179. unsigned short d_reclen;
  2180. char d_name[256]; /* We must not include limits.h! */
  2181. };
  2182. struct linux_dirent64 {
  2183. uint64_t d_ino;
  2184. int64_t d_off;
  2185. unsigned short d_reclen;
  2186. unsigned char d_type;
  2187. char d_name[256];
  2188. };
  2189. struct target_mq_attr {
  2190. abi_long mq_flags;
  2191. abi_long mq_maxmsg;
  2192. abi_long mq_msgsize;
  2193. abi_long mq_curmsgs;
  2194. };
  2195. #include "socket.h"
  2196. #include "errno_defs.h"
  2197. #define FUTEX_WAIT 0
  2198. #define FUTEX_WAKE 1
  2199. #define FUTEX_FD 2
  2200. #define FUTEX_REQUEUE 3
  2201. #define FUTEX_CMP_REQUEUE 4
  2202. #define FUTEX_WAKE_OP 5
  2203. #define FUTEX_LOCK_PI 6
  2204. #define FUTEX_UNLOCK_PI 7
  2205. #define FUTEX_TRYLOCK_PI 8
  2206. #define FUTEX_WAIT_BITSET 9
  2207. #define FUTEX_WAKE_BITSET 10
  2208. #define FUTEX_PRIVATE_FLAG 128
  2209. #define FUTEX_CLOCK_REALTIME 256
  2210. #define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)
  2211. #ifdef CONFIG_EPOLL
  2212. typedef union target_epoll_data {
  2213. abi_ulong ptr;
  2214. abi_ulong fd;
  2215. uint32_t u32;
  2216. uint64_t u64;
  2217. } target_epoll_data_t;
  2218. struct target_epoll_event {
  2219. uint32_t events;
  2220. #ifdef TARGET_ARM
  2221. uint32_t __pad;
  2222. #endif
  2223. target_epoll_data_t data;
  2224. } QEMU_PACKED;
  2225. #endif
  2226. struct target_rlimit64 {
  2227. uint64_t rlim_cur;
  2228. uint64_t rlim_max;
  2229. };
  2230. struct target_ucred {
  2231. uint32_t pid;
  2232. uint32_t uid;
  2233. uint32_t gid;
  2234. };
  2235. #endif
  2236. struct target_timer_t {
  2237. abi_ulong ptr;
  2238. };
  2239. struct target_sigevent {
  2240. target_sigval_t sigev_value;
  2241. int32_t sigev_signo;
  2242. int32_t sigev_notify;
  2243. union {
  2244. int32_t _pad[ARRAY_SIZE(((struct sigevent *)0)->_sigev_un._pad)];
  2245. int32_t _tid;
  2246. struct {
  2247. void (*_function)(sigval_t);
  2248. void *_attribute;
  2249. } _sigev_thread;
  2250. } _sigev_un;
  2251. };
  2252. struct target_user_cap_header {
  2253. uint32_t version;
  2254. int pid;
  2255. };
  2256. struct target_user_cap_data {
  2257. uint32_t effective;
  2258. uint32_t permitted;
  2259. uint32_t inheritable;
  2260. };