summaryrefslogtreecommitdiffstats
path: root/sys/compat
Commit message (Collapse)AuthorAgeFilesLines
* include sys/lock.h and sys/mutex.h to make compile.alfred2002-01-301-0/+2
| | | | Noticed by: Vincent Poy <vince@oahu.WURLDLINK.NET>
* Have SIOCGIFCONF return all (if any) AF_INET addresses for themarcel2002-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
* Linux/alpha uses the same BSDish return mechanism we do forgallatin2002-01-231-0/+4
| | | | | | | | getpid, getuid, getgid and pipe, since they bootstrapped from OSF/1 and never cleaned up. Switch to the native syscalls on alpha so that the above functions work MFC after: 7 days
* Lock the caller process if the pid passed to getsid() or getpgid()tanimura2002-01-191-4/+6
| | | | equals to zero.
* For getsid(), return the sid stored in struct session. This preventstanimura2002-01-191-1/+1
| | | | | | panic in case where a session has no session leader. Inspired by: Solaris 8
* Make compile, remove extra fdrop() calls.alfred2002-01-191-3/+1
| | | | Change name of function to what it's supposed to be (s/sys/do)
* make compile, add missing { and variable declaration.alfred2002-01-191-2/+2
|
* Semi-backout previous fgetvp change, we need the struct file pointeralfred2002-01-191-7/+11
| | | | to perform relative offset calculations, so use fget instead.
* fix typo, there's uap, just fdalfred2002-01-161-1/+1
|
* Reinstate linux_ifname. Although the Linuxulator doesn't use itmarcel2002-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.
* Replace ffind_* with fget calls.alfred2002-01-147-58/+38
| | | | | | | | Make fget MPsafe. Make fgetvp and fgetsock use the fget subsystem to reduce code bloat. Push giant down in fpathconf().
* Remove unused variable.alfred2002-01-131-1/+0
|
* Some of the KSE stuff was accidentally reverted by file locking,alfred2002-01-131-5/+5
| | | | | | fix it. Pointed out by: jhb
* SMP Lock struct file, filedesc and the global file list.alfred2002-01-138-165/+349
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Further fixes related to the interface renaming. Now that wemarcel2002-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>
* Gut this header; since physio_proc_init is never called, the code never doesmsmith2002-01-081-34/+1
| | | | anything more than multiply declare some unused variables.
* Update to C99, s/__FUNCTION__/__func__/,obrien2001-12-101-5/+5
| | | | also don't use ANSI string concatenation.
* Pull in more stuff from procfs now that it's been pseudofsized.des2001-12-091-31/+3
|
* When translating the interface name when "eth?" is given, do notmarcel2001-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
* o Introduce pr_mtx into struct prison, providing protection for therwatson2001-12-034-43/+111
| | | | | | | | | | | | | | | | | | mutable contents of struct prison (hostname, securelevel, refcount, pr_linux, ...) o Generally introduce mtx_lock()/mtx_unlock() calls throughout kern/ so as to enforce these protections, in particular, in kern_mib.c protection sysctl access to the hostname and securelevel, as well as kern_prot.c access to the securelevel for access control purposes. o Rewrite linux emulator abstractions for accessing per-jail linux mib entries (osname, osrelease, osversion) so that they don't return a pointer to the text in the struct linux_prison, rather, a copy to an array passed into the calls. Likewise, update linprocfs to use these primitives. o Update in_pcb.c to always use prison_getip() rather than directly accessing struct prison. Reviewed by: jhb
* Revert incorrect KSEfication: realitexpire expects a struct proc *, not ades2001-11-241-1/+1
| | | | struct thread *.
* Deal with a few issues that cropped up following the recent changesiedowse2001-11-192-14/+70
| | | | | | | | | | | | | | | | | | | | | | | 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
* Implement DVD-ROM ioctls.marcel2001-11-182-27/+434
| | | | | PR: 26955 Submitted by: Boris Nikolaus (email unknown)
* Implement missing SOUND_MIXER_WRITE_RECSRC ioctl.marcel2001-11-182-0/+5
| | | | | PR: 22971 Tested by: dougb
* Fix missing holdsock()->fgetsock()dillon2001-11-171-7/+5
| | | | Submitted by: Hisashi Hiramoto <hiramoto@phys.chs.nihon-u.ac.jp>
* Give struct socket structures a ref counting interface similar todillon2001-11-171-18/+12
| | | | | | | vnodes. This will hopefully serve as a base from which we can expand the MP code. We currently do not attempt to obtain any mutex or SX locks, but the door is open to add them when we nail down exactly how that part of it is going to work.
* Forward declare struct ifnet - this fixes a warning in tdfx_pci.cpeter2001-11-171-0/+1
|
* Fix printf warnings (int/long)peter2001-11-171-2/+4
| | | | #if 0 around unused ifname_bsd_to_linux() function
* Fix warning in debug printf. This is a long on alpha, and int on i386,peter2001-11-171-1/+1
| | | | but printed with %ld always.
* o Replace reference to 'struct proc' with 'struct thread' in 'structrwatson2001-11-081-6/+6
| | | | | | | | | | | | | | | sysctl_req', which describes in-progress sysctl requests. This permits sysctl handlers to have access to the current thread, permitting work on implementing td->td_ucred, migration of suser() to using struct thread to derive the appropriate ucred, and allowing struct thread to be passed down to other code, such as network code where td is not currently available (and curproc is used). o Note: netncp and netsmb are not updated to reflect this change, as they are not currently KSE-adapted. Reviewed by: julian Obtained from: TrustedBSD Project
* promote tv_sec in printf to make it type agnosticdillon2001-10-291-4/+4
|
* Introduce [IPC|SHM]_[INFO|STAT] to shmctl to makemr2001-10-281-3/+52
| | | | `/compat/linux/usr/bin/ipcs -m` happy.
* Eliminate the prefix parameter to linux_emul_find(), which was alwaysdes2001-10-272-7/+5
| | | | | | | | linux_emul_path anyway. Linux_emul_find() has interesting bugs in its prefix handling (which luckily are not currently exploitable); this commit is preliminary to an attempt at cleaning it up. Approved by: marcel
* Force the length of the sockaddr to be correct for AF_INET and AF_INET6fenner2001-10-261-2/+23
| | | | | | in bind() and connect(). Linux doesn't care if the length of the sockaddr matches its address family; FreeBSD does. This fixes the known issues with the resolver in linux_base-7.
* Reporting device drivers by traversing cdevsw[] is at best a hackphk2001-10-261-2/+6
| | | | | | | | | | | which may or may not return something which is partially right. Disable the "devices" file until we find out what this is needed for, and what exactly those apps need. This will allow cdevsw to become static again. Approved by: DES
* Add proc/mtab which simulates a Linux system's /etc/mtab.des2001-10-211-1/+72
|
* Tweak the way we determine if an interface needs to have its name translated.des2001-10-202-22/+62
| | | | | | | | 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.
* Fix Alpha related brokenness. We used to have a MD linux_ioctl.hmarcel2001-10-192-8/+209
| | | | | | | | | | | | | | | | | 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.
* #if 0 out some code that depends on other uncommitted patches.des2001-10-191-0/+2
|
* Adapt to pseudofs changes (dynamic initialization, not static).des2001-10-191-67/+60
| | | | | Use the new linux_ifname() function from the linuxulator rather than roll our own interface name translation.
* Add support for the "device private" ioctls soon to be used by the an driver.des2001-10-192-16/+76
| | | | | | 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.
* Whitespace fix.des2001-10-191-1/+1
|
* Implement linux_chown and linux_lchown. The fchown syscall mapsmarcel2001-10-161-0/+42
| | | | | | | directly to the native syscall, because no filename handling needs to be done. Tested by: Martin Blapp <mb@imp.ch>
* Try to make Linux socket ioctls work. Up until now they've only *pretended*des2001-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>
* When casting from uid16/gid16 to uid/gid respectively, make suremarcel2001-10-141-14/+16
| | | | | | | that "no change" (ie 0xFFFF) is properly cast to (int)-1 for those syscalls that set uids and/or gids. Verified by: LTP
* Add missing includes of sys/lock.h.jhb2001-10-111-0/+1
|
* Make MAXTSIZ, DFLDSIZ, MAXDSIZ, DFLSSIZ, MAXSSIZ, SGROWSIZ loaderps2001-10-103-3/+3
| | | | | | | tunable. Reviewed by: peter MFC after: 2 weeks
* Catch up with the visibility callback stuff, and give up trying to keep thedes2001-10-011-19/+37
| | | | file definitions on single lines.
* Specify readability and / or writeability for all nodes that need it.des2001-09-301-18/+18
|
* Adapt to pseudofs version 2. Sorry about the breakage - I had this readydes2001-09-291-20/+18
| | | | to commit along with the pseudofs patches, but just plain forgot.
OpenPOWER on IntegriCloud