libc
libc copied to clipboard
libc::clone() should take an unsafe callback
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.