Skip to content

Commit 3357ebf

Browse files
authored
Spec for GetProcessInfo3 IPC command (#3476)
1 parent 80d66b3 commit 3357ebf

File tree

1 file changed

+64
-1
lines changed

1 file changed

+64
-1
lines changed

documentation/design-docs/ipc-protocol.md

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ enum class ProcessCommandId : uint8_t
383383
EnablePerfMap = 0x05,
384384
DisablePerfMap = 0x06,
385385
ApplyStartupHook = 0x07
386+
ProcessInfo3 = 0x08,
386387
// future
387388
}
388389
```
@@ -804,7 +805,7 @@ In the event of an [error](#Errors), the runtime will attempt to send an error m
804805

805806
#### Inputs:
806807

807-
Header: `{ Magic; Size; 0x0402; 0x0000 }`
808+
Header: `{ Magic; Size; 0x0404; 0x0000 }`
808809

809810
There is no payload.
810811

@@ -848,6 +849,8 @@ struct Payload
848849
}
849850
```
850851
852+
> Available since .NET 7.0
853+
851854
### `EnablePerfMap`
852855
853856
Command Code: `0x0405`
@@ -972,6 +975,66 @@ struct Payload
972975
973976
> Available since .NET 8.0
974977
978+
### `ProcessInfo3`
979+
980+
Command Code: `0x0408`
981+
982+
The `ProcessInfo3` command queries the runtime for some basic information about the process. The returned payload is versioned and fields will be added over time.
983+
984+
In the event of an [error](#Errors), the runtime will attempt to send an error message and subsequently close the connection.
985+
986+
#### Inputs:
987+
988+
Header: `{ Magic; Size; 0x0408; 0x0000 }`
989+
990+
There is no payload.
991+
992+
#### Returns (as an IPC Message Payload):
993+
994+
Header: `{ Magic; size; 0xFF00; 0x0000; }`
995+
996+
Payload:
997+
* `uint32 version`: the version of the payload returned. Future versions can add new fields after the end of the current structure, but will never remove or change any field that has already been defined.
998+
* `uint64 processId`: the process id in the process's PID-space
999+
* `GUID runtimeCookie`: a 128-bit GUID that should be unique across PID-spaces
1000+
* `string commandLine`: the command line that invoked the process
1001+
* Windows: will be the same as the output of `GetCommandLineW`
1002+
* Non-Windows: will be the fully qualified path of the executable in `argv[0]` followed by all arguments as the appear in `argv` separated by spaces, i.e., `/full/path/to/argv[0] argv[1] argv[2] ...`
1003+
* `string OS`: the operating system that the process is running on
1004+
* macOS => `"macOS"`
1005+
* Windows => `"Windows"`
1006+
* Linux => `"Linux"`
1007+
* other => `"Unknown"`
1008+
* `string arch`: the architecture of the process
1009+
* 32-bit => `"x86"`
1010+
* 64-bit => `"x64"`
1011+
* ARM32 => `"arm32"`
1012+
* ARM64 => `"arm64"`
1013+
* Other => `"Unknown"`
1014+
* `string managedEntrypointAssemblyName`: the assembly name from the assembly identity of the entrypoint assembly of the process. This is the same value that is returned from executing `System.Reflection.Assembly.GetEntryAssembly().GetName().Name` in the target process.
1015+
* `string clrProductVersion`: the product version of the CLR of the process; may contain prerelease label information e.g. `6.0.0-preview.6.#####`
1016+
* `string runtimeIdentifier`: information to identify the platform this runtime targets, e.g. `linux_musl_arm`64, `linux_x64`, or `windows_x64` are all valid identifiers. See [.NET RID Catalog](https://learn.microsoft.com/en-us/dotnet/core/rid-catalog) for more information.
1017+
1018+
##### Details:
1019+
1020+
Returns:
1021+
```c++
1022+
struct Payload
1023+
{
1024+
uint32_t Version;
1025+
uint64_t ProcessId;
1026+
LPCWSTR CommandLine;
1027+
LPCWSTR OS;
1028+
LPCWSTR Arch;
1029+
GUID RuntimeCookie;
1030+
LPCWSTR ManagedEntrypointAssemblyName;
1031+
LPCWSTR ClrProductVersion;
1032+
LPCWSTR RuntimeIdentifier;
1033+
}
1034+
```
1035+
1036+
> Available since .NET 8.0
1037+
9751038
## Errors
9761039

9771040
In the event an error occurs in the handling of an Ipc Message, the Diagnostic Server will attempt to send an Ipc Message encoding the error and subsequently close the connection. The connection will be closed **regardless** of the success of sending the error message. The Client is expected to be resilient in the event of a connection being abruptly closed.

0 commit comments

Comments
 (0)