jack1 codebase
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.

74 lines
2.7KB

  1. /**
  2. * GPL etc.
  3. *
  4. * @author Florian Faber
  5. *
  6. * @version 0.1 (2009-01-17) [FF]
  7. * - initial version
  8. **/
  9. #include <stdio.h>
  10. #include <jack/systemtest.h>
  11. #include <jack/sanitycheck.h>
  12. int sanitycheck() {
  13. int errors = 0;
  14. int relogin = 0;
  15. if (!system_user_can_rtprio()) {
  16. errors++;
  17. relogin++;
  18. fprintf(stderr, "\nYou are not allowed to set realtime priority.\n");
  19. if (!system_has_rtprio_limits_conf()) {
  20. errors++;
  21. relogin++;
  22. fprintf (stderr, "Please check your /etc/security/limits.conf for the following lines\n");
  23. fprintf (stderr, "and correct/add them:\n\n");
  24. fprintf(stderr, " @audio - rtprio 100\n");
  25. fprintf(stderr, " @audio - nice -10\n");
  26. } else if (!system_has_audiogroup()) {
  27. errors++;
  28. relogin++;
  29. fprintf(stderr, "\nYour system has no audio group. Please add it by executing (as root):\n");
  30. fprintf(stderr, " groupadd -r audio\n");
  31. fprintf(stderr, " usermod -a -G audio %s\n", system_get_username());
  32. } else if (!system_user_in_audiogroup()) {
  33. errors++;
  34. relogin++;
  35. fprintf(stderr, "\nYour system has an audio group, but you are not a member of it.\n");
  36. fprintf(stderr, "Please add yourself to the audio group by executing (as root):\n");
  37. fprintf(stderr, " usermod -a -G audio %s\n", system_get_username());
  38. }
  39. }
  40. if (system_has_frequencyscaling() && system_uses_frequencyscaling()) {
  41. errors++;
  42. fprintf(stderr, "\nYour system seems to use frequency scaling. This can have a serious impact\n");
  43. fprintf(stderr, "on the audio latency. Please turn it off, e.g. by chosing the 'performance'\n");
  44. fprintf(stderr, "governor.\n");
  45. }
  46. if (system_memlock_is_unlimited()) {
  47. fprintf(stderr, "\nMemory locking is unlimited - this is dangerous. Please alter the line");
  48. fprintf(stderr, " @audio - memlock unlimited");
  49. fprintf(stderr, "in your /etc/limits.conf to");
  50. fprintf(stderr, " @audio - memlock %llu\n", (system_available_physical_mem()*3)/4096);
  51. } else if (0==system_memlock_amount()) {
  52. errors++;
  53. relogin++;
  54. fprintf(stderr, "\nYou are not allowed to lock memory. Please add a line\n");
  55. fprintf(stderr, " @audio - memlock %llu\n", (system_available_physical_mem()*3)/4096);
  56. fprintf(stderr, "in your /etc/limits.conf.\n");
  57. }
  58. if (0<relogin) {
  59. fprintf(stderr, "\nAfter applying these changes, please re-login in order for them to take effect.\n");
  60. }
  61. if (0<errors) {
  62. fprintf(stderr, "\nYou don't appear to have a sane system configuration. It is very likely that you\n");
  63. fprintf(stderr, "encounter xruns. Please apply all the above mentioned changes and start jack again!\n");
  64. }
  65. return errors;
  66. }