Permalink
Browse files

Merge in ports work

This is a spiffied-up rebase of a bunch of intermediate changes, presented
as a whole because it is, surprisingly, less confusing that way.  The basic
idea is to separate the guts code into categories ranging from generic
stuff that can be the same everywhere and specific variants.  The big scary
one is the Darwin support, which actually seems to run okay on 64-bit OS X
10.6.  (No other variants were tested.)  The other example given is support
for the old clone() syscall on RHEL 4, which affects some wrlinux use cases.

There's a few minor cleanup bits here, such as a function with inconsistent
calling conventions, but nothing really exciting.
  • Loading branch information...
1 parent 96d8e7c commit 29e8b8a4cd8f7383c3d851b6255272f1c2a5d286 @wr-seebs wr-seebs committed Mar 25, 2011
Showing with 2,554 additions and 929 deletions.
  1. +2 −0 .gitignore
  2. +14 −0 ChangeLog.txt
  3. +7 −6 Makefile.in
  4. +23 −0 doc/ports
  5. +10 −5 maketables
  6. +188 −24 makewrappers
  7. +13 −0 ports/common/guts/execl.c
  8. +13 −0 ports/common/guts/execle.c
  9. +13 −0 ports/common/guts/execlp.c
  10. 0 { → ports/common}/guts/execv.c
  11. 0 { → ports/common}/guts/execve.c
  12. 0 { → ports/common}/guts/execvp.c
  13. 0 { → ports/common}/guts/fork.c
  14. +376 −0 ports/common/pseudo_wrappers.c
  15. +8 −0 ports/common/subports
  16. +7 −0 ports/common/wrapfuncs.in
  17. +17 −0 ports/darwin/guts/COPYRIGHT
  18. +46 −0 ports/darwin/guts/fcntl.c
  19. +13 −0 ports/darwin/guts/fgetgrent_r.c
  20. +13 −0 ports/darwin/guts/fgetpwent_r.c
  21. +13 −0 ports/darwin/guts/fgetxattr.c
  22. +13 −0 ports/darwin/guts/flistxattr.c
  23. +13 −0 ports/darwin/guts/fsetxattr.c
  24. +27 −0 ports/darwin/guts/fstat.c
  25. +13 −0 ports/darwin/guts/getgrent_r.c
  26. +42 −0 ports/darwin/guts/getgrouplist.c
  27. +22 −0 ports/darwin/guts/getgroups.c
  28. +13 −0 ports/darwin/guts/getpwent_r.c
  29. +13 −0 ports/darwin/guts/getxattr.c
  30. +13 −0 ports/darwin/guts/listxattr.c
  31. +27 −0 ports/darwin/guts/lstat.c
  32. +49 −0 ports/darwin/guts/open.c
  33. +14 −0 ports/darwin/guts/scandir.c
  34. +13 −0 ports/darwin/guts/setxattr.c
  35. +31 −0 ports/darwin/guts/stat.c
  36. +10 −0 ports/darwin/portdefs.h
  37. +2 −0 ports/darwin/preports
  38. +316 −0 ports/darwin/pseudo_wrappers.c
  39. +3 −0 ports/darwin/subports
  40. +25 −0 ports/darwin/wrapfuncs.in
  41. +17 −0 ports/linux/guts/COPYRIGHT
  42. 0 { → ports/linux}/guts/__fxstat.c
  43. +2 −3 { → ports/linux}/guts/__fxstat64.c
  44. 0 { → ports/linux}/guts/__fxstatat.c
  45. 0 { → ports/linux}/guts/__fxstatat64.c
  46. 0 { → ports/linux}/guts/__lxstat.c
  47. 0 { → ports/linux}/guts/__lxstat64.c
  48. 0 { → ports/linux}/guts/__openat64_2.c
  49. 0 { → ports/linux}/guts/__openat_2.c
  50. 0 { → ports/linux}/guts/__xmknod.c
  51. +2 −4 { → ports/linux}/guts/__xmknodat.c
  52. 0 { → ports/linux}/guts/__xstat.c
  53. 0 { → ports/linux}/guts/__xstat64.c
  54. 0 { → ports/linux}/guts/canonicalize_file_name.c
  55. 0 { → ports/linux}/guts/creat64.c
  56. 0 { → ports/linux}/guts/eaccess.c
  57. 0 { → ports/linux}/guts/euidaccess.c
  58. 0 { → ports/linux}/guts/fcntl.c
  59. +5 −0 { → ports/linux}/guts/fgetxattr.c
  60. +4 −0 { → ports/linux}/guts/flistxattr.c
  61. 0 { → ports/linux}/guts/fopen64.c
  62. +3 −0 { → ports/linux}/guts/fremovexattr.c
  63. 0 { → ports/linux}/guts/freopen64.c
  64. +6 −0 { → ports/linux}/guts/fsetxattr.c
  65. +13 −0 ports/linux/guts/fstat.c
  66. 0 { → ports/linux}/guts/ftw64.c
  67. 0 { → ports/linux}/guts/get_current_dir_name.c
  68. +1 −8 { → ports/linux}/guts/getgrent_r.c
  69. 0 { → ports/linux}/guts/getgrouplist.c
  70. 0 { → ports/linux}/guts/getgroups.c
  71. 0 { → ports/linux}/guts/getpw.c
  72. +2 −2 { → ports/linux}/guts/getpwent_r.c
  73. 0 { → ports/linux}/guts/getresgid.c
  74. 0 { → ports/linux}/guts/getresuid.c
  75. +5 −0 { → ports/linux}/guts/getxattr.c
  76. 0 { → ports/linux}/guts/glob64.c
  77. 0 { → ports/linux}/guts/lchown.c
  78. 0 { → ports/linux}/guts/lckpwdf.c
  79. +5 −0 { → ports/linux}/guts/lgetxattr.c
  80. +4 −0 { → ports/linux}/guts/listxattr.c
  81. +4 −0 { → ports/linux}/guts/llistxattr.c
  82. +3 −0 { → ports/linux}/guts/lremovexattr.c
  83. +6 −0 { → ports/linux}/guts/lsetxattr.c
  84. +13 −0 ports/linux/guts/lstat.c
  85. 0 { → ports/linux}/guts/mkstemp64.c
  86. 0 { → ports/linux}/guts/nftw64.c
  87. 0 { → ports/linux}/guts/open.c
  88. 0 { → ports/linux}/guts/open64.c
  89. 0 { → ports/linux}/guts/openat.c
  90. 0 { → ports/linux}/guts/openat64.c
  91. +3 −0 { → ports/linux}/guts/removexattr.c
  92. 0 { → ports/linux}/guts/scandir.c
  93. 0 { → ports/linux}/guts/scandir64.c
  94. 0 { → ports/linux}/guts/setfsgid.c
  95. 0 { → ports/linux}/guts/setfsuid.c
  96. 0 { → ports/linux}/guts/setgroups.c
  97. 0 { → ports/linux}/guts/setresgid.c
  98. 0 { → ports/linux}/guts/setresuid.c
  99. +6 −0 { → ports/linux}/guts/setxattr.c
  100. +13 −0 ports/linux/guts/stat.c
  101. 0 { → ports/linux}/guts/truncate64.c
  102. 0 { → ports/linux}/guts/ulckpwdf.c
  103. 0 { → ports/linux/newclone}/guts/clone.c
  104. +69 −0 ports/linux/newclone/pseudo_wrappers.c
  105. +1 −0 ports/linux/newclone/wrapfuncs.in
  106. +27 −0 ports/linux/oldclone/guts/clone.c
  107. +59 −0 ports/linux/oldclone/pseudo_wrappers.c
  108. +1 −0 ports/linux/oldclone/wrapfuncs.in
  109. +5 −0 ports/linux/portdefs.h
  110. +2 −0 ports/linux/preports
  111. +18 −0 ports/linux/pseudo_wrappers.c
  112. +27 −0 ports/linux/subports
  113. +64 −0 ports/linux/wrapfuncs.in
  114. +17 −0 ports/uids_generic/guts/COPYRIGHT
  115. 0 { → ports/uids_generic}/guts/endgrent.c
  116. 0 { → ports/uids_generic}/guts/endpwent.c
  117. 0 { → ports/uids_generic}/guts/getegid.c
  118. 0 { → ports/uids_generic}/guts/geteuid.c
  119. 0 { → ports/uids_generic}/guts/getgid.c
  120. 0 { → ports/uids_generic}/guts/getgrent.c
  121. 0 { → ports/uids_generic}/guts/getgrgid.c
  122. 0 { → ports/uids_generic}/guts/getgrgid_r.c
  123. 0 { → ports/uids_generic}/guts/getgrnam.c
  124. 0 { → ports/uids_generic}/guts/getgrnam_r.c
  125. 0 { → ports/uids_generic}/guts/getpwent.c
  126. 0 { → ports/uids_generic}/guts/getpwnam.c
  127. 0 { → ports/uids_generic}/guts/getpwnam_r.c
  128. 0 { → ports/uids_generic}/guts/getpwuid.c
  129. 0 { → ports/uids_generic}/guts/getpwuid_r.c
  130. 0 { → ports/uids_generic}/guts/getuid.c
  131. 0 { → ports/uids_generic}/guts/setegid.c
  132. 0 { → ports/uids_generic}/guts/seteuid.c
  133. 0 { → ports/uids_generic}/guts/setgid.c
  134. 0 { → ports/uids_generic}/guts/setgrent.c
  135. 0 { → ports/uids_generic}/guts/setpwent.c
  136. 0 { → ports/uids_generic}/guts/setregid.c
  137. 0 { → ports/uids_generic}/guts/setreuid.c
  138. 0 { → ports/uids_generic}/guts/setuid.c
  139. +25 −0 ports/uids_generic/wrapfuncs.in
  140. +17 −0 ports/unix/guts/COPYRIGHT
  141. +2 −2 { → ports/unix}/guts/access.c
  142. 0 { → ports/unix}/guts/acct.c
  143. 0 { → ports/unix}/guts/chdir.c
  144. 0 { → ports/unix}/guts/chmod.c
  145. 0 { → ports/unix}/guts/chown.c
  146. 0 { → ports/unix}/guts/chroot.c
  147. 0 { → ports/unix}/guts/close.c
  148. +1 −1 { → ports/unix}/guts/creat.c
  149. 0 { → ports/unix}/guts/dup.c
  150. 0 { → ports/unix}/guts/dup2.c
  151. 0 { → ports/unix}/guts/fchdir.c
  152. +5 −7 { → ports/unix}/guts/fchmod.c
  153. +8 −10 { → ports/unix}/guts/fchmodat.c
  154. +8 −10 { → ports/unix}/guts/fchown.c
  155. +9 −11 { → ports/unix}/guts/fchownat.c
  156. 0 { → ports/unix}/guts/fclose.c
  157. +6 −6 { → ports/unix}/guts/fopen.c
  158. +6 −6 { → ports/unix}/guts/freopen.c
  159. 0 { → ports/unix}/guts/fts_open.c
  160. 0 { → ports/unix}/guts/ftw.c
  161. 0 { → ports/unix}/guts/getcwd.c
  162. 0 { → ports/unix}/guts/getwd.c
  163. 0 { → ports/unix}/guts/glob.c
  164. +13 −0 ports/unix/guts/lchown.c
  165. +5 −5 { → ports/unix}/guts/link.c
  166. 0 { → ports/unix}/guts/lutimes.c
  167. 0 { → ports/unix}/guts/mkdir.c
  168. +4 −4 { → ports/unix}/guts/mkdirat.c
  169. +3 −3 { → ports/unix}/guts/mkdtemp.c
  170. 0 { → ports/unix}/guts/mkfifo.c
  171. +1 −2 { → ports/unix}/guts/mkfifoat.c
  172. +13 −0 ports/unix/guts/mknod.c
  173. +66 −0 ports/unix/guts/mknodat.c
  174. +5 −5 { → ports/unix}/guts/mkstemp.c
  175. 0 { → ports/unix}/guts/mktemp.c
  176. 0 { → ports/unix}/guts/nftw.c
  177. 0 { → ports/unix}/guts/opendir.c
  178. 0 { → ports/unix}/guts/pathconf.c
  179. 0 { → ports/unix}/guts/readlink.c
  180. 0 { → ports/unix}/guts/readlinkat.c
  181. 0 { → ports/unix}/guts/realpath.c
  182. +1 −1 { → ports/unix}/guts/remove.c
  183. +8 −8 { → ports/unix}/guts/rename.c
  184. 0 { → ports/unix}/guts/renameat.c
  185. +5 −5 { → ports/unix}/guts/rmdir.c
  186. 0 { → ports/unix}/guts/symlink.c
  187. +4 −4 { → ports/unix}/guts/symlinkat.c
  188. 0 { → ports/unix}/guts/tempnam.c
  189. 0 { → ports/unix}/guts/tmpnam.c
  190. 0 { → ports/unix}/guts/truncate.c
  191. 0 { → ports/unix}/guts/unlink.c
  192. +6 −6 { → ports/unix}/guts/unlinkat.c
  193. 0 { → ports/unix}/guts/utime.c
  194. 0 { → ports/unix}/guts/utimes.c
  195. +56 −0 ports/unix/wrapfuncs.in
  196. +9 −2 pseudo.1
  197. +11 −11 pseudo.c
  198. +6 −3 pseudo.h
  199. +75 −40 pseudo_client.c
  200. +6 −3 pseudo_client.h
  201. +28 −26 pseudo_db.c
  202. +22 −2 pseudo_ipc.c
  203. +9 −2 pseudo_ipc.h
  204. +5 −1 pseudo_server.c
  205. +190 −65 pseudo_util.c
  206. +34 −430 pseudo_wrappers.c
  207. +19 −7 templatefile.py
  208. +2 −1 templates/guts
  209. +5 −0 templates/port_wrappers
  210. +6 −0 templates/pseudo_ports
  211. +6 −3 templates/wrapfuncs.c
  212. +1 −18 templates/wrapfuncs.h
  213. +1 −27 templates/wrapper_table
  214. +0 −124 wrapfuncs.in
  215. +0 −16 wrapfuncs64.in
View
@@ -8,4 +8,6 @@ pseudodb
pseudolog
pseudo_tables.c
pseudo_tables.h
+port_wrappers.c
+pseudo_ports.h
templatefile.pyc
View
@@ -1,6 +1,20 @@
2011-03-25:
* (seebs) don't try to search path when you don't have one
+ * (seebs) merge in ports branch
+2011-03-24:
+ * (seebs) more work on OS X port.
+ * (seebs) include errno in the verbose debug output
+ * (seebs) fix darwin fcntl.
+ * (seebs) fix *xattr for darwin (they take more arguments)
+
+2011-02-18:
+ * (seebs) moving things to Unix port, cleanup for Darwin
+
+2011-02-14:
+ * (seebs) first pass on splitting out ports
+ * (seebs) various cleanup
+
2011-02-10:
* (seebs) pseudo_client_shutdown(), and the pseudo server, have to
be smart enough to make the local state directory in case the
View
@@ -24,7 +24,7 @@ SQLITE=@SQLITE@
BITS=@BITS@
MARK64=@MARK64@
RPATH=@RPATH@
-VERSION=0.3
+VERSION=1.0
LIB=lib$(MARK64)
BIN=bin
@@ -47,8 +47,6 @@ GUTS=$(filter-out "$(GLOB_PATTERN)",$(wildcard $(GLOB_PATTERN)))
SOURCES=$(wildcard *.c)
OBJS=$(subst .c,.o,$(SOURCES))
-USE_64=wrapfuncs64.in
-
SHOBJS=pseudo_tables.o pseudo_util.o
DBOBJS=pseudo_db.o
WRAPOBJS=pseudo_wrappers.o
@@ -113,7 +111,9 @@ $(LIBPSEUDO): $(LIB) $(WRAPOBJS) pseudo_client.o pseudo_ipc.o $(SHOBJS)
pseudo_client.o pseudo_ipc.o \
$(WRAPOBJS) $(SHOBJS) $(CLIENT_LDFLAGS)
-%.o: %.c
+# *everything* now relies on stuff that's generated in the
+# wrapper process.
+%.o: %.c pseudo_wrapfuncs.h
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(CFLAGS_PSEUDO) $<
$(OBJS): pseudo_tables.h
@@ -127,8 +127,8 @@ pseudo_server.o: pseudo_server.h
tables: enums/*.in maketables templatefile.py $(TABLES)
./maketables enums/*.in
-wrappers: wrapfuncs.in $(USE_64) makewrappers templatefile.py $(TEMPLATES)
- ./makewrappers wrapfuncs.in $(USE_64)
+wrappers: makewrappers templatefile.py $(TEMPLATES) ports/*/wrapfuncs.in
+ ./makewrappers
.SECONDARY: tables wrappers
@@ -154,6 +154,7 @@ clean:
pseudo_wrapfuncs.h pseudo_wrapfuncs.c \
pseudo_wrapper_table.c \
pseudo_tables.c pseudo_tables.h \
+ pseudo_ports.h port_wrappers.c \
offsets32 offsets64
distclean: clean
View
@@ -0,0 +1,23 @@
+The "ports" system provides functionality for porting pseudo to new targets.
+The original motivation was a requirement to support older and newer Linux
+systems on which the signature for clone() differed.
+
+The Darwin port is totally nonfunctional at this point, but it compiles,
+and sufficiently careful hand-tuning of DYLD_INSERT_LIBRARIES and a
+manually-started server can actually pass a simple test. It will get
+worked on in my copious free time.
+
+The basic design of a port is that it provides a wrapfuncs.in list of
+function signatures, guts implementations, and optionally some port-specific
+defines or a block of wrapper code for pseudo_wrappers.c. This is used
+for cases where the default wrapper would not be appropriate, and may
+be combined with the new hand_wrapped=1 flag in wrapfuncs.in.
+
+A port may specify preports or subports. Preports are ports that are
+included and processed *before* the current port -- meaning that functions
+in the current port can override them. Subports are processed *after*
+the current port -- meaning that they can override functions in the
+current port. The preports and subports are specified by scripts,
+which echo a list of port names to standard output. (Be sure any
+diagnostic messages go to standard error.)
+
View
@@ -108,15 +108,20 @@ class DataType:
return attr
def __repr__(self):
+ column = 0
out = ""
out += "type: %s_t" % self.name
- out += " %s_ENUM\n" % self.prefix
+ out += " (prefix '%s_ENUM')\n" % self.prefix
for col in self.columns:
- out += "\tcol: %s (%s)\n" % (col["name"], col["value"])
+ out += " extra column: %s (default '%s')\n" % (col["name"], col["value"])
+ out += " "
for item in self.data:
- out += "item: %s\n" % item["name"]
- for col in item["cols"]:
- out += "\t%s(%s)\n" % (col["name"], col["value"])
+ column = column + 1
+ if column > 4 and column % 4 == 1:
+ out += "\n "
+ out += "%-19s" % item["name"]
+# for col in item["cols"]:
+# out += "\t%s(%s)\n" % (col["name"], col["value"])
return out
def comment(self):
Oops, something went wrong.

0 comments on commit 29e8b8a

Please sign in to comment.