false.c 478 B

12345678910111213141516171819
  1. /* Exit with status 1 like the POSIX false utility:
  2. * http://pubs.opengroup.org/onlinepubs/9699919799/utilities/false.html
  3. *
  4. * Can be uesd to test that emulators forward the exit status properly.
  5. * https://cirosantilli.com/linux-kernel-module-cheat#gem5-syscall-emulation-exit-status
  6. */
  7. #include <stdlib.h>
  8. int main(int argc, char **argv) {
  9. int ret;
  10. if (argc <= 1) {
  11. ret = 1;
  12. } else {
  13. ret = strtoull(argv[1], NULL, 0);
  14. }
  15. return ret;
  16. }