xref: /llvm-project/compiler-rt/test/sanitizer_common/TestCases/Linux/name_to_handle_at.cpp (revision 74989aff5351beaeb03f46fc2fe57752d57f848b)
1 // RUN: %clangxx -O0 %s -o %t && %run %t
2 // UNSUPPORTED: android
3 
4 #include <assert.h>
5 #include <fcntl.h>
6 #include <stdlib.h>
7 #include <sys/stat.h>
8 #include <sys/types.h>
9 
main(int argc,char ** argv)10 int main(int argc, char **argv) {
11   int mount_id;
12   struct file_handle *handle = reinterpret_cast<struct file_handle *>(
13       malloc(sizeof(*handle) + MAX_HANDLE_SZ));
14 
15   handle->handle_bytes = MAX_HANDLE_SZ;
16   int res = name_to_handle_at(AT_FDCWD, "/dev/null", handle, &mount_id, 0);
17   assert(!res);
18 
19   free(handle);
20   return 0;
21 }
22