mt-libuv 4.1.0 → 4.1.03
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/ext/Rakefile +1 -1
- data/ext/gyp/.gitignore +1 -0
- data/ext/gyp/AUTHORS +17 -0
- data/ext/gyp/DEPS +23 -0
- data/ext/gyp/LICENSE +27 -0
- data/ext/gyp/OWNERS +1 -0
- data/ext/gyp/PRESUBMIT.py +125 -0
- data/ext/gyp/README.md +5 -0
- data/ext/gyp/buildbot/buildbot_run.py +138 -0
- data/ext/gyp/buildbot/commit_queue/OWNERS +6 -0
- data/ext/gyp/buildbot/commit_queue/README +3 -0
- data/ext/gyp/buildbot/commit_queue/cq_config.json +15 -0
- data/ext/gyp/buildbot/travis-checkout.sh +27 -0
- data/ext/gyp/buildbot/travis-test.sh +12 -0
- data/ext/gyp/codereview.settings +6 -0
- data/ext/gyp/data/win/large-pdb-shim.cc +12 -0
- data/ext/gyp/gyp +8 -0
- data/ext/gyp/gyp.bat +5 -0
- data/ext/gyp/gyp_main.py +16 -0
- data/ext/gyp/gyptest.py +243 -0
- data/ext/gyp/pylib/gyp/MSVSNew.py +353 -0
- data/ext/gyp/pylib/gyp/MSVSProject.py +208 -0
- data/ext/gyp/pylib/gyp/MSVSSettings.py +1106 -0
- data/ext/gyp/pylib/gyp/MSVSSettings_test.py +1486 -0
- data/ext/gyp/pylib/gyp/MSVSToolFile.py +58 -0
- data/ext/gyp/pylib/gyp/MSVSUserFile.py +147 -0
- data/ext/gyp/pylib/gyp/MSVSUtil.py +271 -0
- data/ext/gyp/pylib/gyp/MSVSVersion.py +504 -0
- data/ext/gyp/pylib/gyp/__init__.py +555 -0
- data/ext/gyp/pylib/gyp/common.py +619 -0
- data/ext/gyp/pylib/gyp/common_test.py +73 -0
- data/ext/gyp/pylib/gyp/easy_xml.py +170 -0
- data/ext/gyp/pylib/gyp/easy_xml_test.py +106 -0
- data/ext/gyp/pylib/gyp/flock_tool.py +54 -0
- data/ext/gyp/pylib/gyp/generator/__init__.py +0 -0
- data/ext/gyp/pylib/gyp/generator/analyzer.py +744 -0
- data/ext/gyp/pylib/gyp/generator/cmake.py +1256 -0
- data/ext/gyp/pylib/gyp/generator/dump_dependency_json.py +101 -0
- data/ext/gyp/pylib/gyp/generator/eclipse.py +425 -0
- data/ext/gyp/pylib/gyp/generator/gypd.py +94 -0
- data/ext/gyp/pylib/gyp/generator/gypsh.py +56 -0
- data/ext/gyp/pylib/gyp/generator/make.py +2260 -0
- data/ext/gyp/pylib/gyp/generator/msvs.py +3537 -0
- data/ext/gyp/pylib/gyp/generator/msvs_test.py +40 -0
- data/ext/gyp/pylib/gyp/generator/ninja.py +2500 -0
- data/ext/gyp/pylib/gyp/generator/ninja_test.py +46 -0
- data/ext/gyp/pylib/gyp/generator/xcode.py +1302 -0
- data/ext/gyp/pylib/gyp/generator/xcode_test.py +23 -0
- data/ext/gyp/pylib/gyp/input.py +2908 -0
- data/ext/gyp/pylib/gyp/input_test.py +90 -0
- data/ext/gyp/pylib/gyp/mac_tool.py +721 -0
- data/ext/gyp/pylib/gyp/msvs_emulation.py +1112 -0
- data/ext/gyp/pylib/gyp/ninja_syntax.py +168 -0
- data/ext/gyp/pylib/gyp/simple_copy.py +57 -0
- data/ext/gyp/pylib/gyp/win_tool.py +326 -0
- data/ext/gyp/pylib/gyp/xcode_emulation.py +1800 -0
- data/ext/gyp/pylib/gyp/xcode_ninja.py +289 -0
- data/ext/gyp/pylib/gyp/xcodeproj_file.py +2995 -0
- data/ext/gyp/pylib/gyp/xml_fix.py +68 -0
- data/ext/gyp/samples/samples +83 -0
- data/ext/gyp/samples/samples.bat +5 -0
- data/ext/gyp/setup.py +19 -0
- data/ext/gyp/test/actions/generated-header/action.py +11 -0
- data/ext/gyp/test/actions/generated-header/main.cc +7 -0
- data/ext/gyp/test/actions/generated-header/test.gyp +34 -0
- data/ext/gyp/test/actions/gyptest-all.py +101 -0
- data/ext/gyp/test/actions/gyptest-default.py +68 -0
- data/ext/gyp/test/actions/gyptest-errors.py +24 -0
- data/ext/gyp/test/actions/gyptest-generated-header.py +38 -0
- data/ext/gyp/test/actions/src/action_missing_name.gyp +24 -0
- data/ext/gyp/test/actions/src/actions.gyp +114 -0
- data/ext/gyp/test/actions/src/confirm-dep-files.py +21 -0
- data/ext/gyp/test/actions/src/subdir1/counter.py +44 -0
- data/ext/gyp/test/actions/src/subdir1/executable.gyp +74 -0
- data/ext/gyp/test/actions/src/subdir1/make-prog1.py +20 -0
- data/ext/gyp/test/actions/src/subdir1/make-prog2.py +20 -0
- data/ext/gyp/test/actions/src/subdir1/program.c +12 -0
- data/ext/gyp/test/actions/src/subdir2/make-file.py +11 -0
- data/ext/gyp/test/actions/src/subdir2/none.gyp +33 -0
- data/ext/gyp/test/actions/src/subdir3/generate_main.py +21 -0
- data/ext/gyp/test/actions/src/subdir3/null_input.gyp +29 -0
- data/ext/gyp/test/actions-bare/gyptest-bare.py +24 -0
- data/ext/gyp/test/actions-bare/src/bare.gyp +25 -0
- data/ext/gyp/test/actions-bare/src/bare.py +11 -0
- data/ext/gyp/test/actions-depfile/depfile.gyp +42 -0
- data/ext/gyp/test/actions-depfile/gyptest-all.py +30 -0
- data/ext/gyp/test/actions-depfile/input.txt +1 -0
- data/ext/gyp/test/actions-depfile/touch.py +18 -0
- data/ext/gyp/test/actions-multiple/gyptest-all.py +72 -0
- data/ext/gyp/test/actions-multiple/src/actions.gyp +226 -0
- data/ext/gyp/test/actions-multiple/src/copyfile.py +9 -0
- data/ext/gyp/test/actions-multiple/src/filter.py +12 -0
- data/ext/gyp/test/actions-multiple/src/foo.c +11 -0
- data/ext/gyp/test/actions-multiple/src/input.txt +1 -0
- data/ext/gyp/test/actions-multiple/src/main.c +22 -0
- data/ext/gyp/test/actions-multiple-outputs/gyptest-multiple-outputs.py +45 -0
- data/ext/gyp/test/actions-multiple-outputs/src/multiple-outputs.gyp +23 -0
- data/ext/gyp/test/actions-multiple-outputs/src/touch.py +16 -0
- data/ext/gyp/test/actions-multiple-outputs-with-dependencies/gyptest-action.py +45 -0
- data/ext/gyp/test/actions-multiple-outputs-with-dependencies/src/action.gyp +28 -0
- data/ext/gyp/test/actions-multiple-outputs-with-dependencies/src/rcopy.py +20 -0
- data/ext/gyp/test/actions-none/gyptest-none.py +24 -0
- data/ext/gyp/test/actions-none/src/fake_cross.py +12 -0
- data/ext/gyp/test/actions-none/src/foo.cc +1 -0
- data/ext/gyp/test/actions-none/src/none_with_source_files.gyp +35 -0
- data/ext/gyp/test/actions-subdir/gyptest-action.py +26 -0
- data/ext/gyp/test/actions-subdir/src/make-file.py +11 -0
- data/ext/gyp/test/actions-subdir/src/none.gyp +31 -0
- data/ext/gyp/test/actions-subdir/src/subdir/make-subdir-file.py +11 -0
- data/ext/gyp/test/actions-subdir/src/subdir/subdir.gyp +28 -0
- data/ext/gyp/test/additional-targets/gyptest-additional.py +63 -0
- data/ext/gyp/test/additional-targets/src/all.gyp +13 -0
- data/ext/gyp/test/additional-targets/src/dir1/actions.gyp +56 -0
- data/ext/gyp/test/additional-targets/src/dir1/emit.py +11 -0
- data/ext/gyp/test/additional-targets/src/dir1/lib1.c +6 -0
- data/ext/gyp/test/analyzer/common.gypi +6 -0
- data/ext/gyp/test/analyzer/gyptest-analyzer.py +427 -0
- data/ext/gyp/test/analyzer/static_library_test.gyp +34 -0
- data/ext/gyp/test/analyzer/subdir/subdir.gyp +36 -0
- data/ext/gyp/test/analyzer/subdir/subdir2/subdir2.gyp +15 -0
- data/ext/gyp/test/analyzer/subdir2/subdir.gyp +18 -0
- data/ext/gyp/test/analyzer/subdir2/subdir.includes.gypi +9 -0
- data/ext/gyp/test/analyzer/test.gyp +114 -0
- data/ext/gyp/test/analyzer/test2.gyp +25 -0
- data/ext/gyp/test/analyzer/test2.includes.gypi +13 -0
- data/ext/gyp/test/analyzer/test2.includes.includes.gypi +9 -0
- data/ext/gyp/test/analyzer/test2.toplevel_includes.gypi +15 -0
- data/ext/gyp/test/analyzer/test3.gyp +77 -0
- data/ext/gyp/test/analyzer/test4.gyp +80 -0
- data/ext/gyp/test/analyzer/test5.gyp +25 -0
- data/ext/gyp/test/arflags/gyptest-arflags.py +26 -0
- data/ext/gyp/test/arflags/lib.cc +0 -0
- data/ext/gyp/test/arflags/test.gyp +10 -0
- data/ext/gyp/test/assembly/gyptest-assembly.py +31 -0
- data/ext/gyp/test/assembly/gyptest-override.py +24 -0
- data/ext/gyp/test/assembly/src/as.bat +4 -0
- data/ext/gyp/test/assembly/src/assembly.gyp +62 -0
- data/ext/gyp/test/assembly/src/lib1.S +15 -0
- data/ext/gyp/test/assembly/src/lib1.c +3 -0
- data/ext/gyp/test/assembly/src/override.gyp +34 -0
- data/ext/gyp/test/assembly/src/override_asm.asm +8 -0
- data/ext/gyp/test/assembly/src/program.c +12 -0
- data/ext/gyp/test/build-option/gyptest-build.py +27 -0
- data/ext/gyp/test/build-option/hello.c +13 -0
- data/ext/gyp/test/build-option/hello.gyp +15 -0
- data/ext/gyp/test/builddir/gyptest-all.py +85 -0
- data/ext/gyp/test/builddir/gyptest-default.py +85 -0
- data/ext/gyp/test/builddir/src/builddir.gypi +18 -0
- data/ext/gyp/test/builddir/src/func1.c +6 -0
- data/ext/gyp/test/builddir/src/func2.c +6 -0
- data/ext/gyp/test/builddir/src/func3.c +6 -0
- data/ext/gyp/test/builddir/src/func4.c +6 -0
- data/ext/gyp/test/builddir/src/func5.c +6 -0
- data/ext/gyp/test/builddir/src/prog1.c +10 -0
- data/ext/gyp/test/builddir/src/prog1.gyp +30 -0
- data/ext/gyp/test/builddir/src/subdir2/prog2.c +10 -0
- data/ext/gyp/test/builddir/src/subdir2/prog2.gyp +19 -0
- data/ext/gyp/test/builddir/src/subdir2/subdir3/prog3.c +10 -0
- data/ext/gyp/test/builddir/src/subdir2/subdir3/prog3.gyp +19 -0
- data/ext/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.c +10 -0
- data/ext/gyp/test/builddir/src/subdir2/subdir3/subdir4/prog4.gyp +19 -0
- data/ext/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.c +10 -0
- data/ext/gyp/test/builddir/src/subdir2/subdir3/subdir4/subdir5/prog5.gyp +19 -0
- data/ext/gyp/test/cflags/cflags.c +15 -0
- data/ext/gyp/test/cflags/cflags.gyp +23 -0
- data/ext/gyp/test/cflags/gyptest-cflags.py +75 -0
- data/ext/gyp/test/compilable/gyptest-headers.py +29 -0
- data/ext/gyp/test/compilable/src/headers.gyp +26 -0
- data/ext/gyp/test/compilable/src/lib1.cpp +7 -0
- data/ext/gyp/test/compilable/src/lib1.hpp +6 -0
- data/ext/gyp/test/compilable/src/program.cpp +9 -0
- data/ext/gyp/test/compiler-override/compiler-exe.gyp +16 -0
- data/ext/gyp/test/compiler-override/compiler-global-settings.gyp.in +34 -0
- data/ext/gyp/test/compiler-override/compiler-host.gyp +17 -0
- data/ext/gyp/test/compiler-override/compiler-shared-lib.gyp +16 -0
- data/ext/gyp/test/compiler-override/cxxtest.cc +7 -0
- data/ext/gyp/test/compiler-override/gyptest-compiler-env-toolchain.py +78 -0
- data/ext/gyp/test/compiler-override/gyptest-compiler-env.py +110 -0
- data/ext/gyp/test/compiler-override/gyptest-compiler-global-settings.py +82 -0
- data/ext/gyp/test/compiler-override/my_cc.py +7 -0
- data/ext/gyp/test/compiler-override/my_cxx.py +7 -0
- data/ext/gyp/test/compiler-override/my_ld.py +7 -0
- data/ext/gyp/test/compiler-override/my_nm.py +9 -0
- data/ext/gyp/test/compiler-override/my_readelf.py +9 -0
- data/ext/gyp/test/compiler-override/test.c +7 -0
- data/ext/gyp/test/conditions/elseif/elseif.gyp +43 -0
- data/ext/gyp/test/conditions/elseif/elseif_bad1.gyp +20 -0
- data/ext/gyp/test/conditions/elseif/elseif_bad2.gyp +22 -0
- data/ext/gyp/test/conditions/elseif/elseif_bad3.gyp +23 -0
- data/ext/gyp/test/conditions/elseif/elseif_conditions.gypi +15 -0
- data/ext/gyp/test/conditions/elseif/gyptest_elseif.py +33 -0
- data/ext/gyp/test/conditions/elseif/program.cc +10 -0
- data/ext/gyp/test/configurations/basics/configurations.c +15 -0
- data/ext/gyp/test/configurations/basics/configurations.gyp +32 -0
- data/ext/gyp/test/configurations/basics/gyptest-configurations.py +29 -0
- data/ext/gyp/test/configurations/inheritance/configurations.c +21 -0
- data/ext/gyp/test/configurations/inheritance/configurations.gyp +40 -0
- data/ext/gyp/test/configurations/inheritance/duplicates.gyp +27 -0
- data/ext/gyp/test/configurations/inheritance/duplicates.gypd.golden +12 -0
- data/ext/gyp/test/configurations/inheritance/gyptest-duplicates.py +36 -0
- data/ext/gyp/test/configurations/inheritance/gyptest-inheritance.py +33 -0
- data/ext/gyp/test/configurations/invalid/actions.gyp +18 -0
- data/ext/gyp/test/configurations/invalid/all_dependent_settings.gyp +18 -0
- data/ext/gyp/test/configurations/invalid/configurations.gyp +18 -0
- data/ext/gyp/test/configurations/invalid/dependencies.gyp +18 -0
- data/ext/gyp/test/configurations/invalid/direct_dependent_settings.gyp +18 -0
- data/ext/gyp/test/configurations/invalid/gyptest-configurations.py +36 -0
- data/ext/gyp/test/configurations/invalid/libraries.gyp +18 -0
- data/ext/gyp/test/configurations/invalid/link_settings.gyp +18 -0
- data/ext/gyp/test/configurations/invalid/sources.gyp +18 -0
- data/ext/gyp/test/configurations/invalid/standalone_static_library.gyp +17 -0
- data/ext/gyp/test/configurations/invalid/target_name.gyp +18 -0
- data/ext/gyp/test/configurations/invalid/type.gyp +18 -0
- data/ext/gyp/test/configurations/target_platform/configurations.gyp +58 -0
- data/ext/gyp/test/configurations/target_platform/front.c +8 -0
- data/ext/gyp/test/configurations/target_platform/gyptest-target_platform.py +40 -0
- data/ext/gyp/test/configurations/target_platform/left.c +3 -0
- data/ext/gyp/test/configurations/target_platform/right.c +3 -0
- data/ext/gyp/test/configurations/x64/configurations.c +12 -0
- data/ext/gyp/test/configurations/x64/configurations.gyp +38 -0
- data/ext/gyp/test/configurations/x64/gyptest-x86.py +31 -0
- data/ext/gyp/test/copies/gyptest-all.py +42 -0
- data/ext/gyp/test/copies/gyptest-attribs.py +41 -0
- data/ext/gyp/test/copies/gyptest-default.py +42 -0
- data/ext/gyp/test/copies/gyptest-samedir.py +28 -0
- data/ext/gyp/test/copies/gyptest-slash.py +39 -0
- data/ext/gyp/test/copies/gyptest-sourceless-shared-lib.py +20 -0
- data/ext/gyp/test/copies/gyptest-updir.py +32 -0
- data/ext/gyp/test/copies/src/copies-attribs.gyp +20 -0
- data/ext/gyp/test/copies/src/copies-samedir.gyp +37 -0
- data/ext/gyp/test/copies/src/copies-slash.gyp +36 -0
- data/ext/gyp/test/copies/src/copies-sourceless-shared-lib.gyp +27 -0
- data/ext/gyp/test/copies/src/copies-updir.gyp +21 -0
- data/ext/gyp/test/copies/src/copies.gyp +70 -0
- data/ext/gyp/test/copies/src/directory/file3 +1 -0
- data/ext/gyp/test/copies/src/directory/file4 +1 -0
- data/ext/gyp/test/copies/src/directory/subdir/file5 +1 -0
- data/ext/gyp/test/copies/src/executable-file.sh +3 -0
- data/ext/gyp/test/copies/src/file1 +1 -0
- data/ext/gyp/test/copies/src/file2 +1 -0
- data/ext/gyp/test/copies/src/foo.c +13 -0
- data/ext/gyp/test/copies/src/parentdir/subdir/file6 +1 -0
- data/ext/gyp/test/custom-generator/gyptest-custom-generator.py +18 -0
- data/ext/gyp/test/custom-generator/mygenerator.py +14 -0
- data/ext/gyp/test/custom-generator/test.gyp +15 -0
- data/ext/gyp/test/cxxflags/cxxflags.cc +15 -0
- data/ext/gyp/test/cxxflags/cxxflags.gyp +15 -0
- data/ext/gyp/test/cxxflags/gyptest-cxxflags.py +45 -0
- data/ext/gyp/test/defines/defines-env.gyp +22 -0
- data/ext/gyp/test/defines/defines.c +23 -0
- data/ext/gyp/test/defines/defines.gyp +38 -0
- data/ext/gyp/test/defines/gyptest-define-override.py +43 -0
- data/ext/gyp/test/defines/gyptest-defines-env-regyp.py +51 -0
- data/ext/gyp/test/defines/gyptest-defines-env.py +85 -0
- data/ext/gyp/test/defines/gyptest-defines.py +39 -0
- data/ext/gyp/test/defines-escaping/defines-escaping.c +11 -0
- data/ext/gyp/test/defines-escaping/defines-escaping.gyp +19 -0
- data/ext/gyp/test/defines-escaping/gyptest-defines-escaping.py +184 -0
- data/ext/gyp/test/dependencies/a.c +9 -0
- data/ext/gyp/test/dependencies/adso/all_dependent_settings_order.gyp +45 -0
- data/ext/gyp/test/dependencies/adso/write_args.py +11 -0
- data/ext/gyp/test/dependencies/b/b.c +3 -0
- data/ext/gyp/test/dependencies/b/b.gyp +22 -0
- data/ext/gyp/test/dependencies/b/b3.c +9 -0
- data/ext/gyp/test/dependencies/c/c.c +4 -0
- data/ext/gyp/test/dependencies/c/c.gyp +22 -0
- data/ext/gyp/test/dependencies/c/d.c +3 -0
- data/ext/gyp/test/dependencies/double_dependency.gyp +23 -0
- data/ext/gyp/test/dependencies/double_dependent.gyp +12 -0
- data/ext/gyp/test/dependencies/extra_targets.gyp +18 -0
- data/ext/gyp/test/dependencies/gyptest-all-dependent-settings-order.py +19 -0
- data/ext/gyp/test/dependencies/gyptest-double-dependency.py +19 -0
- data/ext/gyp/test/dependencies/gyptest-extra-targets.py +22 -0
- data/ext/gyp/test/dependencies/gyptest-indirect-module-dependency.py +22 -0
- data/ext/gyp/test/dependencies/gyptest-lib-only.py +39 -0
- data/ext/gyp/test/dependencies/gyptest-none-traversal.py +25 -0
- data/ext/gyp/test/dependencies/gyptest-sharedlib-linksettings.py +21 -0
- data/ext/gyp/test/dependencies/lib_only.gyp +16 -0
- data/ext/gyp/test/dependencies/main.c +14 -0
- data/ext/gyp/test/dependencies/module-dep/a.cc +7 -0
- data/ext/gyp/test/dependencies/module-dep/dll.cc +9 -0
- data/ext/gyp/test/dependencies/module-dep/exe.cc +7 -0
- data/ext/gyp/test/dependencies/module-dep/indirect-module-dependency.gyp +37 -0
- data/ext/gyp/test/dependencies/none_traversal.gyp +46 -0
- data/ext/gyp/test/dependencies/sharedlib-linksettings/program.c +25 -0
- data/ext/gyp/test/dependencies/sharedlib-linksettings/sharedlib.c +16 -0
- data/ext/gyp/test/dependencies/sharedlib-linksettings/staticlib.c +24 -0
- data/ext/gyp/test/dependencies/sharedlib-linksettings/test.gyp +37 -0
- data/ext/gyp/test/dependency-copy/gyptest-copy.py +26 -0
- data/ext/gyp/test/dependency-copy/src/copies.gyp +25 -0
- data/ext/gyp/test/dependency-copy/src/file1.c +7 -0
- data/ext/gyp/test/dependency-copy/src/file2.c +7 -0
- data/ext/gyp/test/dependent-settings/nested-dependent-settings/all-dependent-settings.gyp +19 -0
- data/ext/gyp/test/dependent-settings/nested-dependent-settings/direct-dependent-settings.gyp +19 -0
- data/ext/gyp/test/dependent-settings/nested-dependent-settings/gyptest-nested-dependent-settings.py +18 -0
- data/ext/gyp/test/determinism/determinism.gyp +59 -0
- data/ext/gyp/test/determinism/empty-targets.gyp +32 -0
- data/ext/gyp/test/determinism/gyptest-determinism.py +30 -0
- data/ext/gyp/test/determinism/gyptest-empty-target-names.py +30 -0
- data/ext/gyp/test/determinism/gyptest-needed-variables.py +30 -0
- data/ext/gyp/test/determinism/gyptest-solibs.py +37 -0
- data/ext/gyp/test/determinism/main.cc +5 -0
- data/ext/gyp/test/determinism/needed-variables.gyp +33 -0
- data/ext/gyp/test/determinism/rule.py +8 -0
- data/ext/gyp/test/determinism/solib.cc +8 -0
- data/ext/gyp/test/determinism/solibs.gyp +32 -0
- data/ext/gyp/test/empty-target/empty-target.gyp +12 -0
- data/ext/gyp/test/empty-target/gyptest-empty-target.py +18 -0
- data/ext/gyp/test/errors/dependency_cycle.gyp +23 -0
- data/ext/gyp/test/errors/duplicate_basenames.gyp +13 -0
- data/ext/gyp/test/errors/duplicate_node.gyp +12 -0
- data/ext/gyp/test/errors/duplicate_rule.gyp +22 -0
- data/ext/gyp/test/errors/duplicate_targets.gyp +14 -0
- data/ext/gyp/test/errors/error_command.gyp +12 -0
- data/ext/gyp/test/errors/file_cycle0.gyp +17 -0
- data/ext/gyp/test/errors/file_cycle1.gyp +13 -0
- data/ext/gyp/test/errors/gyptest-errors.py +80 -0
- data/ext/gyp/test/errors/missing_command.gyp +12 -0
- data/ext/gyp/test/errors/missing_dep.gyp +15 -0
- data/ext/gyp/test/errors/missing_targets.gyp +8 -0
- data/ext/gyp/test/escaping/colon/test.gyp +21 -0
- data/ext/gyp/test/escaping/gyptest-colon.py +51 -0
- data/ext/gyp/test/exclusion/exclusion.gyp +23 -0
- data/ext/gyp/test/exclusion/gyptest-exclusion.py +22 -0
- data/ext/gyp/test/exclusion/hello.c +15 -0
- data/ext/gyp/test/external-cross-compile/gyptest-cross.py +31 -0
- data/ext/gyp/test/external-cross-compile/src/bogus1.cc +1 -0
- data/ext/gyp/test/external-cross-compile/src/bogus2.c +1 -0
- data/ext/gyp/test/external-cross-compile/src/cross.gyp +83 -0
- data/ext/gyp/test/external-cross-compile/src/cross_compile.gypi +23 -0
- data/ext/gyp/test/external-cross-compile/src/fake_cross.py +18 -0
- data/ext/gyp/test/external-cross-compile/src/program.cc +16 -0
- data/ext/gyp/test/external-cross-compile/src/test1.cc +1 -0
- data/ext/gyp/test/external-cross-compile/src/test2.c +1 -0
- data/ext/gyp/test/external-cross-compile/src/test3.cc +1 -0
- data/ext/gyp/test/external-cross-compile/src/test4.c +1 -0
- data/ext/gyp/test/external-cross-compile/src/tochar.py +13 -0
- data/ext/gyp/test/generator-output/actions/actions.gyp +16 -0
- data/ext/gyp/test/generator-output/actions/build/README.txt +4 -0
- data/ext/gyp/test/generator-output/actions/subdir1/actions-out/README.txt +4 -0
- data/ext/gyp/test/generator-output/actions/subdir1/build/README.txt +4 -0
- data/ext/gyp/test/generator-output/actions/subdir1/executable.gyp +44 -0
- data/ext/gyp/test/generator-output/actions/subdir1/make-prog1.py +20 -0
- data/ext/gyp/test/generator-output/actions/subdir1/make-prog2.py +20 -0
- data/ext/gyp/test/generator-output/actions/subdir1/program.c +12 -0
- data/ext/gyp/test/generator-output/actions/subdir2/actions-out/README.txt +4 -0
- data/ext/gyp/test/generator-output/actions/subdir2/build/README.txt +4 -0
- data/ext/gyp/test/generator-output/actions/subdir2/make-file.py +11 -0
- data/ext/gyp/test/generator-output/actions/subdir2/none.gyp +31 -0
- data/ext/gyp/test/generator-output/copies/build/README.txt +4 -0
- data/ext/gyp/test/generator-output/copies/copies-out/README.txt +4 -0
- data/ext/gyp/test/generator-output/copies/copies.gyp +50 -0
- data/ext/gyp/test/generator-output/copies/file1 +1 -0
- data/ext/gyp/test/generator-output/copies/file2 +1 -0
- data/ext/gyp/test/generator-output/copies/subdir/build/README.txt +4 -0
- data/ext/gyp/test/generator-output/copies/subdir/copies-out/README.txt +4 -0
- data/ext/gyp/test/generator-output/copies/subdir/file3 +1 -0
- data/ext/gyp/test/generator-output/copies/subdir/file4 +1 -0
- data/ext/gyp/test/generator-output/copies/subdir/subdir.gyp +32 -0
- data/ext/gyp/test/generator-output/gyptest-actions.py +57 -0
- data/ext/gyp/test/generator-output/gyptest-copies.py +59 -0
- data/ext/gyp/test/generator-output/gyptest-depth.py +58 -0
- data/ext/gyp/test/generator-output/gyptest-mac-bundle.py +33 -0
- data/ext/gyp/test/generator-output/gyptest-relocate.py +59 -0
- data/ext/gyp/test/generator-output/gyptest-rules.py +58 -0
- data/ext/gyp/test/generator-output/gyptest-subdir2-deep.py +36 -0
- data/ext/gyp/test/generator-output/gyptest-symlink.py +44 -0
- data/ext/gyp/test/generator-output/gyptest-top-all.py +53 -0
- data/ext/gyp/test/generator-output/mac-bundle/Info.plist +32 -0
- data/ext/gyp/test/generator-output/mac-bundle/app.order +1 -0
- data/ext/gyp/test/generator-output/mac-bundle/header.h +1 -0
- data/ext/gyp/test/generator-output/mac-bundle/main.c +1 -0
- data/ext/gyp/test/generator-output/mac-bundle/resource.sb +1 -0
- data/ext/gyp/test/generator-output/mac-bundle/test.gyp +25 -0
- data/ext/gyp/test/generator-output/rules/build/README.txt +4 -0
- data/ext/gyp/test/generator-output/rules/copy-file.py +12 -0
- data/ext/gyp/test/generator-output/rules/rules.gyp +16 -0
- data/ext/gyp/test/generator-output/rules/subdir1/build/README.txt +4 -0
- data/ext/gyp/test/generator-output/rules/subdir1/define3.in0 +1 -0
- data/ext/gyp/test/generator-output/rules/subdir1/define4.in0 +1 -0
- data/ext/gyp/test/generator-output/rules/subdir1/executable.gyp +59 -0
- data/ext/gyp/test/generator-output/rules/subdir1/function1.in1 +6 -0
- data/ext/gyp/test/generator-output/rules/subdir1/function2.in1 +6 -0
- data/ext/gyp/test/generator-output/rules/subdir1/program.c +18 -0
- data/ext/gyp/test/generator-output/rules/subdir2/build/README.txt +4 -0
- data/ext/gyp/test/generator-output/rules/subdir2/file1.in0 +1 -0
- data/ext/gyp/test/generator-output/rules/subdir2/file2.in0 +1 -0
- data/ext/gyp/test/generator-output/rules/subdir2/file3.in1 +1 -0
- data/ext/gyp/test/generator-output/rules/subdir2/file4.in1 +1 -0
- data/ext/gyp/test/generator-output/rules/subdir2/none.gyp +49 -0
- data/ext/gyp/test/generator-output/rules/subdir2/rules-out/README.txt +4 -0
- data/ext/gyp/test/generator-output/src/build/README.txt +4 -0
- data/ext/gyp/test/generator-output/src/inc.h +1 -0
- data/ext/gyp/test/generator-output/src/inc1/include1.h +1 -0
- data/ext/gyp/test/generator-output/src/prog1.c +18 -0
- data/ext/gyp/test/generator-output/src/prog1.gyp +28 -0
- data/ext/gyp/test/generator-output/src/subdir2/build/README.txt +4 -0
- data/ext/gyp/test/generator-output/src/subdir2/deeper/build/README.txt +4 -0
- data/ext/gyp/test/generator-output/src/subdir2/deeper/deeper.c +7 -0
- data/ext/gyp/test/generator-output/src/subdir2/deeper/deeper.gyp +18 -0
- data/ext/gyp/test/generator-output/src/subdir2/deeper/deeper.h +1 -0
- data/ext/gyp/test/generator-output/src/subdir2/inc2/include2.h +1 -0
- data/ext/gyp/test/generator-output/src/subdir2/prog2.c +18 -0
- data/ext/gyp/test/generator-output/src/subdir2/prog2.gyp +28 -0
- data/ext/gyp/test/generator-output/src/subdir3/build/README.txt +4 -0
- data/ext/gyp/test/generator-output/src/subdir3/inc3/include3.h +1 -0
- data/ext/gyp/test/generator-output/src/subdir3/prog3.c +18 -0
- data/ext/gyp/test/generator-output/src/subdir3/prog3.gyp +25 -0
- data/ext/gyp/test/generator-output/src/symroot.gypi +16 -0
- data/ext/gyp/test/gyp-defines/defines.gyp +26 -0
- data/ext/gyp/test/gyp-defines/echo.py +11 -0
- data/ext/gyp/test/gyp-defines/gyptest-multiple-values.py +36 -0
- data/ext/gyp/test/gyp-defines/gyptest-regyp.py +40 -0
- data/ext/gyp/test/hard_dependency/gyptest-exported-hard-dependency.py +37 -0
- data/ext/gyp/test/hard_dependency/gyptest-no-exported-hard-dependency.py +36 -0
- data/ext/gyp/test/hard_dependency/src/a.c +9 -0
- data/ext/gyp/test/hard_dependency/src/a.h +12 -0
- data/ext/gyp/test/hard_dependency/src/b.c +9 -0
- data/ext/gyp/test/hard_dependency/src/b.h +12 -0
- data/ext/gyp/test/hard_dependency/src/c.c +10 -0
- data/ext/gyp/test/hard_dependency/src/c.h +10 -0
- data/ext/gyp/test/hard_dependency/src/d.c +9 -0
- data/ext/gyp/test/hard_dependency/src/emit.py +11 -0
- data/ext/gyp/test/hard_dependency/src/hard_dependency.gyp +78 -0
- data/ext/gyp/test/hello/gyptest-all.py +24 -0
- data/ext/gyp/test/hello/gyptest-default.py +24 -0
- data/ext/gyp/test/hello/gyptest-disable-regyp.py +32 -0
- data/ext/gyp/test/hello/gyptest-regyp-output.py +36 -0
- data/ext/gyp/test/hello/gyptest-regyp.py +32 -0
- data/ext/gyp/test/hello/gyptest-target.py +24 -0
- data/ext/gyp/test/hello/hello.c +11 -0
- data/ext/gyp/test/hello/hello.gyp +15 -0
- data/ext/gyp/test/hello/hello2.c +11 -0
- data/ext/gyp/test/hello/hello2.gyp +15 -0
- data/ext/gyp/test/home_dot_gyp/gyptest-home-includes-config-arg.py +31 -0
- data/ext/gyp/test/home_dot_gyp/gyptest-home-includes-config-env.py +33 -0
- data/ext/gyp/test/home_dot_gyp/gyptest-home-includes-regyp.py +44 -0
- data/ext/gyp/test/home_dot_gyp/gyptest-home-includes.py +30 -0
- data/ext/gyp/test/home_dot_gyp/home/.gyp/include.gypi +5 -0
- data/ext/gyp/test/home_dot_gyp/home2/.gyp/include.gypi +5 -0
- data/ext/gyp/test/home_dot_gyp/home2/.gyp_new/include.gypi +5 -0
- data/ext/gyp/test/home_dot_gyp/src/all.gyp +22 -0
- data/ext/gyp/test/home_dot_gyp/src/printfoo.c +7 -0
- data/ext/gyp/test/include_dirs/gyptest-all.py +43 -0
- data/ext/gyp/test/include_dirs/gyptest-default.py +43 -0
- data/ext/gyp/test/include_dirs/src/inc.h +1 -0
- data/ext/gyp/test/include_dirs/src/inc1/include1.h +1 -0
- data/ext/gyp/test/include_dirs/src/includes.c +19 -0
- data/ext/gyp/test/include_dirs/src/includes.gyp +27 -0
- data/ext/gyp/test/include_dirs/src/shadow1/shadow.h +1 -0
- data/ext/gyp/test/include_dirs/src/shadow2/shadow.h +1 -0
- data/ext/gyp/test/include_dirs/src/subdir/inc.h +1 -0
- data/ext/gyp/test/include_dirs/src/subdir/inc2/include2.h +1 -0
- data/ext/gyp/test/include_dirs/src/subdir/subdir_includes.c +14 -0
- data/ext/gyp/test/include_dirs/src/subdir/subdir_includes.gyp +20 -0
- data/ext/gyp/test/intermediate_dir/gyptest-intermediate-dir.py +44 -0
- data/ext/gyp/test/intermediate_dir/src/script.py +22 -0
- data/ext/gyp/test/intermediate_dir/src/shared_infile.txt +1 -0
- data/ext/gyp/test/intermediate_dir/src/test.gyp +42 -0
- data/ext/gyp/test/intermediate_dir/src/test2.gyp +42 -0
- data/ext/gyp/test/ios/app-bundle/TestApp/English.lproj/InfoPlist-error.strings +3 -0
- data/ext/gyp/test/ios/app-bundle/TestApp/English.lproj/InfoPlist.strings +3 -0
- data/ext/gyp/test/ios/app-bundle/TestApp/English.lproj/LanguageMap.plist +8 -0
- data/ext/gyp/test/ios/app-bundle/TestApp/English.lproj/MainMenu.xib +17 -0
- data/ext/gyp/test/ios/app-bundle/TestApp/English.lproj/Main_iPhone.storyboard +27 -0
- data/ext/gyp/test/ios/app-bundle/TestApp/Images.xcassets/AppIcon.appiconset/Contents.json +58 -0
- data/ext/gyp/test/ios/app-bundle/TestApp/Images.xcassets/image.imageset/Contents.json +23 -0
- data/ext/gyp/test/ios/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain.png +0 -0
- data/ext/gyp/test/ios/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain@2x.png +0 -0
- data/ext/gyp/test/ios/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain@3x.png +0 -0
- data/ext/gyp/test/ios/app-bundle/TestApp/TestApp-Info.plist +28 -0
- data/ext/gyp/test/ios/app-bundle/TestApp/check_no_signature.py +13 -0
- data/ext/gyp/test/ios/app-bundle/TestApp/main.m +13 -0
- data/ext/gyp/test/ios/app-bundle/TestApp/only-compile-in-32-bits.m +7 -0
- data/ext/gyp/test/ios/app-bundle/TestApp/only-compile-in-64-bits.m +7 -0
- data/ext/gyp/test/ios/app-bundle/test-archs.gyp +109 -0
- data/ext/gyp/test/ios/app-bundle/test-assets-catalog.gyp +45 -0
- data/ext/gyp/test/ios/app-bundle/test-crosscompile.gyp +47 -0
- data/ext/gyp/test/ios/app-bundle/test-device.gyp +109 -0
- data/ext/gyp/test/ios/app-bundle/test.gyp +75 -0
- data/ext/gyp/test/ios/app-bundle/tool_main.cc +7 -0
- data/ext/gyp/test/ios/copies-with-xcode-envvars/Info.plist +24 -0
- data/ext/gyp/test/ios/copies-with-xcode-envvars/copies-with-xcode-envvars.gyp +97 -0
- data/ext/gyp/test/ios/copies-with-xcode-envvars/empty.c +1 -0
- data/ext/gyp/test/ios/copies-with-xcode-envvars/file0 +1 -0
- data/ext/gyp/test/ios/copies-with-xcode-envvars/file1 +1 -0
- data/ext/gyp/test/ios/copies-with-xcode-envvars/file10 +1 -0
- data/ext/gyp/test/ios/copies-with-xcode-envvars/file11 +1 -0
- data/ext/gyp/test/ios/copies-with-xcode-envvars/file2 +1 -0
- data/ext/gyp/test/ios/copies-with-xcode-envvars/file3 +1 -0
- data/ext/gyp/test/ios/copies-with-xcode-envvars/file4 +1 -0
- data/ext/gyp/test/ios/copies-with-xcode-envvars/file5 +1 -0
- data/ext/gyp/test/ios/copies-with-xcode-envvars/file6 +1 -0
- data/ext/gyp/test/ios/copies-with-xcode-envvars/file7 +1 -0
- data/ext/gyp/test/ios/copies-with-xcode-envvars/file8 +1 -0
- data/ext/gyp/test/ios/copies-with-xcode-envvars/file9 +1 -0
- data/ext/gyp/test/ios/deployment-target/check-version-min.c +33 -0
- data/ext/gyp/test/ios/deployment-target/deployment-target.gyp +34 -0
- data/ext/gyp/test/ios/extension/ActionExtension/ActionViewController.h +9 -0
- data/ext/gyp/test/ios/extension/ActionExtension/ActionViewController.m +31 -0
- data/ext/gyp/test/ios/extension/ActionExtension/Info.plist +42 -0
- data/ext/gyp/test/ios/extension/ActionExtension/MainInterface.storyboard +63 -0
- data/ext/gyp/test/ios/extension/ExtensionContainer/AppDelegate.h +12 -0
- data/ext/gyp/test/ios/extension/ExtensionContainer/AppDelegate.m +19 -0
- data/ext/gyp/test/ios/extension/ExtensionContainer/Base.lproj/Main.storyboard +25 -0
- data/ext/gyp/test/ios/extension/ExtensionContainer/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- data/ext/gyp/test/ios/extension/ExtensionContainer/Images.xcassets/LaunchImage.launchimage/Contents.json +51 -0
- data/ext/gyp/test/ios/extension/ExtensionContainer/Info.plist +32 -0
- data/ext/gyp/test/ios/extension/ExtensionContainer/ViewController.h +11 -0
- data/ext/gyp/test/ios/extension/ExtensionContainer/ViewController.m +24 -0
- data/ext/gyp/test/ios/extension/ExtensionContainer/main.m +13 -0
- data/ext/gyp/test/ios/extension/extension.gyp +91 -0
- data/ext/gyp/test/ios/framework/framework.gyp +43 -0
- data/ext/gyp/test/ios/framework/iOSFramework/Info.plist +26 -0
- data/ext/gyp/test/ios/framework/iOSFramework/Thing.h +10 -0
- data/ext/gyp/test/ios/framework/iOSFramework/Thing.m +22 -0
- data/ext/gyp/test/ios/framework/iOSFramework/iOSFramework.h +9 -0
- data/ext/gyp/test/ios/gyptest-app-ios-assets-catalog.py +57 -0
- data/ext/gyp/test/ios/gyptest-app-ios.py +76 -0
- data/ext/gyp/test/ios/gyptest-archs.py +62 -0
- data/ext/gyp/test/ios/gyptest-copies-with-xcode-envvars.py +65 -0
- data/ext/gyp/test/ios/gyptest-crosscompile.py +34 -0
- data/ext/gyp/test/ios/gyptest-deployment-target.py +23 -0
- data/ext/gyp/test/ios/gyptest-extension.py +51 -0
- data/ext/gyp/test/ios/gyptest-framework.py +37 -0
- data/ext/gyp/test/ios/gyptest-per-config-settings.py +190 -0
- data/ext/gyp/test/ios/gyptest-watch.py +44 -0
- data/ext/gyp/test/ios/gyptest-xcode-ninja.py +25 -0
- data/ext/gyp/test/ios/watch/WatchApp/Images.xcassets/AppIcon.appiconset/Contents.json +62 -0
- data/ext/gyp/test/ios/watch/WatchApp/Images.xcassets/LaunchImage.launchimage/Contents.json +24 -0
- data/ext/gyp/test/ios/watch/WatchApp/Info.plist +35 -0
- data/ext/gyp/test/ios/watch/WatchApp/Interface.storyboard +15 -0
- data/ext/gyp/test/ios/watch/WatchContainer/AppDelegate.h +12 -0
- data/ext/gyp/test/ios/watch/WatchContainer/AppDelegate.m +19 -0
- data/ext/gyp/test/ios/watch/WatchContainer/Base.lproj/Main.storyboard +25 -0
- data/ext/gyp/test/ios/watch/WatchContainer/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- data/ext/gyp/test/ios/watch/WatchContainer/Images.xcassets/LaunchImage.launchimage/Contents.json +51 -0
- data/ext/gyp/test/ios/watch/WatchContainer/Info.plist +32 -0
- data/ext/gyp/test/ios/watch/WatchContainer/ViewController.h +11 -0
- data/ext/gyp/test/ios/watch/WatchContainer/ViewController.m +24 -0
- data/ext/gyp/test/ios/watch/WatchContainer/main.m +13 -0
- data/ext/gyp/test/ios/watch/WatchKitExtension/Images.xcassets/MyImage.imageset/Contents.json +20 -0
- data/ext/gyp/test/ios/watch/WatchKitExtension/Info.plist +38 -0
- data/ext/gyp/test/ios/watch/WatchKitExtension/InterfaceController.h +10 -0
- data/ext/gyp/test/ios/watch/WatchKitExtension/InterfaceController.m +25 -0
- data/ext/gyp/test/ios/watch/WatchKitExtension/MainInterface.storyboard +63 -0
- data/ext/gyp/test/ios/watch/watch.gyp +105 -0
- data/ext/gyp/test/ios/xctests/App/AppDelegate.h +11 -0
- data/ext/gyp/test/ios/xctests/App/AppDelegate.m +18 -0
- data/ext/gyp/test/ios/xctests/App/Base.lproj/LaunchScreen.xib +41 -0
- data/ext/gyp/test/ios/xctests/App/Base.lproj/Main.storyboard +25 -0
- data/ext/gyp/test/ios/xctests/App/Images.xcassets/AppIcon.appiconset/Contents.json +68 -0
- data/ext/gyp/test/ios/xctests/App/Info.plist +47 -0
- data/ext/gyp/test/ios/xctests/App/ViewController.h +9 -0
- data/ext/gyp/test/ios/xctests/App/ViewController.m +21 -0
- data/ext/gyp/test/ios/xctests/App/main.m +13 -0
- data/ext/gyp/test/ios/xctests/AppTests/AppTests.m +31 -0
- data/ext/gyp/test/ios/xctests/AppTests/Info.plist +24 -0
- data/ext/gyp/test/ios/xctests/gyptest-xctests.py +49 -0
- data/ext/gyp/test/ios/xctests/xctests.gyp +74 -0
- data/ext/gyp/test/lib/README.txt +17 -0
- data/ext/gyp/test/lib/TestCmd.py +1597 -0
- data/ext/gyp/test/lib/TestCommon.py +591 -0
- data/ext/gyp/test/lib/TestGyp.py +1259 -0
- data/ext/gyp/test/lib/TestMac.py +76 -0
- data/ext/gyp/test/lib/TestWin.py +101 -0
- data/ext/gyp/test/library/gyptest-shared-obj-install-path.py +39 -0
- data/ext/gyp/test/library/gyptest-shared.py +84 -0
- data/ext/gyp/test/library/gyptest-static.py +84 -0
- data/ext/gyp/test/library/src/lib1.c +10 -0
- data/ext/gyp/test/library/src/lib1_moveable.c +10 -0
- data/ext/gyp/test/library/src/lib2.c +10 -0
- data/ext/gyp/test/library/src/lib2_moveable.c +10 -0
- data/ext/gyp/test/library/src/library.gyp +58 -0
- data/ext/gyp/test/library/src/program.c +15 -0
- data/ext/gyp/test/library/src/shared_dependency.gyp +33 -0
- data/ext/gyp/test/library_dirs/gyptest-library-dirs.py +50 -0
- data/ext/gyp/test/library_dirs/subdir/README.txt +1 -0
- data/ext/gyp/test/library_dirs/subdir/hello.cc +11 -0
- data/ext/gyp/test/library_dirs/subdir/mylib.cc +9 -0
- data/ext/gyp/test/library_dirs/subdir/mylib.h +12 -0
- data/ext/gyp/test/library_dirs/subdir/test-win.gyp +60 -0
- data/ext/gyp/test/library_dirs/subdir/test.gyp +68 -0
- data/ext/gyp/test/link-dependency/gyptest-link-dependency.py +23 -0
- data/ext/gyp/test/link-dependency/main.c +7 -0
- data/ext/gyp/test/link-dependency/mymalloc.c +12 -0
- data/ext/gyp/test/link-dependency/test.gyp +37 -0
- data/ext/gyp/test/link-objects/base.c +6 -0
- data/ext/gyp/test/link-objects/extra.c +5 -0
- data/ext/gyp/test/link-objects/gyptest-all.py +28 -0
- data/ext/gyp/test/link-objects/link-objects.gyp +24 -0
- data/ext/gyp/test/linux/gyptest-implicit-rpath.py +48 -0
- data/ext/gyp/test/linux/gyptest-ldflags-duplicates.py +22 -0
- data/ext/gyp/test/linux/gyptest-ldflags-from-environment.py +45 -0
- data/ext/gyp/test/linux/gyptest-target-rpath.py +43 -0
- data/ext/gyp/test/linux/implicit-rpath/file.c +1 -0
- data/ext/gyp/test/linux/implicit-rpath/main.c +1 -0
- data/ext/gyp/test/linux/implicit-rpath/test.gyp +47 -0
- data/ext/gyp/test/linux/ldflags-duplicates/check-ldflags.py +28 -0
- data/ext/gyp/test/linux/ldflags-duplicates/lib1.c +6 -0
- data/ext/gyp/test/linux/ldflags-duplicates/lib2.c +6 -0
- data/ext/gyp/test/linux/ldflags-duplicates/main.c +7 -0
- data/ext/gyp/test/linux/ldflags-duplicates/test.gyp +45 -0
- data/ext/gyp/test/linux/ldflags-from-environment/main.c +7 -0
- data/ext/gyp/test/linux/ldflags-from-environment/test.gyp +23 -0
- data/ext/gyp/test/linux/target-rpath/file.c +1 -0
- data/ext/gyp/test/linux/target-rpath/main.c +1 -0
- data/ext/gyp/test/linux/target-rpath/test.gyp +47 -0
- data/ext/gyp/test/mac/action-envvars/action/action.gyp +34 -0
- data/ext/gyp/test/mac/action-envvars/action/action.sh +8 -0
- data/ext/gyp/test/mac/app-bundle/TestApp/English.lproj/InfoPlist-error.strings +3 -0
- data/ext/gyp/test/mac/app-bundle/TestApp/English.lproj/InfoPlist.strings +3 -0
- data/ext/gyp/test/mac/app-bundle/TestApp/English.lproj/MainMenu.xib +4119 -0
- data/ext/gyp/test/mac/app-bundle/TestApp/English.lproj/utf-16be.strings +0 -0
- data/ext/gyp/test/mac/app-bundle/TestApp/English.lproj/utf-16le.strings +0 -0
- data/ext/gyp/test/mac/app-bundle/TestApp/Images.xcassets/AppIcon.appiconset/Contents.json +58 -0
- data/ext/gyp/test/mac/app-bundle/TestApp/Images.xcassets/image.imageset/Contents.json +23 -0
- data/ext/gyp/test/mac/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain.png +0 -0
- data/ext/gyp/test/mac/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain@2x.png +0 -0
- data/ext/gyp/test/mac/app-bundle/TestApp/Images.xcassets/image.imageset/super_sylvain@3x.png +0 -0
- data/ext/gyp/test/mac/app-bundle/TestApp/TestApp-Info.plist +34 -0
- data/ext/gyp/test/mac/app-bundle/TestApp/TestAppAppDelegate.h +13 -0
- data/ext/gyp/test/mac/app-bundle/TestApp/TestAppAppDelegate.m +15 -0
- data/ext/gyp/test/mac/app-bundle/TestApp/main.m +10 -0
- data/ext/gyp/test/mac/app-bundle/empty.c +0 -0
- data/ext/gyp/test/mac/app-bundle/test-assets-catalog.gyp +43 -0
- data/ext/gyp/test/mac/app-bundle/test-error.gyp +31 -0
- data/ext/gyp/test/mac/app-bundle/test.gyp +41 -0
- data/ext/gyp/test/mac/archs/empty_main.cc +1 -0
- data/ext/gyp/test/mac/archs/file.mm +1 -0
- data/ext/gyp/test/mac/archs/file_a.cc +8 -0
- data/ext/gyp/test/mac/archs/file_a.h +10 -0
- data/ext/gyp/test/mac/archs/file_b.cc +8 -0
- data/ext/gyp/test/mac/archs/file_b.h +10 -0
- data/ext/gyp/test/mac/archs/file_c.cc +11 -0
- data/ext/gyp/test/mac/archs/file_d.cc +11 -0
- data/ext/gyp/test/mac/archs/header.h +1 -0
- data/ext/gyp/test/mac/archs/my_file.cc +4 -0
- data/ext/gyp/test/mac/archs/my_main_file.cc +9 -0
- data/ext/gyp/test/mac/archs/test-archs-multiarch.gyp +92 -0
- data/ext/gyp/test/mac/archs/test-archs-x86_64.gyp +27 -0
- data/ext/gyp/test/mac/archs/test-dependencies.gyp +92 -0
- data/ext/gyp/test/mac/archs/test-no-archs.gyp +21 -0
- data/ext/gyp/test/mac/archs/test-valid-archs.gyp +28 -0
- data/ext/gyp/test/mac/bundle-resources/change.sh +3 -0
- data/ext/gyp/test/mac/bundle-resources/executable-file.sh +3 -0
- data/ext/gyp/test/mac/bundle-resources/secret.txt +1 -0
- data/ext/gyp/test/mac/bundle-resources/test.gyp +59 -0
- data/ext/gyp/test/mac/cflags/ccfile.cc +7 -0
- data/ext/gyp/test/mac/cflags/ccfile_withcflags.cc +7 -0
- data/ext/gyp/test/mac/cflags/cfile.c +7 -0
- data/ext/gyp/test/mac/cflags/cppfile.cpp +7 -0
- data/ext/gyp/test/mac/cflags/cppfile_withcflags.cpp +7 -0
- data/ext/gyp/test/mac/cflags/cxxfile.cxx +7 -0
- data/ext/gyp/test/mac/cflags/cxxfile_withcflags.cxx +7 -0
- data/ext/gyp/test/mac/cflags/mfile.m +7 -0
- data/ext/gyp/test/mac/cflags/mmfile.mm +7 -0
- data/ext/gyp/test/mac/cflags/mmfile_withcflags.mm +7 -0
- data/ext/gyp/test/mac/cflags/test.gyp +132 -0
- data/ext/gyp/test/mac/clang-cxx-language-standard/c++11.cc +8 -0
- data/ext/gyp/test/mac/clang-cxx-language-standard/c++98.cc +24 -0
- data/ext/gyp/test/mac/clang-cxx-language-standard/clang-cxx-language-standard.gyp +30 -0
- data/ext/gyp/test/mac/clang-cxx-library/clang-cxx-library.gyp +32 -0
- data/ext/gyp/test/mac/clang-cxx-library/libc++.cc +11 -0
- data/ext/gyp/test/mac/clang-cxx-library/libstdc++.cc +11 -0
- data/ext/gyp/test/mac/copies-with-xcode-envvars/copies-with-xcode-envvars.gyp +87 -0
- data/ext/gyp/test/mac/copies-with-xcode-envvars/empty.c +1 -0
- data/ext/gyp/test/mac/copies-with-xcode-envvars/file0 +1 -0
- data/ext/gyp/test/mac/copies-with-xcode-envvars/file1 +1 -0
- data/ext/gyp/test/mac/copies-with-xcode-envvars/file10 +1 -0
- data/ext/gyp/test/mac/copies-with-xcode-envvars/file11 +1 -0
- data/ext/gyp/test/mac/copies-with-xcode-envvars/file2 +1 -0
- data/ext/gyp/test/mac/copies-with-xcode-envvars/file3 +1 -0
- data/ext/gyp/test/mac/copies-with-xcode-envvars/file4 +1 -0
- data/ext/gyp/test/mac/copies-with-xcode-envvars/file5 +1 -0
- data/ext/gyp/test/mac/copies-with-xcode-envvars/file6 +1 -0
- data/ext/gyp/test/mac/copies-with-xcode-envvars/file7 +1 -0
- data/ext/gyp/test/mac/copies-with-xcode-envvars/file8 +1 -0
- data/ext/gyp/test/mac/copies-with-xcode-envvars/file9 +1 -0
- data/ext/gyp/test/mac/copy-dylib/empty.c +1 -0
- data/ext/gyp/test/mac/copy-dylib/test.gyp +31 -0
- data/ext/gyp/test/mac/debuginfo/file.c +6 -0
- data/ext/gyp/test/mac/debuginfo/test.gyp +82 -0
- data/ext/gyp/test/mac/depend-on-bundle/English.lproj/InfoPlist.strings +1 -0
- data/ext/gyp/test/mac/depend-on-bundle/Info.plist +28 -0
- data/ext/gyp/test/mac/depend-on-bundle/bundle.c +1 -0
- data/ext/gyp/test/mac/depend-on-bundle/executable.c +4 -0
- data/ext/gyp/test/mac/depend-on-bundle/test.gyp +28 -0
- data/ext/gyp/test/mac/deployment-target/check-version-min.c +33 -0
- data/ext/gyp/test/mac/deployment-target/deployment-target.gyp +28 -0
- data/ext/gyp/test/mac/framework/TestFramework/English.lproj/InfoPlist.strings +2 -0
- data/ext/gyp/test/mac/framework/TestFramework/Info.plist +28 -0
- data/ext/gyp/test/mac/framework/TestFramework/ObjCVector.h +28 -0
- data/ext/gyp/test/mac/framework/TestFramework/ObjCVector.mm +63 -0
- data/ext/gyp/test/mac/framework/TestFramework/ObjCVectorInternal.h +9 -0
- data/ext/gyp/test/mac/framework/TestFramework/TestFramework_Prefix.pch +7 -0
- data/ext/gyp/test/mac/framework/empty.c +0 -0
- data/ext/gyp/test/mac/framework/framework.gyp +108 -0
- data/ext/gyp/test/mac/framework-dirs/calculate.c +15 -0
- data/ext/gyp/test/mac/framework-dirs/framework-dirs.gyp +21 -0
- data/ext/gyp/test/mac/framework-headers/myframework.h +8 -0
- data/ext/gyp/test/mac/framework-headers/myframework.m +8 -0
- data/ext/gyp/test/mac/framework-headers/test.gyp +44 -0
- data/ext/gyp/test/mac/global-settings/src/dir1/dir1.gyp +11 -0
- data/ext/gyp/test/mac/global-settings/src/dir2/dir2.gyp +22 -0
- data/ext/gyp/test/mac/global-settings/src/dir2/file.txt +1 -0
- data/ext/gyp/test/mac/gyptest-action-envvars.py +36 -0
- data/ext/gyp/test/mac/gyptest-app-assets-catalog.py +125 -0
- data/ext/gyp/test/mac/gyptest-app-error.py +49 -0
- data/ext/gyp/test/mac/gyptest-app.py +122 -0
- data/ext/gyp/test/mac/gyptest-archs.py +96 -0
- data/ext/gyp/test/mac/gyptest-bundle-resources.py +64 -0
- data/ext/gyp/test/mac/gyptest-cflags.py +21 -0
- data/ext/gyp/test/mac/gyptest-clang-cxx-language-standard.py +25 -0
- data/ext/gyp/test/mac/gyptest-clang-cxx-library.py +32 -0
- data/ext/gyp/test/mac/gyptest-copies-with-xcode-envvars.py +65 -0
- data/ext/gyp/test/mac/gyptest-copies.py +62 -0
- data/ext/gyp/test/mac/gyptest-copy-dylib.py +25 -0
- data/ext/gyp/test/mac/gyptest-debuginfo.py +36 -0
- data/ext/gyp/test/mac/gyptest-depend-on-bundle.py +45 -0
- data/ext/gyp/test/mac/gyptest-deployment-target.py +27 -0
- data/ext/gyp/test/mac/gyptest-framework-dirs.py +23 -0
- data/ext/gyp/test/mac/gyptest-framework-headers.py +38 -0
- data/ext/gyp/test/mac/gyptest-framework.py +80 -0
- data/ext/gyp/test/mac/gyptest-global-settings.py +33 -0
- data/ext/gyp/test/mac/gyptest-identical-name.py +45 -0
- data/ext/gyp/test/mac/gyptest-infoplist-process.py +56 -0
- data/ext/gyp/test/mac/gyptest-installname.py +85 -0
- data/ext/gyp/test/mac/gyptest-kext.py +27 -0
- data/ext/gyp/test/mac/gyptest-ldflags-passed-to-libtool.py +37 -0
- data/ext/gyp/test/mac/gyptest-ldflags.py +74 -0
- data/ext/gyp/test/mac/gyptest-libraries.py +30 -0
- data/ext/gyp/test/mac/gyptest-libtool-zero.py +26 -0
- data/ext/gyp/test/mac/gyptest-loadable-module-bundle-product-extension.py +31 -0
- data/ext/gyp/test/mac/gyptest-loadable-module.py +54 -0
- data/ext/gyp/test/mac/gyptest-lto.py +66 -0
- data/ext/gyp/test/mac/gyptest-missing-cfbundlesignature.py +34 -0
- data/ext/gyp/test/mac/gyptest-non-strs-flattened-to-env.py +38 -0
- data/ext/gyp/test/mac/gyptest-objc-arc.py +27 -0
- data/ext/gyp/test/mac/gyptest-objc-gc.py +51 -0
- data/ext/gyp/test/mac/gyptest-postbuild-copy-bundle.py +75 -0
- data/ext/gyp/test/mac/gyptest-postbuild-defaults.py +34 -0
- data/ext/gyp/test/mac/gyptest-postbuild-fail.py +71 -0
- data/ext/gyp/test/mac/gyptest-postbuild-multiple-configurations.py +26 -0
- data/ext/gyp/test/mac/gyptest-postbuild-static-library.py +28 -0
- data/ext/gyp/test/mac/gyptest-postbuild.py +53 -0
- data/ext/gyp/test/mac/gyptest-prefixheader.py +20 -0
- data/ext/gyp/test/mac/gyptest-rebuild.py +46 -0
- data/ext/gyp/test/mac/gyptest-rpath.py +50 -0
- data/ext/gyp/test/mac/gyptest-sdkroot.py +56 -0
- data/ext/gyp/test/mac/gyptest-sourceless-module.py +77 -0
- data/ext/gyp/test/mac/gyptest-strip-default.py +97 -0
- data/ext/gyp/test/mac/gyptest-strip.py +66 -0
- data/ext/gyp/test/mac/gyptest-swift-library.py +67 -0
- data/ext/gyp/test/mac/gyptest-type-envvars.py +26 -0
- data/ext/gyp/test/mac/gyptest-unicode-settings.py +20 -0
- data/ext/gyp/test/mac/gyptest-xcode-env-order.py +95 -0
- data/ext/gyp/test/mac/gyptest-xcode-gcc-clang.py +40 -0
- data/ext/gyp/test/mac/gyptest-xcode-gcc.py +60 -0
- data/ext/gyp/test/mac/gyptest-xcode-support-actions.py +25 -0
- data/ext/gyp/test/mac/gyptest-xctest.py +41 -0
- data/ext/gyp/test/mac/gyptest-xcuitest.py +39 -0
- data/ext/gyp/test/mac/identical-name/proxy/proxy.cc +2 -0
- data/ext/gyp/test/mac/identical-name/proxy/proxy.gyp +9 -0
- data/ext/gyp/test/mac/identical-name/proxy/testlib/testlib.cc +2 -0
- data/ext/gyp/test/mac/identical-name/proxy/testlib/testlib.gyp +8 -0
- data/ext/gyp/test/mac/identical-name/test-should-fail.gyp +10 -0
- data/ext/gyp/test/mac/identical-name/test.gyp +11 -0
- data/ext/gyp/test/mac/identical-name/test.gypi +7 -0
- data/ext/gyp/test/mac/identical-name/testlib/main.cc +3 -0
- data/ext/gyp/test/mac/identical-name/testlib/testlib.gyp +14 -0
- data/ext/gyp/test/mac/identical-name/testlib/void.cc +2 -0
- data/ext/gyp/test/mac/infoplist-process/Info.plist +36 -0
- data/ext/gyp/test/mac/infoplist-process/main.c +7 -0
- data/ext/gyp/test/mac/infoplist-process/test1.gyp +25 -0
- data/ext/gyp/test/mac/infoplist-process/test2.gyp +25 -0
- data/ext/gyp/test/mac/infoplist-process/test3.gyp +25 -0
- data/ext/gyp/test/mac/installname/Info.plist +28 -0
- data/ext/gyp/test/mac/installname/file.c +1 -0
- data/ext/gyp/test/mac/installname/main.c +1 -0
- data/ext/gyp/test/mac/installname/test.gyp +93 -0
- data/ext/gyp/test/mac/kext/GypKext/GypKext-Info.plist +35 -0
- data/ext/gyp/test/mac/kext/GypKext/GypKext.c +16 -0
- data/ext/gyp/test/mac/kext/kext.gyp +18 -0
- data/ext/gyp/test/mac/ldflags/subdirectory/Info.plist +8 -0
- data/ext/gyp/test/mac/ldflags/subdirectory/file.c +2 -0
- data/ext/gyp/test/mac/ldflags/subdirectory/symbol_list.def +1 -0
- data/ext/gyp/test/mac/ldflags/subdirectory/test.gyp +66 -0
- data/ext/gyp/test/mac/ldflags-libtool/file.c +1 -0
- data/ext/gyp/test/mac/ldflags-libtool/test.gyp +17 -0
- data/ext/gyp/test/mac/libraries/subdir/README.txt +1 -0
- data/ext/gyp/test/mac/libraries/subdir/hello.cc +10 -0
- data/ext/gyp/test/mac/libraries/subdir/mylib.c +7 -0
- data/ext/gyp/test/mac/libraries/subdir/test.gyp +65 -0
- data/ext/gyp/test/mac/libtool-zero/mylib.c +7 -0
- data/ext/gyp/test/mac/libtool-zero/test.gyp +18 -0
- data/ext/gyp/test/mac/loadable-module/Info.plist +26 -0
- data/ext/gyp/test/mac/loadable-module/module.c +11 -0
- data/ext/gyp/test/mac/loadable-module/test.gyp +18 -0
- data/ext/gyp/test/mac/loadable-module-bundle-product-extension/src.cc +7 -0
- data/ext/gyp/test/mac/loadable-module-bundle-product-extension/test.gyp +24 -0
- data/ext/gyp/test/mac/lto/asmfile.S +2 -0
- data/ext/gyp/test/mac/lto/ccfile.cc +1 -0
- data/ext/gyp/test/mac/lto/cfile.c +1 -0
- data/ext/gyp/test/mac/lto/mfile.m +1 -0
- data/ext/gyp/test/mac/lto/mmfile.mm +1 -0
- data/ext/gyp/test/mac/lto/test.gyp +35 -0
- data/ext/gyp/test/mac/missing-cfbundlesignature/Info.plist +10 -0
- data/ext/gyp/test/mac/missing-cfbundlesignature/Other-Info.plist +12 -0
- data/ext/gyp/test/mac/missing-cfbundlesignature/Third-Info.plist +12 -0
- data/ext/gyp/test/mac/missing-cfbundlesignature/file.c +1 -0
- data/ext/gyp/test/mac/missing-cfbundlesignature/test.gyp +34 -0
- data/ext/gyp/test/mac/non-strs-flattened-to-env/Info.plist +15 -0
- data/ext/gyp/test/mac/non-strs-flattened-to-env/main.c +7 -0
- data/ext/gyp/test/mac/non-strs-flattened-to-env/test.gyp +27 -0
- data/ext/gyp/test/mac/objc-arc/c-file.c +5 -0
- data/ext/gyp/test/mac/objc-arc/cc-file.cc +5 -0
- data/ext/gyp/test/mac/objc-arc/m-file-arc-weak.m +9 -0
- data/ext/gyp/test/mac/objc-arc/m-file-no-arc.m +9 -0
- data/ext/gyp/test/mac/objc-arc/m-file.m +9 -0
- data/ext/gyp/test/mac/objc-arc/mm-file-arc-weak.mm +9 -0
- data/ext/gyp/test/mac/objc-arc/mm-file-no-arc.mm +9 -0
- data/ext/gyp/test/mac/objc-arc/mm-file.mm +9 -0
- data/ext/gyp/test/mac/objc-arc/test.gyp +53 -0
- data/ext/gyp/test/mac/objc-gc/c-file.c +1 -0
- data/ext/gyp/test/mac/objc-gc/cc-file.cc +1 -0
- data/ext/gyp/test/mac/objc-gc/main.m +6 -0
- data/ext/gyp/test/mac/objc-gc/needs-gc-mm.mm +1 -0
- data/ext/gyp/test/mac/objc-gc/needs-gc.m +1 -0
- data/ext/gyp/test/mac/objc-gc/test.gyp +102 -0
- data/ext/gyp/test/mac/postbuild-copy-bundle/Framework-Info.plist +30 -0
- data/ext/gyp/test/mac/postbuild-copy-bundle/TestApp-Info.plist +32 -0
- data/ext/gyp/test/mac/postbuild-copy-bundle/copied.txt +1 -0
- data/ext/gyp/test/mac/postbuild-copy-bundle/empty.c +0 -0
- data/ext/gyp/test/mac/postbuild-copy-bundle/main.c +4 -0
- data/ext/gyp/test/mac/postbuild-copy-bundle/postbuild-copy-framework.sh +9 -0
- data/ext/gyp/test/mac/postbuild-copy-bundle/resource_file.sb +1 -0
- data/ext/gyp/test/mac/postbuild-copy-bundle/test.gyp +49 -0
- data/ext/gyp/test/mac/postbuild-defaults/Info.plist +13 -0
- data/ext/gyp/test/mac/postbuild-defaults/main.c +7 -0
- data/ext/gyp/test/mac/postbuild-defaults/postbuild-defaults.sh +15 -0
- data/ext/gyp/test/mac/postbuild-defaults/test.gyp +26 -0
- data/ext/gyp/test/mac/postbuild-fail/file.c +6 -0
- data/ext/gyp/test/mac/postbuild-fail/postbuild-fail.sh +6 -0
- data/ext/gyp/test/mac/postbuild-fail/test.gyp +38 -0
- data/ext/gyp/test/mac/postbuild-fail/touch-dynamic.sh +7 -0
- data/ext/gyp/test/mac/postbuild-fail/touch-static.sh +7 -0
- data/ext/gyp/test/mac/postbuild-multiple-configurations/main.c +4 -0
- data/ext/gyp/test/mac/postbuild-multiple-configurations/postbuild-touch-file.sh +7 -0
- data/ext/gyp/test/mac/postbuild-multiple-configurations/test.gyp +26 -0
- data/ext/gyp/test/mac/postbuild-static-library/empty.c +4 -0
- data/ext/gyp/test/mac/postbuild-static-library/postbuild-touch-file.sh +7 -0
- data/ext/gyp/test/mac/postbuild-static-library/test.gyp +34 -0
- data/ext/gyp/test/mac/postbuilds/copy.sh +3 -0
- data/ext/gyp/test/mac/postbuilds/file.c +4 -0
- data/ext/gyp/test/mac/postbuilds/file_g.c +4 -0
- data/ext/gyp/test/mac/postbuilds/file_h.c +4 -0
- data/ext/gyp/test/mac/postbuilds/script/shared_library_postbuild.sh +23 -0
- data/ext/gyp/test/mac/postbuilds/script/static_library_postbuild.sh +23 -0
- data/ext/gyp/test/mac/postbuilds/subdirectory/copied_file.txt +1 -0
- data/ext/gyp/test/mac/postbuilds/subdirectory/nested_target.gyp +53 -0
- data/ext/gyp/test/mac/postbuilds/test.gyp +93 -0
- data/ext/gyp/test/mac/prefixheader/file.c +1 -0
- data/ext/gyp/test/mac/prefixheader/file.cc +1 -0
- data/ext/gyp/test/mac/prefixheader/file.m +1 -0
- data/ext/gyp/test/mac/prefixheader/file.mm +1 -0
- data/ext/gyp/test/mac/prefixheader/header.h +1 -0
- data/ext/gyp/test/mac/prefixheader/test.gyp +82 -0
- data/ext/gyp/test/mac/rebuild/TestApp-Info.plist +32 -0
- data/ext/gyp/test/mac/rebuild/delay-touch.sh +6 -0
- data/ext/gyp/test/mac/rebuild/empty.c +0 -0
- data/ext/gyp/test/mac/rebuild/main.c +1 -0
- data/ext/gyp/test/mac/rebuild/test.gyp +56 -0
- data/ext/gyp/test/mac/rpath/file.c +1 -0
- data/ext/gyp/test/mac/rpath/main.c +1 -0
- data/ext/gyp/test/mac/rpath/test.gyp +48 -0
- data/ext/gyp/test/mac/sdkroot/file.cc +5 -0
- data/ext/gyp/test/mac/sdkroot/test.gyp +35 -0
- data/ext/gyp/test/mac/sdkroot/test_shorthand.sh +20 -0
- data/ext/gyp/test/mac/sourceless-module/empty.c +1 -0
- data/ext/gyp/test/mac/sourceless-module/empty.txt +2 -0
- data/ext/gyp/test/mac/sourceless-module/fun.c +1 -0
- data/ext/gyp/test/mac/sourceless-module/test.gyp +96 -0
- data/ext/gyp/test/mac/strip/file.c +22 -0
- data/ext/gyp/test/mac/strip/main.c +25 -0
- data/ext/gyp/test/mac/strip/strip.saves +5 -0
- data/ext/gyp/test/mac/strip/subdirectory/nested_file.c +1 -0
- data/ext/gyp/test/mac/strip/subdirectory/nested_strip.saves +5 -0
- data/ext/gyp/test/mac/strip/subdirectory/subdirectory.gyp +38 -0
- data/ext/gyp/test/mac/strip/subdirectory/test_reading_save_file_from_postbuild.sh +5 -0
- data/ext/gyp/test/mac/strip/test-defaults.gyp +51 -0
- data/ext/gyp/test/mac/strip/test.gyp +119 -0
- data/ext/gyp/test/mac/swift-library/Info.plist +28 -0
- data/ext/gyp/test/mac/swift-library/file.swift +9 -0
- data/ext/gyp/test/mac/swift-library/test.gyp +21 -0
- data/ext/gyp/test/mac/type_envvars/file.c +6 -0
- data/ext/gyp/test/mac/type_envvars/test.gyp +100 -0
- data/ext/gyp/test/mac/type_envvars/test_bundle_executable.sh +30 -0
- data/ext/gyp/test/mac/type_envvars/test_bundle_loadable_module.sh +35 -0
- data/ext/gyp/test/mac/type_envvars/test_bundle_shared_library.sh +38 -0
- data/ext/gyp/test/mac/type_envvars/test_check_sdkroot.sh +47 -0
- data/ext/gyp/test/mac/type_envvars/test_nonbundle_executable.sh +33 -0
- data/ext/gyp/test/mac/type_envvars/test_nonbundle_loadable_module.sh +31 -0
- data/ext/gyp/test/mac/type_envvars/test_nonbundle_none.sh +32 -0
- data/ext/gyp/test/mac/type_envvars/test_nonbundle_shared_library.sh +31 -0
- data/ext/gyp/test/mac/type_envvars/test_nonbundle_static_library.sh +31 -0
- data/ext/gyp/test/mac/unicode-settings/file.cc +2 -0
- data/ext/gyp/test/mac/unicode-settings/test.gyp +23 -0
- data/ext/gyp/test/mac/unicode-settings/test_bundle_display_name.sh +7 -0
- data/ext/gyp/test/mac/xcode-env-order/Info.plist +56 -0
- data/ext/gyp/test/mac/xcode-env-order/file.ext1 +0 -0
- data/ext/gyp/test/mac/xcode-env-order/file.ext2 +0 -0
- data/ext/gyp/test/mac/xcode-env-order/file.ext3 +0 -0
- data/ext/gyp/test/mac/xcode-env-order/main.c +7 -0
- data/ext/gyp/test/mac/xcode-env-order/test.gyp +121 -0
- data/ext/gyp/test/mac/xcode-gcc/aliasing.cc +13 -0
- data/ext/gyp/test/mac/xcode-gcc/test-clang.gyp +42 -0
- data/ext/gyp/test/mac/xcode-gcc/test.gyp +60 -0
- data/ext/gyp/test/mac/xcode-gcc/valid_c.c +8 -0
- data/ext/gyp/test/mac/xcode-gcc/valid_cc.cc +8 -0
- data/ext/gyp/test/mac/xcode-gcc/valid_m.m +8 -0
- data/ext/gyp/test/mac/xcode-gcc/valid_mm.mm +8 -0
- data/ext/gyp/test/mac/xcode-gcc/warn_about_invalid_offsetof_macro.cc +15 -0
- data/ext/gyp/test/mac/xcode-gcc/warn_about_missing_newline.c +8 -0
- data/ext/gyp/test/mac/xcode-support-actions/source.c +0 -0
- data/ext/gyp/test/mac/xcode-support-actions/test.gyp +26 -0
- data/ext/gyp/test/mac/xctest/MyClass.h +8 -0
- data/ext/gyp/test/mac/xctest/MyClass.m +8 -0
- data/ext/gyp/test/mac/xctest/TestCase.m +16 -0
- data/ext/gyp/test/mac/xctest/resource.txt +1 -0
- data/ext/gyp/test/mac/xctest/test.gyp +47 -0
- data/ext/gyp/test/mac/xctest/test.xcodeproj/xcshareddata/xcschemes/classes.xcscheme +69 -0
- data/ext/gyp/test/mac/xcuitest/Info.plist +28 -0
- data/ext/gyp/test/mac/xcuitest/MyAppDelegate.h +8 -0
- data/ext/gyp/test/mac/xcuitest/MyAppDelegate.m +19 -0
- data/ext/gyp/test/mac/xcuitest/TestCase.m +15 -0
- data/ext/gyp/test/mac/xcuitest/main.m +15 -0
- data/ext/gyp/test/mac/xcuitest/resource.txt +1 -0
- data/ext/gyp/test/mac/xcuitest/test.gyp +69 -0
- data/ext/gyp/test/make/dependencies.gyp +15 -0
- data/ext/gyp/test/make/gyptest-dependencies.py +26 -0
- data/ext/gyp/test/make/gyptest-noload.py +57 -0
- data/ext/gyp/test/make/main.cc +12 -0
- data/ext/gyp/test/make/main.h +0 -0
- data/ext/gyp/test/make/noload/all.gyp +18 -0
- data/ext/gyp/test/make/noload/lib/shared.c +3 -0
- data/ext/gyp/test/make/noload/lib/shared.gyp +16 -0
- data/ext/gyp/test/make/noload/lib/shared.h +1 -0
- data/ext/gyp/test/make/noload/main.c +9 -0
- data/ext/gyp/test/make_global_settings/ar/gyptest-make_global_settings_ar.py +126 -0
- data/ext/gyp/test/make_global_settings/ar/make_global_settings_ar.gyp +29 -0
- data/ext/gyp/test/make_global_settings/basics/gyptest-make_global_settings.py +51 -0
- data/ext/gyp/test/make_global_settings/basics/make_global_settings.gyp +17 -0
- data/ext/gyp/test/make_global_settings/env-wrapper/gyptest-wrapper.py +51 -0
- data/ext/gyp/test/make_global_settings/env-wrapper/wrapper.gyp +17 -0
- data/ext/gyp/test/make_global_settings/full-toolchain/bar.cc +1 -0
- data/ext/gyp/test/make_global_settings/full-toolchain/foo.c +1 -0
- data/ext/gyp/test/make_global_settings/full-toolchain/gyptest-make_global_settings.py +53 -0
- data/ext/gyp/test/make_global_settings/full-toolchain/make_global_settings.gyp +22 -0
- data/ext/gyp/test/make_global_settings/full-toolchain/my_nm.py +9 -0
- data/ext/gyp/test/make_global_settings/full-toolchain/my_readelf.py +9 -0
- data/ext/gyp/test/make_global_settings/ld/gyptest-make_global_settings_ld.py +130 -0
- data/ext/gyp/test/make_global_settings/ld/make_global_settings_ld.gyp +29 -0
- data/ext/gyp/test/make_global_settings/wrapper/gyptest-wrapper.py +52 -0
- data/ext/gyp/test/make_global_settings/wrapper/wrapper.gyp +21 -0
- data/ext/gyp/test/many-actions/file0 +0 -0
- data/ext/gyp/test/many-actions/file1 +0 -0
- data/ext/gyp/test/many-actions/file2 +0 -0
- data/ext/gyp/test/many-actions/file3 +0 -0
- data/ext/gyp/test/many-actions/file4 +0 -0
- data/ext/gyp/test/many-actions/gyptest-many-actions-unsorted.py +43 -0
- data/ext/gyp/test/many-actions/gyptest-many-actions.py +29 -0
- data/ext/gyp/test/many-actions/many-actions-unsorted.gyp +154 -0
- data/ext/gyp/test/many-actions/many-actions.gyp +1817 -0
- data/ext/gyp/test/module/gyptest-default.py +28 -0
- data/ext/gyp/test/module/src/lib1.c +10 -0
- data/ext/gyp/test/module/src/lib2.c +10 -0
- data/ext/gyp/test/module/src/module.gyp +53 -0
- data/ext/gyp/test/module/src/program.c +111 -0
- data/ext/gyp/test/msvs/buildevents/buildevents.gyp +14 -0
- data/ext/gyp/test/msvs/buildevents/gyptest-msbuild-supports-prepostbuild.py +24 -0
- data/ext/gyp/test/msvs/buildevents/gyptest-ninja-warnings.py +29 -0
- data/ext/gyp/test/msvs/buildevents/main.cc +5 -0
- data/ext/gyp/test/msvs/config_attrs/gyptest-config_attrs.py +41 -0
- data/ext/gyp/test/msvs/config_attrs/hello.c +11 -0
- data/ext/gyp/test/msvs/config_attrs/hello.gyp +21 -0
- data/ext/gyp/test/msvs/express/base/base.gyp +22 -0
- data/ext/gyp/test/msvs/express/express.gyp +19 -0
- data/ext/gyp/test/msvs/express/gyptest-express.py +29 -0
- data/ext/gyp/test/msvs/external_builder/external.gyp +68 -0
- data/ext/gyp/test/msvs/external_builder/external_builder.py +9 -0
- data/ext/gyp/test/msvs/external_builder/gyptest-all.py +59 -0
- data/ext/gyp/test/msvs/external_builder/hello.cpp +10 -0
- data/ext/gyp/test/msvs/external_builder/hello.z +6 -0
- data/ext/gyp/test/msvs/external_builder/msbuild_action.py +9 -0
- data/ext/gyp/test/msvs/external_builder/msbuild_rule.py +11 -0
- data/ext/gyp/test/msvs/filters/filters.gyp +47 -0
- data/ext/gyp/test/msvs/filters/gyptest-filters-2008.py +68 -0
- data/ext/gyp/test/msvs/filters/gyptest-filters-2010.py +57 -0
- data/ext/gyp/test/msvs/list_excluded/gyptest-all.py +51 -0
- data/ext/gyp/test/msvs/list_excluded/hello.cpp +10 -0
- data/ext/gyp/test/msvs/list_excluded/hello_exclude.gyp +19 -0
- data/ext/gyp/test/msvs/list_excluded/hello_mac.cpp +10 -0
- data/ext/gyp/test/msvs/missing_sources/gyptest-missing.py +43 -0
- data/ext/gyp/test/msvs/missing_sources/hello_missing.gyp +15 -0
- data/ext/gyp/test/msvs/multiple_actions_error_handling/action_fail.py +7 -0
- data/ext/gyp/test/msvs/multiple_actions_error_handling/action_succeed.py +7 -0
- data/ext/gyp/test/msvs/multiple_actions_error_handling/actions.gyp +40 -0
- data/ext/gyp/test/msvs/multiple_actions_error_handling/gyptest.py +26 -0
- data/ext/gyp/test/msvs/props/AppName.props +14 -0
- data/ext/gyp/test/msvs/props/AppName.vsprops +11 -0
- data/ext/gyp/test/msvs/props/gyptest-props.py +22 -0
- data/ext/gyp/test/msvs/props/hello.c +11 -0
- data/ext/gyp/test/msvs/props/hello.gyp +22 -0
- data/ext/gyp/test/msvs/rules_stdout_stderr/dummy.bar +5 -0
- data/ext/gyp/test/msvs/rules_stdout_stderr/dummy.foo +5 -0
- data/ext/gyp/test/msvs/rules_stdout_stderr/gyptest-rules-stdout-stderr.py +29 -0
- data/ext/gyp/test/msvs/rules_stdout_stderr/rule_stderr.py +8 -0
- data/ext/gyp/test/msvs/rules_stdout_stderr/rule_stdout.py +7 -0
- data/ext/gyp/test/msvs/rules_stdout_stderr/rules-stdout-stderr.gyp +52 -0
- data/ext/gyp/test/msvs/shared_output/common.gypi +17 -0
- data/ext/gyp/test/msvs/shared_output/gyptest-shared_output.py +41 -0
- data/ext/gyp/test/msvs/shared_output/hello.c +12 -0
- data/ext/gyp/test/msvs/shared_output/hello.gyp +21 -0
- data/ext/gyp/test/msvs/shared_output/there/there.c +12 -0
- data/ext/gyp/test/msvs/shared_output/there/there.gyp +16 -0
- data/ext/gyp/test/msvs/uldi2010/gyptest-all.py +20 -0
- data/ext/gyp/test/msvs/uldi2010/hello.c +13 -0
- data/ext/gyp/test/msvs/uldi2010/hello.gyp +26 -0
- data/ext/gyp/test/msvs/uldi2010/hello2.c +10 -0
- data/ext/gyp/test/multiple-targets/gyptest-all.py +30 -0
- data/ext/gyp/test/multiple-targets/gyptest-default.py +30 -0
- data/ext/gyp/test/multiple-targets/src/common.c +7 -0
- data/ext/gyp/test/multiple-targets/src/multiple.gyp +24 -0
- data/ext/gyp/test/multiple-targets/src/prog1.c +10 -0
- data/ext/gyp/test/multiple-targets/src/prog2.c +10 -0
- data/ext/gyp/test/ninja/action-rule-hash/gyptest-action-rule-hash.py +32 -0
- data/ext/gyp/test/ninja/action-rule-hash/subdir/action-rule-hash.gyp +29 -0
- data/ext/gyp/test/ninja/action-rule-hash/subdir/emit.py +13 -0
- data/ext/gyp/test/ninja/action_dependencies/gyptest-action-dependencies.py +64 -0
- data/ext/gyp/test/ninja/action_dependencies/src/a.c +10 -0
- data/ext/gyp/test/ninja/action_dependencies/src/a.h +13 -0
- data/ext/gyp/test/ninja/action_dependencies/src/action_dependencies.gyp +88 -0
- data/ext/gyp/test/ninja/action_dependencies/src/b.c +18 -0
- data/ext/gyp/test/ninja/action_dependencies/src/b.h +13 -0
- data/ext/gyp/test/ninja/action_dependencies/src/c.c +10 -0
- data/ext/gyp/test/ninja/action_dependencies/src/c.h +13 -0
- data/ext/gyp/test/ninja/action_dependencies/src/emit.py +11 -0
- data/ext/gyp/test/ninja/chained-dependency/chained-dependency.gyp +53 -0
- data/ext/gyp/test/ninja/chained-dependency/chained.c +5 -0
- data/ext/gyp/test/ninja/chained-dependency/gyptest-chained-dependency.py +30 -0
- data/ext/gyp/test/ninja/empty-and-non-empty-duplicate-name/gyptest-empty-and-non-empty-duplicate-name.py +23 -0
- data/ext/gyp/test/ninja/empty-and-non-empty-duplicate-name/subdir/included.gyp +19 -0
- data/ext/gyp/test/ninja/empty-and-non-empty-duplicate-name/test.gyp +19 -0
- data/ext/gyp/test/ninja/normalize-paths-win/gyptest-normalize-paths.py +46 -0
- data/ext/gyp/test/ninja/normalize-paths-win/hello.cc +7 -0
- data/ext/gyp/test/ninja/normalize-paths-win/normalize-paths.gyp +68 -0
- data/ext/gyp/test/ninja/s-needs-no-depfiles/empty.s +1 -0
- data/ext/gyp/test/ninja/s-needs-no-depfiles/gyptest-s-needs-no-depfiles.py +42 -0
- data/ext/gyp/test/ninja/s-needs-no-depfiles/s-needs-no-depfiles.gyp +13 -0
- data/ext/gyp/test/ninja/solibs_avoid_relinking/gyptest-solibs-avoid-relinking.py +48 -0
- data/ext/gyp/test/ninja/solibs_avoid_relinking/main.cc +5 -0
- data/ext/gyp/test/ninja/solibs_avoid_relinking/solib.cc +8 -0
- data/ext/gyp/test/ninja/solibs_avoid_relinking/solibs_avoid_relinking.gyp +38 -0
- data/ext/gyp/test/ninja/use-console/foo.bar +5 -0
- data/ext/gyp/test/ninja/use-console/gyptest-use-console.py +29 -0
- data/ext/gyp/test/ninja/use-console/use-console.gyp +60 -0
- data/ext/gyp/test/ninja/use-custom-environment-files/gyptest-use-custom-environment-files.py +28 -0
- data/ext/gyp/test/ninja/use-custom-environment-files/use-custom-environment-files.cc +7 -0
- data/ext/gyp/test/ninja/use-custom-environment-files/use-custom-environment-files.gyp +15 -0
- data/ext/gyp/test/no-cpp/gyptest-no-cpp.py +53 -0
- data/ext/gyp/test/no-cpp/src/call-f-main.c +2 -0
- data/ext/gyp/test/no-cpp/src/empty-main.c +1 -0
- data/ext/gyp/test/no-cpp/src/f.cc +3 -0
- data/ext/gyp/test/no-cpp/src/test.gyp +25 -0
- data/ext/gyp/test/no-output/gyptest-no-output.py +21 -0
- data/ext/gyp/test/no-output/src/nooutput.gyp +17 -0
- data/ext/gyp/test/product/gyptest-product.py +43 -0
- data/ext/gyp/test/product/hello.c +15 -0
- data/ext/gyp/test/product/product.gyp +128 -0
- data/ext/gyp/test/prune_targets/gyptest-prune-targets.py +66 -0
- data/ext/gyp/test/prune_targets/lib1.cc +6 -0
- data/ext/gyp/test/prune_targets/lib2.cc +6 -0
- data/ext/gyp/test/prune_targets/lib3.cc +6 -0
- data/ext/gyp/test/prune_targets/lib_indirect.cc +6 -0
- data/ext/gyp/test/prune_targets/program.cc +7 -0
- data/ext/gyp/test/prune_targets/test1.gyp +26 -0
- data/ext/gyp/test/prune_targets/test2.gyp +30 -0
- data/ext/gyp/test/relative/foo/a/a.cc +9 -0
- data/ext/gyp/test/relative/foo/a/a.gyp +13 -0
- data/ext/gyp/test/relative/foo/a/c/c.cc +9 -0
- data/ext/gyp/test/relative/foo/a/c/c.gyp +12 -0
- data/ext/gyp/test/relative/foo/b/b.cc +9 -0
- data/ext/gyp/test/relative/foo/b/b.gyp +9 -0
- data/ext/gyp/test/relative/gyptest-default.py +25 -0
- data/ext/gyp/test/rename/filecase/file.c +1 -0
- data/ext/gyp/test/rename/filecase/test-casesensitive.gyp +15 -0
- data/ext/gyp/test/rename/filecase/test.gyp +14 -0
- data/ext/gyp/test/rename/gyptest-filecase.py +35 -0
- data/ext/gyp/test/restat/gyptest-restat.py +31 -0
- data/ext/gyp/test/restat/src/create_intermediate.py +17 -0
- data/ext/gyp/test/restat/src/restat.gyp +50 -0
- data/ext/gyp/test/restat/src/touch.py +16 -0
- data/ext/gyp/test/rules/gyptest-all.py +84 -0
- data/ext/gyp/test/rules/gyptest-default.py +70 -0
- data/ext/gyp/test/rules/gyptest-input-root.py +26 -0
- data/ext/gyp/test/rules/gyptest-special-variables.py +18 -0
- data/ext/gyp/test/rules/src/actions.gyp +23 -0
- data/ext/gyp/test/rules/src/an_asm.S +6 -0
- data/ext/gyp/test/rules/src/as.bat +7 -0
- data/ext/gyp/test/rules/src/copy-file.py +11 -0
- data/ext/gyp/test/rules/src/external/external.gyp +66 -0
- data/ext/gyp/test/rules/src/external/file1.in +1 -0
- data/ext/gyp/test/rules/src/external/file2.in +1 -0
- data/ext/gyp/test/rules/src/input-root.gyp +24 -0
- data/ext/gyp/test/rules/src/noaction/file1.in +1 -0
- data/ext/gyp/test/rules/src/noaction/no_action_with_rules_fails.gyp +37 -0
- data/ext/gyp/test/rules/src/rule.py +17 -0
- data/ext/gyp/test/rules/src/somefile.ext +0 -0
- data/ext/gyp/test/rules/src/special-variables.gyp +34 -0
- data/ext/gyp/test/rules/src/subdir1/executable.gyp +37 -0
- data/ext/gyp/test/rules/src/subdir1/function1.in +6 -0
- data/ext/gyp/test/rules/src/subdir1/function2.in +6 -0
- data/ext/gyp/test/rules/src/subdir1/program.c +12 -0
- data/ext/gyp/test/rules/src/subdir2/both_rule_and_action_input.gyp +50 -0
- data/ext/gyp/test/rules/src/subdir2/file1.in +1 -0
- data/ext/gyp/test/rules/src/subdir2/file2.in +1 -0
- data/ext/gyp/test/rules/src/subdir2/never_used.gyp +31 -0
- data/ext/gyp/test/rules/src/subdir2/no_action.gyp +38 -0
- data/ext/gyp/test/rules/src/subdir2/no_inputs.gyp +32 -0
- data/ext/gyp/test/rules/src/subdir2/none.gyp +33 -0
- data/ext/gyp/test/rules/src/subdir2/program.c +12 -0
- data/ext/gyp/test/rules/src/subdir3/executable2.gyp +37 -0
- data/ext/gyp/test/rules/src/subdir3/function3.in +6 -0
- data/ext/gyp/test/rules/src/subdir3/program.c +10 -0
- data/ext/gyp/test/rules/src/subdir4/asm-function.assem +10 -0
- data/ext/gyp/test/rules/src/subdir4/build-asm.gyp +49 -0
- data/ext/gyp/test/rules/src/subdir4/program.c +19 -0
- data/ext/gyp/test/rules-dirname/gyptest-dirname.py +57 -0
- data/ext/gyp/test/rules-dirname/src/actions.gyp +15 -0
- data/ext/gyp/test/rules-dirname/src/copy-file.py +11 -0
- data/ext/gyp/test/rules-dirname/src/subdir/a/b/c.gencc +8 -0
- data/ext/gyp/test/rules-dirname/src/subdir/a/b/c.printvars +1 -0
- data/ext/gyp/test/rules-dirname/src/subdir/foo/bar/baz.gencc +8 -0
- data/ext/gyp/test/rules-dirname/src/subdir/foo/bar/baz.printvars +1 -0
- data/ext/gyp/test/rules-dirname/src/subdir/input-rule-dirname.gyp +140 -0
- data/ext/gyp/test/rules-dirname/src/subdir/main.cc +14 -0
- data/ext/gyp/test/rules-dirname/src/subdir/nodir.gencc +8 -0
- data/ext/gyp/test/rules-dirname/src/subdir/printvars.py +14 -0
- data/ext/gyp/test/rules-rebuild/gyptest-all.py +70 -0
- data/ext/gyp/test/rules-rebuild/gyptest-default.py +91 -0
- data/ext/gyp/test/rules-rebuild/src/main.c +12 -0
- data/ext/gyp/test/rules-rebuild/src/make-sources.py +19 -0
- data/ext/gyp/test/rules-rebuild/src/prog1.in +7 -0
- data/ext/gyp/test/rules-rebuild/src/prog2.in +7 -0
- data/ext/gyp/test/rules-rebuild/src/same_target.gyp +31 -0
- data/ext/gyp/test/rules-use-built-dependencies/gyptest-use-built-dependencies.py +23 -0
- data/ext/gyp/test/rules-use-built-dependencies/src/main.cc +17 -0
- data/ext/gyp/test/rules-use-built-dependencies/src/use-built-dependencies-rule.gyp +42 -0
- data/ext/gyp/test/rules-variables/gyptest-rules-variables.py +35 -0
- data/ext/gyp/test/rules-variables/src/input_ext.c +9 -0
- data/ext/gyp/test/rules-variables/src/input_name/test.c +9 -0
- data/ext/gyp/test/rules-variables/src/input_path/subdir/test.c +9 -0
- data/ext/gyp/test/rules-variables/src/subdir/input_dirname.c +9 -0
- data/ext/gyp/test/rules-variables/src/subdir/test.c +18 -0
- data/ext/gyp/test/rules-variables/src/test.input_root.c +9 -0
- data/ext/gyp/test/rules-variables/src/variables.gyp +40 -0
- data/ext/gyp/test/same-gyp-name/gyptest-all.py +38 -0
- data/ext/gyp/test/same-gyp-name/gyptest-default.py +38 -0
- data/ext/gyp/test/same-gyp-name/gyptest-library.py +20 -0
- data/ext/gyp/test/same-gyp-name/library/one/sub.gyp +11 -0
- data/ext/gyp/test/same-gyp-name/library/test.gyp +15 -0
- data/ext/gyp/test/same-gyp-name/library/two/sub.gyp +11 -0
- data/ext/gyp/test/same-gyp-name/src/all.gyp +16 -0
- data/ext/gyp/test/same-gyp-name/src/subdir1/executable.gyp +15 -0
- data/ext/gyp/test/same-gyp-name/src/subdir1/main1.cc +6 -0
- data/ext/gyp/test/same-gyp-name/src/subdir2/executable.gyp +15 -0
- data/ext/gyp/test/same-gyp-name/src/subdir2/main2.cc +6 -0
- data/ext/gyp/test/same-rule-output-file-name/gyptest-all.py +23 -0
- data/ext/gyp/test/same-rule-output-file-name/src/subdir1/subdir1.gyp +30 -0
- data/ext/gyp/test/same-rule-output-file-name/src/subdir2/subdir2.gyp +30 -0
- data/ext/gyp/test/same-rule-output-file-name/src/subdirs.gyp +16 -0
- data/ext/gyp/test/same-rule-output-file-name/src/touch.py +11 -0
- data/ext/gyp/test/same-source-file-name/gyptest-all.py +34 -0
- data/ext/gyp/test/same-source-file-name/gyptest-default.py +34 -0
- data/ext/gyp/test/same-source-file-name/gyptest-pass-executable.py +33 -0
- data/ext/gyp/test/same-source-file-name/gyptest-pass-shared.py +18 -0
- data/ext/gyp/test/same-source-file-name/gyptest-static.py +34 -0
- data/ext/gyp/test/same-source-file-name/src/all.gyp +30 -0
- data/ext/gyp/test/same-source-file-name/src/double-executable.gyp +21 -0
- data/ext/gyp/test/same-source-file-name/src/double-shared.gyp +27 -0
- data/ext/gyp/test/same-source-file-name/src/double-static.gyp +22 -0
- data/ext/gyp/test/same-source-file-name/src/func.c +6 -0
- data/ext/gyp/test/same-source-file-name/src/prog1.c +16 -0
- data/ext/gyp/test/same-source-file-name/src/prog2.c +16 -0
- data/ext/gyp/test/same-source-file-name/src/prog3.c +18 -0
- data/ext/gyp/test/same-source-file-name/src/subdir1/func.c +6 -0
- data/ext/gyp/test/same-source-file-name/src/subdir2/func.c +6 -0
- data/ext/gyp/test/same-target-name/gyptest-same-target-name.py +18 -0
- data/ext/gyp/test/same-target-name/src/all.gyp +16 -0
- data/ext/gyp/test/same-target-name/src/executable1.gyp +15 -0
- data/ext/gyp/test/same-target-name/src/executable2.gyp +15 -0
- data/ext/gyp/test/same-target-name-different-directory/gyptest-all.py +41 -0
- data/ext/gyp/test/same-target-name-different-directory/src/subdir1/subdir1.gyp +66 -0
- data/ext/gyp/test/same-target-name-different-directory/src/subdir2/subdir2.gyp +66 -0
- data/ext/gyp/test/same-target-name-different-directory/src/subdirs.gyp +16 -0
- data/ext/gyp/test/same-target-name-different-directory/src/touch.py +11 -0
- data/ext/gyp/test/sanitize-rule-names/blah.S +0 -0
- data/ext/gyp/test/sanitize-rule-names/gyptest-sanitize-rule-names.py +17 -0
- data/ext/gyp/test/sanitize-rule-names/hello.cc +7 -0
- data/ext/gyp/test/sanitize-rule-names/sanitize-rule-names.gyp +27 -0
- data/ext/gyp/test/sanitize-rule-names/script.py +10 -0
- data/ext/gyp/test/self-dependency/common.gypi +13 -0
- data/ext/gyp/test/self-dependency/dep.gyp +23 -0
- data/ext/gyp/test/self-dependency/gyptest-self-dependency.py +19 -0
- data/ext/gyp/test/self-dependency/self_dependency.gyp +15 -0
- data/ext/gyp/test/sibling/gyptest-all.py +42 -0
- data/ext/gyp/test/sibling/gyptest-relocate.py +44 -0
- data/ext/gyp/test/sibling/src/build/all.gyp +16 -0
- data/ext/gyp/test/sibling/src/prog1/prog1.c +7 -0
- data/ext/gyp/test/sibling/src/prog1/prog1.gyp +15 -0
- data/ext/gyp/test/sibling/src/prog2/prog2.c +7 -0
- data/ext/gyp/test/sibling/src/prog2/prog2.gyp +15 -0
- data/ext/gyp/test/small/gyptest-small.py +56 -0
- data/ext/gyp/test/standalone/gyptest-standalone.py +35 -0
- data/ext/gyp/test/standalone/standalone.gyp +12 -0
- data/ext/gyp/test/standalone-static-library/gyptest-standalone-static-library.py +50 -0
- data/ext/gyp/test/standalone-static-library/invalid.gyp +16 -0
- data/ext/gyp/test/standalone-static-library/mylib.c +7 -0
- data/ext/gyp/test/standalone-static-library/mylib.gyp +26 -0
- data/ext/gyp/test/standalone-static-library/prog.c +7 -0
- data/ext/gyp/test/subdirectory/gyptest-SYMROOT-all.py +36 -0
- data/ext/gyp/test/subdirectory/gyptest-SYMROOT-default.py +37 -0
- data/ext/gyp/test/subdirectory/gyptest-subdir-all.py +34 -0
- data/ext/gyp/test/subdirectory/gyptest-subdir-default.py +34 -0
- data/ext/gyp/test/subdirectory/gyptest-subdir2-deep.py +25 -0
- data/ext/gyp/test/subdirectory/gyptest-top-all.py +43 -0
- data/ext/gyp/test/subdirectory/gyptest-top-default.py +43 -0
- data/ext/gyp/test/subdirectory/src/prog1.c +7 -0
- data/ext/gyp/test/subdirectory/src/prog1.gyp +21 -0
- data/ext/gyp/test/subdirectory/src/subdir/prog2.c +7 -0
- data/ext/gyp/test/subdirectory/src/subdir/prog2.gyp +18 -0
- data/ext/gyp/test/subdirectory/src/subdir/subdir2/prog3.c +7 -0
- data/ext/gyp/test/subdirectory/src/subdir/subdir2/prog3.gyp +18 -0
- data/ext/gyp/test/subdirectory/src/symroot.gypi +16 -0
- data/ext/gyp/test/symlinks/gyptest-symlinks.py +66 -0
- data/ext/gyp/test/symlinks/hello.c +12 -0
- data/ext/gyp/test/symlinks/hello.gyp +15 -0
- data/ext/gyp/test/target/gyptest-target.py +37 -0
- data/ext/gyp/test/target/hello.c +7 -0
- data/ext/gyp/test/target/target.gyp +24 -0
- data/ext/gyp/test/toolsets/gyptest-toolsets.py +31 -0
- data/ext/gyp/test/toolsets/main.cc +13 -0
- data/ext/gyp/test/toolsets/toolsets.cc +11 -0
- data/ext/gyp/test/toolsets/toolsets.gyp +62 -0
- data/ext/gyp/test/toolsets/toolsets_shared.cc +11 -0
- data/ext/gyp/test/toplevel-dir/gyptest-toplevel-dir.py +31 -0
- data/ext/gyp/test/toplevel-dir/src/sub1/main.gyp +18 -0
- data/ext/gyp/test/toplevel-dir/src/sub1/prog1.c +7 -0
- data/ext/gyp/test/toplevel-dir/src/sub2/prog2.c +7 -0
- data/ext/gyp/test/toplevel-dir/src/sub2/prog2.gyp +15 -0
- data/ext/gyp/test/variables/commands/commands-repeated.gyp +128 -0
- data/ext/gyp/test/variables/commands/commands-repeated.gyp.stdout +136 -0
- data/ext/gyp/test/variables/commands/commands-repeated.gypd.golden +77 -0
- data/ext/gyp/test/variables/commands/commands.gyp +91 -0
- data/ext/gyp/test/variables/commands/commands.gyp.ignore-env.stdout +96 -0
- data/ext/gyp/test/variables/commands/commands.gyp.stdout +96 -0
- data/ext/gyp/test/variables/commands/commands.gypd.golden +66 -0
- data/ext/gyp/test/variables/commands/commands.gypi +23 -0
- data/ext/gyp/test/variables/commands/gyptest-commands-ignore-env.py +47 -0
- data/ext/gyp/test/variables/commands/gyptest-commands-repeated-multidir.py +23 -0
- data/ext/gyp/test/variables/commands/gyptest-commands-repeated.py +40 -0
- data/ext/gyp/test/variables/commands/gyptest-commands.py +40 -0
- data/ext/gyp/test/variables/commands/repeated_multidir/dir_1/test_1.gyp +13 -0
- data/ext/gyp/test/variables/commands/repeated_multidir/dir_2/test_2.gyp +13 -0
- data/ext/gyp/test/variables/commands/repeated_multidir/main.gyp +16 -0
- data/ext/gyp/test/variables/commands/repeated_multidir/print_cwd_basename.py +11 -0
- data/ext/gyp/test/variables/commands/repeated_multidir/repeated_command_common.gypi +25 -0
- data/ext/gyp/test/variables/commands/test.py +7 -0
- data/ext/gyp/test/variables/commands/update_golden +11 -0
- data/ext/gyp/test/variables/empty/empty.gyp +13 -0
- data/ext/gyp/test/variables/empty/empty.gypi +9 -0
- data/ext/gyp/test/variables/empty/gyptest-empty.py +19 -0
- data/ext/gyp/test/variables/filelist/filelist.gyp.stdout +26 -0
- data/ext/gyp/test/variables/filelist/filelist.gypd.golden +43 -0
- data/ext/gyp/test/variables/filelist/gyptest-filelist-golden.py +53 -0
- data/ext/gyp/test/variables/filelist/gyptest-filelist.py +29 -0
- data/ext/gyp/test/variables/filelist/src/dummy.py +5 -0
- data/ext/gyp/test/variables/filelist/src/filelist.gyp +93 -0
- data/ext/gyp/test/variables/filelist/src/filelist2.gyp +40 -0
- data/ext/gyp/test/variables/filelist/update_golden +8 -0
- data/ext/gyp/test/variables/latelate/gyptest-latelate.py +25 -0
- data/ext/gyp/test/variables/latelate/src/latelate.gyp +34 -0
- data/ext/gyp/test/variables/latelate/src/program.cc +13 -0
- data/ext/gyp/test/variables/variable-in-path/C1/hello.cc +7 -0
- data/ext/gyp/test/variables/variable-in-path/gyptest-variable-in-path.py +23 -0
- data/ext/gyp/test/variables/variable-in-path/variable-in-path.gyp +31 -0
- data/ext/gyp/test/win/asm-files/asm-files.gyp +17 -0
- data/ext/gyp/test/win/asm-files/b.s +0 -0
- data/ext/gyp/test/win/asm-files/c.S +0 -0
- data/ext/gyp/test/win/asm-files/hello.cc +7 -0
- data/ext/gyp/test/win/batch-file-action/batch-file-action.gyp +21 -0
- data/ext/gyp/test/win/batch-file-action/infile +1 -0
- data/ext/gyp/test/win/batch-file-action/somecmd.bat +5 -0
- data/ext/gyp/test/win/command-quote/a.S +0 -0
- data/ext/gyp/test/win/command-quote/bat with spaces.bat +7 -0
- data/ext/gyp/test/win/command-quote/command-quote.gyp +79 -0
- data/ext/gyp/test/win/command-quote/go.bat +7 -0
- data/ext/gyp/test/win/command-quote/subdir/and/another/in-subdir.gyp +27 -0
- data/ext/gyp/test/win/compiler-flags/additional-include-dirs.cc +10 -0
- data/ext/gyp/test/win/compiler-flags/additional-include-dirs.gyp +20 -0
- data/ext/gyp/test/win/compiler-flags/additional-options.cc +10 -0
- data/ext/gyp/test/win/compiler-flags/additional-options.gyp +31 -0
- data/ext/gyp/test/win/compiler-flags/analysis.gyp +40 -0
- data/ext/gyp/test/win/compiler-flags/buffer-security-check.gyp +51 -0
- data/ext/gyp/test/win/compiler-flags/buffer-security.cc +12 -0
- data/ext/gyp/test/win/compiler-flags/calling-convention-cdecl.def +6 -0
- data/ext/gyp/test/win/compiler-flags/calling-convention-fastcall.def +6 -0
- data/ext/gyp/test/win/compiler-flags/calling-convention-stdcall.def +6 -0
- data/ext/gyp/test/win/compiler-flags/calling-convention-vectorcall.def +6 -0
- data/ext/gyp/test/win/compiler-flags/calling-convention.cc +6 -0
- data/ext/gyp/test/win/compiler-flags/calling-convention.gyp +66 -0
- data/ext/gyp/test/win/compiler-flags/character-set-mbcs.cc +11 -0
- data/ext/gyp/test/win/compiler-flags/character-set-unicode.cc +15 -0
- data/ext/gyp/test/win/compiler-flags/character-set.gyp +35 -0
- data/ext/gyp/test/win/compiler-flags/compile-as-managed.cc +9 -0
- data/ext/gyp/test/win/compiler-flags/compile-as-managed.gyp +29 -0
- data/ext/gyp/test/win/compiler-flags/compile-as-winrt.cc +12 -0
- data/ext/gyp/test/win/compiler-flags/compile-as-winrt.gyp +20 -0
- data/ext/gyp/test/win/compiler-flags/debug-format.gyp +48 -0
- data/ext/gyp/test/win/compiler-flags/default-char-is-unsigned.cc +15 -0
- data/ext/gyp/test/win/compiler-flags/default-char-is-unsigned.gyp +20 -0
- data/ext/gyp/test/win/compiler-flags/disable-specific-warnings.cc +9 -0
- data/ext/gyp/test/win/compiler-flags/disable-specific-warnings.gyp +29 -0
- data/ext/gyp/test/win/compiler-flags/enable-enhanced-instruction-set.cc +28 -0
- data/ext/gyp/test/win/compiler-flags/enable-enhanced-instruction-set.gyp +68 -0
- data/ext/gyp/test/win/compiler-flags/exception-handling-on.cc +24 -0
- data/ext/gyp/test/win/compiler-flags/exception-handling.gyp +46 -0
- data/ext/gyp/test/win/compiler-flags/floating-point-model-fast.cc +19 -0
- data/ext/gyp/test/win/compiler-flags/floating-point-model-precise.cc +19 -0
- data/ext/gyp/test/win/compiler-flags/floating-point-model-strict.cc +19 -0
- data/ext/gyp/test/win/compiler-flags/floating-point-model.gyp +43 -0
- data/ext/gyp/test/win/compiler-flags/force-include-files-with-precompiled.cc +10 -0
- data/ext/gyp/test/win/compiler-flags/force-include-files.cc +8 -0
- data/ext/gyp/test/win/compiler-flags/force-include-files.gyp +36 -0
- data/ext/gyp/test/win/compiler-flags/function-level-linking.cc +11 -0
- data/ext/gyp/test/win/compiler-flags/function-level-linking.gyp +28 -0
- data/ext/gyp/test/win/compiler-flags/hello.cc +7 -0
- data/ext/gyp/test/win/compiler-flags/optimizations.gyp +207 -0
- data/ext/gyp/test/win/compiler-flags/pdbname-override.gyp +26 -0
- data/ext/gyp/test/win/compiler-flags/pdbname.cc +7 -0
- data/ext/gyp/test/win/compiler-flags/pdbname.gyp +24 -0
- data/ext/gyp/test/win/compiler-flags/precomp.cc +6 -0
- data/ext/gyp/test/win/compiler-flags/rtti-on.cc +11 -0
- data/ext/gyp/test/win/compiler-flags/rtti.gyp +37 -0
- data/ext/gyp/test/win/compiler-flags/runtime-checks.cc +11 -0
- data/ext/gyp/test/win/compiler-flags/runtime-checks.gyp +29 -0
- data/ext/gyp/test/win/compiler-flags/runtime-library-md.cc +19 -0
- data/ext/gyp/test/win/compiler-flags/runtime-library-mdd.cc +19 -0
- data/ext/gyp/test/win/compiler-flags/runtime-library-mt.cc +19 -0
- data/ext/gyp/test/win/compiler-flags/runtime-library-mtd.cc +19 -0
- data/ext/gyp/test/win/compiler-flags/runtime-library.gyp +48 -0
- data/ext/gyp/test/win/compiler-flags/subdir/header.h +0 -0
- data/ext/gyp/test/win/compiler-flags/treat-wchar-t-as-built-in-type.gyp +33 -0
- data/ext/gyp/test/win/compiler-flags/treat-wchar-t-as-built-in-type1.cc +11 -0
- data/ext/gyp/test/win/compiler-flags/treat-wchar-t-as-built-in-type2.cc +11 -0
- data/ext/gyp/test/win/compiler-flags/uninit.cc +13 -0
- data/ext/gyp/test/win/compiler-flags/warning-as-error.cc +9 -0
- data/ext/gyp/test/win/compiler-flags/warning-as-error.gyp +37 -0
- data/ext/gyp/test/win/compiler-flags/warning-level.gyp +115 -0
- data/ext/gyp/test/win/compiler-flags/warning-level1.cc +8 -0
- data/ext/gyp/test/win/compiler-flags/warning-level2.cc +14 -0
- data/ext/gyp/test/win/compiler-flags/warning-level3.cc +11 -0
- data/ext/gyp/test/win/compiler-flags/warning-level4.cc +10 -0
- data/ext/gyp/test/win/enable-winrt/dllmain.cc +30 -0
- data/ext/gyp/test/win/enable-winrt/enable-winrt.gyp +39 -0
- data/ext/gyp/test/win/generator-output-different-drive/gyptest-generator-output-different-drive.py +44 -0
- data/ext/gyp/test/win/generator-output-different-drive/prog.c +10 -0
- data/ext/gyp/test/win/generator-output-different-drive/prog.gyp +15 -0
- data/ext/gyp/test/win/gyptest-asm-files.py +26 -0
- data/ext/gyp/test/win/gyptest-cl-additional-include-dirs.py +22 -0
- data/ext/gyp/test/win/gyptest-cl-additional-options.py +28 -0
- data/ext/gyp/test/win/gyptest-cl-analysis.py +30 -0
- data/ext/gyp/test/win/gyptest-cl-buffer-security-check.py +53 -0
- data/ext/gyp/test/win/gyptest-cl-calling-convention.py +22 -0
- data/ext/gyp/test/win/gyptest-cl-character-set.py +22 -0
- data/ext/gyp/test/win/gyptest-cl-compile-as-managed.py +24 -0
- data/ext/gyp/test/win/gyptest-cl-compile-as-winrt.py +20 -0
- data/ext/gyp/test/win/gyptest-cl-debug-format.py +43 -0
- data/ext/gyp/test/win/gyptest-cl-default-char-is-unsigned.py +22 -0
- data/ext/gyp/test/win/gyptest-cl-disable-specific-warnings.py +32 -0
- data/ext/gyp/test/win/gyptest-cl-enable-enhanced-instruction-set.py +49 -0
- data/ext/gyp/test/win/gyptest-cl-exception-handling.py +33 -0
- data/ext/gyp/test/win/gyptest-cl-floating-point-model.py +22 -0
- data/ext/gyp/test/win/gyptest-cl-force-include-files.py +22 -0
- data/ext/gyp/test/win/gyptest-cl-function-level-linking.py +54 -0
- data/ext/gyp/test/win/gyptest-cl-optimizations.py +105 -0
- data/ext/gyp/test/win/gyptest-cl-pdbname-override.py +27 -0
- data/ext/gyp/test/win/gyptest-cl-pdbname.py +30 -0
- data/ext/gyp/test/win/gyptest-cl-rtti.py +30 -0
- data/ext/gyp/test/win/gyptest-cl-runtime-checks.py +30 -0
- data/ext/gyp/test/win/gyptest-cl-runtime-library.py +22 -0
- data/ext/gyp/test/win/gyptest-cl-treat-wchar-t-as-built-in-type.py +22 -0
- data/ext/gyp/test/win/gyptest-cl-warning-as-error.py +30 -0
- data/ext/gyp/test/win/gyptest-cl-warning-level.py +41 -0
- data/ext/gyp/test/win/gyptest-command-quote.py +42 -0
- data/ext/gyp/test/win/gyptest-crosscompile-ar.py +29 -0
- data/ext/gyp/test/win/gyptest-lib-ltcg.py +22 -0
- data/ext/gyp/test/win/gyptest-link-additional-deps.py +22 -0
- data/ext/gyp/test/win/gyptest-link-additional-options.py +22 -0
- data/ext/gyp/test/win/gyptest-link-aslr.py +35 -0
- data/ext/gyp/test/win/gyptest-link-base-address.py +62 -0
- data/ext/gyp/test/win/gyptest-link-debug-info.py +26 -0
- data/ext/gyp/test/win/gyptest-link-default-libs.py +22 -0
- data/ext/gyp/test/win/gyptest-link-deffile.py +43 -0
- data/ext/gyp/test/win/gyptest-link-defrelink.py +56 -0
- data/ext/gyp/test/win/gyptest-link-delay-load-dlls.py +35 -0
- data/ext/gyp/test/win/gyptest-link-embed-manifest.py +100 -0
- data/ext/gyp/test/win/gyptest-link-enable-uac.py +104 -0
- data/ext/gyp/test/win/gyptest-link-enable-winrt-app-revision.py +43 -0
- data/ext/gyp/test/win/gyptest-link-enable-winrt-target-platform-version.py +47 -0
- data/ext/gyp/test/win/gyptest-link-enable-winrt.py +37 -0
- data/ext/gyp/test/win/gyptest-link-entrypointsymbol.py +24 -0
- data/ext/gyp/test/win/gyptest-link-fixed-base.py +40 -0
- data/ext/gyp/test/win/gyptest-link-force-symbol-reference.py +26 -0
- data/ext/gyp/test/win/gyptest-link-generate-manifest.py +127 -0
- data/ext/gyp/test/win/gyptest-link-incremental.py +37 -0
- data/ext/gyp/test/win/gyptest-link-large-address-aware.py +35 -0
- data/ext/gyp/test/win/gyptest-link-large-pdb.py +76 -0
- data/ext/gyp/test/win/gyptest-link-library-adjust.py +21 -0
- data/ext/gyp/test/win/gyptest-link-library-directories.py +35 -0
- data/ext/gyp/test/win/gyptest-link-ltcg.py +44 -0
- data/ext/gyp/test/win/gyptest-link-mapfile.py +44 -0
- data/ext/gyp/test/win/gyptest-link-nodefaultlib.py +24 -0
- data/ext/gyp/test/win/gyptest-link-noimportlib.py +30 -0
- data/ext/gyp/test/win/gyptest-link-nxcompat.py +37 -0
- data/ext/gyp/test/win/gyptest-link-opt-icf.py +41 -0
- data/ext/gyp/test/win/gyptest-link-opt-ref.py +40 -0
- data/ext/gyp/test/win/gyptest-link-ordering.py +103 -0
- data/ext/gyp/test/win/gyptest-link-outputfile.py +28 -0
- data/ext/gyp/test/win/gyptest-link-pdb-no-output.py +25 -0
- data/ext/gyp/test/win/gyptest-link-pdb-output.py +33 -0
- data/ext/gyp/test/win/gyptest-link-pdb.py +35 -0
- data/ext/gyp/test/win/gyptest-link-pgo.py +75 -0
- data/ext/gyp/test/win/gyptest-link-profile.py +37 -0
- data/ext/gyp/test/win/gyptest-link-restat-importlib.py +47 -0
- data/ext/gyp/test/win/gyptest-link-safeseh.py +46 -0
- data/ext/gyp/test/win/gyptest-link-shard.py +30 -0
- data/ext/gyp/test/win/gyptest-link-stacksize.py +62 -0
- data/ext/gyp/test/win/gyptest-link-subsystem.py +38 -0
- data/ext/gyp/test/win/gyptest-link-target-machine.py +28 -0
- data/ext/gyp/test/win/gyptest-link-tsaware.py +33 -0
- data/ext/gyp/test/win/gyptest-link-uldi-depending-on-module.py +24 -0
- data/ext/gyp/test/win/gyptest-link-uldi.py +28 -0
- data/ext/gyp/test/win/gyptest-link-unsupported-manifest.py +27 -0
- data/ext/gyp/test/win/gyptest-link-update-manifest.py +104 -0
- data/ext/gyp/test/win/gyptest-link-warnings-as-errors.py +24 -0
- data/ext/gyp/test/win/gyptest-long-command-line.py +23 -0
- data/ext/gyp/test/win/gyptest-macro-projectname.py +24 -0
- data/ext/gyp/test/win/gyptest-macro-targetext.py +26 -0
- data/ext/gyp/test/win/gyptest-macro-targetfilename.py +37 -0
- data/ext/gyp/test/win/gyptest-macro-targetname.py +29 -0
- data/ext/gyp/test/win/gyptest-macro-targetpath.py +30 -0
- data/ext/gyp/test/win/gyptest-macro-vcinstalldir.py +24 -0
- data/ext/gyp/test/win/gyptest-macros-containing-gyp.py +21 -0
- data/ext/gyp/test/win/gyptest-macros-in-inputs-and-outputs.py +27 -0
- data/ext/gyp/test/win/gyptest-midl-excluded.py +22 -0
- data/ext/gyp/test/win/gyptest-midl-includedirs.py +21 -0
- data/ext/gyp/test/win/gyptest-midl-rules.py +28 -0
- data/ext/gyp/test/win/gyptest-ml-safeseh.py +22 -0
- data/ext/gyp/test/win/gyptest-quoting-commands.py +25 -0
- data/ext/gyp/test/win/gyptest-rc-build.py +29 -0
- data/ext/gyp/test/win/gyptest-sys.py +27 -0
- data/ext/gyp/test/win/gyptest-system-include.py +21 -0
- data/ext/gyp/test/win/idl-excluded/bad.idl +6 -0
- data/ext/gyp/test/win/idl-excluded/copy-file.py +11 -0
- data/ext/gyp/test/win/idl-excluded/idl-excluded.gyp +58 -0
- data/ext/gyp/test/win/idl-excluded/program.cc +7 -0
- data/ext/gyp/test/win/idl-includedirs/hello.cc +7 -0
- data/ext/gyp/test/win/idl-includedirs/idl-includedirs.gyp +26 -0
- data/ext/gyp/test/win/idl-includedirs/subdir/bar.idl +13 -0
- data/ext/gyp/test/win/idl-includedirs/subdir/foo.idl +14 -0
- data/ext/gyp/test/win/idl-rules/Window.idl +9 -0
- data/ext/gyp/test/win/idl-rules/basic-idl.gyp +67 -0
- data/ext/gyp/test/win/idl-rules/history_indexer.idl +17 -0
- data/ext/gyp/test/win/idl-rules/history_indexer_user.cc +15 -0
- data/ext/gyp/test/win/idl-rules/idl_compiler.py +17 -0
- data/ext/gyp/test/win/importlib/dll_no_exports.cc +9 -0
- data/ext/gyp/test/win/importlib/has-exports.cc +10 -0
- data/ext/gyp/test/win/importlib/hello.cc +9 -0
- data/ext/gyp/test/win/importlib/importlib.gyp +30 -0
- data/ext/gyp/test/win/importlib/noimplib.gyp +16 -0
- data/ext/gyp/test/win/large-pdb/dllmain.cc +9 -0
- data/ext/gyp/test/win/large-pdb/large-pdb.gyp +98 -0
- data/ext/gyp/test/win/large-pdb/main.cc +7 -0
- data/ext/gyp/test/win/lib-crosscompile/answer.cc +9 -0
- data/ext/gyp/test/win/lib-crosscompile/answer.h +5 -0
- data/ext/gyp/test/win/lib-crosscompile/use_host_ar.gyp +17 -0
- data/ext/gyp/test/win/lib-flags/answer.cc +9 -0
- data/ext/gyp/test/win/lib-flags/answer.h +5 -0
- data/ext/gyp/test/win/lib-flags/ltcg.gyp +21 -0
- data/ext/gyp/test/win/linker-flags/a/x.cc +7 -0
- data/ext/gyp/test/win/linker-flags/a/z.cc +7 -0
- data/ext/gyp/test/win/linker-flags/additional-deps.cc +10 -0
- data/ext/gyp/test/win/linker-flags/additional-deps.gyp +30 -0
- data/ext/gyp/test/win/linker-flags/additional-options.gyp +29 -0
- data/ext/gyp/test/win/linker-flags/aslr.gyp +35 -0
- data/ext/gyp/test/win/linker-flags/b/y.cc +7 -0
- data/ext/gyp/test/win/linker-flags/base-address.gyp +38 -0
- data/ext/gyp/test/win/linker-flags/debug-info.gyp +28 -0
- data/ext/gyp/test/win/linker-flags/deffile-multiple.gyp +17 -0
- data/ext/gyp/test/win/linker-flags/deffile.cc +13 -0
- data/ext/gyp/test/win/linker-flags/deffile.def +8 -0
- data/ext/gyp/test/win/linker-flags/deffile.gyp +38 -0
- data/ext/gyp/test/win/linker-flags/delay-load-dlls.gyp +35 -0
- data/ext/gyp/test/win/linker-flags/delay-load.cc +10 -0
- data/ext/gyp/test/win/linker-flags/embed-manifest.gyp +109 -0
- data/ext/gyp/test/win/linker-flags/enable-uac.gyp +45 -0
- data/ext/gyp/test/win/linker-flags/entrypointsymbol.cc +13 -0
- data/ext/gyp/test/win/linker-flags/entrypointsymbol.gyp +28 -0
- data/ext/gyp/test/win/linker-flags/extra.manifest +11 -0
- data/ext/gyp/test/win/linker-flags/extra2.manifest +11 -0
- data/ext/gyp/test/win/linker-flags/fixed-base.gyp +52 -0
- data/ext/gyp/test/win/linker-flags/force-symbol-reference.gyp +39 -0
- data/ext/gyp/test/win/linker-flags/generate-manifest.gyp +166 -0
- data/ext/gyp/test/win/linker-flags/hello.cc +7 -0
- data/ext/gyp/test/win/linker-flags/incremental.gyp +65 -0
- data/ext/gyp/test/win/linker-flags/inline_test.cc +12 -0
- data/ext/gyp/test/win/linker-flags/inline_test.h +5 -0
- data/ext/gyp/test/win/linker-flags/inline_test_main.cc +15 -0
- data/ext/gyp/test/win/linker-flags/large-address-aware.gyp +28 -0
- data/ext/gyp/test/win/linker-flags/library-adjust.cc +10 -0
- data/ext/gyp/test/win/linker-flags/library-adjust.gyp +16 -0
- data/ext/gyp/test/win/linker-flags/library-directories-define.cc +7 -0
- data/ext/gyp/test/win/linker-flags/library-directories-reference.cc +10 -0
- data/ext/gyp/test/win/linker-flags/library-directories.gyp +42 -0
- data/ext/gyp/test/win/linker-flags/link-ordering.gyp +95 -0
- data/ext/gyp/test/win/linker-flags/link-warning.cc +10 -0
- data/ext/gyp/test/win/linker-flags/ltcg.gyp +42 -0
- data/ext/gyp/test/win/linker-flags/main-crt.c +8 -0
- data/ext/gyp/test/win/linker-flags/manifest-in-comment.cc +13 -0
- data/ext/gyp/test/win/linker-flags/mapfile.cc +12 -0
- data/ext/gyp/test/win/linker-flags/mapfile.gyp +45 -0
- data/ext/gyp/test/win/linker-flags/no-default-libs.cc +18 -0
- data/ext/gyp/test/win/linker-flags/no-default-libs.gyp +13 -0
- data/ext/gyp/test/win/linker-flags/nodefaultlib.cc +13 -0
- data/ext/gyp/test/win/linker-flags/nodefaultlib.gyp +30 -0
- data/ext/gyp/test/win/linker-flags/nxcompat.gyp +35 -0
- data/ext/gyp/test/win/linker-flags/opt-icf.cc +29 -0
- data/ext/gyp/test/win/linker-flags/opt-icf.gyp +63 -0
- data/ext/gyp/test/win/linker-flags/opt-ref.cc +11 -0
- data/ext/gyp/test/win/linker-flags/opt-ref.gyp +56 -0
- data/ext/gyp/test/win/linker-flags/outputfile.gyp +58 -0
- data/ext/gyp/test/win/linker-flags/pdb-output.gyp +49 -0
- data/ext/gyp/test/win/linker-flags/pgo.gyp +143 -0
- data/ext/gyp/test/win/linker-flags/profile.gyp +50 -0
- data/ext/gyp/test/win/linker-flags/program-database.gyp +40 -0
- data/ext/gyp/test/win/linker-flags/safeseh.gyp +79 -0
- data/ext/gyp/test/win/linker-flags/safeseh_hello.cc +11 -0
- data/ext/gyp/test/win/linker-flags/safeseh_zero.asm +10 -0
- data/ext/gyp/test/win/linker-flags/safeseh_zero64.asm +9 -0
- data/ext/gyp/test/win/linker-flags/stacksize.gyp +44 -0
- data/ext/gyp/test/win/linker-flags/subdir/library.gyp +13 -0
- data/ext/gyp/test/win/linker-flags/subsystem-windows.cc +9 -0
- data/ext/gyp/test/win/linker-flags/subsystem.gyp +70 -0
- data/ext/gyp/test/win/linker-flags/target-machine.gyp +48 -0
- data/ext/gyp/test/win/linker-flags/tsaware.gyp +28 -0
- data/ext/gyp/test/win/linker-flags/unsupported-manifest.gyp +13 -0
- data/ext/gyp/test/win/linker-flags/update_pgd.py +35 -0
- data/ext/gyp/test/win/linker-flags/warn-as-error.gyp +33 -0
- data/ext/gyp/test/win/linker-flags/x.cc +7 -0
- data/ext/gyp/test/win/linker-flags/y.cc +7 -0
- data/ext/gyp/test/win/linker-flags/z.cc +7 -0
- data/ext/gyp/test/win/long-command-line/function.cc +7 -0
- data/ext/gyp/test/win/long-command-line/hello.cc +7 -0
- data/ext/gyp/test/win/long-command-line/long-command-line.gyp +54 -0
- data/ext/gyp/test/win/ml-safeseh/a.asm +10 -0
- data/ext/gyp/test/win/ml-safeseh/hello.cc +11 -0
- data/ext/gyp/test/win/ml-safeseh/ml-safeseh.gyp +24 -0
- data/ext/gyp/test/win/precompiled/gyptest-all.py +21 -0
- data/ext/gyp/test/win/precompiled/hello.c +14 -0
- data/ext/gyp/test/win/precompiled/hello.gyp +28 -0
- data/ext/gyp/test/win/precompiled/hello2.c +13 -0
- data/ext/gyp/test/win/precompiled/precomp.c +8 -0
- data/ext/gyp/test/win/rc-build/Resource.h +26 -0
- data/ext/gyp/test/win/rc-build/hello.cpp +30 -0
- data/ext/gyp/test/win/rc-build/hello.gyp +92 -0
- data/ext/gyp/test/win/rc-build/hello.h +3 -0
- data/ext/gyp/test/win/rc-build/hello.ico +0 -0
- data/ext/gyp/test/win/rc-build/hello.rc +86 -0
- data/ext/gyp/test/win/rc-build/hello3.rc +87 -0
- data/ext/gyp/test/win/rc-build/small.ico +0 -0
- data/ext/gyp/test/win/rc-build/subdir/hello2.rc +87 -0
- data/ext/gyp/test/win/rc-build/subdir/include.h +1 -0
- data/ext/gyp/test/win/rc-build/targetver.h +24 -0
- data/ext/gyp/test/win/shard/hello.cc +7 -0
- data/ext/gyp/test/win/shard/hello1.cc +7 -0
- data/ext/gyp/test/win/shard/hello2.cc +7 -0
- data/ext/gyp/test/win/shard/hello3.cc +7 -0
- data/ext/gyp/test/win/shard/hello4.cc +7 -0
- data/ext/gyp/test/win/shard/shard.gyp +31 -0
- data/ext/gyp/test/win/shard/shard_ref.gyp +41 -0
- data/ext/gyp/test/win/system-include/bar/header.h +0 -0
- data/ext/gyp/test/win/system-include/common/commonheader.h +0 -0
- data/ext/gyp/test/win/system-include/foo/header.h +0 -0
- data/ext/gyp/test/win/system-include/main.cc +4 -0
- data/ext/gyp/test/win/system-include/test.gyp +26 -0
- data/ext/gyp/test/win/uldi/a.cc +7 -0
- data/ext/gyp/test/win/uldi/b.cc +7 -0
- data/ext/gyp/test/win/uldi/dll.cc +6 -0
- data/ext/gyp/test/win/uldi/exe.cc +7 -0
- data/ext/gyp/test/win/uldi/main.cc +10 -0
- data/ext/gyp/test/win/uldi/uldi-depending-on-module.gyp +42 -0
- data/ext/gyp/test/win/uldi/uldi.gyp +45 -0
- data/ext/gyp/test/win/vs-macros/as.py +20 -0
- data/ext/gyp/test/win/vs-macros/containing-gyp.gyp +39 -0
- data/ext/gyp/test/win/vs-macros/do_stuff.py +8 -0
- data/ext/gyp/test/win/vs-macros/hello.cc +7 -0
- data/ext/gyp/test/win/vs-macros/input-output-macros.gyp +32 -0
- data/ext/gyp/test/win/vs-macros/input.S +0 -0
- data/ext/gyp/test/win/vs-macros/projectname.gyp +29 -0
- data/ext/gyp/test/win/vs-macros/stuff.blah +1 -0
- data/ext/gyp/test/win/vs-macros/targetext.gyp +59 -0
- data/ext/gyp/test/win/vs-macros/targetfilename.gyp +59 -0
- data/ext/gyp/test/win/vs-macros/targetname.gyp +52 -0
- data/ext/gyp/test/win/vs-macros/targetpath.gyp +59 -0
- data/ext/gyp/test/win/vs-macros/test_exists.py +10 -0
- data/ext/gyp/test/win/vs-macros/vcinstalldir.gyp +41 -0
- data/ext/gyp/test/win/win-driver-target-type/win-driver-target-type.c +10 -0
- data/ext/gyp/test/win/win-driver-target-type/win-driver-target-type.gyp +32 -0
- data/ext/gyp/test/win/win-driver-target-type/win-driver-target-type.h +13 -0
- data/ext/gyp/test/win/win-driver-target-type/win-driver-target-type.rc +14 -0
- data/ext/gyp/test/win/win-tool/copies_readonly_files.gyp +29 -0
- data/ext/gyp/test/win/win-tool/gyptest-win-tool-handles-readonly-files.py +55 -0
- data/ext/gyp/test/win/winrt-app-type-revision/dllmain.cc +30 -0
- data/ext/gyp/test/win/winrt-app-type-revision/winrt-app-type-revison.gyp +43 -0
- data/ext/gyp/test/win/winrt-target-platform-version/dllmain.cc +30 -0
- data/ext/gyp/test/win/winrt-target-platform-version/winrt-target-platform-version.gyp +49 -0
- data/ext/gyp/test/xcode-ninja/list_excluded/gyptest-all.py +49 -0
- data/ext/gyp/test/xcode-ninja/list_excluded/hello.cpp +7 -0
- data/ext/gyp/test/xcode-ninja/list_excluded/hello_exclude.gyp +19 -0
- data/ext/gyp/test/xcode-ninja/list_excluded/hello_excluded.cpp +7 -0
- data/ext/gyp/tools/README +15 -0
- data/ext/gyp/tools/Xcode/README +5 -0
- data/ext/gyp/tools/Xcode/Specifications/gyp.pbfilespec +27 -0
- data/ext/gyp/tools/Xcode/Specifications/gyp.xclangspec +226 -0
- data/ext/gyp/tools/emacs/README +12 -0
- data/ext/gyp/tools/emacs/gyp-tests.el +63 -0
- data/ext/gyp/tools/emacs/gyp.el +275 -0
- data/ext/gyp/tools/emacs/run-unit-tests.sh +7 -0
- data/ext/gyp/tools/emacs/testdata/media.gyp +1105 -0
- data/ext/gyp/tools/emacs/testdata/media.gyp.fontified +1107 -0
- data/ext/gyp/tools/graphviz.py +102 -0
- data/ext/gyp/tools/pretty_gyp.py +156 -0
- data/ext/gyp/tools/pretty_sln.py +171 -0
- data/ext/gyp/tools/pretty_vcproj.py +337 -0
- data/ext/libuv/.gitattributes +1 -0
- data/ext/libuv/.github/ISSUE_TEMPLATE.md +13 -0
- data/ext/libuv/.github/stale.yml +22 -0
- data/ext/libuv/.gitignore +80 -0
- data/ext/libuv/.mailmap +50 -0
- data/ext/libuv/AUTHORS +415 -0
- data/ext/libuv/CMakeLists.txt +430 -0
- data/ext/libuv/CONTRIBUTING.md +172 -0
- data/ext/libuv/ChangeLog +4548 -0
- data/ext/libuv/LICENSE +70 -0
- data/ext/libuv/LICENSE-docs +396 -0
- data/ext/libuv/MAINTAINERS.md +48 -0
- data/ext/libuv/Makefile.am +548 -0
- data/ext/libuv/README.md +431 -0
- data/ext/libuv/SUPPORTED_PLATFORMS.md +68 -0
- data/ext/libuv/android-configure-arm +23 -0
- data/ext/libuv/android-configure-arm64 +23 -0
- data/ext/libuv/android-configure-x86 +23 -0
- data/ext/libuv/android-configure-x86_64 +25 -0
- data/ext/libuv/appveyor.yml +32 -0
- data/ext/libuv/autogen.sh +46 -0
- data/ext/libuv/common.gypi +213 -0
- data/ext/libuv/configure.ac +82 -0
- data/ext/libuv/docs/Makefile +183 -0
- data/ext/libuv/docs/code/cgi/main.c +81 -0
- data/ext/libuv/docs/code/cgi/tick.c +13 -0
- data/ext/libuv/docs/code/detach/main.c +31 -0
- data/ext/libuv/docs/code/dns/main.c +80 -0
- data/ext/libuv/docs/code/helloworld/main.c +15 -0
- data/ext/libuv/docs/code/idle-basic/main.c +24 -0
- data/ext/libuv/docs/code/idle-compute/main.c +43 -0
- data/ext/libuv/docs/code/interfaces/main.c +33 -0
- data/ext/libuv/docs/code/locks/main.c +57 -0
- data/ext/libuv/docs/code/multi-echo-server/hammer.js +20 -0
- data/ext/libuv/docs/code/multi-echo-server/main.c +114 -0
- data/ext/libuv/docs/code/multi-echo-server/worker.c +88 -0
- data/ext/libuv/docs/code/onchange/main.c +44 -0
- data/ext/libuv/docs/code/pipe-echo-server/main.c +94 -0
- data/ext/libuv/docs/code/plugin/hello.c +5 -0
- data/ext/libuv/docs/code/plugin/main.c +39 -0
- data/ext/libuv/docs/code/plugin/plugin.h +7 -0
- data/ext/libuv/docs/code/proc-streams/main.c +49 -0
- data/ext/libuv/docs/code/proc-streams/test.c +8 -0
- data/ext/libuv/docs/code/progress/main.c +47 -0
- data/ext/libuv/docs/code/queue-cancel/main.c +59 -0
- data/ext/libuv/docs/code/queue-work/main.c +44 -0
- data/ext/libuv/docs/code/ref-timer/main.c +29 -0
- data/ext/libuv/docs/code/signal/main.c +66 -0
- data/ext/libuv/docs/code/spawn/main.c +36 -0
- data/ext/libuv/docs/code/tcp-echo-server/main.c +87 -0
- data/ext/libuv/docs/code/thread-create/main.c +36 -0
- data/ext/libuv/docs/code/tty/main.c +29 -0
- data/ext/libuv/docs/code/tty-gravity/main.c +48 -0
- data/ext/libuv/docs/code/udp-dhcp/main.c +127 -0
- data/ext/libuv/docs/code/uvcat/main.c +63 -0
- data/ext/libuv/docs/code/uvstop/main.c +33 -0
- data/ext/libuv/docs/code/uvtee/main.c +80 -0
- data/ext/libuv/docs/code/uvwget/main.c +166 -0
- data/ext/libuv/docs/make.bat +243 -0
- data/ext/libuv/docs/src/api.rst +35 -0
- data/ext/libuv/docs/src/async.rst +65 -0
- data/ext/libuv/docs/src/check.rst +46 -0
- data/ext/libuv/docs/src/conf.py +348 -0
- data/ext/libuv/docs/src/design.rst +140 -0
- data/ext/libuv/docs/src/dll.rst +44 -0
- data/ext/libuv/docs/src/dns.rst +108 -0
- data/ext/libuv/docs/src/errors.rst +365 -0
- data/ext/libuv/docs/src/fs.rst +689 -0
- data/ext/libuv/docs/src/fs_event.rst +132 -0
- data/ext/libuv/docs/src/fs_poll.rst +77 -0
- data/ext/libuv/docs/src/guide/about.rst +22 -0
- data/ext/libuv/docs/src/guide/basics.rst +219 -0
- data/ext/libuv/docs/src/guide/eventloops.rst +48 -0
- data/ext/libuv/docs/src/guide/filesystem.rst +330 -0
- data/ext/libuv/docs/src/guide/introduction.rst +75 -0
- data/ext/libuv/docs/src/guide/networking.rst +250 -0
- data/ext/libuv/docs/src/guide/processes.rst +406 -0
- data/ext/libuv/docs/src/guide/threads.rst +385 -0
- data/ext/libuv/docs/src/guide/utilities.rst +437 -0
- data/ext/libuv/docs/src/guide.rst +22 -0
- data/ext/libuv/docs/src/handle.rst +283 -0
- data/ext/libuv/docs/src/idle.rst +54 -0
- data/ext/libuv/docs/src/index.rst +62 -0
- data/ext/libuv/docs/src/loop.rst +238 -0
- data/ext/libuv/docs/src/migration_010_100.rst +244 -0
- data/ext/libuv/docs/src/misc.rst +702 -0
- data/ext/libuv/docs/src/pipe.rst +116 -0
- data/ext/libuv/docs/src/poll.rst +121 -0
- data/ext/libuv/docs/src/prepare.rst +46 -0
- data/ext/libuv/docs/src/process.rst +250 -0
- data/ext/libuv/docs/src/request.rst +116 -0
- data/ext/libuv/docs/src/signal.rst +101 -0
- data/ext/libuv/docs/src/sphinx-plugins/manpage.py +45 -0
- data/ext/libuv/docs/src/static/architecture.png +0 -0
- data/ext/libuv/docs/src/static/diagrams.key/Data/st0-311.jpg +0 -0
- data/ext/libuv/docs/src/static/diagrams.key/Data/st1-475.jpg +0 -0
- data/ext/libuv/docs/src/static/diagrams.key/Index.zip +0 -0
- data/ext/libuv/docs/src/static/diagrams.key/Metadata/BuildVersionHistory.plist +8 -0
- data/ext/libuv/docs/src/static/diagrams.key/Metadata/DocumentIdentifier +1 -0
- data/ext/libuv/docs/src/static/diagrams.key/Metadata/Properties.plist +0 -0
- data/ext/libuv/docs/src/static/diagrams.key/preview-micro.jpg +0 -0
- data/ext/libuv/docs/src/static/diagrams.key/preview-web.jpg +0 -0
- data/ext/libuv/docs/src/static/diagrams.key/preview.jpg +0 -0
- data/ext/libuv/docs/src/static/favicon.ico +0 -0
- data/ext/libuv/docs/src/static/logo.png +0 -0
- data/ext/libuv/docs/src/static/loop_iteration.png +0 -0
- data/ext/libuv/docs/src/stream.rst +237 -0
- data/ext/libuv/docs/src/tcp.rst +125 -0
- data/ext/libuv/docs/src/threading.rst +197 -0
- data/ext/libuv/docs/src/threadpool.rst +69 -0
- data/ext/libuv/docs/src/timer.rst +81 -0
- data/ext/libuv/docs/src/tty.rst +139 -0
- data/ext/libuv/docs/src/udp.rst +390 -0
- data/ext/libuv/docs/src/upgrading.rst +11 -0
- data/ext/libuv/docs/src/version.rst +60 -0
- data/ext/libuv/gyp_uv.py +73 -0
- data/ext/libuv/img/banner.png +0 -0
- data/ext/libuv/img/logos.svg +152 -0
- data/ext/libuv/include/uv/aix.h +32 -0
- data/ext/libuv/include/uv/android-ifaddrs.h +54 -0
- data/ext/libuv/include/uv/bsd.h +34 -0
- data/ext/libuv/include/uv/darwin.h +61 -0
- data/ext/libuv/include/uv/errno.h +448 -0
- data/ext/libuv/include/uv/linux.h +34 -0
- data/ext/libuv/include/uv/os390.h +33 -0
- data/ext/libuv/include/uv/posix.h +31 -0
- data/ext/libuv/include/uv/stdint-msvc2008.h +247 -0
- data/ext/libuv/include/uv/sunos.h +44 -0
- data/ext/libuv/include/uv/threadpool.h +37 -0
- data/ext/libuv/include/uv/tree.h +768 -0
- data/ext/libuv/include/uv/unix.h +505 -0
- data/ext/libuv/include/uv/version.h +43 -0
- data/ext/libuv/include/uv/win.h +691 -0
- data/ext/libuv/include/uv.h +1782 -0
- data/ext/libuv/libuv.pc.in +12 -0
- data/ext/libuv/m4/.gitignore +4 -0
- data/ext/libuv/m4/as_case.m4 +21 -0
- data/ext/libuv/m4/libuv-check-flags.m4 +319 -0
- data/ext/libuv/src/fs-poll.c +287 -0
- data/ext/libuv/src/heap-inl.h +245 -0
- data/ext/libuv/src/idna.c +291 -0
- data/ext/libuv/src/idna.h +31 -0
- data/ext/libuv/src/inet.c +302 -0
- data/ext/libuv/src/queue.h +108 -0
- data/ext/libuv/src/random.c +123 -0
- data/ext/libuv/src/strscpy.c +17 -0
- data/ext/libuv/src/strscpy.h +18 -0
- data/ext/libuv/src/threadpool.c +388 -0
- data/ext/libuv/src/timer.c +181 -0
- data/ext/libuv/src/unix/aix-common.c +337 -0
- data/ext/libuv/src/unix/aix.c +1066 -0
- data/ext/libuv/src/unix/android-ifaddrs.c +712 -0
- data/ext/libuv/src/unix/async.c +298 -0
- data/ext/libuv/src/unix/atomic-ops.h +59 -0
- data/ext/libuv/src/unix/bsd-ifaddrs.c +161 -0
- data/ext/libuv/src/unix/bsd-proctitle.c +93 -0
- data/ext/libuv/src/unix/core.c +1571 -0
- data/ext/libuv/src/unix/cygwin.c +53 -0
- data/ext/libuv/src/unix/darwin-proctitle.c +202 -0
- data/ext/libuv/src/unix/darwin.c +225 -0
- data/ext/libuv/src/unix/dl.c +80 -0
- data/ext/libuv/src/unix/freebsd.c +290 -0
- data/ext/libuv/src/unix/fs.c +2044 -0
- data/ext/libuv/src/unix/fsevents.c +924 -0
- data/ext/libuv/src/unix/getaddrinfo.c +255 -0
- data/ext/libuv/src/unix/getnameinfo.c +121 -0
- data/ext/libuv/src/unix/haiku.c +167 -0
- data/ext/libuv/src/unix/ibmi.c +249 -0
- data/ext/libuv/src/unix/internal.h +331 -0
- data/ext/libuv/src/unix/kqueue.c +544 -0
- data/ext/libuv/src/unix/linux-core.c +1091 -0
- data/ext/libuv/src/unix/linux-inotify.c +354 -0
- data/ext/libuv/src/unix/linux-syscalls.c +394 -0
- data/ext/libuv/src/unix/linux-syscalls.h +153 -0
- data/ext/libuv/src/unix/loop-watcher.c +68 -0
- data/ext/libuv/src/unix/loop.c +194 -0
- data/ext/libuv/src/unix/netbsd.c +259 -0
- data/ext/libuv/src/unix/no-fsevents.c +42 -0
- data/ext/libuv/src/unix/no-proctitle.c +42 -0
- data/ext/libuv/src/unix/openbsd.c +244 -0
- data/ext/libuv/src/unix/os390-syscalls.c +519 -0
- data/ext/libuv/src/unix/os390-syscalls.h +68 -0
- data/ext/libuv/src/unix/os390.c +1003 -0
- data/ext/libuv/src/unix/pipe.c +377 -0
- data/ext/libuv/src/unix/poll.c +150 -0
- data/ext/libuv/src/unix/posix-hrtime.c +35 -0
- data/ext/libuv/src/unix/posix-poll.c +336 -0
- data/ext/libuv/src/unix/process.c +603 -0
- data/ext/libuv/src/unix/procfs-exepath.c +45 -0
- data/ext/libuv/src/unix/proctitle.c +132 -0
- data/ext/libuv/src/unix/pthread-fixes.c +56 -0
- data/ext/libuv/src/unix/random-devurandom.c +93 -0
- data/ext/libuv/src/unix/random-getentropy.c +57 -0
- data/ext/libuv/src/unix/random-getrandom.c +88 -0
- data/ext/libuv/src/unix/random-sysctl-linux.c +99 -0
- data/ext/libuv/src/unix/signal.c +577 -0
- data/ext/libuv/src/unix/spinlock.h +53 -0
- data/ext/libuv/src/unix/stream.c +1697 -0
- data/ext/libuv/src/unix/sunos.c +836 -0
- data/ext/libuv/src/unix/sysinfo-loadavg.c +36 -0
- data/ext/libuv/src/unix/sysinfo-memory.c +42 -0
- data/ext/libuv/src/unix/tcp.c +450 -0
- data/ext/libuv/src/unix/thread.c +852 -0
- data/ext/libuv/src/unix/tty.c +381 -0
- data/ext/libuv/src/unix/udp.c +1136 -0
- data/ext/libuv/src/uv-common.c +812 -0
- data/ext/libuv/src/uv-common.h +326 -0
- data/ext/libuv/src/uv-data-getter-setters.c +98 -0
- data/ext/libuv/src/version.c +45 -0
- data/ext/libuv/src/win/async.c +98 -0
- data/ext/libuv/src/win/atomicops-inl.h +57 -0
- data/ext/libuv/src/win/core.c +657 -0
- data/ext/libuv/src/win/detect-wakeup.c +35 -0
- data/ext/libuv/src/win/dl.c +136 -0
- data/ext/libuv/src/win/error.c +172 -0
- data/ext/libuv/src/win/fs-event.c +589 -0
- data/ext/libuv/src/win/fs-fd-hash-inl.h +178 -0
- data/ext/libuv/src/win/fs.c +3238 -0
- data/ext/libuv/src/win/getaddrinfo.c +463 -0
- data/ext/libuv/src/win/getnameinfo.c +157 -0
- data/ext/libuv/src/win/handle-inl.h +180 -0
- data/ext/libuv/src/win/handle.c +162 -0
- data/ext/libuv/src/win/internal.h +344 -0
- data/ext/libuv/src/win/loop-watcher.c +122 -0
- data/ext/libuv/src/win/pipe.c +2386 -0
- data/ext/libuv/src/win/poll.c +643 -0
- data/ext/libuv/src/win/process-stdio.c +512 -0
- data/ext/libuv/src/win/process.c +1282 -0
- data/ext/libuv/src/win/req-inl.h +221 -0
- data/ext/libuv/src/win/signal.c +277 -0
- data/ext/libuv/src/win/snprintf.c +42 -0
- data/ext/libuv/src/win/stream-inl.h +54 -0
- data/ext/libuv/src/win/stream.c +243 -0
- data/ext/libuv/src/win/tcp.c +1520 -0
- data/ext/libuv/src/win/thread.c +520 -0
- data/ext/libuv/src/win/tty.c +2348 -0
- data/ext/libuv/src/win/udp.c +1185 -0
- data/ext/libuv/src/win/util.c +1879 -0
- data/ext/libuv/src/win/winapi.c +149 -0
- data/ext/libuv/src/win/winapi.h +4751 -0
- data/ext/libuv/src/win/winsock.c +575 -0
- data/ext/libuv/src/win/winsock.h +201 -0
- data/ext/libuv/test/benchmark-async-pummel.c +119 -0
- data/ext/libuv/test/benchmark-async.c +141 -0
- data/ext/libuv/test/benchmark-fs-stat.c +136 -0
- data/ext/libuv/test/benchmark-getaddrinfo.c +92 -0
- data/ext/libuv/test/benchmark-list.h +163 -0
- data/ext/libuv/test/benchmark-loop-count.c +92 -0
- data/ext/libuv/test/benchmark-million-async.c +112 -0
- data/ext/libuv/test/benchmark-million-timers.c +86 -0
- data/ext/libuv/test/benchmark-multi-accept.c +447 -0
- data/ext/libuv/test/benchmark-ping-pongs.c +221 -0
- data/ext/libuv/test/benchmark-pound.c +351 -0
- data/ext/libuv/test/benchmark-pump.c +476 -0
- data/ext/libuv/test/benchmark-sizes.c +46 -0
- data/ext/libuv/test/benchmark-spawn.c +164 -0
- data/ext/libuv/test/benchmark-tcp-write-batch.c +144 -0
- data/ext/libuv/test/benchmark-thread.c +64 -0
- data/ext/libuv/test/benchmark-udp-pummel.c +243 -0
- data/ext/libuv/test/blackhole-server.c +121 -0
- data/ext/libuv/test/dns-server.c +340 -0
- data/ext/libuv/test/echo-server.c +382 -0
- data/ext/libuv/test/fixtures/empty_file +0 -0
- data/ext/libuv/test/fixtures/load_error.node +1 -0
- data/ext/libuv/test/fixtures/lorem_ipsum.txt +1 -0
- data/ext/libuv/test/run-benchmarks.c +65 -0
- data/ext/libuv/test/run-tests.c +239 -0
- data/ext/libuv/test/runner-unix.c +450 -0
- data/ext/libuv/test/runner-unix.h +36 -0
- data/ext/libuv/test/runner-win.c +357 -0
- data/ext/libuv/test/runner-win.h +41 -0
- data/ext/libuv/test/runner.c +431 -0
- data/ext/libuv/test/runner.h +176 -0
- data/ext/libuv/test/task.h +238 -0
- data/ext/libuv/test/test-active.c +84 -0
- data/ext/libuv/test/test-async-null-cb.c +64 -0
- data/ext/libuv/test/test-async.c +134 -0
- data/ext/libuv/test/test-barrier.c +148 -0
- data/ext/libuv/test/test-callback-order.c +77 -0
- data/ext/libuv/test/test-callback-stack.c +204 -0
- data/ext/libuv/test/test-close-fd.c +80 -0
- data/ext/libuv/test/test-close-order.c +80 -0
- data/ext/libuv/test/test-condvar.c +267 -0
- data/ext/libuv/test/test-connect-unspecified.c +63 -0
- data/ext/libuv/test/test-connection-fail.c +151 -0
- data/ext/libuv/test/test-cwd-and-chdir.c +58 -0
- data/ext/libuv/test/test-default-loop-close.c +59 -0
- data/ext/libuv/test/test-delayed-accept.c +189 -0
- data/ext/libuv/test/test-dlerror.c +61 -0
- data/ext/libuv/test/test-eintr-handling.c +94 -0
- data/ext/libuv/test/test-embed.c +139 -0
- data/ext/libuv/test/test-emfile.c +121 -0
- data/ext/libuv/test/test-env-vars.c +140 -0
- data/ext/libuv/test/test-error.c +79 -0
- data/ext/libuv/test/test-fail-always.c +29 -0
- data/ext/libuv/test/test-fork.c +683 -0
- data/ext/libuv/test/test-fs-copyfile.c +209 -0
- data/ext/libuv/test/test-fs-event.c +1165 -0
- data/ext/libuv/test/test-fs-fd-hash.c +133 -0
- data/ext/libuv/test/test-fs-open-flags.c +435 -0
- data/ext/libuv/test/test-fs-poll.c +300 -0
- data/ext/libuv/test/test-fs-readdir.c +462 -0
- data/ext/libuv/test/test-fs.c +4238 -0
- data/ext/libuv/test/test-get-currentexe.c +86 -0
- data/ext/libuv/test/test-get-loadavg.c +35 -0
- data/ext/libuv/test/test-get-memory.c +40 -0
- data/ext/libuv/test/test-get-passwd.c +86 -0
- data/ext/libuv/test/test-getaddrinfo.c +191 -0
- data/ext/libuv/test/test-gethostname.c +58 -0
- data/ext/libuv/test/test-getnameinfo.c +101 -0
- data/ext/libuv/test/test-getsockname.c +361 -0
- data/ext/libuv/test/test-getters-setters.c +88 -0
- data/ext/libuv/test/test-gettimeofday.c +39 -0
- data/ext/libuv/test/test-handle-fileno.c +125 -0
- data/ext/libuv/test/test-homedir.c +72 -0
- data/ext/libuv/test/test-hrtime.c +52 -0
- data/ext/libuv/test/test-idle.c +99 -0
- data/ext/libuv/test/test-idna.c +195 -0
- data/ext/libuv/test/test-ip4-addr.c +55 -0
- data/ext/libuv/test/test-ip6-addr.c +171 -0
- data/ext/libuv/test/test-ipc-heavy-traffic-deadlock-bug.c +159 -0
- data/ext/libuv/test/test-ipc-send-recv.c +429 -0
- data/ext/libuv/test/test-ipc.c +974 -0
- data/ext/libuv/test/test-list.h +1064 -0
- data/ext/libuv/test/test-loop-alive.c +67 -0
- data/ext/libuv/test/test-loop-close.c +75 -0
- data/ext/libuv/test/test-loop-configure.c +38 -0
- data/ext/libuv/test/test-loop-handles.c +337 -0
- data/ext/libuv/test/test-loop-stop.c +71 -0
- data/ext/libuv/test/test-loop-time.c +63 -0
- data/ext/libuv/test/test-multiple-listen.c +109 -0
- data/ext/libuv/test/test-mutexes.c +182 -0
- data/ext/libuv/test/test-osx-select.c +140 -0
- data/ext/libuv/test/test-pass-always.c +28 -0
- data/ext/libuv/test/test-ping-pong.c +301 -0
- data/ext/libuv/test/test-pipe-bind-error.c +139 -0
- data/ext/libuv/test/test-pipe-close-stdout-read-stdin.c +112 -0
- data/ext/libuv/test/test-pipe-connect-error.c +95 -0
- data/ext/libuv/test/test-pipe-connect-multiple.c +107 -0
- data/ext/libuv/test/test-pipe-connect-prepare.c +83 -0
- data/ext/libuv/test/test-pipe-getsockname.c +266 -0
- data/ext/libuv/test/test-pipe-pending-instances.c +59 -0
- data/ext/libuv/test/test-pipe-sendmsg.c +172 -0
- data/ext/libuv/test/test-pipe-server-close.c +94 -0
- data/ext/libuv/test/test-pipe-set-fchmod.c +90 -0
- data/ext/libuv/test/test-pipe-set-non-blocking.c +99 -0
- data/ext/libuv/test/test-platform-output.c +170 -0
- data/ext/libuv/test/test-poll-close-doesnt-corrupt-stack.c +114 -0
- data/ext/libuv/test/test-poll-close.c +73 -0
- data/ext/libuv/test/test-poll-closesocket.c +92 -0
- data/ext/libuv/test/test-poll-oob.c +210 -0
- data/ext/libuv/test/test-poll.c +668 -0
- data/ext/libuv/test/test-process-priority.c +83 -0
- data/ext/libuv/test/test-process-title-threadsafe.c +89 -0
- data/ext/libuv/test/test-process-title.c +76 -0
- data/ext/libuv/test/test-queue-foreach-delete.c +204 -0
- data/ext/libuv/test/test-random.c +94 -0
- data/ext/libuv/test/test-ref.c +445 -0
- data/ext/libuv/test/test-run-nowait.c +45 -0
- data/ext/libuv/test/test-run-once.c +48 -0
- data/ext/libuv/test/test-semaphore.c +111 -0
- data/ext/libuv/test/test-shutdown-close.c +108 -0
- data/ext/libuv/test/test-shutdown-eof.c +182 -0
- data/ext/libuv/test/test-shutdown-twice.c +85 -0
- data/ext/libuv/test/test-signal-multiple-loops.c +302 -0
- data/ext/libuv/test/test-signal-pending-on-close.c +94 -0
- data/ext/libuv/test/test-signal.c +325 -0
- data/ext/libuv/test/test-socket-buffer-size.c +77 -0
- data/ext/libuv/test/test-spawn.c +1924 -0
- data/ext/libuv/test/test-stdio-over-pipes.c +256 -0
- data/ext/libuv/test/test-strscpy.c +53 -0
- data/ext/libuv/test/test-tcp-alloc-cb-fail.c +123 -0
- data/ext/libuv/test/test-tcp-bind-error.c +254 -0
- data/ext/libuv/test/test-tcp-bind6-error.c +176 -0
- data/ext/libuv/test/test-tcp-close-accept.c +198 -0
- data/ext/libuv/test/test-tcp-close-reset.c +290 -0
- data/ext/libuv/test/test-tcp-close-while-connecting.c +97 -0
- data/ext/libuv/test/test-tcp-close.c +136 -0
- data/ext/libuv/test/test-tcp-connect-error-after-write.c +98 -0
- data/ext/libuv/test/test-tcp-connect-error.c +73 -0
- data/ext/libuv/test/test-tcp-connect-timeout.c +91 -0
- data/ext/libuv/test/test-tcp-connect6-error.c +71 -0
- data/ext/libuv/test/test-tcp-create-socket-early.c +209 -0
- data/ext/libuv/test/test-tcp-flags.c +52 -0
- data/ext/libuv/test/test-tcp-oob.c +146 -0
- data/ext/libuv/test/test-tcp-open.c +400 -0
- data/ext/libuv/test/test-tcp-read-stop.c +76 -0
- data/ext/libuv/test/test-tcp-shutdown-after-write.c +138 -0
- data/ext/libuv/test/test-tcp-try-write-error.c +109 -0
- data/ext/libuv/test/test-tcp-try-write.c +135 -0
- data/ext/libuv/test/test-tcp-unexpected-read.c +117 -0
- data/ext/libuv/test/test-tcp-write-after-connect.c +72 -0
- data/ext/libuv/test/test-tcp-write-fail.c +115 -0
- data/ext/libuv/test/test-tcp-write-queue-order.c +139 -0
- data/ext/libuv/test/test-tcp-write-to-half-open-connection.c +141 -0
- data/ext/libuv/test/test-tcp-writealot.c +180 -0
- data/ext/libuv/test/test-thread-equal.c +45 -0
- data/ext/libuv/test/test-thread.c +286 -0
- data/ext/libuv/test/test-threadpool-cancel.c +349 -0
- data/ext/libuv/test/test-threadpool.c +76 -0
- data/ext/libuv/test/test-timer-again.c +141 -0
- data/ext/libuv/test/test-timer-from-check.c +80 -0
- data/ext/libuv/test/test-timer.c +343 -0
- data/ext/libuv/test/test-tmpdir.c +82 -0
- data/ext/libuv/test/test-tty-duplicate-key.c +321 -0
- data/ext/libuv/test/test-tty.c +464 -0
- data/ext/libuv/test/test-udp-alloc-cb-fail.c +196 -0
- data/ext/libuv/test/test-udp-bind.c +93 -0
- data/ext/libuv/test/test-udp-connect.c +182 -0
- data/ext/libuv/test/test-udp-create-socket-early.c +135 -0
- data/ext/libuv/test/test-udp-dgram-too-big.c +91 -0
- data/ext/libuv/test/test-udp-ipv6.c +200 -0
- data/ext/libuv/test/test-udp-multicast-interface.c +99 -0
- data/ext/libuv/test/test-udp-multicast-interface6.c +103 -0
- data/ext/libuv/test/test-udp-multicast-join.c +181 -0
- data/ext/libuv/test/test-udp-multicast-join6.c +215 -0
- data/ext/libuv/test/test-udp-multicast-ttl.c +94 -0
- data/ext/libuv/test/test-udp-open.c +350 -0
- data/ext/libuv/test/test-udp-options.c +156 -0
- data/ext/libuv/test/test-udp-send-and-recv.c +212 -0
- data/ext/libuv/test/test-udp-send-hang-loop.c +99 -0
- data/ext/libuv/test/test-udp-send-immediate.c +148 -0
- data/ext/libuv/test/test-udp-send-unreachable.c +150 -0
- data/ext/libuv/test/test-udp-try-send.c +121 -0
- data/ext/libuv/test/test-uname.c +69 -0
- data/ext/libuv/test/test-walk-handles.c +77 -0
- data/ext/libuv/test/test-watcher-cross-stop.c +111 -0
- data/ext/libuv/test/test.gyp +293 -0
- data/ext/libuv/tools/make_dist_html.py +124 -0
- data/ext/libuv/tools/vswhere_usability_wrapper.cmd +33 -0
- data/ext/libuv/uv.gyp +368 -0
- data/ext/libuv/vcbuild.bat +184 -0
- data/lib/mt-libuv/tcp.rb +2 -2
- data/lib/mt-libuv/version.rb +1 -1
- data/mt-libuv.gemspec +26 -26
- metadata +2089 -2
@@ -0,0 +1,3238 @@
|
|
1
|
+
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
2
|
+
*
|
3
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
* of this software and associated documentation files (the "Software"), to
|
5
|
+
* deal in the Software without restriction, including without limitation the
|
6
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
7
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
8
|
+
* furnished to do so, subject to the following conditions:
|
9
|
+
*
|
10
|
+
* The above copyright notice and this permission notice shall be included in
|
11
|
+
* all copies or substantial portions of the Software.
|
12
|
+
*
|
13
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
18
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
19
|
+
* IN THE SOFTWARE.
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include <assert.h>
|
23
|
+
#include <stdlib.h>
|
24
|
+
#include <direct.h>
|
25
|
+
#include <errno.h>
|
26
|
+
#include <fcntl.h>
|
27
|
+
#include <io.h>
|
28
|
+
#include <limits.h>
|
29
|
+
#include <sys/stat.h>
|
30
|
+
#include <sys/utime.h>
|
31
|
+
#include <stdio.h>
|
32
|
+
|
33
|
+
#include "uv.h"
|
34
|
+
#include "internal.h"
|
35
|
+
#include "req-inl.h"
|
36
|
+
#include "handle-inl.h"
|
37
|
+
#include "fs-fd-hash-inl.h"
|
38
|
+
|
39
|
+
|
40
|
+
#define UV_FS_FREE_PATHS 0x0002
|
41
|
+
#define UV_FS_FREE_PTR 0x0008
|
42
|
+
#define UV_FS_CLEANEDUP 0x0010
|
43
|
+
|
44
|
+
|
45
|
+
#define INIT(subtype) \
|
46
|
+
do { \
|
47
|
+
if (req == NULL) \
|
48
|
+
return UV_EINVAL; \
|
49
|
+
uv_fs_req_init(loop, req, subtype, cb); \
|
50
|
+
} \
|
51
|
+
while (0)
|
52
|
+
|
53
|
+
#define POST \
|
54
|
+
do { \
|
55
|
+
if (cb != NULL) { \
|
56
|
+
uv__req_register(loop, req); \
|
57
|
+
uv__work_submit(loop, \
|
58
|
+
&req->work_req, \
|
59
|
+
UV__WORK_FAST_IO, \
|
60
|
+
uv__fs_work, \
|
61
|
+
uv__fs_done); \
|
62
|
+
return 0; \
|
63
|
+
} else { \
|
64
|
+
uv__fs_work(&req->work_req); \
|
65
|
+
return req->result; \
|
66
|
+
} \
|
67
|
+
} \
|
68
|
+
while (0)
|
69
|
+
|
70
|
+
#define SET_REQ_RESULT(req, result_value) \
|
71
|
+
do { \
|
72
|
+
req->result = (result_value); \
|
73
|
+
if (req->result == -1) { \
|
74
|
+
req->sys_errno_ = _doserrno; \
|
75
|
+
req->result = uv_translate_sys_error(req->sys_errno_); \
|
76
|
+
} \
|
77
|
+
} while (0)
|
78
|
+
|
79
|
+
#define SET_REQ_WIN32_ERROR(req, sys_errno) \
|
80
|
+
do { \
|
81
|
+
req->sys_errno_ = (sys_errno); \
|
82
|
+
req->result = uv_translate_sys_error(req->sys_errno_); \
|
83
|
+
} while (0)
|
84
|
+
|
85
|
+
#define SET_REQ_UV_ERROR(req, uv_errno, sys_errno) \
|
86
|
+
do { \
|
87
|
+
req->result = (uv_errno); \
|
88
|
+
req->sys_errno_ = (sys_errno); \
|
89
|
+
} while (0)
|
90
|
+
|
91
|
+
#define VERIFY_FD(fd, req) \
|
92
|
+
if (fd == -1) { \
|
93
|
+
req->result = UV_EBADF; \
|
94
|
+
req->sys_errno_ = ERROR_INVALID_HANDLE; \
|
95
|
+
return; \
|
96
|
+
}
|
97
|
+
|
98
|
+
#define MILLIONu (1000U * 1000U)
|
99
|
+
#define BILLIONu (1000U * 1000U * 1000U)
|
100
|
+
|
101
|
+
#define FILETIME_TO_UINT(filetime) \
|
102
|
+
(*((uint64_t*) &(filetime)) - (uint64_t) 116444736 * BILLIONu)
|
103
|
+
|
104
|
+
#define FILETIME_TO_TIME_T(filetime) \
|
105
|
+
(FILETIME_TO_UINT(filetime) / (10u * MILLIONu))
|
106
|
+
|
107
|
+
#define FILETIME_TO_TIME_NS(filetime, secs) \
|
108
|
+
((FILETIME_TO_UINT(filetime) - (secs * (uint64_t) 10 * MILLIONu)) * 100U)
|
109
|
+
|
110
|
+
#define FILETIME_TO_TIMESPEC(ts, filetime) \
|
111
|
+
do { \
|
112
|
+
(ts).tv_sec = (long) FILETIME_TO_TIME_T(filetime); \
|
113
|
+
(ts).tv_nsec = (long) FILETIME_TO_TIME_NS(filetime, (ts).tv_sec); \
|
114
|
+
} while(0)
|
115
|
+
|
116
|
+
#define TIME_T_TO_FILETIME(time, filetime_ptr) \
|
117
|
+
do { \
|
118
|
+
uint64_t bigtime = ((uint64_t) ((time) * (uint64_t) 10 * MILLIONu)) + \
|
119
|
+
(uint64_t) 116444736 * BILLIONu; \
|
120
|
+
(filetime_ptr)->dwLowDateTime = bigtime & 0xFFFFFFFF; \
|
121
|
+
(filetime_ptr)->dwHighDateTime = bigtime >> 32; \
|
122
|
+
} while(0)
|
123
|
+
|
124
|
+
#define IS_SLASH(c) ((c) == L'\\' || (c) == L'/')
|
125
|
+
#define IS_LETTER(c) (((c) >= L'a' && (c) <= L'z') || \
|
126
|
+
((c) >= L'A' && (c) <= L'Z'))
|
127
|
+
|
128
|
+
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
129
|
+
|
130
|
+
const WCHAR JUNCTION_PREFIX[] = L"\\??\\";
|
131
|
+
const WCHAR JUNCTION_PREFIX_LEN = 4;
|
132
|
+
|
133
|
+
const WCHAR LONG_PATH_PREFIX[] = L"\\\\?\\";
|
134
|
+
const WCHAR LONG_PATH_PREFIX_LEN = 4;
|
135
|
+
|
136
|
+
const WCHAR UNC_PATH_PREFIX[] = L"\\\\?\\UNC\\";
|
137
|
+
const WCHAR UNC_PATH_PREFIX_LEN = 8;
|
138
|
+
|
139
|
+
static int uv__file_symlink_usermode_flag = SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE;
|
140
|
+
|
141
|
+
static DWORD uv__allocation_granularity;
|
142
|
+
|
143
|
+
|
144
|
+
void uv_fs_init(void) {
|
145
|
+
SYSTEM_INFO system_info;
|
146
|
+
|
147
|
+
GetSystemInfo(&system_info);
|
148
|
+
uv__allocation_granularity = system_info.dwAllocationGranularity;
|
149
|
+
|
150
|
+
uv__fd_hash_init();
|
151
|
+
}
|
152
|
+
|
153
|
+
|
154
|
+
INLINE static int fs__capture_path(uv_fs_t* req, const char* path,
|
155
|
+
const char* new_path, const int copy_path) {
|
156
|
+
char* buf;
|
157
|
+
char* pos;
|
158
|
+
ssize_t buf_sz = 0, path_len = 0, pathw_len = 0, new_pathw_len = 0;
|
159
|
+
|
160
|
+
/* new_path can only be set if path is also set. */
|
161
|
+
assert(new_path == NULL || path != NULL);
|
162
|
+
|
163
|
+
if (path != NULL) {
|
164
|
+
pathw_len = MultiByteToWideChar(CP_UTF8,
|
165
|
+
0,
|
166
|
+
path,
|
167
|
+
-1,
|
168
|
+
NULL,
|
169
|
+
0);
|
170
|
+
if (pathw_len == 0) {
|
171
|
+
return GetLastError();
|
172
|
+
}
|
173
|
+
|
174
|
+
buf_sz += pathw_len * sizeof(WCHAR);
|
175
|
+
}
|
176
|
+
|
177
|
+
if (path != NULL && copy_path) {
|
178
|
+
path_len = 1 + strlen(path);
|
179
|
+
buf_sz += path_len;
|
180
|
+
}
|
181
|
+
|
182
|
+
if (new_path != NULL) {
|
183
|
+
new_pathw_len = MultiByteToWideChar(CP_UTF8,
|
184
|
+
0,
|
185
|
+
new_path,
|
186
|
+
-1,
|
187
|
+
NULL,
|
188
|
+
0);
|
189
|
+
if (new_pathw_len == 0) {
|
190
|
+
return GetLastError();
|
191
|
+
}
|
192
|
+
|
193
|
+
buf_sz += new_pathw_len * sizeof(WCHAR);
|
194
|
+
}
|
195
|
+
|
196
|
+
|
197
|
+
if (buf_sz == 0) {
|
198
|
+
req->file.pathw = NULL;
|
199
|
+
req->fs.info.new_pathw = NULL;
|
200
|
+
req->path = NULL;
|
201
|
+
return 0;
|
202
|
+
}
|
203
|
+
|
204
|
+
buf = (char*) uv__malloc(buf_sz);
|
205
|
+
if (buf == NULL) {
|
206
|
+
return ERROR_OUTOFMEMORY;
|
207
|
+
}
|
208
|
+
|
209
|
+
pos = buf;
|
210
|
+
|
211
|
+
if (path != NULL) {
|
212
|
+
DWORD r = MultiByteToWideChar(CP_UTF8,
|
213
|
+
0,
|
214
|
+
path,
|
215
|
+
-1,
|
216
|
+
(WCHAR*) pos,
|
217
|
+
pathw_len);
|
218
|
+
assert(r == (DWORD) pathw_len);
|
219
|
+
req->file.pathw = (WCHAR*) pos;
|
220
|
+
pos += r * sizeof(WCHAR);
|
221
|
+
} else {
|
222
|
+
req->file.pathw = NULL;
|
223
|
+
}
|
224
|
+
|
225
|
+
if (new_path != NULL) {
|
226
|
+
DWORD r = MultiByteToWideChar(CP_UTF8,
|
227
|
+
0,
|
228
|
+
new_path,
|
229
|
+
-1,
|
230
|
+
(WCHAR*) pos,
|
231
|
+
new_pathw_len);
|
232
|
+
assert(r == (DWORD) new_pathw_len);
|
233
|
+
req->fs.info.new_pathw = (WCHAR*) pos;
|
234
|
+
pos += r * sizeof(WCHAR);
|
235
|
+
} else {
|
236
|
+
req->fs.info.new_pathw = NULL;
|
237
|
+
}
|
238
|
+
|
239
|
+
req->path = path;
|
240
|
+
if (path != NULL && copy_path) {
|
241
|
+
memcpy(pos, path, path_len);
|
242
|
+
assert(path_len == buf_sz - (pos - buf));
|
243
|
+
req->path = pos;
|
244
|
+
}
|
245
|
+
|
246
|
+
req->flags |= UV_FS_FREE_PATHS;
|
247
|
+
|
248
|
+
return 0;
|
249
|
+
}
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
INLINE static void uv_fs_req_init(uv_loop_t* loop, uv_fs_t* req,
|
254
|
+
uv_fs_type fs_type, const uv_fs_cb cb) {
|
255
|
+
uv__once_init();
|
256
|
+
UV_REQ_INIT(req, UV_FS);
|
257
|
+
req->loop = loop;
|
258
|
+
req->flags = 0;
|
259
|
+
req->fs_type = fs_type;
|
260
|
+
req->result = 0;
|
261
|
+
req->ptr = NULL;
|
262
|
+
req->path = NULL;
|
263
|
+
req->cb = cb;
|
264
|
+
memset(&req->fs, 0, sizeof(req->fs));
|
265
|
+
}
|
266
|
+
|
267
|
+
|
268
|
+
static int fs__wide_to_utf8(WCHAR* w_source_ptr,
|
269
|
+
DWORD w_source_len,
|
270
|
+
char** target_ptr,
|
271
|
+
uint64_t* target_len_ptr) {
|
272
|
+
int r;
|
273
|
+
int target_len;
|
274
|
+
char* target;
|
275
|
+
target_len = WideCharToMultiByte(CP_UTF8,
|
276
|
+
0,
|
277
|
+
w_source_ptr,
|
278
|
+
w_source_len,
|
279
|
+
NULL,
|
280
|
+
0,
|
281
|
+
NULL,
|
282
|
+
NULL);
|
283
|
+
|
284
|
+
if (target_len == 0) {
|
285
|
+
return -1;
|
286
|
+
}
|
287
|
+
|
288
|
+
if (target_len_ptr != NULL) {
|
289
|
+
*target_len_ptr = target_len;
|
290
|
+
}
|
291
|
+
|
292
|
+
if (target_ptr == NULL) {
|
293
|
+
return 0;
|
294
|
+
}
|
295
|
+
|
296
|
+
target = uv__malloc(target_len + 1);
|
297
|
+
if (target == NULL) {
|
298
|
+
SetLastError(ERROR_OUTOFMEMORY);
|
299
|
+
return -1;
|
300
|
+
}
|
301
|
+
|
302
|
+
r = WideCharToMultiByte(CP_UTF8,
|
303
|
+
0,
|
304
|
+
w_source_ptr,
|
305
|
+
w_source_len,
|
306
|
+
target,
|
307
|
+
target_len,
|
308
|
+
NULL,
|
309
|
+
NULL);
|
310
|
+
assert(r == target_len);
|
311
|
+
target[target_len] = '\0';
|
312
|
+
*target_ptr = target;
|
313
|
+
return 0;
|
314
|
+
}
|
315
|
+
|
316
|
+
|
317
|
+
INLINE static int fs__readlink_handle(HANDLE handle, char** target_ptr,
|
318
|
+
uint64_t* target_len_ptr) {
|
319
|
+
char buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
|
320
|
+
REPARSE_DATA_BUFFER* reparse_data = (REPARSE_DATA_BUFFER*) buffer;
|
321
|
+
WCHAR* w_target;
|
322
|
+
DWORD w_target_len;
|
323
|
+
DWORD bytes;
|
324
|
+
|
325
|
+
if (!DeviceIoControl(handle,
|
326
|
+
FSCTL_GET_REPARSE_POINT,
|
327
|
+
NULL,
|
328
|
+
0,
|
329
|
+
buffer,
|
330
|
+
sizeof buffer,
|
331
|
+
&bytes,
|
332
|
+
NULL)) {
|
333
|
+
return -1;
|
334
|
+
}
|
335
|
+
|
336
|
+
if (reparse_data->ReparseTag == IO_REPARSE_TAG_SYMLINK) {
|
337
|
+
/* Real symlink */
|
338
|
+
w_target = reparse_data->SymbolicLinkReparseBuffer.PathBuffer +
|
339
|
+
(reparse_data->SymbolicLinkReparseBuffer.SubstituteNameOffset /
|
340
|
+
sizeof(WCHAR));
|
341
|
+
w_target_len =
|
342
|
+
reparse_data->SymbolicLinkReparseBuffer.SubstituteNameLength /
|
343
|
+
sizeof(WCHAR);
|
344
|
+
|
345
|
+
/* Real symlinks can contain pretty much everything, but the only thing we
|
346
|
+
* really care about is undoing the implicit conversion to an NT namespaced
|
347
|
+
* path that CreateSymbolicLink will perform on absolute paths. If the path
|
348
|
+
* is win32-namespaced then the user must have explicitly made it so, and
|
349
|
+
* we better just return the unmodified reparse data. */
|
350
|
+
if (w_target_len >= 4 &&
|
351
|
+
w_target[0] == L'\\' &&
|
352
|
+
w_target[1] == L'?' &&
|
353
|
+
w_target[2] == L'?' &&
|
354
|
+
w_target[3] == L'\\') {
|
355
|
+
/* Starts with \??\ */
|
356
|
+
if (w_target_len >= 6 &&
|
357
|
+
((w_target[4] >= L'A' && w_target[4] <= L'Z') ||
|
358
|
+
(w_target[4] >= L'a' && w_target[4] <= L'z')) &&
|
359
|
+
w_target[5] == L':' &&
|
360
|
+
(w_target_len == 6 || w_target[6] == L'\\')) {
|
361
|
+
/* \??\<drive>:\ */
|
362
|
+
w_target += 4;
|
363
|
+
w_target_len -= 4;
|
364
|
+
|
365
|
+
} else if (w_target_len >= 8 &&
|
366
|
+
(w_target[4] == L'U' || w_target[4] == L'u') &&
|
367
|
+
(w_target[5] == L'N' || w_target[5] == L'n') &&
|
368
|
+
(w_target[6] == L'C' || w_target[6] == L'c') &&
|
369
|
+
w_target[7] == L'\\') {
|
370
|
+
/* \??\UNC\<server>\<share>\ - make sure the final path looks like
|
371
|
+
* \\<server>\<share>\ */
|
372
|
+
w_target += 6;
|
373
|
+
w_target[0] = L'\\';
|
374
|
+
w_target_len -= 6;
|
375
|
+
}
|
376
|
+
}
|
377
|
+
|
378
|
+
} else if (reparse_data->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) {
|
379
|
+
/* Junction. */
|
380
|
+
w_target = reparse_data->MountPointReparseBuffer.PathBuffer +
|
381
|
+
(reparse_data->MountPointReparseBuffer.SubstituteNameOffset /
|
382
|
+
sizeof(WCHAR));
|
383
|
+
w_target_len = reparse_data->MountPointReparseBuffer.SubstituteNameLength /
|
384
|
+
sizeof(WCHAR);
|
385
|
+
|
386
|
+
/* Only treat junctions that look like \??\<drive>:\ as symlink. Junctions
|
387
|
+
* can also be used as mount points, like \??\Volume{<guid>}, but that's
|
388
|
+
* confusing for programs since they wouldn't be able to actually
|
389
|
+
* understand such a path when returned by uv_readlink(). UNC paths are
|
390
|
+
* never valid for junctions so we don't care about them. */
|
391
|
+
if (!(w_target_len >= 6 &&
|
392
|
+
w_target[0] == L'\\' &&
|
393
|
+
w_target[1] == L'?' &&
|
394
|
+
w_target[2] == L'?' &&
|
395
|
+
w_target[3] == L'\\' &&
|
396
|
+
((w_target[4] >= L'A' && w_target[4] <= L'Z') ||
|
397
|
+
(w_target[4] >= L'a' && w_target[4] <= L'z')) &&
|
398
|
+
w_target[5] == L':' &&
|
399
|
+
(w_target_len == 6 || w_target[6] == L'\\'))) {
|
400
|
+
SetLastError(ERROR_SYMLINK_NOT_SUPPORTED);
|
401
|
+
return -1;
|
402
|
+
}
|
403
|
+
|
404
|
+
/* Remove leading \??\ */
|
405
|
+
w_target += 4;
|
406
|
+
w_target_len -= 4;
|
407
|
+
|
408
|
+
} else {
|
409
|
+
/* Reparse tag does not indicate a symlink. */
|
410
|
+
SetLastError(ERROR_SYMLINK_NOT_SUPPORTED);
|
411
|
+
return -1;
|
412
|
+
}
|
413
|
+
|
414
|
+
return fs__wide_to_utf8(w_target, w_target_len, target_ptr, target_len_ptr);
|
415
|
+
}
|
416
|
+
|
417
|
+
|
418
|
+
void fs__open(uv_fs_t* req) {
|
419
|
+
DWORD access;
|
420
|
+
DWORD share;
|
421
|
+
DWORD disposition;
|
422
|
+
DWORD attributes = 0;
|
423
|
+
HANDLE file;
|
424
|
+
int fd, current_umask;
|
425
|
+
int flags = req->fs.info.file_flags;
|
426
|
+
struct uv__fd_info_s fd_info;
|
427
|
+
|
428
|
+
/* Adjust flags to be compatible with the memory file mapping. Save the
|
429
|
+
* original flags to emulate the correct behavior. */
|
430
|
+
if (flags & UV_FS_O_FILEMAP) {
|
431
|
+
fd_info.flags = flags;
|
432
|
+
fd_info.current_pos.QuadPart = 0;
|
433
|
+
|
434
|
+
if ((flags & (UV_FS_O_RDONLY | UV_FS_O_WRONLY | UV_FS_O_RDWR)) ==
|
435
|
+
UV_FS_O_WRONLY) {
|
436
|
+
/* CreateFileMapping always needs read access */
|
437
|
+
flags = (flags & ~UV_FS_O_WRONLY) | UV_FS_O_RDWR;
|
438
|
+
}
|
439
|
+
|
440
|
+
if (flags & UV_FS_O_APPEND) {
|
441
|
+
/* Clear the append flag and ensure RDRW mode */
|
442
|
+
flags &= ~UV_FS_O_APPEND;
|
443
|
+
flags &= ~(UV_FS_O_RDONLY | UV_FS_O_WRONLY | UV_FS_O_RDWR);
|
444
|
+
flags |= UV_FS_O_RDWR;
|
445
|
+
}
|
446
|
+
}
|
447
|
+
|
448
|
+
/* Obtain the active umask. umask() never fails and returns the previous
|
449
|
+
* umask. */
|
450
|
+
current_umask = umask(0);
|
451
|
+
umask(current_umask);
|
452
|
+
|
453
|
+
/* convert flags and mode to CreateFile parameters */
|
454
|
+
switch (flags & (UV_FS_O_RDONLY | UV_FS_O_WRONLY | UV_FS_O_RDWR)) {
|
455
|
+
case UV_FS_O_RDONLY:
|
456
|
+
access = FILE_GENERIC_READ;
|
457
|
+
break;
|
458
|
+
case UV_FS_O_WRONLY:
|
459
|
+
access = FILE_GENERIC_WRITE;
|
460
|
+
break;
|
461
|
+
case UV_FS_O_RDWR:
|
462
|
+
access = FILE_GENERIC_READ | FILE_GENERIC_WRITE;
|
463
|
+
break;
|
464
|
+
default:
|
465
|
+
goto einval;
|
466
|
+
}
|
467
|
+
|
468
|
+
if (flags & UV_FS_O_APPEND) {
|
469
|
+
access &= ~FILE_WRITE_DATA;
|
470
|
+
access |= FILE_APPEND_DATA;
|
471
|
+
}
|
472
|
+
|
473
|
+
/*
|
474
|
+
* Here is where we deviate significantly from what CRT's _open()
|
475
|
+
* does. We indiscriminately use all the sharing modes, to match
|
476
|
+
* UNIX semantics. In particular, this ensures that the file can
|
477
|
+
* be deleted even whilst it's open, fixing issue
|
478
|
+
* https://github.com/nodejs/node-v0.x-archive/issues/1449.
|
479
|
+
* We still support exclusive sharing mode, since it is necessary
|
480
|
+
* for opening raw block devices, otherwise Windows will prevent
|
481
|
+
* any attempt to write past the master boot record.
|
482
|
+
*/
|
483
|
+
if (flags & UV_FS_O_EXLOCK) {
|
484
|
+
share = 0;
|
485
|
+
} else {
|
486
|
+
share = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
|
487
|
+
}
|
488
|
+
|
489
|
+
switch (flags & (UV_FS_O_CREAT | UV_FS_O_EXCL | UV_FS_O_TRUNC)) {
|
490
|
+
case 0:
|
491
|
+
case UV_FS_O_EXCL:
|
492
|
+
disposition = OPEN_EXISTING;
|
493
|
+
break;
|
494
|
+
case UV_FS_O_CREAT:
|
495
|
+
disposition = OPEN_ALWAYS;
|
496
|
+
break;
|
497
|
+
case UV_FS_O_CREAT | UV_FS_O_EXCL:
|
498
|
+
case UV_FS_O_CREAT | UV_FS_O_TRUNC | UV_FS_O_EXCL:
|
499
|
+
disposition = CREATE_NEW;
|
500
|
+
break;
|
501
|
+
case UV_FS_O_TRUNC:
|
502
|
+
case UV_FS_O_TRUNC | UV_FS_O_EXCL:
|
503
|
+
disposition = TRUNCATE_EXISTING;
|
504
|
+
break;
|
505
|
+
case UV_FS_O_CREAT | UV_FS_O_TRUNC:
|
506
|
+
disposition = CREATE_ALWAYS;
|
507
|
+
break;
|
508
|
+
default:
|
509
|
+
goto einval;
|
510
|
+
}
|
511
|
+
|
512
|
+
attributes |= FILE_ATTRIBUTE_NORMAL;
|
513
|
+
if (flags & UV_FS_O_CREAT) {
|
514
|
+
if (!((req->fs.info.mode & ~current_umask) & _S_IWRITE)) {
|
515
|
+
attributes |= FILE_ATTRIBUTE_READONLY;
|
516
|
+
}
|
517
|
+
}
|
518
|
+
|
519
|
+
if (flags & UV_FS_O_TEMPORARY ) {
|
520
|
+
attributes |= FILE_FLAG_DELETE_ON_CLOSE | FILE_ATTRIBUTE_TEMPORARY;
|
521
|
+
access |= DELETE;
|
522
|
+
}
|
523
|
+
|
524
|
+
if (flags & UV_FS_O_SHORT_LIVED) {
|
525
|
+
attributes |= FILE_ATTRIBUTE_TEMPORARY;
|
526
|
+
}
|
527
|
+
|
528
|
+
switch (flags & (UV_FS_O_SEQUENTIAL | UV_FS_O_RANDOM)) {
|
529
|
+
case 0:
|
530
|
+
break;
|
531
|
+
case UV_FS_O_SEQUENTIAL:
|
532
|
+
attributes |= FILE_FLAG_SEQUENTIAL_SCAN;
|
533
|
+
break;
|
534
|
+
case UV_FS_O_RANDOM:
|
535
|
+
attributes |= FILE_FLAG_RANDOM_ACCESS;
|
536
|
+
break;
|
537
|
+
default:
|
538
|
+
goto einval;
|
539
|
+
}
|
540
|
+
|
541
|
+
if (flags & UV_FS_O_DIRECT) {
|
542
|
+
/*
|
543
|
+
* FILE_APPEND_DATA and FILE_FLAG_NO_BUFFERING are mutually exclusive.
|
544
|
+
* Windows returns 87, ERROR_INVALID_PARAMETER if these are combined.
|
545
|
+
*
|
546
|
+
* FILE_APPEND_DATA is included in FILE_GENERIC_WRITE:
|
547
|
+
*
|
548
|
+
* FILE_GENERIC_WRITE = STANDARD_RIGHTS_WRITE |
|
549
|
+
* FILE_WRITE_DATA |
|
550
|
+
* FILE_WRITE_ATTRIBUTES |
|
551
|
+
* FILE_WRITE_EA |
|
552
|
+
* FILE_APPEND_DATA |
|
553
|
+
* SYNCHRONIZE
|
554
|
+
*
|
555
|
+
* Note: Appends are also permitted by FILE_WRITE_DATA.
|
556
|
+
*
|
557
|
+
* In order for direct writes and direct appends to succeed, we therefore
|
558
|
+
* exclude FILE_APPEND_DATA if FILE_WRITE_DATA is specified, and otherwise
|
559
|
+
* fail if the user's sole permission is a direct append, since this
|
560
|
+
* particular combination is invalid.
|
561
|
+
*/
|
562
|
+
if (access & FILE_APPEND_DATA) {
|
563
|
+
if (access & FILE_WRITE_DATA) {
|
564
|
+
access &= ~FILE_APPEND_DATA;
|
565
|
+
} else {
|
566
|
+
goto einval;
|
567
|
+
}
|
568
|
+
}
|
569
|
+
attributes |= FILE_FLAG_NO_BUFFERING;
|
570
|
+
}
|
571
|
+
|
572
|
+
switch (flags & (UV_FS_O_DSYNC | UV_FS_O_SYNC)) {
|
573
|
+
case 0:
|
574
|
+
break;
|
575
|
+
case UV_FS_O_DSYNC:
|
576
|
+
case UV_FS_O_SYNC:
|
577
|
+
attributes |= FILE_FLAG_WRITE_THROUGH;
|
578
|
+
break;
|
579
|
+
default:
|
580
|
+
goto einval;
|
581
|
+
}
|
582
|
+
|
583
|
+
/* Setting this flag makes it possible to open a directory. */
|
584
|
+
attributes |= FILE_FLAG_BACKUP_SEMANTICS;
|
585
|
+
|
586
|
+
file = CreateFileW(req->file.pathw,
|
587
|
+
access,
|
588
|
+
share,
|
589
|
+
NULL,
|
590
|
+
disposition,
|
591
|
+
attributes,
|
592
|
+
NULL);
|
593
|
+
if (file == INVALID_HANDLE_VALUE) {
|
594
|
+
DWORD error = GetLastError();
|
595
|
+
if (error == ERROR_FILE_EXISTS && (flags & UV_FS_O_CREAT) &&
|
596
|
+
!(flags & UV_FS_O_EXCL)) {
|
597
|
+
/* Special case: when ERROR_FILE_EXISTS happens and UV_FS_O_CREAT was
|
598
|
+
* specified, it means the path referred to a directory. */
|
599
|
+
SET_REQ_UV_ERROR(req, UV_EISDIR, error);
|
600
|
+
} else {
|
601
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
602
|
+
}
|
603
|
+
return;
|
604
|
+
}
|
605
|
+
|
606
|
+
fd = _open_osfhandle((intptr_t) file, flags);
|
607
|
+
if (fd < 0) {
|
608
|
+
/* The only known failure mode for _open_osfhandle() is EMFILE, in which
|
609
|
+
* case GetLastError() will return zero. However we'll try to handle other
|
610
|
+
* errors as well, should they ever occur.
|
611
|
+
*/
|
612
|
+
if (errno == EMFILE)
|
613
|
+
SET_REQ_UV_ERROR(req, UV_EMFILE, ERROR_TOO_MANY_OPEN_FILES);
|
614
|
+
else if (GetLastError() != ERROR_SUCCESS)
|
615
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
616
|
+
else
|
617
|
+
SET_REQ_WIN32_ERROR(req, (DWORD) UV_UNKNOWN);
|
618
|
+
CloseHandle(file);
|
619
|
+
return;
|
620
|
+
}
|
621
|
+
|
622
|
+
if (flags & UV_FS_O_FILEMAP) {
|
623
|
+
FILE_STANDARD_INFO file_info;
|
624
|
+
if (!GetFileInformationByHandleEx(file,
|
625
|
+
FileStandardInfo,
|
626
|
+
&file_info,
|
627
|
+
sizeof file_info)) {
|
628
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
629
|
+
CloseHandle(file);
|
630
|
+
return;
|
631
|
+
}
|
632
|
+
fd_info.is_directory = file_info.Directory;
|
633
|
+
|
634
|
+
if (fd_info.is_directory) {
|
635
|
+
fd_info.size.QuadPart = 0;
|
636
|
+
fd_info.mapping = INVALID_HANDLE_VALUE;
|
637
|
+
} else {
|
638
|
+
if (!GetFileSizeEx(file, &fd_info.size)) {
|
639
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
640
|
+
CloseHandle(file);
|
641
|
+
return;
|
642
|
+
}
|
643
|
+
|
644
|
+
if (fd_info.size.QuadPart == 0) {
|
645
|
+
fd_info.mapping = INVALID_HANDLE_VALUE;
|
646
|
+
} else {
|
647
|
+
DWORD flProtect = (fd_info.flags & (UV_FS_O_RDONLY | UV_FS_O_WRONLY |
|
648
|
+
UV_FS_O_RDWR)) == UV_FS_O_RDONLY ? PAGE_READONLY : PAGE_READWRITE;
|
649
|
+
fd_info.mapping = CreateFileMapping(file,
|
650
|
+
NULL,
|
651
|
+
flProtect,
|
652
|
+
fd_info.size.HighPart,
|
653
|
+
fd_info.size.LowPart,
|
654
|
+
NULL);
|
655
|
+
if (fd_info.mapping == NULL) {
|
656
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
657
|
+
CloseHandle(file);
|
658
|
+
return;
|
659
|
+
}
|
660
|
+
}
|
661
|
+
}
|
662
|
+
|
663
|
+
uv__fd_hash_add(fd, &fd_info);
|
664
|
+
}
|
665
|
+
|
666
|
+
SET_REQ_RESULT(req, fd);
|
667
|
+
return;
|
668
|
+
|
669
|
+
einval:
|
670
|
+
SET_REQ_UV_ERROR(req, UV_EINVAL, ERROR_INVALID_PARAMETER);
|
671
|
+
}
|
672
|
+
|
673
|
+
void fs__close(uv_fs_t* req) {
|
674
|
+
int fd = req->file.fd;
|
675
|
+
int result;
|
676
|
+
struct uv__fd_info_s fd_info;
|
677
|
+
|
678
|
+
VERIFY_FD(fd, req);
|
679
|
+
|
680
|
+
if (uv__fd_hash_remove(fd, &fd_info)) {
|
681
|
+
if (fd_info.mapping != INVALID_HANDLE_VALUE) {
|
682
|
+
CloseHandle(fd_info.mapping);
|
683
|
+
}
|
684
|
+
}
|
685
|
+
|
686
|
+
if (fd > 2)
|
687
|
+
result = _close(fd);
|
688
|
+
else
|
689
|
+
result = 0;
|
690
|
+
|
691
|
+
/* _close doesn't set _doserrno on failure, but it does always set errno
|
692
|
+
* to EBADF on failure.
|
693
|
+
*/
|
694
|
+
if (result == -1) {
|
695
|
+
assert(errno == EBADF);
|
696
|
+
SET_REQ_UV_ERROR(req, UV_EBADF, ERROR_INVALID_HANDLE);
|
697
|
+
} else {
|
698
|
+
req->result = 0;
|
699
|
+
}
|
700
|
+
}
|
701
|
+
|
702
|
+
|
703
|
+
LONG fs__filemap_ex_filter(LONG excode, PEXCEPTION_POINTERS pep,
|
704
|
+
int* perror) {
|
705
|
+
if (excode != EXCEPTION_IN_PAGE_ERROR) {
|
706
|
+
return EXCEPTION_CONTINUE_SEARCH;
|
707
|
+
}
|
708
|
+
|
709
|
+
assert(perror != NULL);
|
710
|
+
if (pep != NULL && pep->ExceptionRecord != NULL &&
|
711
|
+
pep->ExceptionRecord->NumberParameters >= 3) {
|
712
|
+
NTSTATUS status = (NTSTATUS)pep->ExceptionRecord->ExceptionInformation[3];
|
713
|
+
*perror = pRtlNtStatusToDosError(status);
|
714
|
+
if (*perror != ERROR_SUCCESS) {
|
715
|
+
return EXCEPTION_EXECUTE_HANDLER;
|
716
|
+
}
|
717
|
+
}
|
718
|
+
*perror = UV_UNKNOWN;
|
719
|
+
return EXCEPTION_EXECUTE_HANDLER;
|
720
|
+
}
|
721
|
+
|
722
|
+
|
723
|
+
void fs__read_filemap(uv_fs_t* req, struct uv__fd_info_s* fd_info) {
|
724
|
+
int fd = req->file.fd; /* VERIFY_FD done in fs__read */
|
725
|
+
int rw_flags = fd_info->flags &
|
726
|
+
(UV_FS_O_RDONLY | UV_FS_O_WRONLY | UV_FS_O_RDWR);
|
727
|
+
size_t read_size, done_read;
|
728
|
+
unsigned int index;
|
729
|
+
LARGE_INTEGER pos, end_pos;
|
730
|
+
size_t view_offset;
|
731
|
+
LARGE_INTEGER view_base;
|
732
|
+
void* view;
|
733
|
+
|
734
|
+
if (rw_flags == UV_FS_O_WRONLY) {
|
735
|
+
SET_REQ_WIN32_ERROR(req, ERROR_ACCESS_DENIED);
|
736
|
+
return;
|
737
|
+
}
|
738
|
+
if (fd_info->is_directory) {
|
739
|
+
SET_REQ_WIN32_ERROR(req, ERROR_INVALID_FUNCTION);
|
740
|
+
return;
|
741
|
+
}
|
742
|
+
|
743
|
+
if (req->fs.info.offset == -1) {
|
744
|
+
pos = fd_info->current_pos;
|
745
|
+
} else {
|
746
|
+
pos.QuadPart = req->fs.info.offset;
|
747
|
+
}
|
748
|
+
|
749
|
+
/* Make sure we wont read past EOF. */
|
750
|
+
if (pos.QuadPart >= fd_info->size.QuadPart) {
|
751
|
+
SET_REQ_RESULT(req, 0);
|
752
|
+
return;
|
753
|
+
}
|
754
|
+
|
755
|
+
read_size = 0;
|
756
|
+
for (index = 0; index < req->fs.info.nbufs; ++index) {
|
757
|
+
read_size += req->fs.info.bufs[index].len;
|
758
|
+
}
|
759
|
+
read_size = (size_t) MIN((LONGLONG) read_size,
|
760
|
+
fd_info->size.QuadPart - pos.QuadPart);
|
761
|
+
if (read_size == 0) {
|
762
|
+
SET_REQ_RESULT(req, 0);
|
763
|
+
return;
|
764
|
+
}
|
765
|
+
|
766
|
+
end_pos.QuadPart = pos.QuadPart + read_size;
|
767
|
+
|
768
|
+
view_offset = pos.QuadPart % uv__allocation_granularity;
|
769
|
+
view_base.QuadPart = pos.QuadPart - view_offset;
|
770
|
+
view = MapViewOfFile(fd_info->mapping,
|
771
|
+
FILE_MAP_READ,
|
772
|
+
view_base.HighPart,
|
773
|
+
view_base.LowPart,
|
774
|
+
view_offset + read_size);
|
775
|
+
if (view == NULL) {
|
776
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
777
|
+
return;
|
778
|
+
}
|
779
|
+
|
780
|
+
done_read = 0;
|
781
|
+
for (index = 0;
|
782
|
+
index < req->fs.info.nbufs && done_read < read_size;
|
783
|
+
++index) {
|
784
|
+
int err = 0;
|
785
|
+
size_t this_read_size = MIN(req->fs.info.bufs[index].len,
|
786
|
+
read_size - done_read);
|
787
|
+
#ifdef _MSC_VER
|
788
|
+
__try {
|
789
|
+
#endif
|
790
|
+
memcpy(req->fs.info.bufs[index].base,
|
791
|
+
(char*)view + view_offset + done_read,
|
792
|
+
this_read_size);
|
793
|
+
#ifdef _MSC_VER
|
794
|
+
}
|
795
|
+
__except (fs__filemap_ex_filter(GetExceptionCode(),
|
796
|
+
GetExceptionInformation(), &err)) {
|
797
|
+
SET_REQ_WIN32_ERROR(req, err);
|
798
|
+
UnmapViewOfFile(view);
|
799
|
+
return;
|
800
|
+
}
|
801
|
+
#endif
|
802
|
+
done_read += this_read_size;
|
803
|
+
}
|
804
|
+
assert(done_read == read_size);
|
805
|
+
|
806
|
+
if (!UnmapViewOfFile(view)) {
|
807
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
808
|
+
return;
|
809
|
+
}
|
810
|
+
|
811
|
+
if (req->fs.info.offset == -1) {
|
812
|
+
fd_info->current_pos = end_pos;
|
813
|
+
uv__fd_hash_add(fd, fd_info);
|
814
|
+
}
|
815
|
+
|
816
|
+
SET_REQ_RESULT(req, read_size);
|
817
|
+
return;
|
818
|
+
}
|
819
|
+
|
820
|
+
void fs__read(uv_fs_t* req) {
|
821
|
+
int fd = req->file.fd;
|
822
|
+
int64_t offset = req->fs.info.offset;
|
823
|
+
HANDLE handle;
|
824
|
+
OVERLAPPED overlapped, *overlapped_ptr;
|
825
|
+
LARGE_INTEGER offset_;
|
826
|
+
DWORD bytes;
|
827
|
+
DWORD error;
|
828
|
+
int result;
|
829
|
+
unsigned int index;
|
830
|
+
LARGE_INTEGER original_position;
|
831
|
+
LARGE_INTEGER zero_offset;
|
832
|
+
int restore_position;
|
833
|
+
struct uv__fd_info_s fd_info;
|
834
|
+
|
835
|
+
VERIFY_FD(fd, req);
|
836
|
+
|
837
|
+
if (uv__fd_hash_get(fd, &fd_info)) {
|
838
|
+
fs__read_filemap(req, &fd_info);
|
839
|
+
return;
|
840
|
+
}
|
841
|
+
|
842
|
+
zero_offset.QuadPart = 0;
|
843
|
+
restore_position = 0;
|
844
|
+
handle = uv__get_osfhandle(fd);
|
845
|
+
|
846
|
+
if (handle == INVALID_HANDLE_VALUE) {
|
847
|
+
SET_REQ_WIN32_ERROR(req, ERROR_INVALID_HANDLE);
|
848
|
+
return;
|
849
|
+
}
|
850
|
+
|
851
|
+
if (offset != -1) {
|
852
|
+
memset(&overlapped, 0, sizeof overlapped);
|
853
|
+
overlapped_ptr = &overlapped;
|
854
|
+
if (SetFilePointerEx(handle, zero_offset, &original_position,
|
855
|
+
FILE_CURRENT)) {
|
856
|
+
restore_position = 1;
|
857
|
+
}
|
858
|
+
} else {
|
859
|
+
overlapped_ptr = NULL;
|
860
|
+
}
|
861
|
+
|
862
|
+
index = 0;
|
863
|
+
bytes = 0;
|
864
|
+
do {
|
865
|
+
DWORD incremental_bytes;
|
866
|
+
|
867
|
+
if (offset != -1) {
|
868
|
+
offset_.QuadPart = offset + bytes;
|
869
|
+
overlapped.Offset = offset_.LowPart;
|
870
|
+
overlapped.OffsetHigh = offset_.HighPart;
|
871
|
+
}
|
872
|
+
|
873
|
+
result = ReadFile(handle,
|
874
|
+
req->fs.info.bufs[index].base,
|
875
|
+
req->fs.info.bufs[index].len,
|
876
|
+
&incremental_bytes,
|
877
|
+
overlapped_ptr);
|
878
|
+
bytes += incremental_bytes;
|
879
|
+
++index;
|
880
|
+
} while (result && index < req->fs.info.nbufs);
|
881
|
+
|
882
|
+
if (restore_position)
|
883
|
+
SetFilePointerEx(handle, original_position, NULL, FILE_BEGIN);
|
884
|
+
|
885
|
+
if (result || bytes > 0) {
|
886
|
+
SET_REQ_RESULT(req, bytes);
|
887
|
+
} else {
|
888
|
+
error = GetLastError();
|
889
|
+
if (error == ERROR_HANDLE_EOF) {
|
890
|
+
SET_REQ_RESULT(req, bytes);
|
891
|
+
} else {
|
892
|
+
SET_REQ_WIN32_ERROR(req, error);
|
893
|
+
}
|
894
|
+
}
|
895
|
+
}
|
896
|
+
|
897
|
+
|
898
|
+
void fs__write_filemap(uv_fs_t* req, HANDLE file,
|
899
|
+
struct uv__fd_info_s* fd_info) {
|
900
|
+
int fd = req->file.fd; /* VERIFY_FD done in fs__write */
|
901
|
+
int force_append = fd_info->flags & UV_FS_O_APPEND;
|
902
|
+
int rw_flags = fd_info->flags &
|
903
|
+
(UV_FS_O_RDONLY | UV_FS_O_WRONLY | UV_FS_O_RDWR);
|
904
|
+
size_t write_size, done_write;
|
905
|
+
unsigned int index;
|
906
|
+
LARGE_INTEGER zero, pos, end_pos;
|
907
|
+
size_t view_offset;
|
908
|
+
LARGE_INTEGER view_base;
|
909
|
+
void* view;
|
910
|
+
FILETIME ft;
|
911
|
+
|
912
|
+
if (rw_flags == UV_FS_O_RDONLY) {
|
913
|
+
SET_REQ_WIN32_ERROR(req, ERROR_ACCESS_DENIED);
|
914
|
+
return;
|
915
|
+
}
|
916
|
+
if (fd_info->is_directory) {
|
917
|
+
SET_REQ_WIN32_ERROR(req, ERROR_INVALID_FUNCTION);
|
918
|
+
return;
|
919
|
+
}
|
920
|
+
|
921
|
+
write_size = 0;
|
922
|
+
for (index = 0; index < req->fs.info.nbufs; ++index) {
|
923
|
+
write_size += req->fs.info.bufs[index].len;
|
924
|
+
}
|
925
|
+
|
926
|
+
if (write_size == 0) {
|
927
|
+
SET_REQ_RESULT(req, 0);
|
928
|
+
return;
|
929
|
+
}
|
930
|
+
|
931
|
+
zero.QuadPart = 0;
|
932
|
+
if (force_append) {
|
933
|
+
pos = fd_info->size;
|
934
|
+
} else if (req->fs.info.offset == -1) {
|
935
|
+
pos = fd_info->current_pos;
|
936
|
+
} else {
|
937
|
+
pos.QuadPart = req->fs.info.offset;
|
938
|
+
}
|
939
|
+
|
940
|
+
end_pos.QuadPart = pos.QuadPart + write_size;
|
941
|
+
|
942
|
+
/* Recreate the mapping to enlarge the file if needed */
|
943
|
+
if (end_pos.QuadPart > fd_info->size.QuadPart) {
|
944
|
+
if (fd_info->mapping != INVALID_HANDLE_VALUE) {
|
945
|
+
CloseHandle(fd_info->mapping);
|
946
|
+
}
|
947
|
+
|
948
|
+
fd_info->mapping = CreateFileMapping(file,
|
949
|
+
NULL,
|
950
|
+
PAGE_READWRITE,
|
951
|
+
end_pos.HighPart,
|
952
|
+
end_pos.LowPart,
|
953
|
+
NULL);
|
954
|
+
if (fd_info->mapping == NULL) {
|
955
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
956
|
+
CloseHandle(file);
|
957
|
+
fd_info->mapping = INVALID_HANDLE_VALUE;
|
958
|
+
fd_info->size.QuadPart = 0;
|
959
|
+
fd_info->current_pos.QuadPart = 0;
|
960
|
+
uv__fd_hash_add(fd, fd_info);
|
961
|
+
return;
|
962
|
+
}
|
963
|
+
|
964
|
+
fd_info->size = end_pos;
|
965
|
+
uv__fd_hash_add(fd, fd_info);
|
966
|
+
}
|
967
|
+
|
968
|
+
view_offset = pos.QuadPart % uv__allocation_granularity;
|
969
|
+
view_base.QuadPart = pos.QuadPart - view_offset;
|
970
|
+
view = MapViewOfFile(fd_info->mapping,
|
971
|
+
FILE_MAP_WRITE,
|
972
|
+
view_base.HighPart,
|
973
|
+
view_base.LowPart,
|
974
|
+
view_offset + write_size);
|
975
|
+
if (view == NULL) {
|
976
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
977
|
+
return;
|
978
|
+
}
|
979
|
+
|
980
|
+
done_write = 0;
|
981
|
+
for (index = 0; index < req->fs.info.nbufs; ++index) {
|
982
|
+
int err = 0;
|
983
|
+
#ifdef _MSC_VER
|
984
|
+
__try {
|
985
|
+
#endif
|
986
|
+
memcpy((char*)view + view_offset + done_write,
|
987
|
+
req->fs.info.bufs[index].base,
|
988
|
+
req->fs.info.bufs[index].len);
|
989
|
+
#ifdef _MSC_VER
|
990
|
+
}
|
991
|
+
__except (fs__filemap_ex_filter(GetExceptionCode(),
|
992
|
+
GetExceptionInformation(), &err)) {
|
993
|
+
SET_REQ_WIN32_ERROR(req, err);
|
994
|
+
UnmapViewOfFile(view);
|
995
|
+
return;
|
996
|
+
}
|
997
|
+
#endif
|
998
|
+
done_write += req->fs.info.bufs[index].len;
|
999
|
+
}
|
1000
|
+
assert(done_write == write_size);
|
1001
|
+
|
1002
|
+
if (!FlushViewOfFile(view, 0)) {
|
1003
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
1004
|
+
UnmapViewOfFile(view);
|
1005
|
+
return;
|
1006
|
+
}
|
1007
|
+
if (!UnmapViewOfFile(view)) {
|
1008
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
1009
|
+
return;
|
1010
|
+
}
|
1011
|
+
|
1012
|
+
if (req->fs.info.offset == -1) {
|
1013
|
+
fd_info->current_pos = end_pos;
|
1014
|
+
uv__fd_hash_add(fd, fd_info);
|
1015
|
+
}
|
1016
|
+
|
1017
|
+
GetSystemTimeAsFileTime(&ft);
|
1018
|
+
SetFileTime(file, NULL, NULL, &ft);
|
1019
|
+
|
1020
|
+
SET_REQ_RESULT(req, done_write);
|
1021
|
+
}
|
1022
|
+
|
1023
|
+
void fs__write(uv_fs_t* req) {
|
1024
|
+
int fd = req->file.fd;
|
1025
|
+
int64_t offset = req->fs.info.offset;
|
1026
|
+
HANDLE handle;
|
1027
|
+
OVERLAPPED overlapped, *overlapped_ptr;
|
1028
|
+
LARGE_INTEGER offset_;
|
1029
|
+
DWORD bytes;
|
1030
|
+
int result;
|
1031
|
+
unsigned int index;
|
1032
|
+
LARGE_INTEGER original_position;
|
1033
|
+
LARGE_INTEGER zero_offset;
|
1034
|
+
int restore_position;
|
1035
|
+
struct uv__fd_info_s fd_info;
|
1036
|
+
|
1037
|
+
VERIFY_FD(fd, req);
|
1038
|
+
|
1039
|
+
zero_offset.QuadPart = 0;
|
1040
|
+
restore_position = 0;
|
1041
|
+
handle = uv__get_osfhandle(fd);
|
1042
|
+
if (handle == INVALID_HANDLE_VALUE) {
|
1043
|
+
SET_REQ_WIN32_ERROR(req, ERROR_INVALID_HANDLE);
|
1044
|
+
return;
|
1045
|
+
}
|
1046
|
+
|
1047
|
+
if (uv__fd_hash_get(fd, &fd_info)) {
|
1048
|
+
fs__write_filemap(req, handle, &fd_info);
|
1049
|
+
return;
|
1050
|
+
}
|
1051
|
+
|
1052
|
+
if (offset != -1) {
|
1053
|
+
memset(&overlapped, 0, sizeof overlapped);
|
1054
|
+
overlapped_ptr = &overlapped;
|
1055
|
+
if (SetFilePointerEx(handle, zero_offset, &original_position,
|
1056
|
+
FILE_CURRENT)) {
|
1057
|
+
restore_position = 1;
|
1058
|
+
}
|
1059
|
+
} else {
|
1060
|
+
overlapped_ptr = NULL;
|
1061
|
+
}
|
1062
|
+
|
1063
|
+
index = 0;
|
1064
|
+
bytes = 0;
|
1065
|
+
do {
|
1066
|
+
DWORD incremental_bytes;
|
1067
|
+
|
1068
|
+
if (offset != -1) {
|
1069
|
+
offset_.QuadPart = offset + bytes;
|
1070
|
+
overlapped.Offset = offset_.LowPart;
|
1071
|
+
overlapped.OffsetHigh = offset_.HighPart;
|
1072
|
+
}
|
1073
|
+
|
1074
|
+
result = WriteFile(handle,
|
1075
|
+
req->fs.info.bufs[index].base,
|
1076
|
+
req->fs.info.bufs[index].len,
|
1077
|
+
&incremental_bytes,
|
1078
|
+
overlapped_ptr);
|
1079
|
+
bytes += incremental_bytes;
|
1080
|
+
++index;
|
1081
|
+
} while (result && index < req->fs.info.nbufs);
|
1082
|
+
|
1083
|
+
if (restore_position)
|
1084
|
+
SetFilePointerEx(handle, original_position, NULL, FILE_BEGIN);
|
1085
|
+
|
1086
|
+
if (result || bytes > 0) {
|
1087
|
+
SET_REQ_RESULT(req, bytes);
|
1088
|
+
} else {
|
1089
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
1090
|
+
}
|
1091
|
+
}
|
1092
|
+
|
1093
|
+
|
1094
|
+
void fs__rmdir(uv_fs_t* req) {
|
1095
|
+
int result = _wrmdir(req->file.pathw);
|
1096
|
+
SET_REQ_RESULT(req, result);
|
1097
|
+
}
|
1098
|
+
|
1099
|
+
|
1100
|
+
void fs__unlink(uv_fs_t* req) {
|
1101
|
+
const WCHAR* pathw = req->file.pathw;
|
1102
|
+
HANDLE handle;
|
1103
|
+
BY_HANDLE_FILE_INFORMATION info;
|
1104
|
+
FILE_DISPOSITION_INFORMATION disposition;
|
1105
|
+
IO_STATUS_BLOCK iosb;
|
1106
|
+
NTSTATUS status;
|
1107
|
+
|
1108
|
+
handle = CreateFileW(pathw,
|
1109
|
+
FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES | DELETE,
|
1110
|
+
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
1111
|
+
NULL,
|
1112
|
+
OPEN_EXISTING,
|
1113
|
+
FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS,
|
1114
|
+
NULL);
|
1115
|
+
|
1116
|
+
if (handle == INVALID_HANDLE_VALUE) {
|
1117
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
1118
|
+
return;
|
1119
|
+
}
|
1120
|
+
|
1121
|
+
if (!GetFileInformationByHandle(handle, &info)) {
|
1122
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
1123
|
+
CloseHandle(handle);
|
1124
|
+
return;
|
1125
|
+
}
|
1126
|
+
|
1127
|
+
if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
1128
|
+
/* Do not allow deletion of directories, unless it is a symlink. When the
|
1129
|
+
* path refers to a non-symlink directory, report EPERM as mandated by
|
1130
|
+
* POSIX.1. */
|
1131
|
+
|
1132
|
+
/* Check if it is a reparse point. If it's not, it's a normal directory. */
|
1133
|
+
if (!(info.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) {
|
1134
|
+
SET_REQ_WIN32_ERROR(req, ERROR_ACCESS_DENIED);
|
1135
|
+
CloseHandle(handle);
|
1136
|
+
return;
|
1137
|
+
}
|
1138
|
+
|
1139
|
+
/* Read the reparse point and check if it is a valid symlink. If not, don't
|
1140
|
+
* unlink. */
|
1141
|
+
if (fs__readlink_handle(handle, NULL, NULL) < 0) {
|
1142
|
+
DWORD error = GetLastError();
|
1143
|
+
if (error == ERROR_SYMLINK_NOT_SUPPORTED)
|
1144
|
+
error = ERROR_ACCESS_DENIED;
|
1145
|
+
SET_REQ_WIN32_ERROR(req, error);
|
1146
|
+
CloseHandle(handle);
|
1147
|
+
return;
|
1148
|
+
}
|
1149
|
+
}
|
1150
|
+
|
1151
|
+
if (info.dwFileAttributes & FILE_ATTRIBUTE_READONLY) {
|
1152
|
+
/* Remove read-only attribute */
|
1153
|
+
FILE_BASIC_INFORMATION basic = { 0 };
|
1154
|
+
|
1155
|
+
basic.FileAttributes = (info.dwFileAttributes & ~FILE_ATTRIBUTE_READONLY) |
|
1156
|
+
FILE_ATTRIBUTE_ARCHIVE;
|
1157
|
+
|
1158
|
+
status = pNtSetInformationFile(handle,
|
1159
|
+
&iosb,
|
1160
|
+
&basic,
|
1161
|
+
sizeof basic,
|
1162
|
+
FileBasicInformation);
|
1163
|
+
if (!NT_SUCCESS(status)) {
|
1164
|
+
SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(status));
|
1165
|
+
CloseHandle(handle);
|
1166
|
+
return;
|
1167
|
+
}
|
1168
|
+
}
|
1169
|
+
|
1170
|
+
/* Try to set the delete flag. */
|
1171
|
+
disposition.DeleteFile = TRUE;
|
1172
|
+
status = pNtSetInformationFile(handle,
|
1173
|
+
&iosb,
|
1174
|
+
&disposition,
|
1175
|
+
sizeof disposition,
|
1176
|
+
FileDispositionInformation);
|
1177
|
+
if (NT_SUCCESS(status)) {
|
1178
|
+
SET_REQ_SUCCESS(req);
|
1179
|
+
} else {
|
1180
|
+
SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(status));
|
1181
|
+
}
|
1182
|
+
|
1183
|
+
CloseHandle(handle);
|
1184
|
+
}
|
1185
|
+
|
1186
|
+
|
1187
|
+
void fs__mkdir(uv_fs_t* req) {
|
1188
|
+
/* TODO: use req->mode. */
|
1189
|
+
req->result = _wmkdir(req->file.pathw);
|
1190
|
+
if (req->result == -1) {
|
1191
|
+
req->sys_errno_ = _doserrno;
|
1192
|
+
req->result = req->sys_errno_ == ERROR_INVALID_NAME
|
1193
|
+
? UV_EINVAL
|
1194
|
+
: uv_translate_sys_error(req->sys_errno_);
|
1195
|
+
}
|
1196
|
+
}
|
1197
|
+
|
1198
|
+
typedef int (*uv__fs_mktemp_func)(uv_fs_t* req);
|
1199
|
+
|
1200
|
+
/* OpenBSD original: lib/libc/stdio/mktemp.c */
|
1201
|
+
void fs__mktemp(uv_fs_t* req, uv__fs_mktemp_func func) {
|
1202
|
+
static const WCHAR *tempchars =
|
1203
|
+
L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
1204
|
+
static const size_t num_chars = 62;
|
1205
|
+
static const size_t num_x = 6;
|
1206
|
+
WCHAR *cp, *ep;
|
1207
|
+
unsigned int tries, i;
|
1208
|
+
size_t len;
|
1209
|
+
uint64_t v;
|
1210
|
+
|
1211
|
+
len = wcslen(req->file.pathw);
|
1212
|
+
ep = req->file.pathw + len;
|
1213
|
+
if (len < num_x || wcsncmp(ep - num_x, L"XXXXXX", num_x)) {
|
1214
|
+
SET_REQ_UV_ERROR(req, UV_EINVAL, ERROR_INVALID_PARAMETER);
|
1215
|
+
return;
|
1216
|
+
}
|
1217
|
+
|
1218
|
+
tries = TMP_MAX;
|
1219
|
+
do {
|
1220
|
+
if (uv__random_rtlgenrandom((void *)&v, sizeof(v)) < 0) {
|
1221
|
+
SET_REQ_UV_ERROR(req, UV_EIO, ERROR_IO_DEVICE);
|
1222
|
+
break;
|
1223
|
+
}
|
1224
|
+
|
1225
|
+
cp = ep - num_x;
|
1226
|
+
for (i = 0; i < num_x; i++) {
|
1227
|
+
*cp++ = tempchars[v % num_chars];
|
1228
|
+
v /= num_chars;
|
1229
|
+
}
|
1230
|
+
|
1231
|
+
if (func(req)) {
|
1232
|
+
if (req->result >= 0) {
|
1233
|
+
len = strlen(req->path);
|
1234
|
+
wcstombs((char*) req->path + len - num_x, ep - num_x, num_x);
|
1235
|
+
}
|
1236
|
+
break;
|
1237
|
+
}
|
1238
|
+
} while (--tries);
|
1239
|
+
|
1240
|
+
if (tries == 0) {
|
1241
|
+
SET_REQ_RESULT(req, -1);
|
1242
|
+
}
|
1243
|
+
}
|
1244
|
+
|
1245
|
+
|
1246
|
+
static int fs__mkdtemp_func(uv_fs_t* req) {
|
1247
|
+
if (_wmkdir(req->file.pathw) == 0) {
|
1248
|
+
SET_REQ_RESULT(req, 0);
|
1249
|
+
return 1;
|
1250
|
+
} else if (errno != EEXIST) {
|
1251
|
+
SET_REQ_RESULT(req, -1);
|
1252
|
+
return 1;
|
1253
|
+
}
|
1254
|
+
|
1255
|
+
return 0;
|
1256
|
+
}
|
1257
|
+
|
1258
|
+
|
1259
|
+
void fs__mkdtemp(uv_fs_t* req) {
|
1260
|
+
fs__mktemp(req, fs__mkdtemp_func);
|
1261
|
+
}
|
1262
|
+
|
1263
|
+
|
1264
|
+
static int fs__mkstemp_func(uv_fs_t* req) {
|
1265
|
+
HANDLE file;
|
1266
|
+
int fd;
|
1267
|
+
|
1268
|
+
file = CreateFileW(req->file.pathw,
|
1269
|
+
GENERIC_READ | GENERIC_WRITE,
|
1270
|
+
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
1271
|
+
NULL,
|
1272
|
+
CREATE_NEW,
|
1273
|
+
FILE_ATTRIBUTE_NORMAL,
|
1274
|
+
NULL);
|
1275
|
+
|
1276
|
+
if (file == INVALID_HANDLE_VALUE) {
|
1277
|
+
DWORD error;
|
1278
|
+
error = GetLastError();
|
1279
|
+
|
1280
|
+
/* If the file exists, the main fs__mktemp() function
|
1281
|
+
will retry. If it's another error, we want to stop. */
|
1282
|
+
if (error != ERROR_FILE_EXISTS) {
|
1283
|
+
SET_REQ_WIN32_ERROR(req, error);
|
1284
|
+
return 1;
|
1285
|
+
}
|
1286
|
+
|
1287
|
+
return 0;
|
1288
|
+
}
|
1289
|
+
|
1290
|
+
fd = _open_osfhandle((intptr_t) file, 0);
|
1291
|
+
if (fd < 0) {
|
1292
|
+
/* The only known failure mode for _open_osfhandle() is EMFILE, in which
|
1293
|
+
* case GetLastError() will return zero. However we'll try to handle other
|
1294
|
+
* errors as well, should they ever occur.
|
1295
|
+
*/
|
1296
|
+
if (errno == EMFILE)
|
1297
|
+
SET_REQ_UV_ERROR(req, UV_EMFILE, ERROR_TOO_MANY_OPEN_FILES);
|
1298
|
+
else if (GetLastError() != ERROR_SUCCESS)
|
1299
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
1300
|
+
else
|
1301
|
+
SET_REQ_WIN32_ERROR(req, UV_UNKNOWN);
|
1302
|
+
CloseHandle(file);
|
1303
|
+
return 1;
|
1304
|
+
}
|
1305
|
+
|
1306
|
+
SET_REQ_RESULT(req, fd);
|
1307
|
+
|
1308
|
+
return 1;
|
1309
|
+
}
|
1310
|
+
|
1311
|
+
|
1312
|
+
void fs__mkstemp(uv_fs_t* req) {
|
1313
|
+
fs__mktemp(req, fs__mkstemp_func);
|
1314
|
+
}
|
1315
|
+
|
1316
|
+
|
1317
|
+
void fs__scandir(uv_fs_t* req) {
|
1318
|
+
static const size_t dirents_initial_size = 32;
|
1319
|
+
|
1320
|
+
HANDLE dir_handle = INVALID_HANDLE_VALUE;
|
1321
|
+
|
1322
|
+
uv__dirent_t** dirents = NULL;
|
1323
|
+
size_t dirents_size = 0;
|
1324
|
+
size_t dirents_used = 0;
|
1325
|
+
|
1326
|
+
IO_STATUS_BLOCK iosb;
|
1327
|
+
NTSTATUS status;
|
1328
|
+
|
1329
|
+
/* Buffer to hold directory entries returned by NtQueryDirectoryFile.
|
1330
|
+
* It's important that this buffer can hold at least one entry, regardless
|
1331
|
+
* of the length of the file names present in the enumerated directory.
|
1332
|
+
* A file name is at most 256 WCHARs long.
|
1333
|
+
* According to MSDN, the buffer must be aligned at an 8-byte boundary.
|
1334
|
+
*/
|
1335
|
+
#if _MSC_VER
|
1336
|
+
__declspec(align(8)) char buffer[8192];
|
1337
|
+
#else
|
1338
|
+
__attribute__ ((aligned (8))) char buffer[8192];
|
1339
|
+
#endif
|
1340
|
+
|
1341
|
+
STATIC_ASSERT(sizeof buffer >=
|
1342
|
+
sizeof(FILE_DIRECTORY_INFORMATION) + 256 * sizeof(WCHAR));
|
1343
|
+
|
1344
|
+
/* Open the directory. */
|
1345
|
+
dir_handle =
|
1346
|
+
CreateFileW(req->file.pathw,
|
1347
|
+
FILE_LIST_DIRECTORY | SYNCHRONIZE,
|
1348
|
+
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
1349
|
+
NULL,
|
1350
|
+
OPEN_EXISTING,
|
1351
|
+
FILE_FLAG_BACKUP_SEMANTICS,
|
1352
|
+
NULL);
|
1353
|
+
if (dir_handle == INVALID_HANDLE_VALUE)
|
1354
|
+
goto win32_error;
|
1355
|
+
|
1356
|
+
/* Read the first chunk. */
|
1357
|
+
status = pNtQueryDirectoryFile(dir_handle,
|
1358
|
+
NULL,
|
1359
|
+
NULL,
|
1360
|
+
NULL,
|
1361
|
+
&iosb,
|
1362
|
+
&buffer,
|
1363
|
+
sizeof buffer,
|
1364
|
+
FileDirectoryInformation,
|
1365
|
+
FALSE,
|
1366
|
+
NULL,
|
1367
|
+
TRUE);
|
1368
|
+
|
1369
|
+
/* If the handle is not a directory, we'll get STATUS_INVALID_PARAMETER.
|
1370
|
+
* This should be reported back as UV_ENOTDIR.
|
1371
|
+
*/
|
1372
|
+
if (status == STATUS_INVALID_PARAMETER)
|
1373
|
+
goto not_a_directory_error;
|
1374
|
+
|
1375
|
+
while (NT_SUCCESS(status)) {
|
1376
|
+
char* position = buffer;
|
1377
|
+
size_t next_entry_offset = 0;
|
1378
|
+
|
1379
|
+
do {
|
1380
|
+
FILE_DIRECTORY_INFORMATION* info;
|
1381
|
+
uv__dirent_t* dirent;
|
1382
|
+
|
1383
|
+
size_t wchar_len;
|
1384
|
+
size_t utf8_len;
|
1385
|
+
|
1386
|
+
/* Obtain a pointer to the current directory entry. */
|
1387
|
+
position += next_entry_offset;
|
1388
|
+
info = (FILE_DIRECTORY_INFORMATION*) position;
|
1389
|
+
|
1390
|
+
/* Fetch the offset to the next directory entry. */
|
1391
|
+
next_entry_offset = info->NextEntryOffset;
|
1392
|
+
|
1393
|
+
/* Compute the length of the filename in WCHARs. */
|
1394
|
+
wchar_len = info->FileNameLength / sizeof info->FileName[0];
|
1395
|
+
|
1396
|
+
/* Skip over '.' and '..' entries. It has been reported that
|
1397
|
+
* the SharePoint driver includes the terminating zero byte in
|
1398
|
+
* the filename length. Strip those first.
|
1399
|
+
*/
|
1400
|
+
while (wchar_len > 0 && info->FileName[wchar_len - 1] == L'\0')
|
1401
|
+
wchar_len -= 1;
|
1402
|
+
|
1403
|
+
if (wchar_len == 0)
|
1404
|
+
continue;
|
1405
|
+
if (wchar_len == 1 && info->FileName[0] == L'.')
|
1406
|
+
continue;
|
1407
|
+
if (wchar_len == 2 && info->FileName[0] == L'.' &&
|
1408
|
+
info->FileName[1] == L'.')
|
1409
|
+
continue;
|
1410
|
+
|
1411
|
+
/* Compute the space required to store the filename as UTF-8. */
|
1412
|
+
utf8_len = WideCharToMultiByte(
|
1413
|
+
CP_UTF8, 0, &info->FileName[0], wchar_len, NULL, 0, NULL, NULL);
|
1414
|
+
if (utf8_len == 0)
|
1415
|
+
goto win32_error;
|
1416
|
+
|
1417
|
+
/* Resize the dirent array if needed. */
|
1418
|
+
if (dirents_used >= dirents_size) {
|
1419
|
+
size_t new_dirents_size =
|
1420
|
+
dirents_size == 0 ? dirents_initial_size : dirents_size << 1;
|
1421
|
+
uv__dirent_t** new_dirents =
|
1422
|
+
uv__realloc(dirents, new_dirents_size * sizeof *dirents);
|
1423
|
+
|
1424
|
+
if (new_dirents == NULL)
|
1425
|
+
goto out_of_memory_error;
|
1426
|
+
|
1427
|
+
dirents_size = new_dirents_size;
|
1428
|
+
dirents = new_dirents;
|
1429
|
+
}
|
1430
|
+
|
1431
|
+
/* Allocate space for the uv dirent structure. The dirent structure
|
1432
|
+
* includes room for the first character of the filename, but `utf8_len`
|
1433
|
+
* doesn't count the NULL terminator at this point.
|
1434
|
+
*/
|
1435
|
+
dirent = uv__malloc(sizeof *dirent + utf8_len);
|
1436
|
+
if (dirent == NULL)
|
1437
|
+
goto out_of_memory_error;
|
1438
|
+
|
1439
|
+
dirents[dirents_used++] = dirent;
|
1440
|
+
|
1441
|
+
/* Convert file name to UTF-8. */
|
1442
|
+
if (WideCharToMultiByte(CP_UTF8,
|
1443
|
+
0,
|
1444
|
+
&info->FileName[0],
|
1445
|
+
wchar_len,
|
1446
|
+
&dirent->d_name[0],
|
1447
|
+
utf8_len,
|
1448
|
+
NULL,
|
1449
|
+
NULL) == 0)
|
1450
|
+
goto win32_error;
|
1451
|
+
|
1452
|
+
/* Add a null terminator to the filename. */
|
1453
|
+
dirent->d_name[utf8_len] = '\0';
|
1454
|
+
|
1455
|
+
/* Fill out the type field. */
|
1456
|
+
if (info->FileAttributes & FILE_ATTRIBUTE_DEVICE)
|
1457
|
+
dirent->d_type = UV__DT_CHAR;
|
1458
|
+
else if (info->FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
|
1459
|
+
dirent->d_type = UV__DT_LINK;
|
1460
|
+
else if (info->FileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
1461
|
+
dirent->d_type = UV__DT_DIR;
|
1462
|
+
else
|
1463
|
+
dirent->d_type = UV__DT_FILE;
|
1464
|
+
} while (next_entry_offset != 0);
|
1465
|
+
|
1466
|
+
/* Read the next chunk. */
|
1467
|
+
status = pNtQueryDirectoryFile(dir_handle,
|
1468
|
+
NULL,
|
1469
|
+
NULL,
|
1470
|
+
NULL,
|
1471
|
+
&iosb,
|
1472
|
+
&buffer,
|
1473
|
+
sizeof buffer,
|
1474
|
+
FileDirectoryInformation,
|
1475
|
+
FALSE,
|
1476
|
+
NULL,
|
1477
|
+
FALSE);
|
1478
|
+
|
1479
|
+
/* After the first pNtQueryDirectoryFile call, the function may return
|
1480
|
+
* STATUS_SUCCESS even if the buffer was too small to hold at least one
|
1481
|
+
* directory entry.
|
1482
|
+
*/
|
1483
|
+
if (status == STATUS_SUCCESS && iosb.Information == 0)
|
1484
|
+
status = STATUS_BUFFER_OVERFLOW;
|
1485
|
+
}
|
1486
|
+
|
1487
|
+
if (status != STATUS_NO_MORE_FILES)
|
1488
|
+
goto nt_error;
|
1489
|
+
|
1490
|
+
CloseHandle(dir_handle);
|
1491
|
+
|
1492
|
+
/* Store the result in the request object. */
|
1493
|
+
req->ptr = dirents;
|
1494
|
+
if (dirents != NULL)
|
1495
|
+
req->flags |= UV_FS_FREE_PTR;
|
1496
|
+
|
1497
|
+
SET_REQ_RESULT(req, dirents_used);
|
1498
|
+
|
1499
|
+
/* `nbufs` will be used as index by uv_fs_scandir_next. */
|
1500
|
+
req->fs.info.nbufs = 0;
|
1501
|
+
|
1502
|
+
return;
|
1503
|
+
|
1504
|
+
nt_error:
|
1505
|
+
SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(status));
|
1506
|
+
goto cleanup;
|
1507
|
+
|
1508
|
+
win32_error:
|
1509
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
1510
|
+
goto cleanup;
|
1511
|
+
|
1512
|
+
not_a_directory_error:
|
1513
|
+
SET_REQ_UV_ERROR(req, UV_ENOTDIR, ERROR_DIRECTORY);
|
1514
|
+
goto cleanup;
|
1515
|
+
|
1516
|
+
out_of_memory_error:
|
1517
|
+
SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
|
1518
|
+
goto cleanup;
|
1519
|
+
|
1520
|
+
cleanup:
|
1521
|
+
if (dir_handle != INVALID_HANDLE_VALUE)
|
1522
|
+
CloseHandle(dir_handle);
|
1523
|
+
while (dirents_used > 0)
|
1524
|
+
uv__free(dirents[--dirents_used]);
|
1525
|
+
if (dirents != NULL)
|
1526
|
+
uv__free(dirents);
|
1527
|
+
}
|
1528
|
+
|
1529
|
+
void fs__opendir(uv_fs_t* req) {
|
1530
|
+
WCHAR* pathw;
|
1531
|
+
size_t len;
|
1532
|
+
const WCHAR* fmt;
|
1533
|
+
WCHAR* find_path;
|
1534
|
+
uv_dir_t* dir;
|
1535
|
+
|
1536
|
+
pathw = req->file.pathw;
|
1537
|
+
dir = NULL;
|
1538
|
+
find_path = NULL;
|
1539
|
+
|
1540
|
+
/* Figure out whether path is a file or a directory. */
|
1541
|
+
if (!(GetFileAttributesW(pathw) & FILE_ATTRIBUTE_DIRECTORY)) {
|
1542
|
+
SET_REQ_UV_ERROR(req, UV_ENOTDIR, ERROR_DIRECTORY);
|
1543
|
+
goto error;
|
1544
|
+
}
|
1545
|
+
|
1546
|
+
dir = uv__malloc(sizeof(*dir));
|
1547
|
+
if (dir == NULL) {
|
1548
|
+
SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
|
1549
|
+
goto error;
|
1550
|
+
}
|
1551
|
+
|
1552
|
+
len = wcslen(pathw);
|
1553
|
+
|
1554
|
+
if (len == 0)
|
1555
|
+
fmt = L"./*";
|
1556
|
+
else if (IS_SLASH(pathw[len - 1]))
|
1557
|
+
fmt = L"%s*";
|
1558
|
+
else
|
1559
|
+
fmt = L"%s\\*";
|
1560
|
+
|
1561
|
+
find_path = uv__malloc(sizeof(WCHAR) * (len + 4));
|
1562
|
+
if (find_path == NULL) {
|
1563
|
+
SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
|
1564
|
+
goto error;
|
1565
|
+
}
|
1566
|
+
|
1567
|
+
_snwprintf(find_path, len + 3, fmt, pathw);
|
1568
|
+
dir->dir_handle = FindFirstFileW(find_path, &dir->find_data);
|
1569
|
+
uv__free(find_path);
|
1570
|
+
find_path = NULL;
|
1571
|
+
if (dir->dir_handle == INVALID_HANDLE_VALUE &&
|
1572
|
+
GetLastError() != ERROR_FILE_NOT_FOUND) {
|
1573
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
1574
|
+
goto error;
|
1575
|
+
}
|
1576
|
+
|
1577
|
+
dir->need_find_call = FALSE;
|
1578
|
+
req->ptr = dir;
|
1579
|
+
SET_REQ_RESULT(req, 0);
|
1580
|
+
return;
|
1581
|
+
|
1582
|
+
error:
|
1583
|
+
uv__free(dir);
|
1584
|
+
uv__free(find_path);
|
1585
|
+
req->ptr = NULL;
|
1586
|
+
}
|
1587
|
+
|
1588
|
+
void fs__readdir(uv_fs_t* req) {
|
1589
|
+
uv_dir_t* dir;
|
1590
|
+
uv_dirent_t* dirents;
|
1591
|
+
uv__dirent_t dent;
|
1592
|
+
unsigned int dirent_idx;
|
1593
|
+
PWIN32_FIND_DATAW find_data;
|
1594
|
+
unsigned int i;
|
1595
|
+
int r;
|
1596
|
+
|
1597
|
+
req->flags |= UV_FS_FREE_PTR;
|
1598
|
+
dir = req->ptr;
|
1599
|
+
dirents = dir->dirents;
|
1600
|
+
memset(dirents, 0, dir->nentries * sizeof(*dir->dirents));
|
1601
|
+
find_data = &dir->find_data;
|
1602
|
+
dirent_idx = 0;
|
1603
|
+
|
1604
|
+
while (dirent_idx < dir->nentries) {
|
1605
|
+
if (dir->need_find_call && FindNextFileW(dir->dir_handle, find_data) == 0) {
|
1606
|
+
if (GetLastError() == ERROR_NO_MORE_FILES)
|
1607
|
+
break;
|
1608
|
+
goto error;
|
1609
|
+
}
|
1610
|
+
|
1611
|
+
/* Skip "." and ".." entries. */
|
1612
|
+
if (find_data->cFileName[0] == L'.' &&
|
1613
|
+
(find_data->cFileName[1] == L'\0' ||
|
1614
|
+
(find_data->cFileName[1] == L'.' &&
|
1615
|
+
find_data->cFileName[2] == L'\0'))) {
|
1616
|
+
dir->need_find_call = TRUE;
|
1617
|
+
continue;
|
1618
|
+
}
|
1619
|
+
|
1620
|
+
r = uv__convert_utf16_to_utf8((const WCHAR*) &find_data->cFileName,
|
1621
|
+
-1,
|
1622
|
+
(char**) &dirents[dirent_idx].name);
|
1623
|
+
if (r != 0)
|
1624
|
+
goto error;
|
1625
|
+
|
1626
|
+
/* Copy file type. */
|
1627
|
+
if ((find_data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
|
1628
|
+
dent.d_type = UV__DT_DIR;
|
1629
|
+
else if ((find_data->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) != 0)
|
1630
|
+
dent.d_type = UV__DT_LINK;
|
1631
|
+
else if ((find_data->dwFileAttributes & FILE_ATTRIBUTE_DEVICE) != 0)
|
1632
|
+
dent.d_type = UV__DT_CHAR;
|
1633
|
+
else
|
1634
|
+
dent.d_type = UV__DT_FILE;
|
1635
|
+
|
1636
|
+
dirents[dirent_idx].type = uv__fs_get_dirent_type(&dent);
|
1637
|
+
dir->need_find_call = TRUE;
|
1638
|
+
++dirent_idx;
|
1639
|
+
}
|
1640
|
+
|
1641
|
+
SET_REQ_RESULT(req, dirent_idx);
|
1642
|
+
return;
|
1643
|
+
|
1644
|
+
error:
|
1645
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
1646
|
+
for (i = 0; i < dirent_idx; ++i) {
|
1647
|
+
uv__free((char*) dirents[i].name);
|
1648
|
+
dirents[i].name = NULL;
|
1649
|
+
}
|
1650
|
+
}
|
1651
|
+
|
1652
|
+
void fs__closedir(uv_fs_t* req) {
|
1653
|
+
uv_dir_t* dir;
|
1654
|
+
|
1655
|
+
dir = req->ptr;
|
1656
|
+
FindClose(dir->dir_handle);
|
1657
|
+
uv__free(req->ptr);
|
1658
|
+
SET_REQ_RESULT(req, 0);
|
1659
|
+
}
|
1660
|
+
|
1661
|
+
INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf,
|
1662
|
+
int do_lstat) {
|
1663
|
+
FILE_ALL_INFORMATION file_info;
|
1664
|
+
FILE_FS_VOLUME_INFORMATION volume_info;
|
1665
|
+
NTSTATUS nt_status;
|
1666
|
+
IO_STATUS_BLOCK io_status;
|
1667
|
+
|
1668
|
+
nt_status = pNtQueryInformationFile(handle,
|
1669
|
+
&io_status,
|
1670
|
+
&file_info,
|
1671
|
+
sizeof file_info,
|
1672
|
+
FileAllInformation);
|
1673
|
+
|
1674
|
+
/* Buffer overflow (a warning status code) is expected here. */
|
1675
|
+
if (NT_ERROR(nt_status)) {
|
1676
|
+
SetLastError(pRtlNtStatusToDosError(nt_status));
|
1677
|
+
return -1;
|
1678
|
+
}
|
1679
|
+
|
1680
|
+
nt_status = pNtQueryVolumeInformationFile(handle,
|
1681
|
+
&io_status,
|
1682
|
+
&volume_info,
|
1683
|
+
sizeof volume_info,
|
1684
|
+
FileFsVolumeInformation);
|
1685
|
+
|
1686
|
+
/* Buffer overflow (a warning status code) is expected here. */
|
1687
|
+
if (io_status.Status == STATUS_NOT_IMPLEMENTED) {
|
1688
|
+
statbuf->st_dev = 0;
|
1689
|
+
} else if (NT_ERROR(nt_status)) {
|
1690
|
+
SetLastError(pRtlNtStatusToDosError(nt_status));
|
1691
|
+
return -1;
|
1692
|
+
} else {
|
1693
|
+
statbuf->st_dev = volume_info.VolumeSerialNumber;
|
1694
|
+
}
|
1695
|
+
|
1696
|
+
/* Todo: st_mode should probably always be 0666 for everyone. We might also
|
1697
|
+
* want to report 0777 if the file is a .exe or a directory.
|
1698
|
+
*
|
1699
|
+
* Currently it's based on whether the 'readonly' attribute is set, which
|
1700
|
+
* makes little sense because the semantics are so different: the 'read-only'
|
1701
|
+
* flag is just a way for a user to protect against accidental deletion, and
|
1702
|
+
* serves no security purpose. Windows uses ACLs for that.
|
1703
|
+
*
|
1704
|
+
* Also people now use uv_fs_chmod() to take away the writable bit for good
|
1705
|
+
* reasons. Windows however just makes the file read-only, which makes it
|
1706
|
+
* impossible to delete the file afterwards, since read-only files can't be
|
1707
|
+
* deleted.
|
1708
|
+
*
|
1709
|
+
* IOW it's all just a clusterfuck and we should think of something that
|
1710
|
+
* makes slightly more sense.
|
1711
|
+
*
|
1712
|
+
* And uv_fs_chmod should probably just fail on windows or be a total no-op.
|
1713
|
+
* There's nothing sensible it can do anyway.
|
1714
|
+
*/
|
1715
|
+
statbuf->st_mode = 0;
|
1716
|
+
|
1717
|
+
/*
|
1718
|
+
* On Windows, FILE_ATTRIBUTE_REPARSE_POINT is a general purpose mechanism
|
1719
|
+
* by which filesystem drivers can intercept and alter file system requests.
|
1720
|
+
*
|
1721
|
+
* The only reparse points we care about are symlinks and mount points, both
|
1722
|
+
* of which are treated as POSIX symlinks. Further, we only care when
|
1723
|
+
* invoked via lstat, which seeks information about the link instead of its
|
1724
|
+
* target. Otherwise, reparse points must be treated as regular files.
|
1725
|
+
*/
|
1726
|
+
if (do_lstat &&
|
1727
|
+
(file_info.BasicInformation.FileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) {
|
1728
|
+
/*
|
1729
|
+
* If reading the link fails, the reparse point is not a symlink and needs
|
1730
|
+
* to be treated as a regular file. The higher level lstat function will
|
1731
|
+
* detect this failure and retry without do_lstat if appropriate.
|
1732
|
+
*/
|
1733
|
+
if (fs__readlink_handle(handle, NULL, &statbuf->st_size) != 0)
|
1734
|
+
return -1;
|
1735
|
+
statbuf->st_mode |= S_IFLNK;
|
1736
|
+
}
|
1737
|
+
|
1738
|
+
if (statbuf->st_mode == 0) {
|
1739
|
+
if (file_info.BasicInformation.FileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
1740
|
+
statbuf->st_mode |= _S_IFDIR;
|
1741
|
+
statbuf->st_size = 0;
|
1742
|
+
} else {
|
1743
|
+
statbuf->st_mode |= _S_IFREG;
|
1744
|
+
statbuf->st_size = file_info.StandardInformation.EndOfFile.QuadPart;
|
1745
|
+
}
|
1746
|
+
}
|
1747
|
+
|
1748
|
+
if (file_info.BasicInformation.FileAttributes & FILE_ATTRIBUTE_READONLY)
|
1749
|
+
statbuf->st_mode |= _S_IREAD | (_S_IREAD >> 3) | (_S_IREAD >> 6);
|
1750
|
+
else
|
1751
|
+
statbuf->st_mode |= (_S_IREAD | _S_IWRITE) | ((_S_IREAD | _S_IWRITE) >> 3) |
|
1752
|
+
((_S_IREAD | _S_IWRITE) >> 6);
|
1753
|
+
|
1754
|
+
FILETIME_TO_TIMESPEC(statbuf->st_atim, file_info.BasicInformation.LastAccessTime);
|
1755
|
+
FILETIME_TO_TIMESPEC(statbuf->st_ctim, file_info.BasicInformation.ChangeTime);
|
1756
|
+
FILETIME_TO_TIMESPEC(statbuf->st_mtim, file_info.BasicInformation.LastWriteTime);
|
1757
|
+
FILETIME_TO_TIMESPEC(statbuf->st_birthtim, file_info.BasicInformation.CreationTime);
|
1758
|
+
|
1759
|
+
statbuf->st_ino = file_info.InternalInformation.IndexNumber.QuadPart;
|
1760
|
+
|
1761
|
+
/* st_blocks contains the on-disk allocation size in 512-byte units. */
|
1762
|
+
statbuf->st_blocks =
|
1763
|
+
(uint64_t) file_info.StandardInformation.AllocationSize.QuadPart >> 9;
|
1764
|
+
|
1765
|
+
statbuf->st_nlink = file_info.StandardInformation.NumberOfLinks;
|
1766
|
+
|
1767
|
+
/* The st_blksize is supposed to be the 'optimal' number of bytes for reading
|
1768
|
+
* and writing to the disk. That is, for any definition of 'optimal' - it's
|
1769
|
+
* supposed to at least avoid read-update-write behavior when writing to the
|
1770
|
+
* disk.
|
1771
|
+
*
|
1772
|
+
* However nobody knows this and even fewer people actually use this value,
|
1773
|
+
* and in order to fill it out we'd have to make another syscall to query the
|
1774
|
+
* volume for FILE_FS_SECTOR_SIZE_INFORMATION.
|
1775
|
+
*
|
1776
|
+
* Therefore we'll just report a sensible value that's quite commonly okay
|
1777
|
+
* on modern hardware.
|
1778
|
+
*
|
1779
|
+
* 4096 is the minimum required to be compatible with newer Advanced Format
|
1780
|
+
* drives (which have 4096 bytes per physical sector), and to be backwards
|
1781
|
+
* compatible with older drives (which have 512 bytes per physical sector).
|
1782
|
+
*/
|
1783
|
+
statbuf->st_blksize = 4096;
|
1784
|
+
|
1785
|
+
/* Todo: set st_flags to something meaningful. Also provide a wrapper for
|
1786
|
+
* chattr(2).
|
1787
|
+
*/
|
1788
|
+
statbuf->st_flags = 0;
|
1789
|
+
|
1790
|
+
/* Windows has nothing sensible to say about these values, so they'll just
|
1791
|
+
* remain empty.
|
1792
|
+
*/
|
1793
|
+
statbuf->st_gid = 0;
|
1794
|
+
statbuf->st_uid = 0;
|
1795
|
+
statbuf->st_rdev = 0;
|
1796
|
+
statbuf->st_gen = 0;
|
1797
|
+
|
1798
|
+
return 0;
|
1799
|
+
}
|
1800
|
+
|
1801
|
+
|
1802
|
+
INLINE static void fs__stat_prepare_path(WCHAR* pathw) {
|
1803
|
+
size_t len = wcslen(pathw);
|
1804
|
+
|
1805
|
+
/* TODO: ignore namespaced paths. */
|
1806
|
+
if (len > 1 && pathw[len - 2] != L':' &&
|
1807
|
+
(pathw[len - 1] == L'\\' || pathw[len - 1] == L'/')) {
|
1808
|
+
pathw[len - 1] = '\0';
|
1809
|
+
}
|
1810
|
+
}
|
1811
|
+
|
1812
|
+
|
1813
|
+
INLINE static DWORD fs__stat_impl_from_path(WCHAR* path,
|
1814
|
+
int do_lstat,
|
1815
|
+
uv_stat_t* statbuf) {
|
1816
|
+
HANDLE handle;
|
1817
|
+
DWORD flags;
|
1818
|
+
DWORD ret;
|
1819
|
+
|
1820
|
+
flags = FILE_FLAG_BACKUP_SEMANTICS;
|
1821
|
+
if (do_lstat)
|
1822
|
+
flags |= FILE_FLAG_OPEN_REPARSE_POINT;
|
1823
|
+
|
1824
|
+
handle = CreateFileW(path,
|
1825
|
+
FILE_READ_ATTRIBUTES,
|
1826
|
+
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
1827
|
+
NULL,
|
1828
|
+
OPEN_EXISTING,
|
1829
|
+
flags,
|
1830
|
+
NULL);
|
1831
|
+
|
1832
|
+
if (handle == INVALID_HANDLE_VALUE)
|
1833
|
+
ret = GetLastError();
|
1834
|
+
else if (fs__stat_handle(handle, statbuf, do_lstat) != 0)
|
1835
|
+
ret = GetLastError();
|
1836
|
+
else
|
1837
|
+
ret = 0;
|
1838
|
+
|
1839
|
+
CloseHandle(handle);
|
1840
|
+
return ret;
|
1841
|
+
}
|
1842
|
+
|
1843
|
+
|
1844
|
+
INLINE static void fs__stat_impl(uv_fs_t* req, int do_lstat) {
|
1845
|
+
DWORD error;
|
1846
|
+
|
1847
|
+
error = fs__stat_impl_from_path(req->file.pathw, do_lstat, &req->statbuf);
|
1848
|
+
if (error != 0) {
|
1849
|
+
if (do_lstat &&
|
1850
|
+
(error == ERROR_SYMLINK_NOT_SUPPORTED ||
|
1851
|
+
error == ERROR_NOT_A_REPARSE_POINT)) {
|
1852
|
+
/* We opened a reparse point but it was not a symlink. Try again. */
|
1853
|
+
fs__stat_impl(req, 0);
|
1854
|
+
} else {
|
1855
|
+
/* Stat failed. */
|
1856
|
+
SET_REQ_WIN32_ERROR(req, error);
|
1857
|
+
}
|
1858
|
+
|
1859
|
+
return;
|
1860
|
+
}
|
1861
|
+
|
1862
|
+
req->ptr = &req->statbuf;
|
1863
|
+
req->result = 0;
|
1864
|
+
}
|
1865
|
+
|
1866
|
+
|
1867
|
+
static void fs__stat(uv_fs_t* req) {
|
1868
|
+
fs__stat_prepare_path(req->file.pathw);
|
1869
|
+
fs__stat_impl(req, 0);
|
1870
|
+
}
|
1871
|
+
|
1872
|
+
|
1873
|
+
static void fs__lstat(uv_fs_t* req) {
|
1874
|
+
fs__stat_prepare_path(req->file.pathw);
|
1875
|
+
fs__stat_impl(req, 1);
|
1876
|
+
}
|
1877
|
+
|
1878
|
+
|
1879
|
+
static void fs__fstat(uv_fs_t* req) {
|
1880
|
+
int fd = req->file.fd;
|
1881
|
+
HANDLE handle;
|
1882
|
+
|
1883
|
+
VERIFY_FD(fd, req);
|
1884
|
+
|
1885
|
+
handle = uv__get_osfhandle(fd);
|
1886
|
+
|
1887
|
+
if (handle == INVALID_HANDLE_VALUE) {
|
1888
|
+
SET_REQ_WIN32_ERROR(req, ERROR_INVALID_HANDLE);
|
1889
|
+
return;
|
1890
|
+
}
|
1891
|
+
|
1892
|
+
if (fs__stat_handle(handle, &req->statbuf, 0) != 0) {
|
1893
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
1894
|
+
return;
|
1895
|
+
}
|
1896
|
+
|
1897
|
+
req->ptr = &req->statbuf;
|
1898
|
+
req->result = 0;
|
1899
|
+
}
|
1900
|
+
|
1901
|
+
|
1902
|
+
static void fs__rename(uv_fs_t* req) {
|
1903
|
+
if (!MoveFileExW(req->file.pathw, req->fs.info.new_pathw, MOVEFILE_REPLACE_EXISTING)) {
|
1904
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
1905
|
+
return;
|
1906
|
+
}
|
1907
|
+
|
1908
|
+
SET_REQ_RESULT(req, 0);
|
1909
|
+
}
|
1910
|
+
|
1911
|
+
|
1912
|
+
INLINE static void fs__sync_impl(uv_fs_t* req) {
|
1913
|
+
int fd = req->file.fd;
|
1914
|
+
int result;
|
1915
|
+
|
1916
|
+
VERIFY_FD(fd, req);
|
1917
|
+
|
1918
|
+
result = FlushFileBuffers(uv__get_osfhandle(fd)) ? 0 : -1;
|
1919
|
+
if (result == -1) {
|
1920
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
1921
|
+
} else {
|
1922
|
+
SET_REQ_RESULT(req, result);
|
1923
|
+
}
|
1924
|
+
}
|
1925
|
+
|
1926
|
+
|
1927
|
+
static void fs__fsync(uv_fs_t* req) {
|
1928
|
+
fs__sync_impl(req);
|
1929
|
+
}
|
1930
|
+
|
1931
|
+
|
1932
|
+
static void fs__fdatasync(uv_fs_t* req) {
|
1933
|
+
fs__sync_impl(req);
|
1934
|
+
}
|
1935
|
+
|
1936
|
+
|
1937
|
+
static void fs__ftruncate(uv_fs_t* req) {
|
1938
|
+
int fd = req->file.fd;
|
1939
|
+
HANDLE handle;
|
1940
|
+
struct uv__fd_info_s fd_info = { 0 };
|
1941
|
+
NTSTATUS status;
|
1942
|
+
IO_STATUS_BLOCK io_status;
|
1943
|
+
FILE_END_OF_FILE_INFORMATION eof_info;
|
1944
|
+
|
1945
|
+
VERIFY_FD(fd, req);
|
1946
|
+
|
1947
|
+
handle = uv__get_osfhandle(fd);
|
1948
|
+
|
1949
|
+
if (uv__fd_hash_get(fd, &fd_info)) {
|
1950
|
+
if (fd_info.is_directory) {
|
1951
|
+
SET_REQ_WIN32_ERROR(req, ERROR_ACCESS_DENIED);
|
1952
|
+
return;
|
1953
|
+
}
|
1954
|
+
|
1955
|
+
if (fd_info.mapping != INVALID_HANDLE_VALUE) {
|
1956
|
+
CloseHandle(fd_info.mapping);
|
1957
|
+
}
|
1958
|
+
}
|
1959
|
+
|
1960
|
+
eof_info.EndOfFile.QuadPart = req->fs.info.offset;
|
1961
|
+
|
1962
|
+
status = pNtSetInformationFile(handle,
|
1963
|
+
&io_status,
|
1964
|
+
&eof_info,
|
1965
|
+
sizeof eof_info,
|
1966
|
+
FileEndOfFileInformation);
|
1967
|
+
|
1968
|
+
if (NT_SUCCESS(status)) {
|
1969
|
+
SET_REQ_RESULT(req, 0);
|
1970
|
+
} else {
|
1971
|
+
SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(status));
|
1972
|
+
|
1973
|
+
if (fd_info.flags) {
|
1974
|
+
CloseHandle(handle);
|
1975
|
+
fd_info.mapping = INVALID_HANDLE_VALUE;
|
1976
|
+
fd_info.size.QuadPart = 0;
|
1977
|
+
fd_info.current_pos.QuadPart = 0;
|
1978
|
+
uv__fd_hash_add(fd, &fd_info);
|
1979
|
+
return;
|
1980
|
+
}
|
1981
|
+
}
|
1982
|
+
|
1983
|
+
if (fd_info.flags) {
|
1984
|
+
fd_info.size = eof_info.EndOfFile;
|
1985
|
+
|
1986
|
+
if (fd_info.size.QuadPart == 0) {
|
1987
|
+
fd_info.mapping = INVALID_HANDLE_VALUE;
|
1988
|
+
} else {
|
1989
|
+
DWORD flProtect = (fd_info.flags & (UV_FS_O_RDONLY | UV_FS_O_WRONLY |
|
1990
|
+
UV_FS_O_RDWR)) == UV_FS_O_RDONLY ? PAGE_READONLY : PAGE_READWRITE;
|
1991
|
+
fd_info.mapping = CreateFileMapping(handle,
|
1992
|
+
NULL,
|
1993
|
+
flProtect,
|
1994
|
+
fd_info.size.HighPart,
|
1995
|
+
fd_info.size.LowPart,
|
1996
|
+
NULL);
|
1997
|
+
if (fd_info.mapping == NULL) {
|
1998
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
1999
|
+
CloseHandle(handle);
|
2000
|
+
fd_info.mapping = INVALID_HANDLE_VALUE;
|
2001
|
+
fd_info.size.QuadPart = 0;
|
2002
|
+
fd_info.current_pos.QuadPart = 0;
|
2003
|
+
uv__fd_hash_add(fd, &fd_info);
|
2004
|
+
return;
|
2005
|
+
}
|
2006
|
+
}
|
2007
|
+
|
2008
|
+
uv__fd_hash_add(fd, &fd_info);
|
2009
|
+
}
|
2010
|
+
}
|
2011
|
+
|
2012
|
+
|
2013
|
+
static void fs__copyfile(uv_fs_t* req) {
|
2014
|
+
int flags;
|
2015
|
+
int overwrite;
|
2016
|
+
uv_stat_t statbuf;
|
2017
|
+
uv_stat_t new_statbuf;
|
2018
|
+
|
2019
|
+
flags = req->fs.info.file_flags;
|
2020
|
+
|
2021
|
+
if (flags & UV_FS_COPYFILE_FICLONE_FORCE) {
|
2022
|
+
SET_REQ_UV_ERROR(req, UV_ENOSYS, ERROR_NOT_SUPPORTED);
|
2023
|
+
return;
|
2024
|
+
}
|
2025
|
+
|
2026
|
+
overwrite = flags & UV_FS_COPYFILE_EXCL;
|
2027
|
+
|
2028
|
+
if (CopyFileW(req->file.pathw, req->fs.info.new_pathw, overwrite) != 0) {
|
2029
|
+
SET_REQ_RESULT(req, 0);
|
2030
|
+
return;
|
2031
|
+
}
|
2032
|
+
|
2033
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
2034
|
+
if (req->result != UV_EBUSY)
|
2035
|
+
return;
|
2036
|
+
|
2037
|
+
/* if error UV_EBUSY check if src and dst file are the same */
|
2038
|
+
if (fs__stat_impl_from_path(req->file.pathw, 0, &statbuf) != 0 ||
|
2039
|
+
fs__stat_impl_from_path(req->fs.info.new_pathw, 0, &new_statbuf) != 0) {
|
2040
|
+
return;
|
2041
|
+
}
|
2042
|
+
|
2043
|
+
if (statbuf.st_dev == new_statbuf.st_dev &&
|
2044
|
+
statbuf.st_ino == new_statbuf.st_ino) {
|
2045
|
+
SET_REQ_RESULT(req, 0);
|
2046
|
+
}
|
2047
|
+
}
|
2048
|
+
|
2049
|
+
|
2050
|
+
static void fs__sendfile(uv_fs_t* req) {
|
2051
|
+
int fd_in = req->file.fd, fd_out = req->fs.info.fd_out;
|
2052
|
+
size_t length = req->fs.info.bufsml[0].len;
|
2053
|
+
int64_t offset = req->fs.info.offset;
|
2054
|
+
const size_t max_buf_size = 65536;
|
2055
|
+
size_t buf_size = length < max_buf_size ? length : max_buf_size;
|
2056
|
+
int n, result = 0;
|
2057
|
+
int64_t result_offset = 0;
|
2058
|
+
char* buf = (char*) uv__malloc(buf_size);
|
2059
|
+
if (!buf) {
|
2060
|
+
uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
|
2061
|
+
}
|
2062
|
+
|
2063
|
+
if (offset != -1) {
|
2064
|
+
result_offset = _lseeki64(fd_in, offset, SEEK_SET);
|
2065
|
+
}
|
2066
|
+
|
2067
|
+
if (result_offset == -1) {
|
2068
|
+
result = -1;
|
2069
|
+
} else {
|
2070
|
+
while (length > 0) {
|
2071
|
+
n = _read(fd_in, buf, length < buf_size ? length : buf_size);
|
2072
|
+
if (n == 0) {
|
2073
|
+
break;
|
2074
|
+
} else if (n == -1) {
|
2075
|
+
result = -1;
|
2076
|
+
break;
|
2077
|
+
}
|
2078
|
+
|
2079
|
+
length -= n;
|
2080
|
+
|
2081
|
+
n = _write(fd_out, buf, n);
|
2082
|
+
if (n == -1) {
|
2083
|
+
result = -1;
|
2084
|
+
break;
|
2085
|
+
}
|
2086
|
+
|
2087
|
+
result += n;
|
2088
|
+
}
|
2089
|
+
}
|
2090
|
+
|
2091
|
+
uv__free(buf);
|
2092
|
+
|
2093
|
+
SET_REQ_RESULT(req, result);
|
2094
|
+
}
|
2095
|
+
|
2096
|
+
|
2097
|
+
static void fs__access(uv_fs_t* req) {
|
2098
|
+
DWORD attr = GetFileAttributesW(req->file.pathw);
|
2099
|
+
|
2100
|
+
if (attr == INVALID_FILE_ATTRIBUTES) {
|
2101
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
2102
|
+
return;
|
2103
|
+
}
|
2104
|
+
|
2105
|
+
/*
|
2106
|
+
* Access is possible if
|
2107
|
+
* - write access wasn't requested,
|
2108
|
+
* - or the file isn't read-only,
|
2109
|
+
* - or it's a directory.
|
2110
|
+
* (Directories cannot be read-only on Windows.)
|
2111
|
+
*/
|
2112
|
+
if (!(req->fs.info.mode & W_OK) ||
|
2113
|
+
!(attr & FILE_ATTRIBUTE_READONLY) ||
|
2114
|
+
(attr & FILE_ATTRIBUTE_DIRECTORY)) {
|
2115
|
+
SET_REQ_RESULT(req, 0);
|
2116
|
+
} else {
|
2117
|
+
SET_REQ_WIN32_ERROR(req, UV_EPERM);
|
2118
|
+
}
|
2119
|
+
|
2120
|
+
}
|
2121
|
+
|
2122
|
+
|
2123
|
+
static void fs__chmod(uv_fs_t* req) {
|
2124
|
+
int result = _wchmod(req->file.pathw, req->fs.info.mode);
|
2125
|
+
SET_REQ_RESULT(req, result);
|
2126
|
+
}
|
2127
|
+
|
2128
|
+
|
2129
|
+
static void fs__fchmod(uv_fs_t* req) {
|
2130
|
+
int fd = req->file.fd;
|
2131
|
+
int clear_archive_flag;
|
2132
|
+
HANDLE handle;
|
2133
|
+
NTSTATUS nt_status;
|
2134
|
+
IO_STATUS_BLOCK io_status;
|
2135
|
+
FILE_BASIC_INFORMATION file_info;
|
2136
|
+
|
2137
|
+
VERIFY_FD(fd, req);
|
2138
|
+
|
2139
|
+
handle = ReOpenFile(uv__get_osfhandle(fd), FILE_WRITE_ATTRIBUTES, 0, 0);
|
2140
|
+
if (handle == INVALID_HANDLE_VALUE) {
|
2141
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
2142
|
+
return;
|
2143
|
+
}
|
2144
|
+
|
2145
|
+
nt_status = pNtQueryInformationFile(handle,
|
2146
|
+
&io_status,
|
2147
|
+
&file_info,
|
2148
|
+
sizeof file_info,
|
2149
|
+
FileBasicInformation);
|
2150
|
+
|
2151
|
+
if (!NT_SUCCESS(nt_status)) {
|
2152
|
+
SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(nt_status));
|
2153
|
+
goto fchmod_cleanup;
|
2154
|
+
}
|
2155
|
+
|
2156
|
+
/* Test if the Archive attribute is cleared */
|
2157
|
+
if ((file_info.FileAttributes & FILE_ATTRIBUTE_ARCHIVE) == 0) {
|
2158
|
+
/* Set Archive flag, otherwise setting or clearing the read-only
|
2159
|
+
flag will not work */
|
2160
|
+
file_info.FileAttributes |= FILE_ATTRIBUTE_ARCHIVE;
|
2161
|
+
nt_status = pNtSetInformationFile(handle,
|
2162
|
+
&io_status,
|
2163
|
+
&file_info,
|
2164
|
+
sizeof file_info,
|
2165
|
+
FileBasicInformation);
|
2166
|
+
if (!NT_SUCCESS(nt_status)) {
|
2167
|
+
SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(nt_status));
|
2168
|
+
goto fchmod_cleanup;
|
2169
|
+
}
|
2170
|
+
/* Remeber to clear the flag later on */
|
2171
|
+
clear_archive_flag = 1;
|
2172
|
+
} else {
|
2173
|
+
clear_archive_flag = 0;
|
2174
|
+
}
|
2175
|
+
|
2176
|
+
if (req->fs.info.mode & _S_IWRITE) {
|
2177
|
+
file_info.FileAttributes &= ~FILE_ATTRIBUTE_READONLY;
|
2178
|
+
} else {
|
2179
|
+
file_info.FileAttributes |= FILE_ATTRIBUTE_READONLY;
|
2180
|
+
}
|
2181
|
+
|
2182
|
+
nt_status = pNtSetInformationFile(handle,
|
2183
|
+
&io_status,
|
2184
|
+
&file_info,
|
2185
|
+
sizeof file_info,
|
2186
|
+
FileBasicInformation);
|
2187
|
+
|
2188
|
+
if (!NT_SUCCESS(nt_status)) {
|
2189
|
+
SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(nt_status));
|
2190
|
+
goto fchmod_cleanup;
|
2191
|
+
}
|
2192
|
+
|
2193
|
+
if (clear_archive_flag) {
|
2194
|
+
file_info.FileAttributes &= ~FILE_ATTRIBUTE_ARCHIVE;
|
2195
|
+
if (file_info.FileAttributes == 0) {
|
2196
|
+
file_info.FileAttributes = FILE_ATTRIBUTE_NORMAL;
|
2197
|
+
}
|
2198
|
+
nt_status = pNtSetInformationFile(handle,
|
2199
|
+
&io_status,
|
2200
|
+
&file_info,
|
2201
|
+
sizeof file_info,
|
2202
|
+
FileBasicInformation);
|
2203
|
+
if (!NT_SUCCESS(nt_status)) {
|
2204
|
+
SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(nt_status));
|
2205
|
+
goto fchmod_cleanup;
|
2206
|
+
}
|
2207
|
+
}
|
2208
|
+
|
2209
|
+
SET_REQ_SUCCESS(req);
|
2210
|
+
fchmod_cleanup:
|
2211
|
+
CloseHandle(handle);
|
2212
|
+
}
|
2213
|
+
|
2214
|
+
|
2215
|
+
INLINE static int fs__utime_handle(HANDLE handle, double atime, double mtime) {
|
2216
|
+
FILETIME filetime_a, filetime_m;
|
2217
|
+
|
2218
|
+
TIME_T_TO_FILETIME(atime, &filetime_a);
|
2219
|
+
TIME_T_TO_FILETIME(mtime, &filetime_m);
|
2220
|
+
|
2221
|
+
if (!SetFileTime(handle, NULL, &filetime_a, &filetime_m)) {
|
2222
|
+
return -1;
|
2223
|
+
}
|
2224
|
+
|
2225
|
+
return 0;
|
2226
|
+
}
|
2227
|
+
|
2228
|
+
|
2229
|
+
static void fs__utime(uv_fs_t* req) {
|
2230
|
+
HANDLE handle;
|
2231
|
+
|
2232
|
+
handle = CreateFileW(req->file.pathw,
|
2233
|
+
FILE_WRITE_ATTRIBUTES,
|
2234
|
+
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
2235
|
+
NULL,
|
2236
|
+
OPEN_EXISTING,
|
2237
|
+
FILE_FLAG_BACKUP_SEMANTICS,
|
2238
|
+
NULL);
|
2239
|
+
|
2240
|
+
if (handle == INVALID_HANDLE_VALUE) {
|
2241
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
2242
|
+
return;
|
2243
|
+
}
|
2244
|
+
|
2245
|
+
if (fs__utime_handle(handle, req->fs.time.atime, req->fs.time.mtime) != 0) {
|
2246
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
2247
|
+
CloseHandle(handle);
|
2248
|
+
return;
|
2249
|
+
}
|
2250
|
+
|
2251
|
+
CloseHandle(handle);
|
2252
|
+
|
2253
|
+
req->result = 0;
|
2254
|
+
}
|
2255
|
+
|
2256
|
+
|
2257
|
+
static void fs__futime(uv_fs_t* req) {
|
2258
|
+
int fd = req->file.fd;
|
2259
|
+
HANDLE handle;
|
2260
|
+
VERIFY_FD(fd, req);
|
2261
|
+
|
2262
|
+
handle = uv__get_osfhandle(fd);
|
2263
|
+
|
2264
|
+
if (handle == INVALID_HANDLE_VALUE) {
|
2265
|
+
SET_REQ_WIN32_ERROR(req, ERROR_INVALID_HANDLE);
|
2266
|
+
return;
|
2267
|
+
}
|
2268
|
+
|
2269
|
+
if (fs__utime_handle(handle, req->fs.time.atime, req->fs.time.mtime) != 0) {
|
2270
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
2271
|
+
return;
|
2272
|
+
}
|
2273
|
+
|
2274
|
+
req->result = 0;
|
2275
|
+
}
|
2276
|
+
|
2277
|
+
|
2278
|
+
static void fs__link(uv_fs_t* req) {
|
2279
|
+
DWORD r = CreateHardLinkW(req->fs.info.new_pathw, req->file.pathw, NULL);
|
2280
|
+
if (r == 0) {
|
2281
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
2282
|
+
} else {
|
2283
|
+
req->result = 0;
|
2284
|
+
}
|
2285
|
+
}
|
2286
|
+
|
2287
|
+
|
2288
|
+
static void fs__create_junction(uv_fs_t* req, const WCHAR* path,
|
2289
|
+
const WCHAR* new_path) {
|
2290
|
+
HANDLE handle = INVALID_HANDLE_VALUE;
|
2291
|
+
REPARSE_DATA_BUFFER *buffer = NULL;
|
2292
|
+
int created = 0;
|
2293
|
+
int target_len;
|
2294
|
+
int is_absolute, is_long_path;
|
2295
|
+
int needed_buf_size, used_buf_size, used_data_size, path_buf_len;
|
2296
|
+
int start, len, i;
|
2297
|
+
int add_slash;
|
2298
|
+
DWORD bytes;
|
2299
|
+
WCHAR* path_buf;
|
2300
|
+
|
2301
|
+
target_len = wcslen(path);
|
2302
|
+
is_long_path = wcsncmp(path, LONG_PATH_PREFIX, LONG_PATH_PREFIX_LEN) == 0;
|
2303
|
+
|
2304
|
+
if (is_long_path) {
|
2305
|
+
is_absolute = 1;
|
2306
|
+
} else {
|
2307
|
+
is_absolute = target_len >= 3 && IS_LETTER(path[0]) &&
|
2308
|
+
path[1] == L':' && IS_SLASH(path[2]);
|
2309
|
+
}
|
2310
|
+
|
2311
|
+
if (!is_absolute) {
|
2312
|
+
/* Not supporting relative paths */
|
2313
|
+
SET_REQ_UV_ERROR(req, UV_EINVAL, ERROR_NOT_SUPPORTED);
|
2314
|
+
return;
|
2315
|
+
}
|
2316
|
+
|
2317
|
+
/* Do a pessimistic calculation of the required buffer size */
|
2318
|
+
needed_buf_size =
|
2319
|
+
FIELD_OFFSET(REPARSE_DATA_BUFFER, MountPointReparseBuffer.PathBuffer) +
|
2320
|
+
JUNCTION_PREFIX_LEN * sizeof(WCHAR) +
|
2321
|
+
2 * (target_len + 2) * sizeof(WCHAR);
|
2322
|
+
|
2323
|
+
/* Allocate the buffer */
|
2324
|
+
buffer = (REPARSE_DATA_BUFFER*)uv__malloc(needed_buf_size);
|
2325
|
+
if (!buffer) {
|
2326
|
+
uv_fatal_error(ERROR_OUTOFMEMORY, "uv__malloc");
|
2327
|
+
}
|
2328
|
+
|
2329
|
+
/* Grab a pointer to the part of the buffer where filenames go */
|
2330
|
+
path_buf = (WCHAR*)&(buffer->MountPointReparseBuffer.PathBuffer);
|
2331
|
+
path_buf_len = 0;
|
2332
|
+
|
2333
|
+
/* Copy the substitute (internal) target path */
|
2334
|
+
start = path_buf_len;
|
2335
|
+
|
2336
|
+
wcsncpy((WCHAR*)&path_buf[path_buf_len], JUNCTION_PREFIX,
|
2337
|
+
JUNCTION_PREFIX_LEN);
|
2338
|
+
path_buf_len += JUNCTION_PREFIX_LEN;
|
2339
|
+
|
2340
|
+
add_slash = 0;
|
2341
|
+
for (i = is_long_path ? LONG_PATH_PREFIX_LEN : 0; path[i] != L'\0'; i++) {
|
2342
|
+
if (IS_SLASH(path[i])) {
|
2343
|
+
add_slash = 1;
|
2344
|
+
continue;
|
2345
|
+
}
|
2346
|
+
|
2347
|
+
if (add_slash) {
|
2348
|
+
path_buf[path_buf_len++] = L'\\';
|
2349
|
+
add_slash = 0;
|
2350
|
+
}
|
2351
|
+
|
2352
|
+
path_buf[path_buf_len++] = path[i];
|
2353
|
+
}
|
2354
|
+
path_buf[path_buf_len++] = L'\\';
|
2355
|
+
len = path_buf_len - start;
|
2356
|
+
|
2357
|
+
/* Set the info about the substitute name */
|
2358
|
+
buffer->MountPointReparseBuffer.SubstituteNameOffset = start * sizeof(WCHAR);
|
2359
|
+
buffer->MountPointReparseBuffer.SubstituteNameLength = len * sizeof(WCHAR);
|
2360
|
+
|
2361
|
+
/* Insert null terminator */
|
2362
|
+
path_buf[path_buf_len++] = L'\0';
|
2363
|
+
|
2364
|
+
/* Copy the print name of the target path */
|
2365
|
+
start = path_buf_len;
|
2366
|
+
add_slash = 0;
|
2367
|
+
for (i = is_long_path ? LONG_PATH_PREFIX_LEN : 0; path[i] != L'\0'; i++) {
|
2368
|
+
if (IS_SLASH(path[i])) {
|
2369
|
+
add_slash = 1;
|
2370
|
+
continue;
|
2371
|
+
}
|
2372
|
+
|
2373
|
+
if (add_slash) {
|
2374
|
+
path_buf[path_buf_len++] = L'\\';
|
2375
|
+
add_slash = 0;
|
2376
|
+
}
|
2377
|
+
|
2378
|
+
path_buf[path_buf_len++] = path[i];
|
2379
|
+
}
|
2380
|
+
len = path_buf_len - start;
|
2381
|
+
if (len == 2) {
|
2382
|
+
path_buf[path_buf_len++] = L'\\';
|
2383
|
+
len++;
|
2384
|
+
}
|
2385
|
+
|
2386
|
+
/* Set the info about the print name */
|
2387
|
+
buffer->MountPointReparseBuffer.PrintNameOffset = start * sizeof(WCHAR);
|
2388
|
+
buffer->MountPointReparseBuffer.PrintNameLength = len * sizeof(WCHAR);
|
2389
|
+
|
2390
|
+
/* Insert another null terminator */
|
2391
|
+
path_buf[path_buf_len++] = L'\0';
|
2392
|
+
|
2393
|
+
/* Calculate how much buffer space was actually used */
|
2394
|
+
used_buf_size = FIELD_OFFSET(REPARSE_DATA_BUFFER, MountPointReparseBuffer.PathBuffer) +
|
2395
|
+
path_buf_len * sizeof(WCHAR);
|
2396
|
+
used_data_size = used_buf_size -
|
2397
|
+
FIELD_OFFSET(REPARSE_DATA_BUFFER, MountPointReparseBuffer);
|
2398
|
+
|
2399
|
+
/* Put general info in the data buffer */
|
2400
|
+
buffer->ReparseTag = IO_REPARSE_TAG_MOUNT_POINT;
|
2401
|
+
buffer->ReparseDataLength = used_data_size;
|
2402
|
+
buffer->Reserved = 0;
|
2403
|
+
|
2404
|
+
/* Create a new directory */
|
2405
|
+
if (!CreateDirectoryW(new_path, NULL)) {
|
2406
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
2407
|
+
goto error;
|
2408
|
+
}
|
2409
|
+
created = 1;
|
2410
|
+
|
2411
|
+
/* Open the directory */
|
2412
|
+
handle = CreateFileW(new_path,
|
2413
|
+
GENERIC_WRITE,
|
2414
|
+
0,
|
2415
|
+
NULL,
|
2416
|
+
OPEN_EXISTING,
|
2417
|
+
FILE_FLAG_BACKUP_SEMANTICS |
|
2418
|
+
FILE_FLAG_OPEN_REPARSE_POINT,
|
2419
|
+
NULL);
|
2420
|
+
if (handle == INVALID_HANDLE_VALUE) {
|
2421
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
2422
|
+
goto error;
|
2423
|
+
}
|
2424
|
+
|
2425
|
+
/* Create the actual reparse point */
|
2426
|
+
if (!DeviceIoControl(handle,
|
2427
|
+
FSCTL_SET_REPARSE_POINT,
|
2428
|
+
buffer,
|
2429
|
+
used_buf_size,
|
2430
|
+
NULL,
|
2431
|
+
0,
|
2432
|
+
&bytes,
|
2433
|
+
NULL)) {
|
2434
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
2435
|
+
goto error;
|
2436
|
+
}
|
2437
|
+
|
2438
|
+
/* Clean up */
|
2439
|
+
CloseHandle(handle);
|
2440
|
+
uv__free(buffer);
|
2441
|
+
|
2442
|
+
SET_REQ_RESULT(req, 0);
|
2443
|
+
return;
|
2444
|
+
|
2445
|
+
error:
|
2446
|
+
uv__free(buffer);
|
2447
|
+
|
2448
|
+
if (handle != INVALID_HANDLE_VALUE) {
|
2449
|
+
CloseHandle(handle);
|
2450
|
+
}
|
2451
|
+
|
2452
|
+
if (created) {
|
2453
|
+
RemoveDirectoryW(new_path);
|
2454
|
+
}
|
2455
|
+
}
|
2456
|
+
|
2457
|
+
|
2458
|
+
static void fs__symlink(uv_fs_t* req) {
|
2459
|
+
WCHAR* pathw;
|
2460
|
+
WCHAR* new_pathw;
|
2461
|
+
int flags;
|
2462
|
+
int err;
|
2463
|
+
|
2464
|
+
pathw = req->file.pathw;
|
2465
|
+
new_pathw = req->fs.info.new_pathw;
|
2466
|
+
|
2467
|
+
if (req->fs.info.file_flags & UV_FS_SYMLINK_JUNCTION) {
|
2468
|
+
fs__create_junction(req, pathw, new_pathw);
|
2469
|
+
return;
|
2470
|
+
}
|
2471
|
+
|
2472
|
+
if (req->fs.info.file_flags & UV_FS_SYMLINK_DIR)
|
2473
|
+
flags = SYMBOLIC_LINK_FLAG_DIRECTORY | uv__file_symlink_usermode_flag;
|
2474
|
+
else
|
2475
|
+
flags = uv__file_symlink_usermode_flag;
|
2476
|
+
|
2477
|
+
if (CreateSymbolicLinkW(new_pathw, pathw, flags)) {
|
2478
|
+
SET_REQ_RESULT(req, 0);
|
2479
|
+
return;
|
2480
|
+
}
|
2481
|
+
|
2482
|
+
/* Something went wrong. We will test if it is because of user-mode
|
2483
|
+
* symlinks.
|
2484
|
+
*/
|
2485
|
+
err = GetLastError();
|
2486
|
+
if (err == ERROR_INVALID_PARAMETER &&
|
2487
|
+
flags & SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE) {
|
2488
|
+
/* This system does not support user-mode symlinks. We will clear the
|
2489
|
+
* unsupported flag and retry.
|
2490
|
+
*/
|
2491
|
+
uv__file_symlink_usermode_flag = 0;
|
2492
|
+
fs__symlink(req);
|
2493
|
+
} else {
|
2494
|
+
SET_REQ_WIN32_ERROR(req, err);
|
2495
|
+
}
|
2496
|
+
}
|
2497
|
+
|
2498
|
+
|
2499
|
+
static void fs__readlink(uv_fs_t* req) {
|
2500
|
+
HANDLE handle;
|
2501
|
+
|
2502
|
+
handle = CreateFileW(req->file.pathw,
|
2503
|
+
0,
|
2504
|
+
0,
|
2505
|
+
NULL,
|
2506
|
+
OPEN_EXISTING,
|
2507
|
+
FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS,
|
2508
|
+
NULL);
|
2509
|
+
|
2510
|
+
if (handle == INVALID_HANDLE_VALUE) {
|
2511
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
2512
|
+
return;
|
2513
|
+
}
|
2514
|
+
|
2515
|
+
if (fs__readlink_handle(handle, (char**) &req->ptr, NULL) != 0) {
|
2516
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
2517
|
+
CloseHandle(handle);
|
2518
|
+
return;
|
2519
|
+
}
|
2520
|
+
|
2521
|
+
req->flags |= UV_FS_FREE_PTR;
|
2522
|
+
SET_REQ_RESULT(req, 0);
|
2523
|
+
|
2524
|
+
CloseHandle(handle);
|
2525
|
+
}
|
2526
|
+
|
2527
|
+
|
2528
|
+
static ssize_t fs__realpath_handle(HANDLE handle, char** realpath_ptr) {
|
2529
|
+
int r;
|
2530
|
+
DWORD w_realpath_len;
|
2531
|
+
WCHAR* w_realpath_ptr = NULL;
|
2532
|
+
WCHAR* w_realpath_buf;
|
2533
|
+
|
2534
|
+
w_realpath_len = GetFinalPathNameByHandleW(handle, NULL, 0, VOLUME_NAME_DOS);
|
2535
|
+
if (w_realpath_len == 0) {
|
2536
|
+
return -1;
|
2537
|
+
}
|
2538
|
+
|
2539
|
+
w_realpath_buf = uv__malloc((w_realpath_len + 1) * sizeof(WCHAR));
|
2540
|
+
if (w_realpath_buf == NULL) {
|
2541
|
+
SetLastError(ERROR_OUTOFMEMORY);
|
2542
|
+
return -1;
|
2543
|
+
}
|
2544
|
+
w_realpath_ptr = w_realpath_buf;
|
2545
|
+
|
2546
|
+
if (GetFinalPathNameByHandleW(
|
2547
|
+
handle, w_realpath_ptr, w_realpath_len, VOLUME_NAME_DOS) == 0) {
|
2548
|
+
uv__free(w_realpath_buf);
|
2549
|
+
SetLastError(ERROR_INVALID_HANDLE);
|
2550
|
+
return -1;
|
2551
|
+
}
|
2552
|
+
|
2553
|
+
/* convert UNC path to long path */
|
2554
|
+
if (wcsncmp(w_realpath_ptr,
|
2555
|
+
UNC_PATH_PREFIX,
|
2556
|
+
UNC_PATH_PREFIX_LEN) == 0) {
|
2557
|
+
w_realpath_ptr += 6;
|
2558
|
+
*w_realpath_ptr = L'\\';
|
2559
|
+
w_realpath_len -= 6;
|
2560
|
+
} else if (wcsncmp(w_realpath_ptr,
|
2561
|
+
LONG_PATH_PREFIX,
|
2562
|
+
LONG_PATH_PREFIX_LEN) == 0) {
|
2563
|
+
w_realpath_ptr += 4;
|
2564
|
+
w_realpath_len -= 4;
|
2565
|
+
} else {
|
2566
|
+
uv__free(w_realpath_buf);
|
2567
|
+
SetLastError(ERROR_INVALID_HANDLE);
|
2568
|
+
return -1;
|
2569
|
+
}
|
2570
|
+
|
2571
|
+
r = fs__wide_to_utf8(w_realpath_ptr, w_realpath_len, realpath_ptr, NULL);
|
2572
|
+
uv__free(w_realpath_buf);
|
2573
|
+
return r;
|
2574
|
+
}
|
2575
|
+
|
2576
|
+
static void fs__realpath(uv_fs_t* req) {
|
2577
|
+
HANDLE handle;
|
2578
|
+
|
2579
|
+
handle = CreateFileW(req->file.pathw,
|
2580
|
+
0,
|
2581
|
+
0,
|
2582
|
+
NULL,
|
2583
|
+
OPEN_EXISTING,
|
2584
|
+
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS,
|
2585
|
+
NULL);
|
2586
|
+
if (handle == INVALID_HANDLE_VALUE) {
|
2587
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
2588
|
+
return;
|
2589
|
+
}
|
2590
|
+
|
2591
|
+
if (fs__realpath_handle(handle, (char**) &req->ptr) == -1) {
|
2592
|
+
CloseHandle(handle);
|
2593
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
2594
|
+
return;
|
2595
|
+
}
|
2596
|
+
|
2597
|
+
CloseHandle(handle);
|
2598
|
+
req->flags |= UV_FS_FREE_PTR;
|
2599
|
+
SET_REQ_RESULT(req, 0);
|
2600
|
+
}
|
2601
|
+
|
2602
|
+
|
2603
|
+
static void fs__chown(uv_fs_t* req) {
|
2604
|
+
req->result = 0;
|
2605
|
+
}
|
2606
|
+
|
2607
|
+
|
2608
|
+
static void fs__fchown(uv_fs_t* req) {
|
2609
|
+
req->result = 0;
|
2610
|
+
}
|
2611
|
+
|
2612
|
+
|
2613
|
+
static void fs__lchown(uv_fs_t* req) {
|
2614
|
+
req->result = 0;
|
2615
|
+
}
|
2616
|
+
|
2617
|
+
|
2618
|
+
static void fs__statfs(uv_fs_t* req) {
|
2619
|
+
uv_statfs_t* stat_fs;
|
2620
|
+
DWORD sectors_per_cluster;
|
2621
|
+
DWORD bytes_per_sector;
|
2622
|
+
DWORD free_clusters;
|
2623
|
+
DWORD total_clusters;
|
2624
|
+
|
2625
|
+
if (0 == GetDiskFreeSpaceW(req->file.pathw,
|
2626
|
+
§ors_per_cluster,
|
2627
|
+
&bytes_per_sector,
|
2628
|
+
&free_clusters,
|
2629
|
+
&total_clusters)) {
|
2630
|
+
SET_REQ_WIN32_ERROR(req, GetLastError());
|
2631
|
+
return;
|
2632
|
+
}
|
2633
|
+
|
2634
|
+
stat_fs = uv__malloc(sizeof(*stat_fs));
|
2635
|
+
if (stat_fs == NULL) {
|
2636
|
+
SET_REQ_UV_ERROR(req, UV_ENOMEM, ERROR_OUTOFMEMORY);
|
2637
|
+
return;
|
2638
|
+
}
|
2639
|
+
|
2640
|
+
stat_fs->f_type = 0;
|
2641
|
+
stat_fs->f_bsize = bytes_per_sector * sectors_per_cluster;
|
2642
|
+
stat_fs->f_blocks = total_clusters;
|
2643
|
+
stat_fs->f_bfree = free_clusters;
|
2644
|
+
stat_fs->f_bavail = free_clusters;
|
2645
|
+
stat_fs->f_files = 0;
|
2646
|
+
stat_fs->f_ffree = 0;
|
2647
|
+
req->ptr = stat_fs;
|
2648
|
+
req->flags |= UV_FS_FREE_PTR;
|
2649
|
+
SET_REQ_RESULT(req, 0);
|
2650
|
+
}
|
2651
|
+
|
2652
|
+
|
2653
|
+
static void uv__fs_work(struct uv__work* w) {
|
2654
|
+
uv_fs_t* req;
|
2655
|
+
|
2656
|
+
req = container_of(w, uv_fs_t, work_req);
|
2657
|
+
assert(req->type == UV_FS);
|
2658
|
+
|
2659
|
+
#define XX(uc, lc) case UV_FS_##uc: fs__##lc(req); break;
|
2660
|
+
switch (req->fs_type) {
|
2661
|
+
XX(OPEN, open)
|
2662
|
+
XX(CLOSE, close)
|
2663
|
+
XX(READ, read)
|
2664
|
+
XX(WRITE, write)
|
2665
|
+
XX(COPYFILE, copyfile)
|
2666
|
+
XX(SENDFILE, sendfile)
|
2667
|
+
XX(STAT, stat)
|
2668
|
+
XX(LSTAT, lstat)
|
2669
|
+
XX(FSTAT, fstat)
|
2670
|
+
XX(FTRUNCATE, ftruncate)
|
2671
|
+
XX(UTIME, utime)
|
2672
|
+
XX(FUTIME, futime)
|
2673
|
+
XX(ACCESS, access)
|
2674
|
+
XX(CHMOD, chmod)
|
2675
|
+
XX(FCHMOD, fchmod)
|
2676
|
+
XX(FSYNC, fsync)
|
2677
|
+
XX(FDATASYNC, fdatasync)
|
2678
|
+
XX(UNLINK, unlink)
|
2679
|
+
XX(RMDIR, rmdir)
|
2680
|
+
XX(MKDIR, mkdir)
|
2681
|
+
XX(MKDTEMP, mkdtemp)
|
2682
|
+
XX(MKSTEMP, mkstemp)
|
2683
|
+
XX(RENAME, rename)
|
2684
|
+
XX(SCANDIR, scandir)
|
2685
|
+
XX(READDIR, readdir)
|
2686
|
+
XX(OPENDIR, opendir)
|
2687
|
+
XX(CLOSEDIR, closedir)
|
2688
|
+
XX(LINK, link)
|
2689
|
+
XX(SYMLINK, symlink)
|
2690
|
+
XX(READLINK, readlink)
|
2691
|
+
XX(REALPATH, realpath)
|
2692
|
+
XX(CHOWN, chown)
|
2693
|
+
XX(FCHOWN, fchown)
|
2694
|
+
XX(LCHOWN, lchown)
|
2695
|
+
XX(STATFS, statfs)
|
2696
|
+
default:
|
2697
|
+
assert(!"bad uv_fs_type");
|
2698
|
+
}
|
2699
|
+
}
|
2700
|
+
|
2701
|
+
|
2702
|
+
static void uv__fs_done(struct uv__work* w, int status) {
|
2703
|
+
uv_fs_t* req;
|
2704
|
+
|
2705
|
+
req = container_of(w, uv_fs_t, work_req);
|
2706
|
+
uv__req_unregister(req->loop, req);
|
2707
|
+
|
2708
|
+
if (status == UV_ECANCELED) {
|
2709
|
+
assert(req->result == 0);
|
2710
|
+
req->result = UV_ECANCELED;
|
2711
|
+
}
|
2712
|
+
|
2713
|
+
req->cb(req);
|
2714
|
+
}
|
2715
|
+
|
2716
|
+
|
2717
|
+
void uv_fs_req_cleanup(uv_fs_t* req) {
|
2718
|
+
if (req == NULL)
|
2719
|
+
return;
|
2720
|
+
|
2721
|
+
if (req->flags & UV_FS_CLEANEDUP)
|
2722
|
+
return;
|
2723
|
+
|
2724
|
+
if (req->flags & UV_FS_FREE_PATHS)
|
2725
|
+
uv__free(req->file.pathw);
|
2726
|
+
|
2727
|
+
if (req->flags & UV_FS_FREE_PTR) {
|
2728
|
+
if (req->fs_type == UV_FS_SCANDIR && req->ptr != NULL)
|
2729
|
+
uv__fs_scandir_cleanup(req);
|
2730
|
+
else if (req->fs_type == UV_FS_READDIR)
|
2731
|
+
uv__fs_readdir_cleanup(req);
|
2732
|
+
else
|
2733
|
+
uv__free(req->ptr);
|
2734
|
+
}
|
2735
|
+
|
2736
|
+
if (req->fs.info.bufs != req->fs.info.bufsml)
|
2737
|
+
uv__free(req->fs.info.bufs);
|
2738
|
+
|
2739
|
+
req->path = NULL;
|
2740
|
+
req->file.pathw = NULL;
|
2741
|
+
req->fs.info.new_pathw = NULL;
|
2742
|
+
req->fs.info.bufs = NULL;
|
2743
|
+
req->ptr = NULL;
|
2744
|
+
|
2745
|
+
req->flags |= UV_FS_CLEANEDUP;
|
2746
|
+
}
|
2747
|
+
|
2748
|
+
|
2749
|
+
int uv_fs_open(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags,
|
2750
|
+
int mode, uv_fs_cb cb) {
|
2751
|
+
int err;
|
2752
|
+
|
2753
|
+
INIT(UV_FS_OPEN);
|
2754
|
+
err = fs__capture_path(req, path, NULL, cb != NULL);
|
2755
|
+
if (err) {
|
2756
|
+
return uv_translate_sys_error(err);
|
2757
|
+
}
|
2758
|
+
|
2759
|
+
req->fs.info.file_flags = flags;
|
2760
|
+
req->fs.info.mode = mode;
|
2761
|
+
POST;
|
2762
|
+
}
|
2763
|
+
|
2764
|
+
|
2765
|
+
int uv_fs_close(uv_loop_t* loop, uv_fs_t* req, uv_file fd, uv_fs_cb cb) {
|
2766
|
+
INIT(UV_FS_CLOSE);
|
2767
|
+
req->file.fd = fd;
|
2768
|
+
POST;
|
2769
|
+
}
|
2770
|
+
|
2771
|
+
|
2772
|
+
int uv_fs_read(uv_loop_t* loop,
|
2773
|
+
uv_fs_t* req,
|
2774
|
+
uv_file fd,
|
2775
|
+
const uv_buf_t bufs[],
|
2776
|
+
unsigned int nbufs,
|
2777
|
+
int64_t offset,
|
2778
|
+
uv_fs_cb cb) {
|
2779
|
+
INIT(UV_FS_READ);
|
2780
|
+
|
2781
|
+
if (bufs == NULL || nbufs == 0)
|
2782
|
+
return UV_EINVAL;
|
2783
|
+
|
2784
|
+
req->file.fd = fd;
|
2785
|
+
|
2786
|
+
req->fs.info.nbufs = nbufs;
|
2787
|
+
req->fs.info.bufs = req->fs.info.bufsml;
|
2788
|
+
if (nbufs > ARRAY_SIZE(req->fs.info.bufsml))
|
2789
|
+
req->fs.info.bufs = uv__malloc(nbufs * sizeof(*bufs));
|
2790
|
+
|
2791
|
+
if (req->fs.info.bufs == NULL)
|
2792
|
+
return UV_ENOMEM;
|
2793
|
+
|
2794
|
+
memcpy(req->fs.info.bufs, bufs, nbufs * sizeof(*bufs));
|
2795
|
+
|
2796
|
+
req->fs.info.offset = offset;
|
2797
|
+
POST;
|
2798
|
+
}
|
2799
|
+
|
2800
|
+
|
2801
|
+
int uv_fs_write(uv_loop_t* loop,
|
2802
|
+
uv_fs_t* req,
|
2803
|
+
uv_file fd,
|
2804
|
+
const uv_buf_t bufs[],
|
2805
|
+
unsigned int nbufs,
|
2806
|
+
int64_t offset,
|
2807
|
+
uv_fs_cb cb) {
|
2808
|
+
INIT(UV_FS_WRITE);
|
2809
|
+
|
2810
|
+
if (bufs == NULL || nbufs == 0)
|
2811
|
+
return UV_EINVAL;
|
2812
|
+
|
2813
|
+
req->file.fd = fd;
|
2814
|
+
|
2815
|
+
req->fs.info.nbufs = nbufs;
|
2816
|
+
req->fs.info.bufs = req->fs.info.bufsml;
|
2817
|
+
if (nbufs > ARRAY_SIZE(req->fs.info.bufsml))
|
2818
|
+
req->fs.info.bufs = uv__malloc(nbufs * sizeof(*bufs));
|
2819
|
+
|
2820
|
+
if (req->fs.info.bufs == NULL)
|
2821
|
+
return UV_ENOMEM;
|
2822
|
+
|
2823
|
+
memcpy(req->fs.info.bufs, bufs, nbufs * sizeof(*bufs));
|
2824
|
+
|
2825
|
+
req->fs.info.offset = offset;
|
2826
|
+
POST;
|
2827
|
+
}
|
2828
|
+
|
2829
|
+
|
2830
|
+
int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
2831
|
+
uv_fs_cb cb) {
|
2832
|
+
int err;
|
2833
|
+
|
2834
|
+
INIT(UV_FS_UNLINK);
|
2835
|
+
err = fs__capture_path(req, path, NULL, cb != NULL);
|
2836
|
+
if (err) {
|
2837
|
+
return uv_translate_sys_error(err);
|
2838
|
+
}
|
2839
|
+
|
2840
|
+
POST;
|
2841
|
+
}
|
2842
|
+
|
2843
|
+
|
2844
|
+
int uv_fs_mkdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode,
|
2845
|
+
uv_fs_cb cb) {
|
2846
|
+
int err;
|
2847
|
+
|
2848
|
+
INIT(UV_FS_MKDIR);
|
2849
|
+
err = fs__capture_path(req, path, NULL, cb != NULL);
|
2850
|
+
if (err) {
|
2851
|
+
return uv_translate_sys_error(err);
|
2852
|
+
}
|
2853
|
+
|
2854
|
+
req->fs.info.mode = mode;
|
2855
|
+
POST;
|
2856
|
+
}
|
2857
|
+
|
2858
|
+
|
2859
|
+
int uv_fs_mkdtemp(uv_loop_t* loop,
|
2860
|
+
uv_fs_t* req,
|
2861
|
+
const char* tpl,
|
2862
|
+
uv_fs_cb cb) {
|
2863
|
+
int err;
|
2864
|
+
|
2865
|
+
INIT(UV_FS_MKDTEMP);
|
2866
|
+
err = fs__capture_path(req, tpl, NULL, TRUE);
|
2867
|
+
if (err)
|
2868
|
+
return uv_translate_sys_error(err);
|
2869
|
+
|
2870
|
+
POST;
|
2871
|
+
}
|
2872
|
+
|
2873
|
+
|
2874
|
+
int uv_fs_mkstemp(uv_loop_t* loop,
|
2875
|
+
uv_fs_t* req,
|
2876
|
+
const char* tpl,
|
2877
|
+
uv_fs_cb cb) {
|
2878
|
+
int err;
|
2879
|
+
|
2880
|
+
INIT(UV_FS_MKSTEMP);
|
2881
|
+
err = fs__capture_path(req, tpl, NULL, TRUE);
|
2882
|
+
if (err)
|
2883
|
+
return uv_translate_sys_error(err);
|
2884
|
+
|
2885
|
+
POST;
|
2886
|
+
}
|
2887
|
+
|
2888
|
+
|
2889
|
+
int uv_fs_rmdir(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
|
2890
|
+
int err;
|
2891
|
+
|
2892
|
+
INIT(UV_FS_RMDIR);
|
2893
|
+
err = fs__capture_path(req, path, NULL, cb != NULL);
|
2894
|
+
if (err) {
|
2895
|
+
return uv_translate_sys_error(err);
|
2896
|
+
}
|
2897
|
+
|
2898
|
+
POST;
|
2899
|
+
}
|
2900
|
+
|
2901
|
+
|
2902
|
+
int uv_fs_scandir(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags,
|
2903
|
+
uv_fs_cb cb) {
|
2904
|
+
int err;
|
2905
|
+
|
2906
|
+
INIT(UV_FS_SCANDIR);
|
2907
|
+
err = fs__capture_path(req, path, NULL, cb != NULL);
|
2908
|
+
if (err) {
|
2909
|
+
return uv_translate_sys_error(err);
|
2910
|
+
}
|
2911
|
+
|
2912
|
+
req->fs.info.file_flags = flags;
|
2913
|
+
POST;
|
2914
|
+
}
|
2915
|
+
|
2916
|
+
int uv_fs_opendir(uv_loop_t* loop,
|
2917
|
+
uv_fs_t* req,
|
2918
|
+
const char* path,
|
2919
|
+
uv_fs_cb cb) {
|
2920
|
+
int err;
|
2921
|
+
|
2922
|
+
INIT(UV_FS_OPENDIR);
|
2923
|
+
err = fs__capture_path(req, path, NULL, cb != NULL);
|
2924
|
+
if (err)
|
2925
|
+
return uv_translate_sys_error(err);
|
2926
|
+
POST;
|
2927
|
+
}
|
2928
|
+
|
2929
|
+
int uv_fs_readdir(uv_loop_t* loop,
|
2930
|
+
uv_fs_t* req,
|
2931
|
+
uv_dir_t* dir,
|
2932
|
+
uv_fs_cb cb) {
|
2933
|
+
INIT(UV_FS_READDIR);
|
2934
|
+
|
2935
|
+
if (dir == NULL ||
|
2936
|
+
dir->dirents == NULL ||
|
2937
|
+
dir->dir_handle == INVALID_HANDLE_VALUE) {
|
2938
|
+
return UV_EINVAL;
|
2939
|
+
}
|
2940
|
+
|
2941
|
+
req->ptr = dir;
|
2942
|
+
POST;
|
2943
|
+
}
|
2944
|
+
|
2945
|
+
int uv_fs_closedir(uv_loop_t* loop,
|
2946
|
+
uv_fs_t* req,
|
2947
|
+
uv_dir_t* dir,
|
2948
|
+
uv_fs_cb cb) {
|
2949
|
+
INIT(UV_FS_CLOSEDIR);
|
2950
|
+
if (dir == NULL)
|
2951
|
+
return UV_EINVAL;
|
2952
|
+
req->ptr = dir;
|
2953
|
+
POST;
|
2954
|
+
}
|
2955
|
+
|
2956
|
+
int uv_fs_link(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
2957
|
+
const char* new_path, uv_fs_cb cb) {
|
2958
|
+
int err;
|
2959
|
+
|
2960
|
+
INIT(UV_FS_LINK);
|
2961
|
+
err = fs__capture_path(req, path, new_path, cb != NULL);
|
2962
|
+
if (err) {
|
2963
|
+
return uv_translate_sys_error(err);
|
2964
|
+
}
|
2965
|
+
|
2966
|
+
POST;
|
2967
|
+
}
|
2968
|
+
|
2969
|
+
|
2970
|
+
int uv_fs_symlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
2971
|
+
const char* new_path, int flags, uv_fs_cb cb) {
|
2972
|
+
int err;
|
2973
|
+
|
2974
|
+
INIT(UV_FS_SYMLINK);
|
2975
|
+
err = fs__capture_path(req, path, new_path, cb != NULL);
|
2976
|
+
if (err) {
|
2977
|
+
return uv_translate_sys_error(err);
|
2978
|
+
}
|
2979
|
+
|
2980
|
+
req->fs.info.file_flags = flags;
|
2981
|
+
POST;
|
2982
|
+
}
|
2983
|
+
|
2984
|
+
|
2985
|
+
int uv_fs_readlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
2986
|
+
uv_fs_cb cb) {
|
2987
|
+
int err;
|
2988
|
+
|
2989
|
+
INIT(UV_FS_READLINK);
|
2990
|
+
err = fs__capture_path(req, path, NULL, cb != NULL);
|
2991
|
+
if (err) {
|
2992
|
+
return uv_translate_sys_error(err);
|
2993
|
+
}
|
2994
|
+
|
2995
|
+
POST;
|
2996
|
+
}
|
2997
|
+
|
2998
|
+
|
2999
|
+
int uv_fs_realpath(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
3000
|
+
uv_fs_cb cb) {
|
3001
|
+
int err;
|
3002
|
+
|
3003
|
+
INIT(UV_FS_REALPATH);
|
3004
|
+
|
3005
|
+
if (!path) {
|
3006
|
+
return UV_EINVAL;
|
3007
|
+
}
|
3008
|
+
|
3009
|
+
err = fs__capture_path(req, path, NULL, cb != NULL);
|
3010
|
+
if (err) {
|
3011
|
+
return uv_translate_sys_error(err);
|
3012
|
+
}
|
3013
|
+
|
3014
|
+
POST;
|
3015
|
+
}
|
3016
|
+
|
3017
|
+
|
3018
|
+
int uv_fs_chown(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_uid_t uid,
|
3019
|
+
uv_gid_t gid, uv_fs_cb cb) {
|
3020
|
+
int err;
|
3021
|
+
|
3022
|
+
INIT(UV_FS_CHOWN);
|
3023
|
+
err = fs__capture_path(req, path, NULL, cb != NULL);
|
3024
|
+
if (err) {
|
3025
|
+
return uv_translate_sys_error(err);
|
3026
|
+
}
|
3027
|
+
|
3028
|
+
POST;
|
3029
|
+
}
|
3030
|
+
|
3031
|
+
|
3032
|
+
int uv_fs_fchown(uv_loop_t* loop, uv_fs_t* req, uv_file fd, uv_uid_t uid,
|
3033
|
+
uv_gid_t gid, uv_fs_cb cb) {
|
3034
|
+
INIT(UV_FS_FCHOWN);
|
3035
|
+
POST;
|
3036
|
+
}
|
3037
|
+
|
3038
|
+
|
3039
|
+
int uv_fs_lchown(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_uid_t uid,
|
3040
|
+
uv_gid_t gid, uv_fs_cb cb) {
|
3041
|
+
int err;
|
3042
|
+
|
3043
|
+
INIT(UV_FS_LCHOWN);
|
3044
|
+
err = fs__capture_path(req, path, NULL, cb != NULL);
|
3045
|
+
if (err) {
|
3046
|
+
return uv_translate_sys_error(err);
|
3047
|
+
}
|
3048
|
+
POST;
|
3049
|
+
}
|
3050
|
+
|
3051
|
+
|
3052
|
+
int uv_fs_stat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
|
3053
|
+
int err;
|
3054
|
+
|
3055
|
+
INIT(UV_FS_STAT);
|
3056
|
+
err = fs__capture_path(req, path, NULL, cb != NULL);
|
3057
|
+
if (err) {
|
3058
|
+
return uv_translate_sys_error(err);
|
3059
|
+
}
|
3060
|
+
|
3061
|
+
POST;
|
3062
|
+
}
|
3063
|
+
|
3064
|
+
|
3065
|
+
int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
|
3066
|
+
int err;
|
3067
|
+
|
3068
|
+
INIT(UV_FS_LSTAT);
|
3069
|
+
err = fs__capture_path(req, path, NULL, cb != NULL);
|
3070
|
+
if (err) {
|
3071
|
+
return uv_translate_sys_error(err);
|
3072
|
+
}
|
3073
|
+
|
3074
|
+
POST;
|
3075
|
+
}
|
3076
|
+
|
3077
|
+
|
3078
|
+
int uv_fs_fstat(uv_loop_t* loop, uv_fs_t* req, uv_file fd, uv_fs_cb cb) {
|
3079
|
+
INIT(UV_FS_FSTAT);
|
3080
|
+
req->file.fd = fd;
|
3081
|
+
POST;
|
3082
|
+
}
|
3083
|
+
|
3084
|
+
|
3085
|
+
int uv_fs_rename(uv_loop_t* loop, uv_fs_t* req, const char* path,
|
3086
|
+
const char* new_path, uv_fs_cb cb) {
|
3087
|
+
int err;
|
3088
|
+
|
3089
|
+
INIT(UV_FS_RENAME);
|
3090
|
+
err = fs__capture_path(req, path, new_path, cb != NULL);
|
3091
|
+
if (err) {
|
3092
|
+
return uv_translate_sys_error(err);
|
3093
|
+
}
|
3094
|
+
|
3095
|
+
POST;
|
3096
|
+
}
|
3097
|
+
|
3098
|
+
|
3099
|
+
int uv_fs_fsync(uv_loop_t* loop, uv_fs_t* req, uv_file fd, uv_fs_cb cb) {
|
3100
|
+
INIT(UV_FS_FSYNC);
|
3101
|
+
req->file.fd = fd;
|
3102
|
+
POST;
|
3103
|
+
}
|
3104
|
+
|
3105
|
+
|
3106
|
+
int uv_fs_fdatasync(uv_loop_t* loop, uv_fs_t* req, uv_file fd, uv_fs_cb cb) {
|
3107
|
+
INIT(UV_FS_FDATASYNC);
|
3108
|
+
req->file.fd = fd;
|
3109
|
+
POST;
|
3110
|
+
}
|
3111
|
+
|
3112
|
+
|
3113
|
+
int uv_fs_ftruncate(uv_loop_t* loop, uv_fs_t* req, uv_file fd,
|
3114
|
+
int64_t offset, uv_fs_cb cb) {
|
3115
|
+
INIT(UV_FS_FTRUNCATE);
|
3116
|
+
req->file.fd = fd;
|
3117
|
+
req->fs.info.offset = offset;
|
3118
|
+
POST;
|
3119
|
+
}
|
3120
|
+
|
3121
|
+
|
3122
|
+
int uv_fs_copyfile(uv_loop_t* loop,
|
3123
|
+
uv_fs_t* req,
|
3124
|
+
const char* path,
|
3125
|
+
const char* new_path,
|
3126
|
+
int flags,
|
3127
|
+
uv_fs_cb cb) {
|
3128
|
+
int err;
|
3129
|
+
|
3130
|
+
INIT(UV_FS_COPYFILE);
|
3131
|
+
|
3132
|
+
if (flags & ~(UV_FS_COPYFILE_EXCL |
|
3133
|
+
UV_FS_COPYFILE_FICLONE |
|
3134
|
+
UV_FS_COPYFILE_FICLONE_FORCE)) {
|
3135
|
+
return UV_EINVAL;
|
3136
|
+
}
|
3137
|
+
|
3138
|
+
err = fs__capture_path(req, path, new_path, cb != NULL);
|
3139
|
+
|
3140
|
+
if (err)
|
3141
|
+
return uv_translate_sys_error(err);
|
3142
|
+
|
3143
|
+
req->fs.info.file_flags = flags;
|
3144
|
+
POST;
|
3145
|
+
}
|
3146
|
+
|
3147
|
+
|
3148
|
+
int uv_fs_sendfile(uv_loop_t* loop, uv_fs_t* req, uv_file fd_out,
|
3149
|
+
uv_file fd_in, int64_t in_offset, size_t length, uv_fs_cb cb) {
|
3150
|
+
INIT(UV_FS_SENDFILE);
|
3151
|
+
req->file.fd = fd_in;
|
3152
|
+
req->fs.info.fd_out = fd_out;
|
3153
|
+
req->fs.info.offset = in_offset;
|
3154
|
+
req->fs.info.bufsml[0].len = length;
|
3155
|
+
POST;
|
3156
|
+
}
|
3157
|
+
|
3158
|
+
|
3159
|
+
int uv_fs_access(uv_loop_t* loop,
|
3160
|
+
uv_fs_t* req,
|
3161
|
+
const char* path,
|
3162
|
+
int flags,
|
3163
|
+
uv_fs_cb cb) {
|
3164
|
+
int err;
|
3165
|
+
|
3166
|
+
INIT(UV_FS_ACCESS);
|
3167
|
+
err = fs__capture_path(req, path, NULL, cb != NULL);
|
3168
|
+
if (err)
|
3169
|
+
return uv_translate_sys_error(err);
|
3170
|
+
|
3171
|
+
req->fs.info.mode = flags;
|
3172
|
+
POST;
|
3173
|
+
}
|
3174
|
+
|
3175
|
+
|
3176
|
+
int uv_fs_chmod(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode,
|
3177
|
+
uv_fs_cb cb) {
|
3178
|
+
int err;
|
3179
|
+
|
3180
|
+
INIT(UV_FS_CHMOD);
|
3181
|
+
err = fs__capture_path(req, path, NULL, cb != NULL);
|
3182
|
+
if (err) {
|
3183
|
+
return uv_translate_sys_error(err);
|
3184
|
+
}
|
3185
|
+
|
3186
|
+
req->fs.info.mode = mode;
|
3187
|
+
POST;
|
3188
|
+
}
|
3189
|
+
|
3190
|
+
|
3191
|
+
int uv_fs_fchmod(uv_loop_t* loop, uv_fs_t* req, uv_file fd, int mode,
|
3192
|
+
uv_fs_cb cb) {
|
3193
|
+
INIT(UV_FS_FCHMOD);
|
3194
|
+
req->file.fd = fd;
|
3195
|
+
req->fs.info.mode = mode;
|
3196
|
+
POST;
|
3197
|
+
}
|
3198
|
+
|
3199
|
+
|
3200
|
+
int uv_fs_utime(uv_loop_t* loop, uv_fs_t* req, const char* path, double atime,
|
3201
|
+
double mtime, uv_fs_cb cb) {
|
3202
|
+
int err;
|
3203
|
+
|
3204
|
+
INIT(UV_FS_UTIME);
|
3205
|
+
err = fs__capture_path(req, path, NULL, cb != NULL);
|
3206
|
+
if (err) {
|
3207
|
+
return uv_translate_sys_error(err);
|
3208
|
+
}
|
3209
|
+
|
3210
|
+
req->fs.time.atime = atime;
|
3211
|
+
req->fs.time.mtime = mtime;
|
3212
|
+
POST;
|
3213
|
+
}
|
3214
|
+
|
3215
|
+
|
3216
|
+
int uv_fs_futime(uv_loop_t* loop, uv_fs_t* req, uv_file fd, double atime,
|
3217
|
+
double mtime, uv_fs_cb cb) {
|
3218
|
+
INIT(UV_FS_FUTIME);
|
3219
|
+
req->file.fd = fd;
|
3220
|
+
req->fs.time.atime = atime;
|
3221
|
+
req->fs.time.mtime = mtime;
|
3222
|
+
POST;
|
3223
|
+
}
|
3224
|
+
|
3225
|
+
|
3226
|
+
int uv_fs_statfs(uv_loop_t* loop,
|
3227
|
+
uv_fs_t* req,
|
3228
|
+
const char* path,
|
3229
|
+
uv_fs_cb cb) {
|
3230
|
+
int err;
|
3231
|
+
|
3232
|
+
INIT(UV_FS_STATFS);
|
3233
|
+
err = fs__capture_path(req, path, NULL, cb != NULL);
|
3234
|
+
if (err)
|
3235
|
+
return uv_translate_sys_error(err);
|
3236
|
+
|
3237
|
+
POST;
|
3238
|
+
}
|