{"id":20122832,"url":"https://github.com/freaky/rust-proctitle","last_synced_at":"2025-05-06T16:33:12.552Z","repository":{"id":62442954,"uuid":"183337813","full_name":"Freaky/rust-proctitle","owner":"Freaky","description":"A safe cross-platform interface to setting process titles","archived":false,"fork":false,"pushed_at":"2019-04-28T18:18:59.000Z","size":19,"stargazers_count":16,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-11T15:49:31.330Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-25T02:05:24.000Z","updated_at":"2023-01-18T11:42:09.000Z","dependencies_parsed_at":"2022-11-01T22:02:51.912Z","dependency_job_id":null,"html_url":"https://github.com/Freaky/rust-proctitle","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freaky%2Frust-proctitle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freaky%2Frust-proctitle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freaky%2Frust-proctitle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Freaky%2Frust-proctitle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Freaky","download_url":"https://codeload.github.com/Freaky/rust-proctitle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224516758,"owners_count":17324398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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:23.775Z","updated_at":"2024-11-13T19:41:24.437Z","avatar_url":"https://github.com/Freaky.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# proctitle\n\n[![Cargo](https://img.shields.io/crates/v/proctitle.svg)][crate]\n[![Build Status](https://travis-ci.org/Freaky/rust-proctitle.svg?branch=master)](https://travis-ci.org/Freaky/rust-proctitle)\n\n## Cross-platform process titles.\n\n`proctitle` attempts to expose the closest safe approximation of the BSD\n[`setproctitle()`] function on the platforms it supports.\n\nThis can be useful if you wish to expose some internal state to `top` or `ps`,\nor to help an administrator distinguish between multiple instances of your\nprogram.\n\n```rust\nuse proctitle::set_title;\nlet tasks = [\"frobrinate\", \"defroogle\", \"hodor\", \"bork\"];\n\nfor task in \u0026tasks {\n    set_title(format!(\"example: {}\", task));\n    perform_task(task);\n}\n\nset_title(\"example: idle\");\n```\n\nOn Linux or a BSD you could then watch `top` or `ps` and see the process name\nchange as it works:\n\n```sh\n-% cmd \u0026\n[1] 8515\n-% ps $!\n PID TT  STAT     TIME COMMAND\n8515  4  S+    0:00.06 example: defroggle (cmd)\n```\n\n### Supported Platforms\n\n#### BSD\n\nOn BSDs, [`setproctitle()`] is used, and should pretty much Just Work.  Tested\non FreeBSD 12, DragonFlyBSD 5.4, OpenBSD 6.5, and NetBSD 8.0.\n\n#### Linux\n\n`proctitle` uses [`prctl(PR_SET_NAME)`][prctl] to name the current thread, with\na truncation limit of 15 bytes.  It may be wise to limit `set_title()` calls to\nthe main thread.\n\nMore BSD-ish process-global changes are possible by modifying the process\nenvironment, but this is not yet supported because it's wildly unsafe.\n\n#### Windows\n\n[`SetConsoleTitleW()`] is used to set a title for the console, if any.\n\nIn case there is no console (for example, a system service), a dummy named\n[event handle] is also created.  This can be found via tools such as\n[Process Explorer] (View ⮕ Lower Pane View ⮕ Handles) and [Process Hacker]\n(Properties ⮕ Handles).\n\n#### Everything Else\n\nUnsupported platforms merely receive a stub function that does nothing.\n\n[`setproctitle()`]: https://www.freebsd.org/cgi/man.cgi?query=setproctitle\u0026sektion=3\n[prctl]: http://man7.org/linux/man-pages/man2/prctl.2.html\n[`SetConsoleTitleW()`]: https://docs.microsoft.com/en-us/windows/console/setconsoletitle\n[event handle]: https://docs.microsoft.com/en-us/windows/desktop/api/synchapi/nf-synchapi-createeventa\n[Process Explorer]: https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer\n[Process Hacker]: https://processhacker.sourceforge.io/\n[crate]: https://crates.io/crates/proctitle\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreaky%2Frust-proctitle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreaky%2Frust-proctitle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreaky%2Frust-proctitle/lists"}