glibc-liblibos.patch 4.1 KB

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