summaryrefslogtreecommitdiff
path: root/sys/compat/linux/linux_ioctl.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Fix Alpha related brokenness. We used to have a MD linux_ioctl.hMarcel Moolenaar2001-10-191-6/+30
| | | | | | | | | | | | | | | | | | | | that appeared to be very different from the MI version. These differences were mostly bogus and caused by copying octal definitions and write them as hexadecimal values without doing any base conversion (ie 010 was copied to 0x10). After filtering out these differences, any remaining (real) incompatibilities have been merged into the MI header file to make them more visible. While here, fix the termios <-> termio conversion WRT to the c_cc field for Alpha. The termios values do not match the termio values and thus prevents us from copying. By eliminating the Alpha MD copy of linux_ioctl.h we also fixed the recent build breakage caused by putting new bits in the MI header and not in the MD header. Notes: svn path=/head/; revision=85139
* Add support for the "device private" ioctls soon to be used by the an driver.Dag-Erling Smørgrav2001-10-191-16/+63
| | | | | | | | | Also slightly change the name translation policy - only rename interfaces that have the IFF_BROADCAST flag set. This is not perfect, but is closer to how Linux names network interfaces. Notes: svn path=/head/; revision=85127
* Try to make Linux socket ioctls work. Up until now they've only *pretended*Dag-Erling Smørgrav2001-10-151-50/+281
| | | | | | | | | | | | | | | | | to work, but haven't really due to subtle differences in structs etc. This is still not perfect (some ioctls are still known not to work, while others haven't been tested at all), but it's enough to get Debian's ifconfig to produce relatively sane output. More work will be needed to get all ioctls (or at least a reasonable subset) working, and to support the Cisco Aironet config tool mentioned in the PR. PR: 26546 Submitted by: Doug Ambrisko <ambrisko@ambrisko.com> Notes: svn path=/head/; revision=85012
* Fix off by one error introduced by the use of the ifnet_byindex()Marcel Moolenaar2001-09-141-1/+1
| | | | | | | | | | | macro. The commit log clearly states that the index given to the macro is one higher than previously used to index the array. This wasn't represented in the code and resulted in kernel page faults. Reported by: Andrew Atrens <atrens@nortelnetworks.com> Notes: svn path=/head/; revision=83436
* KSE Milestone 2Julian Elischer2001-09-121-139/+139
| | | | | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha Notes: svn path=/head/; revision=83366
* Round of cleanups and enhancements. These include (in random order):Marcel Moolenaar2001-09-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | o Introduce private types for use in linux syscalls for two reasons: 1. establish type independence for ease in porting and, 2. provide a visual queue as to which syscalls have proper prototypes to further cleanup the i386/alpha split. Linuxulator types are prefixed by 'l_'. void and char have not been "virtualized". o Provide dummy functions for all syscalls and remove dummy functions or implementations of truely obsolete syscalls. o Sanitize the shm*, sem* and msg* syscalls. o Make a first attempt to implement the linux_sysctl syscall. At this time it only returns one MIB (KERN_VERSION), but most importantly, it tells us when we need to add additional sysctls :-) o Bump the kenel version up to 2.4.2 (this is not the same as the KERN_VERSION MIB, BTW). o Implement new syscalls, of which most are specific to i386. Our syscall table is now up to date with Linux 2.4.2. Some highlights: - Implement the 32-bit uid_t and gid_t bases syscalls. - Implement a couple of 64-bit file size/offset bases syscalls. o Fix or improve numerous syscalls and prototypes. o Reduce style(9) violations while I'm here. Especially indentation inconsistencies within the same file are addressed. Re-indenting did not obfuscate actual changes to the extend that it could not be combined. NOTE: I spend some time testing these changes and found that if there were regressions, they were not caused by these changes AFAICT. It was observed that installing a RH 7.1 runtime environment did make matters worse. Hangs and/or reboots have been observed with and without these changes, so when it failed to make life better in cases it doesn't look like it made it worse. Notes: svn path=/head/; revision=83221
* Wrap array accesses in macros, which also happen to be lvalues:Jonathan Lemon2001-09-061-1/+1
| | | | | | | | | | ifnet_addrs[i - 1] -> ifaddr_byindex(i) ifindex2ifnet[i] -> ifnet_byindex(i) This is intended to ease the conversion to SMPng. Notes: svn path=/head/; revision=83130
* With this commit, I hereby pronounce gensetdefs past its use-by date.Peter Wemm2001-06-131-34/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace the a.out emulation of 'struct linker_set' with something a little more flexible. <sys/linker_set.h> now provides macros for accessing elements and completely hides the implementation. The linker_set.h macros have been on the back burner in various forms since 1998 and has ideas and code from Mike Smith (SET_FOREACH()), John Polstra (ELF clue) and myself (cleaned up API and the conversion of the rest of the kernel to use it). The macros declare a strongly typed set. They return elements with the type that you declare the set with, rather than a generic void *. For ELF, we use the magic ld symbols (__start_<setname> and __stop_<setname>). Thanks to Richard Henderson <rth@redhat.com> for the trick about how to force ld to provide them for kld's. For a.out, we use the old linker_set struct. NOTE: the item lists are no longer null terminated. This is why the code impact is high in certain areas. The runtime linker has a new method to find the linker set boundaries depending on which backend format is in use. linker sets are still module/kld unfriendly and should never be used for anything that may be modular one day. Reviewed by: eivind Notes: svn path=/head/; revision=78161
* Allow debugging output to be controlled on a per-syscall granularity.Jonathan Lemon2001-02-161-34/+45
| | | | | | | | | Also clean up debugging output in a slightly more uniform fashion. The default behavior remains the same (all debugging output is turned on) Notes: svn path=/head/; revision=72543
* Don't auto-generate the syscalls.Marcel Moolenaar2000-12-031-4/+0
| | | | Notes: svn path=/head/; revision=69539
* Revert auto-generation. The Alpha port is broken.Marcel Moolenaar2000-11-101-0/+4
| | | | | | | Syncing with it is wrong. Notes: svn path=/head/; revision=68583
* Sync with Alpha:Marcel Moolenaar2000-11-091-4/+0
| | | | | | | | Do not use sysent.c, proto.h and syscall.h in source tree; use auto-generated versions. Notes: svn path=/head/; revision=68519
* zap a stray include that snuck in with rev 1.56Andrew Gallatin2000-11-021-1/+0
| | | | | | | Submitted by: Clive Lin <clive@CirX.ORG> Notes: svn path=/head/; revision=68251
* fix linux_termio and linux_termios structs on alpha. alpha differencesAndrew Gallatin2000-11-011-7/+7
| | | | | | | | are in the termios struct (probably because linux wants to be compatible with the osf/1 termios struct), not the termio struct. Notes: svn path=/head/; revision=68210
* The MI/MD split wasn't perfect and the MI files need hacks for theDavid E. O'Brien2000-11-011-1/+18
| | | | | | | | | AlphaLinux compat bits. This will be better cleaned up soon. Agreed to what ever was necessary by: marcel Notes: svn path=/head/; revision=68201
* Initiate deorbit burn sequence for <machine/console.h>.Poul-Henning Kamp2000-10-081-2/+2
| | | | | | | | | | | | Replace all in-tree uses with necessary subset of <sys/{fb,kb,cons}io.h>. This is also the appropriate fix for exo-tree sources. Put warnings in <machine/console.h> to discourage use. November 15th 2000 the warnings will be converted to errors. January 15th 2001 the <machine/console.h> files will be removed. Notes: svn path=/head/; revision=66834
* Update include directives.Marcel Moolenaar2000-08-221-5/+5
| | | | Notes: svn path=/head/; revision=64907
* Back out the previous change to the queue(3) interface.Jake Burkholder2000-05-261-2/+2
| | | | | | | | | It was not discussed and should probably not happen. Requested by: msmith and others Notes: svn path=/head/; revision=60938
* Change the way that the queue(3) structures are declared; don't assume thatJake Burkholder2000-05-231-2/+2
| | | | | | | | | | | the type argument to *_HEAD and *_ENTRY is a struct. Suggested by: phk Reviewed by: phk Approved by: mdodd Notes: svn path=/head/; revision=60833
* Fix some style bugs. The long line is in a chunk of code that'sNick Sayer2000-03-131-4/+4
| | | | | | | | | being rewritten, though. Submitted by: bde Notes: svn path=/head/; revision=57998
* Implement Linux BLKGETSIZE ioctl, and open the door to implementingNick Sayer2000-03-091-0/+23
| | | | | | | | | other BLK.* ioctls should the desire arize. Approved by: jkh (via dufault) Notes: svn path=/head/; revision=57858
* Avoid passing an uninitialized structure member to the realNick Sayer2000-02-011-0/+1
| | | | | | | | | | READSUBCHANNEL ioctl. This makes vmware work with SCSI CDROM drives. Approved by: jkh Notes: svn path=/head/; revision=56940
* Implement pluggable ioctl handlers.Marcel Moolenaar1999-12-041-1077/+1293
| | | | | | | | | | | | | | | | | | | | | | | | | | | Other modules can register and unregister ioctl handlers to extend the ioctls known by the Linuxulator. A recent application is the vmware port. The Linuxulator itself uses the new interface to register its handlers as well. Handlers for the following types of ioctls have been defined: cdrom console (=keyboard and VT handling) socket sound termio All ioctl related defines and declarations have been moved to a new file (linux_ioctl.h), except for the pluggable ioctl handler interface definition. While there, cleanup linux.h some more. linux.h and linux_ioctl.[ch] have been made to conform to style(9) as much as possible. Inspired and reviewed by: Vladimir N. Silyaev Notes: svn path=/head/; revision=54122
* add linuxulator wrapper for SNDCTL_DSP_GETODELAYAlfred Perlstein1999-11-291-0/+4
| | | | Notes: svn path=/head/; revision=53902
* Swap IOC_OUT and IOC_IN for the SETDIR macro. The linux ioctl read andJohn Hay1999-10-061-1/+1
| | | | | | | | | write bits are swapped. Reviewed by: luoqi, marcel Notes: svn path=/head/; revision=51969
* This is what was "fdfix2.patch," a fix for fd sharing. It's prettyBrian Feldman1999-09-191-21/+19
| | | | | | | | | | | | | | | | | | | | far-reaching in fd-land, so you'll want to consult the code for changes. The biggest change is that now, you don't use fp->f_ops->fo_foo(fp, bar) but instead fo_foo(fp, bar), which increments and decrements the fp refcount upon entry and exit. Two new calls, fhold() and fdrop(), are provided. Each does what it seems like it should, and if fdrop() brings the refcount to zero, the fd is freed as well. Thanks to peter ("to hell with it, it looks ok to me.") for his review. Thanks to msmith for keeping me from putting locks everywhere :) Reviewed by: peter Notes: svn path=/head/; revision=51418