Skip to content

Commit

Permalink
Add note about libc::exit's unsafety.
Browse files Browse the repository at this point in the history
Fixes #19245.
  • Loading branch information
steveklabnik committed Jan 14, 2015
1 parent b21a6da commit acf7fb9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/liblibc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4157,6 +4157,27 @@ pub mod funcs {
pub fn malloc(size: size_t) -> *mut c_void;
pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
pub fn free(p: *mut c_void);

/// Exits the running program in a possibly dangerous manner.
///
/// # Unsafety
///
/// While this forces your program to exit, it does so in a way that has
/// consequences. This will skip all unwinding code, which means that anything
/// relying on unwinding for cleanup (such as flushing and closing a buffer to a
/// file) may act in an unexpected way.
///
/// # Examples
///
/// ```no_run
/// extern crate libc;
///
/// fn main() {
/// unsafe {
/// libc::exit(1);
/// }
/// }
/// ```
pub fn exit(status: c_int) -> !;
pub fn _exit(status: c_int) -> !;
pub fn atexit(cb: extern fn()) -> c_int;
Expand Down

1 comment on commit acf7fb9

@steveklabnik
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+ rollup

Please sign in to comment.