Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,11 @@ jobs:
name: x86_64, linked with no SDK
runs-on: ubuntu-24.04
timeout-minutes: 45
# The platform release groups the openkal this package requires: 0.28.0
# named openkal 0.25.3 and was refused since 0.24.0 asks for ^0.26.0.
# 0.32.1 names 0.26.0 and needs mcpp 2026.11.17.1 or later.
env:
MCPP_VERSION: 2026.11.27.1
steps:
- uses: actions/checkout@v4
with: { path: openkal-macos }
Expand Down Expand Up @@ -543,7 +548,7 @@ jobs:
kind = "bin"
main = "src/main.c"
[target.x86_64-macos-musl]
platform = "openkal-platform@0.28.0"
platform = "openkal-platform@0.32.1"
[target.x86_64-macos-musl.layers]
kernel-abi = { path = "../openkal-macos" }
TOML
Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ written on the kernel's own calls.

```toml
[dependencies]
openkal = "0.26.0"
openkal = "0.26.1"

[target.'cfg(os = "macos")'.dependencies]
openkal-macos = "0.24.1"
openkal-macos = "0.24.2"
```

Its purpose is as much to test the specification as to be used. A specification
Expand Down Expand Up @@ -198,6 +198,17 @@ same image parses as fast on Linux arm64. Since 0.17.1 it is the same kernel ide
this system's library keeps for each thread (`pthread_threadid_np`, a name no C
library in this ecosystem defines).

## What 0.24.2 changes

**A start that states no preference leaves the environment as it was given**
(openkal 0.26.1, clause 7.17). A start removed every `KAL_RESOURCES` variable the
caller gave and wrote this process's own preference where it was not balanced, so
a program that is not an openkal program received a variable its caller had not
written, and a caller that composed an environment could not start a program with
the default. The variable is now written only for a start that states a
preference; a caller that passes its own environment on passes its preference with
it. The suite of 0.26.1 observes both starts.

## What 0.24.1 corrects

**A request acted on by another context ends the program as the request.**
Expand Down
2 changes: 1 addition & 1 deletion mcpp.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
namespace = "mcpplibs"
name = "openkal-macos"
version = "0.24.1"
version = "0.24.2"
description = "An implementation of openkal for macOS, written on the kernel's own calls. Its purpose is as much to test the specification as to be used."
license = "Apache-2.0"

Expand Down
20 changes: 9 additions & 11 deletions src/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
extern "C" int sandbox_init_with_parameters(const char* profile, unsigned long long flags,
const char* const parameters[], char** error);
namespace okm {
int resource_preference();
void fork_prepare();
void fork_parent();
void fork_child();
Expand Down Expand Up @@ -120,7 +119,11 @@ constexpr okm_uptr kPidDigits = 10;
// THE TWO VARIABLES 0.23 WRITES BESIDE IT: what each grant carries
// (`KAL_GRANT_RIGHTS', read in fs.cpp) and the started program's resource
// preference (`KAL_RESOURCES', read in env.cpp). A value of either the caller
// supplied is left out.
// supplied is left out where this start writes its own. A start that states no
// preference writes none and leaves the caller's variable where it is: the
// preference is inherited through the environment the caller gives
// (openkal 0.26.1, clause 7.17), and a program that is not an openkal program
// receives exactly that environment.
constexpr char kRights[] = "KAL_GRANT_RIGHTS=";
constexpr okm_uptr kRightsLen = sizeof kRights - 1;
constexpr char kResources[] = "KAL_RESOURCES=";
Expand Down Expand Up @@ -265,7 +268,7 @@ struct vector {
const kal_preopen* grants, kal_uintptr g, const conveyance& c) {
auto left_out = [&](const char* s, kal_uintptr l) {
return names_preopens(s, l) || starts_with(s, l, kRights, kRightsLen)
|| starts_with(s, l, kResources, kResourcesLen);
|| (c.resources && starts_with(s, l, kResources, kResourcesLen));
};
kal_uintptr kept = 0;
okm_uptr total = 0;
Expand Down Expand Up @@ -894,14 +897,9 @@ int kal_process_spawn(const kal_spawn* how,
okm::copy(carry.rights + carry.rights_len, prefix, plen); carry.rights_len += plen;
carry.any_rights = true;
}
{
const int own = okm::resource_preference();
const int asked = preference == KAL_SPAWN_RESOURCES_PERFORMANCE ? 1
: preference == KAL_SPAWN_RESOURCES_ECONOMY ? 2
: preference == KAL_SPAWN_RESOURCES_BALANCED ? 0 : own;
carry.resources = asked == 1 ? "performance" : asked == 2 ? "economy"
: preference != 0 ? "balanced" : nullptr;
}
carry.resources = preference == KAL_SPAWN_RESOURCES_PERFORMANCE ? "performance"
: preference == KAL_SPAWN_RESOURCES_ECONOMY ? "economy"
: preference == KAL_SPAWN_RESOURCES_BALANCED ? "balanced" : nullptr;

vector args, envs;
if (!args.build(argv, argv_lens, argc)) return kal_err_no_memory;
Expand Down
Loading