Seccomp.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* vim: set expandtab ts=4 sw=4: */
  2. /*
  3. * You may redistribute this program and/or modify it under the terms of
  4. * the GNU General Public License as published by the Free Software Foundation,
  5. * either version 3 of the License, or (at your option) any later version.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU General Public License
  13. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. #ifndef Seccomp_H
  16. #define Seccomp_H
  17. #include "exception/Except.h"
  18. <?js
  19. var main = function (async) {
  20. if (typeof(builder.config.HAS_SECCOMP) !== 'undefined') {
  21. if (builder.config.HAS_SECCOMP) {
  22. file.links.push("util/Seccomp.c");
  23. return [
  24. "void Seccomp_dropPermissions(struct Except* eh);",
  25. "int Seccomp_isWorking();",
  26. "static inline int Seccomp_exists() { return 1; }",
  27. ].join('\n');
  28. } else {
  29. return [
  30. "static inline void Seccomp_dropPermissions(struct Except* eh) { }",
  31. "static inline int Seccomp_isWorking() { return 0; }",
  32. "static inline int Seccomp_exists() { return 0; }",
  33. ].join('\n');
  34. }
  35. }
  36. console.log("Searching for SECCOMP");
  37. var done = async();
  38. var HasFunction = require("./HasFunction");
  39. HasFunction.check(builder, "seccomp_init", ["-lseccomp"], function (err, has) {
  40. if (err) { throw err; }
  41. builder.config.HAS_SECCOMP = has;
  42. if (has) {
  43. console.log("Successfully found SECCOMP");
  44. builder.config.libs.push("-lseccomp");
  45. } else {
  46. console.log("Could not find SECCOMP, skipping");
  47. }
  48. done(main());
  49. });
  50. };
  51. return main(this.async);
  52. ?>
  53. #endif