summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux/linux_stats.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r297063:dchagin2016-03-271-10/+28
| | | | | | | | | | | | Whitespaces, style(9) fixes. No functional changes. MFC r297070: Return EOVERFLOW in case when actual statfs values are large enough and not fit into 32 bit fileds of a Linux struct statfs. MFC r297072: Check bsd_to_linux_statfs() return value.
* MFC r297061;dchagin2016-03-271-0/+21
| | | | | | | Implement fstatfs64 system call. PR: 181012 Submitted by: John Wehle
* MFC r283492:dchagin2016-01-091-0/+41
| | | | Implement Linux specific syncfs() system call.
* MFC r283461:dchagin2016-01-091-8/+3
| | | | | | As for now our tmpfs is no longer being considered "highly experimental" remove /dev/shm magic commited in r218497 and convert tmpfs type to an expected magic number.
* MFC r283420:dchagin2016-01-091-0/+30
| | | | Add newfstatat system call for 64-bit Linuxulator.
* MFC r283419:dchagin2016-01-091-1/+1
| | | | Fix compilation with -DDEBUG option.
* MFC r283415:dchagin2016-01-091-0/+4
| | | | Disable i386 call for x86-64 Linux.
* MFC r283412:dchagin2016-01-091-10/+9
| | | | | | Get ready to commit x86_64 Linux emulation. All fields of type l_int in struct statfs are defined as l_long on i386 and amd64.
* Remove direct access to si_name.ed2012-02-101-3/+3
| | | | | | | | Code should just use the devtoname() function to obtain the name of a character device. Also add const keywords to pieces of code that need it to build properly. MFC after: 2 weeks
* Convert files to UTF-8uqs2012-01-151-1/+1
|
* Second-to-last commit implementing Capsicum capabilities in the FreeBSDrwatson2011-08-111-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | kernel for FreeBSD 9.0: Add a new capability mask argument to fget(9) and friends, allowing system call code to declare what capabilities are required when an integer file descriptor is converted into an in-kernel struct file *. With options CAPABILITIES compiled into the kernel, this enforces capability protection; without, this change is effectively a no-op. Some cases require special handling, such as mmap(2), which must preserve information about the maximum rights at the time of mapping in the memory map so that they can later be enforced in mprotect(2) -- this is done by narrowing the rights in the existing max_protection field used for similar purposes with file permissions. In namei(9), we assert that the code is not reached from within capability mode, as we're not yet ready to enforce namespace capabilities there. This will follow in a later commit. Update two capability names: CAP_EVENT and CAP_KEVENT become CAP_POST_KEVENT and CAP_POLL_KEVENT to more accurately indicate what they represent. Approved by: re (bz) Submitted by: jonathan Sponsored by: Google Inc
* Linux' shm_open() fails because it wants to find some funky shmfsnetchild2011-02-091-1/+9
| | | | | | | | | | | | | | | | | | | | to construct the full pathname. It starts to search at the default mountpoint which is /dev/shm. If this fails it runs through fstab and searches for shmfs and tmpfs. Whatever it finds will be statfs()'ed to be checked for Linux' fs magic for shmfs (0x01021994). Ideally our tmpfs should deliver this fs magic to Linux processes, but as our tmpfs is considered to be an experimental feature we can not assume that there is always a tmpfs available. To make shared memory work in the Linuxulator, force the fs type of /dev/shm (which can be a symlink) to match what Linux expects. The user is responsible (info has to be added to the linux base ports and the docs) to setup a suitable link for /dev/shm. Noticed by: Andre Albsmeier <Andre.Albsmeier@siemens.com> Submitted by: Andre Albsmeier <Andre.Albsmeier@siemens.com> MFC after: 1 month
* Rename st_*timespec fields to st_*tim for POSIX 2008 compliance.ed2010-03-281-9/+18
| | | | | | | | | | | | | | | A nice thing about POSIX 2008 is that it finally standardizes a way to obtain file access/modification/change times in sub-second precision, namely using struct timespec, which we already have for a very long time. Unfortunately POSIX uses different names. This commit adds compatibility macros, so existing code should still build properly. Also change all source code in the kernel to work without any of the compatibility macros. This makes it all a less ambiguous. I am also renaming st_birthtime to st_birthtim, even though it was a local extension anyway. It seems Cygwin also has a st_birthtim.
* No need to include security/mac/mac_framework.h here.pjd2010-02-181-2/+0
|
* Move "options MAC" from opt_mac.h to opt_global.h, as it's now in GENERICrwatson2009-06-051-1/+0
| | | | | | | | and used in a large number of files, but also because an increasing number of incorrect uses of MAC calls were sneaking in due to copy-and-paste of MAC-aware code without the associated opt_mac.h include. Discussed with: pjd
* Move the per-prison Linux MIB from a private one-off pointer to the newjamie2009-05-071-1/+0
| | | | | | | | | OSD-based jail extensions. This allows the Linux MIB to accessed via jail_set and jail_get, and serves as a demonstration of adding jail support to a module. Reviewed by: dchagin, kib Approved by: bz (mentor)
* Don't make Linux stat() open character devices to resolve its name.ed2009-02-201-47/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The existing code calls kern_open() to resolve the vnode of a pathname right after a stat(). This is not correct, because it causes random character devices to be opened in /dev. This means ls'ing a tape streamer will cause it to rewind, for example. Changes I have made: - Add kern_statat_vnhook() to allow binary emulators to `post-process' struct stat, using the proper vnode. - Remove unneeded printf's from stat() and statfs(). - Make the Linuxolator use kern_statat_vnhook(), replacing translate_path_major_minor_at(). - Let translate_fd_major_minor() use vp->v_rdev instead of vp->v_un.vu_cdev. Result: crw-rw-rw- 1 root root 0, 14 Feb 20 13:54 /dev/ptmx crw--w---- 1 root adm 136, 0 Feb 20 14:03 /dev/pts/0 crw--w---- 1 root adm 136, 1 Feb 20 14:02 /dev/pts/1 crw--w---- 1 ed tty 136, 2 Feb 20 14:03 /dev/pts/2 Before this commit, ptmx also had a major number of 136, because it silently allocated and deallocated a pseudo-terminal. Device nodes that cannot be opened now have proper major/minor-numbers. Reviewed by: kib, netchild, rdivacky (thanks!)
* Last step of splitting up minor and unit numbers: remove minor().ed2009-01-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | Inside the kernel, the minor() function was responsible for obtaining the device minor number of a character device. Because we made device numbers dynamically allocated and independent of the unit number passed to make_dev() a long time ago, it was actually a misnomer. If you really want to obtain the device number, you should use dev2udev(). We already converted all the drivers to use dev2unit() to obtain the device unit number, which is still used by a lot of drivers. I've noticed not a single driver passes NULL to dev2unit(). Even if they would, its behaviour would make little sense. This is why I've removed the NULL check. Ths commit removes minor(), minor2unit() and unit2minor() from the kernel. Because there was a naming collision with uminor(), we can rename umajor() and uminor() back to major() and minor(). This means that the makedev(3) manual page also applies to kernel space code now. I suspect umajor() and uminor() isn't used that often in external code, but to make it easier for other parties to port their code, I've increased __FreeBSD_version to 800062.
* Integrate the new MPSAFE TTY layer to the FreeBSD operating system.ed2008-08-201-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The last half year I've been working on a replacement TTY layer for the FreeBSD kernel. The new TTY layer was designed to improve the following: - Improved driver model: The old TTY layer has a driver model that is not abstract enough to make it friendly to use. A good example is the output path, where the device drivers directly access the output buffers. This means that an in-kernel PPP implementation must always convert network buffers into TTY buffers. If a PPP implementation would be built on top of the new TTY layer (still needs a hooks layer, though), it would allow the PPP implementation to directly hand the data to the TTY driver. - Improved hotplugging: With the old TTY layer, it isn't entirely safe to destroy TTY's from the system. This implementation has a two-step destructing design, where the driver first abandons the TTY. After all threads have left the TTY, the TTY layer calls a routine in the driver, which can be used to free resources (unit numbers, etc). The pts(4) driver also implements this feature, which means posix_openpt() will now return PTY's that are created on the fly. - Improved performance: One of the major improvements is the per-TTY mutex, which is expected to improve scalability when compared to the old Giant locking. Another change is the unbuffered copying to userspace, which is both used on TTY device nodes and PTY masters. Upgrading should be quite straightforward. Unlike previous versions, existing kernel configuration files do not need to be changed, except when they reference device drivers that are listed in UPDATING. Obtained from: //depot/projects/mpsafetty/... Approved by: philip (ex-mentor) Discussed: on the lists, at BSDCan, at the DevSummit Sponsored by: Snow B.V., the Netherlands dcons(4) fixed by: kan
* Push down the major/minor conversion for pts/%u to improve consistency.ed2008-06-021-26/+4
| | | | | | | | | | | | | | | | | | In the mpsafetty branch, Linux sshd seems to work properly inside a jail. Some small modifications had to be made to the Linux compatibility layer. The Linux PTY routines always expect the device major number to be 136 or higher. Our code always set the major/minor number pair to 136:0. This makes routines like ttyname() and ptsname() fail, because we'll end up having ambiguous device numbers. The conversion was not performed on all *stat() routines, which meant in some cases the numbers didn't get transformed. By pushing the conversion into linux_driver_get_major_minor(), the transformation will take place on all calls. Approved by: philip (mentor), rdivacky
* Implement the linux syscallskib2008-04-081-3/+40
| | | | | | | | | openat, mkdirat, mknodat, fchownat, futimesat, fstatat, unlinkat, renameat, linkat, symlinkat, readlinkat, fchmodat, faccessat. Submitted by: rdivacky Sponsored by: Google Summer of Code 2007 Tested by: pho
* After applying LCONVPATH() to the path, do use the converted pathkib2008-01-051-9/+13
| | | | | | | | instead of original user-mode string in the linux_stat() and linux_lstat() syscalls. Tested by: Peter Holm MFC after: 3 days
* Apply the LCONVPATH() to the (old) linux_stat() and linux_lstat() syscalls.kib2007-12-291-3/+12
| | | | | | | | | | | | Without it, code has two problems: - behaviour of the old and new [l]stat are different with regard of the /compat/linux - directly accessing the userspace data from the kernel asks for the panics. Reported and tested by: Peter Holm Reviewed by: rdivacky MFC after: 3 days
* The kernel version of Linux statfs64 is actually supposed to takedwmalone2007-09-181-13/+3
| | | | | | | | | | | | | 3 arguments, but we had forgotten the second argument. Also make the Linux statfs64 struct depend on the architecture because it has an extra 4 bytes padding on amd64 compared to i386. The three argument fix is from David Taylor, the struct statfs64 stuff is my fault. With this patch I can install i386 Linux matlab on an amd64 machine. Submitted by: David Taylor <davidt_at_yadt.co.uk> Approved by: re (kensmith)
* 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.
OpenPOWER on IntegriCloud