Runtime: Add Support for Process's ParentProcessId on FreeBSD

Created on 13 Feb 2019  路  9Comments  路  Source: dotnet/runtime

Request/Need

Implement private instance method Process.ParentProcessId method on FreeBSD. Presumably this will involve adding an interop method that calls the appropriate native API method.

Background

Currently, this method is not supported on FreeBSD (e.g. throws a PlatformNotSupportedException). This lack blocks Kill(entireProcessTree: true) from being supported on FreeBSD.

Related: https://github.com/dotnet/corefx/pull/34147#discussion_r248261306

area-System.Diagnostics.Process os-freebsd

Most helpful comment

I would probably add ppid to proc_stats instead of dragging unsafe code to Process.cs. I'll see what I can do about the build. It would be nice to have it back.

All 9 comments

/cc: @tmds @danmosemsft

do you have simple code to run to reproduce this @bgribaudo ?

Off the top of my head, maybe just try calling process.Kill(entireProcessTree: true) on a process instance?

I think this FreeBSD implementation will fill the gap: https://github.com/am11/corefx/commit/fe9254b980ae777a0d7c08b6290b1026259cec86.

I didn't open a pull request due to the blocker that we are unable to build CoreFX on FreeBSD; hitting package restore errors (https://github.com/dotnet/corefx/issues/2046#issuecomment-481739054). If building CoreFX via source-build is a viable option with release/3.0 branch, I can attempt @wfurt, @dagood (on a private VM for now).

Otherwise, we can park it until the whole azure-pipelines-agent -> core-setup -> core-sdk -> corefx,coreclr chain is unblocked. 馃槩

Thanks for working on this, @am11! It will be nice to see this supported on another platform.

I would probably add ppid to proc_stats instead of dragging unsafe code to Process.cs. I'll see what I can do about the build. It would be nice to have it back.

Agree, your approach is much cleaner @wfurt: https://github.com/am11/corefx/commit/871cf28?w=1
(remove ?w=1 to compare with whitespace/formatting changes)

The property was implemented in master branch, can be closed.

Thanks @am11

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jamesqo picture jamesqo  路  3Comments

matty-hall picture matty-hall  路  3Comments

iCodeWebApps picture iCodeWebApps  路  3Comments

Timovzl picture Timovzl  路  3Comments

omajid picture omajid  路  3Comments