Skip to content

Inappropriate Macro use and Unsafety #7

@henninglive

Description

@henninglive

Why does this crate use macros to wrap FFI? I see no benefits in using macros over normal functions. The macro documentation does not include the types of parameters, there is no unsafe keywords when appropriate and inlining should account for any performance benefits.

There are also other safety and usability concerns in this crate. There is no error checking, this is left to the user. When providing a safe interface, you should probably check for errors and return a std::io::Error constructed from the errno with Error::last_os_error(). Also, signal numbers should probably be a enum bit set to keep users from passing invalid values.

Take a look at the Nix crate, they implement the wrappers for same functions, but with a reasonably safe interface.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions