sigreturn fix

This commit is contained in:
Matheus
2024-05-17 19:19:37 -03:00
parent 1b63e9b436
commit b2644df9c2
2 changed files with 20 additions and 2 deletions
+1
View File
@@ -17,6 +17,7 @@ __attribute__((noreturn)) void syscall_sigreturn(context_t *context) {
memcpy(&_cpu()->thread->extracontext, &sigframe.extracontext, sizeof(extracontext_t)); memcpy(&_cpu()->thread->extracontext, &sigframe.extracontext, sizeof(extracontext_t));
ARCH_CONTEXT_THREADLOAD(_cpu()->thread, context); ARCH_CONTEXT_THREADLOAD(_cpu()->thread, context);
interrupt_set(true);
arch_context_switch(&sigframe.context); arch_context_switch(&sigframe.context);
// if we were to return normally, CTX_RET and CTX_ERRNO would be corrupted, // if we were to return normally, CTX_RET and CTX_ERRNO would be corrupted,
+19 -2
View File
@@ -29,6 +29,23 @@ index 905fbb9..6360ca5 100644
else else
error('No sysdeps defined for OS: ' + host_machine.system()) error('No sysdeps defined for OS: ' + host_machine.system())
endif endif
diff --git mlibc-clean/options/ansi/generic/environment.cpp mlibc-workdir/options/ansi/generic/environment.cpp
index 5625592..36b42ee 100644
--- mlibc-clean/options/ansi/generic/environment.cpp
+++ mlibc-workdir/options/ansi/generic/environment.cpp
@@ -111,8 +111,10 @@ namespace mlibc {
int putenv(char *string) {
frg::string_view view{string};
size_t s = view.find_first('=');
- if(s == size_t(-1))
- __ensure(!"Environment strings need to contain an equals sign");
+ if(s == size_t(-1)) {
+ unsetenv(string);
+ return 0;
+ }
update_vector();
assign_variable(view.sub_string(0, s), string, true);
diff --git mlibc-clean/options/ansi/generic/string-stubs.cpp mlibc-workdir/options/ansi/generic/string-stubs.cpp diff --git mlibc-clean/options/ansi/generic/string-stubs.cpp mlibc-workdir/options/ansi/generic/string-stubs.cpp
index 8defd0e..d6cb65b 100644 index 8defd0e..d6cb65b 100644
--- mlibc-clean/options/ansi/generic/string-stubs.cpp --- mlibc-clean/options/ansi/generic/string-stubs.cpp
@@ -175,7 +192,7 @@ index 0000000..e5b087a
+ +
diff --git mlibc-workdir/sysdeps/astral/generic/generic.cpp mlibc-workdir/sysdeps/astral/generic/generic.cpp diff --git mlibc-workdir/sysdeps/astral/generic/generic.cpp mlibc-workdir/sysdeps/astral/generic/generic.cpp
new file mode 100644 new file mode 100644
index 0000000..440f0dc index 0000000..6562b81
--- /dev/null --- /dev/null
+++ mlibc-workdir/sysdeps/astral/generic/generic.cpp +++ mlibc-workdir/sysdeps/astral/generic/generic.cpp
@@ -0,0 +1,673 @@ @@ -0,0 +1,673 @@
@@ -334,7 +351,7 @@ index 0000000..440f0dc
+ +
+ struct sigaction newact; + struct sigaction newact;
+ if (act) + if (act)
+ newact = *act; + memcpy(&newact, act, sizeof(struct sigaction));
+ +
+ if (act && (newact.sa_flags & SA_RESTORER) == 0) { + if (act && (newact.sa_flags & SA_RESTORER) == 0) {
+ newact.sa_restorer = __mlibc_restorer; + newact.sa_restorer = __mlibc_restorer;