{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/corefx/issues/2070","labels_url":"https://api.github.com/repos/dotnet/corefx/issues/2070/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/2070/comments","events_url":"https://api.github.com/repos/dotnet/corefx/issues/2070/events","html_url":"https://github.com/dotnet/corefx/issues/2070","id":88847947,"number":2070,"title":"How to implement System.Diagnostics.Process on FreeBSD?","user":{"login":"ghuntley","id":127353,"avatar_url":"https://avatars.githubusercontent.com/u/127353?v=3","gravatar_id":"","url":"https://api.github.com/users/ghuntley","html_url":"https://github.com/ghuntley","followers_url":"https://api.github.com/users/ghuntley/followers","following_url":"https://api.github.com/users/ghuntley/following{/other_user}","gists_url":"https://api.github.com/users/ghuntley/gists{/gist_id}","starred_url":"https://api.github.com/users/ghuntley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghuntley/subscriptions","organizations_url":"https://api.github.com/users/ghuntley/orgs","repos_url":"https://api.github.com/users/ghuntley/repos","events_url":"https://api.github.com/users/ghuntley/events{/privacy}","received_events_url":"https://api.github.com/users/ghuntley/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-06-16T21:45:35Z","updated_at":"2015-10-07T23:23:36Z","closed_at":null,"body":"This issue is to discuss how we can implement `System.Diagnostics.Process` on FreeBSD which does not have procfs by enabled by default as [it should be considered deprecated.](http://lists.freebsd.org/pipermail/freebsd-fs/2011-February/010760.html)\r\n\r\n# Reference Material\r\n* [Implement basic System.Diagnostics.Process.Modules support on Linux #2188](https://github.com/dotnet/corefx/pull/2188#issuecomment-116671221)\r\n* The System.Diagnostics.Process [specification on MSDN.](https://msdn.microsoft.com/en-us/library/system.diagnostics.process%28v=vs.110%29.aspx) \r\n* The [FreeBSD process information implementation within Mono] (https://github.com/mono/mono/blob/master/mono/io-layer/processes.c#L1888-L1910) (LGPL)\r\n* The [FreeBSD process information implementation within IO.JS] (https://github.com/nodejs/io.js/blob/master/deps/uv/src/unix/freebsd.c) (MIT)\r\n* https://www.freebsd.org/cgi/man.cgi?procstat and https://www.freebsd.org/cgi/man.cgi?sysctl(3)\r\n\r\n             KERN_PROC\r\n\t     Return selected information about specific running processes.\r\n\r\n\t     For the following names, an array of struct kinfo_proc structures\r\n\t     is\treturned, whose\tsize depends on\tthe current number of such\r\n\t     objects in\tthe system.\r\n\r\n\t\t   Third level name\t     Fourth level is:\r\n\t\t   KERN_PROC_ALL\t     None\r\n\t\t   KERN_PROC_PID\t     A process ID\r\n\t\t   KERN_PROC_PGRP\t     A process group\r\n\t\t   KERN_PROC_TTY\t     A tty device\r\n\t\t   KERN_PROC_UID\t     A user ID\r\n\t\t   KERN_PROC_RUID\t     A real user ID\r\n\r\n\t     If\tthe third level\tname is\tKERN_PROC_ARGS then the\tcommand\tline\r\n\t     argument array is returned\tin a flattened form, i.e., zero-termi-\r\n\t     nated arguments follow each other.\t The total size\tof array is\r\n\t     returned.\tIt is also possible for\ta process to set its own\r\n\t     process title this\tway.  If the third level name is\r\n\t     KERN_PROC_PATHNAME, the path of the process' text file is stored.\r\n\t     For KERN_PROC_PATHNAME, a process ID of -1\timplies\tthe current\r\n\t     process.\r\n\r\n\t\t   Third level name\t     Fourth level is:\r\n\t\t   KERN_PROC_ARGS\t     A process ID\r\n\t\t   KERN_PROC_PATHNAME\t     A process ID\r\n\r\n\r\n/cc: @janhenke @saper @jasonwilliams200OK @josteink "},"comment":{"url":"https://api.github.com/repos/dotnet/corefx/issues/comments/146363754","html_url":"https://github.com/dotnet/corefx/issues/2070#issuecomment-146363754","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/2070","id":146363754,"user":{"login":"sokket","id":1761798,"avatar_url":"https://avatars.githubusercontent.com/u/1761798?v=3","gravatar_id":"","url":"https://api.github.com/users/sokket","html_url":"https://github.com/sokket","followers_url":"https://api.github.com/users/sokket/followers","following_url":"https://api.github.com/users/sokket/following{/other_user}","gists_url":"https://api.github.com/users/sokket/gists{/gist_id}","starred_url":"https://api.github.com/users/sokket/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sokket/subscriptions","organizations_url":"https://api.github.com/users/sokket/orgs","repos_url":"https://api.github.com/users/sokket/repos","events_url":"https://api.github.com/users/sokket/events{/privacy}","received_events_url":"https://api.github.com/users/sokket/received_events","type":"User","site_admin":false},"created_at":"2015-10-07T23:23:36Z","updated_at":"2015-10-07T23:23:36Z","body":"I did an initial investigation into FileSystemWatcher and wrote about it in #2046, but the tldr; is that the FreeBSD version would work very differently from the OSX and Linux implementations today. We have some options for how to mitigate that written up in the bug.\r\n\r\nI'm currently working on shim'ing the ProcessInfo and ThreadInfo native calls over, but it looks like FreeBSD does not have the OSX system calls or ProcFS like on Linux. My refactor should make it simple for new platforms (such as FreeBSD :smile:) to be brought up and working, as long as someone knows the correct native calls for that platform. If anyone on this thread knows the correct calls for retrieving process information, shoot me an email and (if they're trivial to add) I can add them to the PAL layer with my current pack"}}