7e9a5924 | 12-Jan-2020 |
Sascha Wildner <saw@online.de> |
libc: Improve nslexer.c generation using FLAGS_GROUPS.
Flex detects YY_BUF_SIZE being defined since some time so there is no need anymore to sed it in the source. |
62d728b0 | 04-Jan-2020 |
Sascha Wildner <saw@online.de> |
basename.3/dirname.3: Adjust for recent commits. |
207ba670 | 04-Jan-2020 |
Matthew Dillon <dillon@apollo.backplane.com> |
libc - Adopt more linux-friendly basename() and dirname()
* Essentially take the FreeBSD basename() and dirname() code, changing the API to be more linux-friendly. This reduces work required in d
libc - Adopt more linux-friendly basename() and dirname()
* Essentially take the FreeBSD basename() and dirname() code, changing the API to be more linux-friendly. This reduces work required in dports.
* Adjust numerous cases in our base code that assumed the old prototypes and side effects.
* The passed-in string pointers are no longer const and can be modified in-place by the functions. The returned value is no longer sometimes dynamically allocated and will instead either return a constant string, a portion of the passed in string, or a modified portion of the passed-in string.
The API unfortunately has to be declared to return a char * instead of a const char *, even though it sometimes returns pointers to constant strings.
The API is now thread-safe.
* The API is still a huge historical mess but at least the ports for the most part assume the above behavior now due to linux doing the same thing.
Reviewed-by: multiple people
show more ...
|
09ad8dbb | 08-Dec-2019 |
Sascha Wildner <saw@online.de> |
Remove wrong getvfsbytype.3 MLINK. The manpage doesn't document it. |
9ae6396e | 06-Dec-2019 |
Sascha Wildner <saw@online.de> |
libc: Fix some -Wmissing-prototypes warnings. |
9358893d | 01-Dec-2019 |
Sascha Wildner <saw@online.de> |
libc: Change getlogin_r()'s second argument to size_t, as POSIX likes it.
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html
Also adjust the getconf syscall, aka _getconf() in
libc: Change getlogin_r()'s second argument to size_t, as POSIX likes it.
https://pubs.opengroup.org/onlinepubs/9699919799/functions/getlogin.html
Also adjust the getconf syscall, aka _getconf() in userland, which is called by getconf(3) and getconf_r(3).
Approved-by: dillon Tested-by: zrj
show more ...
|
4989e1f1 | 24-Nov-2019 |
Matthew Dillon <dillon@apollo.backplane.com> |
libc - nmalloc clean part 3
* Cleanup the sigblockall()/sigunblockall() use cases to remove unnecessary recursive counts. It suffices to wrap the exported functions, fork callbacks, and the des
libc - nmalloc clean part 3
* Cleanup the sigblockall()/sigunblockall() use cases to remove unnecessary recursive counts. It suffices to wrap the exported functions, fork callbacks, and the destructor.
show more ...
|
369c9b6c | 24-Nov-2019 |
Matthew Dillon <dillon@apollo.backplane.com> |
libc - nmalloc clean part 2
* Clean up a lot of unused #define's and other constants.
* Increase the maximum capacity of a magazine to roughly 512 (M_MAX_ROUNDS). Continue to use a fixed structu
libc - nmalloc clean part 2
* Clean up a lot of unused #define's and other constants.
* Increase the maximum capacity of a magazine to roughly 512 (M_MAX_ROUNDS). Continue to use a fixed structure.
* Set the magazine capacity dynamically based on the allocation size. Magazines for smaller allocations have larger capacities. This should improve performance for tiny allocations.
show more ...
|
8b07b5e8 | 24-Nov-2019 |
Matthew Dillon <dillon@apollo.backplane.com> |
libc - nmalloc clean part 1
* Add an __isexiting global that the malloc thread destructor can use to detect program exit (verses just thread exit), allowing it to avoid burning unnecessary cpu.
libc - nmalloc clean part 1
* Add an __isexiting global that the malloc thread destructor can use to detect program exit (verses just thread exit), allowing it to avoid burning unnecessary cpu. That is, it doesn't bother to clean stuff if the program is on its way out.
* Fresh allocations when the magazines are empty no longer dive into the global structure (with accompanying locks) for every allocation and will instead burst a bunch of chunks into the local mtmagazine to reduce lock contention.
* Reduce the time the global slgd_lock() is held by rejiggering the code a bit.
* Reduce overhead for allocating the magazine structure by allowing the thead-local magazine to be accessed if it happens to contain approriate free chunks.
We no longer disable the thread-local mtmagazine during the recursive _slaballoc() call and instead pass a flag to prevent an infinite recursion.
* Fix the confusing slgd_unlock() call that was previously in zone_free(). slgd_unlock() is now called prior to the zone_free().
show more ...
|
619a518a | 20-Nov-2019 |
zrj <rimvydas.jasinskas@gmail.com> |
libstand: Switch to _STANDALONE handling.
Prevent TLS __thread variables leaking into intermediates. |
f1c466f7 | 17-Nov-2019 |
Sascha Wildner <saw@online.de> |
libc/citrus: Include <sys/types.h> for int*_t etc. types. |
ef10c7d6 | 16-Nov-2019 |
Antonio Huete Jimenez <tuxillo@quantumachine.net> |
libc/getaddrinfo: Accept numeric servname for AF_INET/AF_INET6
According to RFC3493:
If servname is null, the call shall return network-level addresses for the specified nodename. If ser
libc/getaddrinfo: Accept numeric servname for AF_INET/AF_INET6
According to RFC3493:
If servname is null, the call shall return network-level addresses for the specified nodename. If servname is not null, it is a null- terminated character string identifying the requested service. This can be either a descriptive name or a numeric representation suitable for use with the address family or families. If the specified address family is AF_INET, AF_INET6 or AF_UNSPEC, the service can be specified as a string specifying a decimal port number.
Taken from: FreeBSD r190382
show more ...
|
806a5ed7 | 15-Nov-2019 |
Sascha Wildner <saw@online.de> |
libc: Add more namespace.h/un-namespace.h. |
78897f0b | 15-Nov-2019 |
Sascha Wildner <saw@online.de> |
Remove the old libc_r.
Nothing is using it, if it even works, and no one has been working on it for a long time.
Approved-by: dillon |
020a8784 | 15-Nov-2019 |
Sascha Wildner <saw@online.de> |
sigblockall.3/sigprocmask.2: Various small fixes/markup improvements. |
40209b5b | 11-Nov-2019 |
zrj <rimvydas.jasinskas@gmail.com> |
cpu/x64_64: Move MMU page table types back to <cpu/pmap.h>.
Reduce namespace pollution. These types are common for both pc64/vkernel64 and are used in pmap context only. All userland cases need
cpu/x64_64: Move MMU page table types back to <cpu/pmap.h>.
Reduce namespace pollution. These types are common for both pc64/vkernel64 and are used in pmap context only. All userland cases need just VM_MAX_USER_ADDRESS, PS_STRINGS constants through <machine/vmparam.h> with huge cpp expansion that requires <machine/pmap.h> header inclusion anyway. Simplify it.
* Hard-code NPTEPG/NPDEPG/NPDPEPG/NPML4EPG constants to properly solve header inclusion ordering. The SHIFT constants are hard-coded already (log2() values) so there are no reasons to pretend everything will adjust automatically. * Use LU suffixes, debug printf() in vkernel64 use %ld types. * Optionally reorder includes in libc setproctitle.c. * Optionally add explicit includes in libkvm where pmap.h is only coming from <sys/user.h>. The kvm_*_x86_64.c use X86_PG_* constants.
For now keep PDESIZE/PTESIZE (used in pc64 genassym.c).
No intermediates differences observed.
show more ...
|
9d4f17d1 | 10-Nov-2019 |
zrj <rimvydas.jasinskas@gmail.com> |
Adjust headers for <machine/stdint.h> visibility.
This also reduces namespace pollution a bit. Include <machine/stdint.h> where <stdint.h> is used too. External compiler under -ffreestanding (_
Adjust headers for <machine/stdint.h> visibility.
This also reduces namespace pollution a bit. Include <machine/stdint.h> where <stdint.h> is used too. External compiler under -ffreestanding (__STDC_HOSTED__ == 0) will use their own <stdint.h> version and will not include <machine/stdint.h>.
show more ...
|
eb396e51 | 14-Nov-2019 |
Matthew Dillon <dillon@apollo.backplane.com> |
world - Add support for lwp_getname() and pthread_get_name_np()
* Add support for the new system call lwp_getname()
* Add support for pthread_get_name_np(), rounding out that function set and imp
world - Add support for lwp_getname() and pthread_get_name_np()
* Add support for the new system call lwp_getname()
* Add support for pthread_get_name_np(), rounding out that function set and improving ports compatibility.
show more ...
|
4beeb8ba | 13-Nov-2019 |
Sascha Wildner <saw@online.de> |
libc: Remove _nmalloc_thr_init from Symbol.map again.
My fault, it is now internal only.
Pointed-out-by: dillon |
ea59862c | 12-Nov-2019 |
Matthew Dillon <dillon@apollo.backplane.com> |
docs - Add manual page for sigblockall() and sigunblockall()
* Add a nice manual page for sigblockall() and sigunblockall() |
e7126f0a | 12-Nov-2019 |
Matthew Dillon <dillon@apollo.backplane.com> |
kernel and libc - Reimplement lwp_setname*() using /dev/lpmap
* Generally speaking we are implementing the features necessary to allow per-thread titling set via pthread_set_name_np() to show up
kernel and libc - Reimplement lwp_setname*() using /dev/lpmap
* Generally speaking we are implementing the features necessary to allow per-thread titling set via pthread_set_name_np() to show up in 'ps' output, and to use lpmap to make it fast.
* The lwp_setname() system call now stores the title in lpmap->thread_title[].
* Implement a libc fast-path for lwp_setname() using lpmap. If called more than 10 times, libc will use lpmap for any further calls, which omits the need to make any system calls.
* setproctitle() now stores the title in upmap->proc_title[] instead of replacing proc->p_args. proc->p_args is now no longer modified from its original contents.
* The kernel now includes lpmap->thread_title[] in the following priority order when retrieving the process command line:
lpmap->thread_title[] User-supplied thread title, if not empty upmap->proc_title[] User-supplied process title, if not empty proc->p_args Original process arguments (no longer modified)
* Put the TID in /dev/lpmap for convenient access
* Enhance the KERN_PROC_ARGS sysctl to allow the TID to be specified. The sysctl now accepts { KERN_PROC, KERN_PROC_ARGS, pid, tid } in addition to the existing { KERN_PROC, KERN_PROC_ARGS, pid } mechanism.
Enhance libkvm to use the new feature. libkvm will fall-back to the old version if necessary.
show more ...
|
1a43169d | 12-Nov-2019 |
Sascha Wildner <saw@online.de> |
libc: Fix up two Symbol.map's a bit.
* Keep _nmalloc_thr_init, it didn't go away.
* Put _libc_thr_init into DF508.0.
* Reindent like everywhere else. |
b8efa4bd | 12-Nov-2019 |
Matthew Dillon <dillon@apollo.backplane.com> |
libc - make strtok() thread-safe
* Make strtok() thread-safe. Applications are getting too complex to trust that they will do the right thing. |
721505de | 12-Nov-2019 |
Matthew Dillon <dillon@apollo.backplane.com> |
libc - Implement sigblockall() and sigunblockall()
* Signal safety is becoming a defacto requirement for most of libc and pthreads. In particular, the memory allocator. Given the chances of te
libc - Implement sigblockall() and sigunblockall()
* Signal safety is becoming a defacto requirement for most of libc and pthreads. In particular, the memory allocator. Given the chances of teaching tens of thousands of programmers about signal safety, and just making it work in libc and pthreads, only one of these two possibilities is actually realizable.
In particular, high-level languages have become so complex, and some applications (chrome, firefox, etc) have become so complex, that the code is regularly tripping over signal safety issues.
However, implementing signal safety with current mechanisms is extremely expensive due to the need for multiple system calls. To whit, DragonFlyBSD now has a mechanism that does not require system calls in the critical path.
* Implement sigblockall() and sigunblockall(). These functions leverage the new /dev/lpmap per-thread shared page mechanism to provide a way to temporary block the dispatch of all maskable signals without having to make any system calls.
These are extremely fast routines.
- Reentrant / Recursable
- Temporarily blocks any dispatch of a maskable asynchronous signal to the calling thread. Other threads are not affected... this is a per-thread mechanism.
- The last sigunblockall() will immediately dispatch any blocked signals.
- The normal signal mask is not affected by these routines.
- Does not block signals caused by synchronous traps.
- The current recursion count is retained on [v]fork() to ease coding and to also allow signals to be temporarily blocked across a fork until the child process is ready to deal with them, if desired.
* Implement signal safety for most of pthreads. All temporary internal mutexes are now wrapped with sigblockall() and sigunblockall().
* Implement signal safety for the malloc subsystem. All functions are wrawpped with sigblockall() and sigunblockall().
These implementations make lang/mono and lang/rust far more reliable than they were before. Where 9 out of 10 builds used to fail, now they succeed.
show more ...
|
3cfdabcf | 02-Nov-2019 |
zrj <rimvydas.jasinskas@gmail.com> |
<wchar.h>: Refactor wchar_t/wint_t/mb_state setup.
Kernel has no wchar support functions (except for VKERNEL64).
* Extract wide-character types setup to common <machine/wchar.h>. * Avoid using _
<wchar.h>: Refactor wchar_t/wint_t/mb_state setup.
Kernel has no wchar support functions (except for VKERNEL64).
* Extract wide-character types setup to common <machine/wchar.h>. * Avoid using __wchar_t for clang -fms-extensions issue. * Add more handling for c++ and -fshort-wchar (not supported in libc).
This essentially removes these types from kernel namespace and paves the way for further both userland/kernelland visibility cleanup by making <sys/stdint.h> clean. The WCHAR_MAX/WCHAR_MIN limits will be addressed in separate commit.
show more ...
|