summaryrefslogtreecommitdiffstats
path: root/sys/compat
Commit message (Collapse)AuthorAgeFilesLines
* Regen for r276654 (__getcwd()).dchagin2015-01-045-6/+6
|
* Indeed, instead of hiding the kern___getcwd() bug by bogus castdchagin2015-01-042-5/+5
| | | | | | | | | | | | | | | | | in r276564, change path type to char * (pathnames are always char *). And remove bogus casts of malloc(). kern___getcwd() internally doesn't actually use or support u_char * paths, except to copy them to a normal char * path. These changes are not visible to libc as libc/gen/getcwd.c misdeclares __getcwd() as taking a plain char * path. While here remove _SYS_SYSPROTO_H_ for __getcwd() syscall as we always have sysproto.h. Pointed out by: bde MFC after: 1 week
* Cast *path to silence clang -Wpointer-sign warning.dchagin2015-01-021-1/+1
| | | | MFC after: 1 week
* Remove Giant from linux_getcwd() due to VFS is MPSAFE now.dchagin2015-01-021-3/+0
| | | | | Discussed with: kib MFC after: 1 week
* Fix Clang -Wpointer-sign warnings.dchagin2015-01-011-2/+3
| | | | MFC after: 1 week
* Fix Clang warning: passing 'unsigned int *' to parameter of type 'int *' ↵dchagin2015-01-011-4/+5
| | | | | | converts between pointers to integer types with different sign. MFC after: 1 week
* Adjust printf format specifiers for dev_t and ino_t in kernel.gleb2014-12-172-8/+11
| | | | | | ino_t and dev_t are about to become uint64_t. Reviewed by: kib, mckusick
* Add a facility for non-init process to declare itself the reaper ofkib2014-12-152-4/+53
| | | | | | | | | | | the orphaned descendants. Base of the API is modelled after the same feature from the DragonFlyBSD. Requested by: bapt Reviewed by: jilles (previous version) Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 3 weeks
* The process spin lock currently has the following distinct uses:kib2014-11-262-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Threads lifetime cycle, in particular, counting of the threads in the process, and interlocking with process mutex and thread lock. The main reason of this is that turnstile locks are after thread locks, so you e.g. cannot unlock blockable mutex (think process mutex) while owning thread lock. - Virtual and profiling itimers, since the timers activation is done from the clock interrupt context. Replace the p_slock by p_itimmtx and PROC_ITIMLOCK(). - Profiling code (profil(2)), for similar reason. Replace the p_slock by p_profmtx and PROC_PROFLOCK(). - Resource usage accounting. Need for the spinlock there is subtle, my understanding is that spinlock blocks context switching for the current thread, which prevents td_runtime and similar fields from changing (updates are done at the mi_switch()). Replace the p_slock by p_statmtx and PROC_STATLOCK(). The split is done mostly for code clarity, and should not affect scalability. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week
* Improve support for XSAVE with debuggers.jhb2014-11-211-2/+18
| | | | | | | | | | | | | | | | | | | - Dump an NT_X86_XSTATE note if XSAVE is in use. This note is designed to match what Linux does in that 1) it dumps the entire XSAVE area including the fxsave state, and 2) it stashes a copy of the current xsave mask in the unused padding between the fxsave state and the xstate header at the same location used by Linux. - Teach readelf() to recognize NT_X86_XSTATE notes. - Change PT_GET/SETXSTATE to take the entire XSAVE state instead of only the extra portion. This avoids having to always make two ptrace() calls to get or set the full XSAVE state. - Add a PT_GET_XSTATE_INFO which returns the length of the current XSTATE save area (so the size of the buffer needed for PT_GETXSTATE) and the current XSAVE mask (%xcr0). Differential Revision: https://reviews.freebsd.org/D1193 Reviewed by: kib MFC after: 2 weeks
* Remove the no-at variants of the kern_xx() syscall helpers. E.g., wekib2014-11-1310-56/+85
| | | | | | | | | | | | have both kern_open() and kern_openat(); change the callers to use kern_openat(). This removes one (sometimes two) levels of indirection and consolidates arguments checks. Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week
* Regen for r274462.dchagin2014-11-135-5/+50
|
* Add the ppoll() system call.dchagin2014-11-132-0/+31
| | | | | | | | Export kern_poll() needed by an upcoming Linuxulator change. Differential Revision: https://reviews.freebsd.org/D1133 Reviewed by: kib, wblock MFC after: 1 month
* Fix build.glebius2014-11-111-0/+2
|
* Remove SF_KQUEUE code. This code was developed at Netflix, but was notglebius2014-11-111-37/+9
| | | | | | | | | | ever used. It didn't go into stable/10, neither was documented. It might be useful, but we collectively decided to remove it, rather leave it abandoned and unmaintained. It is removed in one single commit, so restoring it should be easy, if anyone wants to reopen this idea. Sponsored by: Netflix
* These don't belong in the modules directory.imp2014-11-062-0/+53
|
* Replace some calls to fuword() by fueword() with proper error checking.kib2014-10-281-3/+8
| | | | | | Sponsored by: The FreeBSD Foundation Tested by: pho MFC after: 3 weeks
* Avoid dynamic syscall overhead for statically compiled modules.mjg2014-10-262-10/+17
| | | | | | | | | | | | | The kernel tracks syscall users so that modules can safely unregister them. But if the module is not unloadable or was compiled into the kernel, there is no need to do this. Achieve this by adding SY_THR_STATIC_KLD macro which expands to SY_THR_STATIC during kernel build and 0 otherwise. Reviewed by: kib (previous version) MFC after: 2 weeks
* Fix multiple incorrect SYSCTL arguments in the kernel:hselasky2014-10-211-17/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Wrong integer type was specified. - Wrong or missing "access" specifier. The "access" specifier sometimes included the SYSCTL type, which it should not, except for procedural SYSCTL nodes. - Logical OR where binary OR was expected. - Properly assert the "access" argument passed to all SYSCTL macros, using the CTASSERT macro. This applies to both static- and dynamically created SYSCTLs. - Properly assert the the data type for both static and dynamic SYSCTLs. In the case of static SYSCTLs we only assert that the data pointed to by the SYSCTL data pointer has the correct size, hence there is no easy way to assert types in the C language outside a C-function. - Rewrote some code which doesn't pass a constant "access" specifier when creating dynamic SYSCTL nodes, which is now a requirement. - Updated "EXAMPLES" section in SYSCTL manual page. MFC after: 3 days Sponsored by: Mellanox Technologies
* Update the ULE scheduler + thread and kinfo structs to use int for cpuidadrian2014-10-181-2/+4
| | | | | | | | | | | rather than u_char. To try and play nice with the ABI, the u_char CPU ID values are clamped at 254. The new fields now contain the full CPU ID, or -1 for no cpu. Differential Revision: D955 Reviewed by: jhb, kib Sponsored by: Norse Corp, Inc.
* Regenerate after r272823:marcel2014-10-094-8/+8
| | | | | | | | Move the SCTP syscalls to netinet with the rest of the SCTP code. Submitted by: Steve Kiernan <stevek@juniper.net> Reviewed by: tuexen, rrs Obtained from: Juniper Networks, Inc.
* Move the SCTP syscalls to netinet with the rest of the SCTP code. Themarcel2014-10-091-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | syscalls themselves are tightly coupled with the network stack and therefore should not be in the generic socket code. The following four syscalls have been marked as NOSTD so they can be dynamically registered in sctp_syscalls_init() function: sys_sctp_peeloff sys_sctp_generic_sendmsg sys_sctp_generic_sendmsg_iov sys_sctp_generic_recvmsg The syscalls are also set up to be dynamically registered when COMPAT32 option is configured. As a side effect of moving the SCTP syscalls, getsock_cap needs to be made available outside of the uipc_syscalls.c source file. A proper prototype has been added to the sys/socketvar.h header file. API tests from the SCTP reference implementation have been run to ensure compatibility. (http://code.google.com/p/sctp-refimpl/source/checkout) Submitted by: Steve Kiernan <stevek@juniper.net> Reviewed by: tuexen, rrs Obtained from: Juniper Networks, Inc.
* Fix fcntl(2) compat32 after r270691. The copyin and copyout of thekib2014-09-251-2/+2
| | | | | | | | | | | | | struct flock are done in the sys_fcntl(), which mean that compat32 used direct access to userland pointers. Move code from sys_fcntl() to new wrapper, kern_fcntl_freebsd(), which performs neccessary userland memory accesses, and use it from both native and compat32 fcntl syscalls. Reported by: jhibbits Sponsored by: The FreeBSD Foundation MFC after: 3 days
* Remake Linux' SOUND_MIXER_INFO IOCTL as a wrapper around new FreeBSD's one.mav2014-09-241-13/+2
| | | | | Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com> MFC after: 3 days
* Bump minimum linux compat version to support Centos6 ports updates for linux.sbruno2014-09-221-2/+2
| | | | | | | | | | | Update linux compat minimum revision to match linux-c6 now in ports. This is a candidate for 10.1 R as it matches the current state of supported linux compat packages in the ports tree. PR: 187786 Reviewed by: xmj MFC after: 2 days Relnotes: yes
* Fix build on 32-bit machines.glebius2014-09-181-1/+1
| | | | Pointy hat to: glebius
* - Use if_get_counter() to fetch ifnet statistics.glebius2014-09-181-12/+12
| | | | | | | - Report IFCOUNTER_OQDROPS to linprocfs. Wasn't there before. Sponsored by: Netflix Sponsored by: Nginx, Inc.
* Implement most of timer_{create,settime,gettime,getoverrun,delete}bz2014-09-182-0/+279
| | | | | | | | | | | | | | for amd64/linux32. Fix the entirely bogus (untested) version from r161310 for i386/linux using the same shared code in compat/linux. It is unclear to me if we could support more clock mappings but the current set allows me to successfully run commercial 32bit linux software under linuxolator on amd64. Reviewed by: jhb Differential Revision: D784 MFC after: 3 days Sponsored by: DARPA, AFRL
* Add missing proctree locking to fill_kinfo_proc consumers.mjg2014-08-301-0/+7
| | | | | | | | This fixes r270444. Pointy hat: mjg Reported by: many MFC after: 1 week
* Return real parent pid in kinfo (used by e.g. ps)mjg2014-08-281-0/+1
| | | | | | | | | | | Add a separate field which exports tracer pid and add a new keyword ("tracer") for ps to display it. This is a follow up to r270444. Reviewed by: kib MFC after: 1 week Relnotes: yes
* Regen.kib2014-08-275-13/+20
|
* Fix handling of the third argument for fcntl(2). The native syscallkib2014-08-272-1/+27
| | | | | | | | uses long for arg, which needs translation. Discussed with and tested by: mjg Sponsored by: The FreeBSD Foundation MFC after: 1 week
* All mbuf external free functions never fail, so let them be void.glebius2014-07-112-6/+4
| | | | Sponsored by: Nginx, Inc.
* Remove ia64.marcel2014-07-074-132/+3
| | | | | | | | | | | | | | | | | This includes: o All directories named *ia64* o All files named *ia64* o All ia64-specific code guarded by __ia64__ o All ia64-specific makefile logic o Mention of ia64 in comments and documentation This excludes: o Everything under contrib/ o Everything under crypto/ o sys/xen/interface o sys/sys/elf_common.h Discussed at: BSDcan
* Pull in r267961 and r267973 again. Fix for issues reported will follow.hselasky2014-06-282-10/+5
|
* Revert r267961, r267973:gjb2014-06-272-5/+10
| | | | | | | | | | These changes prevent sysctl(8) from returning proper output, such as: 1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1) truss: can not get etype: Cannot allocate memory
* Extend the meaning of the CTLFLAG_TUN flag to automatically check ifhselasky2014-06-272-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | there is an environment variable which shall initialize the SYSCTL during early boot. This works for all SYSCTL types both statically and dynamically created ones, except for the SYSCTL NODE type and SYSCTLs which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to be used in the case a tunable sysctl has a custom initialisation function allowing the sysctl to still be marked as a tunable. The kernel SYSCTL API is mostly the same, with a few exceptions for some special operations like iterating childrens of a static/extern SYSCTL node. This operation should probably be made into a factored out common macro, hence some device drivers use this. The reason for changing the SYSCTL API was the need for a SYSCTL parent OID pointer and not only the SYSCTL parent OID list pointer in order to quickly generate the sysctl path. The motivation behind this patch is to avoid parameter loading cludges inside the OFED driver subsystem. Instead of adding special code to the OFED driver subsystem to post-load tunables into dynamically created sysctls, we generalize this in the kernel. Other changes: - Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask" to "hw.pcic.intr_mask". - Removed redundant TUNABLE statements throughout the kernel. - Some minor code rewrites in connection to removing not needed TUNABLE statements. - Added a missing SYSCTL_DECL(). - Wrapped two very long lines. - Avoid malloc()/free() inside sysctl string handling, in case it is called to initialize a sysctl from a tunable, hence malloc()/free() is not ready when sysctls from the sysctl dataset are registered. - Bumped FreeBSD version to indicate SYSCTL API change. MFC after: 2 weeks Sponsored by: Mellanox Technologies
* - Add support for SG_GET_SG_TABLESIZE IOCTL to report that we don't supportmav2014-06-041-0/+3
| | | | | | | scatter/gather lists. - Return error for still unsupported SG 3.x API read/write calls. MFC after: 1 month
* Overhaul CAM SG driver IOCTL interfaces.mav2014-06-023-5/+196
| | | | | | | | | | | | | | | | Make it really work for native FreeBSD programs. Before this it was broken for years due to different number of pointer dereferences in Linux and FreeBSD IOCTL paths, permanently returning errors to FreeBSD programs. This change breaks the driver FreeBSD IOCTL ABI, making it more strict, but since it was not working any way -- who bother. Add shims for 32-bit programs on 64-bit host, translating the argument of the SG_IO IOCTL for both FreeBSD and Linux ABIs. With this change I was able to run 32-bit Linux sg3_utils tools and simple 32 and 64-bit FreeBSD test tools on both 32 and 64-bit FreeBSD systems. MFC after: 1 month
* Glibc was switched to the FUTEX_WAIT_BITSET op and CLOCK_REALTIMEdchagin2014-05-311-31/+40
| | | | | | | | | | | | | | | | flag has been added instead of FUTEX_WAIT to replace the FUTEX_WAIT logic which needs to do gettimeofday() calls before the futex syscall to convert the absolute timeout to a relative timeout. Before this the CLOCK_MONOTONIC used by the FUTEX_WAIT_BITSET op. When the FUTEX_CLOCK_REALTIME is specified the timeout is an absolute time, not a relative time. Rework futex_wait to handle this. On the side fix the futex leak in error case and remove useless parentheses. Properly calculate the timeout for the CLOCK_MONOTONIC case. MFC after: 3 days
* In r218101 I have not changed properly the futex syscall definition.dchagin2014-05-281-13/+16
| | | | | | | | | | | | | | Some Linux futex ops atomically verifies that the futex address uaddr (uval) contains the value val. Comparing signed uval and unsigned val may lead to an unexpected result, mostly to a deadlock. So copyin uaddr to an unsigned int to compare the parameters correctly. While here change ktr records to print parameters in more readable format. Tested by eadler@ MFC after: 3 days
* In freebsd32_sendmsg(), replace the call to sockargs() followed by amarcel2014-04-051-32/+75
| | | | | | | | | | | | | | | | | | | | | call to freebsd32_convert_msg_in() with freebsd32_copyin_control() to readin and convert in a single step. This makes it simpler to put all the control messages in a single mbuf or mbuf cluster as per the limitations imposed upon us by ip6_setpktopts(). The logic is as follows: 1. Go over the array of control messages to determine overall size and include extra padding for proper alignment as we go. 2. Get a mbuf or mbuf cluster as needed or fail if the overall (adjusted) size is larger than a cluster. 3. Go over the array of control messages again, but now copy them into kernel space and into aligned offsets. 4. Update the length of the control message to take padding between the header and the data into account (but not for padding added between one control message and the next). Obtained from: Juniper Networks, Inc. MFC after: 1 week
* Remove instances of variables that were set, but never used. gcc 4.9imp2014-03-301-4/+0
| | | | warns about these by default.
* Rename global cnt to vm_cnt to avoid shadowing.bdrewery2014-03-223-12/+12
| | | | | | | | | | | | | | To reduce the diff struct pcu.cnt field was not renamed, so PCPU_OP(cnt.field) is still used. pc_cnt and pcpu are also used in kvm(3) and vmstat(8). The goal was to not affect externally used KPI. Bump __FreeBSD_version_ in case some out-of-tree module/code relies on the the global cnt variable. Exp-run revealed no ports using it directly. No objection from: arch@ Sponsored by: EMC / Isilon Storage Division
* Make the array pointed to by AT_PAGESIZES auxv properly aligned.kib2014-03-191-22/+27
| | | | | | | | | | | Also, remove the expression which calculated the location of the strings for a new image and grown over the time to be non-comprehensible. Instead, calculate the offsets by steps, which also makes fixing the alignments much cleaner. Reported and reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week
* Regen per r263318.attilio2014-03-185-64/+8
| | | | Sponsored by: EMC / Isilon storage division
* Remove dead code from umtx support:attilio2014-03-181-2/+2
| | | | | | | | | | | | | | | - Retire long time unused (basically always unused) sys__umtx_lock() and sys__umtx_unlock() syscalls - struct umtx and their supporting definitions - UMUTEX_ERROR_CHECK flag - Retire UMTX_OP_LOCK/UMTX_OP_UNLOCK from _umtx_op() syscall __FreeBSD_version is not bumped yet because it is expected that further breakages to the umtx interface will follow up in the next days. However there will be a final bump when necessary. Sponsored by: EMC / Isilon storage division Reviewed by: jhb
* Update NetBSD Foundation copyrights to 2-clause BSDemaste2014-03-184-28/+0
| | | | | | | | | | | The NetBSD Foundation states "Third parties are encouraged to change the license on any files which have a 4-clause license contributed to the NetBSD Foundation to a 2-clause license." This change removes clauses 3 and 4 from copyright / license blocks that list The NetBSD Foundation as the only copyright holder. Sponsored by: The FreeBSD Foundation
* Update kernel inclusions of capability.h to use capsicum.h instead; somerwatson2014-03-1611-11/+11
| | | | | | | | further refinement is required as some device drivers intended to be portable over FreeBSD versions rely on __FreeBSD_version to decide whether to include capability.h. MFC after: 3 weeks
* change td_retval into a union w/ off_t, with defines to mask thejmg2014-03-161-1/+1
| | | | | | | | | | | | | | | change... This eliminates a cast, and also forces td_retval (often 2 32-bit registers) to be aligned so that off_t's can be stored there on arches with strict alignment requirements like armeb (AVILA)... On i386, this doesn't change alignment, and on amd64 it doesn't either, as register_t is already 64bits... This will also prevent future breakage due to people adding additional fields to the struct... This gets AVILA booting a bit farther... Reviewed by: bde
OpenPOWER on IntegriCloud