passenger 5.0.8 → 5.0.9

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

Files changed (168) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.asc +7 -7
  3. data.tar.gz.asc +7 -7
  4. data/.editorconfig +20 -0
  5. data/CHANGELOG +21 -0
  6. data/bin/passenger-install-apache2-module +3 -1
  7. data/build/agents.rb +7 -5
  8. data/build/basics.rb +3 -3
  9. data/build/common_library.rb +52 -30
  10. data/build/cxx_tests.rb +20 -13
  11. data/build/misc.rb +5 -5
  12. data/doc/Design and Architecture.html +1 -1
  13. data/doc/Design and Architecture.txt +1 -1
  14. data/doc/Packaging.html +4 -4
  15. data/doc/Packaging.txt.md +4 -4
  16. data/doc/Users guide Apache.html +22 -9
  17. data/doc/Users guide Apache.idmap.txt +4 -2
  18. data/doc/Users guide Apache.txt +2 -0
  19. data/doc/Users guide Nginx.html +22 -9
  20. data/doc/Users guide Nginx.idmap.txt +4 -2
  21. data/doc/Users guide Nginx.txt +2 -0
  22. data/doc/Users guide Standalone.html +14 -9
  23. data/doc/Users guide Standalone.idmap.txt +4 -2
  24. data/doc/users_guide_snippets/installation.txt +10 -6
  25. data/ext/apache2/Hooks.cpp +13 -2
  26. data/ext/common/ApplicationPool2/Pool/Inspection.h +8 -3
  27. data/ext/common/BackgroundEventLoop.cpp +249 -67
  28. data/ext/common/BackgroundEventLoop.h +5 -5
  29. data/ext/common/Constants.h +1 -1
  30. data/ext/common/InstanceDirectory.h +8 -6
  31. data/ext/common/ServerKit/Context.h +8 -2
  32. data/ext/common/ServerKit/FileBufferedChannel.h +262 -226
  33. data/ext/common/ServerKit/HeaderTable.h +28 -3
  34. data/ext/common/ServerKit/HttpHeaderParser.h +37 -13
  35. data/ext/common/ServerKit/HttpServer.h +17 -1
  36. data/ext/common/ServerKit/Implementation.cpp +2 -0
  37. data/ext/common/ServerKit/Server.h +25 -28
  38. data/ext/common/Utils/IOUtils.cpp +11 -0
  39. data/ext/common/Utils/ProcessMetricsCollector.h +4 -0
  40. data/ext/common/Utils/StrIntUtils.cpp +11 -7
  41. data/ext/common/Utils/StrIntUtils.h +1 -1
  42. data/ext/common/Utils/StrIntUtilsNoStrictAliasing.cpp +21 -16
  43. data/ext/common/agents/Base.cpp +6 -0
  44. data/ext/common/agents/Base.h +2 -0
  45. data/ext/common/agents/HelperAgent/AdminServer.h +25 -25
  46. data/ext/common/agents/HelperAgent/Main.cpp +37 -12
  47. data/ext/common/agents/HelperAgent/RequestHandler.h +18 -20
  48. data/ext/common/agents/HelperAgent/RequestHandler/AppResponse.h +4 -0
  49. data/ext/common/agents/HelperAgent/RequestHandler/ForwardResponse.cpp +10 -6
  50. data/ext/common/agents/HelperAgent/RequestHandler/Hooks.cpp +2 -0
  51. data/ext/common/agents/HelperAgent/RequestHandler/InitRequest.cpp +1 -1
  52. data/ext/common/agents/HelperAgent/RequestHandler/SendRequest.cpp +1 -1
  53. data/ext/common/agents/HelperAgent/RequestHandler/Utils.cpp +9 -2
  54. data/ext/common/agents/HelperAgent/ResponseCache.h +11 -11
  55. data/ext/common/agents/LoggingAgent/AdminServer.h +8 -8
  56. data/ext/common/agents/LoggingAgent/Main.cpp +6 -5
  57. data/ext/common/agents/Watchdog/AdminServer.h +13 -13
  58. data/ext/common/agents/Watchdog/Main.cpp +8 -3
  59. data/ext/libuv/.gitignore +72 -0
  60. data/ext/libuv/AUTHORS +199 -0
  61. data/ext/libuv/ChangeLog +2023 -0
  62. data/ext/libuv/LICENSE +46 -0
  63. data/ext/libuv/Makefile.am +336 -0
  64. data/ext/libuv/README.md +197 -0
  65. data/ext/libuv/checksparse.sh +233 -0
  66. data/ext/libuv/common.gypi +210 -0
  67. data/ext/libuv/configure.ac +67 -0
  68. data/ext/libuv/gyp_uv.py +96 -0
  69. data/ext/libuv/include/android-ifaddrs.h +54 -0
  70. data/ext/libuv/include/pthread-fixes.h +72 -0
  71. data/ext/libuv/include/tree.h +768 -0
  72. data/ext/libuv/include/uv-aix.h +32 -0
  73. data/ext/libuv/include/uv-bsd.h +34 -0
  74. data/ext/libuv/include/uv-darwin.h +61 -0
  75. data/ext/libuv/include/uv-errno.h +418 -0
  76. data/ext/libuv/include/uv-linux.h +34 -0
  77. data/ext/libuv/include/uv-sunos.h +44 -0
  78. data/ext/libuv/include/uv-threadpool.h +37 -0
  79. data/ext/libuv/include/uv-unix.h +383 -0
  80. data/ext/libuv/include/uv-version.h +39 -0
  81. data/ext/libuv/include/uv.h +1455 -0
  82. data/ext/libuv/libuv.pc.in +11 -0
  83. data/ext/libuv/m4/.gitignore +4 -0
  84. data/ext/libuv/m4/as_case.m4 +21 -0
  85. data/ext/libuv/m4/libuv-check-flags.m4 +319 -0
  86. data/ext/libuv/src/fs-poll.c +255 -0
  87. data/ext/libuv/src/heap-inl.h +245 -0
  88. data/ext/libuv/src/inet.c +313 -0
  89. data/ext/libuv/src/queue.h +92 -0
  90. data/ext/libuv/src/threadpool.c +303 -0
  91. data/ext/libuv/src/unix/aix.c +1240 -0
  92. data/ext/libuv/src/unix/android-ifaddrs.c +703 -0
  93. data/ext/libuv/src/unix/async.c +284 -0
  94. data/ext/libuv/src/unix/atomic-ops.h +60 -0
  95. data/ext/libuv/src/unix/core.c +985 -0
  96. data/ext/libuv/src/unix/darwin-proctitle.c +206 -0
  97. data/ext/libuv/src/unix/darwin.c +331 -0
  98. data/ext/libuv/src/unix/dl.c +83 -0
  99. data/ext/libuv/src/unix/freebsd.c +435 -0
  100. data/ext/libuv/src/unix/fs.c +1189 -0
  101. data/ext/libuv/src/unix/fsevents.c +899 -0
  102. data/ext/libuv/src/unix/getaddrinfo.c +202 -0
  103. data/ext/libuv/src/unix/getnameinfo.c +120 -0
  104. data/ext/libuv/src/unix/internal.h +314 -0
  105. data/ext/libuv/src/unix/kqueue.c +418 -0
  106. data/ext/libuv/src/unix/linux-core.c +876 -0
  107. data/ext/libuv/src/unix/linux-inotify.c +257 -0
  108. data/ext/libuv/src/unix/linux-syscalls.c +471 -0
  109. data/ext/libuv/src/unix/linux-syscalls.h +158 -0
  110. data/ext/libuv/src/unix/loop-watcher.c +63 -0
  111. data/ext/libuv/src/unix/loop.c +135 -0
  112. data/ext/libuv/src/unix/netbsd.c +368 -0
  113. data/ext/libuv/src/unix/openbsd.c +384 -0
  114. data/ext/libuv/src/unix/pipe.c +288 -0
  115. data/ext/libuv/src/unix/poll.c +113 -0
  116. data/ext/libuv/src/unix/process.c +551 -0
  117. data/ext/libuv/src/unix/proctitle.c +102 -0
  118. data/ext/libuv/src/unix/pthread-fixes.c +103 -0
  119. data/ext/libuv/src/unix/signal.c +465 -0
  120. data/ext/libuv/src/unix/spinlock.h +53 -0
  121. data/ext/libuv/src/unix/stream.c +1598 -0
  122. data/ext/libuv/src/unix/sunos.c +763 -0
  123. data/ext/libuv/src/unix/tcp.c +327 -0
  124. data/ext/libuv/src/unix/thread.c +519 -0
  125. data/ext/libuv/src/unix/timer.c +172 -0
  126. data/ext/libuv/src/unix/tty.c +265 -0
  127. data/ext/libuv/src/unix/udp.c +833 -0
  128. data/ext/libuv/src/uv-common.c +544 -0
  129. data/ext/libuv/src/uv-common.h +214 -0
  130. data/ext/libuv/src/version.c +49 -0
  131. data/ext/libuv/uv.gyp +487 -0
  132. data/ext/nginx/ContentHandler.c +21 -10
  133. data/ext/nginx/ngx_http_passenger_module.c +7 -0
  134. data/ext/oxt/implementation.cpp +9 -2
  135. data/ext/oxt/initialize.hpp +5 -1
  136. data/lib/phusion_passenger.rb +3 -3
  137. data/lib/phusion_passenger/admin_tools/instance.rb +10 -6
  138. data/lib/phusion_passenger/admin_tools/instance_registry.rb +6 -2
  139. data/lib/phusion_passenger/packaging.rb +3 -4
  140. data/lib/phusion_passenger/platform_info.rb +13 -1
  141. data/lib/phusion_passenger/platform_info/apache.rb +15 -4
  142. data/lib/phusion_passenger/platform_info/apache_detector.rb +5 -1
  143. data/lib/phusion_passenger/rack/thread_handler_extension.rb +184 -99
  144. data/lib/phusion_passenger/request_handler/thread_handler.rb +13 -6
  145. data/lib/phusion_passenger/standalone/start_command.rb +2 -2
  146. data/resources/templates/apache2/apache_install_broken.txt.erb +2 -1
  147. metadata +99 -22
  148. metadata.gz.asc +7 -7
  149. data/ext/libeio/Changes +0 -76
  150. data/ext/libeio/LICENSE +0 -36
  151. data/ext/libeio/Makefile.am +0 -15
  152. data/ext/libeio/Makefile.in +0 -694
  153. data/ext/libeio/aclocal.m4 +0 -9418
  154. data/ext/libeio/autogen.sh +0 -3
  155. data/ext/libeio/config.guess +0 -1540
  156. data/ext/libeio/config.h.in +0 -136
  157. data/ext/libeio/config.sub +0 -1779
  158. data/ext/libeio/configure +0 -14822
  159. data/ext/libeio/configure.ac +0 -22
  160. data/ext/libeio/demo.c +0 -194
  161. data/ext/libeio/ecb.h +0 -714
  162. data/ext/libeio/eio.c +0 -2818
  163. data/ext/libeio/eio.h +0 -414
  164. data/ext/libeio/install-sh +0 -520
  165. data/ext/libeio/libeio.m4 +0 -195
  166. data/ext/libeio/ltmain.sh +0 -9636
  167. data/ext/libeio/missing +0 -376
  168. data/ext/libeio/xthread.h +0 -166
