Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FreeBSD compatability #9

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

FreeBSD compatability #9

wants to merge 4 commits into from

Conversation

justjake
Copy link
Collaborator

This branch adds basic support for FreeBSD, which is different enough from Linux/macOS that customizations were required. The branch is developed on a FreeBSD 10 server, in a jail. The only supported revealer on FreeBSD is the tmux revealer.

Currently, this branch can reveal a tmux pane, but then crashes afterwards in the #tmux_client_for_tree method. Appear dies trying to run lsof against a non-existent /dev/pts/1, which is the TTY that tmux reports its client is attached to. This is rather odd -- maybe it has something to do with jails?

Jake Teton-Landis added 4 commits August 26, 2016 00:06
- log the process tree
- log revealer activation
- decent to_s method on ProcessInfo
FreeBSD has this to say about the "command" aka "args" output field:

> The ps utility first tries to obtain the arguments cached by the kernel
> (if they were shorter than the value of the kern.ps_arg_cache_limit
> sysctl).  The process can change the arguments shown with
> setproctitle(3).  Otherwise, ps makes an educated guess as to the file
> name and arguments given when the process was created by examining
> memory or the swap area.  The method is inherently somewhat unreliable
> and in any event a process is entitled to destroy this information.

tl;dr it's gonna give you monkey business instead of actual args
sometimes.

Rather than try to parse the varying different output formats, just add
the "command name" field to provide the ProcessInfo.name attribute in a
reliable manner. Switch to using the "args" output field for clarity.
Lsof does not come pre-installed on FreeBSD systems. Instead, we can use
`fstat`, an lsof-like tool that comes with the system by default.
`fstat` is actually really fast (at least for ptys), so we can skip all
the memoization and threading mumbo-jumbo on FreeBSD.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant