summaryrefslogtreecommitdiffstats
path: root/linux-user/ioctls.h
Commit message (Collapse)AuthorAgeFilesLines
* linux-user: Implement special usbfs ioctls.Cortland Tölva2018-10-191-0/+8
| | | | | | | | | | | | | | Userspace submits a USB Request Buffer to the kernel, optionally discards it, and finally reaps the URB. Thunk buffers from target to host and back. Tested by running an i386 scanner driver on ARMv7 and by running the PowerPC lsusb utility on x86_64. The discardurb ioctl is not exercised in these tests. Signed-off-by: Cortland Tölva <cst@tolva.net> Message-Id: <20181008163521.17341-4-cst@tolva.net> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
* linux-user: Define ordinary usbfs ioctls.Cortland Tölva2018-10-191-0/+38
| | | | | | | | | | Provide ioctl definitions for the generic thunk mechanism to convert most usbfs calls. Calculate arg size at runtime. Signed-off-by: Cortland Tölva <cst@tolva.net> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20181008163521.17341-3-cst@tolva.net> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
* linux-user: Implement ioctl cmd TIOCGPTPEERAndreas Schwab2018-02-181-0/+3
| | | | | | | | | With glibc 2.27 the openpty function prefers the TIOCGPTPEER ioctl. Signed-off-by: Andreas Schwab <schwab@suse.de> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <mvmbmhdosb9.fsf_-_@suse.de> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
* linux-user: Add some random ioctlsMarco A L Barbosa2017-10-161-0/+5
| | | | | | Signed-off-by: Marco A L Barbosa <malbarbo@gmail.com> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* linux-user: Add FICLONE and FICLONERANGE ioctlsHelge Deller2017-02-161-0/+5
| | | | | | | | | Add missing FICLONE and FICLONERANGE ioctls. Signed-off-by: Helge Deller <deller@gmx.de> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20170211222602.GA6399@ls3530.fritz.box> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
* linux-user: Add SIOCGPGRP, SIOCGSTAMP, SIOCGSTAMPNSHelge Deller2017-01-231-0/+3
| | | | | | | | | | Mirror syscall_defs.h for the element type of struct timeval and struct timespec, even though that's not 100% accurate for each guest. Signed-off-by: Helge Deller <deller@gmx.de> [rth: Changed the MK_ARRAY types as per above; added ioctl.h entries.] Signed-off-by: Richard Henderson <rth@twiddle.net>
* linux-user: Handle TIOCSTART and TIOCSTOPHelge Deller2017-01-231-0/+5
| | | | | | | | | | | | | | | Some architectures (ppc, alpha, sparc, parisc, sh and xtensa) define the BSD TIOCSTART and TIOCSTOP ioctls in their kernel headers to provide compatibility to other operating systems. Those ioctls are not implemented in Linux, nevertheless, bash will use this ioctl if it's available on those architectures. To avoid false warnings, add code to simply ignore those ioctls. Signed-off-by: Helge Deller <deller@gmx.de> Message-Id: <20161206152403.GA6651@ls3530> Signed-off-by: Richard Henderson <rth@twiddle.net>
* linux-user: Implement FS_IOC_GETFLAGS and FS_IOC_SETFLAGS ioctlsPeter Maydell2016-09-211-0/+3
| | | | | | | | | | | | Implement the FS_IOC_GETFLAGS and FS_IOC_SETFLAGS ioctls, as used by chattr. Note that the type information encoded in these ioctl numbers is at odds with the actual type the kernel accesses, as discussed in http://thread.gmane.org/gmane.linux.file-systems/80164. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Fix type for SIOCATMARK ioctlPeter Maydell2016-07-191-1/+1
| | | | | | | | | | | The SIOCATMARK ioctl takes an argument which should be a pointer to an integer where the kernel will write the result. We were incorrectly declaring it as TYPE_NULL which would mean it would always fail (with EFAULT) when it should succeed. Correct the type. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Add some new blk ioctlsPeter Maydell2016-07-191-0/+29
| | | | | | | | | | | | | | | | | Add some new blk ioctls (these are 0x12,119 through to 0x12,127). Several of these are used by mke2fs; this silences the warnings: mke2fs 1.42.12 (29-Aug-2014) Unsupported ioctl: cmd=0x127b Unsupported ioctl: cmd=0x127a warning: Unable to get device geometry for /dev/loop5 Unsupported ioctl: cmd=0x127c Unsupported ioctl: cmd=0x127c Unsupported ioctl: cmd=0x1277 Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Correct type for LOOP_GET_STATUS{,64} ioctlsPeter Maydell2016-07-191-2/+2
| | | | | | | | | | | | | | | | The LOOP_GET_STATUS and LOOP_GET_STATUS64 ioctls were incorrectly defined as IOC_W rather than IOC_R, which meant we weren't correctly copying the information back from the kernel to the guest. The loop_info64 structure definition was also missing a member and using the wrong type for several 32-bit fields. In particular, this meant that "kpartx -d image.img" didn't work and "losetup -a" behaved strangely. Correct the ioctl type definitions. Reported-by: Chanho Park <chanho61.park@samsung.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Correct type for BLKSSZGETPeter Maydell2016-07-191-1/+1
| | | | | | | | | | | | | | | The BLKSSZGET ioctl takes an argument which is a pointer to an int. We were incorrectly declaring it to take a pointer to a long, which meant that we would incorrectly write to memory which we should not if the guest is a 64-bit architecture. In particular, kpartx uses this ioctl to write to an int on the stack, which tends to result in it crashing immediately. Reported-by: Chanho Park <chanho61.park@samsung.com> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Add loop control ioctlsPeter Maydell2016-07-191-0/+4
| | | | | | | | | | | | Add support for the /dev/loop-control ioctls: LOOP_CTL_ADD LOOP_CTL_REMOVE LOOP_CTL_GET_FREE [RV: fixed to apply to new header guards] Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Convert blkpg to use a special subop handlerAlexander Graf2014-10-061-1/+2
| | | | | | | | | | | The blkpg ioctl can take different payloads depending on the opcode in its payload structure. Create a new special ioctl handler that can only deal with partition style ones for now. This patch fixes running parted for me. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* SIOCGIFINDEX: fix typoJoakim Tjernlund2014-07-151-1/+1
| | | | | | | | Wrong type was used in ioctl definition. Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: support the SIOCGIFINDEX ioctlPaul Burton2014-06-291-0/+1
| | | | | | | | Add a definition of the SIOCGIFINDEX ioctl, allowing its use by target programs. Signed-off-by: Paul Burton <paul@archlinuxmips.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: support the KDSIGACCEPT ioctlPaul Burton2014-06-291-0/+1
| | | | | | | | Add a definition of the KDSIGACCEPT ioctl & allow its use by target programs. Signed-off-by: Paul Burton <paul@archlinuxmips.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Implement BLKPG ioctlAndreas Färber2014-02-191-0/+1
| | | | | | Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: allow use of TIOCGSIDLaurent Vivier2013-09-241-0/+1
| | | | | | Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: add SIOCADDRT/SIOCDELRT supportLaurent Vivier2013-07-051-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | This allows to pass the device name. You can test this with the "route" command. WITHOUT this patch: $ sudo route add -net default gw 10.0.3.1 eth0 SIOCADDRT: Bad address $ netstat -nr Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Ifa 10.0.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth WITH this patch: $ sudo route add -net default gw 10.0.3.1 eth0 $ netstat -nr Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Ifa 0.0.0.0 10.0.3.1 0.0.0.0 UG 0 0 0 eth 10.0.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
* linux-user: Fix SNDCTL_DSP_MAP{IN, OUT}BUF ioctl definitionsPeter Maydell2012-08-131-2/+2
| | | | | | | | | Fix the SNDCTL_DSP_MAP{IN,OUT}BUF ioctl definitions so that they refer to a suitably defined target struct layout rather than hardcoding the ioctl number. This fixes complaints from the syscall_init() consistency check when running an x86_64-to-x86_64 linux-user qemu. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* linux-user: Add ioctl for BLKBSZGETAlexander Graf2012-04-061-0/+1
| | | | | | | This patch adds the ioctl wrapper definition for BLKBSZGET. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: add BLKSSZGET ioctl wrapperAlexander Graf2012-04-061-0/+1
| | | | | | | This patch adds an ioctl definition for BLKSSZGET. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: implement device mapper ioctlsAlexander Graf2012-04-061-0/+32
| | | | | | | | This patch implements all ioctls currently implemented by device mapper, enabling us to run dmsetup and kpartx inside of linux-user. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Add support for even more FB ioctlsCédric VINCENT2011-07-111-0/+5
| | | | | | | | | This patch was validated with programs from DirectFB-1.0 and WebKit/DirectFB. Signed-off-by: Cédric VINCENT <cedric.vincent@st.com> Cc: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Add support for more VT ioctlsCédric VINCENT2011-07-111-0/+4
| | | | | | | | | | DirectFB-1.0 uses at least two of the four added ioctls, and the two others were added for completeness. This patch was validated with the program "vlock -all/-new". Signed-off-by: Cédric VINCENT <cedric.vincent@st.com> Cc: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: Add support for KD...LED ioctlsCédric VINCENT2011-07-111-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DirectFB-1.0 uses at least one of the four added ioctls, and the three others were added for completeness. This patch was validated with the program "setleds" and the following Makefile: SETLEDS_INIT = setleds -v -num -caps -scroll SETLEDS_TESTS = sh -c ' \ setleds -v +num +caps +scroll; \ setleds -v -num -caps -scroll; \ setleds -v +num -caps -scroll; \ setleds -v +num +caps -scroll; \ setleds -v +num +caps +scroll; \ setleds -v -num +caps +scroll; \ setleds -v -num -caps +scroll; \ setleds -v -num -caps -scroll' SETLEDS_HOST = setleds SETLEDS_QEMU = "SETLEDS_QEMU not set" .PHONY: setleds_tests setleds_tests: rm -f setleds.host setleds.target $(SETLEDS_INIT:setleds=$(SETLEDS_HOST)) $(SETLEDS_TESTS:setleds=$(SETLEDS_HOST)) >> setleds.host $(SETLEDS_INIT:setleds=$(SETLEDS_QEMU)) $(SETLEDS_TESTS:setleds=$(SETLEDS_QEMU)) >> setleds.target cmp setleds.host setleds.target Signed-off-by: Cédric VINCENT <cedric.vincent@st.com> Cc: Riku Voipio <riku.voipio@iki.fi> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
* linux-user: add ioctl(SIOCGIWNAME, ...) support.Laurent Vivier2011-04-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow to run properly following program from linux-user: /* cc -o wifi wifi.c */ #include <stdio.h> #include <sys/ioctl.h> #include <sys/types.h> #include <sys/socket.h> #include <linux/wireless.h> #include <netinet/in.h> #include <arpa/inet.h> #include <string.h> int main(int argc, char **argv) { int ret; struct ifreq req; struct sockaddr_in *addr; int s; if (argc != 2) { fprintf(stderr, "Need an interface name (like wlan0)\n"); return 1; } s = socket( AF_INET, SOCK_DGRAM, 0 ); if (s < 0) { perror("Cannot open socket"); return 1; } strncpy(req.ifr_name, argv[1], sizeof(req.ifr_name)); ret = ioctl( s, SIOCGIWNAME, &req ); if (ret < 0) { fprintf(stderr, "No wireless extension\n"); return 1; } printf("%s\n", req.ifr_name); printf("%s\n", req.ifr_newname); return 0; } $ ./wifi eth0 No wireless extension $ ./wifi wlan0 wlan0 IEEE 802.11bg Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* linux-user: convert ioctl(SIOCGIFCONF, ...) result.Laurent Vivier2011-04-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The result needs to be converted as it is stored in an array of struct ifreq and sizeof(struct ifreq) differs according to target and host alignment rules. This patch allows to execute correctly the following program on arm and m68k: #include <stdio.h> #include <sys/ioctl.h> #include <net/if.h> #include <alloca.h> #include <string.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> int main(void) { int s, ret; struct ifconf ifc; int i; memset( &ifc, 0, sizeof( struct ifconf ) ); ifc.ifc_len = 8 * sizeof(struct ifreq); ifc.ifc_buf = alloca(ifc.ifc_len); s = socket( AF_INET, SOCK_DGRAM, 0 ); if (s < 0) { perror("Cannot open socket"); return 1; } ret = ioctl( s, SIOCGIFCONF, &ifc ); if (s < 0) { perror("ioctl() failed"); return 1; } for (i = 0; i < ifc.ifc_len / sizeof(struct ifreq) ; i ++) { struct sockaddr_in *s; s = (struct sockaddr_in*)&ifc.ifc_req[i].ifr_addr; printf("%s\n", ifc.ifc_req[i].ifr_name); printf("%s\n", inet_ntoa(s->sin_addr)); } } Signed-off-by: Laurent Vivier <laurent@vivier.eu> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* linux-user: fix for loopmount ioctlMartin Mohring2011-02-091-2/+0Star
| | | | | | | In case a chrooted build uses XEN or KVM, a looped mount needs to be done to setup the chroot. The ioctl for loop mount works correctly for arm, mips, ppc32 and sh4, so its now activated. Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
* linux-user: Add configure check for linux/fiemap.h and IOC_FS_FIEMAPPeter Maydell2011-01-121-1/+1
| | | | | | | | | Add a configure check for the existence of linux/fiemap.h and the IOC_FS_FIEMAP ioctl. This fixes a compilation failure on Linux systems which don't have that header file. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
* linux-user: Implement FS_IOC_FIEMAP ioctlPeter Maydell2011-01-071-0/+4
| | | | | | | | | Implement the FS_IOC_FIEMAP ioctl using the new support for custom handling of ioctls; this is needed because the struct that is passed includes a variable-length array. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* linux-user: KD/VT/FB ioctlsUlrich Hecht2009-10-171-0/+14
| | | | | | | everything needed to run SDL on a framebuffer device in the userspace emulator Signed-off-by: Ulrich Hecht <uli@suse.de> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
* Add MTIOCTOP, MTIOCGET and MTIOCPOS ioctls (Kirill Shutemov).balrog2008-09-201-0/+4
| | | | | | | Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5271 c046a42c-6fe2-441c-8c8c-71466251a162
* Add loop device ioctls (Gary Thomas).balrog2008-04-261-0/+10
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4257 c046a42c-6fe2-441c-8c8c-71466251a162
* Avoid accessing guest memory directly in usermode emulation.pbrook2006-03-251-1/+1
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1790 c046a42c-6fe2-441c-8c8c-71466251a162
* factorized more definitions - suppressed broken sound ioctlsbellard2003-06-151-4/+8
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@241 c046a42c-6fe2-441c-8c8c-71466251a162
* more console ioctlsbellard2003-05-101-1/+5
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@139 c046a42c-6fe2-441c-8c8c-71466251a162
* added KDGKBTYPEbellard2003-05-081-0/+2
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@132 c046a42c-6fe2-441c-8c8c-71466251a162
* TIOCGPTN and TIOCSPTLCK ioctlsbellard2003-04-101-0/+2
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@90 c046a42c-6fe2-441c-8c8c-71466251a162
* added SIOCATMARK and times() syscallbellard2003-03-301-0/+1
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@70 c046a42c-6fe2-441c-8c8c-71466251a162
* better signal/exception supportbellard2003-03-231-1/+5
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@42 c046a42c-6fe2-441c-8c8c-71466251a162
* added loop/xadd/cmpxchg supportbellard2003-03-161-0/+3
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@29 c046a42c-6fe2-441c-8c8c-71466251a162
* This commit was generated by cvs2svn to compensate for changes in r2,bellard2003-02-181-0/+282
which included commits to RCS files with non-trunk default branches. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3 c046a42c-6fe2-441c-8c8c-71466251a162