Skip to main content

splinter_create

Function splinter_create 

Source
pub unsafe extern "C" fn splinter_create(
    name_or_path: *const c_char,
    slots: usize,
    max_value_sz: usize,
) -> c_int
Expand description

@brief Creates and initializes a new splinter store. @param name_or_path The name of the shared memory object or path to the file. @param slots The total number of key-value slots to allocate. @param max_value_sz The maximum size in bytes for any single value. @return 0 on success, -1 on failure (e.g., store already exists). @note Creation is exclusive (O_EXCL): if a store of the same name/path already exists this fails (errno EEXIST) rather than adopting or reinitializing it. In persistent mode the path is also opened O_NOFOLLOW, so a symlink planted at that path is refused. Use splinter_open() to attach to an existing store, or splinter_create_or_open() to do either. @note The store is created with mode 0666 masked by the process umask, so by default it inherits the shell’s umask (often world-readable on GNU systems). Set SPLINTER_DEFAULT_UMASK in the environment to an octal mask (e.g. “077” for a private 0600 store) to override this at creation time; adjust further with chmod afterward. Applies to persistent mode too.