@@ -1,414 +0,0 @@
1
- /*
2
- * libeio API header
3
- *
4
- * Copyright (c) 2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann <libeio@schmorp.de>
5
- * All rights reserved.
6
- *
7
- * Redistribution and use in source and binary forms, with or without modifica-
8
- * tion, are permitted provided that the following conditions are met:
9
- *
10
- * 1. Redistributions of source code must retain the above copyright notice,
11
- * this list of conditions and the following disclaimer.
12
- *
13
- * 2. Redistributions in binary form must reproduce the above copyright
14
- * notice, this list of conditions and the following disclaimer in the
15
- * documentation and/or other materials provided with the distribution.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
18
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
19
- * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
20
- * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
21
- * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
25
- * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
26
- * OF THE POSSIBILITY OF SUCH DAMAGE.
27
- *
28
- * Alternatively, the contents of this file may be used under the terms of
29
- * the GNU General Public License ("GPL") version 2 or any later version,
30
- * in which case the provisions of the GPL are applicable instead of
31
- * the above. If you wish to allow the use of your version of this file
32
- * only under the terms of the GPL and not to allow others to use your
33
- * version of this file under the BSD license, indicate your decision
34
- * by deleting the provisions above and replace them with the notice
35
- * and other provisions required by the GPL. If you do not delete the
36
- * provisions above, a recipient may use your version of this file under
37
- * either the BSD or the GPL.
38
- */
39
-
40
- #ifndef EIO_H_
41
- #define EIO_H_
42
-
43
- #ifdef __cplusplus
44
- extern "C" {
45
- #endif
46
-
47
- #include <stddef.h>
48
- #include <signal.h>
49
- #include <sys/types.h>
50
-
51
- typedef struct eio_req eio_req;
52
- typedef struct eio_dirent eio_dirent;
53
-
54
- typedef int (*eio_cb)(eio_req *req);
55
-
56
- #ifndef EIO_REQ_MEMBERS
57
- # define EIO_REQ_MEMBERS
58
- #endif
59
-
60
- #ifndef EIO_STRUCT_STAT
61
- # ifdef _WIN32
62
- # define EIO_STRUCT_STAT struct _stati64
63
- # define EIO_STRUCT_STATI64
64
- # else
65
- # define EIO_STRUCT_STAT struct stat
66
- # endif
67
- #endif
68
-
69
- #ifdef _WIN32
70
- typedef int eio_uid_t;
71
- typedef int eio_gid_t;
72
- #ifdef __MINGW32__ /* no intptr_t */
73
- typedef ssize_t eio_ssize_t;
74
- #else
75
- typedef intptr_t eio_ssize_t; /* or SSIZE_T */
76
- #endif
77
- #if __GNUC__
78
- typedef long long eio_ino_t; /* signed for compatibility to msvc */
79
- #else
80
- typedef __int64 eio_ino_t; /* unsigned not supported by msvc */
81
- #endif
82
- #else
83
- typedef uid_t eio_uid_t;
84
- typedef gid_t eio_gid_t;
85
- typedef ssize_t eio_ssize_t;
86
- typedef ino_t eio_ino_t;
87
- #endif
88
-
89
- #ifndef EIO_STRUCT_STATVFS
90
- # define EIO_STRUCT_STATVFS struct statvfs
91
- #endif
92
-
93
- /* managing working directories */
94
-
95
- typedef struct eio_pwd *eio_wd;
96
-
97
- #define EIO_CWD 0 /* the current working directory of the process, guaranteed to be a null pointer */
98
- #define EIO_INVALID_WD ((eio_wd)(int)-1) /* failure return for eio_wd_open */
99
-
100
- eio_wd eio_wd_open_sync (eio_wd wd, const char *path);
101
- void eio_wd_close_sync (eio_wd wd);
102
-
103
- /* for readdir */
104
-
105
- /* eio_readdir flags */
106
- enum
107
- {
108
- EIO_READDIR_DENTS = 0x01, /* ptr2 contains eio_dirents, not just the (unsorted) names */
109
- EIO_READDIR_DIRS_FIRST = 0x02, /* dirents gets sorted into a good stat() ing order to find directories first */
110
- EIO_READDIR_STAT_ORDER = 0x04, /* dirents gets sorted into a good stat() ing order to quickly stat all files */
111
- EIO_READDIR_FOUND_UNKNOWN = 0x80, /* set by eio_readdir when *_ARRAY was set and any TYPE=UNKNOWN's were found */
112
-
113
- EIO_READDIR_CUSTOM1 = 0x100, /* for use by apps */
114
- EIO_READDIR_CUSTOM2 = 0x200 /* for use by apps */
115
- };
116
-
117
- /* using "typical" values in the hope that the compiler will do something sensible */
118
- enum eio_dtype
119
- {
120
- EIO_DT_UNKNOWN = 0,
121
- EIO_DT_FIFO = 1,
122
- EIO_DT_CHR = 2,
123
- EIO_DT_MPC = 3, /* multiplexed char device (v7+coherent) */
124
- EIO_DT_DIR = 4,
125
- EIO_DT_NAM = 5, /* xenix special named file */
126
- EIO_DT_BLK = 6,
127
- EIO_DT_MPB = 7, /* multiplexed block device (v7+coherent) */
128
- EIO_DT_REG = 8,
129
- EIO_DT_NWK = 9, /* HP-UX network special */
130
- EIO_DT_CMP = 9, /* VxFS compressed */
131
- EIO_DT_LNK = 10,
132
- /* DT_SHAD = 11,*/
133
- EIO_DT_SOCK = 12,
134
- EIO_DT_DOOR = 13, /* solaris door */
135
- EIO_DT_WHT = 14,
136
- EIO_DT_MAX = 15 /* highest DT_VALUE ever, hopefully */
137
- };
138
-
139
- struct eio_dirent
140
- {
141
- int nameofs; /* offset of null-terminated name string in (char *)req->ptr2 */
142
- unsigned short namelen; /* size of filename without trailing 0 */
143
- unsigned char type; /* one of EIO_DT_* */
144
- signed char score; /* internal use */
145
- eio_ino_t inode; /* the inode number, if available, otherwise unspecified */
146
- };
147
-
148
- /* eio_msync flags */
149
- enum
150
- {
151
- EIO_MS_ASYNC = 1,
152
- EIO_MS_INVALIDATE = 2,
153
- EIO_MS_SYNC = 4
154
- };
155
-
156
- /* eio_mtouch flags */
157
- enum
158
- {
159
- EIO_MT_MODIFY = 1
160
- };
161
-
162
- /* eio_sync_file_range flags */
163
- enum
164
- {
165
- EIO_SYNC_FILE_RANGE_WAIT_BEFORE = 1,
166
- EIO_SYNC_FILE_RANGE_WRITE = 2,
167
- EIO_SYNC_FILE_RANGE_WAIT_AFTER = 4
168
- };
169
-
170
- /* eio_fallocate flags */
171
- enum
172
- {
173
- /* these MUST match the value in linux/falloc.h */
174
- EIO_FALLOC_FL_KEEP_SIZE = 1,
175
- EIO_FALLOC_FL_PUNCH_HOLE = 2
176
- };
177
-
178
- /* timestamps and differences - feel free to use double in your code directly */
179
- typedef double eio_tstamp;
180
-
181
- /* the eio request structure */
182
- enum
183
- {
184
- EIO_CUSTOM,
185
- EIO_WD_OPEN, EIO_WD_CLOSE,
186
-
187
- EIO_CLOSE, EIO_DUP2,
188
- EIO_SEEK, EIO_READ, EIO_WRITE,
189
- EIO_READAHEAD, EIO_SENDFILE,
190
- EIO_FSTAT, EIO_FSTATVFS,
191
- EIO_FTRUNCATE, EIO_FUTIME, EIO_FCHMOD, EIO_FCHOWN,
192
- EIO_SYNC, EIO_FSYNC, EIO_FDATASYNC, EIO_SYNCFS,
193
- EIO_MSYNC, EIO_MTOUCH, EIO_SYNC_FILE_RANGE, EIO_FALLOCATE,
194
- EIO_MLOCK, EIO_MLOCKALL,
195
- EIO_GROUP, EIO_NOP,
196
- EIO_BUSY,
197
-
198
- /* these use wd + ptr1, but are emulated */
199
- EIO_REALPATH,
200
- EIO_READDIR,
201
-
202
- /* all the following requests use wd + ptr1 as path in xxxat functions */
203
- EIO_OPEN,
204
- EIO_STAT, EIO_LSTAT, EIO_STATVFS,
205
- EIO_TRUNCATE,
206
- EIO_UTIME,
207
- EIO_CHMOD,
208
- EIO_CHOWN,
209
- EIO_UNLINK, EIO_RMDIR, EIO_MKDIR, EIO_RENAME,
210
- EIO_MKNOD,
211
- EIO_LINK, EIO_SYMLINK, EIO_READLINK,
212
-
213
- EIO_REQ_TYPE_NUM
214
- };
215
-
216
- /* seek whence modes */
217
- /* these are guaranteed to hasve the traditional 0, 1, 2 values, */
218
- /* so you might as wlel use those */
219
- enum
220
- {
221
- EIO_SEEK_SET = 0,
222
- EIO_SEEK_CUR = 1,
223
- EIO_SEEK_END = 2
224
- };
225
-
226
-
227
- /* mlockall constants */
228
- enum
229
- {
230
- EIO_MCL_CURRENT = 1,
231
- EIO_MCL_FUTURE = 2
232
- };
233
-
234
- /* request priorities */
235
-
236
- enum {
237
- EIO_PRI_MIN = -4,
238
- EIO_PRI_MAX = 4,
239
- EIO_PRI_DEFAULT = 0
240
- };
241
-
242
- /* eio request structure */
243
- /* this structure is mostly read-only */
244
- /* when initialising it, all members must be zero-initialised */
245
- struct eio_req
246
- {
247
- eio_req volatile *next; /* private ETP */
248
-
249
- eio_wd wd; /* all applicable requests: working directory of pathname, old name; wd_open: return wd */
250
-
251
- eio_ssize_t result; /* result of syscall, e.g. result = read (... */
252
- off_t offs; /* read, write, truncate, readahead, sync_file_range, fallocate: file offset, mknod: dev_t */
253
- size_t size; /* read, write, readahead, sendfile, msync, mlock, sync_file_range, fallocate: length */
254
- void *ptr1; /* all applicable requests: pathname, old name; readdir: optional eio_dirents */
255
- void *ptr2; /* all applicable requests: new name or memory buffer; readdir: name strings */
256
- eio_tstamp nv1; /* utime, futime: atime; busy: sleep time */
257
- eio_tstamp nv2; /* utime, futime: mtime */
258
-
259
- int type; /* EIO_xxx constant ETP */
260
- int int1; /* all applicable requests: file descriptor; sendfile: output fd; open, msync, mlockall, readdir: flags */
261
- long int2; /* chown, fchown: uid; sendfile: input fd; open, chmod, mkdir, mknod: file mode, seek: whence, sync_file_range, fallocate: flags */
262
- long int3; /* chown, fchown: gid; rename, link: working directory of new name */
263
- int errorno; /* errno value on syscall return */
264
-
265
- #if __i386 || __amd64
266
- unsigned char cancelled;
267
- #else
268
- sig_atomic_t cancelled;
269
- #endif
270
-
271
- unsigned char flags; /* private */
272
- signed char pri; /* the priority */
273
-
274
- void *data;
275
- eio_cb finish;
276
- void (*destroy)(eio_req *req); /* called when request no longer needed */
277
- void (*feed)(eio_req *req); /* only used for group requests */
278
-
279
- EIO_REQ_MEMBERS
280
-
281
- eio_req *grp, *grp_prev, *grp_next, *grp_first; /* private */
282
- };
283
-
284
- /* _private_ request flags */
285
- enum {
286
- EIO_FLAG_PTR1_FREE = 0x01, /* need to free(ptr1) */
287
- EIO_FLAG_PTR2_FREE = 0x02, /* need to free(ptr2) */
288
- EIO_FLAG_GROUPADD = 0x04 /* some request was added to the group */
289
- };
290
-
291
- /* undocumented/unsupported/private helper */
292
- /*void eio_page_align (void **addr, size_t *length);*/
293
-
294
- /* returns < 0 on error, errno set
295
- * need_poll, if non-zero, will be called when results are available
296
- * and eio_poll_cb needs to be invoked (it MUST NOT call eio_poll_cb itself).
297
- * done_poll is called when the need to poll is gone.
298
- */
299
- int eio_init (void (*want_poll)(void), void (*done_poll)(void));
300
-
301
- int eio_deinit ();
302
-
303
- /* must be called regularly to handle pending requests */
304
- /* returns 0 if all requests were handled, -1 if not, or the value of EIO_FINISH if != 0 */
305
- int eio_poll (void);
306
-
307
- /* stop polling if poll took longer than duration seconds */
308
- void eio_set_max_poll_time (eio_tstamp nseconds);
309
- /* do not handle more then count requests in one call to eio_poll_cb */
310
- void eio_set_max_poll_reqs (unsigned int nreqs);
311
-
312
- /* set minimum required number
313
- * maximum wanted number
314
- * or maximum idle number of threads */
315
- void eio_set_min_parallel (unsigned int nthreads);
316
- void eio_set_max_parallel (unsigned int nthreads);
317
- void eio_set_max_idle (unsigned int nthreads);
318
- void eio_set_idle_timeout (unsigned int seconds);
319
-
320
- unsigned int eio_nreqs (void); /* number of requests in-flight */
321
- unsigned int eio_nready (void); /* number of not-yet handled requests */
322
- unsigned int eio_npending (void); /* number of finished but unhandled requests */
323
- unsigned int eio_nthreads (void); /* number of worker threads in use currently */
324
-
325
- /*****************************************************************************/
326
- /* convenience wrappers */
327
-
328
- #ifndef EIO_NO_WRAPPERS
329
- eio_req *eio_wd_open (const char *path, int pri, eio_cb cb, void *data); /* result=wd */
330
- eio_req *eio_wd_close (eio_wd wd, int pri, eio_cb cb, void *data);
331
- eio_req *eio_nop (int pri, eio_cb cb, void *data); /* does nothing except go through the whole process */
332
- eio_req *eio_busy (eio_tstamp delay, int pri, eio_cb cb, void *data); /* ties a thread for this long, simulating busyness */
333
- eio_req *eio_sync (int pri, eio_cb cb, void *data);
334
- eio_req *eio_fsync (int fd, int pri, eio_cb cb, void *data);
335
- eio_req *eio_fdatasync (int fd, int pri, eio_cb cb, void *data);
336
- eio_req *eio_syncfs (int fd, int pri, eio_cb cb, void *data);
337
- eio_req *eio_msync (void *addr, size_t length, int flags, int pri, eio_cb cb, void *data);
338
- eio_req *eio_mtouch (void *addr, size_t length, int flags, int pri, eio_cb cb, void *data);
339
- eio_req *eio_mlock (void *addr, size_t length, int pri, eio_cb cb, void *data);
340
- eio_req *eio_mlockall (int flags, int pri, eio_cb cb, void *data);
341
- eio_req *eio_sync_file_range (int fd, off_t offset, size_t nbytes, unsigned int flags, int pri, eio_cb cb, void *data);
342
- eio_req *eio_fallocate (int fd, int mode, off_t offset, size_t len, int pri, eio_cb cb, void *data);
343
- eio_req *eio_close (int fd, int pri, eio_cb cb, void *data);
344
- eio_req *eio_readahead (int fd, off_t offset, size_t length, int pri, eio_cb cb, void *data);
345
- eio_req *eio_seek (int fd, off_t offset, int whence, int pri, eio_cb cb, void *data);
346
- eio_req *eio_read (int fd, void *buf, size_t length, off_t offset, int pri, eio_cb cb, void *data);
347
- eio_req *eio_write (int fd, void *buf, size_t length, off_t offset, int pri, eio_cb cb, void *data);
348
- eio_req *eio_fstat (int fd, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */
349
- eio_req *eio_fstatvfs (int fd, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */
350
- eio_req *eio_futime (int fd, eio_tstamp atime, eio_tstamp mtime, int pri, eio_cb cb, void *data);
351
- eio_req *eio_ftruncate (int fd, off_t offset, int pri, eio_cb cb, void *data);
352
- eio_req *eio_fchmod (int fd, mode_t mode, int pri, eio_cb cb, void *data);
353
- eio_req *eio_fchown (int fd, eio_uid_t uid, eio_gid_t gid, int pri, eio_cb cb, void *data);
354
- eio_req *eio_dup2 (int fd, int fd2, int pri, eio_cb cb, void *data);
355
- eio_req *eio_sendfile (int out_fd, int in_fd, off_t in_offset, size_t length, int pri, eio_cb cb, void *data);
356
- eio_req *eio_open (const char *path, int flags, mode_t mode, int pri, eio_cb cb, void *data);
357
- eio_req *eio_utime (const char *path, eio_tstamp atime, eio_tstamp mtime, int pri, eio_cb cb, void *data);
358
- eio_req *eio_truncate (const char *path, off_t offset, int pri, eio_cb cb, void *data);
359
- eio_req *eio_chown (const char *path, eio_uid_t uid, eio_gid_t gid, int pri, eio_cb cb, void *data);
360
- eio_req *eio_chmod (const char *path, mode_t mode, int pri, eio_cb cb, void *data);
361
- eio_req *eio_mkdir (const char *path, mode_t mode, int pri, eio_cb cb, void *data);
362
- eio_req *eio_readdir (const char *path, int flags, int pri, eio_cb cb, void *data); /* result=ptr2 allocated dynamically */
363
- eio_req *eio_rmdir (const char *path, int pri, eio_cb cb, void *data);
364
- eio_req *eio_unlink (const char *path, int pri, eio_cb cb, void *data);
365
- eio_req *eio_readlink (const char *path, int pri, eio_cb cb, void *data); /* result=ptr2 allocated dynamically */
366
- eio_req *eio_realpath (const char *path, int pri, eio_cb cb, void *data); /* result=ptr2 allocated dynamically */
367
- eio_req *eio_stat (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */
368
- eio_req *eio_lstat (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */
369
- eio_req *eio_statvfs (const char *path, int pri, eio_cb cb, void *data); /* stat buffer=ptr2 allocated dynamically */
370
- eio_req *eio_mknod (const char *path, mode_t mode, dev_t dev, int pri, eio_cb cb, void *data);
371
- eio_req *eio_link (const char *path, const char *new_path, int pri, eio_cb cb, void *data);
372
- eio_req *eio_symlink (const char *path, const char *new_path, int pri, eio_cb cb, void *data);
373
- eio_req *eio_rename (const char *path, const char *new_path, int pri, eio_cb cb, void *data);
374
- eio_req *eio_custom (void (*execute)(eio_req *), int pri, eio_cb cb, void *data);
375
- #endif
376
-
377
- /*****************************************************************************/
378
- /* groups */
379
-
380
- eio_req *eio_grp (eio_cb cb, void *data);
381
- void eio_grp_feed (eio_req *grp, void (*feed)(eio_req *req), int limit);
382
- void eio_grp_limit (eio_req *grp, int limit);
383
- void eio_grp_add (eio_req *grp, eio_req *req);
384
- void eio_grp_cancel (eio_req *grp); /* cancels all sub requests but not the group */
385
-
386
- /*****************************************************************************/
387
- /* request api */
388
-
389
- /* true if the request was cancelled, useful in the invoke callback */
390
- #define EIO_CANCELLED(req) ((req)->cancelled)
391
-
392
- #define EIO_RESULT(req) ((req)->result)
393
- /* returns a pointer to the result buffer allocated by eio */
394
- #define EIO_BUF(req) ((req)->ptr2)
395
- #define EIO_STAT_BUF(req) ((EIO_STRUCT_STAT *)EIO_BUF(req))
396
- #define EIO_STATVFS_BUF(req) ((EIO_STRUCT_STATVFS *)EIO_BUF(req))
397
- #define EIO_PATH(req) ((char *)(req)->ptr1)
398
-
399
- /* submit a request for execution */
400
- void eio_submit (eio_req *req);
401
- /* cancel a request as soon fast as possible, if possible */
402
- void eio_cancel (eio_req *req);
403
-
404
- /*****************************************************************************/
405
- /* convenience functions */
406
-
407
- eio_ssize_t eio_sendfile_sync (int ofd, int ifd, off_t offset, size_t count);
408
-
409
- #ifdef __cplusplus
410
- }
411
- #endif
412
-
413
- #endif
414
-
@@ -1,520 +0,0 @@
1
- #!/bin/sh
2
- # install - install a program, script, or datafile
3
-
4
- scriptversion=2009-04-28.21; # UTC
5
-
6
- # This originates from X11R5 (mit/util/scripts/install.sh), which was
7
- # later released in X11R6 (xc/config/util/install.sh) with the
8
- # following copyright and license.
9
- #
10
- # Copyright (C) 1994 X Consortium
11
- #
12
- # Permission is hereby granted, free of charge, to any person obtaining a copy
13
- # of this software and associated documentation files (the "Software"), to
14
- # deal in the Software without restriction, including without limitation the
15
- # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
16
- # sell copies of the Software, and to permit persons to whom the Software is
17
- # furnished to do so, subject to the following conditions:
18
- #
19
- # The above copyright notice and this permission notice shall be included in
20
- # all copies or substantial portions of the Software.
21
- #
22
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
26
- # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
27
- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
- #
29
- # Except as contained in this notice, the name of the X Consortium shall not
30
- # be used in advertising or otherwise to promote the sale, use or other deal-
31
- # ings in this Software without prior written authorization from the X Consor-
32
- # tium.
33
- #
34
- #
35
- # FSF changes to this file are in the public domain.
36
- #
37
- # Calling this script install-sh is preferred over install.sh, to prevent
38
- # `make' implicit rules from creating a file called install from it
39
- # when there is no Makefile.
40
- #
41
- # This script is compatible with the BSD install script, but was written
42
- # from scratch.
43
-
44
- nl='
45
- '
46
- IFS=" "" $nl"
47
-
48
- # set DOITPROG to echo to test this script
49
-
50
- # Don't use :- since 4.3BSD and earlier shells don't like it.
51
- doit=${DOITPROG-}
52
- if test -z "$doit"; then
53
- doit_exec=exec
54
- else
55
- doit_exec=$doit
56
- fi
57
-
58
- # Put in absolute file names if you don't have them in your path;
59
- # or use environment vars.
60
-
61
- chgrpprog=${CHGRPPROG-chgrp}
62
- chmodprog=${CHMODPROG-chmod}
63
- chownprog=${CHOWNPROG-chown}
64
- cmpprog=${CMPPROG-cmp}
65
- cpprog=${CPPROG-cp}
66
- mkdirprog=${MKDIRPROG-mkdir}
67
- mvprog=${MVPROG-mv}
68
- rmprog=${RMPROG-rm}
69
- stripprog=${STRIPPROG-strip}
70
-
71
- posix_glob='?'
72
- initialize_posix_glob='
73
- test "$posix_glob" != "?" || {
74
- if (set -f) 2>/dev/null; then
75
- posix_glob=
76
- else
77
- posix_glob=:
78
- fi
79
- }
80
- '
81
-
82
- posix_mkdir=
83
-
84
- # Desired mode of installed file.
85
- mode=0755
86
-
87
- chgrpcmd=
88
- chmodcmd=$chmodprog
89
- chowncmd=
90
- mvcmd=$mvprog
91
- rmcmd="$rmprog -f"
92
- stripcmd=
93
-
94
- src=
95
- dst=
96
- dir_arg=
97
- dst_arg=
98
-
99
- copy_on_change=false
100
- no_target_directory=
101
-
102
- usage="\
103
- Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
104
- or: $0 [OPTION]... SRCFILES... DIRECTORY
105
- or: $0 [OPTION]... -t DIRECTORY SRCFILES...
106
- or: $0 [OPTION]... -d DIRECTORIES...
107
-
108
- In the 1st form, copy SRCFILE to DSTFILE.
109
- In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
110
- In the 4th, create DIRECTORIES.
111
-
112
- Options:
113
- --help display this help and exit.
114
- --version display version info and exit.
115
-
116
- -c (ignored)
117
- -C install only if different (preserve the last data modification time)
118
- -d create directories instead of installing files.
119
- -g GROUP $chgrpprog installed files to GROUP.
120
- -m MODE $chmodprog installed files to MODE.
121
- -o USER $chownprog installed files to USER.
122
- -s $stripprog installed files.
123
- -t DIRECTORY install into DIRECTORY.
124
- -T report an error if DSTFILE is a directory.
125
-
126
- Environment variables override the default commands:
127
- CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
128
- RMPROG STRIPPROG
129
- "
130
-
131
- while test $# -ne 0; do
132
- case $1 in
133
- -c) ;;
134
-
135
- -C) copy_on_change=true;;
136
-
137
- -d) dir_arg=true;;
138
-
139
- -g) chgrpcmd="$chgrpprog $2"
140
- shift;;
141
-
142
- --help) echo "$usage"; exit $?;;
143
-
144
- -m) mode=$2
145
- case $mode in
146
- *' '* | *' '* | *'
147
- '* | *'*'* | *'?'* | *'['*)
148
- echo "$0: invalid mode: $mode" >&2
149
- exit 1;;
150
- esac
151
- shift;;
152
-
153
- -o) chowncmd="$chownprog $2"
154
- shift;;
155
-
156
- -s) stripcmd=$stripprog;;
157
-
158
- -t) dst_arg=$2
159
- shift;;
160
-
161
- -T) no_target_directory=true;;
162
-
163
- --version) echo "$0 $scriptversion"; exit $?;;
164
-
165
- --) shift
166
- break;;
167
-
168
- -*) echo "$0: invalid option: $1" >&2
169
- exit 1;;
170
-
171
- *) break;;
172
- esac
173
- shift
174
- done
175
-
176
- if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
177
- # When -d is used, all remaining arguments are directories to create.
178
- # When -t is used, the destination is already specified.
179
- # Otherwise, the last argument is the destination. Remove it from $@.
180
- for arg
181
- do
182
- if test -n "$dst_arg"; then
183
- # $@ is not empty: it contains at least $arg.
184
- set fnord "$@" "$dst_arg"
185
- shift # fnord
186
- fi
187
- shift # arg
188
- dst_arg=$arg
189
- done
190
- fi
191
-
192
- if test $# -eq 0; then
193
- if test -z "$dir_arg"; then
194
- echo "$0: no input file specified." >&2
195
- exit 1
196
- fi
197
- # It's OK to call `install-sh -d' without argument.
198
- # This can happen when creating conditional directories.
199
- exit 0
200
- fi
201
-
202
- if test -z "$dir_arg"; then
203
- trap '(exit $?); exit' 1 2 13 15
204
-
205
- # Set umask so as not to create temps with too-generous modes.
206
- # However, 'strip' requires both read and write access to temps.
207
- case $mode in
208
- # Optimize common cases.
209
- *644) cp_umask=133;;
210
- *755) cp_umask=22;;
211
-
212
- *[0-7])
213
- if test -z "$stripcmd"; then
214
- u_plus_rw=
215
- else
216
- u_plus_rw='% 200'
217
- fi
218
- cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
219
- *)
220
- if test -z "$stripcmd"; then
221
- u_plus_rw=
222
- else
223
- u_plus_rw=,u+rw
224
- fi
225
- cp_umask=$mode$u_plus_rw;;
226
- esac
227
- fi
228
-
229
- for src
230
- do
231
- # Protect names starting with `-'.
232
- case $src in
233
- -*) src=./$src;;
234
- esac
235
-
236
- if test -n "$dir_arg"; then
237
- dst=$src
238
- dstdir=$dst
239
- test -d "$dstdir"
240
- dstdir_status=$?
241
- else
242
-
243
- # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
244
- # might cause directories to be created, which would be especially bad
245
- # if $src (and thus $dsttmp) contains '*'.
246
- if test ! -f "$src" && test ! -d "$src"; then
247
- echo "$0: $src does not exist." >&2
248
- exit 1
249
- fi
250
-
251
- if test -z "$dst_arg"; then
252
- echo "$0: no destination specified." >&2
253
- exit 1
254
- fi
255
-
256
- dst=$dst_arg
257
- # Protect names starting with `-'.
258
- case $dst in
259
- -*) dst=./$dst;;
260
- esac
261
-
262
- # If destination is a directory, append the input filename; won't work
263
- # if double slashes aren't ignored.
264
- if test -d "$dst"; then
265
- if test -n "$no_target_directory"; then
266
- echo "$0: $dst_arg: Is a directory" >&2
267
- exit 1
268
- fi
269
- dstdir=$dst
270
- dst=$dstdir/`basename "$src"`
271
- dstdir_status=0
272
- else
273
- # Prefer dirname, but fall back on a substitute if dirname fails.
274
- dstdir=`
275
- (dirname "$dst") 2>/dev/null ||
276
- expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
277
- X"$dst" : 'X\(//\)[^/]' \| \
278
- X"$dst" : 'X\(//\)$' \| \
279
- X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
280
- echo X"$dst" |
281
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
282
- s//\1/
283
- q
284
- }
285
- /^X\(\/\/\)[^/].*/{
286
- s//\1/
287
- q
288
- }
289
- /^X\(\/\/\)$/{
290
- s//\1/
291
- q
292
- }
293
- /^X\(\/\).*/{
294
- s//\1/
295
- q
296
- }
297
- s/.*/./; q'
298
- `
299
-
300
- test -d "$dstdir"
301
- dstdir_status=$?
302
- fi
303
- fi
304
-
305
- obsolete_mkdir_used=false
306
-
307
- if test $dstdir_status != 0; then
308
- case $posix_mkdir in
309
- '')
310
- # Create intermediate dirs using mode 755 as modified by the umask.
311
- # This is like FreeBSD 'install' as of 1997-10-28.
312
- umask=`umask`
313
- case $stripcmd.$umask in
314
- # Optimize common cases.
315
- *[2367][2367]) mkdir_umask=$umask;;
316
- .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
317
-
318
- *[0-7])
319
- mkdir_umask=`expr $umask + 22 \
320
- - $umask % 100 % 40 + $umask % 20 \
321
- - $umask % 10 % 4 + $umask % 2
322
- `;;
323
- *) mkdir_umask=$umask,go-w;;
324
- esac
325
-
326
- # With -d, create the new directory with the user-specified mode.
327
- # Otherwise, rely on $mkdir_umask.
328
- if test -n "$dir_arg"; then
329
- mkdir_mode=-m$mode
330
- else
331
- mkdir_mode=
332
- fi
333
-
334
- posix_mkdir=false
335
- case $umask in
336
- *[123567][0-7][0-7])
337
- # POSIX mkdir -p sets u+wx bits regardless of umask, which
338
- # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
339
- ;;
340
- *)
341
- tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
342
- trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
343
-
344
- if (umask $mkdir_umask &&
345
- exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
346
- then
347
- if test -z "$dir_arg" || {
348
- # Check for POSIX incompatibilities with -m.
349
- # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
350
- # other-writeable bit of parent directory when it shouldn't.
351
- # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
352
- ls_ld_tmpdir=`ls -ld "$tmpdir"`
353
- case $ls_ld_tmpdir in
354
- d????-?r-*) different_mode=700;;
355
- d????-?--*) different_mode=755;;
356
- *) false;;
357
- esac &&
358
- $mkdirprog -m$different_mode -p -- "$tmpdir" && {
359
- ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
360
- test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
361
- }
362
- }
363
- then posix_mkdir=:
364
- fi
365
- rmdir "$tmpdir/d" "$tmpdir"
366
- else
367
- # Remove any dirs left behind by ancient mkdir implementations.
368
- rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
369
- fi
370
- trap '' 0;;
371
- esac;;
372
- esac
373
-
374
- if
375
- $posix_mkdir && (
376
- umask $mkdir_umask &&
377
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
378
- )
379
- then :
380
- else
381
-
382
- # The umask is ridiculous, or mkdir does not conform to POSIX,
383
- # or it failed possibly due to a race condition. Create the
384
- # directory the slow way, step by step, checking for races as we go.
385
-
386
- case $dstdir in
387
- /*) prefix='/';;
388
- -*) prefix='./';;
389
- *) prefix='';;
390
- esac
391
-
392
- eval "$initialize_posix_glob"
393
-
394
- oIFS=$IFS
395
- IFS=/
396
- $posix_glob set -f
397
- set fnord $dstdir
398
- shift
399
- $posix_glob set +f
400
- IFS=$oIFS
401
-
402
- prefixes=
403
-
404
- for d
405
- do
406
- test -z "$d" && continue
407
-
408
- prefix=$prefix$d
409
- if test -d "$prefix"; then
410
- prefixes=
411
- else
412
- if $posix_mkdir; then
413
- (umask=$mkdir_umask &&
414
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
415
- # Don't fail if two instances are running concurrently.
416
- test -d "$prefix" || exit 1
417
- else
418
- case $prefix in
419
- *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
420
- *) qprefix=$prefix;;
421
- esac
422
- prefixes="$prefixes '$qprefix'"
423
- fi
424
- fi
425
- prefix=$prefix/
426
- done
427
-
428
- if test -n "$prefixes"; then
429
- # Don't fail if two instances are running concurrently.
430
- (umask $mkdir_umask &&
431
- eval "\$doit_exec \$mkdirprog $prefixes") ||
432
- test -d "$dstdir" || exit 1
433
- obsolete_mkdir_used=true
434
- fi
435
- fi
436
- fi
437
-
438
- if test -n "$dir_arg"; then
439
- { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
440
- { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
441
- { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
442
- test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
443
- else
444
-
445
- # Make a couple of temp file names in the proper directory.
446
- dsttmp=$dstdir/_inst.$$_
447
- rmtmp=$dstdir/_rm.$$_
448
-
449
- # Trap to clean up those temp files at exit.
450
- trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
451
-
452
- # Copy the file name to the temp name.
453
- (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
454
-
455
- # and set any options; do chmod last to preserve setuid bits.
456
- #
457
- # If any of these fail, we abort the whole thing. If we want to
458
- # ignore errors from any of these, just make sure not to ignore
459
- # errors from the above "$doit $cpprog $src $dsttmp" command.
460
- #
461
- { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
462
- { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
463
- { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
464
- { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
465
-
466
- # If -C, don't bother to copy if it wouldn't change the file.
467
- if $copy_on_change &&
468
- old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
469
- new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
470
-
471
- eval "$initialize_posix_glob" &&
472
- $posix_glob set -f &&
473
- set X $old && old=:$2:$4:$5:$6 &&
474
- set X $new && new=:$2:$4:$5:$6 &&
475
- $posix_glob set +f &&
476
-
477
- test "$old" = "$new" &&
478
- $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
479
- then
480
- rm -f "$dsttmp"
481
- else
482
- # Rename the file to the real destination.
483
- $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
484
-
485
- # The rename failed, perhaps because mv can't rename something else
486
- # to itself, or perhaps because mv is so ancient that it does not
487
- # support -f.
488
- {
489
- # Now remove or move aside any old file at destination location.
490
- # We try this two ways since rm can't unlink itself on some
491
- # systems and the destination file might be busy for other
492
- # reasons. In this case, the final cleanup might fail but the new
493
- # file should still install successfully.
494
- {
495
- test ! -f "$dst" ||
496
- $doit $rmcmd -f "$dst" 2>/dev/null ||
497
- { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
498
- { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
499
- } ||
500
- { echo "$0: cannot unlink or rename $dst" >&2
501
- (exit 1); exit 1
502
- }
503
- } &&
504
-
505
- # Now rename the file to the real destination.
506
- $doit $mvcmd "$dsttmp" "$dst"
507
- }
508
- fi || exit 1
509
-
510
- trap '' 0
511
- fi
512
- done
513
-
514
- # Local variables:
515
- # eval: (add-hook 'write-file-hooks 'time-stamp)
516
- # time-stamp-start: "scriptversion="
517
- # time-stamp-format: "%:y-%02m-%02d.%02H"
518
- # time-stamp-time-zone: "UTC"
519
- # time-stamp-end: "; # UTC"
520
- # End: