passenger 5.0.25 → 5.0.26
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.
- checksums.yaml +4 -4
- data/CHANGELOG +20 -0
- data/CONTRIBUTORS +1 -0
- data/build/cxx_dependency_map.rb +7338 -7104
- data/build/cxx_tests.rb +3 -3
- data/build/misc.rb +1 -0
- data/dev/index_cxx_dependencies.rb +3 -2
- data/resources/templates/standalone/config.erb +1 -1
- data/resources/templates/standalone/http.erb +1 -0
- data/resources/templates/standalone/server.erb +1 -0
- data/src/agent/Core/ApplicationPool/AbstractSession.h +83 -0
- data/src/agent/Core/ApplicationPool/Common.h +6 -4
- data/src/agent/Core/ApplicationPool/Options.h +4 -1
- data/src/agent/Core/ApplicationPool/Pool.h +2 -2
- data/src/agent/Core/ApplicationPool/Pool/AnalyticsCollection.cpp +3 -6
- data/src/agent/Core/ApplicationPool/Pool/GeneralUtils.cpp +3 -3
- data/src/agent/Core/ApplicationPool/Session.h +15 -27
- data/src/agent/Core/ApplicationPool/TestSession.h +188 -0
- data/src/agent/Core/Controller.h +15 -6
- data/src/agent/Core/Controller/CheckoutSession.cpp +13 -5
- data/src/agent/Core/Controller/ForwardResponse.cpp +20 -2
- data/src/agent/Core/Controller/Hooks.cpp +15 -2
- data/src/agent/Core/Controller/InitRequest.cpp +5 -1
- data/src/agent/Core/Controller/InitializationAndShutdown.cpp +1 -0
- data/src/agent/Core/Controller/Request.h +11 -4
- data/src/agent/Core/Controller/SendRequest.cpp +34 -13
- data/src/agent/Core/Controller/StateInspectionAndConfiguration.cpp +2 -2
- data/src/agent/Core/CoreMain.cpp +27 -1
- data/src/agent/Core/OptionParser.h +11 -1
- data/src/agent/Core/SpawningKit/DirectSpawner.h +1 -0
- data/src/agent/Core/SpawningKit/SmartSpawner.h +1 -0
- data/src/agent/Core/SpawningKit/Spawner.h +21 -1
- data/src/agent/SpawnPreparer/SpawnPreparerMain.cpp +1 -1
- data/src/agent/UstRouter/OptionParser.h +7 -1
- data/src/agent/UstRouter/UstRouterMain.cpp +27 -1
- data/src/cxx_supportlib/Algorithms/MovingAverage.h +223 -0
- data/src/cxx_supportlib/Constants.h +2 -2
- data/src/cxx_supportlib/DataStructures/StringKeyTable.h +96 -40
- data/src/cxx_supportlib/ResourceLocator.h +33 -14
- data/src/cxx_supportlib/ServerKit/Channel.h +198 -69
- data/src/cxx_supportlib/ServerKit/Errors.h +6 -1
- data/src/cxx_supportlib/ServerKit/HttpRequest.h +20 -1
- data/src/cxx_supportlib/ServerKit/HttpServer.h +124 -32
- data/src/cxx_supportlib/ServerKit/Server.h +65 -1
- data/src/cxx_supportlib/Utils/IOUtils.cpp +12 -22
- data/src/cxx_supportlib/Utils/JsonUtils.h +87 -1
- data/src/cxx_supportlib/Utils/StrIntUtils.cpp +16 -1
- data/src/cxx_supportlib/Utils/StrIntUtils.h +31 -1
- data/src/cxx_supportlib/Utils/VariantMap.h +6 -1
- data/src/cxx_supportlib/WatchdogLauncher.h +17 -9
- data/src/cxx_supportlib/vendor-copy/libuv/AUTHORS +43 -0
- data/src/cxx_supportlib/vendor-copy/libuv/ChangeLog +350 -1
- data/src/cxx_supportlib/vendor-copy/libuv/Makefile.am +9 -1
- data/src/cxx_supportlib/vendor-copy/libuv/README.md +48 -0
- data/src/cxx_supportlib/vendor-copy/libuv/checksparse.sh +1 -0
- data/src/cxx_supportlib/vendor-copy/libuv/common.gypi +5 -5
- data/src/cxx_supportlib/vendor-copy/libuv/configure.ac +2 -1
- data/src/cxx_supportlib/vendor-copy/libuv/gyp_uv.py +0 -3
- data/src/cxx_supportlib/vendor-copy/libuv/include/uv-version.h +5 -1
- data/src/cxx_supportlib/vendor-copy/libuv/include/uv.h +30 -3
- data/src/cxx_supportlib/vendor-copy/libuv/src/fs-poll.c +3 -3
- data/src/cxx_supportlib/vendor-copy/libuv/src/inet.c +0 -4
- data/src/cxx_supportlib/vendor-copy/libuv/src/queue.h +17 -1
- data/src/cxx_supportlib/vendor-copy/libuv/src/threadpool.c +10 -10
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/aix.c +84 -166
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/android-ifaddrs.c +11 -11
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/async.c +7 -1
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/atomic-ops.h +17 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/core.c +140 -21
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/darwin.c +15 -11
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/dl.c +4 -7
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/freebsd.c +52 -37
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/fs.c +181 -60
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/fsevents.c +39 -34
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/getaddrinfo.c +4 -4
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/internal.h +3 -1
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/kqueue.c +12 -4
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-core.c +38 -15
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-inotify.c +36 -8
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-syscalls.c +4 -4
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-syscalls.h +2 -2
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/loop-watcher.c +6 -1
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/loop.c +28 -8
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/netbsd.c +18 -16
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/openbsd.c +18 -16
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/pipe.c +3 -3
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/process.c +18 -6
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/proctitle.c +2 -2
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/pthread-fixes.c +1 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/signal.c +2 -0
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/stream.c +47 -30
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/sunos.c +13 -11
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/tcp.c +43 -8
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/thread.c +21 -15
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/tty.c +16 -2
- data/src/cxx_supportlib/vendor-copy/libuv/src/unix/udp.c +54 -14
- data/src/cxx_supportlib/vendor-copy/libuv/src/uv-common.c +104 -21
- data/src/cxx_supportlib/vendor-copy/libuv/src/uv-common.h +14 -1
- data/src/cxx_supportlib/vendor-copy/libuv/src/version.c +1 -5
- data/src/cxx_supportlib/vendor-copy/libuv/uv.gyp +22 -1
- data/src/nginx_module/CacheLocationConfig.c +52 -0
- data/src/nginx_module/CacheLocationConfig.c.erb +13 -1
- data/src/nginx_module/Configuration.c +1 -0
- data/src/nginx_module/Configuration.h +1 -0
- data/src/nginx_module/ConfigurationCommands.c +20 -0
- data/src/nginx_module/ConfigurationFields.h +4 -0
- data/src/nginx_module/CreateLocationConfig.c +8 -0
- data/src/nginx_module/MergeLocationConfig.c +12 -0
- data/src/nginx_module/config +31 -13
- data/src/nginx_module/ngx_http_passenger_module.c +4 -0
- data/src/ruby_supportlib/phusion_passenger.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/constants.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +11 -1
- data/src/ruby_supportlib/phusion_passenger/platform_info/apache.rb +6 -1
- data/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb +32 -31
- data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +13 -2
- data/src/ruby_supportlib/phusion_passenger/standalone/config_utils.rb +1 -0
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +6 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core.rb +6 -0
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/api.rb +29 -19
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/context.rb +2 -2
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter.rb +2 -3
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/simple_json.rb +2 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/spec_helper.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/time_point.rb +3 -17
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/transaction.rb +7 -10
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/utils.rb +11 -9
- metadata +5 -2
@@ -45,7 +45,7 @@ include_HEADERS += include/uv-win.h include/tree.h
|
|
45
45
|
AM_CPPFLAGS += -I$(top_srcdir)/src/win \
|
46
46
|
-DWIN32_LEAN_AND_MEAN \
|
47
47
|
-D_WIN32_WINNT=0x0600
|
48
|
-
LIBS += -lws2_32 -lpsapi -liphlpapi -lshell32
|
48
|
+
LIBS += -lws2_32 -lpsapi -liphlpapi -lshell32 -luserenv
|
49
49
|
libuv_la_SOURCES += src/win/async.c \
|
50
50
|
src/win/atomicops-inl.h \
|
51
51
|
src/win/core.c \
|
@@ -165,6 +165,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \
|
|
165
165
|
test/test-getnameinfo.c \
|
166
166
|
test/test-getsockname.c \
|
167
167
|
test/test-handle-fileno.c \
|
168
|
+
test/test-homedir.c \
|
168
169
|
test/test-hrtime.c \
|
169
170
|
test/test-idle.c \
|
170
171
|
test/test-ip4-addr.c \
|
@@ -185,7 +186,10 @@ test_run_tests_SOURCES = test/blackhole-server.c \
|
|
185
186
|
test/test-ping-pong.c \
|
186
187
|
test/test-pipe-bind-error.c \
|
187
188
|
test/test-pipe-connect-error.c \
|
189
|
+
test/test-pipe-connect-multiple.c \
|
190
|
+
test/test-pipe-connect-prepare.c \
|
188
191
|
test/test-pipe-getsockname.c \
|
192
|
+
test/test-pipe-pending-instances.c \
|
189
193
|
test/test-pipe-sendmsg.c \
|
190
194
|
test/test-pipe-server-close.c \
|
191
195
|
test/test-pipe-close-stdout-read-stdin.c \
|
@@ -196,6 +200,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \
|
|
196
200
|
test/test-poll-closesocket.c \
|
197
201
|
test/test-poll.c \
|
198
202
|
test/test-process-title.c \
|
203
|
+
test/test-queue-foreach-delete.c \
|
199
204
|
test/test-ref.c \
|
200
205
|
test/test-run-nowait.c \
|
201
206
|
test/test-run-once.c \
|
@@ -213,6 +218,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \
|
|
213
218
|
test/test-tcp-close-accept.c \
|
214
219
|
test/test-tcp-close-while-connecting.c \
|
215
220
|
test/test-tcp-close.c \
|
221
|
+
test/test-tcp-create-socket-early.c \
|
216
222
|
test/test-tcp-connect-error-after-write.c \
|
217
223
|
test/test-tcp-connect-error.c \
|
218
224
|
test/test-tcp-connect-timeout.c \
|
@@ -238,6 +244,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \
|
|
238
244
|
test/test-timer.c \
|
239
245
|
test/test-tty.c \
|
240
246
|
test/test-udp-bind.c \
|
247
|
+
test/test-udp-create-socket-early.c \
|
241
248
|
test/test-udp-dgram-too-big.c \
|
242
249
|
test/test-udp-ipv6.c \
|
243
250
|
test/test-udp-multicast-interface.c \
|
@@ -274,6 +281,7 @@ endif
|
|
274
281
|
|
275
282
|
if AIX
|
276
283
|
libuv_la_CFLAGS += -D_ALL_SOURCE -D_XOPEN_SOURCE=500 -D_LINUX_SOURCE_COMPAT
|
284
|
+
include_HEADERS += include/uv-aix.h
|
277
285
|
libuv_la_SOURCES += src/unix/aix.c
|
278
286
|
endif
|
279
287
|
|
@@ -89,6 +89,42 @@ also serve as API specification and usage examples.
|
|
89
89
|
These resources are not handled by libuv maintainers and might be out of
|
90
90
|
date. Please verify it before opening new issues.
|
91
91
|
|
92
|
+
## Downloading
|
93
|
+
|
94
|
+
libuv can be downloaded either from the
|
95
|
+
[GitHub repository](https://github.com/libuv/libuv)
|
96
|
+
or from the [downloads site](http://dist.libuv.org/dist/).
|
97
|
+
|
98
|
+
Starting with libuv 1.7.0, binaries for Windows are also provided. This is to
|
99
|
+
be considered EXPERIMENTAL.
|
100
|
+
|
101
|
+
Before verifying the git tags or signature files, importing the relevant keys
|
102
|
+
is necessary. Key IDs are listed in the
|
103
|
+
[MAINTAINERS](https://github.com/libuv/libuv/blob/master/MAINTAINERS.md)
|
104
|
+
file, but are also available as git blob objects for easier use.
|
105
|
+
|
106
|
+
Importing a key the usual way:
|
107
|
+
|
108
|
+
$ gpg --keyserver pool.sks-keyservers.net \
|
109
|
+
--recv-keys AE9BC059
|
110
|
+
|
111
|
+
Importing a key from a git blob object:
|
112
|
+
|
113
|
+
$ git show pubkey-saghul | gpg --import
|
114
|
+
|
115
|
+
### Verifying releases
|
116
|
+
|
117
|
+
Git tags are signed with the developer's key, they can be verified as follows:
|
118
|
+
|
119
|
+
$ git verify-tag v1.6.1
|
120
|
+
|
121
|
+
Starting with libuv 1.7.0, the tarballs stored in the
|
122
|
+
[downloads site](http://dist.libuv.org/dist/) are signed and an accompanying
|
123
|
+
signature file sit alongside each. Once both the release tarball and the
|
124
|
+
signature file are downloaded, the file can be verified as follows:
|
125
|
+
|
126
|
+
$ gpg --verify libuv-1.7.0.tar.gz.sign
|
127
|
+
|
92
128
|
## Build Instructions
|
93
129
|
|
94
130
|
For GCC there are two build methods: via autotools or via [GYP][].
|
@@ -185,6 +221,18 @@ OS X using the GCC or XCode toolchain.
|
|
185
221
|
|
186
222
|
Solaris 121 and later using GCC toolchain.
|
187
223
|
|
224
|
+
AIX 6 and later using GCC toolchain (see notes).
|
225
|
+
|
226
|
+
### AIX Notes
|
227
|
+
|
228
|
+
AIX support for filesystem events requires the non-default IBM `bos.ahafs`
|
229
|
+
package to be installed. This package provides the AIX Event Infrastructure
|
230
|
+
that is detected by `autoconf`.
|
231
|
+
[IBM documentation](http://www.ibm.com/developerworks/aix/library/au-aix_event_infrastructure/)
|
232
|
+
describes the package in more detail.
|
233
|
+
|
234
|
+
AIX support for filesystem events is not compiled when building with `gyp`.
|
235
|
+
|
188
236
|
## Patches
|
189
237
|
|
190
238
|
See the [guidelines for contributing][].
|
@@ -4,7 +4,6 @@
|
|
4
4
|
'target_arch%': 'ia32', # set v8's target architecture
|
5
5
|
'host_arch%': 'ia32', # set v8's host architecture
|
6
6
|
'uv_library%': 'static_library', # allow override to 'shared_library' for DLL/.so builds
|
7
|
-
'component%': 'static_library', # NB. these names match with what V8 expects
|
8
7
|
'msvs_multi_core_compile': '0', # we do enable multicore compiles, but not using the V8 way
|
9
8
|
},
|
10
9
|
|
@@ -37,9 +36,10 @@
|
|
37
36
|
'OTHER_CFLAGS': [ '-Wno-strict-aliasing' ],
|
38
37
|
},
|
39
38
|
'conditions': [
|
40
|
-
['OS
|
41
|
-
'
|
42
|
-
|
39
|
+
['OS == "android"', {
|
40
|
+
'cflags': [ '-fPIE' ],
|
41
|
+
'ldflags': [ '-fPIE', '-pie' ]
|
42
|
+
}]
|
43
43
|
]
|
44
44
|
},
|
45
45
|
'Release': {
|
@@ -128,7 +128,7 @@
|
|
128
128
|
}]
|
129
129
|
]
|
130
130
|
}],
|
131
|
-
['OS in "freebsd linux openbsd solaris android"', {
|
131
|
+
['OS in "freebsd dragonflybsd linux openbsd solaris android"', {
|
132
132
|
'cflags': [ '-Wall' ],
|
133
133
|
'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
|
134
134
|
'target_conditions': [
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
14
14
|
|
15
15
|
AC_PREREQ(2.57)
|
16
|
-
AC_INIT([libuv], [1.
|
16
|
+
AC_INIT([libuv], [1.8.0], [https://github.com/libuv/libuv/issues])
|
17
17
|
AC_CONFIG_MACRO_DIR([m4])
|
18
18
|
m4_include([m4/libuv-extra-automake-flags.m4])
|
19
19
|
m4_include([m4/as_case.m4])
|
@@ -58,6 +58,7 @@ AM_CONDITIONAL([NETBSD], [AS_CASE([$host_os],[netbsd*], [true], [false])
|
|
58
58
|
AM_CONDITIONAL([OPENBSD], [AS_CASE([$host_os],[openbsd*], [true], [false])])
|
59
59
|
AM_CONDITIONAL([SUNOS], [AS_CASE([$host_os],[solaris*], [true], [false])])
|
60
60
|
AM_CONDITIONAL([WINNT], [AS_CASE([$host_os],[mingw*], [true], [false])])
|
61
|
+
AC_CHECK_HEADERS([sys/ahafs_evProds.h])
|
61
62
|
AC_CHECK_PROG(PKG_CONFIG, pkg-config, yes)
|
62
63
|
AM_CONDITIONAL([HAVE_PKG_CONFIG], [test "x$PKG_CONFIG" != "x"])
|
63
64
|
AS_IF([test "x$PKG_CONFIG" != "x"], [
|
@@ -83,9 +83,6 @@ if __name__ == '__main__':
|
|
83
83
|
if not any(a.startswith('-Duv_library=') for a in args):
|
84
84
|
args.append('-Duv_library=static_library')
|
85
85
|
|
86
|
-
if not any(a.startswith('-Dcomponent=') for a in args):
|
87
|
-
args.append('-Dcomponent=static_library')
|
88
|
-
|
89
86
|
# Some platforms (OpenBSD for example) don't have multiprocessing.synchronize
|
90
87
|
# so gyp must be run with --no-parallel
|
91
88
|
if not gyp_parallel_support:
|
@@ -31,9 +31,13 @@
|
|
31
31
|
*/
|
32
32
|
|
33
33
|
#define UV_VERSION_MAJOR 1
|
34
|
-
#define UV_VERSION_MINOR
|
34
|
+
#define UV_VERSION_MINOR 8
|
35
35
|
#define UV_VERSION_PATCH 0
|
36
36
|
#define UV_VERSION_IS_RELEASE 1
|
37
37
|
#define UV_VERSION_SUFFIX ""
|
38
38
|
|
39
|
+
#define UV_VERSION_HEX ((UV_VERSION_MAJOR << 16) | \
|
40
|
+
(UV_VERSION_MINOR << 8) | \
|
41
|
+
(UV_VERSION_PATCH))
|
42
|
+
|
39
43
|
#endif /* UV_VERSION_H */
|
@@ -48,6 +48,7 @@ extern "C" {
|
|
48
48
|
#include "uv-errno.h"
|
49
49
|
#include "uv-version.h"
|
50
50
|
#include <stddef.h>
|
51
|
+
#include <stdio.h>
|
51
52
|
|
52
53
|
#if defined(_MSC_VER) && _MSC_VER < 1600
|
53
54
|
# include "stdint-msvc2008.h"
|
@@ -244,6 +245,16 @@ typedef enum {
|
|
244
245
|
UV_EXTERN unsigned int uv_version(void);
|
245
246
|
UV_EXTERN const char* uv_version_string(void);
|
246
247
|
|
248
|
+
typedef void* (*uv_malloc_func)(size_t size);
|
249
|
+
typedef void* (*uv_realloc_func)(void* ptr, size_t size);
|
250
|
+
typedef void* (*uv_calloc_func)(size_t count, size_t size);
|
251
|
+
typedef void (*uv_free_func)(void* ptr);
|
252
|
+
|
253
|
+
UV_EXTERN int uv_replace_allocator(uv_malloc_func malloc_func,
|
254
|
+
uv_realloc_func realloc_func,
|
255
|
+
uv_calloc_func calloc_func,
|
256
|
+
uv_free_func free_func);
|
257
|
+
|
247
258
|
UV_EXTERN uv_loop_t* uv_default_loop(void);
|
248
259
|
UV_EXTERN int uv_loop_init(uv_loop_t* loop);
|
249
260
|
UV_EXTERN int uv_loop_close(uv_loop_t* loop);
|
@@ -396,7 +407,10 @@ struct uv_shutdown_s {
|
|
396
407
|
/* private */ \
|
397
408
|
uv_close_cb close_cb; \
|
398
409
|
void* handle_queue[2]; \
|
399
|
-
|
410
|
+
union { \
|
411
|
+
int fd; \
|
412
|
+
void* reserved[4]; \
|
413
|
+
} u; \
|
400
414
|
UV_HANDLE_PRIVATE_FIELDS \
|
401
415
|
|
402
416
|
/* The abstract base class of all handles. */
|
@@ -411,6 +425,10 @@ UV_EXTERN int uv_is_active(const uv_handle_t* handle);
|
|
411
425
|
|
412
426
|
UV_EXTERN void uv_walk(uv_loop_t* loop, uv_walk_cb walk_cb, void* arg);
|
413
427
|
|
428
|
+
/* Helpers for ad hoc debugging, no API/ABI stability guaranteed. */
|
429
|
+
UV_EXTERN void uv_print_all_handles(uv_loop_t* loop, FILE* stream);
|
430
|
+
UV_EXTERN void uv_print_active_handles(uv_loop_t* loop, FILE* stream);
|
431
|
+
|
414
432
|
UV_EXTERN void uv_close(uv_handle_t* handle, uv_close_cb close_cb);
|
415
433
|
|
416
434
|
UV_EXTERN int uv_send_buffer_size(uv_handle_t* handle, int* value);
|
@@ -494,6 +512,7 @@ struct uv_tcp_s {
|
|
494
512
|
};
|
495
513
|
|
496
514
|
UV_EXTERN int uv_tcp_init(uv_loop_t*, uv_tcp_t* handle);
|
515
|
+
UV_EXTERN int uv_tcp_init_ex(uv_loop_t*, uv_tcp_t* handle, unsigned int flags);
|
497
516
|
UV_EXTERN int uv_tcp_open(uv_tcp_t* handle, uv_os_sock_t sock);
|
498
517
|
UV_EXTERN int uv_tcp_nodelay(uv_tcp_t* handle, int enable);
|
499
518
|
UV_EXTERN int uv_tcp_keepalive(uv_tcp_t* handle,
|
@@ -584,6 +603,7 @@ struct uv_udp_send_s {
|
|
584
603
|
};
|
585
604
|
|
586
605
|
UV_EXTERN int uv_udp_init(uv_loop_t*, uv_udp_t* handle);
|
606
|
+
UV_EXTERN int uv_udp_init_ex(uv_loop_t*, uv_udp_t* handle, unsigned int flags);
|
587
607
|
UV_EXTERN int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock);
|
588
608
|
UV_EXTERN int uv_udp_bind(uv_udp_t* handle,
|
589
609
|
const struct sockaddr* addr,
|
@@ -1028,6 +1048,8 @@ typedef struct {
|
|
1028
1048
|
|
1029
1049
|
UV_EXTERN int uv_getrusage(uv_rusage_t* rusage);
|
1030
1050
|
|
1051
|
+
UV_EXTERN int uv_os_homedir(char* buffer, size_t* size);
|
1052
|
+
|
1031
1053
|
UV_EXTERN int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count);
|
1032
1054
|
UV_EXTERN void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count);
|
1033
1055
|
|
@@ -1066,7 +1088,8 @@ typedef enum {
|
|
1066
1088
|
UV_FS_SYMLINK,
|
1067
1089
|
UV_FS_READLINK,
|
1068
1090
|
UV_FS_CHOWN,
|
1069
|
-
UV_FS_FCHOWN
|
1091
|
+
UV_FS_FCHOWN,
|
1092
|
+
UV_FS_REALPATH
|
1070
1093
|
} uv_fs_type;
|
1071
1094
|
|
1072
1095
|
/* uv_fs_t is a subclass of uv_req_t. */
|
@@ -1218,6 +1241,10 @@ UV_EXTERN int uv_fs_readlink(uv_loop_t* loop,
|
|
1218
1241
|
uv_fs_t* req,
|
1219
1242
|
const char* path,
|
1220
1243
|
uv_fs_cb cb);
|
1244
|
+
UV_EXTERN int uv_fs_realpath(uv_loop_t* loop,
|
1245
|
+
uv_fs_t* req,
|
1246
|
+
const char* path,
|
1247
|
+
uv_fs_cb cb);
|
1221
1248
|
UV_EXTERN int uv_fs_fchmod(uv_loop_t* loop,
|
1222
1249
|
uv_fs_t* req,
|
1223
1250
|
uv_file file,
|
@@ -1346,7 +1373,7 @@ UV_EXTERN int uv_chdir(const char* dir);
|
|
1346
1373
|
UV_EXTERN uint64_t uv_get_free_memory(void);
|
1347
1374
|
UV_EXTERN uint64_t uv_get_total_memory(void);
|
1348
1375
|
|
1349
|
-
UV_EXTERN
|
1376
|
+
UV_EXTERN uint64_t uv_hrtime(void);
|
1350
1377
|
|
1351
1378
|
UV_EXTERN void uv_disable_stdio_inheritance(void);
|
1352
1379
|
|
@@ -67,7 +67,7 @@ int uv_fs_poll_start(uv_fs_poll_t* handle,
|
|
67
67
|
|
68
68
|
loop = handle->loop;
|
69
69
|
len = strlen(path);
|
70
|
-
ctx =
|
70
|
+
ctx = uv__calloc(1, sizeof(*ctx) + len);
|
71
71
|
|
72
72
|
if (ctx == NULL)
|
73
73
|
return UV_ENOMEM;
|
@@ -96,7 +96,7 @@ int uv_fs_poll_start(uv_fs_poll_t* handle,
|
|
96
96
|
return 0;
|
97
97
|
|
98
98
|
error:
|
99
|
-
|
99
|
+
uv__free(ctx);
|
100
100
|
return err;
|
101
101
|
}
|
102
102
|
|
@@ -219,7 +219,7 @@ out:
|
|
219
219
|
|
220
220
|
|
221
221
|
static void timer_close_cb(uv_handle_t* handle) {
|
222
|
-
|
222
|
+
uv__free(container_of(handle, struct poll_ctx, timer_handle));
|
223
223
|
}
|
224
224
|
|
225
225
|
|
@@ -55,11 +55,7 @@ static int inet_ntop4(const unsigned char *src, char *dst, size_t size) {
|
|
55
55
|
char tmp[UV__INET_ADDRSTRLEN];
|
56
56
|
int l;
|
57
57
|
|
58
|
-
#ifndef _WIN32
|
59
58
|
l = snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]);
|
60
|
-
#else
|
61
|
-
l = _snprintf(tmp, sizeof(tmp), fmt, src[0], src[1], src[2], src[3]);
|
62
|
-
#endif
|
63
59
|
if (l <= 0 || (size_t) l >= size) {
|
64
60
|
return UV_ENOSPC;
|
65
61
|
}
|
@@ -16,6 +16,8 @@
|
|
16
16
|
#ifndef QUEUE_H_
|
17
17
|
#define QUEUE_H_
|
18
18
|
|
19
|
+
#include <stddef.h>
|
20
|
+
|
19
21
|
typedef void *QUEUE[2];
|
20
22
|
|
21
23
|
/* Private macros. */
|
@@ -26,8 +28,11 @@ typedef void *QUEUE[2];
|
|
26
28
|
|
27
29
|
/* Public macros. */
|
28
30
|
#define QUEUE_DATA(ptr, type, field) \
|
29
|
-
((type *) ((char *) (ptr) - (
|
31
|
+
((type *) ((char *) (ptr) - offsetof(type, field)))
|
30
32
|
|
33
|
+
/* Important note: mutating the list while QUEUE_FOREACH is
|
34
|
+
* iterating over its elements results in undefined behavior.
|
35
|
+
*/
|
31
36
|
#define QUEUE_FOREACH(q, h) \
|
32
37
|
for ((q) = QUEUE_NEXT(h); (q) != (h); (q) = QUEUE_NEXT(q))
|
33
38
|
|
@@ -64,6 +69,17 @@ typedef void *QUEUE[2];
|
|
64
69
|
} \
|
65
70
|
while (0)
|
66
71
|
|
72
|
+
#define QUEUE_MOVE(h, n) \
|
73
|
+
do { \
|
74
|
+
if (QUEUE_EMPTY(h)) \
|
75
|
+
QUEUE_INIT(n); \
|
76
|
+
else { \
|
77
|
+
QUEUE* q = QUEUE_HEAD(h); \
|
78
|
+
QUEUE_SPLIT(h, q, n); \
|
79
|
+
} \
|
80
|
+
} \
|
81
|
+
while (0)
|
82
|
+
|
67
83
|
#define QUEUE_INSERT_HEAD(h, q) \
|
68
84
|
do { \
|
69
85
|
QUEUE_NEXT(q) = QUEUE_NEXT(h); \
|
@@ -44,6 +44,7 @@ static void uv__req_init(uv_loop_t* loop,
|
|
44
44
|
static uv_once_t once = UV_ONCE_INIT;
|
45
45
|
static uv_cond_t cond;
|
46
46
|
static uv_mutex_t mutex;
|
47
|
+
static unsigned int idle_threads;
|
47
48
|
static unsigned int nthreads;
|
48
49
|
static uv_thread_t* threads;
|
49
50
|
static uv_thread_t default_threads[4];
|
@@ -69,8 +70,11 @@ static void worker(void* arg) {
|
|
69
70
|
for (;;) {
|
70
71
|
uv_mutex_lock(&mutex);
|
71
72
|
|
72
|
-
while (QUEUE_EMPTY(&wq))
|
73
|
+
while (QUEUE_EMPTY(&wq)) {
|
74
|
+
idle_threads += 1;
|
73
75
|
uv_cond_wait(&cond, &mutex);
|
76
|
+
idle_threads -= 1;
|
77
|
+
}
|
74
78
|
|
75
79
|
q = QUEUE_HEAD(&wq);
|
76
80
|
|
@@ -103,7 +107,8 @@ static void worker(void* arg) {
|
|
103
107
|
static void post(QUEUE* q) {
|
104
108
|
uv_mutex_lock(&mutex);
|
105
109
|
QUEUE_INSERT_TAIL(&wq, q);
|
106
|
-
|
110
|
+
if (idle_threads > 0)
|
111
|
+
uv_cond_signal(&cond);
|
107
112
|
uv_mutex_unlock(&mutex);
|
108
113
|
}
|
109
114
|
|
@@ -122,7 +127,7 @@ UV_DESTRUCTOR(static void cleanup(void)) {
|
|
122
127
|
abort();
|
123
128
|
|
124
129
|
if (threads != default_threads)
|
125
|
-
|
130
|
+
uv__free(threads);
|
126
131
|
|
127
132
|
uv_mutex_destroy(&mutex);
|
128
133
|
uv_cond_destroy(&cond);
|
@@ -149,7 +154,7 @@ static void init_once(void) {
|
|
149
154
|
|
150
155
|
threads = default_threads;
|
151
156
|
if (nthreads > ARRAY_SIZE(default_threads)) {
|
152
|
-
threads =
|
157
|
+
threads = uv__malloc(nthreads * sizeof(threads[0]));
|
153
158
|
if (threads == NULL) {
|
154
159
|
nthreads = ARRAY_SIZE(default_threads);
|
155
160
|
threads = default_threads;
|
@@ -218,13 +223,8 @@ void uv__work_done(uv_async_t* handle) {
|
|
218
223
|
int err;
|
219
224
|
|
220
225
|
loop = container_of(handle, uv_loop_t, wq_async);
|
221
|
-
QUEUE_INIT(&wq);
|
222
|
-
|
223
226
|
uv_mutex_lock(&loop->wq_mutex);
|
224
|
-
|
225
|
-
q = QUEUE_HEAD(&loop->wq);
|
226
|
-
QUEUE_SPLIT(&loop->wq, q, &wq);
|
227
|
-
}
|
227
|
+
QUEUE_MOVE(&loop->wq, &wq);
|
228
228
|
uv_mutex_unlock(&loop->wq_mutex);
|
229
229
|
|
230
230
|
while (!QUEUE_EMPTY(&wq)) {
|
@@ -43,6 +43,7 @@
|
|
43
43
|
|
44
44
|
#include <sys/protosw.h>
|
45
45
|
#include <libperfstat.h>
|
46
|
+
#include <procinfo.h>
|
46
47
|
#include <sys/proc.h>
|
47
48
|
#include <sys/procfs.h>
|
48
49
|
|
@@ -50,7 +51,9 @@
|
|
50
51
|
|
51
52
|
#include <sys/pollset.h>
|
52
53
|
#include <ctype.h>
|
54
|
+
#ifdef HAVE_SYS_AHAFS_EVPRODS_H
|
53
55
|
#include <sys/ahafs_evProds.h>
|
56
|
+
#endif
|
54
57
|
|
55
58
|
#include <sys/mntctl.h>
|
56
59
|
#include <sys/vmount.h>
|
@@ -286,182 +289,80 @@ uint64_t uv__hrtime(uv_clocktype_t type) {
|
|
286
289
|
* and use it in conjunction with PATH environment variable to craft one.
|
287
290
|
*/
|
288
291
|
int uv_exepath(char* buffer, size_t* size) {
|
289
|
-
|
290
|
-
char
|
291
|
-
char
|
292
|
-
|
293
|
-
struct
|
294
|
-
int fd;
|
295
|
-
char **argv;
|
292
|
+
int res;
|
293
|
+
char args[PATH_MAX];
|
294
|
+
char abspath[PATH_MAX];
|
295
|
+
size_t abspath_size;
|
296
|
+
struct procsinfo pi;
|
296
297
|
|
297
298
|
if (buffer == NULL || size == NULL || *size == 0)
|
298
299
|
return -EINVAL;
|
299
300
|
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
if (fd < 0)
|
304
|
-
return fd;
|
305
|
-
|
306
|
-
res = read(fd, &ps, sizeof(ps));
|
307
|
-
uv__close(fd);
|
308
|
-
if (res < 0)
|
309
|
-
return res;
|
310
|
-
|
311
|
-
if (ps.pr_argv == 0)
|
312
|
-
return -EINVAL;
|
313
|
-
|
314
|
-
argv = (char **) *((char ***) (intptr_t) ps.pr_argv);
|
315
|
-
|
316
|
-
if ((argv == NULL) || (argv[0] == NULL))
|
301
|
+
pi.pi_pid = getpid();
|
302
|
+
res = getargs(&pi, sizeof(pi), args, sizeof(args));
|
303
|
+
if (res < 0)
|
317
304
|
return -EINVAL;
|
318
305
|
|
319
306
|
/*
|
320
|
-
*
|
307
|
+
* Possibilities for args:
|
321
308
|
* i) an absolute path such as: /home/user/myprojects/nodejs/node
|
322
|
-
* ii) a relative path such as: ./node or
|
309
|
+
* ii) a relative path such as: ./node or ../myprojects/nodejs/node
|
323
310
|
* iii) a bare filename such as "node", after exporting PATH variable
|
324
311
|
* to its location.
|
325
312
|
*/
|
326
313
|
|
327
|
-
/*
|
328
|
-
if (
|
329
|
-
|
330
|
-
|
331
|
-
/* This could or could not be a symlink. */
|
332
|
-
res = readlink(symlink, temp_buffer, PATH_MAX-1);
|
333
|
-
|
334
|
-
/* if readlink fails, it is a normal file just copy symlink to the
|
335
|
-
* output buffer.
|
336
|
-
*/
|
337
|
-
if (res < 0) {
|
338
|
-
assert(*size > strlen(symlink));
|
339
|
-
strcpy(buffer, symlink);
|
340
|
-
|
341
|
-
/* If it is a link, the resolved filename is again a relative path,
|
342
|
-
* make it absolute.
|
343
|
-
*/
|
344
|
-
} else {
|
345
|
-
assert(*size > (strlen(symlink) + 1 + strlen(temp_buffer)));
|
346
|
-
snprintf(buffer, *size-1, "%s/%s", dirname(symlink), temp_buffer);
|
347
|
-
}
|
348
|
-
*size = strlen(buffer);
|
349
|
-
return 0;
|
350
|
-
|
351
|
-
/* case #2, relative path with usage of '.' */
|
352
|
-
} else if (argv[0][0] == '.') {
|
353
|
-
char *relative = strchr(argv[0], '/');
|
354
|
-
if (relative == NULL)
|
355
|
-
return -EINVAL;
|
356
|
-
|
357
|
-
/* Get the current working directory to resolve the relative path. */
|
358
|
-
snprintf(cwd, PATH_MAX-1, "/proc/%lu/cwd", (unsigned long) getpid());
|
359
|
-
|
360
|
-
/* This is always a symlink, resolve it. */
|
361
|
-
res = readlink(cwd, cwdl, sizeof(cwdl) - 1);
|
362
|
-
if (res < 0)
|
314
|
+
/* Case i) and ii) absolute or relative paths */
|
315
|
+
if (strchr(args, '/') != NULL) {
|
316
|
+
if (realpath(args, abspath) != abspath)
|
363
317
|
return -errno;
|
364
318
|
|
365
|
-
|
366
|
-
|
367
|
-
res = readlink(symlink, temp_buffer, PATH_MAX-1);
|
368
|
-
if (res < 0) {
|
369
|
-
assert(*size > strlen(symlink));
|
370
|
-
strcpy(buffer, symlink);
|
371
|
-
} else {
|
372
|
-
assert(*size > (strlen(symlink) + 1 + strlen(temp_buffer)));
|
373
|
-
snprintf(buffer, *size-1, "%s/%s", dirname(symlink), temp_buffer);
|
374
|
-
}
|
375
|
-
*size = strlen(buffer);
|
376
|
-
return 0;
|
377
|
-
|
378
|
-
/* case #3, relative path without usage of '.', such as invocations in Node test suite. */
|
379
|
-
} else if (strchr(argv[0], '/') != NULL) {
|
380
|
-
/* Get the current working directory to resolve the relative path. */
|
381
|
-
snprintf(cwd, PATH_MAX-1, "/proc/%lu/cwd", (unsigned long) getpid());
|
319
|
+
abspath_size = strlen(abspath);
|
382
320
|
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
return -errno;
|
321
|
+
*size -= 1;
|
322
|
+
if (*size > abspath_size)
|
323
|
+
*size = abspath_size;
|
387
324
|
|
388
|
-
|
325
|
+
memcpy(buffer, abspath, *size);
|
326
|
+
buffer[*size] = '\0';
|
389
327
|
|
390
|
-
res = readlink(symlink, temp_buffer, PATH_MAX-1);
|
391
|
-
if (res < 0) {
|
392
|
-
assert(*size > strlen(symlink));
|
393
|
-
strcpy(buffer, symlink);
|
394
|
-
} else {
|
395
|
-
assert(*size > (strlen(symlink) + 1 + strlen(temp_buffer)));
|
396
|
-
snprintf(buffer, *size-1, "%s/%s", dirname(symlink), temp_buffer);
|
397
|
-
}
|
398
|
-
*size = strlen(buffer);
|
399
328
|
return 0;
|
400
|
-
/* Usage of absolute filename with location exported in PATH */
|
401
329
|
} else {
|
402
|
-
|
330
|
+
/* Case iii). Search PATH environment variable */
|
331
|
+
char trypath[PATH_MAX];
|
332
|
+
char *clonedpath = NULL;
|
403
333
|
char *token = NULL;
|
404
|
-
struct stat statstruct;
|
405
|
-
|
406
|
-
/* Get the paths. */
|
407
334
|
char *path = getenv("PATH");
|
408
|
-
|
335
|
+
|
336
|
+
if (path == NULL)
|
409
337
|
return -EINVAL;
|
410
338
|
|
411
|
-
|
412
|
-
|
339
|
+
clonedpath = uv__strdup(path);
|
340
|
+
if (clonedpath == NULL)
|
341
|
+
return -ENOMEM;
|
413
342
|
|
414
|
-
/* Tokenize. */
|
415
343
|
token = strtok(clonedpath, ":");
|
344
|
+
while (token != NULL) {
|
345
|
+
snprintf(trypath, sizeof(trypath) - 1, "%s/%s", token, args);
|
346
|
+
if (realpath(trypath, abspath) == abspath) {
|
347
|
+
/* Check the match is executable */
|
348
|
+
if (access(abspath, X_OK) == 0) {
|
349
|
+
abspath_size = strlen(abspath);
|
416
350
|
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
if (res < 0)
|
421
|
-
return -errno;
|
422
|
-
/* Run through the tokens, append our executable file name with each,
|
423
|
-
* and see which one succeeds. Exit on first match. */
|
424
|
-
while(token != NULL) {
|
425
|
-
if (token[0] == '.') {
|
426
|
-
/* Path contains a token relative to current directory. */
|
427
|
-
char *relative = strchr(token, '/');
|
428
|
-
if (relative != NULL)
|
429
|
-
/* A path which is not current directory. */
|
430
|
-
snprintf(symlink, PATH_MAX-1, "%s%s/%s", cwdl, relative+1, ps.pr_fname);
|
431
|
-
else
|
432
|
-
snprintf(symlink, PATH_MAX-1, "%s%s", cwdl, ps.pr_fname);
|
433
|
-
if (stat(symlink, &statstruct) != -1) {
|
434
|
-
/* File exists. Resolve if it is a link. */
|
435
|
-
res = readlink(symlink, temp_buffer, PATH_MAX-1);
|
436
|
-
if (res < 0) {
|
437
|
-
assert(*size > strlen(symlink));
|
438
|
-
strcpy(buffer, symlink);
|
439
|
-
} else {
|
440
|
-
assert(*size > (strlen(symlink) + 1 + strlen(temp_buffer)));
|
441
|
-
snprintf(buffer, *size-1, "%s/%s", dirname(symlink), temp_buffer);
|
442
|
-
}
|
443
|
-
*size = strlen(buffer);
|
444
|
-
return 0;
|
445
|
-
}
|
351
|
+
*size -= 1;
|
352
|
+
if (*size > abspath_size)
|
353
|
+
*size = abspath_size;
|
446
354
|
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
res = readlink(symlink, temp_buffer, PATH_MAX-1);
|
452
|
-
if (res < 0) {
|
453
|
-
assert(*size > strlen(symlink));
|
454
|
-
strcpy(buffer, symlink);
|
455
|
-
} else {
|
456
|
-
assert(*size > (strlen(symlink) + 1 + strlen(temp_buffer)));
|
457
|
-
snprintf(buffer, *size-1, "%s/%s", dirname(symlink), temp_buffer);
|
458
|
-
}
|
459
|
-
*size = strlen(buffer);
|
355
|
+
memcpy(buffer, abspath, *size);
|
356
|
+
buffer[*size] = '\0';
|
357
|
+
|
358
|
+
uv__free(clonedpath);
|
460
359
|
return 0;
|
461
360
|
}
|
462
361
|
}
|
463
362
|
token = strtok(NULL, ":");
|
464
363
|
}
|
364
|
+
uv__free(clonedpath);
|
365
|
+
|
465
366
|
/* Out of tokens (path entries), and no match found */
|
466
367
|
return -EINVAL;
|
467
368
|
}
|
@@ -501,6 +402,7 @@ void uv_loadavg(double avg[3]) {
|
|
501
402
|
}
|
502
403
|
|
503
404
|
|
405
|
+
#ifdef HAVE_SYS_AHAFS_EVPRODS_H
|
504
406
|
static char *uv__rawname(char *cp) {
|
505
407
|
static char rawbuf[FILENAME_MAX+1];
|
506
408
|
char *dp = rindex(cp, '/');
|
@@ -550,7 +452,7 @@ static int uv__is_ahafs_mounted(void){
|
|
550
452
|
const char *dev = "/aha";
|
551
453
|
char *obj, *stub;
|
552
454
|
|
553
|
-
p =
|
455
|
+
p = uv__malloc(siz);
|
554
456
|
if (p == NULL)
|
555
457
|
return -errno;
|
556
458
|
|
@@ -561,8 +463,8 @@ static int uv__is_ahafs_mounted(void){
|
|
561
463
|
if (rv == 0) {
|
562
464
|
/* buffer was not large enough, reallocate to correct size */
|
563
465
|
siz = *(int*)p;
|
564
|
-
|
565
|
-
p =
|
466
|
+
uv__free(p);
|
467
|
+
p = uv__malloc(siz);
|
566
468
|
if (p == NULL)
|
567
469
|
return -errno;
|
568
470
|
rv = mntctl(MCTL_QUERY, siz, (char*)p);
|
@@ -576,7 +478,7 @@ static int uv__is_ahafs_mounted(void){
|
|
576
478
|
stub = vmt2dataptr(vmt, VMT_STUB); /* mount point */
|
577
479
|
|
578
480
|
if (EQ(obj, dev) || EQ(uv__rawname(obj), dev) || EQ(stub, dev)) {
|
579
|
-
|
481
|
+
uv__free(p); /* Found a match */
|
580
482
|
return 0;
|
581
483
|
}
|
582
484
|
vmt = (struct vmount *) ((char *) vmt + vmt->vmt_length);
|
@@ -781,7 +683,7 @@ static int uv__parse_data(char *buf, int *events, uv_fs_event_t* handle) {
|
|
781
683
|
|
782
684
|
/* Scan out the name of the file that triggered the event*/
|
783
685
|
if (sscanf(p, "BEGIN_EVPROD_INFO\n%sEND_EVPROD_INFO", filename) == 1) {
|
784
|
-
handle->dir_filename =
|
686
|
+
handle->dir_filename = uv__strdup((const char*)&filename);
|
785
687
|
} else
|
786
688
|
return -1;
|
787
689
|
}
|
@@ -859,11 +761,16 @@ static void uv__ahafs_event(uv_loop_t* loop, uv__io_t* event_watch, unsigned int
|
|
859
761
|
else /* Call the actual JavaScript callback function */
|
860
762
|
handle->cb(handle, (const char*)&fname, events, 0);
|
861
763
|
}
|
764
|
+
#endif
|
862
765
|
|
863
766
|
|
864
767
|
int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) {
|
768
|
+
#ifdef HAVE_SYS_AHAFS_EVPRODS_H
|
865
769
|
uv__handle_init(loop, (uv_handle_t*)handle, UV_FS_EVENT);
|
866
770
|
return 0;
|
771
|
+
#else
|
772
|
+
return -ENOSYS;
|
773
|
+
#endif
|
867
774
|
}
|
868
775
|
|
869
776
|
|
@@ -871,6 +778,7 @@ int uv_fs_event_start(uv_fs_event_t* handle,
|
|
871
778
|
uv_fs_event_cb cb,
|
872
779
|
const char* filename,
|
873
780
|
unsigned int flags) {
|
781
|
+
#ifdef HAVE_SYS_AHAFS_EVPRODS_H
|
874
782
|
int fd, rc, i = 0, res = 0;
|
875
783
|
char cwd[PATH_MAX];
|
876
784
|
char absolute_path[PATH_MAX];
|
@@ -931,17 +839,20 @@ int uv_fs_event_start(uv_fs_event_t* handle,
|
|
931
839
|
/* Setup/Initialize all the libuv routines */
|
932
840
|
uv__handle_start(handle);
|
933
841
|
uv__io_init(&handle->event_watcher, uv__ahafs_event, fd);
|
934
|
-
handle->path =
|
842
|
+
handle->path = uv__strdup((const char*)&absolute_path);
|
935
843
|
handle->cb = cb;
|
936
844
|
|
937
845
|
uv__io_start(handle->loop, &handle->event_watcher, UV__POLLIN);
|
938
846
|
|
939
847
|
return 0;
|
848
|
+
#else
|
849
|
+
return -ENOSYS;
|
850
|
+
#endif
|
940
851
|
}
|
941
852
|
|
942
853
|
|
943
854
|
int uv_fs_event_stop(uv_fs_event_t* handle) {
|
944
|
-
|
855
|
+
#ifdef HAVE_SYS_AHAFS_EVPRODS_H
|
945
856
|
if (!uv__is_active(handle))
|
946
857
|
return 0;
|
947
858
|
|
@@ -949,21 +860,28 @@ int uv_fs_event_stop(uv_fs_event_t* handle) {
|
|
949
860
|
uv__handle_stop(handle);
|
950
861
|
|
951
862
|
if (uv__path_is_a_directory(handle->path) == 0) {
|
952
|
-
|
863
|
+
uv__free(handle->dir_filename);
|
953
864
|
handle->dir_filename = NULL;
|
954
865
|
}
|
955
866
|
|
956
|
-
|
867
|
+
uv__free(handle->path);
|
957
868
|
handle->path = NULL;
|
958
869
|
uv__close(handle->event_watcher.fd);
|
959
870
|
handle->event_watcher.fd = -1;
|
960
871
|
|
961
872
|
return 0;
|
873
|
+
#else
|
874
|
+
return -ENOSYS;
|
875
|
+
#endif
|
962
876
|
}
|
963
877
|
|
964
878
|
|
965
879
|
void uv__fs_event_close(uv_fs_event_t* handle) {
|
880
|
+
#ifdef HAVE_SYS_AHAFS_EVPRODS_H
|
966
881
|
uv_fs_event_stop(handle);
|
882
|
+
#else
|
883
|
+
UNREACHABLE();
|
884
|
+
#endif
|
967
885
|
}
|
968
886
|
|
969
887
|
|
@@ -1052,7 +970,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
|
|
1052
970
|
return -ENOSYS;
|
1053
971
|
}
|
1054
972
|
|
1055
|
-
ps_cpus = (perfstat_cpu_t*)
|
973
|
+
ps_cpus = (perfstat_cpu_t*) uv__malloc(ncpus * sizeof(perfstat_cpu_t));
|
1056
974
|
if (!ps_cpus) {
|
1057
975
|
return -ENOMEM;
|
1058
976
|
}
|
@@ -1060,13 +978,13 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
|
|
1060
978
|
strcpy(cpu_id.name, FIRST_CPU);
|
1061
979
|
result = perfstat_cpu(&cpu_id, ps_cpus, sizeof(perfstat_cpu_t), ncpus);
|
1062
980
|
if (result == -1) {
|
1063
|
-
|
981
|
+
uv__free(ps_cpus);
|
1064
982
|
return -ENOSYS;
|
1065
983
|
}
|
1066
984
|
|
1067
|
-
*cpu_infos = (uv_cpu_info_t*)
|
985
|
+
*cpu_infos = (uv_cpu_info_t*) uv__malloc(ncpus * sizeof(uv_cpu_info_t));
|
1068
986
|
if (!*cpu_infos) {
|
1069
|
-
|
987
|
+
uv__free(ps_cpus);
|
1070
988
|
return -ENOMEM;
|
1071
989
|
}
|
1072
990
|
|
@@ -1075,7 +993,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
|
|
1075
993
|
cpu_info = *cpu_infos;
|
1076
994
|
while (idx < ncpus) {
|
1077
995
|
cpu_info->speed = (int)(ps_total.processorHZ / 1000000);
|
1078
|
-
cpu_info->model =
|
996
|
+
cpu_info->model = uv__strdup(ps_total.description);
|
1079
997
|
cpu_info->cpu_times.user = ps_cpus[idx].user;
|
1080
998
|
cpu_info->cpu_times.sys = ps_cpus[idx].sys;
|
1081
999
|
cpu_info->cpu_times.idle = ps_cpus[idx].idle;
|
@@ -1085,7 +1003,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
|
|
1085
1003
|
idx++;
|
1086
1004
|
}
|
1087
1005
|
|
1088
|
-
|
1006
|
+
uv__free(ps_cpus);
|
1089
1007
|
return 0;
|
1090
1008
|
}
|
1091
1009
|
|
@@ -1094,10 +1012,10 @@ void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) {
|
|
1094
1012
|
int i;
|
1095
1013
|
|
1096
1014
|
for (i = 0; i < count; ++i) {
|
1097
|
-
|
1015
|
+
uv__free(cpu_infos[i].model);
|
1098
1016
|
}
|
1099
1017
|
|
1100
|
-
|
1018
|
+
uv__free(cpu_infos);
|
1101
1019
|
}
|
1102
1020
|
|
1103
1021
|
|
@@ -1119,7 +1037,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses,
|
|
1119
1037
|
return -errno;
|
1120
1038
|
}
|
1121
1039
|
|
1122
|
-
ifc.ifc_req = (struct ifreq*)
|
1040
|
+
ifc.ifc_req = (struct ifreq*)uv__malloc(size);
|
1123
1041
|
ifc.ifc_len = size;
|
1124
1042
|
if (ioctl(sockfd, SIOCGIFCONF, &ifc) == -1) {
|
1125
1043
|
SAVE_ERRNO(uv__close(sockfd));
|
@@ -1153,7 +1071,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses,
|
|
1153
1071
|
|
1154
1072
|
/* Alloc the return interface structs */
|
1155
1073
|
*addresses = (uv_interface_address_t*)
|
1156
|
-
|
1074
|
+
uv__malloc(*count * sizeof(uv_interface_address_t));
|
1157
1075
|
if (!(*addresses)) {
|
1158
1076
|
uv__close(sockfd);
|
1159
1077
|
return -ENOMEM;
|
@@ -1181,7 +1099,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses,
|
|
1181
1099
|
|
1182
1100
|
/* All conditions above must match count loop */
|
1183
1101
|
|
1184
|
-
address->name =
|
1102
|
+
address->name = uv__strdup(p->ifr_name);
|
1185
1103
|
|
1186
1104
|
if (p->ifr_addr.sa_family == AF_INET6) {
|
1187
1105
|
address->address.address6 = *((struct sockaddr_in6*) &p->ifr_addr);
|
@@ -1208,10 +1126,10 @@ void uv_free_interface_addresses(uv_interface_address_t* addresses,
|
|
1208
1126
|
int i;
|
1209
1127
|
|
1210
1128
|
for (i = 0; i < count; ++i) {
|
1211
|
-
|
1129
|
+
uv__free(addresses[i].name);
|
1212
1130
|
}
|
1213
1131
|
|
1214
|
-
|
1132
|
+
uv__free(addresses);
|
1215
1133
|
}
|
1216
1134
|
|
1217
1135
|
void uv__platform_invalidate_fd(uv_loop_t* loop, int fd) {
|