hugetlbfs_unlinked_fd man page
hugetlbfs_unlinked_fd, hugetlbfs_unlinked_fd_for_size — Obtain a file descriptor for a new unlinked file in hugetlbfs
int hugetlbfs_unlinked_fd_for_size(long page_size);
These functions return an open file descriptor for a unique, newly-created file in a hugetlbfs filesystem. To avoid leaking hugepages, the file is unlinked automatically before the function returns.
For hugetlbfs_unlinked_fd, the default huge page size is used (see gethugepagesize(3)). For hugetlbfs_unlinked_fd_for_size, a valid huge page size must be specified (see gethugepagesizes(3)).
On success, a valid open file descriptor is returned. On failure, -1 is returned and errno may be set appropriately.
gethugepagesize(3), gethugepagesizes(3), mkstemp(3), libhugetlbfs(7)
libhugetlbfs was written by various people on the libhugetlbfs-devel mailing list.