Skip to content

libc::clone() should take an unsafe callback #2198

Open
@jstarks

Description

@jstarks

On Linux, clone takes a callback function pointer. The function pointer type is not marked unsafe, but there is basically no way to implement this callback with a safe function since it takes its context parameter by pointer.

It seems to me that unsafe should be added to the function pointer type, e.g.:

    pub fn clone(
        cb: unsafe extern "C" fn(*mut ::c_void) -> ::c_int,
        child_stack: *mut ::c_void,
        flags: ::c_int,
        arg: *mut ::c_void,
        ...
    ) -> ::c_int;

I'm not certain, but I don't think this would be a breaking change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.breakage-candidate

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions