+
+/**
+ * Generates a temporary filename and stores it to the @name_buf (of size
+ * at least * `TEMP_FILE_NAME_LEN`). If @open_flags are not NULL, flags that
+ * should be OR-ed with other flags to open() will be stored there.
+ *
+ * The location and style of temporary files is controlled by the configuration.
+ * By default, the system temp directory (`$TMPDIR` or `/tmp`) is used.
+ *
+ * If the location is a publicly writeable directory (like `/tmp`), the
+ * generated filename cannot be guaranteed to be unique, so @open_flags
+ * will include `O_EXCL` and you have to check the result of open() and
+ * iterate if needed.
+ *
+ * This function is not specific to fastbufs, it can be used separately.
+ **/
+void temp_file_name(char *name_buf, int *open_flags);
+
+/**
+ * Opens a temporary file and returns its file descriptor.
+ * You specify the file @mode and @open_flags passed to open().
+ *
+ * If the @name_buf (of at last `TEMP_FILE_NAME_LEN` chars) is not NULL,
+ * the filename is also stored in it.
+ *
+ * This function is not specific to fastbufs, it can be used separately.
+ */
+int open_tmp(char *name_buf, int open_flags, int mode);
+
+/**
+ * Sometimes, a file is created as temporary and then moved to a stable
+ * location. This function takes a fastbuf created by @bopen_tmp_file()
+ * or @bopen_tmp(), marks it as permanent, closes it and renames it to
+ * @name.
+ *
+ * Please note that it assumes that the temporary file and the @name
+ * are on the same volume (otherwise, rename() fails), so you might
+ * want to configure a special location for the temporary files
+ * beforehand.
+ */