fs-at-pointers.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* Copyright (C) 2021 Maxime Devos <maximedevos at telenet dot be>
  2. This library is free software; you can redistribute it and/or
  3. modify it under the terms of the GNU Lesser General Public
  4. License as published by the Free Software Foundation; either
  5. version 3 of the License, or (at your option) any later version.
  6. This library is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  9. Lesser General Public License for more details.
  10. You should have received a copy of the GNU Lesser General Public
  11. License along with this library; if not, write to the Free Software
  12. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 U>
  13. */
  14. /* Add this to guile's source code with a patch
  15. (as a source code patch or a static library
  16. to link with) if XXX elaborate & test & (optionally) use*/
  17. #define _GNU_SOURCE
  18. #include <sys/stat.h>
  19. #include <sys/types.h>
  20. #include <fcntl.h>
  21. #include <unistd.h>
  22. #include <libguile.h>
  23. #include <stdint.h>
  24. #define EXPORT(name, cfunc) \
  25. scm_c_define(name, scm_from_uintptr_t((uintptr_t) &cfunc))
  26. void
  27. init_fs_at_pointers (void)
  28. {
  29. EXPORT("p:openat", openat);
  30. EXPORT("p:fchmodat", fchmodat);
  31. EXPORT("p:fchownat", fchownat);
  32. EXPORT("p:__xmknodat", __xmknodat);
  33. EXPORT("p:__fxstatat", __fxstatat64);
  34. }