feat: add Rust userspace support; fix TLS layout for p_align < 16; kill whole process on sibling-thread faults
This commit is contained in:
1 parent
a81298fb24
commit
f8b8f9610f
31 files changed
+1076
-38
No files matched your search
@@ -32,6 +32,9 @@ typedef enum {
|
||||
WouldBlock = 16
|
||||
} StatusCode;
|
||||
|
||||
// Highest defined StatusCode; update when adding a code above.
|
||||
enum { MaxStatusCode = WouldBlock };
|
||||
|
||||
inline const char* GetStatusText(StatusCode statusCode) {
|
||||
const char* statusText[] = {
|
||||
"Success", // 0
|
||||
@@ -53,7 +56,7 @@ inline const char* GetStatusText(StatusCode statusCode) {
|
||||
"Operation would block", // 16
|
||||
};
|
||||
|
||||
if (statusCode > 0 && statusCode <= 16) {
|
||||
if (statusCode > 0 && statusCode <= MaxStatusCode) {
|
||||
return statusText[statusCode];
|
||||
} else {
|
||||
return "Unknown error";
|
||||
@@ -63,7 +66,7 @@ inline const char* GetStatusText(StatusCode statusCode) {
|
||||
// Map a raw syscall result to a StatusCode.
|
||||
inline StatusCode StatusFromResult(long long rc) {
|
||||
if (rc >= 0) return Success;
|
||||
if (rc < -(long long)WouldBlock) return GenericFailure;
|
||||
if (rc < -(long long)MaxStatusCode) return GenericFailure;
|
||||
return (StatusCode)(-rc);
|
||||
}
|
||||
|
||||
@@ -89,7 +92,7 @@ inline const char* GetStatusExplanationText(StatusCode statusCode) {
|
||||
0, // 16
|
||||
};
|
||||
|
||||
if (statusCode > 0 && statusCode <= 16) {
|
||||
if (statusCode > 0 && statusCode <= MaxStatusCode) {
|
||||
if (explanationText[statusCode] != 0) {
|
||||
return explanationText[statusCode];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user