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
8 changes: 8 additions & 0 deletions docs/design/datacontracts/RuntimeInfo.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public enum RuntimeInfoOperatingSystem : uint
Unknown = 0,
Win,
Unix,
Browser,
Apple,
}
```

Expand Down Expand Up @@ -50,6 +52,12 @@ Global variables used:
The contract implementation returns the architecture and operating system global values parsed as the
respective enum case-insensitively. If these globals are not available, the contract returns Unknown.

`Apple` covers all Apple platforms (macOS, iOS, tvOS, MacCatalyst) — i.e. any target where the
runtime is compiled with `TARGET_APPLE` defined. It is distinct from `Unix` so that consumers which
need to apply Apple-specific ABI or platform rules (for example, the Apple ARM64 stack-argument
alignment) can detect the target reliably. Apple platforms are still POSIX and will behave like
`Unix` for the purposes of any `GetTargetOperatingSystem() != Windows` check.

### Reader versioning scheme

When the .NET runtime team wants to signal that an update is recommended we update both the
Expand Down
5 changes: 5 additions & 0 deletions src/coreclr/vm/datadescriptor/datadescriptor.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,11 @@ CDAC_GLOBALS_BEGIN()
#error Handle 'Browser' define
#endif // Browser
CDAC_GLOBAL_STRING(OperatingSystem, Browser)
#elif defined(TARGET_APPLE)
#ifdef Apple
#error Handle 'Apple' define
#endif // Apple
CDAC_GLOBAL_STRING(OperatingSystem, Apple)
#elif defined(TARGET_UNIX)
#ifdef Unix
#error Handle 'Unix' define
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public enum RuntimeInfoOperatingSystem : uint
Windows,
Unix,
Browser,
Apple,
}

public interface IRuntimeInfo : IContract
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public void RuntimeInfo_OperatingSystemMatchesDumpMetadata(TestConfiguration con
RuntimeInfoOperatingSystem expected = DumpMetadata.Os switch
{
"windows" => RuntimeInfoOperatingSystem.Windows,
"linux" or "osx" or "freebsd" => RuntimeInfoOperatingSystem.Unix,
"osx" => RuntimeInfoOperatingSystem.Apple,
"linux" or "freebsd" => RuntimeInfoOperatingSystem.Unix,
_ => RuntimeInfoOperatingSystem.Unknown,
};

Expand Down
Loading