summaryrefslogtreecommitdiff
path: root/sys/compat/linux/linux_ioctl.c
Commit message (Collapse)AuthorAgeFilesLines
* Changes to MI Linux emulation code necessary to run 32-bit Linux binariesTim J. Robbins2004-08-161-2/+13
| | | | | | | | | | | | | | | | | | on AMD64, and the general case where the emulated platform has different size pointers than we use natively: - declare certain structure members as l_uintptr_t and use the new PTRIN and PTROUT macros to convert to and from native pointers. - declare some structures __packed on amd64 when the layout would differ from that used on i386. - include <machine/../linux32/linux.h> instead of <machine/../linux/linux.h> if compiling with COMPAT_LINUX32. This will need to be revisited before 32-bit and 64-bit Linux emulation support can coexist in the same kernel. - other small scattered changes. This should be a no-op on i386 and Alpha. Notes: svn path=/head/; revision=133816
* Implement SNDCTL_DSP_SETDUPLEX. This may fix sound apps which want toAlexander Leidinger2004-07-021-0/+4
| | | | | | | | | use full duplex mode. Approved by: matk Notes: svn path=/head/; revision=131461
* Add stub for Linux SOUND_MIXER_READ_RECMASK, required by some Linux soundBruce M Simpson2004-06-181-0/+4
| | | | | | | | | | applications. PR: misc/27471 Submitted by: Gavin Atkinson (with cleanups) Notes: svn path=/head/; revision=130691
* Add a stub for the Linux SOUND_MIXER_INFO ioctl (even though we don'tBruce M Simpson2004-06-181-0/+4
| | | | | | | | | | | actually implement it), as some applications, such as RealProducer, expect to be able to use it. PR: kern/65971 Submitted by: Matt Wright Notes: svn path=/head/; revision=130689
* Linux applications expect to be able to call SIOCGIFCONF with anBruce M Simpson2004-06-181-0/+14
| | | | | | | | | | | | | NULL ifc.ifc_buf pointer, to determine the expected buffer size. The submitted fix only takes account of interfaces with an AF_INET address configured. This could no doubt be improved. PR: kern/45753 Submitted by: Jacques Garrigue (with cleanups) Notes: svn path=/head/; revision=130688
* Fix the VT_SETMODE/CDROMIOCTOCENTRY problem correctly.Bruce M Simpson2004-06-181-15/+17
| | | | | | | Reviewed by: tjr Notes: svn path=/head/; revision=130687
* Fix two attempts to use an unchecked NULL pointer provided from theBruce M Simpson2004-06-181-7/+10
| | | | | | | | | userland, for the CDIOREADTOCENTRY and VT_SETMODE cases respectively. Noticed by: tjr Notes: svn path=/head/; revision=130682
* Add support for more linux ioctls.Poul-Henning Kamp2004-06-141-0/+105
| | | | | | | | | | | I've had this sitting in my tree for a long time and I can't seem to find who sent it to me in the first place, apologies to whoever is missing out on a Contributed by: line here. I belive it works as it should. Notes: svn path=/head/; revision=130453
* Add BSD compatibility tty ioctls LINUX_TIOCSBRK and LINUX_TIOCCBRK. ThisBruce M Simpson2004-02-191-0/+10
| | | | | | | | | | addition appears to allow VMware 3 Workstation to operate with nmdm(4) as a virtual COM device. Tested by: Guido van Rooij Notes: svn path=/head/; revision=125997
* Replace the if_name and if_unit members of struct ifnet with new membersBrooks Davis2003-10-311-7/+4
| | | | | | | | | | | | | | | | if_xname, if_dname, and if_dunit. if_xname is the name of the interface and if_dname/unit are the driver name and instance. This change paves the way for interface renaming and enhanced pseudo device creation and configuration symantics. Approved By: re (in principle) Reviewed By: njl, imp Tested On: i386, amd64, sparc64 Obtained From: NetBSD (if_xname) Notes: svn path=/head/; revision=121816
* fix build: linux_to_bsd_msf_lba is no longer used because of previous commitSam Leffler2003-10-201-12/+0
| | | | Notes: svn path=/head/; revision=121286
* We dont support CDROMREADAUDIO anymore.Søren Schmidt2003-10-201-18/+1
| | | | Notes: svn path=/head/; revision=121272
* Don't map LINUX_POSIX_VDISABLE to _POSIX_VDISABLE and vice versa forMarcel Moolenaar2003-06-281-2/+4
| | | | | | | | | | | | | | | | | | | the VMIN and VTIME members of the c_cc array. These members are not special control characters. By not excluding these members we changed the noncanonical mode input processing when both members were 0 on entry (=LINUX_POSIX_VDISABLE) as we would remap them to 255 (=_POSIX_VDISABLE). See termios(4) case A for how that screws up your terminal I/O. PR: 23173 Originator: Bjarne Blichfeldt <bbl@dk.damgaard.com> Patch by: Boris Nikolaus <bn@dali.tellique.de> (original submission) Philipp Mergenthaler <philipp.mergenthaler@stud.uni-karlsruhe.de> Reminders by: Joseph Holland King <gte743n@cad.gatech.edu> MFC after: 5 days Notes: svn path=/head/; revision=116999
* Use __FBSDID().David E. O'Brien2003-06-101-2/+3
| | | | Notes: svn path=/head/; revision=116173
* Add an ioctl handler for the DRM. This removes the need for the DRM_LINUXEric Anholt2003-04-241-0/+14
| | | | | | | option, which has been a source of frustration for many users. Notes: svn path=/head/; revision=113991
* Don't include <sys/disklabel.h>Poul-Henning Kamp2003-04-161-1/+0
| | | | Notes: svn path=/head/; revision=113581
* Add #include <sys/conf.h> so we don't rely on <sys/disk.h> doing it.Poul-Henning Kamp2003-04-011-0/+1
| | | | Notes: svn path=/head/; revision=112938
* Fix an XXX: and implement LINUX_BLKGETSIZE correctly.Poul-Henning Kamp2003-03-281-6/+14
| | | | Notes: svn path=/head/; revision=112740
* - Change the linux_[gs]et_os{name, release, s_version}() functions toJohn Baldwin2003-03-131-1/+1
| | | | | | | | | | | | | | | | take a thread instead of a proc for their first argument. - Add a mutex to protect the system-wide Linux osname, osrelease, and oss_version variables. - Change linux_get_prison() to take a thread instead of a proc for its first argument and to use td_ucred rather than p_ucred. This is ok because a thread's prison does not change even though it's ucred might. - Also, change linux_get_prison() to return a struct prison * instead of a struct linux_prison * since it returns with the struct prison locked and this makes it easier to safely unlock the prison when we are done messing with it. Notes: svn path=/head/; revision=112206
* More caddr_t removal, in conjunction with copy{in,out}(9) this time.Dag-Erling Smørgrav2003-03-031-44/+37
| | | | | | | Also clean up some egregious casts and incorrect use of sizeof. Notes: svn path=/head/; revision=111797
* Clean up whitespace, s/register //, refrain from strong urge to ANSIfy.Dag-Erling Smørgrav2003-03-021-22/+22
| | | | Notes: svn path=/head/; revision=111742
* uiomove-related caddr_t -> void * (just the low-hanging fruit)Dag-Erling Smørgrav2003-03-021-2/+1
| | | | Notes: svn path=/head/; revision=111741
* Back out M_* changes, per decision of the TRB.Warner Losh2003-02-191-1/+1
| | | | | | | Approved by: trb Notes: svn path=/head/; revision=111119
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.Alfred Perlstein2003-01-211-1/+1
| | | | | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT. Notes: svn path=/head/; revision=109623
* Add function linux_msg() for regulating output from the linux emulationAlfred Perlstein2003-01-021-1/+1
| | | | | | | | | | | | | | code, make the emulator use it. Rename unsupported_msg() to unimplemented_syscall(). Rename some arguments for clarity Fixup grammar. Requested by: bde Notes: svn path=/head/; revision=108541
* SMP locking for ifnet list.Jeffrey Hsu2002-12-221-2/+12
| | | | Notes: svn path=/head/; revision=108172
* Implement the CDROMREADAUDIO ioctl.Marcel Moolenaar2002-10-191-1/+37
| | | | Notes: svn path=/head/; revision=105477
* - Add support for IPC_64 extensions into shmctl(2), semctl(2) and msgctl(2);Maxim Sobolev2002-10-111-0/+15
| | | | | | | | | | | | | | | | - add wrappers for mmap2(2) and ftruncate64(2) system calls; - don't spam console with printf's when VFAT_READDIR_BOTH ioctl(2) is invoked; - add support for SOUND_MIXER_READ_STEREODEVS ioctl(2); - make msgctl(IPC_STAT) and IPC_SET actually working by converting from BSD msqid_ds to Linux and vice versa; - properly return EINVAL if semget(2) is called with nsems being negative. Reviewed by: marcel Approved by: marcel Tested with: LSB runtime test Notes: svn path=/head/; revision=104893
* Remove NVIDIA ioctl bits. They will be provided in a kernel module.Matthew N. Dodd2002-09-201-22/+0
| | | | Notes: svn path=/head/; revision=103712
* Put an XXX comment here to point somebody in the right direction.Poul-Henning Kamp2002-09-201-0/+1
| | | | Notes: svn path=/head/; revision=103705
* Current uses struct thread *td rather than struct proc *p.Warner Losh2002-09-201-2/+2
| | | | Notes: svn path=/head/; revision=103664
* This patch extends the FreeBSD Linux compatibility layer to supportMatthew N. Dodd2002-09-191-0/+22
| | | | | | | | | | NVIDIA API calls; more specifically, it adds an ioctl() handler for the range of possible NVIDIA ioctl numbers. Submitted by: Christian Zander <zander@minion.de> Notes: svn path=/head/; revision=103651
* Implement LINUX_TIOCSCTTY.Marcel Moolenaar2002-09-051-1/+4
| | | | | | | PR: kern/42404 Notes: svn path=/head/; revision=102947
* Increase size of ifnet.if_flags from 16 bits (short) to 32 bits (int). To avoidMaxim Sobolev2002-08-181-1/+1
| | | | | | | | | | breaking application ABI use unused ifreq.ifru_flags[1] for upper 16 bits in SIOCSIFFLAGS and SIOCGIFFLAGS ioctl's. Reviewed by: -hackers, -net Notes: svn path=/head/; revision=102052
* In continuation of early fileop credential changes, modify fo_ioctl() toRobert Watson2002-08-171-18/+36
| | | | | | | | | | | | | | | | | | | | | | | | | accept an 'active_cred' argument reflecting the credential of the thread initiating the ioctl operation. - Change fo_ioctl() to accept active_cred; change consumers of the fo_ioctl() interface to generally pass active_cred from td->td_ucred. - In fifofs, initialize filetmp.f_cred to ap->a_cred so that the invocations of soo_ioctl() are provided access to the calling f_cred. Pass ap->a_td->td_ucred as the active_cred, but note that this is required because we don't yet distinguish file_cred and active_cred in invoking VOP's. - Update kqueue_ioctl() for its new argument. - Update pipe_ioctl() for its new argument, pass active_cred rather than td_ucred to MAC for authorization. - Update soo_ioctl() for its new argument. - Update vn_ioctl() for its new argument, use active_cred rather than td->td_ucred to authorize VOP_IOCTL() and the associated VOP_GETATTR(). Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs Notes: svn path=/head/; revision=102003
* - Remove the Giant acquisition from linux_socket_ioctl() as it was reallyAndrew R. Reiter2002-06-261-11/+2
| | | | | | | | | | | there to protect fdrop() (which in turn can call vrele()), however, fdrop_locked() grabs Giant for us, so we do not have to. Reviewed by: jhb Inspired by: alc Notes: svn path=/head/; revision=98878
* Fix typo in the BSD copyright: s/withough/without/Jens Schweikhardt2002-06-021-1/+1
| | | | | | | | Spotted and suggested by: des MFC after: 3 weeks Notes: svn path=/head/; revision=97748
* fix file descriptor leak.Alfred Perlstein2002-02-201-1/+2
| | | | | | | Submitted by: Mark Santcroos <marks@ripe.net> Notes: svn path=/head/; revision=90984
* Have SIOCGIFCONF return all (if any) AF_INET addresses for theMarcel Moolenaar2002-01-291-4/+22
| | | | | | | | | | | | | | | | | | | | | | | | interfaces we encounter. In Linux, all addresses are returned for which gifconf handlers are installed. This boils down to AF_DECnet and AF_INET. We care mostly about AF_INET for now. Adding additional families is simple enough. Returning the addresses is important for RPC clients to function properly. Andrew found in some reference code that the logic that handles the retransmission looks for an interface that's up and has an AF_INET address. This obviously failed as we didn't return any addresses at all. Note also that with this change we don't return interfaces that don't have AF_INET addresses, whereas before we returned any interface present in the system. This is in line with what Linux does (modulo interfaces with only AF_DECnet addresses of course :-) Reported by: "Andrew Atrens" <atrens@nortelnetworks.com> MFC after: 1 week Notes: svn path=/head/; revision=89944
* Reinstate linux_ifname. Although the Linuxulator doesn't use itMarcel Moolenaar2002-01-151-0/+27
| | | | | | | | | itself, it's used outside the Linuxulator. Reimplement the function so that its behaviour matches the current renaming scheme. It's probably better to formalize these interdependencies. Notes: svn path=/head/; revision=89379
* Replace ffind_* with fget calls.Alfred Perlstein2002-01-141-15/+11
| | | | | | | | | | | Make fget MPsafe. Make fgetvp and fgetsock use the fget subsystem to reduce code bloat. Push giant down in fpathconf(). Notes: svn path=/head/; revision=89319
* SMP Lock struct file, filedesc and the global file list.Alfred Perlstein2002-01-131-94/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Seigo Tanimura (tanimura) posted the initial delta. I've polished it quite a bit reducing the need for locking and adapting it for KSE. Locks: 1 mutex in each filedesc protects all the fields. protects "struct file" initialization, while a struct file is being changed from &badfileops -> &pipeops or something the filedesc should be locked. 1 mutex in each struct file protects the refcount fields. doesn't protect anything else. the flags used for garbage collection have been moved to f_gcflag which was the FILLER short, this doesn't need locking because the garbage collection is a single threaded container. could likely be made to use a pool mutex. 1 sx lock for the global filelist. struct file * fhold(struct file *fp); /* increments reference count on a file */ struct file * fhold_locked(struct file *fp); /* like fhold but expects file to locked */ struct file * ffind_hold(struct thread *, int fd); /* finds the struct file in thread, adds one reference and returns it unlocked */ struct file * ffind_lock(struct thread *, int fd); /* ffind_hold, but returns file locked */ I still have to smp-safe the fget cruft, I'll get to that asap. Notes: svn path=/head/; revision=89306
* Further fixes related to the interface renaming. Now that weMarcel Moolenaar2002-01-101-52/+12
| | | | | | | | | | | | | | | | | properly translate the interface name passed to us, make sure we also translate correctly before we return the list of interfaces with the SIOCGIFCONF ioctl. It is common to use the interface names returned by that ioctl in further ioctls, such as SIOCGIFFLAGS. Remove linux_ifname as it is no longer used. Also remove ifname_bsd_to_linux as it cannot be used anymore now that linux_ifname is removed (was deadcode anyway). Reported and tested by: Andrew Atrens <atrens@nortelnetworks.com> Notes: svn path=/head/; revision=89182
* Update to C99, s/__FUNCTION__/__func__/,David E. O'Brien2001-12-101-5/+5
| | | | | | | also don't use ANSI string concatenation. Notes: svn path=/head/; revision=87599
* When translating the interface name when "eth?" is given, do notMarcel Moolenaar2001-12-041-3/+9
| | | | | | | | | | | | | | | | | use the internal index number as the unit number to compare with. The first ethernet interface in Linux is called "eth0", whereas our internal index starts wth 1 and is not unique to ethernet interfaces (lo0 has index 1 for example). Instead, use a function- local index number that starts with 0 and is incremented only for ethernet interfaces. This way the unit number will match the n-th ethernet interface in the system, which is exactly what it means in Linux. Tested by: Glenn Johnson <gjohnson@srrc.ars.usda.gov> MFC after: 3 days Notes: svn path=/head/; revision=87335
* Deal with a few issues that cropped up following the recent changesIan Dowse2001-11-191-14/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | to the code for translating socket and private ioctls: - Only perform socket ioctl translation if the file descriptor is a socket. - Treat socket ioctls on non-sockets specially, and for now assume that these are directed at a tap/vmnet device, so translate the ioctl numbers as appropriate (the way if_tap abuses some socket ioctls to pass non-ifreq data is utterly bogus, but this is how VMware on FreeBSD has always "worked"; I will deal with this later). - Add (untested) support for translating SIOCSIFADDR. - In all cases where we fail to translate an ioctl, return ENOIOCTL so that other handlers have a chance to do the translation. This should fix the "/dev/vmnet1: Invalid argument" errors that users of VMware were experiencing, though I have only verified this on RELENG_4. Submitted by: des (mostly) MFC after: 3 days Notes: svn path=/head/; revision=86607
* Implement DVD-ROM ioctls.Marcel Moolenaar2001-11-181-0/+374
| | | | | | | | PR: 26955 Submitted by: Boris Nikolaus (email unknown) Notes: svn path=/head/; revision=86555
* Implement missing SOUND_MIXER_WRITE_RECSRC ioctl.Marcel Moolenaar2001-11-181-0/+4
| | | | | | | | PR: 22971 Tested by: dougb Notes: svn path=/head/; revision=86540
* Fix printf warnings (int/long)Peter Wemm2001-11-171-2/+4
| | | | | | | #if 0 around unused ifname_bsd_to_linux() function Notes: svn path=/head/; revision=86483
* Tweak the way we determine if an interface needs to have its name translated.Dag-Erling Smørgrav2001-10-201-22/+57
| | | | | | | | | | | Add some missing break statements in the socket ioctl switch. Check the return value from copyin() / copyout(). Fix some disorderings and misindentations. Support a couple more socket ioctls. Add missing break statements. Notes: svn path=/head/; revision=85203