Skip to content

FreeBSD compatability#9

Open
justjake wants to merge 4 commits intomasterfrom
freebsd-compat
Open

FreeBSD compatability#9
justjake wants to merge 4 commits intomasterfrom
freebsd-compat

Conversation

@justjake
Copy link
Copy Markdown
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