summaryrefslogtreecommitdiffstats
path: root/sys/compat
Commit message (Collapse)AuthorAgeFilesLines
...
* linux_map_osrel doesn't need to be checked in linux_prison_set,jamie2016-04-251-8/+5
| | | | since it already was in linux_prison_check.
* Allow to build svr4 module with SYSV support separatelly from the kernel build.dchagin2016-04-231-25/+4
| | | | | | PR: 208464 Reported by: Kristoffer Eriksson MFC after: 2 week
* Fix streams and svr4 module dependency. Both modules are complaining aboutdchagin2016-04-232-1/+15
| | | | | | | | | | undefined symbol svr4_delete_socket which was moved from streams to the svr4 module in r160558 that created a two-way dependency between them. PR: 208464 Submitted by: Kristoffer Eriksson Reported by: Kristoffer Eriksson MFC after: 2 week
* Cleanup redundant parenthesis from existing howmany()/roundup() macro uses.pfg2016-04-221-3/+2
|
* linprocfs_doproclimits: Initialize error return before usecem2016-04-201-0/+2
| | | | | | Reported by: Coverity CID: 1354623 Sponsored by: EMC / Isilon Storage Division
* linprocfs: Don't print uninitialized valuescem2016-04-201-2/+3
| | | | | | Reported by: Coverity CID: 1354624 Sponsored by: EMC / Isilon Storage Division
* kernel: use our nitems() macro when it is available through param.h.pfg2016-04-191-1/+1
| | | | | | No functional change, only trivial cases are done in this sweep, Discussed in: freebsd-current
* compat/linux: for pointers replace 0 with NULL.pfg2016-04-151-1/+1
| | | | | | plvc is a pointer, no functional change. Found with devel/coccinelle.
* Cleanup unnecessary semicolons from the kernel.pfg2016-04-101-1/+1
| | | | Found with devel/coccinelle.
* More complete implementation of /proc/self/limits.dchagin2016-04-102-42/+76
| | | | | | | | Fix the way the code accesses process limits struct - pointed out by mjg@. PR: 207386 Reviewed by: no objection form des@ MFC after: 3 weeks
* Make CloudABI's way of doing TLS more friendly to userspace emulators.ed2016-04-063-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're currently seeing how hard it would be to run CloudABI binaries on operating systems cannot be modified easily (Windows, Mac OS X). The idea is that we want to just run them without any sandboxing. Now that CloudABI executables are PIE, this is already a bit easier, but TLS is still problematic: - CloudABI executables want to write to the %fs, which typically requires extra system calls by the emulator every time it needs to switch between CloudABI's and its own TLS. - If CloudABI executables overwrite the %fs base unconditionally, it also becomes harder for the emulator to store a backup of the old value of %fs. To solve this, let's no longer overwrite %fs, but just %fs:0. As CloudABI's C library does not use a TCB, this space can now be used by an emulator to keep track of its internal state. The executable can now safely overwrite %fs:0, as long as it makes sure that the TCB is copied over to the new TLS area. Ensure that there is an initial TLS area set up when the process starts, only containing a bogus TCB. We don't really care about its contents on FreeBSD. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D5836
* Fix indentation oops.pfg2016-04-031-3/+3
|
* Move Linux specific times tests up to guarantee the values are defined.dchagin2016-04-031-2/+3
| | | | | | CID: 1305178 Submitted by: pfg@ MFC after: 1 week
* tcp/lro: Change SLIST to LIST, so that removing an entry is O(1)sephe2016-04-011-0/+1
| | | | | | | | | This is kinda critical to the performance when the CPU is slow and network bandwidth is high, e.g. in the hypervisor. Reviewed by: rrs, gallatin, Dexuan Cui <decui microsoft com> Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D5765
* Make Position Independent Executables work for CloudABI.ed2016-03-311-0/+1
| | | | | | | - Set BI_CAN_EXEC_DYN, so we can execute ET_DYN ELF files in addition to regular ET_EXECs. - Provide an AT_BASE entry in the auxiliary vector, so the executable knows at which address it got loaded and can apply relocations.
* Regenerate system call table after r297468.ed2016-03-314-7/+7
|
* Sync in the latest CloudABI system call definitions.ed2016-03-313-20/+20
| | | | | | | | | | | | | | Some time ago I made a change to merge together the memory scope definitions used by mmap (MAP_{PRIVATE,SHARED}) and lock objects (PTHREAD_PROCESS_{PRIVATE,SHARED}). Though that sounded pretty smart back then, it's backfiring. In the case of mmap it's used with other flags in a bitmask, but for locking it's an enumeration. As our plan is to automatically generate bindings for other languages, that looks a bit sloppy. Change all of the locking functions to use separate flags instead. Obtained from: https://github.com/NuxiNL/cloudabi
* Add wait_event_interruptible_timeout to linuxkpi.np2016-03-313-10/+57
| | | | | | | Submitted by: Krishnamraju Eraparaju @ Chelsio Reviewed by: hselasky@ Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D5776
* Fix bugs in currently unused bit searching loop.hselasky2016-03-311-2/+2
| | | | | MFC after: 3 days Sponsored by: Mellanox Technologies
* Use osd_reserve / osd_jail_set_reserved, which is known to succeed.jamie2016-03-301-31/+16
| | | | Also don't work around nonexistent osd_register failure.
* The sendfile(2) allows to send extra data from userspace before the fileglebius2016-03-291-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | data (headers). Historically the size of the headers was not checked against the socket buffer space. Application could easily overcommit the socket buffer space. With the new sendfile (r293439) the problem remained, but a KASSERT was inserted that checked that amount of data written to the socket matches its space. In case when size of headers is bigger that socket space, KASSERT fires. Without INVARIANTS the new sendfile won't panic, but would report incorrect amount of bytes sent. o With this change, the headers copyin is moved down into the cycle, after the sbspace() check. The uio size is trimmed by socket space there, which fixes the overcommit problem and its consequences. o The compatibility handling for FreeBSD 4 sendfile headers API is pushed up the stack to syscall wrappers. This required a copy and paste of the code, but in turn this allowed to remove extra stack carried parameter from fo_sendfile_t, and embrace entire compat code into #ifdef. If in future we got more fo_sendfile_t function, the copy and paste level would even reduce. Reviewed by: emax, gallatin, Maxim Dounin <mdounin mdounin.ru> Tested by: Vitalij Satanivskij <satan ukr.net> Sponsored by: Netflix
* Revert r297310 as the SOL_XXX are equal to the IPPROTO_XX except SOL_SOCKET.dchagin2016-03-271-2/+0
| | | | Pointed out by: ae@
* iConvert Linux SOL_IPV6 level.dchagin2016-03-271-0/+2
| | | | MFC after: 1 week
* Whitespaces and style(9) fix. No functional changes.dchagin2016-03-271-29/+11
| | | | MFC after: 1 week
* When write(2) on eventfd object fails with the error EAGAIN do not returndchagin2016-03-261-0/+2
| | | | | | the number of bytes written. MFC after: 1 week
* Implement O_NONBLOCK flag via fcntl(F_SETFL) for eventfd object.dchagin2016-03-261-1/+18
| | | | MFC after: 1 week
* Regenerate system call table after r297247.ed2016-03-244-23/+23
|
* Replace the CloudABI system call table by a machine generated version.ed2016-03-2422-388/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The type definitions and constants that were used by COMPAT_CLOUDABI64 are a literal copy of some headers stored inside of CloudABI's C library, cloudlibc. What is annoying is that we can't make use of cloudlibc's system call list, as the format is completely different and doesn't provide enough information. It had to be synced in manually. We recently decided to solve this (and some other problems) by moving the ABI definitions into a separate file: https://github.com/NuxiNL/cloudabi/blob/master/cloudabi.txt This file is processed by a pile of Python scripts to generate the header files like before, documentation (markdown), but in our case more importantly: a FreeBSD system call table. This change discards the old files in sys/contrib/cloudabi and replaces them by the latest copies, which requires some minor changes here and there. Because cloudabi.txt also enforces consistent names of the system call arguments, we have to patch up a small number of system call implementations to use the new argument names. The new header files can also be included directly in FreeBSD kernel space without needing any includes/defines, so we can now remove cloudabi_syscalldefs.h and cloudabi64_syscalldefs.h. Patch up the sources to include the definitions directly from sys/contrib/cloudabi instead.
* Check bsd_to_linux_statfs() return value. Forgotten in r297070.dchagin2016-03-201-3/+7
| | | | MFC after: 1 week
* Return EOVERFLOW in case when actual statfs values are large enough anddchagin2016-03-201-1/+15
| | | | | | | not fit into 32 bit fileds of a Linux struct statfs. PR: 181012 MFC after: 1 week
* Whitespaces, style(9) fixes. No functional changes.dchagin2016-03-201-6/+6
| | | | MFC after: 1 week
* Implement fstatfs64 system call.dchagin2016-03-201-0/+21
| | | | | | PR: 181012 Submitted by: John Wehle MFC after: 1 week
* Rework r296543:dchagin2016-03-201-18/+19
| | | | | | | | | | | | | 1. Limit secs to INT32_MAX / 2 to avoid errors from kern_setitimer(). Assert that kern_setitimer() returns 0. Remove bogus cast of secs. Fix style(9) issues. 2. Increment the return value if the remaining tv_usec value more than 500000 as a Linux does. Pointed out by: [1] Bruce Evans MFC after: 1 week
* Use uintmax_t (typedef'd to rman_res_t type) for rman ranges.jhibbits2016-03-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On some architectures, u_long isn't large enough for resource definitions. Particularly, powerpc and arm allow 36-bit (or larger) physical addresses, but type `long' is only 32-bit. This extends rman's resources to uintmax_t. With this change, any resource can feasibly be placed anywhere in physical memory (within the constraints of the driver). Why uintmax_t and not something machine dependent, or uint64_t? Though it's possible for uintmax_t to grow, it's highly unlikely it will become 128-bit on 32-bit architectures. 64-bit architectures should have plenty of RAM to absorb the increase on resource sizes if and when this occurs, and the number of resources on memory-constrained systems should be sufficiently small as to not pose a drastic overhead. That being said, uintmax_t was chosen for source clarity. If it's specified as uint64_t, all printf()-like calls would either need casts to uintmax_t, or be littered with PRI*64 macros. Casts to uintmax_t aren't horrible, but it would also bake into the API for resource_list_print_type() either a hidden assumption that entries get cast to uintmax_t for printing, or these calls would need the PRI*64 macros. Since source code is meant to be read more often than written, I chose the clearest path of simply using uintmax_t. Tested on a PowerPC p5020-based board, which places all device resources in 0xfxxxxxxxx, and has 8GB RAM. Regression tested on qemu-system-i386 Regression tested on qemu-system-mips (malta profile) Tested PAE and devinfo on virtualbox (live CD) Special thanks to bz for his testing on ARM. Reviewed By: bz, jhb (previous) Relnotes: Yes Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D4544
* Regen.jhb2016-03-121-16/+16
|
* Regen.jhb2016-03-095-133/+49
|
* Simplify AIO initialization now that it is standard.jhb2016-03-091-14/+14
| | | | | | | | | | | | | | | - Mark AIO system calls as STD and remove the helpers to dynamically register them. - Use COMPAT6 for the old system calls with the older sigevent instead of an 'o' prefix. - Simplify the POSIX configuration to note that AIO is always available. - Handle AIO in the default VOP_PATHCONF instead of special casing it in the pathconf() system call. fpathconf() is still hackish. - Remove freebsd32_aio_cancel() as it just called the native one directly. Reviewed by: kib Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D5589
* Add support for IPPROTO_IPV6 socket layer for getsockopt/setsockopt calls.ae2016-03-092-0/+88
| | | | | | | | Also add mapping for several options from RFC 3493 and 3542. Reviewed by: dchagin Tested by: Joe Love <joe at getsomwhere dot net> MFC after: 2 weeks
* Better english.dchagin2016-03-081-1/+1
| | | | | Submitted by: Kevin P. Neal MFC after: 1 week
* Put a commit message from r296502 about Linux alarm() system calldchagin2016-03-081-0/+5
| | | | | | | | behaviour to the source. Suggested by: emaste@ MFC after: 1 week
* Does not leak fp. While here remove bogus cast of fp->f_data.dchagin2016-03-081-2/+5
| | | | MFC after: 1 week
* Linux accept() system call return EOPNOTSUPP errno instead of EINVALdchagin2016-03-081-1/+12
| | | | | | for UDP sockets. MFC after: 1 week
* According to POSIX and Linux implementation the alarm() system calldchagin2016-03-081-4/+1
| | | | | | | | | | is always successfull. So, ignore any errors and return 0 as a Linux do. XXX. Unlike POSIX, Linux in case when the invalid seconds value specified always return 0, so in that case Linux does not return proper remining time. MFC after: 1 week
* Link the newly created process to the corresponding parent asdchagin2016-03-081-0/+12
| | | | | | | if CLONE_PARENT is set, then the parent of the new process will be the same as that of the calling process. MFC after: 1 week
* Run the LinuxKPI PCI shutdown handler free of the Giant mutex.hselasky2016-03-071-2/+5
| | | | | MFC after: 1 week Sponsored by: Mellanox Technologies
* Add more functions to the LinuxKPI.hselasky2016-03-034-3/+16
| | | | | | | | Define strnicmp as a function macro instead of a regular macro while at it. MFC after: 1 week Sponsored by: Mellanox Technologies
* Improve error handling for posix_fallocate(2) and posix_fadvise(2).markj2016-02-251-6/+7
| | | | | | | | | | | - Set td_errno so that ktrace and dtrace can obtain the syscall error number in the usual way. - Pass negative error numbers directly to the syscall layer, as they're not intended to be returned to userland. Reviewed by: kib Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D5425
* Call cap_rights_init() properly.ed2016-02-241-1/+1
| | | | | Even though or'ing the individual rights works in this specific case, it may not work in general. Pass them in as varargs.
* Make handling of mmap()'s prot argument more strict.ed2016-02-231-9/+27
| | | | | | | | | - Make the system call fail if prot contains bits other than read, write and exec. - Similar to OpenBSD's W^X, don't allow write and exec to be set at the same time. I'd like to see for now what happens if we enforce this policy unconditionally. If it turns out that this is far too strict, we'll loosen this requirement.
* As <machine/vmparam.h> is included from <vm/vm_param.h>, there is noskra2016-02-223-3/+0
| | | | | | | | need to include it explicitly when <vm/vm_param.h> is already included. Suggested by: alc Reviewed by: alc Differential Revision: https://reviews.freebsd.org/D5379
OpenPOWER on IntegriCloud