Crate origin[][src]

Expand description


Program and thread startup and shutdown in Rust

Github Actions CI Status zulip chat page docs

Origin implements program startup and shutdown, as well as thread startup and shutdown, for Linux, implemented in Rust.

Program startup and shutdown for Linux is traditionally implemented in crt1.o, and the libc functions exit, atexit, and _exit. And thread startup and shutdown are traditionally implemented in libpthread functions pthread_create, pthread_join, pthread_detach, and so on. Origin provides its own implementations of this functionality, written in Rust.

For an C-ABI-compatible interface to this functionality, see c-scape.

This is part of the Mustang project, building Rust programs written entirely in Rust.


Data associated with a thread. This is not repr(C) and not ABI-exposed.


Register a function to be called when exit is called.

Register functions to be called when fork is called.

Registers a function to call when the current thread exits.

Creates a new thread.

Return a raw pointer to the data associated with the current thread.

Return the current thread id.

Return the TLS entry for the current thread.

Return the default guard size for new threads.

Return the default stack size for new threads.

Marks a thread as “detached”.

Call all the functions registered with at_exit and .fini_array, and exit the program.

Exit the program without calling functions registered with at_exit or .fini_array.

Creates a new process by duplicating the calling process.

Waits for a thread to finish.

Return the current thread’s stack address (lowest address), size, and guard size.