summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux/linux_stats.c
Commit message (Collapse)AuthorAgeFilesLines
* In translate_path_major_minor(), do not calculate otherwise unused 'fp'rwatson2007-03-061-4/+0
| | | | variable, avoiding an extra locking of the file descriptor array.
* MFP4: 109652jkim2006-12-041-39/+38
| | | | | | | | | | | | Fixes for 'blocking in fifoor state' problem of LTP tests. linux_*stat*() functions were opening files with O_RDONLY to get major/minor pair for char/block special files. Unfortunately, when these functions are used against fifo, it is blocked forever because there is no writer. Instead, we only open char/block special files for major/minor conversion. We have to get rid of kern_open() entirely from translate_path_major_minor() but today is not the day. While I am here, add checks for errors before calling translate_path_major_minor().
* Complete break-out of sys/sys/mac.h into sys/security/mac/mac_framework.hrwatson2006-10-221-1/+2
| | | | | | | | | | | | | begun with a repo-copy of mac.h to mac_framework.h. sys/mac.h now contains the userspace and user<->kernel API and definitions, with all in-kernel interfaces moved to mac_framework.h, which is now included across most of the kernel instead. This change is the first step in a larger cleanup and sweep of MAC Framework interfaces in the kernel, and will not be MFC'd. Obtained from: TrustedBSD Project Sponsored by: SPARTA
* Add the linux statfs64 call. This allows Tivoli backup to proceed a littlenetchild2006-08-271-0/+51
| | | | | | | | | but further on -current (still not successful, but a step into the right direction). Sponsored by: Google SoC 2006 Submitted by: rdivacky Tested by: Paul Mather <paul@gromit.dlib.vt.edu>
* Fix file leaking in translate_path_major_minor.ambrisko2006-05-161-2/+6
|
* Now that we don't have a linuxolator on alpha anymore:netchild2006-05-101-2/+0
| | | | | - unifdef __alpha__ - revert rev. 1.66 of linux_socket.c
* Fix the the duplicate cut-n-paste in linux_fstat64 pointed out byambrisko2006-05-051-1/+0
| | | | Alexander Leidinger. I forget to fix it in this version.
* Enhance the Linux emulation layer to make MegaRAID SAS managements tool happy.ambrisko2006-05-051-5/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add back in a scheme to emulate old type major/minor numbers via hooks into stat, linprocfs to return major/minors that Linux app's expect. Currently only /dev/null is always registered. Drivers can register via the Linux type shim similar to the ioctl shim but by using linux_device_register_handler/linux_device_unregister_handler functions. The structure is: struct linux_device_handler { char *bsd_driver_name; char *linux_driver_name; char *bsd_device_name; char *linux_device_name; int linux_major; int linux_minor; int linux_char_device; }; Linprocfs uses this to display the major number of the driver. The soon to be available linsysfs will use it to fill in the driver name. Linux_stat uses it to translate the major/minor into Linux type values. Note major numbers are dynamically assigned via passing in a -1 for the major number so we don't need to keep track of them. This is somewhat needed due to us switching to our devfs. MegaCli will not run until I add in the linsysfs and mfi Linux compat changes. Sponsored by: IronPort Systems
* Fix tinderbox on alpha.netchild2006-03-201-0/+2
| | | | Tested by: cross-compile
* Unbreak COMPAT_LINUX32 option support on amd64.ru2006-03-191-0/+1
| | | | Broken by: netchild
* Fixup some problems in my previous commit (COMPAT_43).netchild2006-03-181-1/+0
| | | | Pointyhat to: netchild
* Get rid of the need of COMPAT_43 in the linuxolator.netchild2006-03-181-2/+60
| | | | | Submitted by: Divacky Roman <xdivac02@stud.fit.vutbr.cz> Obtained from: DragonFly (some parts)
* - Remove ifdef disabled code that doesn't have a chance of working anymore.jeff2006-02-061-48/+0
|
* Fix a typo : deivce => devicecognet2006-01-261-1/+1
| | | | Spotted by: rwatson
* Linux compat bits needed to make linux programs use the new ptys :cognet2006-01-261-0/+22
| | | | | | | | | | linux_ioctl.[ch] : Implement LINUX_TIOCGPTN, which returns the pty number linux_stats.c : - Return the magic number for devfs. - In various stats()-related functions, check that we're stating a file in /dev/pts, and if so, change the st_rdev field to match what linux expects to be there for a slave pty device. The glibc checks for this, and their openpty() fails if it is no correct.
* Actually only protect mount-point if security.jail.enforce_statfs is set to 2.pjd2005-06-231-3/+0
| | | | | | | If we don't return statistics about requested file systems, system tools may not work correctly or at all. Approved by: re (scottl)
* Rename sysctl security.jail.getfsstatroot_only to security.jail.enforce_statfspjd2005-06-091-2/+3
| | | | | | | | | | | | | | | and extend its functionality: value policy 0 show all mount-points without any restrictions 1 show only mount-points below jail's chroot and show only part of the mount-point's path (if jail's chroot directory is /jails/foo and mount-point is /jails/foo/usr/home only /usr/home will be shown) 2 show only mount-point where jail's chroot directory is placed. Default value is 2. Discussed with: rwatson
* Remove (now) unused argument 'td' from bsd_to_linux_statfs().pjd2005-05-271-4/+3
|
* The code is under '#ifdef not_that_way', but anyway:pjd2005-05-221-0/+3
| | | | - Add missing prison_check_mount() check.
* If we need to hide fsid, kern_statfs()/kern_fstatfs() will do it for us,pjd2005-05-221-7/+2
| | | | | | | | | so do not duplicate the code in cvtstatfs(). Note, that we now need to clear fsid in freebsd4_getfsstat(). This moves all security related checks from functions like cvtstatfs() and will allow to add more security related stuff (like statfs(2), etc. protection for jails) a bit easier.
* Neuter the duplicated disk-device magic code for now. Somebody withphk2005-03-151-41/+32
| | | | serious linux-clue is necessary to fix this properly.
* Neuter linux_ustat() until somebody finds time to try to fix it.phk2005-02-221-4/+9
| | | | | | | | | | | | | | | The fundamental problem is that we get only the lower 8 bits of the minor device number so there is no guarantee that we can actually find the disk device in question at all. This was probably a bigger issue pre-GEOM where the upper bits signaled which slice were in use. The secondary problem is how we get from (partial) dev_t to vnode. The correct implementation will involve traversing the mount list looking for a perfect match or a possible match (for truncated minor).
* - Use kern_{l,f,}stat() and kern_{f,}statfs() functions rather thanjhb2005-02-071-132/+39
| | | | | | duplicating the contents of the same functions inline. - Consolidate common code to convert a BSD statfs struct to a Linux struct into a static worker function.
* Match the LINUX32's style with existing styleobrien2005-01-141-6/+6
| | | | | | Submitted by: Jung-uk Kim <jkim@niksun.com> Use positive, not negative logic.
* Hold thread reference while frobbing cdevsw.phk2004-09-241-18/+24
|
* Changes to MI Linux emulation code necessary to run 32-bit Linux binariestjr2004-08-161-2/+9
| | | | | | | | | | | | | | | 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.
* Add XXX comment about findcdev() misuse.phk2004-08-141-0/+6
|
* Second half of the dev_t cleanup.phk2004-06-171-4/+4
| | | | | | | | | | | The big lines are: NODEV -> NULL NOUDEV -> NODEV udev_t -> dev_t udev2dev() -> findcdev() Various minor adjustments including handling of userland access to kernel space struct cdev etc.
* Do the dreaded s/dev_t/struct cdev */phk2004-06-161-6/+6
| | | | Bump __FreeBSD_version accordingly.
* Remove unused second arg to vfinddev().phk2004-03-111-1/+1
| | | | Don't call addaliasu() on VBLK nodes.
* Device megapatch 5/6:phk2004-02-211-4/+4
| | | | | | | | | | | | Remove the unused second argument from udev2dev(). Convert all remaining users of makedev() to use udev2dev(). The semantic difference is that udev2dev() will only locate a pre-existing dev_t, it will not line makedev() create a new one. Apart from the tiny well controlled windown in D_PSEUDO drivers, there should no longer be any "anonymous" dev_t's in the system now, only dev_t's created with make_dev() and make_dev_alias()
* Prevent leaking of fsid to non-root users in linux_statfs and linux_fstatfs.anholt2003-11-051-4/+14
| | | | | | | | Matches native syscalls now. PR: kern/58793 Submitted by: David P. Reese Jr. <daver@gomerbud.com> MFC after: 1 week
* Add a f_vnode field to struct file.phk2003-06-221-1/+1
| | | | | | | | | | | | Several of the subtypes have an associated vnode which is used for stuff like the f*() functions. By giving the vnode a speparate field, a number of checks for the specific subtype can be replaced simply with a check for f_vnode != NULL, and we can later free f_data up to subtype specific use. At this point in time, f_data still points to the vnode, so any code I might have overlooked will still work.
* Use __FBSDID().obrien2003-06-101-2/+3
|
* Initialize tbuf in newstat_copyout() too.mbr2003-04-291-0/+1
| | | | Reviewed by: phk
* Do the same thing for stat64_copyout() as we alreadymbr2003-04-291-0/+19
| | | | | | | | | | | | do for newstat_copyout(). Lie about disk drives which are character devices in FreeBSD but block devices under Linux. PR: 37227 Submitted by: Vladimir B. Grebenschikov <vova@sw.ru> Reviewed by: phk MFC after: 2 weeks
* Use td->td_ucred instead of td->td_proc->p_ucred.jhb2003-03-201-4/+3
|
* Clean up whitespace and remove register keyword.des2003-03-031-6/+6
|
* More caddr_t removal, in conjunction with copy{in,out}(9) this time.des2003-03-031-4/+2
| | | | Also clean up some egregious casts and incorrect use of sizeof.
* Bow to the whining masses and change a union back into void *. Retaindillon2003-01-131-1/+1
| | | | | removal of unnecessary casts and throw in some minor cleanups to see if anyone complains, just for the hell of it.
* Change struct file f_data to un_data, a union of the correct structdillon2003-01-121-1/+1
| | | | | | | | | | pointer types, and remove a huge number of casts from code using it. Change struct xfile xf_data to xun_data (ABI is still compatible). If we need to add a #define for f_data and xf_data we can, but I don't think it will be necessary. There are no operational changes in this commit.
* Include <sys/malloc.h> instead of depending on namespace pollution 2bde2002-09-051-1/+2
| | | | | | layers deep in <sys/proc.h> or <sys/vnode.h>. Removed unused includes. Sorted includes.
* Use the new kern_* functions to avoid the need to store argumentsiedowse2002-09-011-28/+27
| | | | | | | | in the stack gap. This converts most VFS and signal related system calls, as well as select(). Discussed on: -arch Approved by: marcel
* Make similar changes to fo_stat() and fo_poll() as made earlier torwatson2002-08-161-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fo_read() and fo_write(): explicitly use the cred argument to fo_poll() as "active_cred" using the passed file descriptor's f_cred reference to provide access to the file credential. Add an active_cred argument to fo_stat() so that implementers have access to the active credential as well as the file credential. Generally modify callers of fo_stat() to pass in td->td_ucred rather than fp->f_cred, which was redundantly provided via the fp argument. This set of modifications also permits threads to perform these operations on behalf of another thread without modifying their credential. Trickle this change down into fo_stat/poll() implementations: - badfo_poll(), badfo_stat(): modify/add arguments. - kqueue_poll(), kqueue_stat(): modify arguments. - pipe_poll(), pipe_stat(): modify/add arguments, pass active_cred to MAC checks rather than td->td_ucred. - soo_poll(), soo_stat(): modify/add arguments, pass fp->f_cred rather than cred to pru_sopoll() to maintain current semantics. - sopoll(): moidfy arguments. - vn_poll(), vn_statfile(): modify/add arguments, pass new arguments to vn_stat(). Pass active_cred to MAC and fp->f_cred to VOP_POLL() to maintian current semantics. - vn_close(): rename cred to file_cred to reflect reality while I'm here. - vn_stat(): Add active_cred and file_cred arguments to vn_stat() and consumers so that this distinction is maintained at the VFS as well as 'struct file' layer. Pass active_cred instead of td->td_ucred to MAC and to VOP_GETATTR() to maintain current semantics. - fifofs: modify the creation of a "filetemp" so that the file credential is properly initialized and can be used in the socket code if desired. Pass ap->a_td->td_ucred as the active credential to soo_poll(). If we teach the vnop interface about the distinction between file and active credentials, we would use the active credential here. Note that current inconsistent passing of active_cred vs. file_cred to VOP's is maintained. It's not clear why GETATTR would be authorized using active_cred while POLL would be authorized using file_cred at the file system level. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Another fix that wasn't pulled in from the MAC branch: therwatson2002-08-121-1/+2
| | | | | | | | struct mount is not cached as *mp at this point, so use vp->v_mount directly, following the check that it's non-NULL. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Introduce support for Mandatory Access Control and extensiblerwatson2002-08-011-0/+20
| | | | | | | | | | | | kernel access control. Invoke appropriate MAC entry points for a number of VFS-related operations in the Linux ABI module. In particular, handle uselib in a manner similar to open() (more work is probably needed here), as well as handle statfs(), and linux readdir()-like calls. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Fix typo in the BSD copyright: s/withough/without/schweikh2002-06-021-1/+1
| | | | | Spotted and suggested by: des MFC after: 3 weeks
* Replace ffind_* with fget calls.alfred2002-01-141-3/+2
| | | | | | | | Make fget MPsafe. Make fgetvp and fgetsock use the fget subsystem to reduce code bloat. Push giant down in fpathconf().
* SMP Lock struct file, filedesc and the global file list.alfred2002-01-131-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix abuse of vtagtype. In addition, after this the linux programs will besobomax2001-09-191-32/+20
| | | | | | | able correctly distinguish ext2fs from the ufs filesystem (previously ext2fs was indistinguishable from the ufs). Reviewed by: phk, marcel
OpenPOWER on IntegriCloud