{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreibysocajnptygrzjzli6dsgaj5y3xphb2w3gxnlvqckficxu746ea",
    "uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mhvtkey6lhn2"
  },
  "path": "/t/idea-add-an-option-to-set-the-mode-to-fs-copy/24080#post_15",
  "publishedAt": "2026-03-25T04:11:53.000Z",
  "site": "https://internals.rust-lang.org",
  "tags": [
    "added",
    "macOS 10.12",
    "The implementation of COPYFILE_CLONE"
  ],
  "textContent": "jrose:\n\n> EDIT: …and `copyfile` now has a `COPYFILE_CLONE` flag, so maybe `fclonefileat` is a distraction anyway.\n\nThat does seem like a nice potential simplification. `COPYFILE_CLONE` was added in `copyfile-138` which is from macOS 10.12, and 10.12 happens to be the minimum macOS supported by Rust. So the Apple `fs::copy` implementation could probably be replaced in its entirety with a call to `copyfile`.\n\nBut just to be clear, `copyfile` and `fcopyfile` are userland library functions, not syscalls, so they don't add any new abilities. In particular, `fcopyfile` doesn't let you clone into a file descriptor. The implementation of COPYFILE_CLONE is based on `clonefileat` and only works with regular `copyfile`. `fcopyfile` seems to just silently ignore the flag (even if you pass the `_FORCE` variant!).",
  "title": "Idea: Add an option to set the mode to fs::copy"
}