Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

interposer-safe.cpp 2.0KB

9 years ago
9 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Carla Interposer for unsafe backend functions
  3. * Copyright (C) 2014-2017 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the doc/GPL.txt file.
  16. */
  17. #include "CarlaUtils.hpp"
  18. #include <cerrno>
  19. #include <dlfcn.h>
  20. #include <sched.h>
  21. #include <spawn.h>
  22. #define PREVENTED_FUNC_MSG carla_stderr2("Carla prevented a plugin from calling '%s', bad plugin!", __FUNCTION__)
  23. // -----------------------------------------------------------------------
  24. // Our custom functions
  25. CARLA_EXPORT
  26. pid_t fork()
  27. {
  28. PREVENTED_FUNC_MSG;
  29. errno = ENOSYS;
  30. return -1;
  31. }
  32. CARLA_EXPORT
  33. int clone(int (*)(void*), void*, int, void*, ...)
  34. {
  35. PREVENTED_FUNC_MSG;
  36. errno = ENOSYS;
  37. return -1;
  38. }
  39. CARLA_EXPORT
  40. int posix_spawn(pid_t*, const char*, const posix_spawn_file_actions_t*, const posix_spawnattr_t*, char* const[], char* const[])
  41. {
  42. PREVENTED_FUNC_MSG;
  43. return ENOSYS;
  44. }
  45. CARLA_EXPORT
  46. int posix_spawnp(pid_t*, const char*, const posix_spawn_file_actions_t*, const posix_spawnattr_t*, char* const[], char* const[])
  47. {
  48. PREVENTED_FUNC_MSG;
  49. return ENOSYS;
  50. }
  51. // -----------------------------------------------------------------------
  52. CARLA_EXPORT
  53. void gtk_init(int*, char***)
  54. {
  55. PREVENTED_FUNC_MSG;
  56. }
  57. CARLA_EXPORT
  58. int gtk_init_check(int*, char***)
  59. {
  60. PREVENTED_FUNC_MSG;
  61. return 0;
  62. }
  63. CARLA_EXPORT
  64. int gtk_init_with_args(int*, char***, const char*, void*, const char*, void**)
  65. {
  66. PREVENTED_FUNC_MSG;
  67. return 0;
  68. }
  69. // -----------------------------------------------------------------------