mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
Hunt down more bugs
After going through the MODE=dbg and MODE=zero build modes, a bunch of little issues were identified, which have been addressed. Fixing those issues created even more troubles for the project, because it improved our ability to detect latent problems which are getting fixed so fast.
This commit is contained in:
parent
73c0faa1b5
commit
97b7116953
39 changed files with 557 additions and 754 deletions
|
@ -23,7 +23,6 @@
|
|||
#include "libc/errno.h"
|
||||
#include "libc/fmt/itoa.h"
|
||||
#include "libc/intrin/asan.internal.h"
|
||||
#include "libc/intrin/asmflag.h"
|
||||
#include "libc/intrin/atomic.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/consts/at.h"
|
||||
|
@ -72,23 +71,20 @@ static errno_t pthread_setname_impl(pthread_t thread, const char *name) {
|
|||
}
|
||||
return 0;
|
||||
|
||||
} else if (IsFreebsd()) {
|
||||
char cf;
|
||||
int ax, dx;
|
||||
asm volatile(CFLAG_ASM("syscall")
|
||||
: CFLAG_CONSTRAINT(cf), "=a"(ax), "=d"(dx)
|
||||
: "1"(323 /* thr_set_name */), "D"(tid), "S"(name)
|
||||
: "rcx", "r8", "r9", "r10", "r11", "memory");
|
||||
return !cf ? 0 : ax;
|
||||
|
||||
} else if (IsNetbsd()) {
|
||||
char cf;
|
||||
int ax, dx;
|
||||
asm volatile(CFLAG_ASM("syscall")
|
||||
: CFLAG_CONSTRAINT(cf), "=a"(ax), "=d"(dx)
|
||||
: "1"(323 /* _lwp_setname */), "D"(tid), "S"(name)
|
||||
: "rcx", "r8", "r9", "r10", "r11", "memory");
|
||||
return !cf ? 0 : ax;
|
||||
} else if (IsFreebsd() || IsNetbsd() || IsOpenbsd()) {
|
||||
int ax;
|
||||
if (IsFreebsd()) {
|
||||
ax = 464; // thr_set_name
|
||||
} else if (IsNetbsd()) {
|
||||
ax = 323; // _lwp_setname
|
||||
} else {
|
||||
ax = 143; // sys_setthrname
|
||||
}
|
||||
asm volatile("syscall"
|
||||
: "+a"(ax), "+D"(tid), "+S"(name)
|
||||
: /* no inputs */
|
||||
: "rcx", "rdx", "r8", "r9", "r10", "r11", "memory");
|
||||
return ax;
|
||||
|
||||
} else {
|
||||
return ENOSYS;
|
||||
|
@ -115,7 +111,7 @@ static errno_t pthread_setname_impl(pthread_t thread, const char *name) {
|
|||
* @return 0 on success, or errno on error
|
||||
* @raise ERANGE if length of `name` exceeded system limit, in which
|
||||
* case the name may have still been set with os using truncation
|
||||
* @raise ENOSYS on MacOS, Windows, and OpenBSD
|
||||
* @raise ENOSYS on MacOS, and Windows
|
||||
* @see pthread_getname_np()
|
||||
*/
|
||||
errno_t pthread_setname_np(pthread_t thread, const char *name) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue