Merge remote-tracking branch 'joyent/v0.12' into v1.x
I was originally going to do this after the v0.11.15 release, but as that release is three weeks overdue now, I decided not to wait any longer; we don't want the delta to get too big. Conflicts: lib/net.js test/simple/simple.status PR-URL: https://github.com/iojs/io.js/pull/236 Reviewed-By: Bert Belder <bertbelder@gmail.com> Reviewed-By: Fedor Indutny <fedor@indutny.com>
This commit is contained in:
commit
94e147500c
3
.gitignore
vendored
3
.gitignore
vendored
@ -47,6 +47,9 @@ ipch/
|
||||
email.md
|
||||
deps/v8-*
|
||||
deps/icu
|
||||
deps/icu*.zip
|
||||
deps/icu*.tgz
|
||||
deps/icu-tmp
|
||||
./node_modules
|
||||
.svn/
|
||||
|
||||
|
1
AUTHORS
1
AUTHORS
@ -568,3 +568,4 @@ Kevin Simper <kevin.simper@gmail.com>
|
||||
Jackson Tian <shyvo1987@gmail.com>
|
||||
Tristan Berger <tristan.berger@gmail.com>
|
||||
Mathias Schreck <schreck.mathias@googlemail.com>
|
||||
Steven R. Loomis <srloomis@us.ibm.com>
|
||||
|
4
Makefile
4
Makefile
@ -84,10 +84,12 @@ clean:
|
||||
|
||||
distclean:
|
||||
-rm -rf out
|
||||
-rm -f config.gypi
|
||||
-rm -f config.gypi icu_config.gypi
|
||||
-rm -f config.mk
|
||||
-rm -rf $(NODE_EXE) $(NODE_G_EXE) blog.html email.md
|
||||
-rm -rf node_modules
|
||||
-rm -rf deps/icu
|
||||
-rm -rf deps/icu4c*.tgz deps/icu4c*.zip deps/icu-tmp
|
||||
|
||||
test: all
|
||||
$(PYTHON) tools/test.py --mode=release message parallel sequential -J
|
||||
|
91
README.md
91
README.md
@ -99,30 +99,103 @@ make doc
|
||||
man doc/node.1
|
||||
```
|
||||
|
||||
### To build `Intl` (ECMA-402) support:
|
||||
### `Intl` (ECMA-402) support:
|
||||
|
||||
*Note:* more docs, including how to reduce disk footprint, are on
|
||||
[Intl](https://github.com/joyent/node/wiki/Intl) support is not
|
||||
enabled by default.
|
||||
|
||||
#### "small" (English only) support
|
||||
|
||||
This option will build with "small" (English only) support, but
|
||||
the full `Intl` (ECMA-402) APIs. With `--download=all` it will
|
||||
download the ICU library as needed.
|
||||
|
||||
Unix/Macintosh:
|
||||
|
||||
```sh
|
||||
./configure --with-intl=small-icu --download=all
|
||||
```
|
||||
|
||||
Windows:
|
||||
|
||||
```sh
|
||||
vcbuild small-icu download-all
|
||||
```
|
||||
|
||||
The `small-icu` mode builds
|
||||
with English-only data. You can add full data at runtime.
|
||||
|
||||
*Note:* more docs are on
|
||||
[the wiki](https://github.com/joyent/node/wiki/Intl).
|
||||
|
||||
#### Build with full ICU support (all locales supported by ICU):
|
||||
|
||||
With the `--download=all`, this may download ICU if you don't
|
||||
have an ICU in `deps/icu`.
|
||||
|
||||
Unix/Macintosh:
|
||||
|
||||
```sh
|
||||
./configure --with-intl=full-icu --download=all
|
||||
```
|
||||
|
||||
Windows:
|
||||
|
||||
```sh
|
||||
vcbuild full-icu download-all
|
||||
```
|
||||
|
||||
#### Build with no Intl support `:-(`
|
||||
|
||||
The `Intl` object will not be available.
|
||||
This is the default at present, so this option is not normally needed.
|
||||
|
||||
Unix/Macintosh:
|
||||
|
||||
```sh
|
||||
./configure --with-intl=none
|
||||
```
|
||||
|
||||
Windows:
|
||||
|
||||
```sh
|
||||
vcbuild intl-none
|
||||
```
|
||||
|
||||
#### Use existing installed ICU (Unix/Macintosh only):
|
||||
|
||||
```sh
|
||||
pkg-config --modversion icu-i18n && ./configure --with-intl=system-icu
|
||||
```
|
||||
|
||||
#### Build ICU from source:
|
||||
#### Build with a specific ICU:
|
||||
|
||||
First: Unpack latest ICU
|
||||
[icu4c-**##.#**-src.tgz](http://icu-project.org/download) (or `.zip`)
|
||||
as `deps/icu` (You'll have: `deps/icu/source/...`)
|
||||
You can find other ICU releases at
|
||||
[the ICU homepage](http://icu-project.org/download).
|
||||
Download the file named something like `icu4c-**##.#**-src.tgz` (or
|
||||
`.zip`).
|
||||
|
||||
Unix/Macintosh:
|
||||
Unix/Macintosh: from an already-unpacked ICU
|
||||
|
||||
```sh
|
||||
./configure --with-intl=full-icu
|
||||
./configure --with-intl=[small-icu,full-icu] --with-icu-source=/path/to/icu
|
||||
```
|
||||
|
||||
Windows:
|
||||
Unix/Macintosh: from a local ICU tarball
|
||||
|
||||
```sh
|
||||
./configure --with-intl=[small-icu,full-icu] --with-icu-source=/path/to/icu.tgz
|
||||
```
|
||||
|
||||
Unix/Macintosh: from a tarball URL
|
||||
|
||||
```sh
|
||||
./configure --with-intl=full-icu --with-icu-source=http://url/to/icu.tgz
|
||||
```
|
||||
|
||||
Windows: first unpack latest ICU to `deps/icu`
|
||||
[icu4c-**##.#**-src.tgz](http://icu-project.org/download) (or `.zip`)
|
||||
as `deps/icu` (You'll have: `deps/icu/source/...`)
|
||||
|
||||
```sh
|
||||
vcbuild full-icu
|
||||
|
137
configure
vendored
137
configure
vendored
@ -6,6 +6,8 @@ import re
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
import shutil
|
||||
import string
|
||||
|
||||
CC = os.environ.get('CC', 'cc')
|
||||
|
||||
@ -13,6 +15,10 @@ root_dir = os.path.dirname(__file__)
|
||||
sys.path.insert(0, os.path.join(root_dir, 'tools', 'gyp', 'pylib'))
|
||||
from gyp.common import GetFlavor
|
||||
|
||||
# imports in tools/configure.d
|
||||
sys.path.insert(0, os.path.join(root_dir, 'tools', 'configure.d'))
|
||||
import nodedownload
|
||||
|
||||
# parse our options
|
||||
parser = optparse.OptionParser()
|
||||
|
||||
@ -216,16 +222,31 @@ parser.add_option('--with-etw',
|
||||
dest='with_etw',
|
||||
help='build with ETW (default is true on Windows)')
|
||||
|
||||
parser.add_option('--download',
|
||||
action='store',
|
||||
dest='download_list',
|
||||
help=nodedownload.help())
|
||||
|
||||
parser.add_option('--with-icu-path',
|
||||
action='store',
|
||||
dest='with_icu_path',
|
||||
help='Path to icu.gyp (ICU i18n, Chromium version only.)')
|
||||
|
||||
parser.add_option('--with-icu-locales',
|
||||
action='store',
|
||||
dest='with_icu_locales',
|
||||
help='Comma-separated list of locales for "small-icu". Default: "root,en". "root" is assumed.')
|
||||
|
||||
parser.add_option('--with-intl',
|
||||
action='store',
|
||||
dest='with_intl',
|
||||
help='Intl mode: none, full-icu, small-icu (default is none)')
|
||||
|
||||
parser.add_option('--with-icu-source',
|
||||
action='store',
|
||||
dest='with_icu_source',
|
||||
help='Intl mode: optional local path to icu/ dir, or path/URL of icu source archive.')
|
||||
|
||||
parser.add_option('--with-perfctr',
|
||||
action='store_true',
|
||||
dest='with_perfctr',
|
||||
@ -274,6 +295,8 @@ parser.add_option('--xcode',
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
# set up auto-download list
|
||||
auto_downloads = nodedownload.parse(options.download_list)
|
||||
|
||||
def b(value):
|
||||
"""Returns the string 'true' if value is truthy, 'false' otherwise."""
|
||||
@ -632,6 +655,35 @@ def glob_to_var(dir_base, dir_sub):
|
||||
return list
|
||||
|
||||
def configure_intl(o):
|
||||
icus = [
|
||||
{
|
||||
'url': 'http://download.icu-project.org/files/icu4c/54.1/icu4c-54_1-src.zip',
|
||||
# from https://ssl.icu-project.org/files/icu4c/54.1/icu4c-src-54_1.md5:
|
||||
'md5': '6b89d60e2f0e140898ae4d7f72323bca',
|
||||
},
|
||||
]
|
||||
def icu_download(path):
|
||||
# download ICU, if needed
|
||||
for icu in icus:
|
||||
url = icu['url']
|
||||
md5 = icu['md5']
|
||||
local = url.split('/')[-1]
|
||||
targetfile = os.path.join(root_dir, 'deps', local)
|
||||
if not os.path.isfile(targetfile):
|
||||
if nodedownload.candownload(auto_downloads, "icu"):
|
||||
nodedownload.retrievefile(url, targetfile)
|
||||
else:
|
||||
print ' Re-using existing %s' % targetfile
|
||||
if os.path.isfile(targetfile):
|
||||
sys.stdout.write(' Checking file integrity with MD5:\r')
|
||||
gotmd5 = nodedownload.md5sum(targetfile)
|
||||
print ' MD5: %s %s' % (gotmd5, targetfile)
|
||||
if (md5 == gotmd5):
|
||||
return targetfile
|
||||
else:
|
||||
print ' Expected: %s *MISMATCH*' % md5
|
||||
print '\n ** Corrupted ZIP? Delete %s to retry download.\n' % targetfile
|
||||
return None
|
||||
icu_config = {
|
||||
'variables': {}
|
||||
}
|
||||
@ -643,11 +695,11 @@ def configure_intl(o):
|
||||
write(icu_config_name, do_not_edit +
|
||||
pprint.pformat(icu_config, indent=2) + '\n')
|
||||
|
||||
# small ICU is off by default.
|
||||
# always set icu_small, node.gyp depends on it being defined.
|
||||
o['variables']['icu_small'] = b(False)
|
||||
|
||||
with_intl = options.with_intl
|
||||
with_icu_source = options.with_icu_source
|
||||
have_icu_path = bool(options.with_icu_path)
|
||||
if have_icu_path and with_intl:
|
||||
print 'Error: Cannot specify both --with-icu-path and --with-intl'
|
||||
@ -659,6 +711,13 @@ def configure_intl(o):
|
||||
o['variables']['icu_gyp_path'] = options.with_icu_path
|
||||
return
|
||||
# --with-intl=<with_intl>
|
||||
# set the default
|
||||
if with_intl is None:
|
||||
with_intl = 'none' # The default mode of Intl
|
||||
# sanity check localelist
|
||||
if options.with_icu_locales and (with_intl != 'small-icu'):
|
||||
print 'Error: --with-icu-locales only makes sense with --with-intl=small-icu'
|
||||
sys.exit(1)
|
||||
if with_intl == 'none' or with_intl is None:
|
||||
o['variables']['v8_enable_i18n_support'] = 0
|
||||
return # no Intl
|
||||
@ -666,6 +725,12 @@ def configure_intl(o):
|
||||
# small ICU (English only)
|
||||
o['variables']['v8_enable_i18n_support'] = 1
|
||||
o['variables']['icu_small'] = b(True)
|
||||
with_icu_locales = options.with_icu_locales
|
||||
if not with_icu_locales:
|
||||
with_icu_locales = 'root,en'
|
||||
locs = set(with_icu_locales.split(','))
|
||||
locs.add('root') # must have root
|
||||
o['variables']['icu_locales'] = string.join(locs,',')
|
||||
elif with_intl == 'full-icu':
|
||||
# full ICU
|
||||
o['variables']['v8_enable_i18n_support'] = 1
|
||||
@ -689,20 +754,78 @@ def configure_intl(o):
|
||||
# Note: non-ICU implementations could use other 'with_intl'
|
||||
# values.
|
||||
|
||||
# this is just the 'deps' dir. Used for unpacking.
|
||||
icu_parent_path = os.path.join(root_dir, 'deps')
|
||||
|
||||
# The full path to the ICU source directory.
|
||||
icu_full_path = os.path.join(icu_parent_path, 'icu')
|
||||
|
||||
# icu-tmp is used to download and unpack the ICU tarball.
|
||||
icu_tmp_path = os.path.join(icu_parent_path, 'icu-tmp')
|
||||
|
||||
# --with-icu-source processing
|
||||
# first, check that they didn't pass --with-icu-source=deps/icu
|
||||
if with_icu_source and os.path.abspath(icu_full_path) == os.path.abspath(with_icu_source):
|
||||
print 'Ignoring redundant --with-icu-source=%s' % (with_icu_source)
|
||||
with_icu_source = None
|
||||
# if with_icu_source is still set, try to use it.
|
||||
if with_icu_source:
|
||||
if os.path.isdir(icu_full_path):
|
||||
print 'Deleting old ICU source: %s' % (icu_full_path)
|
||||
shutil.rmtree(icu_full_path)
|
||||
# now, what path was given?
|
||||
if os.path.isdir(with_icu_source):
|
||||
# it's a path. Copy it.
|
||||
print '%s -> %s' % (with_icu_source, icu_full_path)
|
||||
shutil.copytree(with_icu_source, icu_full_path)
|
||||
else:
|
||||
# could be file or URL.
|
||||
# Set up temporary area
|
||||
if os.path.isdir(icu_tmp_path):
|
||||
shutil.rmtree(icu_tmp_path)
|
||||
os.mkdir(icu_tmp_path)
|
||||
icu_tarball = None
|
||||
if os.path.isfile(with_icu_source):
|
||||
# it's a file. Try to unpack it.
|
||||
icu_tarball = with_icu_source
|
||||
else:
|
||||
# Can we download it?
|
||||
local = os.path.join(icu_tmp_path, with_icu_source.split('/')[-1]) # local part
|
||||
icu_tarball = nodedownload.retrievefile(with_icu_source, local)
|
||||
# continue with "icu_tarball"
|
||||
nodedownload.unpack(icu_tarball, icu_tmp_path)
|
||||
# Did it unpack correctly? Should contain 'icu'
|
||||
tmp_icu = os.path.join(icu_tmp_path, 'icu')
|
||||
if os.path.isdir(tmp_icu):
|
||||
os.rename(tmp_icu, icu_full_path)
|
||||
shutil.rmtree(icu_tmp_path)
|
||||
else:
|
||||
print ' Error: --with-icu-source=%s did not result in an "icu" dir.' % with_icu_source
|
||||
shutil.rmtree(icu_tmp_path)
|
||||
sys.exit(1)
|
||||
|
||||
# ICU mode. (icu-generic.gyp)
|
||||
byteorder = sys.byteorder
|
||||
o['variables']['icu_gyp_path'] = 'tools/icu/icu-generic.gyp'
|
||||
# ICU source dir relative to root
|
||||
icu_full_path = os.path.join(root_dir, 'deps/icu')
|
||||
o['variables']['icu_path'] = icu_full_path
|
||||
if not os.path.isdir(icu_full_path):
|
||||
print 'Error: ICU path is not a directory: %s' % (icu_full_path)
|
||||
print '* ECMA-402 (Intl) support didn\'t find ICU in %s..' % (icu_full_path)
|
||||
# can we download (or find) a zipfile?
|
||||
localzip = icu_download(icu_full_path)
|
||||
if localzip:
|
||||
nodedownload.unpack(localzip, icu_parent_path)
|
||||
if not os.path.isdir(icu_full_path):
|
||||
print ' Cannot build Intl without ICU in %s.' % (icu_full_path)
|
||||
print ' (Fix, or disable with "--with-intl=none" )'
|
||||
sys.exit(1)
|
||||
else:
|
||||
print '* Using ICU in %s' % (icu_full_path)
|
||||
# Now, what version of ICU is it? We just need the "major", such as 54.
|
||||
# uvernum.h contains it as a #define.
|
||||
uvernum_h = os.path.join(icu_full_path, 'source/common/unicode/uvernum.h')
|
||||
if not os.path.isfile(uvernum_h):
|
||||
print 'Error: could not load %s - is ICU installed?' % uvernum_h
|
||||
print ' Error: could not load %s - is ICU installed?' % uvernum_h
|
||||
sys.exit(1)
|
||||
icu_ver_major = None
|
||||
matchVerExp = r'^\s*#define\s+U_ICU_VERSION_SHORT\s+"([^"]*)".*'
|
||||
@ -712,7 +835,7 @@ def configure_intl(o):
|
||||
if m:
|
||||
icu_ver_major = m.group(1)
|
||||
if not icu_ver_major:
|
||||
print 'Could not read U_ICU_VERSION_SHORT version from %s' % uvernum_h
|
||||
print ' Could not read U_ICU_VERSION_SHORT version from %s' % uvernum_h
|
||||
sys.exit(1)
|
||||
icu_endianness = sys.byteorder[0]; # TODO(srl295): EBCDIC should be 'e'
|
||||
o['variables']['icu_ver_major'] = icu_ver_major
|
||||
@ -739,8 +862,8 @@ def configure_intl(o):
|
||||
# this is the icudt*.dat file which node will be using (platform endianness)
|
||||
o['variables']['icu_data_file'] = icu_data_file
|
||||
if not os.path.isfile(icu_data_path):
|
||||
print 'Error: ICU prebuilt data file %s does not exist.' % icu_data_path
|
||||
print 'See the README.md.'
|
||||
print ' Error: ICU prebuilt data file %s does not exist.' % icu_data_path
|
||||
print ' See the README.md.'
|
||||
# .. and we're not about to build it from .gyp!
|
||||
sys.exit(1)
|
||||
# map from variable name to subdirs
|
||||
|
6
deps/uv/AUTHORS
vendored
6
deps/uv/AUTHORS
vendored
@ -86,9 +86,7 @@ Nicholas Vavilov <vvnicholas@gmail.com>
|
||||
Miroslav Bajtoš <miro.bajtos@gmail.com>
|
||||
Sean Silva <chisophugis@gmail.com>
|
||||
Wynn Wilkes <wynnw@movenetworks.com>
|
||||
Linus Mårtensson <linus.martensson@sonymobile.com>
|
||||
Andrei Sedoi <bsnote@gmail.com>
|
||||
Navaneeth Kedaram Nambiathan <navaneethkn@gmail.com>
|
||||
Alex Crichton <alex@alexcrichton.com>
|
||||
Brent Cook <brent@boundary.com>
|
||||
Brian Kaisner <bkize1@gmail.com>
|
||||
@ -110,7 +108,6 @@ Yazhong Liu <yorkiefixer@gmail.com>
|
||||
Sam Roberts <vieuxtech@gmail.com>
|
||||
River Tarnell <river@loreley.flyingparchment.org.uk>
|
||||
Nathan Sweet <nathanjsweet@gmail.com>
|
||||
Luca Bruno <lucab@debian.org>
|
||||
Trevor Norris <trev.norris@gmail.com>
|
||||
Oguz Bastemur <obastemur@gmail.com>
|
||||
Dylan Cali <calid1984@gmail.com>
|
||||
@ -173,3 +170,6 @@ Yuri D'Elia <yuri.delia@eurac.edu>
|
||||
Manos Nikolaidis <manos@shadowrobot.com>
|
||||
Elijah Andrews <elijah@busbud.com>
|
||||
Michael Ira Krufky <m.krufky@samsung.com>
|
||||
Helge Deller <deller@gmx.de>
|
||||
Joey Geralnik <jgeralnik@gmail.com>
|
||||
Tim Caswell <tim@creationix.com>
|
||||
|
89
deps/uv/ChangeLog
vendored
89
deps/uv/ChangeLog
vendored
@ -1,3 +1,67 @@
|
||||
2014.12.10, Version 1.0.2 (Stable), eec671f0059953505f9a3c9aeb7f9f31466dd7cd
|
||||
|
||||
Changes since version 1.0.1:
|
||||
|
||||
* linux: fix sigmask size arg in epoll_pwait() call (Ben Noordhuis)
|
||||
|
||||
* linux: handle O_NONBLOCK != SOCK_NONBLOCK case (Helge Deller)
|
||||
|
||||
* doc: fix spelling (Joey Geralnik)
|
||||
|
||||
* unix, windows: fix typos in comments (Joey Geralnik)
|
||||
|
||||
* test: canonicalize test runner path (Ben Noordhuis)
|
||||
|
||||
* test: fix compilation warnings (Saúl Ibarra Corretgé)
|
||||
|
||||
* test: skip tty test if detected width and height are 0 (Saúl Ibarra Corretgé)
|
||||
|
||||
* doc: update README with IRC channel (Saúl Ibarra Corretgé)
|
||||
|
||||
* Revert "unix: use cfmakeraw() for setting raw TTY mode" (Ben Noordhuis)
|
||||
|
||||
* doc: document how to get result of uv_fs_mkdtemp (Tim Caswell)
|
||||
|
||||
* unix: add flag for blocking SIGPROF during poll (Ben Noordhuis)
|
||||
|
||||
* unix, windows: add uv_loop_configure() function (Ben Noordhuis)
|
||||
|
||||
* win: keep a reference to AFD_POLL_INFO in cancel poll (Marc Schlaich)
|
||||
|
||||
* test: raise fd limit for OSX select test (Saúl Ibarra Corretgé)
|
||||
|
||||
* unix: remove overzealous assert in uv_read_stop (Saúl Ibarra Corretgé)
|
||||
|
||||
* unix: reset the reading flag when a stream gets EOF (Saúl Ibarra Corretgé)
|
||||
|
||||
* unix: stop reading if an error is produced (Saúl Ibarra Corretgé)
|
||||
|
||||
* cleanup: remove all dead assignments (Maciej Małecki)
|
||||
|
||||
* linux: return early if we have no interfaces (Maciej Małecki)
|
||||
|
||||
* cleanup: remove a dead increment (Maciej Małecki)
|
||||
|
||||
|
||||
2014.12.10, Version 0.10.30 (Stable), 5a63f5e9546dca482eeebc3054139b21f509f21f
|
||||
|
||||
Changes since version 0.10.29:
|
||||
|
||||
* linux: fix sigmask size arg in epoll_pwait() call (Ben Noordhuis)
|
||||
|
||||
* linux: handle O_NONBLOCK != SOCK_NONBLOCK case (Helge Deller)
|
||||
|
||||
* doc: update project links (Ben Noordhuis)
|
||||
|
||||
* windows: fix compilation of tests (Marc Schlaich)
|
||||
|
||||
* unix: add flag for blocking SIGPROF during poll (Ben Noordhuis)
|
||||
|
||||
* unix, windows: add uv_loop_configure() function (Ben Noordhuis)
|
||||
|
||||
* win: keep a reference to AFD_POLL_INFO in cancel poll (Marc Schlaich)
|
||||
|
||||
|
||||
2014.11.27, Version 1.0.1 (Stable), 0a8e81374e861d425b56c45c8599595d848911d2
|
||||
|
||||
Changes since version 1.0.0:
|
||||
@ -85,6 +149,17 @@ Changes since version 1.0.0-rc1:
|
||||
* windows: fix fs_write with nbufs > 1 and offset (Unknown W. Brackets)
|
||||
|
||||
|
||||
2014.10.21, Version 0.10.29 (Stable), 2d728542d3790183417f8f122a110693cd85db14
|
||||
|
||||
Changes since version 0.10.28:
|
||||
|
||||
* darwin: allocate enough space for select() hack (Fedor Indutny)
|
||||
|
||||
* linux: try epoll_pwait if epoll_wait is missing (Michael Hudson-Doyle)
|
||||
|
||||
* windows: map ERROR_INVALID_DRIVE to UV_ENOENT (Saúl Ibarra Corretgé)
|
||||
|
||||
|
||||
2014.09.18, Version 1.0.0-rc1 (Unstable), 0c28bbf7b42882853d1799ab96ff68b07f7f8d49
|
||||
|
||||
Changes since version 0.11.29:
|
||||
@ -273,6 +348,20 @@ Changes since version 0.11.26:
|
||||
* windows: relay TCP bind errors via ipc (Alexis Campailla)
|
||||
|
||||
|
||||
2014.07.32, Version 0.10.28 (Stable), 9c14b616f5fb84bfd7d45707bab4bbb85894443e
|
||||
|
||||
Changes since version 0.10.27:
|
||||
|
||||
* windows: fix handling closed socket while poll handle is closing (Saúl Ibarra
|
||||
Corretgé)
|
||||
|
||||
* unix: return system error on EAI_SYSTEM (Saúl Ibarra Corretgé)
|
||||
|
||||
* unix: fix bogus structure field name (Saúl Ibarra Corretgé)
|
||||
|
||||
* darwin: invoke `mach_timebase_info` only once (Fedor Indutny)
|
||||
|
||||
|
||||
2014.06.28, Version 0.11.26 (Unstable), 115281a1058c4034d5c5ccedacb667fe3f6327ea
|
||||
|
||||
Changes since version 0.11.25:
|
||||
|
3
deps/uv/README.md
vendored
3
deps/uv/README.md
vendored
@ -36,12 +36,13 @@ used by [Luvit](http://luvit.io/), [Julia](http://julialang.org/),
|
||||
## Versioning
|
||||
|
||||
Starting with version 1.0.0 libuv follows the [semantic versioning](http://semver.org/)
|
||||
scheme. The API change and backwards compatiblity rules are those indicated by
|
||||
scheme. The API change and backwards compatibility rules are those indicated by
|
||||
SemVer. libuv will keep a stable ABI across major releases.
|
||||
|
||||
## Community
|
||||
|
||||
* [Mailing list](http://groups.google.com/group/libuv)
|
||||
* [IRC chatroom (#libuv@irc.freenode.org)](http://webchat.freenode.net?channels=libuv&uio=d4)
|
||||
|
||||
## Documentation
|
||||
|
||||
|
2
deps/uv/configure.ac
vendored
2
deps/uv/configure.ac
vendored
@ -13,7 +13,7 @@
|
||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
AC_PREREQ(2.57)
|
||||
AC_INIT([libuv], [1.0.1], [https://github.com/libuv/libuv/issues])
|
||||
AC_INIT([libuv], [1.0.2], [https://github.com/libuv/libuv/issues])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
m4_include([m4/libuv-extra-automake-flags.m4])
|
||||
m4_include([m4/as_case.m4])
|
||||
|
2
deps/uv/docs/src/conf.py
vendored
2
deps/uv/docs/src/conf.py
vendored
@ -261,7 +261,7 @@ man_pages = [
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
('index', 'libuv', u'libuv API documentation',
|
||||
u'libuv contributors', 'libuv', 'Cross-platform asychronous I/O',
|
||||
u'libuv contributors', 'libuv', 'Cross-platform asynchronous I/O',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
|
6
deps/uv/docs/src/design.rst
vendored
6
deps/uv/docs/src/design.rst
vendored
@ -8,7 +8,7 @@ libuv is cross-platform support library which was originally written for NodeJS.
|
||||
around the event-driven asynchronous I/O model.
|
||||
|
||||
The library provides much more than simply abstraction over different I/O polling mechanisms:
|
||||
'handles' and 'streams' provde a high level abstraction for sockets and other entities;
|
||||
'handles' and 'streams' provide a high level abstraction for sockets and other entities;
|
||||
cross-platform file I/O and threading functionality is also provided, amongst other things.
|
||||
|
||||
Here is a diagram illustrating the different parts that compose libuv and what subsystem they
|
||||
@ -42,7 +42,7 @@ operations, and it's meant to be tied to a single thread. One can run multiple e
|
||||
as long as each runs in a different thread. The libuv event loop (or any other API involving
|
||||
the loop or handles, for that matter) **is not thread-safe** except stated otherwise.
|
||||
|
||||
The event loop follows the rather usual single threaded asynchronous I/O approah: all (network)
|
||||
The event loop follows the rather usual single threaded asynchronous I/O approach: all (network)
|
||||
I/O is performed on non-blocking sockets which are polled using the best mechanism available
|
||||
on the given platform: epoll on Linux, kqueue on OSX and other BSDs, event ports on SunOS and IOCP
|
||||
on Windows. As part of a loop iteration the loop will block waiting for I/O activity on sockets
|
||||
@ -104,7 +104,7 @@ stages of a loop iteration:
|
||||
|
||||
#. Iteration ends. If the loop was run with ``UV_RUN_NOWAIT`` or ``UV_RUN_ONCE`` modes the
|
||||
iteration is ended and :c:func:`uv_run` will return. If the loop was run with ``UV_RUN_DEFAULT``
|
||||
it will contionue from the start if it's asill *alive*, otherwise it will also end.
|
||||
it will continue from the start if it's still *alive*, otherwise it will also end.
|
||||
|
||||
|
||||
.. important::
|
||||
|
2
deps/uv/docs/src/dll.rst
vendored
2
deps/uv/docs/src/dll.rst
vendored
@ -4,7 +4,7 @@
|
||||
Shared library handling
|
||||
=======================
|
||||
|
||||
libuv prodives cross platform utilities for loading shared libraries and
|
||||
libuv provides cross platform utilities for loading shared libraries and
|
||||
retrieving symbols from them, using the following API.
|
||||
|
||||
|
||||
|
5
deps/uv/docs/src/fs.rst
vendored
5
deps/uv/docs/src/fs.rst
vendored
@ -191,6 +191,9 @@ API
|
||||
|
||||
Equivalent to ``mkdtemp(3)``.
|
||||
|
||||
.. note::
|
||||
The result can be found as a null terminated string at `req->path`.
|
||||
|
||||
.. c:function:: int uv_fs_rmdir(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb)
|
||||
|
||||
Equivalent to ``rmdir(2)``.
|
||||
@ -258,7 +261,7 @@ API
|
||||
* ``UV_FS_SYMLINK_DIR``: indicates that `path` points to a directory.
|
||||
|
||||
* ``UV_FS_SYMLINK_JUNCTION``: request that the symlink is created
|
||||
using junktion points.
|
||||
using junction points.
|
||||
|
||||
.. c:function:: int uv_fs_readlink(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb)
|
||||
|
||||
|
2
deps/uv/docs/src/fs_event.rst
vendored
2
deps/uv/docs/src/fs_event.rst
vendored
@ -95,7 +95,7 @@ API
|
||||
|
||||
Get the path being monitored by the handle. The buffer must be preallocated
|
||||
by the user. Returns 0 on success or an error code < 0 in case of failure.
|
||||
On sucess, `buf` will contain the path and `len` its length. If the buffer
|
||||
On success, `buf` will contain the path and `len` its length. If the buffer
|
||||
is not big enough UV_ENOBUFS will be returned and len will be set to the
|
||||
required size.
|
||||
|
||||
|
2
deps/uv/docs/src/fs_poll.rst
vendored
2
deps/uv/docs/src/fs_poll.rst
vendored
@ -62,7 +62,7 @@ API
|
||||
|
||||
Get the path being monitored by the handle. The buffer must be preallocated
|
||||
by the user. Returns 0 on success or an error code < 0 in case of failure.
|
||||
On sucess, `buf` will contain the path and `len` its length. If the buffer
|
||||
On success, `buf` will contain the path and `len` its length. If the buffer
|
||||
is not big enough UV_ENOBUFS will be returned and len will be set to the
|
||||
required size.
|
||||
|
||||
|
19
deps/uv/docs/src/loop.rst
vendored
19
deps/uv/docs/src/loop.rst
vendored
@ -50,6 +50,23 @@ API
|
||||
|
||||
Initializes the given `uv_loop_t` structure.
|
||||
|
||||
.. c:function:: int uv_loop_configure(uv_loop_t* loop, uv_loop_option option, ...)
|
||||
|
||||
Set additional loop options. You should normally call this before the
|
||||
first call to :c:func:`uv_run` unless mentioned otherwise.
|
||||
|
||||
Returns 0 on success or a UV_E* error code on failure. Be prepared to
|
||||
handle UV_ENOSYS; it means the loop option is not supported by the platform.
|
||||
|
||||
Supported options:
|
||||
|
||||
- UV_LOOP_BLOCK_SIGNAL: Block a signal when polling for new events. The
|
||||
second argument to :c:func:`uv_loop_configure` is the signal number.
|
||||
|
||||
This operation is currently only implemented for SIGPROF signals,
|
||||
to suppress unnecessary wakeups when using a sampling profiler.
|
||||
Requesting other signals will fail with UV_EINVAL.
|
||||
|
||||
.. c:function:: int uv_loop_close(uv_loop_t* loop)
|
||||
|
||||
Closes all internal loop resources. This function must only be called once
|
||||
@ -59,7 +76,7 @@ API
|
||||
.. c:function:: uv_loop_t* uv_default_loop(void)
|
||||
|
||||
Returns the initialized default loop. It may return NULL in case of
|
||||
allocation failture.
|
||||
allocation failure.
|
||||
|
||||
.. c:function:: int uv_run(uv_loop_t* loop, uv_run_mode mode)
|
||||
|
||||
|
8
deps/uv/docs/src/migration_010_100.rst
vendored
8
deps/uv/docs/src/migration_010_100.rst
vendored
@ -80,7 +80,7 @@ In libuv 0.10 Unix used a threadpool which defaulted to 4 threads, while Windows
|
||||
threads per process.
|
||||
|
||||
In 1.0, we unified both implementations, so Windows now uses the same implementation Unix
|
||||
does. The threadppol size can be set by exporting the ``UV_THREADPOOL_SIZE`` environment
|
||||
does. The threadpool size can be set by exporting the ``UV_THREADPOOL_SIZE`` environment
|
||||
variable. See :c:ref:`threadpool`.
|
||||
|
||||
|
||||
@ -95,7 +95,7 @@ In libuv 0.10 the callback had to return a filled :c:type:`uv_buf_t` by value:
|
||||
return uv_buf_init(malloc(size), size);
|
||||
}
|
||||
|
||||
In libuv 1.0 a pointer to a buffer is passed to the callbck, which the user
|
||||
In libuv 1.0 a pointer to a buffer is passed to the callback, which the user
|
||||
needs to fill:
|
||||
|
||||
::
|
||||
@ -200,7 +200,7 @@ for such function looked like this:
|
||||
...
|
||||
}
|
||||
|
||||
In libuv 1.0, `uv_read2_start` was removed, and the user needs to check if there are penging
|
||||
In libuv 1.0, `uv_read2_start` was removed, and the user needs to check if there are pending
|
||||
handles using :c:func:`uv_pipe_pending_count` and :c:func:`uv_pipe_pending_type` while in
|
||||
the read callback:
|
||||
|
||||
@ -222,7 +222,7 @@ Extracting the file descriptor out of a handle
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
While it wasn't supported by the API, users often accessed the libuv internals in
|
||||
order to get access to the file descript of a TCP handle, for example.
|
||||
order to get access to the file descriptor of a TCP handle, for example.
|
||||
|
||||
::
|
||||
|
||||
|
8
deps/uv/docs/src/misc.rst
vendored
8
deps/uv/docs/src/misc.rst
vendored
@ -1,10 +1,10 @@
|
||||
|
||||
.. _misc:
|
||||
|
||||
Miscelaneous utilities
|
||||
Miscellaneous utilities
|
||||
======================
|
||||
|
||||
This section contains miscelaneous functions that don't really belong in any
|
||||
This section contains miscellaneous functions that don't really belong in any
|
||||
other section.
|
||||
|
||||
|
||||
@ -186,11 +186,11 @@ API
|
||||
|
||||
.. c:function:: int uv_ip4_name(const struct sockaddr_in* src, char* dst, size_t size)
|
||||
|
||||
Convert a binary structure containing an IPv4 addres to a string.
|
||||
Convert a binary structure containing an IPv4 address to a string.
|
||||
|
||||
.. c:function:: int uv_ip6_name(const struct sockaddr_in6* src, char* dst, size_t size)
|
||||
|
||||
Convert a binary structure containing an IPv6 addres to a string.
|
||||
Convert a binary structure containing an IPv6 address to a string.
|
||||
|
||||
.. c:function:: int uv_inet_ntop(int af, const void* src, char* dst, size_t size)
|
||||
.. c:function:: int uv_inet_pton(int af, const char* src, void* dst)
|
||||
|
2
deps/uv/docs/src/pipe.rst
vendored
2
deps/uv/docs/src/pipe.rst
vendored
@ -39,7 +39,7 @@ API
|
||||
Open an existing file descriptor or HANDLE as a pipe.
|
||||
|
||||
.. note::
|
||||
The user is responsible for setting the dile descriptor in non-blocking mode.
|
||||
The user is responsible for setting the file descriptor in non-blocking mode.
|
||||
|
||||
.. c:function:: int uv_pipe_bind(uv_pipe_t* handle, const char* name)
|
||||
|
||||
|
4
deps/uv/docs/src/stream.rst
vendored
4
deps/uv/docs/src/stream.rst
vendored
@ -62,7 +62,7 @@ Data types
|
||||
|
||||
Callback called when a stream server has received an incoming connection.
|
||||
The user can accept the connection by calling :c:func:`uv_accept`.
|
||||
`status` will de 0 in case of success, < 0 otherwise.
|
||||
`status` will be 0 in case of success, < 0 otherwise.
|
||||
|
||||
|
||||
Public members
|
||||
@ -200,7 +200,7 @@ API
|
||||
When blocking mode is enabled all writes complete synchronously. The
|
||||
interface remains unchanged otherwise, e.g. completion or failure of the
|
||||
operation will still be reported through a callback which is made
|
||||
asychronously.
|
||||
asynchronously.
|
||||
|
||||
.. warning::
|
||||
Relying too much on this API is not recommended. It is likely to change
|
||||
|
2
deps/uv/docs/src/threadpool.rst
vendored
2
deps/uv/docs/src/threadpool.rst
vendored
@ -5,7 +5,7 @@ Thread pool work scheduling
|
||||
===========================
|
||||
|
||||
libuv provides a threadpool which can be used to run user code and get notified
|
||||
in the loop thread. This thread pool is internally used to run al filesystem
|
||||
in the loop thread. This thread pool is internally used to run all filesystem
|
||||
operations, as well as getaddrinfo and getnameinfo requests.
|
||||
|
||||
Its default size is 4, but it can be changed at startup time by setting the
|
||||
|
2
deps/uv/include/uv-version.h
vendored
2
deps/uv/include/uv-version.h
vendored
@ -32,7 +32,7 @@
|
||||
|
||||
#define UV_VERSION_MAJOR 1
|
||||
#define UV_VERSION_MINOR 0
|
||||
#define UV_VERSION_PATCH 1
|
||||
#define UV_VERSION_PATCH 2
|
||||
#define UV_VERSION_IS_RELEASE 1
|
||||
#define UV_VERSION_SUFFIX ""
|
||||
|
||||
|
5
deps/uv/include/uv-win.h
vendored
5
deps/uv/include/uv-win.h
vendored
@ -517,7 +517,10 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
|
||||
/* Used in fast mode */ \
|
||||
SOCKET peer_socket; \
|
||||
AFD_POLL_INFO afd_poll_info_1; \
|
||||
AFD_POLL_INFO afd_poll_info_2; \
|
||||
union { \
|
||||
AFD_POLL_INFO* afd_poll_info_ptr; \
|
||||
AFD_POLL_INFO afd_poll_info; \
|
||||
} afd_poll_info_2; \
|
||||
/* Used in fast and slow mode. */ \
|
||||
uv_req_t poll_req_1; \
|
||||
uv_req_t poll_req_2; \
|
||||
|
4
deps/uv/include/uv.h
vendored
4
deps/uv/include/uv.h
vendored
@ -229,6 +229,9 @@ typedef struct uv_cpu_info_s uv_cpu_info_t;
|
||||
typedef struct uv_interface_address_s uv_interface_address_t;
|
||||
typedef struct uv_dirent_s uv_dirent_t;
|
||||
|
||||
typedef enum {
|
||||
UV_LOOP_BLOCK_SIGNAL
|
||||
} uv_loop_option;
|
||||
|
||||
typedef enum {
|
||||
UV_RUN_DEFAULT = 0,
|
||||
@ -257,6 +260,7 @@ UV_EXTERN uv_loop_t* uv_loop_new(void);
|
||||
UV_EXTERN void uv_loop_delete(uv_loop_t*);
|
||||
UV_EXTERN size_t uv_loop_size(void);
|
||||
UV_EXTERN int uv_loop_alive(const uv_loop_t* loop);
|
||||
UV_EXTERN int uv_loop_configure(uv_loop_t* loop, uv_loop_option option, ...);
|
||||
|
||||
UV_EXTERN int uv_run(uv_loop_t*, uv_run_mode mode);
|
||||
UV_EXTERN void uv_stop(uv_loop_t*);
|
||||
|
4
deps/uv/src/unix/aix.c
vendored
4
deps/uv/src/unix/aix.c
vendored
@ -151,7 +151,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
|
||||
* Could maybe mod if we knew for sure no events are removed, but
|
||||
* content of w->events is handled above as not reliable (falls back)
|
||||
* so may require a pollset_query() which would have to be pretty cheap
|
||||
* compared to a PS_DELETE to be worth optimising. Alternatively, could
|
||||
* compared to a PS_DELETE to be worth optimizing. Alternatively, could
|
||||
* lazily remove events, squelching them in the mean time. */
|
||||
pc.cmd = PS_DELETE;
|
||||
if (pollset_ctl(loop->backend_fd, &pc, 1)) {
|
||||
@ -332,7 +332,7 @@ int uv_exepath(char* buffer, size_t* size) {
|
||||
res = readlink(symlink, temp_buffer, PATH_MAX-1);
|
||||
|
||||
/* if readlink fails, it is a normal file just copy symlink to the
|
||||
* outbut buffer.
|
||||
* output buffer.
|
||||
*/
|
||||
if (res < 0) {
|
||||
assert(*size > strlen(symlink));
|
||||
|
2
deps/uv/src/unix/core.c
vendored
2
deps/uv/src/unix/core.c
vendored
@ -325,7 +325,7 @@ int uv_run(uv_loop_t* loop, uv_run_mode mode) {
|
||||
uv__run_closing_handles(loop);
|
||||
|
||||
if (mode == UV_RUN_ONCE) {
|
||||
/* UV_RUN_ONCE implies forward progess: at least one callback must have
|
||||
/* UV_RUN_ONCE implies forward progress: at least one callback must have
|
||||
* been invoked when it returns. uv__io_poll() can return without doing
|
||||
* I/O (meaning: no callbacks) when its timeout expires - which means we
|
||||
* have pending timers that satisfy the forward progress constraint.
|
||||
|
4
deps/uv/src/unix/getaddrinfo.c
vendored
4
deps/uv/src/unix/getaddrinfo.c
vendored
@ -182,10 +182,8 @@ int uv_getaddrinfo(uv_loop_t* loop,
|
||||
len += service_len;
|
||||
}
|
||||
|
||||
if (hostname) {
|
||||
if (hostname)
|
||||
req->hostname = memcpy(buf + len, hostname, hostname_len);
|
||||
len += hostname_len;
|
||||
}
|
||||
|
||||
uv__work_submit(loop,
|
||||
&req->work_req,
|
||||
|
5
deps/uv/src/unix/internal.h
vendored
5
deps/uv/src/unix/internal.h
vendored
@ -146,6 +146,11 @@ enum {
|
||||
UV_HANDLE_IPV6 = 0x10000 /* Handle is bound to a IPv6 socket. */
|
||||
};
|
||||
|
||||
/* loop flags */
|
||||
enum {
|
||||
UV_LOOP_BLOCK_SIGPROF = 1
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
UV_CLOCK_PRECISE = 0, /* Use the highest resolution clock available. */
|
||||
UV_CLOCK_FAST = 1 /* Use the fastest clock with <= 1ms granularity. */
|
||||
|
17
deps/uv/src/unix/kqueue.c
vendored
17
deps/uv/src/unix/kqueue.c
vendored
@ -55,9 +55,11 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
|
||||
unsigned int nevents;
|
||||
unsigned int revents;
|
||||
QUEUE* q;
|
||||
uv__io_t* w;
|
||||
sigset_t* pset;
|
||||
sigset_t set;
|
||||
uint64_t base;
|
||||
uint64_t diff;
|
||||
uv__io_t* w;
|
||||
int filter;
|
||||
int fflags;
|
||||
int count;
|
||||
@ -117,6 +119,13 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
|
||||
w->events = w->pevents;
|
||||
}
|
||||
|
||||
pset = NULL;
|
||||
if (loop->flags & UV_LOOP_BLOCK_SIGPROF) {
|
||||
pset = &set;
|
||||
sigemptyset(pset);
|
||||
sigaddset(pset, SIGPROF);
|
||||
}
|
||||
|
||||
assert(timeout >= -1);
|
||||
base = loop->time;
|
||||
count = 48; /* Benchmarks suggest this gives the best throughput. */
|
||||
@ -127,6 +136,9 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
|
||||
spec.tv_nsec = (timeout % 1000) * 1000000;
|
||||
}
|
||||
|
||||
if (pset != NULL)
|
||||
pthread_sigmask(SIG_BLOCK, pset, NULL);
|
||||
|
||||
nfds = kevent(loop->backend_fd,
|
||||
events,
|
||||
nevents,
|
||||
@ -134,6 +146,9 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
|
||||
ARRAY_SIZE(events),
|
||||
timeout == -1 ? NULL : &spec);
|
||||
|
||||
if (pset != NULL)
|
||||
pthread_sigmask(SIG_UNBLOCK, pset, NULL);
|
||||
|
||||
/* Update loop->time unconditionally. It's tempting to skip the update when
|
||||
* timeout == 0 (i.e. non-blocking poll) but there is no guarantee that the
|
||||
* operating system didn't reschedule our process while in the syscall.
|
||||
|
28
deps/uv/src/unix/linux-core.c
vendored
28
deps/uv/src/unix/linux-core.c
vendored
@ -33,6 +33,7 @@
|
||||
#include <sys/prctl.h>
|
||||
#include <sys/sysinfo.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
|
||||
@ -141,6 +142,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
|
||||
struct uv__epoll_event e;
|
||||
QUEUE* q;
|
||||
uv__io_t* w;
|
||||
sigset_t* pset;
|
||||
sigset_t set;
|
||||
uint64_t base;
|
||||
uint64_t diff;
|
||||
int nevents;
|
||||
@ -191,12 +194,25 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
|
||||
w->events = w->pevents;
|
||||
}
|
||||
|
||||
pset = NULL;
|
||||
if (loop->flags & UV_LOOP_BLOCK_SIGPROF) {
|
||||
pset = &set;
|
||||
sigemptyset(pset);
|
||||
sigaddset(pset, SIGPROF);
|
||||
}
|
||||
|
||||
assert(timeout >= -1);
|
||||
base = loop->time;
|
||||
count = 48; /* Benchmarks suggest this gives the best throughput. */
|
||||
|
||||
for (;;) {
|
||||
if (!no_epoll_wait) {
|
||||
if (no_epoll_wait || pset != NULL) {
|
||||
nfds = uv__epoll_pwait(loop->backend_fd,
|
||||
events,
|
||||
ARRAY_SIZE(events),
|
||||
timeout,
|
||||
pset);
|
||||
} else {
|
||||
nfds = uv__epoll_wait(loop->backend_fd,
|
||||
events,
|
||||
ARRAY_SIZE(events),
|
||||
@ -205,12 +221,6 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
|
||||
no_epoll_wait = 1;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
nfds = uv__epoll_pwait(loop->backend_fd,
|
||||
events,
|
||||
ARRAY_SIZE(events),
|
||||
timeout,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/* Update loop->time unconditionally. It's tempting to skip the update when
|
||||
@ -744,6 +754,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses,
|
||||
return -errno;
|
||||
|
||||
*count = 0;
|
||||
*addresses = NULL;
|
||||
|
||||
/* Count the number of interfaces */
|
||||
for (ent = addrs; ent != NULL; ent = ent->ifa_next) {
|
||||
@ -756,6 +767,9 @@ int uv_interface_addresses(uv_interface_address_t** addresses,
|
||||
(*count)++;
|
||||
}
|
||||
|
||||
if (*count == 0)
|
||||
return 0;
|
||||
|
||||
*addresses = malloc(*count * sizeof(**addresses));
|
||||
if (!(*addresses))
|
||||
return -ENOMEM;
|
||||
|
3
deps/uv/src/unix/linux-syscalls.c
vendored
3
deps/uv/src/unix/linux-syscalls.c
vendored
@ -21,6 +21,7 @@
|
||||
|
||||
#include "linux-syscalls.h"
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
@ -328,7 +329,7 @@ int uv__epoll_pwait(int epfd,
|
||||
nevents,
|
||||
timeout,
|
||||
sigmask,
|
||||
sizeof(*sigmask));
|
||||
_NSIG / 8);
|
||||
#else
|
||||
return errno = ENOSYS, -1;
|
||||
#endif
|
||||
|
8
deps/uv/src/unix/linux-syscalls.h
vendored
8
deps/uv/src/unix/linux-syscalls.h
vendored
@ -44,7 +44,7 @@
|
||||
#if defined(__alpha__)
|
||||
# define UV__O_NONBLOCK 0x4
|
||||
#elif defined(__hppa__)
|
||||
# define UV__O_NONBLOCK 0x10004
|
||||
# define UV__O_NONBLOCK O_NONBLOCK
|
||||
#elif defined(__mips__)
|
||||
# define UV__O_NONBLOCK 0x80
|
||||
#elif defined(__sparc__)
|
||||
@ -60,7 +60,11 @@
|
||||
#define UV__IN_NONBLOCK UV__O_NONBLOCK
|
||||
|
||||
#define UV__SOCK_CLOEXEC UV__O_CLOEXEC
|
||||
#define UV__SOCK_NONBLOCK UV__O_NONBLOCK
|
||||
#if defined(SOCK_NONBLOCK)
|
||||
# define UV__SOCK_NONBLOCK SOCK_NONBLOCK
|
||||
#else
|
||||
# define UV__SOCK_NONBLOCK UV__O_NONBLOCK
|
||||
#endif
|
||||
|
||||
/* epoll flags */
|
||||
#define UV__EPOLL_CLOEXEC UV__O_CLOEXEC
|
||||
|
12
deps/uv/src/unix/loop.c
vendored
12
deps/uv/src/unix/loop.c
vendored
@ -192,3 +192,15 @@ static void uv__loop_close(uv_loop_t* loop) {
|
||||
loop->watchers = NULL;
|
||||
loop->nwatchers = 0;
|
||||
}
|
||||
|
||||
|
||||
int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap) {
|
||||
if (option != UV_LOOP_BLOCK_SIGNAL)
|
||||
return UV_ENOSYS;
|
||||
|
||||
if (va_arg(ap, int) != SIGPROF)
|
||||
return UV_EINVAL;
|
||||
|
||||
loop->flags |= UV_LOOP_BLOCK_SIGPROF;
|
||||
return 0;
|
||||
}
|
||||
|
13
deps/uv/src/unix/pipe.c
vendored
13
deps/uv/src/unix/pipe.c
vendored
@ -44,13 +44,10 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) {
|
||||
struct sockaddr_un saddr;
|
||||
const char* pipe_fname;
|
||||
int sockfd;
|
||||
int bound;
|
||||
int err;
|
||||
|
||||
pipe_fname = NULL;
|
||||
sockfd = -1;
|
||||
bound = 0;
|
||||
err = -EINVAL;
|
||||
|
||||
/* Already bound? */
|
||||
if (uv__stream_fd(handle) >= 0)
|
||||
@ -83,7 +80,6 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) {
|
||||
err = -EACCES;
|
||||
goto out;
|
||||
}
|
||||
bound = 1;
|
||||
|
||||
/* Success. */
|
||||
handle->pipe_fname = pipe_fname; /* Is a strdup'ed copy. */
|
||||
@ -91,11 +87,9 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) {
|
||||
return 0;
|
||||
|
||||
out:
|
||||
if (bound) {
|
||||
/* unlink() before uv__close() to avoid races. */
|
||||
assert(pipe_fname != NULL);
|
||||
unlink(pipe_fname);
|
||||
}
|
||||
/* unlink() before uv__close() to avoid races. */
|
||||
assert(pipe_fname != NULL);
|
||||
unlink(pipe_fname);
|
||||
uv__close(sockfd);
|
||||
free((void*)pipe_fname);
|
||||
return err;
|
||||
@ -158,7 +152,6 @@ void uv_pipe_connect(uv_connect_t* req,
|
||||
int r;
|
||||
|
||||
new_sock = (uv__stream_fd(handle) == -1);
|
||||
err = -EINVAL;
|
||||
|
||||
if (new_sock) {
|
||||
err = uv__socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
|
24
deps/uv/src/unix/stream.c
vendored
24
deps/uv/src/unix/stream.c
vendored
@ -549,7 +549,6 @@ int uv_accept(uv_stream_t* server, uv_stream_t* client) {
|
||||
if (server->accepted_fd == -1)
|
||||
return -EAGAIN;
|
||||
|
||||
err = 0;
|
||||
switch (client->type) {
|
||||
case UV_NAMED_PIPE:
|
||||
case UV_TCP:
|
||||
@ -951,6 +950,7 @@ static void uv__stream_eof(uv_stream_t* stream, const uv_buf_t* buf) {
|
||||
uv__handle_stop(stream);
|
||||
uv__stream_osx_interrupt_select(stream);
|
||||
stream->read_cb(stream, UV_EOF, buf);
|
||||
stream->flags &= ~UV_STREAM_READING;
|
||||
}
|
||||
|
||||
|
||||
@ -1117,8 +1117,13 @@ static void uv__read(uv_stream_t* stream) {
|
||||
} else {
|
||||
/* Error. User should call uv_close(). */
|
||||
stream->read_cb(stream, -errno, &buf);
|
||||
assert(!uv__io_active(&stream->io_watcher, UV__POLLIN) &&
|
||||
"stream->read_cb(status=-1) did not call uv_close()");
|
||||
if (stream->flags & UV_STREAM_READING) {
|
||||
stream->flags &= ~UV_STREAM_READING;
|
||||
uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLIN);
|
||||
if (!uv__io_active(&stream->io_watcher, UV__POLLOUT))
|
||||
uv__handle_stop(stream);
|
||||
uv__stream_osx_interrupt_select(stream);
|
||||
}
|
||||
}
|
||||
return;
|
||||
} else if (nread == 0) {
|
||||
@ -1319,7 +1324,7 @@ int uv_write2(uv_write_t* req,
|
||||
/* It's legal for write_queue_size > 0 even when the write_queue is empty;
|
||||
* it means there are error-state requests in the write_completed_queue that
|
||||
* will touch up write_queue_size later, see also uv__write_req_finish().
|
||||
* We chould check that write_queue is empty instead but that implies making
|
||||
* We could check that write_queue is empty instead but that implies making
|
||||
* a write() syscall when we know that the handle is in error mode.
|
||||
*/
|
||||
empty_queue = (stream->write_queue_size == 0);
|
||||
@ -1471,15 +1476,8 @@ int uv_read_start(uv_stream_t* stream,
|
||||
|
||||
|
||||
int uv_read_stop(uv_stream_t* stream) {
|
||||
/* Sanity check. We're going to stop the handle unless it's primed for
|
||||
* writing but that means there should be some kind of write action in
|
||||
* progress.
|
||||
*/
|
||||
assert(!uv__io_active(&stream->io_watcher, UV__POLLOUT) ||
|
||||
!QUEUE_EMPTY(&stream->write_completed_queue) ||
|
||||
!QUEUE_EMPTY(&stream->write_queue) ||
|
||||
stream->shutdown_req != NULL ||
|
||||
stream->connect_req != NULL);
|
||||
if (!(stream->flags & UV_STREAM_READING))
|
||||
return 0;
|
||||
|
||||
stream->flags &= ~UV_STREAM_READING;
|
||||
uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLIN);
|
||||
|
29
deps/uv/src/unix/sunos.c
vendored
29
deps/uv/src/unix/sunos.c
vendored
@ -122,6 +122,8 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
|
||||
struct timespec spec;
|
||||
QUEUE* q;
|
||||
uv__io_t* w;
|
||||
sigset_t* pset;
|
||||
sigset_t set;
|
||||
uint64_t base;
|
||||
uint64_t diff;
|
||||
unsigned int nfds;
|
||||
@ -129,6 +131,7 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
|
||||
int saved_errno;
|
||||
int nevents;
|
||||
int count;
|
||||
int err;
|
||||
int fd;
|
||||
|
||||
if (loop->nfds == 0) {
|
||||
@ -150,6 +153,13 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
|
||||
w->events = w->pevents;
|
||||
}
|
||||
|
||||
pset = NULL;
|
||||
if (loop->flags & UV_LOOP_BLOCK_SIGPROF) {
|
||||
pset = &set;
|
||||
sigemptyset(pset);
|
||||
sigaddset(pset, SIGPROF);
|
||||
}
|
||||
|
||||
assert(timeout >= -1);
|
||||
base = loop->time;
|
||||
count = 48; /* Benchmarks suggest this gives the best throughput. */
|
||||
@ -165,11 +175,20 @@ void uv__io_poll(uv_loop_t* loop, int timeout) {
|
||||
|
||||
nfds = 1;
|
||||
saved_errno = 0;
|
||||
if (port_getn(loop->backend_fd,
|
||||
events,
|
||||
ARRAY_SIZE(events),
|
||||
&nfds,
|
||||
timeout == -1 ? NULL : &spec)) {
|
||||
|
||||
if (pset != NULL)
|
||||
pthread_sigmask(SIG_BLOCK, pset, NULL);
|
||||
|
||||
err = port_getn(loop->backend_fd,
|
||||
events,
|
||||
ARRAY_SIZE(events),
|
||||
&nfds,
|
||||
timeout == -1 ? NULL : &spec);
|
||||
|
||||
if (pset != NULL)
|
||||
pthread_sigmask(SIG_UNBLOCK, pset, NULL);
|
||||
|
||||
if (err) {
|
||||
/* Work around another kernel bug: port_getn() may return events even
|
||||
* on error.
|
||||
*/
|
||||
|
3
deps/uv/src/unix/udp.c
vendored
3
deps/uv/src/unix/udp.c
vendored
@ -278,9 +278,6 @@ int uv__udp_bind(uv_udp_t* handle,
|
||||
int yes;
|
||||
int fd;
|
||||
|
||||
err = -EINVAL;
|
||||
fd = -1;
|
||||
|
||||
/* Check for bad flags. */
|
||||
if (flags & ~(UV_UDP_IPV6ONLY | UV_UDP_REUSEADDR))
|
||||
return -EINVAL;
|
||||
|
14
deps/uv/src/uv-common.c
vendored
14
deps/uv/src/uv-common.c
vendored
@ -24,6 +24,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h> /* NULL */
|
||||
#include <stdlib.h> /* malloc */
|
||||
#include <string.h> /* memset */
|
||||
@ -442,3 +443,16 @@ int uv_fs_scandir_next(uv_fs_t* req, uv_dirent_t* ent) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int uv_loop_configure(uv_loop_t* loop, uv_loop_option option, ...) {
|
||||
va_list ap;
|
||||
int err;
|
||||
|
||||
va_start(ap, option);
|
||||
/* Any platform-agnostic options should be handled here. */
|
||||
err = uv__loop_configure(loop, option, ap);
|
||||
va_end(ap);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
3
deps/uv/src/uv-common.h
vendored
3
deps/uv/src/uv-common.h
vendored
@ -28,6 +28,7 @@
|
||||
#define UV_COMMON_H_
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1600
|
||||
@ -59,6 +60,8 @@ enum {
|
||||
# define UV__HANDLE_CLOSING 0x01
|
||||
#endif
|
||||
|
||||
int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap);
|
||||
|
||||
int uv__tcp_bind(uv_tcp_t* tcp,
|
||||
const struct sockaddr* addr,
|
||||
unsigned int addrlen,
|
||||
|
15
deps/uv/src/win/core.c
vendored
15
deps/uv/src/win/core.c
vendored
@ -39,7 +39,7 @@
|
||||
static uv_loop_t default_loop_struct;
|
||||
static uv_loop_t* default_loop_ptr;
|
||||
|
||||
/* uv_once intialization guards */
|
||||
/* uv_once initialization guards */
|
||||
static uv_once_t uv_init_guard_ = UV_ONCE_INIT;
|
||||
|
||||
|
||||
@ -103,7 +103,7 @@ static void uv_init(void) {
|
||||
#endif
|
||||
|
||||
/* Fetch winapi function pointers. This must be done first because other
|
||||
* intialization code might need these function pointers to be loaded.
|
||||
* initialization code might need these function pointers to be loaded.
|
||||
*/
|
||||
uv_winapi_init();
|
||||
|
||||
@ -133,7 +133,7 @@ int uv_loop_init(uv_loop_t* loop) {
|
||||
if (loop->iocp == NULL)
|
||||
return uv_translate_sys_error(GetLastError());
|
||||
|
||||
/* To prevent uninitialized memory access, loop->time must be intialized
|
||||
/* To prevent uninitialized memory access, loop->time must be initialized
|
||||
* to zero before calling uv_update_time for the first time.
|
||||
*/
|
||||
loop->time = 0;
|
||||
@ -199,7 +199,7 @@ uv_loop_t* uv_default_loop(void) {
|
||||
static void uv__loop_close(uv_loop_t* loop) {
|
||||
size_t i;
|
||||
|
||||
/* close the async handle without needeing an extra loop iteration */
|
||||
/* close the async handle without needing an extra loop iteration */
|
||||
assert(!loop->wq_async.async_sent);
|
||||
loop->wq_async.close_cb = NULL;
|
||||
uv__handle_closing(&loop->wq_async);
|
||||
@ -272,6 +272,11 @@ void uv_loop_delete(uv_loop_t* loop) {
|
||||
}
|
||||
|
||||
|
||||
int uv__loop_configure(uv_loop_t* loop, uv_loop_option option, va_list ap) {
|
||||
return UV_ENOSYS;
|
||||
}
|
||||
|
||||
|
||||
int uv_backend_fd(const uv_loop_t* loop) {
|
||||
return -1;
|
||||
}
|
||||
@ -411,7 +416,7 @@ int uv_run(uv_loop_t *loop, uv_run_mode mode) {
|
||||
uv_process_endgames(loop);
|
||||
|
||||
if (mode == UV_RUN_ONCE) {
|
||||
/* UV_RUN_ONCE implies forward progess: at least one callback must have
|
||||
/* UV_RUN_ONCE implies forward progress: at least one callback must have
|
||||
* been invoked when it returns. uv__io_poll() can return without doing
|
||||
* I/O (meaning: no callbacks) when its timeout expires - which means we
|
||||
* have pending timers that satisfy the forward progress constraint.
|
||||
|
4
deps/uv/src/win/fs.c
vendored
4
deps/uv/src/win/fs.c
vendored
@ -947,7 +947,7 @@ INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf) {
|
||||
*
|
||||
* Currently it's based on whether the 'readonly' attribute is set, which
|
||||
* makes little sense because the semantics are so different: the 'read-only'
|
||||
* flag is just a way for a user to protect against accidental deleteion, and
|
||||
* flag is just a way for a user to protect against accidental deletion, and
|
||||
* serves no security purpose. Windows uses ACLs for that.
|
||||
*
|
||||
* Also people now use uv_fs_chmod() to take away the writable bit for good
|
||||
@ -956,7 +956,7 @@ INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf) {
|
||||
* deleted.
|
||||
*
|
||||
* IOW it's all just a clusterfuck and we should think of something that
|
||||
* makes slighty more sense.
|
||||
* makes slightly more sense.
|
||||
*
|
||||
* And uv_fs_chmod should probably just fail on windows or be a total no-op.
|
||||
* There's nothing sensible it can do anyway.
|
||||
|
2
deps/uv/src/win/getaddrinfo.c
vendored
2
deps/uv/src/win/getaddrinfo.c
vendored
@ -296,7 +296,7 @@ int uv_getaddrinfo(uv_loop_t* loop,
|
||||
req->alloc = (void*)alloc_ptr;
|
||||
|
||||
/* convert node string to UTF16 into allocated memory and save pointer in */
|
||||
/* the reques. */
|
||||
/* the request. */
|
||||
if (node != NULL) {
|
||||
req->node = (WCHAR*)alloc_ptr;
|
||||
if (uv_utf8_to_utf16(node,
|
||||
|
34
deps/uv/src/win/poll.c
vendored
34
deps/uv/src/win/poll.c
vendored
@ -79,7 +79,7 @@ static void uv__fast_poll_submit_poll_req(uv_loop_t* loop, uv_poll_t* handle) {
|
||||
handle->mask_events_2 = handle->events;
|
||||
} else if (handle->submitted_events_2 == 0) {
|
||||
req = &handle->poll_req_2;
|
||||
afd_poll_info = &handle->afd_poll_info_2;
|
||||
afd_poll_info = &handle->afd_poll_info_2.afd_poll_info_ptr[0];
|
||||
handle->submitted_events_2 = handle->events;
|
||||
handle->mask_events_1 = handle->events;
|
||||
handle->mask_events_2 = 0;
|
||||
@ -119,18 +119,19 @@ static void uv__fast_poll_submit_poll_req(uv_loop_t* loop, uv_poll_t* handle) {
|
||||
|
||||
|
||||
static int uv__fast_poll_cancel_poll_req(uv_loop_t* loop, uv_poll_t* handle) {
|
||||
AFD_POLL_INFO afd_poll_info;
|
||||
int result;
|
||||
AFD_POLL_INFO* afd_poll_info;
|
||||
DWORD result;
|
||||
|
||||
afd_poll_info.Exclusive = TRUE;
|
||||
afd_poll_info.NumberOfHandles = 1;
|
||||
afd_poll_info.Timeout.QuadPart = INT64_MAX;
|
||||
afd_poll_info.Handles[0].Handle = (HANDLE) handle->socket;
|
||||
afd_poll_info.Handles[0].Status = 0;
|
||||
afd_poll_info.Handles[0].Events = AFD_POLL_ALL;
|
||||
afd_poll_info = &handle->afd_poll_info_2.afd_poll_info_ptr[1];
|
||||
afd_poll_info->Exclusive = TRUE;
|
||||
afd_poll_info->NumberOfHandles = 1;
|
||||
afd_poll_info->Timeout.QuadPart = INT64_MAX;
|
||||
afd_poll_info->Handles[0].Handle = (HANDLE) handle->socket;
|
||||
afd_poll_info->Handles[0].Status = 0;
|
||||
afd_poll_info->Handles[0].Events = AFD_POLL_ALL;
|
||||
|
||||
result = uv_msafd_poll(handle->socket,
|
||||
&afd_poll_info,
|
||||
afd_poll_info,
|
||||
uv__get_overlapped_dummy());
|
||||
|
||||
if (result == SOCKET_ERROR) {
|
||||
@ -154,7 +155,7 @@ static void uv__fast_poll_process_poll_req(uv_loop_t* loop, uv_poll_t* handle,
|
||||
handle->submitted_events_1 = 0;
|
||||
mask_events = handle->mask_events_1;
|
||||
} else if (req == &handle->poll_req_2) {
|
||||
afd_poll_info = &handle->afd_poll_info_2;
|
||||
afd_poll_info = &handle->afd_poll_info_2.afd_poll_info_ptr[0];
|
||||
handle->submitted_events_2 = 0;
|
||||
mask_events = handle->mask_events_2;
|
||||
} else {
|
||||
@ -546,7 +547,7 @@ int uv_poll_init_socket(uv_loop_t* loop, uv_poll_t* handle,
|
||||
handle->flags |= UV_HANDLE_POLL_SLOW;
|
||||
}
|
||||
|
||||
/* Intialize 2 poll reqs. */
|
||||
/* Initialize 2 poll reqs. */
|
||||
handle->submitted_events_1 = 0;
|
||||
uv_req_init(loop, (uv_req_t*) &(handle->poll_req_1));
|
||||
handle->poll_req_1.type = UV_POLL_REQ;
|
||||
@ -557,6 +558,11 @@ int uv_poll_init_socket(uv_loop_t* loop, uv_poll_t* handle,
|
||||
handle->poll_req_2.type = UV_POLL_REQ;
|
||||
handle->poll_req_2.data = handle;
|
||||
|
||||
handle->afd_poll_info_2.afd_poll_info_ptr = malloc(sizeof(*handle->afd_poll_info_2.afd_poll_info_ptr) * 2);
|
||||
if (handle->afd_poll_info_2.afd_poll_info_ptr == NULL) {
|
||||
return UV_ENOMEM;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -618,5 +624,9 @@ void uv_poll_endgame(uv_loop_t* loop, uv_poll_t* handle) {
|
||||
assert(handle->submitted_events_1 == 0);
|
||||
assert(handle->submitted_events_2 == 0);
|
||||
|
||||
if (handle->afd_poll_info_2.afd_poll_info_ptr) {
|
||||
free(handle->afd_poll_info_2.afd_poll_info_ptr);
|
||||
handle->afd_poll_info_2.afd_poll_info_ptr = NULL;
|
||||
}
|
||||
uv__handle_close(handle);
|
||||
}
|
||||
|
6
deps/uv/src/win/process.c
vendored
6
deps/uv/src/win/process.c
vendored
@ -1063,7 +1063,7 @@ int uv_spawn(uv_loop_t* loop,
|
||||
|
||||
if (options->flags & UV_PROCESS_DETACHED) {
|
||||
/* Note that we're not setting the CREATE_BREAKAWAY_FROM_JOB flag. That
|
||||
* means that libuv might not let you create a fully deamonized process
|
||||
* means that libuv might not let you create a fully daemonized process
|
||||
* when run under job control. However the type of job control that libuv
|
||||
* itself creates doesn't trickle down to subprocesses so they can still
|
||||
* daemonize.
|
||||
@ -1141,7 +1141,7 @@ int uv_spawn(uv_loop_t* loop,
|
||||
assert(!err);
|
||||
|
||||
/* Make the handle active. It will remain active until the exit callback */
|
||||
/* iis made or the handle is closed, whichever happens first. */
|
||||
/* is made or the handle is closed, whichever happens first. */
|
||||
uv__handle_start(process);
|
||||
|
||||
/* Cleanup, whether we succeeded or failed. */
|
||||
@ -1177,7 +1177,7 @@ static int uv__kill(HANDLE process_handle, int signum) {
|
||||
return 0;
|
||||
|
||||
/* If the process already exited before TerminateProcess was called, */
|
||||
/* TerminateProcess will fail with ERROR_ACESS_DENIED. */
|
||||
/* TerminateProcess will fail with ERROR_ACCESS_DENIED. */
|
||||
err = GetLastError();
|
||||
if (err == ERROR_ACCESS_DENIED &&
|
||||
GetExitCodeProcess(process_handle, &status) &&
|
||||
|
6
deps/uv/src/win/tcp.c
vendored
6
deps/uv/src/win/tcp.c
vendored
@ -241,7 +241,7 @@ void uv_tcp_endgame(uv_loop_t* loop, uv_tcp_t* handle) {
|
||||
* allow binding to addresses that are in use by sockets in TIME_WAIT, it
|
||||
* effectively allows 'stealing' a port which is in use by another application.
|
||||
*
|
||||
* SO_EXCLUSIVEADDRUSE is also not good here because it does cehck all sockets,
|
||||
* SO_EXCLUSIVEADDRUSE is also not good here because it does check all sockets,
|
||||
* regardless of state, so we'd get an error even if the port is in use by a
|
||||
* socket in TIME_WAIT state.
|
||||
*
|
||||
@ -590,7 +590,7 @@ int uv_tcp_listen(uv_tcp_t* handle, int backlog, uv_connection_cb cb) {
|
||||
}
|
||||
|
||||
/* Initialize other unused requests too, because uv_tcp_endgame */
|
||||
/* doesn't know how how many requests were intialized, so it will */
|
||||
/* doesn't know how how many requests were initialized, so it will */
|
||||
/* try to clean up {uv_simultaneous_server_accepts} requests. */
|
||||
for (i = simultaneous_accepts; i < uv_simultaneous_server_accepts; i++) {
|
||||
req = &handle->accept_reqs[i];
|
||||
@ -1342,7 +1342,7 @@ void uv_tcp_close(uv_loop_t* loop, uv_tcp_t* tcp) {
|
||||
if (uv_tcp_try_cancel_io(tcp) != 0) {
|
||||
/* When cancellation is not possible, there is another option: we can */
|
||||
/* close the incoming sockets, which will also cancel the accept */
|
||||
/* operations. However this is not cool because we might inadvertedly */
|
||||
/* operations. However this is not cool because we might inadvertently */
|
||||
/* close a socket that just accepted a new connection, which will */
|
||||
/* cause the connection to be aborted. */
|
||||
unsigned int i;
|
||||
|
4
deps/uv/src/win/thread.c
vendored
4
deps/uv/src/win/thread.c
vendored
@ -100,7 +100,7 @@ static NOINLINE void uv__once_inner(uv_once_t* guard,
|
||||
|
||||
} else {
|
||||
/* We lost the race. Destroy the event we created and wait for the */
|
||||
/* existing one todv become signaled. */
|
||||
/* existing one to become signaled. */
|
||||
CloseHandle(created_event);
|
||||
result = WaitForSingleObject(existing_event, INFINITE);
|
||||
assert(result == WAIT_OBJECT_0);
|
||||
@ -155,7 +155,7 @@ int uv_thread_create(uv_thread_t *tid, void (*entry)(void *arg), void *arg) {
|
||||
ctx->arg = arg;
|
||||
|
||||
/* Create the thread in suspended state so we have a chance to pass
|
||||
* its own creation handle to it */
|
||||
* its own creation handle to it */
|
||||
thread = (HANDLE) _beginthreadex(NULL,
|
||||
0,
|
||||
uv__thread_start,
|
||||
|
2
deps/uv/src/win/udp.c
vendored
2
deps/uv/src/win/udp.c
vendored
@ -83,7 +83,7 @@ static int uv_udp_set_socket(uv_loop_t* loop, uv_udp_t* handle, SOCKET socket,
|
||||
}
|
||||
|
||||
if (pSetFileCompletionNotificationModes) {
|
||||
/* All know windowses that support SetFileCompletionNotificationModes */
|
||||
/* All known Windows that support SetFileCompletionNotificationModes */
|
||||
/* have a bug that makes it impossible to use this function in */
|
||||
/* conjunction with datagram sockets. We can work around that but only */
|
||||
/* if the user is using the default UDP driver (AFD) and has no other */
|
||||
|
4
deps/uv/src/win/util.c
vendored
4
deps/uv/src/win/util.c
vendored
@ -44,7 +44,7 @@
|
||||
* of the console title is that it is smaller than 64K. However in practice
|
||||
* it is much smaller, and there is no way to figure out what the exact length
|
||||
* of the title is or can be, at least not on XP. To make it even more
|
||||
* annoying, GetConsoleTitle failes when the buffer to be read into is bigger
|
||||
* annoying, GetConsoleTitle fails when the buffer to be read into is bigger
|
||||
* than the actual maximum length. So we make a conservative guess here;
|
||||
* just don't put the novel you're writing in the title, unless the plot
|
||||
* survives truncation.
|
||||
@ -64,7 +64,7 @@ static double hrtime_interval_ = 0;
|
||||
|
||||
|
||||
/*
|
||||
* One-time intialization code for functionality defined in util.c.
|
||||
* One-time initialization code for functionality defined in util.c.
|
||||
*/
|
||||
void uv__util_init() {
|
||||
LARGE_INTEGER perf_frequency;
|
||||
|
7
deps/uv/test/run-benchmarks.c
vendored
7
deps/uv/test/run-benchmarks.c
vendored
@ -33,7 +33,8 @@ static int maybe_run_test(int argc, char **argv);
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
platform_init(argc, argv);
|
||||
if (platform_init(argc, argv))
|
||||
return EXIT_FAILURE;
|
||||
|
||||
switch (argc) {
|
||||
case 1: return run_tests(1);
|
||||
@ -41,8 +42,10 @@ int main(int argc, char **argv) {
|
||||
case 3: return run_test_part(argv[1], argv[2]);
|
||||
default:
|
||||
LOGF("Too many arguments.\n");
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
7
deps/uv/test/run-tests.c
vendored
7
deps/uv/test/run-tests.c
vendored
@ -46,7 +46,8 @@ static int maybe_run_test(int argc, char **argv);
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
platform_init(argc, argv);
|
||||
if (platform_init(argc, argv))
|
||||
return EXIT_FAILURE;
|
||||
|
||||
argv = uv_setup_args(argc, argv);
|
||||
|
||||
@ -56,8 +57,10 @@ int main(int argc, char **argv) {
|
||||
case 3: return run_test_part(argv[1], argv[2]);
|
||||
default:
|
||||
LOGF("Too many arguments.\n");
|
||||
return 1;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
13
deps/uv/test/runner-unix.c
vendored
13
deps/uv/test/runner-unix.c
vendored
@ -22,10 +22,11 @@
|
||||
#include "runner-unix.h"
|
||||
#include "runner.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdint.h> /* uintptr_t */
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h> /* usleep */
|
||||
#include <unistd.h> /* readlink, usleep */
|
||||
#include <string.h> /* strdup */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -40,7 +41,7 @@
|
||||
|
||||
|
||||
/* Do platform-specific initialization. */
|
||||
void platform_init(int argc, char **argv) {
|
||||
int platform_init(int argc, char **argv) {
|
||||
const char* tap;
|
||||
|
||||
tap = getenv("UV_TAP_OUTPUT");
|
||||
@ -49,8 +50,14 @@ void platform_init(int argc, char **argv) {
|
||||
/* Disable stdio output buffering. */
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
setvbuf(stderr, NULL, _IONBF, 0);
|
||||
strncpy(executable_path, argv[0], sizeof(executable_path) - 1);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
if (realpath(argv[0], executable_path) == NULL) {
|
||||
perror("realpath");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
4
deps/uv/test/runner-win.c
vendored
4
deps/uv/test/runner-win.c
vendored
@ -43,7 +43,7 @@
|
||||
|
||||
|
||||
/* Do platform-specific initialization. */
|
||||
void platform_init(int argc, char **argv) {
|
||||
int platform_init(int argc, char **argv) {
|
||||
const char* tap;
|
||||
|
||||
tap = getenv("UV_TAP_OUTPUT");
|
||||
@ -66,6 +66,8 @@ void platform_init(int argc, char **argv) {
|
||||
setvbuf(stderr, NULL, _IONBF, 0);
|
||||
|
||||
strcpy(executable_path, argv[0]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
2
deps/uv/test/runner.c
vendored
2
deps/uv/test/runner.c
vendored
@ -26,7 +26,7 @@
|
||||
#include "task.h"
|
||||
#include "uv.h"
|
||||
|
||||
char executable_path[PATHMAX] = { '\0' };
|
||||
char executable_path[sizeof(executable_path)];
|
||||
|
||||
int tap_output = 0;
|
||||
|
||||
|
10
deps/uv/test/runner.h
vendored
10
deps/uv/test/runner.h
vendored
@ -22,6 +22,7 @@
|
||||
#ifndef RUNNER_H_
|
||||
#define RUNNER_H_
|
||||
|
||||
#include <limits.h> /* PATH_MAX */
|
||||
#include <stdio.h> /* FILE */
|
||||
|
||||
|
||||
@ -83,8 +84,11 @@ typedef struct {
|
||||
#define TEST_HELPER HELPER_ENTRY
|
||||
#define BENCHMARK_HELPER HELPER_ENTRY
|
||||
|
||||
#define PATHMAX 1024
|
||||
extern char executable_path[PATHMAX];
|
||||
#ifdef PATH_MAX
|
||||
extern char executable_path[PATH_MAX];
|
||||
#else
|
||||
extern char executable_path[4096];
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Include platform-dependent definitions
|
||||
@ -130,7 +134,7 @@ void print_tests(FILE* stream);
|
||||
*/
|
||||
|
||||
/* Do platform-specific initialization. */
|
||||
void platform_init(int argc, char** argv);
|
||||
int platform_init(int argc, char** argv);
|
||||
|
||||
/* Invoke "argv[0] test-name [test-part]". Store process info in *p. */
|
||||
/* Make sure that all stdio output of the processes is buffered up. */
|
||||
|
2
deps/uv/test/test-osx-select.c
vendored
2
deps/uv/test/test-osx-select.c
vendored
@ -90,6 +90,8 @@ TEST_IMPL(osx_select_many_fds) {
|
||||
uv_tty_t tty;
|
||||
uv_tcp_t tcps[1500];
|
||||
|
||||
TEST_FILE_LIMIT(ARRAY_SIZE(tcps) + 2);
|
||||
|
||||
r = uv_ip4_addr("127.0.0.1", 0, &addr);
|
||||
ASSERT(r == 0);
|
||||
|
||||
|
@ -54,7 +54,8 @@ TEST_IMPL(pipe_close_stdout_read_stdin) {
|
||||
int fd[2];
|
||||
int status;
|
||||
|
||||
pipe(fd);
|
||||
r = pipe(fd);
|
||||
ASSERT(r == 0);
|
||||
|
||||
if ((pid = fork()) == 0) {
|
||||
/*
|
||||
@ -63,7 +64,8 @@ TEST_IMPL(pipe_close_stdout_read_stdin) {
|
||||
*/
|
||||
close(fd[1]);
|
||||
close(0);
|
||||
dup(fd[0]);
|
||||
r = dup(fd[0]);
|
||||
ASSERT(r != -1);
|
||||
|
||||
/* Create a stream that reads from the pipe. */
|
||||
uv_pipe_t stdin_pipe;
|
||||
|
7
deps/uv/test/test-tty.c
vendored
7
deps/uv/test/test-tty.c
vendored
@ -96,6 +96,13 @@ TEST_IMPL(tty) {
|
||||
|
||||
printf("width=%d height=%d\n", width, height);
|
||||
|
||||
if (width == 0 && height == 0) {
|
||||
/* Some environments such as containers or Jenkins behave like this
|
||||
* sometimes */
|
||||
MAKE_VALGRIND_HAPPY();
|
||||
return TEST_SKIP;
|
||||
}
|
||||
|
||||
/*
|
||||
* Is it a safe assumption that most people have terminals larger than
|
||||
* 10x10?
|
||||
|
@ -778,6 +778,9 @@ Returns a new ReadStream object (See `Readable Stream`).
|
||||
the file instead of the entire file. Both `start` and `end` are inclusive and
|
||||
start at 0. The `encoding` can be `'utf8'`, `'ascii'`, or `'base64'`.
|
||||
|
||||
If `fd` is specified, `ReadStream` will ignore the `path` argument and will use
|
||||
the specified file descriptor. This means that no `open` event will be emitted.
|
||||
|
||||
If `autoClose` is false, then the file descriptor won't be closed, even if
|
||||
there's an error. It is your responsibility to close it and make sure
|
||||
there's no file descriptor leak. If `autoClose` is set to true (default
|
||||
@ -808,6 +811,7 @@ Returns a new WriteStream object (See `Writable Stream`).
|
||||
|
||||
{ flags: 'w',
|
||||
encoding: null,
|
||||
fd: null,
|
||||
mode: 0666 }
|
||||
|
||||
`options` may also include a `start` option to allow writing data at
|
||||
@ -815,6 +819,11 @@ some position past the beginning of the file. Modifying a file rather
|
||||
than replacing it may require a `flags` mode of `r+` rather than the
|
||||
default mode `w`.
|
||||
|
||||
Like `ReadStream` above, if `fd` is specified, `WriteStream` will ignore the
|
||||
`path` argument and will use the specified file descriptor. This means that no
|
||||
`open` event will be emitted.
|
||||
|
||||
|
||||
## Class: fs.WriteStream
|
||||
|
||||
`WriteStream` is a [Writable Stream](stream.html#stream_class_stream_writable).
|
||||
|
@ -1364,6 +1364,12 @@ Interface.prototype.setBreakpoint = function(script, line,
|
||||
script = this.client.currentScript;
|
||||
}
|
||||
|
||||
if (script === undefined) {
|
||||
this.print('Cannot determine the current script, ' +
|
||||
'make sure the debugged process is paused.');
|
||||
return;
|
||||
}
|
||||
|
||||
if (/\(\)$/.test(script)) {
|
||||
// setBreakpoint('functionname()');
|
||||
var req = {
|
||||
|
@ -30,6 +30,7 @@ Writable.WritableState = WritableState;
|
||||
|
||||
var util = require('util');
|
||||
var Stream = require('stream');
|
||||
var debug = util.debuglog('stream');
|
||||
|
||||
util.inherits(Writable, Stream);
|
||||
|
||||
@ -37,6 +38,7 @@ function WriteReq(chunk, encoding, cb) {
|
||||
this.chunk = chunk;
|
||||
this.encoding = encoding;
|
||||
this.callback = cb;
|
||||
this.next = null;
|
||||
}
|
||||
|
||||
function WritableState(options, stream) {
|
||||
@ -111,7 +113,8 @@ function WritableState(options, stream) {
|
||||
// the amount that is being written when _write is called.
|
||||
this.writelen = 0;
|
||||
|
||||
this.buffer = [];
|
||||
this.bufferedRequest = null;
|
||||
this.lastBufferedRequest = null;
|
||||
|
||||
// number of pending user-supplied write callbacks
|
||||
// this must be 0 before 'finish' can be emitted
|
||||
@ -125,6 +128,23 @@ function WritableState(options, stream) {
|
||||
this.errorEmitted = false;
|
||||
}
|
||||
|
||||
WritableState.prototype.getBuffer = function writableStateGetBuffer() {
|
||||
var current = this.bufferedRequest;
|
||||
var out = [];
|
||||
while (current) {
|
||||
out.push(current);
|
||||
current = current.next;
|
||||
}
|
||||
return out;
|
||||
};
|
||||
|
||||
Object.defineProperty(WritableState.prototype, 'buffer', {
|
||||
get: util.deprecate(function() {
|
||||
return this.getBuffer();
|
||||
}, '_writableState.buffer is deprecated. Use ' +
|
||||
'_writableState.getBuffer() instead.')
|
||||
});
|
||||
|
||||
function Writable(options) {
|
||||
// Writable ctor is applied to Duplexes, though they're not
|
||||
// instanceof Writable, they're instanceof Readable.
|
||||
@ -218,7 +238,7 @@ Writable.prototype.uncork = function() {
|
||||
!state.corked &&
|
||||
!state.finished &&
|
||||
!state.bufferProcessing &&
|
||||
state.buffer.length)
|
||||
state.bufferedRequest)
|
||||
clearBuffer(this, state);
|
||||
}
|
||||
};
|
||||
@ -257,8 +277,15 @@ function writeOrBuffer(stream, state, chunk, encoding, cb) {
|
||||
if (!ret)
|
||||
state.needDrain = true;
|
||||
|
||||
if (state.writing || state.corked)
|
||||
state.buffer.push(new WriteReq(chunk, encoding, cb));
|
||||
if (state.writing || state.corked) {
|
||||
var last = state.lastBufferedRequest;
|
||||
state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);
|
||||
if (last) {
|
||||
last.next = state.lastBufferedRequest;
|
||||
} else {
|
||||
state.bufferedRequest = state.lastBufferedRequest;
|
||||
}
|
||||
}
|
||||
else
|
||||
doWrite(stream, state, false, len, chunk, encoding, cb);
|
||||
|
||||
@ -315,7 +342,7 @@ function onwrite(stream, er) {
|
||||
if (!finished &&
|
||||
!state.corked &&
|
||||
!state.bufferProcessing &&
|
||||
state.buffer.length) {
|
||||
state.bufferedRequest) {
|
||||
clearBuffer(stream, state);
|
||||
}
|
||||
|
||||
@ -351,17 +378,23 @@ function onwriteDrain(stream, state) {
|
||||
// if there's something in the buffer waiting, then process it
|
||||
function clearBuffer(stream, state) {
|
||||
state.bufferProcessing = true;
|
||||
var entry = state.bufferedRequest;
|
||||
|
||||
if (stream._writev && state.buffer.length > 1) {
|
||||
if (stream._writev && entry && entry.next) {
|
||||
// Fast case, write everything using _writev()
|
||||
var buffer = [];
|
||||
var cbs = [];
|
||||
for (var c = 0; c < state.buffer.length; c++)
|
||||
cbs.push(state.buffer[c].callback);
|
||||
while (entry) {
|
||||
cbs.push(entry.callback);
|
||||
buffer.push(entry);
|
||||
entry = entry.next;
|
||||
}
|
||||
|
||||
// count the one we are adding, as well.
|
||||
// TODO(isaacs) clean this up
|
||||
state.pendingcb++;
|
||||
doWrite(stream, state, true, state.length, state.buffer, '', function(err) {
|
||||
state.lastBufferedRequest = null;
|
||||
doWrite(stream, state, true, state.length, buffer, '', function(err) {
|
||||
for (var i = 0; i < cbs.length; i++) {
|
||||
state.pendingcb--;
|
||||
cbs[i](err);
|
||||
@ -369,34 +402,29 @@ function clearBuffer(stream, state) {
|
||||
});
|
||||
|
||||
// Clear buffer
|
||||
state.buffer = [];
|
||||
} else {
|
||||
// Slow case, write chunks one-by-one
|
||||
for (var c = 0; c < state.buffer.length; c++) {
|
||||
var entry = state.buffer[c];
|
||||
while (entry) {
|
||||
var chunk = entry.chunk;
|
||||
var encoding = entry.encoding;
|
||||
var cb = entry.callback;
|
||||
var len = state.objectMode ? 1 : chunk.length;
|
||||
|
||||
doWrite(stream, state, false, len, chunk, encoding, cb);
|
||||
|
||||
entry = entry.next;
|
||||
// if we didn't call the onwrite immediately, then
|
||||
// it means that we need to wait until it does.
|
||||
// also, that means that the chunk and cb are currently
|
||||
// being processed, so move the buffer counter past them.
|
||||
if (state.writing) {
|
||||
c++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (c < state.buffer.length)
|
||||
state.buffer = state.buffer.slice(c);
|
||||
else
|
||||
state.buffer.length = 0;
|
||||
if (entry === null)
|
||||
state.lastBufferedRequest = null;
|
||||
}
|
||||
|
||||
state.bufferedRequest = entry;
|
||||
state.bufferProcessing = false;
|
||||
}
|
||||
|
||||
@ -437,7 +465,7 @@ Writable.prototype.end = function(chunk, encoding, cb) {
|
||||
function needFinish(stream, state) {
|
||||
return (state.ending &&
|
||||
state.length === 0 &&
|
||||
state.buffer.length === 0 &&
|
||||
state.bufferedRequest === null &&
|
||||
!state.finished &&
|
||||
!state.writing);
|
||||
}
|
||||
|
83
lib/net.js
83
lib/net.js
@ -752,7 +752,7 @@ Socket.prototype.__defineGetter__('bytesWritten', function() {
|
||||
data = this._pendingData,
|
||||
encoding = this._pendingEncoding;
|
||||
|
||||
state.buffer.forEach(function(el) {
|
||||
state.getBuffer().forEach(function(el) {
|
||||
if (util.isBuffer(el.chunk))
|
||||
bytes += el.chunk.length;
|
||||
else
|
||||
@ -805,34 +805,18 @@ function connect(self, address, port, addressType, localAddress, localPort) {
|
||||
assert.ok(self._connecting);
|
||||
|
||||
var err;
|
||||
|
||||
if (localAddress || localPort) {
|
||||
if (localAddress && !exports.isIP(localAddress))
|
||||
err = new TypeError(
|
||||
'localAddress should be a valid IP: ' + localAddress);
|
||||
|
||||
if (localPort && !util.isNumber(localPort))
|
||||
err = new TypeError('localPort should be a number: ' + localPort);
|
||||
|
||||
var bind;
|
||||
|
||||
switch (addressType) {
|
||||
case 4:
|
||||
if (!localAddress)
|
||||
localAddress = '0.0.0.0';
|
||||
bind = self._handle.bind;
|
||||
break;
|
||||
case 6:
|
||||
if (!localAddress)
|
||||
localAddress = '::';
|
||||
bind = self._handle.bind6;
|
||||
break;
|
||||
default:
|
||||
err = new TypeError('Invalid addressType: ' + addressType);
|
||||
break;
|
||||
}
|
||||
|
||||
if (err) {
|
||||
self._destroy(err);
|
||||
if (addressType === 4) {
|
||||
localAddress = localAddress || '0.0.0.0';
|
||||
bind = self._handle.bind;
|
||||
} else if (addressType === 6) {
|
||||
localAddress = localAddress || '::';
|
||||
bind = self._handle.bind6;
|
||||
} else {
|
||||
self._destroy(new TypeError('Invalid addressType: ' + addressType));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -853,17 +837,14 @@ function connect(self, address, port, addressType, localAddress, localPort) {
|
||||
if (addressType === 6 || addressType === 4) {
|
||||
var req = new TCPConnectWrap();
|
||||
req.oncomplete = afterConnect;
|
||||
port = port | 0;
|
||||
if (port <= 0 || port > 65535)
|
||||
throw new RangeError('Port should be > 0 and < 65536');
|
||||
|
||||
req.port = port;
|
||||
req.address = address;
|
||||
if (addressType === 6) {
|
||||
err = self._handle.connect6(req, address, port);
|
||||
} else if (addressType === 4) {
|
||||
req.port = port;
|
||||
|
||||
if (addressType === 4)
|
||||
err = self._handle.connect(req, address, port);
|
||||
}
|
||||
else
|
||||
err = self._handle.connect6(req, address, port);
|
||||
|
||||
} else {
|
||||
var req = new PipeConnectWrap();
|
||||
req.address = address;
|
||||
@ -930,19 +911,26 @@ Socket.prototype.connect = function(options, cb) {
|
||||
if (pipe) {
|
||||
connect(self, options.path);
|
||||
|
||||
} else if (!options.host) {
|
||||
debug('connect: missing host');
|
||||
self._host = '127.0.0.1';
|
||||
connect(self, self._host, options.port, 4);
|
||||
|
||||
} else {
|
||||
var dns = require('dns');
|
||||
var host = options.host;
|
||||
var host = options.host || 'localhost';
|
||||
var port = options.port | 0;
|
||||
var localAddress = options.localAddress;
|
||||
var localPort = options.localPort;
|
||||
var dnsopts = {
|
||||
family: options.family,
|
||||
hints: 0
|
||||
};
|
||||
|
||||
if (localAddress && !exports.isIP(localAddress))
|
||||
throw new TypeError('localAddress must be a valid IP: ' + localAddress);
|
||||
|
||||
if (localPort && !util.isNumber(localPort))
|
||||
throw new TypeError('localPort should be a number: ' + localPort);
|
||||
|
||||
if (port <= 0 || port > 65535)
|
||||
throw new RangeError('port should be > 0 and < 65536: ' + port);
|
||||
|
||||
if (dnsopts.family !== 4 && dnsopts.family !== 6)
|
||||
dnsopts.hints = dns.ADDRCONFIG | dns.V4MAPPED;
|
||||
|
||||
@ -971,19 +959,12 @@ Socket.prototype.connect = function(options, cb) {
|
||||
});
|
||||
} else {
|
||||
timers._unrefActive(self);
|
||||
|
||||
addressType = addressType || 4;
|
||||
|
||||
// node_net.cc handles null host names graciously but user land
|
||||
// expects remoteAddress to have a meaningful value
|
||||
ip = ip || (addressType === 4 ? '127.0.0.1' : '0:0:0:0:0:0:0:1');
|
||||
|
||||
connect(self,
|
||||
ip,
|
||||
options.port,
|
||||
port,
|
||||
addressType,
|
||||
options.localAddress,
|
||||
options.localPort);
|
||||
localAddress,
|
||||
localPort);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -320,6 +320,8 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
|
||||
// need to be.
|
||||
for (var i = 0, l = autoEscape.length; i < l; i++) {
|
||||
var ae = autoEscape[i];
|
||||
if (rest.indexOf(ae) === -1)
|
||||
continue;
|
||||
var esc = encodeURIComponent(ae);
|
||||
if (esc === ae) {
|
||||
esc = escape(ae);
|
||||
|
19
node.gyp
19
node.gyp
@ -249,8 +249,7 @@
|
||||
'conditions': [
|
||||
[ 'OS=="linux"', {
|
||||
'sources': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/node_dtrace_provider.o',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/libuv_dtrace_provider.o',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/node_dtrace_provider.o'
|
||||
],
|
||||
}],
|
||||
[ 'OS!="mac" and OS!="linux"', {
|
||||
@ -527,15 +526,13 @@
|
||||
{
|
||||
'action_name': 'node_dtrace_provider_o',
|
||||
'inputs': [
|
||||
'<(OBJ_DIR)/libuv/deps/uv/src/unix/core.o',
|
||||
'<(OBJ_DIR)/node/src/node_dtrace.o',
|
||||
],
|
||||
'outputs': [
|
||||
'<(OBJ_DIR)/node/src/node_dtrace_provider.o'
|
||||
],
|
||||
'action': [ 'dtrace', '-G', '-xnolibs', '-s', 'src/node_provider.d',
|
||||
'-s', 'deps/uv/src/unix/uv-dtrace.d', '<@(_inputs)',
|
||||
'-o', '<@(_outputs)' ]
|
||||
'<@(_inputs)', '-o', '<@(_outputs)' ]
|
||||
}
|
||||
]
|
||||
}],
|
||||
@ -550,17 +547,7 @@
|
||||
'action': [
|
||||
'dtrace', '-C', '-G', '-s', '<@(_inputs)', '-o', '<@(_outputs)'
|
||||
],
|
||||
},
|
||||
{
|
||||
'action_name': 'libuv_dtrace_provider_o',
|
||||
'inputs': [ 'deps/uv/src/unix/uv-dtrace.d' ],
|
||||
'outputs': [
|
||||
'<(SHARED_INTERMEDIATE_DIR)/libuv_dtrace_provider.o'
|
||||
],
|
||||
'action': [
|
||||
'dtrace', '-C', '-G', '-s', '<@(_inputs)', '-o', '<@(_outputs)'
|
||||
],
|
||||
},
|
||||
}
|
||||
],
|
||||
}],
|
||||
]
|
||||
|
@ -131,7 +131,7 @@ void CallbackInfo::WeakCallback(Isolate* isolate, Local<Object> object) {
|
||||
object->GetIndexedPropertiesExternalArrayDataType();
|
||||
size_t array_size = ExternalArraySize(array_type);
|
||||
CHECK_GT(array_size, 0);
|
||||
if (array_size > 1) {
|
||||
if (array_size > 1 && array_data != NULL) {
|
||||
CHECK_GT(array_length * array_size, array_length); // Overflow check.
|
||||
array_length *= array_size;
|
||||
}
|
||||
|
103
test/parallel/test-intl.js
Normal file
103
test/parallel/test-intl.js
Normal file
@ -0,0 +1,103 @@
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
var common = require('../common');
|
||||
var assert = require('assert');
|
||||
|
||||
// does node think that i18n was enabled?
|
||||
var enablei18n = process.config.variables.v8_enable_i18n_support;
|
||||
if (enablei18n === undefined) {
|
||||
enablei18n = false;
|
||||
}
|
||||
|
||||
// is the Intl object present?
|
||||
var haveIntl = (global.Intl != undefined);
|
||||
|
||||
// Returns true if no specific locale ids were configured (i.e. "all")
|
||||
// Else, returns true if loc is in the configured list
|
||||
// Else, returns false
|
||||
function haveLocale(loc) {
|
||||
var locs = process.config.variables.icu_locales.split(',');
|
||||
return locs.indexOf(loc) !== -1;
|
||||
}
|
||||
|
||||
if (!haveIntl) {
|
||||
var erMsg =
|
||||
'"Intl" object is NOT present but v8_enable_i18n_support is ' +
|
||||
enablei18n;
|
||||
assert.equal(enablei18n, false, erMsg);
|
||||
console.log('Skipping Intl tests because Intl object not present.');
|
||||
|
||||
} else {
|
||||
var erMsg =
|
||||
'"Intl" object is present but v8_enable_i18n_support is ' +
|
||||
enablei18n +
|
||||
'. Is this test out of date?';
|
||||
assert.equal(enablei18n, true, erMsg);
|
||||
|
||||
// Construct a new date at the beginning of Unix time
|
||||
var date0 = new Date(0);
|
||||
|
||||
// Use the GMT time zone
|
||||
var GMT = 'Etc/GMT';
|
||||
|
||||
// Construct an English formatter. Should format to "Jan 70"
|
||||
var dtf =
|
||||
new Intl.DateTimeFormat(['en'],
|
||||
{timeZone: GMT, month: 'short', year: '2-digit'});
|
||||
|
||||
// If list is specified and doesn't contain 'en' then return.
|
||||
if (process.config.variables.icu_locales && !haveLocale('en')) {
|
||||
console.log('Skipping detailed Intl tests because English is not listed ' +
|
||||
'as supported.');
|
||||
// Smoke test. Does it format anything, or fail?
|
||||
console.log('Date(0) formatted to: ' + dtf.format(date0));
|
||||
return;
|
||||
}
|
||||
|
||||
// Check with toLocaleString
|
||||
var localeString = dtf.format(date0);
|
||||
assert.equal(localeString, 'Jan 70');
|
||||
|
||||
// Options to request GMT
|
||||
var optsGMT = {timeZone: GMT};
|
||||
|
||||
// Test format
|
||||
localeString = date0.toLocaleString(['en'], optsGMT);
|
||||
assert.equal(localeString, '1/1/1970, 12:00:00 AM');
|
||||
|
||||
// number format
|
||||
assert.equal(new Intl.NumberFormat(['en']).format(12345.67890), '12,345.679');
|
||||
|
||||
var collOpts = { sensitivity: 'base', ignorePunctuation: true };
|
||||
var coll = new Intl.Collator(['en'], collOpts);
|
||||
|
||||
assert.equal(coll.compare('blackbird', 'black-bird'), 0,
|
||||
'ignore punctuation failed');
|
||||
assert.equal(coll.compare('blackbird', 'red-bird'), -1,
|
||||
'compare less failed');
|
||||
assert.equal(coll.compare('bluebird', 'blackbird'), 1,
|
||||
'compare greater failed');
|
||||
assert.equal(coll.compare('Bluebird', 'bluebird'), 0,
|
||||
'ignore case failed');
|
||||
assert.equal(coll.compare('\ufb03', 'ffi'), 0,
|
||||
'ffi ligature (contraction) failed');
|
||||
}
|
@ -23,39 +23,30 @@ var common = require('../common');
|
||||
var assert = require('assert');
|
||||
var net = require('net');
|
||||
|
||||
var server = net.createServer(function(socket) {
|
||||
assert.ok(false, 'no clients should connect');
|
||||
}).listen(common.PORT).on('listening', function() {
|
||||
server.unref();
|
||||
connect({
|
||||
host: 'localhost',
|
||||
port: common.PORT,
|
||||
localPort: 'foobar',
|
||||
}, 'localPort should be a number: foobar');
|
||||
|
||||
function test1(next) {
|
||||
connect({
|
||||
host: '127.0.0.1',
|
||||
port: common.PORT,
|
||||
localPort: 'foobar',
|
||||
},
|
||||
'localPort should be a number: foobar',
|
||||
next);
|
||||
}
|
||||
connect({
|
||||
host: 'localhost',
|
||||
port: common.PORT,
|
||||
localAddress: 'foobar',
|
||||
}, 'localAddress should be a valid IP: foobar');
|
||||
|
||||
function test2(next) {
|
||||
connect({
|
||||
host: '127.0.0.1',
|
||||
port: common.PORT,
|
||||
localAddress: 'foobar',
|
||||
},
|
||||
'localAddress should be a valid IP: foobar',
|
||||
next)
|
||||
}
|
||||
connect({
|
||||
host: 'localhost',
|
||||
port: 65536
|
||||
}, 'port should be > 0 and < 65536: 65536');
|
||||
|
||||
test1(test2);
|
||||
})
|
||||
connect({
|
||||
host: 'localhost',
|
||||
port: 0
|
||||
}, 'port should be > 0 and < 65536: 0');
|
||||
|
||||
function connect(opts, msg, cb) {
|
||||
var client = net.connect(opts).on('connect', function() {
|
||||
assert.ok(false, 'we should never connect');
|
||||
}).on('error', function(err) {
|
||||
assert.strictEqual(err.message, msg);
|
||||
if (cb) cb();
|
||||
});
|
||||
function connect(opts, msg) {
|
||||
assert.throws(function() {
|
||||
var client = net.connect(opts);
|
||||
}, msg);
|
||||
}
|
||||
|
@ -41,9 +41,16 @@ var handles = [];
|
||||
})();
|
||||
|
||||
(function() {
|
||||
function onlookup() {
|
||||
setImmediate(function() {
|
||||
assert.equal(process._getActiveRequests().length, 0);
|
||||
});
|
||||
};
|
||||
|
||||
expect(1, 0);
|
||||
var conn = net.createConnection(common.PORT);
|
||||
conn.on('error', function() { /* ignore */ });
|
||||
conn.on('lookup', onlookup);
|
||||
conn.on('error', function() { assert(false); });
|
||||
expect(2, 1);
|
||||
conn.destroy();
|
||||
expect(2, 1); // client handle doesn't shut down until next tick
|
||||
@ -52,10 +59,15 @@ var handles = [];
|
||||
|
||||
(function() {
|
||||
var n = 0;
|
||||
|
||||
handles.forEach(function(handle) {
|
||||
handle.once('close', onclose);
|
||||
});
|
||||
function onclose() {
|
||||
if (++n === handles.length) setImmediate(expect, 0, 0);
|
||||
if (++n === handles.length) {
|
||||
setImmediate(function() {
|
||||
assert.equal(process._getActiveHandles().length, 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
@ -81,7 +81,7 @@ test('writable side consumption', function(t) {
|
||||
t.equal(tx._readableState.length, 10);
|
||||
t.equal(transformed, 10);
|
||||
t.equal(tx._transformState.writechunk.length, 5);
|
||||
t.same(tx._writableState.buffer.map(function(c) {
|
||||
t.same(tx._writableState.getBuffer().map(function(c) {
|
||||
return c.chunk.length;
|
||||
}), [6, 7, 8, 9, 10]);
|
||||
|
||||
|
127
tools/configure.d/nodedownload.py
Normal file
127
tools/configure.d/nodedownload.py
Normal file
@ -0,0 +1,127 @@
|
||||
#!/usr/bin/env python
|
||||
# Moved some utilities here from ../../configure
|
||||
|
||||
import urllib
|
||||
import hashlib
|
||||
import sys
|
||||
import zipfile
|
||||
import tarfile
|
||||
import fpformat
|
||||
import contextlib
|
||||
|
||||
def formatSize(amt):
|
||||
"""Format a size as a string in MB"""
|
||||
return fpformat.fix(amt / 1024000., 1)
|
||||
|
||||
def spin(c):
|
||||
"""print out an ASCII 'spinner' based on the value of counter 'c'"""
|
||||
spin = ".:|'"
|
||||
return (spin[c % len(spin)])
|
||||
|
||||
class ConfigOpener(urllib.FancyURLopener):
|
||||
"""fancy opener used by retrievefile. Set a UA"""
|
||||
# append to existing version (UA)
|
||||
version = '%s node.js/configure' % urllib.URLopener.version
|
||||
|
||||
def reporthook(count, size, total):
|
||||
"""internal hook used by retrievefile"""
|
||||
sys.stdout.write(' Fetch: %c %sMB total, %sMB downloaded \r' %
|
||||
(spin(count),
|
||||
formatSize(total),
|
||||
formatSize(count*size)))
|
||||
|
||||
def retrievefile(url, targetfile):
|
||||
"""fetch file 'url' as 'targetfile'. Return targetfile or throw."""
|
||||
try:
|
||||
sys.stdout.write(' <%s>\nConnecting...\r' % url)
|
||||
sys.stdout.flush()
|
||||
msg = ConfigOpener().retrieve(url, targetfile, reporthook=reporthook)
|
||||
print '' # clear the line
|
||||
return targetfile
|
||||
except:
|
||||
print ' ** Error occurred while downloading\n <%s>' % url
|
||||
raise
|
||||
|
||||
def md5sum(targetfile):
|
||||
"""md5sum a file. Return the hex digest."""
|
||||
digest = hashlib.md5()
|
||||
with open(targetfile, 'rb') as f:
|
||||
chunk = f.read(1024)
|
||||
while chunk != "":
|
||||
digest.update(chunk)
|
||||
chunk = f.read(1024)
|
||||
return digest.hexdigest()
|
||||
|
||||
def unpack(packedfile, parent_path):
|
||||
"""Unpacks packedfile into parent_path. Assumes .zip. Returns parent_path"""
|
||||
if zipfile.is_zipfile(packedfile):
|
||||
with contextlib.closing(zipfile.ZipFile(packedfile, 'r')) as icuzip:
|
||||
print ' Extracting zipfile: %s' % packedfile
|
||||
icuzip.extractall(parent_path)
|
||||
return parent_path
|
||||
elif tarfile.is_tarfile(packedfile):
|
||||
with tarfile.TarFile.open(packedfile, 'r') as icuzip:
|
||||
print ' Extracting tarfile: %s' % packedfile
|
||||
icuzip.extractall(parent_path)
|
||||
return parent_path
|
||||
else:
|
||||
packedsuffix = packedfile.lower().split('.')[-1] # .zip, .tgz etc
|
||||
raise Exception('Error: Don\'t know how to unpack %s with extension %s' % (packedfile, packedsuffix))
|
||||
|
||||
# List of possible "--download=" types.
|
||||
download_types = set(['icu'])
|
||||
|
||||
# Default options for --download.
|
||||
download_default = "none"
|
||||
|
||||
def help():
|
||||
"""This function calculates the '--help' text for '--download'."""
|
||||
return """Select which packages may be auto-downloaded.
|
||||
valid values are: none, all, %s. (default is "%s").""" % (", ".join(download_types), download_default)
|
||||
|
||||
def set2dict(keys, value=None):
|
||||
"""Convert some keys (iterable) to a dict."""
|
||||
return dict((key, value) for (key) in keys)
|
||||
|
||||
def parse(opt):
|
||||
"""This function parses the options to --download and returns a set such as { icu: true }, etc. """
|
||||
if not opt:
|
||||
opt = download_default
|
||||
|
||||
theOpts = set(opt.split(','))
|
||||
|
||||
if 'all' in theOpts:
|
||||
# all on
|
||||
return set2dict(download_types, True)
|
||||
elif 'none' in theOpts:
|
||||
# all off
|
||||
return set2dict(download_types, False)
|
||||
|
||||
# OK. Now, process each of the opts.
|
||||
theRet = set2dict(download_types, False)
|
||||
for anOpt in opt.split(','):
|
||||
if not anOpt or anOpt == "":
|
||||
# ignore stray commas, etc.
|
||||
continue
|
||||
elif anOpt is 'all':
|
||||
# all on
|
||||
theRet = dict((key, True) for (key) in download_types)
|
||||
else:
|
||||
# turn this one on
|
||||
if anOpt in download_types:
|
||||
theRet[anOpt] = True
|
||||
else:
|
||||
# future proof: ignore unknown types
|
||||
print 'Warning: ignoring unknown --download= type "%s"' % anOpt
|
||||
# all done
|
||||
return theRet
|
||||
|
||||
def candownload(auto_downloads, package):
|
||||
if not (package in auto_downloads.keys()):
|
||||
raise Exception('Internal error: "%s" is not in the --downloads list. Check nodedownload.py' % package)
|
||||
if auto_downloads[package]:
|
||||
return True
|
||||
else:
|
||||
print """Warning: Not downloading package "%s". You could pass "--download=all"
|
||||
(Windows: "download-all") to try auto-downloading it.""" % package
|
||||
return False
|
@ -11,6 +11,17 @@
|
||||
},
|
||||
'includes': [ '../../icu_config.gypi' ],
|
||||
'targets': [
|
||||
{
|
||||
# a target for additional uconfig defines, target only
|
||||
'target_name': 'icu_uconfig_target',
|
||||
'type': 'none',
|
||||
'toolsets': [ 'target' ],
|
||||
'direct_dependent_settings': {
|
||||
'defines': [
|
||||
'UCONFIG_NO_CONVERSION=1',
|
||||
]
|
||||
},
|
||||
},
|
||||
{
|
||||
# a target to hold uconfig defines.
|
||||
# for now these are hard coded, but could be defined.
|
||||
@ -92,24 +103,74 @@
|
||||
},
|
||||
{
|
||||
'target_name': 'icui18n',
|
||||
'type': '<(library)',
|
||||
'toolsets': [ 'target' ],
|
||||
'sources': [
|
||||
'<@(icu_src_i18n)'
|
||||
'toolsets': [ 'target', 'host' ],
|
||||
'conditions' : [
|
||||
['_toolset=="target"', {
|
||||
'type': '<(library)',
|
||||
'sources': [
|
||||
'<@(icu_src_i18n)'
|
||||
],
|
||||
'conditions': [
|
||||
[ 'icu_ver_major == 54', { 'sources!': [
|
||||
## Strip out the following for ICU 54 only.
|
||||
## add more conditions in the future?
|
||||
## if your compiler can dead-strip, this will
|
||||
## make ZERO difference to binary size.
|
||||
## Made ICU-specific for future-proofing.
|
||||
|
||||
# alphabetic index
|
||||
'../../deps/icu/source/i18n/alphaindex.cpp',
|
||||
# BOCSU
|
||||
# misc
|
||||
'../../deps/icu/source/i18n/regexcmp.cpp',
|
||||
'../../deps/icu/source/i18n/regexcmp.h',
|
||||
'../../deps/icu/source/i18n/regexcst.h',
|
||||
'../../deps/icu/source/i18n/regeximp.cpp',
|
||||
'../../deps/icu/source/i18n/regeximp.h',
|
||||
'../../deps/icu/source/i18n/regexst.cpp',
|
||||
'../../deps/icu/source/i18n/regexst.h',
|
||||
'../../deps/icu/source/i18n/regextxt.cpp',
|
||||
'../../deps/icu/source/i18n/regextxt.h',
|
||||
'../../deps/icu/source/i18n/region.cpp',
|
||||
'../../deps/icu/source/i18n/region_impl.h',
|
||||
'../../deps/icu/source/i18n/reldatefmt.cpp',
|
||||
'../../deps/icu/source/i18n/reldatefmt.h'
|
||||
'../../deps/icu/source/i18n/scientificformathelper.cpp',
|
||||
'../../deps/icu/source/i18n/tmunit.cpp',
|
||||
'../../deps/icu/source/i18n/tmutamt.cpp',
|
||||
'../../deps/icu/source/i18n/tmutfmt.cpp',
|
||||
'../../deps/icu/source/i18n/uregex.cpp',
|
||||
'../../deps/icu/source/i18n/uregexc.cpp',
|
||||
'../../deps/icu/source/i18n/uregion.cpp',
|
||||
'../../deps/icu/source/i18n/uspoof.cpp',
|
||||
'../../deps/icu/source/i18n/uspoof_build.cpp',
|
||||
'../../deps/icu/source/i18n/uspoof_conf.cpp',
|
||||
'../../deps/icu/source/i18n/uspoof_conf.h',
|
||||
'../../deps/icu/source/i18n/uspoof_impl.cpp',
|
||||
'../../deps/icu/source/i18n/uspoof_impl.h',
|
||||
'../../deps/icu/source/i18n/uspoof_wsconf.cpp',
|
||||
'../../deps/icu/source/i18n/uspoof_wsconf.h',
|
||||
]}]],
|
||||
'include_dirs': [
|
||||
'../../deps/icu/source/i18n',
|
||||
],
|
||||
'defines': [
|
||||
'U_I18N_IMPLEMENTATION=1',
|
||||
],
|
||||
'dependencies': [ 'icuucx', 'icu_implementation', 'icu_uconfig', 'icu_uconfig_target' ],
|
||||
'direct_dependent_settings': {
|
||||
'include_dirs': [
|
||||
'../../deps/icu/source/i18n',
|
||||
],
|
||||
},
|
||||
'export_dependent_settings': [ 'icuucx', 'icu_uconfig_target' ],
|
||||
}],
|
||||
['_toolset=="host"', {
|
||||
'type': 'none',
|
||||
'dependencies': [ 'icutools' ],
|
||||
'export_dependent_settings': [ 'icutools' ],
|
||||
}],
|
||||
],
|
||||
'include_dirs': [
|
||||
'../../deps/icu/source/i18n',
|
||||
],
|
||||
'defines': [
|
||||
'U_I18N_IMPLEMENTATION=1',
|
||||
],
|
||||
'dependencies': [ 'icuucx', 'icu_implementation', 'icu_uconfig' ],
|
||||
'direct_dependent_settings': {
|
||||
'include_dirs': [
|
||||
'../../deps/icu/source/i18n',
|
||||
],
|
||||
},
|
||||
'export_dependent_settings': [ 'icuucx' ],
|
||||
},
|
||||
# This exports actual ICU data
|
||||
{
|
||||
@ -146,32 +207,33 @@
|
||||
# trim down ICU
|
||||
'action_name': 'icutrim',
|
||||
'inputs': [ '<(icu_data_in)', 'icu_small.json' ],
|
||||
'outputs': [ '../../out/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
|
||||
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
|
||||
'action': [ 'python',
|
||||
'icutrim.py',
|
||||
'-P', '../../<(CONFIGURATION_NAME)',
|
||||
'-D', '<(icu_data_in)',
|
||||
'--delete-tmp',
|
||||
'-T', '../../out/icutmp',
|
||||
'-T', '<(SHARED_INTERMEDIATE_DIR)/icutmp',
|
||||
'-F', 'icu_small.json',
|
||||
'-O', 'icudt<(icu_ver_major)<(icu_endianness).dat',
|
||||
'-v' ],
|
||||
'-v',
|
||||
'-L', '<(icu_locales)'],
|
||||
},
|
||||
{
|
||||
# build final .dat -> .obj
|
||||
'action_name': 'genccode',
|
||||
'inputs': [ '../../out/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
|
||||
'outputs': [ '../../out/icudt<(icu_ver_major)<(icu_endianness)_dat.obj' ],
|
||||
'inputs': [ '<(SHARED_INTERMEDIATE_DIR)/icutmp/icudt<(icu_ver_major)<(icu_endianness).dat' ],
|
||||
'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness)_dat.obj' ],
|
||||
'action': [ '../../<(CONFIGURATION_NAME)/genccode',
|
||||
'-o',
|
||||
'-d', '../../out/',
|
||||
'-d', '<(SHARED_INTERMEDIATE_DIR)/',
|
||||
'-n', 'icudata',
|
||||
'-e', 'icusmdt<(icu_ver_major)',
|
||||
'<@(_inputs)' ],
|
||||
},
|
||||
],
|
||||
# This file contains the small ICU data.
|
||||
'sources': [ '../../out/icudt<(icu_ver_major)<(icu_endianness)_dat.obj' ],
|
||||
'sources': [ '<(SHARED_INTERMEDIATE_DIR)/icudt<(icu_ver_major)<(icu_endianness)_dat.obj' ],
|
||||
} ] ], #end of OS==win and icu_small == true
|
||||
}, { # OS != win
|
||||
'conditions': [
|
||||
@ -235,7 +297,8 @@
|
||||
'-T', '<(SHARED_INTERMEDIATE_DIR)/icutmp',
|
||||
'-F', 'icu_small.json',
|
||||
'-O', 'icudt<(icu_ver_major)<(icu_endianness).dat',
|
||||
'-v' ],
|
||||
'-v',
|
||||
'-L', '<(icu_locales)'],
|
||||
}, {
|
||||
# rename to get the final entrypoint name right
|
||||
'action_name': 'rename',
|
||||
@ -284,19 +347,51 @@
|
||||
{
|
||||
'target_name': 'icuuc',
|
||||
'type': 'none',
|
||||
'toolsets': [ 'target' ],
|
||||
'dependencies': [ 'icuucx', 'icudata' ],
|
||||
'export_dependent_settings': [ 'icuucx', 'icudata' ],
|
||||
'toolsets': [ 'target', 'host' ],
|
||||
'conditions' : [
|
||||
['_toolset=="host"', {
|
||||
'dependencies': [ 'icutools' ],
|
||||
'export_dependent_settings': [ 'icutools' ],
|
||||
}],
|
||||
['_toolset=="target"', {
|
||||
'dependencies': [ 'icuucx', 'icudata' ],
|
||||
'export_dependent_settings': [ 'icuucx', 'icudata' ],
|
||||
}],
|
||||
],
|
||||
},
|
||||
# This is the 'real' icuuc.
|
||||
# tools can depend on 'icuuc + stubdata'
|
||||
{
|
||||
'target_name': 'icuucx',
|
||||
'type': '<(library)',
|
||||
'dependencies': [ 'icu_implementation', 'icu_uconfig' ],
|
||||
'dependencies': [ 'icu_implementation', 'icu_uconfig', 'icu_uconfig_target' ],
|
||||
'toolsets': [ 'target' ],
|
||||
'sources': [
|
||||
'<@(icu_src_common)'
|
||||
'<@(icu_src_common)',
|
||||
],
|
||||
'conditions': [
|
||||
[ 'icu_ver_major == 54', { 'sources!': [
|
||||
## Strip out the following for ICU 54 only.
|
||||
## add more conditions in the future?
|
||||
## if your compiler can dead-strip, this will
|
||||
## make ZERO difference to binary size.
|
||||
## Made ICU-specific for future-proofing.
|
||||
|
||||
# bidi- not needed (yet!)
|
||||
'../../deps/icu/source/common/ubidi.c',
|
||||
'../../deps/icu/source/common/ubidiimp.h',
|
||||
'../../deps/icu/source/common/ubidiln.c',
|
||||
'../../deps/icu/source/common/ubidiwrt.c',
|
||||
#'../../deps/icu/source/common/ubidi_props.c',
|
||||
#'../../deps/icu/source/common/ubidi_props.h',
|
||||
#'../../deps/icu/source/common/ubidi_props_data.h',
|
||||
# and the callers
|
||||
'../../deps/icu/source/common/ushape.cpp',
|
||||
'../../deps/icu/source/common/usprep.cpp',
|
||||
'../../deps/icu/source/common/uts46.cpp',
|
||||
]}],
|
||||
[ 'OS == "solaris"', { 'defines': [
|
||||
'_XOPEN_SOURCE_EXTENDED=0',
|
||||
]}],
|
||||
],
|
||||
'include_dirs': [
|
||||
'../../deps/icu/source/common',
|
||||
@ -304,7 +399,8 @@
|
||||
'defines': [
|
||||
'U_COMMON_IMPLEMENTATION=1',
|
||||
],
|
||||
'export_dependent_settings': [ 'icu_uconfig' ],
|
||||
'cflags_c': ['-std=c99'],
|
||||
'export_dependent_settings': [ 'icu_uconfig', 'icu_uconfig_target' ],
|
||||
'direct_dependent_settings': {
|
||||
'include_dirs': [
|
||||
'../../deps/icu/source/common',
|
||||
@ -331,6 +427,12 @@
|
||||
'<@(icu_src_io)',
|
||||
'<@(icu_src_stubdata)',
|
||||
],
|
||||
'sources!': [
|
||||
'../../deps/icu/source/tools/toolutil/udbgutil.cpp',
|
||||
'../../deps/icu/source/tools/toolutil/udbgutil.h',
|
||||
'../../deps/icu/source/tools/toolutil/dbgutil.cpp',
|
||||
'../../deps/icu/source/tools/toolutil/dbgutil.h',
|
||||
],
|
||||
'include_dirs': [
|
||||
'../../deps/icu/source/common',
|
||||
'../../deps/icu/source/i18n',
|
||||
@ -344,6 +446,12 @@
|
||||
'U_TOOLUTIL_IMPLEMENTATION=1',
|
||||
#'DEBUG=0', # http://bugs.icu-project.org/trac/ticket/10977
|
||||
],
|
||||
'cflags_c': ['-std=c99'],
|
||||
'conditions': [
|
||||
['OS == "solaris"', {
|
||||
'defines': [ '_XOPEN_SOURCE_EXTENDED=0' ]
|
||||
}]
|
||||
],
|
||||
'direct_dependent_settings': {
|
||||
'include_dirs': [
|
||||
'../../deps/icu/source/common',
|
||||
@ -359,7 +467,7 @@
|
||||
}],
|
||||
],
|
||||
},
|
||||
'export_dependent_settings': [ 'icu_implementation', 'icu_uconfig' ],
|
||||
'export_dependent_settings': [ 'icu_uconfig' ],
|
||||
},
|
||||
# This tool is needed to rebuild .res files from .txt,
|
||||
# or to build index (res_index.txt) files for small-icu
|
||||
|
@ -1,11 +1,11 @@
|
||||
{
|
||||
"copyright": "Copyright (c) 2014 IBM Corporation and Others. All Rights Reserved.",
|
||||
"comment": "icutrim.py config: Trim down ICU to just English, needed for node.js use.",
|
||||
"comment": "icutrim.py config: Trim down ICU to just a certain locale set, needed for node.js use.",
|
||||
"variables": {
|
||||
"none": {
|
||||
"only": []
|
||||
},
|
||||
"en_only": {
|
||||
"locales": {
|
||||
"only": [
|
||||
"root",
|
||||
"en"
|
||||
@ -15,20 +15,21 @@
|
||||
}
|
||||
},
|
||||
"trees": {
|
||||
"ROOT": "en_only",
|
||||
"ROOT": "locales",
|
||||
"brkitr": "none",
|
||||
"coll": "en_only",
|
||||
"curr": "en_only",
|
||||
"coll": "locales",
|
||||
"curr": "locales",
|
||||
"lang": "none",
|
||||
"rbnf": "none",
|
||||
"region": "none",
|
||||
"zone": "en_only",
|
||||
"zone": "locales",
|
||||
"converters": "none",
|
||||
"stringprep": "none",
|
||||
"translit": "none",
|
||||
"brkfiles": "none",
|
||||
"brkdict": "none",
|
||||
"confusables": "none"
|
||||
"confusables": "none",
|
||||
"unit": "none"
|
||||
},
|
||||
"remove": [
|
||||
"cnvalias.icu",
|
||||
|
@ -65,6 +65,12 @@ parser.add_option("-v","--verbose",
|
||||
action="count",
|
||||
default=0)
|
||||
|
||||
parser.add_option('-L',"--locales",
|
||||
action="store",
|
||||
dest="locales",
|
||||
help="sets the 'locales.only' variable",
|
||||
default=None)
|
||||
|
||||
parser.add_option('-e', '--endian', action='store', dest='endian', help='endian, big, little or host, your default is "%s".' % endian, default=endian, metavar='endianness')
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
@ -147,6 +153,13 @@ fi= open(options.filterfile, "rb")
|
||||
config=json.load(fi)
|
||||
fi.close()
|
||||
|
||||
if (options.locales):
|
||||
if not config.has_key("variables"):
|
||||
config["variables"] = {}
|
||||
if not config["variables"].has_key("locales"):
|
||||
config["variables"]["locales"] = {}
|
||||
config["variables"]["locales"]["only"] = options.locales.split(',')
|
||||
|
||||
if (options.verbose > 6):
|
||||
print config
|
||||
|
||||
|
@ -36,6 +36,7 @@ set noperfctr=
|
||||
set noperfctr_arg=
|
||||
set noperfctr_msi_arg=
|
||||
set i18n_arg=
|
||||
set download_arg=
|
||||
|
||||
:next-arg
|
||||
if "%1"=="" goto args-done
|
||||
@ -65,6 +66,8 @@ if /i "%1"=="upload" set upload=1&goto arg-ok
|
||||
if /i "%1"=="jslint" set jslint=1&goto arg-ok
|
||||
if /i "%1"=="small-icu" set i18n_arg=%1&goto arg-ok
|
||||
if /i "%1"=="full-icu" set i18n_arg=%1&goto arg-ok
|
||||
if /i "%1"=="intl-none" set i18n_arg=%1&goto arg-ok
|
||||
if /i "%1"=="download-all" set download_arg="--download=all"&goto arg-ok
|
||||
|
||||
echo Warning: ignoring invalid command line option `%1`.
|
||||
|
||||
@ -85,6 +88,7 @@ if defined noperfctr set noperfctr_arg=--without-perfctr& set noperfctr_msi_arg=
|
||||
|
||||
if "%i18n_arg%"=="full-icu" set i18n_arg=--with-intl=full-icu
|
||||
if "%i18n_arg%"=="small-icu" set i18n_arg=--with-intl=small-icu
|
||||
if "%i18n_arg%"=="intl-none" set i18n_arg=--with-intl=none
|
||||
|
||||
:project-gen
|
||||
@rem Skip project generation if requested.
|
||||
@ -95,7 +99,7 @@ if defined NIGHTLY set TAG=nightly-%NIGHTLY%
|
||||
@rem Generate the VS project.
|
||||
SETLOCAL
|
||||
if defined VS100COMNTOOLS call "%VS100COMNTOOLS%\VCVarsQueryRegistry.bat"
|
||||
python configure %i18n_arg% %debug_arg% %nosnapshot_arg% %noetw_arg% %noperfctr_arg% --dest-cpu=%target_arch% --tag=%TAG%
|
||||
python configure %download_arg% %i18n_arg% %debug_arg% %nosnapshot_arg% %noetw_arg% %noperfctr_arg% --dest-cpu=%target_arch% --tag=%TAG%
|
||||
if errorlevel 1 goto create-msvs-files-failed
|
||||
if not exist node.sln goto create-msvs-files-failed
|
||||
echo Project files generated.
|
||||
@ -210,7 +214,7 @@ python tools/closure_linter/closure_linter/gjslint.py --unix_mode --strict --noj
|
||||
goto exit
|
||||
|
||||
:help
|
||||
echo vcbuild.bat [debug/release] [msi] [test-all/test-uv/test-internet/test-pummel/test-simple/test-message] [clean] [noprojgen] [nobuild] [nosign] [x86/x64]
|
||||
echo vcbuild.bat [debug/release] [msi] [test-all/test-uv/test-internet/test-pummel/test-simple/test-message] [clean] [noprojgen] [small-icu/full-icu/intl-none] [nobuild] [nosign] [x86/x64] [download-all]
|
||||
echo Examples:
|
||||
echo vcbuild.bat : builds release build
|
||||
echo vcbuild.bat debug : builds debug build
|
||||
|
Loading…
x
Reference in New Issue
Block a user