shim_uname.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* Copyright (C) 2014 Stony Brook University
  2. This file is part of Graphene Library OS.
  3. Graphene Library OS is free software: you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public License
  5. as published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. Graphene Library OS 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 Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  13. /*
  14. * shim_uname.c
  15. *
  16. * Implementation of system call "uname".
  17. */
  18. #include <shim_internal.h>
  19. #include <shim_table.h>
  20. #include <shim_handle.h>
  21. #include <shim_fs.h>
  22. #include <shim_utils.h>
  23. #include <errno.h>
  24. #include <sys/utsname.h>
  25. /* DP: Damned lies */
  26. static struct old_utsname graphene_uname = {
  27. .sysname = "Linux",
  28. .nodename = "localhost",
  29. .release = "3.10.0",
  30. .version = "1",
  31. .machine = "x86_64"
  32. };
  33. int shim_do_uname (struct old_utsname * buf)
  34. {
  35. if (!buf || test_user_memory(buf, sizeof(*buf), true))
  36. return -EFAULT;
  37. memcpy(buf, &graphene_uname, sizeof(graphene_uname));
  38. return 0;
  39. }