{"id":17434855,"url":"https://github.com/coreyja/fcntl-rs","last_synced_at":"2025-10-08T21:34:31.179Z","repository":{"id":196299326,"uuid":"695701259","full_name":"coreyja/fcntl-rs","owner":"coreyja","description":"Fork of https://gitlab.com/BafDyce/fcntl-rs","archived":false,"fork":false,"pushed_at":"2023-10-01T16:27:35.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"ca/main/work-on-macos","last_synced_at":"2025-03-28T01:17:58.973Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coreyja.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","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":"2023-09-24T00:11:23.000Z","updated_at":"2023-09-24T00:13:04.000Z","dependencies_parsed_at":"2023-10-01T18:23:20.816Z","dependency_job_id":null,"html_url":"https://github.com/coreyja/fcntl-rs","commit_stats":null,"previous_names":["coreyja/fcntl-rs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/coreyja/fcntl-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreyja%2Ffcntl-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreyja%2Ffcntl-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreyja%2Ffcntl-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreyja%2Ffcntl-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coreyja","download_url":"https://codeload.github.com/coreyja/fcntl-rs/tar.gz/refs/heads/ca/main/work-on-macos","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreyja%2Ffcntl-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000709,"owners_count":26082838,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"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-10-17T09:23:59.750Z","updated_at":"2025-10-08T21:34:31.150Z","avatar_url":"https://github.com/coreyja.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fork of https://gitlab.com/BafDyce/fcntl-rs\n\n# fcntl-rs\n\n\u003e Wrapper around [fcntl (2)](https://www.man7.org/linux/man-pages/man2/fcntl.2.html) and convenience methods to make\n\u003e interacting with it easier. Currently only supports commands related to Advisory record locking.\n\n- [Documentation](https://docs.rs/fcntl)\n- [Crates.io](https://crates.io/crates/fcntl)\n- [Source Code](https://gitlab.com/BafDyce/fcntl-rs)\n\n## Usage\n\n`Cargo.toml`\n\n```toml\n[dependencies]\nfcntl = \"0.1\"\n```\n\n```rust\nuse std::fs::OpenOptions;\nuse fcntl::{is_file_locked, lock_file, unlock_file};\n\n// Open file\nlet file = OpenOptions::new().read(true).open(\"my.lock\").unwrap();\n\n// Check whether any process is currently holding a lock\nmatch is_file_locked(\u0026file, None) {\n    Ok(true) =\u003e println!(\"File is currently locked\"),\n    Ok(false) =\u003e println!(\"File is not locked\"),\n    Err(err) =\u003e println!(\"Error: {:?}\", err),\n}\n\n\n// Attempt to acquire a lock\nmatch lock_file(\u0026file, None, Some(FcntlLockType::Write)) {\n    Ok(true) =\u003e println!(\"Lock acquired!\"),\n    Ok(false) =\u003e println!(\"Could not acquire lock!\"),\n    Err(err) =\u003e println!(\"Error: {:?}\", err),\n}\n\n\n// Release lock again\nmatch unlock_file(\u0026file, None) {\n    Ok(true) =\u003e println!(\"Lock successfully release\"),\n    Ok(false) =\u003e println!(\"Failed to release lock\"),\n    Err(err) =\u003e println!(\"Error: {:?}\", err),\n}\n```\n\n## License\n\n[MIT](./LICENSE-MIT) OR [Apache-2.0](./LICENSE-APACHE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoreyja%2Ffcntl-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoreyja%2Ffcntl-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoreyja%2Ffcntl-rs/lists"}