{"id":20122865,"url":"https://github.com/freaky/ruby-filemon","last_synced_at":"2026-05-13T03:09:33.535Z","repository":{"id":142942554,"uuid":"93803228","full_name":"Freaky/ruby-filemon","owner":"Freaky","description":"A Ruby interface to FreeBSD's filemon(4) device","archived":false,"fork":false,"pushed_at":"2017-07-02T22:36:43.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-02T20:30:45.193Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Freaky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-09T00:35:44.000Z","updated_at":"2017-06-09T10:54:34.000Z","dependencies_parsed_at":"2023-04-07T07:01:15.614Z","dependency_job_id":null,"html_url":"https://github.com/Freaky/ruby-filemon","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Freaky/ruby-filemon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freaky%2Fruby-filemon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freaky%2Fruby-filemon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freaky%2Fruby-filemon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freaky%2Fruby-filemon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Freaky","download_url":"https://codeload.github.com/Freaky/ruby-filemon/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freaky%2Fruby-filemon/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32965886,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-12T23:30:32.555Z","status":"online","status_checked_at":"2026-05-13T02:00:07.132Z","response_time":115,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T19:41:33.738Z","updated_at":"2026-05-13T03:09:33.506Z","avatar_url":"https://github.com/Freaky.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Filemon\n\nThis is a Ruby interface to Free/NetBSD's [filemon(4)][1] device, which allows for tracing\nof file operations of a process and its children.\n\nIt is not a security tool, but intended for auditing processes for determining\nfile dependencies.\n\nOne example of real-world practical use is for accelerating [FreeBSD][2]/[NetBSD][3] world building\nusing [bmake's meta mode][4].\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'filemon'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install filemon\n\n## Usage\n\nThe `filemon` device works by writing tracing data to a file descriptor.  For the\ntime being, this interface only provides a means of configuring that, what you do\nwith the result is up to you.\n\nYou may need to `kldload filemon` before any of this works.\n\nTo monitor a forked process, this mirrors the code documented in the FreeBSD man page:\n\n```ruby\nmonitor = Filemon::Device.new\nmonitor.fd = File.new('filemon.out', 'w')\n\npid = fork do\n  monitor.pid = $$\n  # Do something here.\nend\n\nProcess.waitpid(pid)\nmonitor.close\n```\n\nBut nothing stops you from simply monitoring the current process:\n\n```ruby\nmonitor = Filemon::Device.new(fd: STDERR, pid: $$)\n# Do something here.\nmonitor.close\n```\n\nOr indeed any pid your user has permission to trace.\n\nA simple command-line tool is provided for tracing commands:\n\n    % bin/filemon sleep 1\n    # filemon version 5\n    # Target pid 53942\n    # Start 1497269126.786684\n    V 5\n    E 65204 /bin/sleep\n    R 65204 /etc/libmap.conf\n    R 65204 /usr/local/etc/libmap.d\n    R 65204 /var/run/ld-elf.so.hints\n    R 65204 /lib/libc.so.7\n    X 65204 0 0\n    # Stop 1497269127.857683\n    # Bye bye\n\nAnd one for monitoring pids:\n\n    % bin/filemonpid PID [PID2 [...]]\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/Freaky/ruby-filemon.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n[1]: https://www.freebsd.org/cgi/man.cgi?query=filemon\u0026sektion=4\n[2]: http://freebsd.1045724.x6.nabble.com/CFT-WITH-META-MODE-Working-incremental-build-td6101876.html\n[3]: http://www.crufty.net/sjg/docs/netbsd-meta-mode.htm\n[4]: http://www.crufty.net/help/sjg/bmake-meta-mode.htm\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreaky%2Fruby-filemon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreaky%2Fruby-filemon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreaky%2Fruby-filemon/lists"}