shim_uname.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 <errno.h>
  19. #include <shim_fs.h>
  20. #include <shim_handle.h>
  21. #include <shim_internal.h>
  22. #include <shim_table.h>
  23. #include <shim_utils.h>
  24. #include <sys/utsname.h>
  25. /* DP: Damned lies */
  26. static struct old_utsname graphene_uname = {.sysname = "Linux",
  27. .nodename = "localhost",
  28. .release = "3.10.0",
  29. .version = "1",
  30. .machine = "x86_64"};
  31. int shim_do_uname(struct old_utsname* buf) {
  32. if (!buf || test_user_memory(buf, sizeof(*buf), true))
  33. return -EFAULT;
  34. memcpy(buf, &graphene_uname, sizeof(graphene_uname));
  35. return 0;
  36. }