liblibos.patch 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. diff --git a/Makeconfig b/Makeconfig
  2. index 1908f27..cf34ba1 100644
  3. --- a/Makeconfig
  4. +++ b/Makeconfig
  5. @@ -1100,4 +1100,7 @@ all-subdirs = csu assert ctype locale in
  6. $(add-on-subdirs) dlfcn elf
  7. +# Add libos for Graphene
  8. +all-subdirs += libos
  9. +
  10. ifndef avoid-generated
  11. # sysd-sorted itself will contain rules making the sysd-sorted target
  12. diff --git a/libos/Makefile b/libos/Makefile
  13. new file mode 100644
  14. index 0000000..7e0027d
  15. --- /dev/null
  16. +++ b/libos/Makefile
  17. @@ -0,0 +1,56 @@
  18. +# Copyright (C) 1996-2001,2002,2003,2004,2005,2006
  19. +# Free Software Foundation, Inc.
  20. +# This file is part of the GNU C Library.
  21. +
  22. +# The GNU C Library is free software; you can redistribute it and/or
  23. +# modify it under the terms of the GNU Lesser General Public
  24. +# License as published by the Free Software Foundation; either
  25. +# version 2.1 of the License, or (at your option) any later version.
  26. +
  27. +# The GNU C Library is distributed in the hope that it will be useful,
  28. +# but WITHOUT ANY WARRANTY; without even the implied warranty of
  29. +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  30. +# Lesser General Public License for more details.
  31. +
  32. +# You should have received a copy of the GNU Lesser General Public
  33. +# License along with the GNU C Library; if not, write to the Free
  34. +# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  35. +# 02111-1307 USA.
  36. +
  37. +# Makefile for the libos library.
  38. +
  39. +subdir := libos
  40. +
  41. +# Installed header files.
  42. +headers :=
  43. +
  44. +# Internal header files.
  45. +distribute := errno.h
  46. +
  47. +liblibos-routines := wrapper
  48. +
  49. +# Build the -llibos library.
  50. +
  51. +extra-libs := liblibos
  52. +extra-libs-others = $(extra-libs)
  53. +
  54. +include ../Makeconfig
  55. +
  56. +ifeq ($(versioning),yes)
  57. +liblibos-routines +=
  58. +liblibos-shared-only-routines :=
  59. +endif
  60. +
  61. +tests =
  62. +
  63. +modules-names =
  64. +
  65. +extra-test-objs += $(modules-names:=.os)
  66. +generated := $(modules-names:=.so)
  67. +
  68. +include ../Rules
  69. +
  70. +# Depend on libc.so so a DT_NEEDED is generated in the shared objects.
  71. +# This ensures they will load libc.so for needed symbols if loaded by
  72. +# a statically-linked program that hasn't already loaded it.
  73. +$(objpfx)liblibos.so: $(common-objpfx)libc.so $(common-objpfx)libc_nonshared.a
  74. diff --git a/libos/Versions b/libos/Versions
  75. new file mode 100644
  76. index 0000000..3211637
  77. --- /dev/null
  78. +++ b/libos/Versions
  79. @@ -0,0 +1,7 @@
  80. +liblibos {
  81. + GLIBC_2.19 {
  82. + checkpoint;
  83. + msgpersist;
  84. + benchmark_rpc; send_rpc; recv_rpc;
  85. + }
  86. +}
  87. diff --git a/libos/wrapper.c b/libos/wrapper.c
  88. new file mode 100644
  89. index 0000000..8785629
  90. --- /dev/null
  91. +++ b/libos/wrapper.c
  92. @@ -0,0 +1,41 @@
  93. +#include <errno.h>
  94. +#include <kernel-features.h>
  95. +#include <shim_unistd.h>
  96. +#include <sysdep.h>
  97. +#include <sysdep-cancel.h>
  98. +#include <sys/syscall.h>
  99. +
  100. +#ifdef __NR_checkpoint
  101. +int checkpoint (const char *filename)
  102. +{
  103. + return INLINE_SYSCALL (checkpoint, 1, filename);
  104. +}
  105. +#endif
  106. +
  107. +#ifdef __NR_msgpersist
  108. +int msgpersist (int msqid, int cmd)
  109. +{
  110. + return INLINE_SYSCALL (msgpersist, 2, msqid, cmd);
  111. +}
  112. +#endif
  113. +
  114. +#ifdef __NR_benchmark_rpc
  115. +int benchmark_rpc(pid_t pid, int times, const void *buf, size_t size)
  116. +{
  117. + return INLINE_SYSCALL (benchmark_rpc, 4, pid, times, buf, size);
  118. +}
  119. +#endif
  120. +
  121. +#ifdef __NR_send_rpc
  122. +size_t send_rpc (pid_t pid, const void *buf, size_t size)
  123. +{
  124. + return INLINE_SYSCALL (send_rpc, 3, pid, buf, size);
  125. +}
  126. +#endif
  127. +
  128. +#ifdef __NR_recv_rpc
  129. +size_t recv_rpc (pid_t * pid, void *buf, size_t size)
  130. +{
  131. + return INLINE_SYSCALL (recv_rpc, 3, pid, buf, size);
  132. +}
  133. +#endif