Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. # This is a shell archive. Save it in a file, remove anything before
  2. # this line, and then unpack it by entering "sh file". Note, it may
  3. # create directories; files and directories will be owned by you and
  4. # have default permissions.
  5. #
  6. # This archive contains:
  7. #
  8. # test_int_sysctl.c
  9. # Makefile
  10. #
  11. echo x - test_int_sysctl.c
  12. sed 's/^X//' >test_int_sysctl.c << '77aefbd69fbbe98c6a0bcaf0991107f7'
  13. X#include <sys/param.h>
  14. X#include <sys/kernel.h>
  15. X#include <sys/proc.h>
  16. X#include <sys/sysctl.h>
  17. X#include <sys/systm.h>
  18. X#include <sys/module.h>
  19. X
  20. X#define MODULE_NAME "test_int_sysctl"
  21. X
  22. Xstatic int _sysctl;
  23. X
  24. XSYSCTL_INT(_debug, OID_AUTO, test_int_sysctl, CTLFLAG_RW, &_sysctl, 0,
  25. X "Test sysctl OID");
  26. X
  27. Xstatic int
  28. Xload (module_t m, int what, void *arg)
  29. X{
  30. X switch (what) {
  31. X case MOD_LOAD:
  32. X printf("%s: %d\n", MODULE_NAME, _sysctl);
  33. X break;
  34. X }
  35. X return (0);
  36. X}
  37. X
  38. Xstatic moduledata_t test_int_sysctl_mod = {
  39. X MODULE_NAME,
  40. X load,
  41. X};
  42. XDECLARE_MODULE(test_int_sysctl, test_int_sysctl_mod, SI_SUB_KLD,
  43. X SI_ORDER_ANY);
  44. XMODULE_VERSION(test_int_sysctl, 1);
  45. 77aefbd69fbbe98c6a0bcaf0991107f7
  46. echo x - Makefile
  47. sed 's/^X//' >Makefile << 'b67911656ef5d18c4ae36cb6741b7965'
  48. XKMOD= test_int_sysctl
  49. XSRCS= test_int_sysctl.c
  50. X
  51. X.include <bsd.kmod.mk>
  52. b67911656ef5d18c4ae36cb6741b7965
  53. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement