Skip to content
Browse files

Use new uv_fs_ apis

This will cause master to be unstable for a while as we replace existing eio
calls with uv_fs calls.
  • Loading branch information...
1 parent 1088638 commit bce41fac9458dd3dec844fc80c8144060e6a9f30 Igor Zinkovsky committed with ry
View
504 deps/pthread-win32/COPYING.LIB
@@ -1,504 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
View
BIN deps/pthread-win32/libpthreadGC2.a
Binary file not shown.
View
BIN deps/pthread-win32/libpthreadGC2d.a
Binary file not shown.
View
9 node.gyp
@@ -72,12 +72,9 @@
'src/req_wrap.h',
'src/stream_wrap.h',
'src/v8_typed_array.h',
- 'deps/uv/src/eio/ecb.h',
- 'deps/uv/include/eio.h',
'deps/http_parser/http_parser.h',
'deps/v8/include/v8.h',
'deps/v8/include/v8-debug.h',
- 'deps/uv/src/eio/xthread.h',
'<(SHARED_INTERMEDIATE_DIR)/node_natives.h',
],
@@ -104,19 +101,13 @@
}],
[ 'OS=="win"', {
- 'dependencies': [
- 'deps/uv/deps/pthread-win32/pthread-win32.gyp:pthread-win32',
- ],
'sources': [
'src/platform_win32.cc',
'src/node_stdio_win32.cc',
- # file operations depend on eio to link. uv contains eio in unix builds, but not win32. So we need to compile it here instead.
- 'deps/uv/src/eio/eio.c',
# headers to make for a more pleasant IDE experience
'src/platform_win32.h',
],
'defines': [
- 'PTW32_STATIC_LIB',
'FD_SETSIZE=1024',
# we need to use node's preferred "win32" rather than gyp's preferred "win"
'PLATFORM="win32"',
View
77 src/node.cc
@@ -141,10 +141,6 @@ static uv_idle_t tick_spinner;
static bool need_tick_cb;
static Persistent<String> tick_callback_sym;
-static uv_async_t eio_want_poll_notifier;
-static uv_async_t eio_done_poll_notifier;
-static uv_idle_t eio_poller;
-
static bool use_uv = true;
@@ -306,62 +302,6 @@ static void CheckTick(uv_check_t* handle, int status) {
Tick();
}
-
-static void DoPoll(uv_idle_t* watcher, int status) {
- assert(watcher == &eio_poller);
-
- //printf("eio_poller\n");
-
- if (eio_poll() != -1 && uv_is_active((uv_handle_t*) &eio_poller)) {
- //printf("eio_poller stop\n");
- uv_idle_stop(&eio_poller);
- uv_unref();
- }
-}
-
-
-// Called from the main thread.
-static void WantPollNotifier(uv_async_t* watcher, int status) {
- assert(watcher == &eio_want_poll_notifier);
-
- //printf("want poll notifier\n");
-
- if (eio_poll() == -1 && !uv_is_active((uv_handle_t*) &eio_poller)) {
- //printf("eio_poller start\n");
- uv_idle_start(&eio_poller, node::DoPoll);
- uv_ref();
- }
-}
-
-
-static void DonePollNotifier(uv_async_t* watcher, int revents) {
- assert(watcher == &eio_done_poll_notifier);
-
- //printf("done poll notifier\n");
-
- if (eio_poll() != -1 && uv_is_active((uv_handle_t*) &eio_poller)) {
- //printf("eio_poller stop\n");
- uv_idle_stop(&eio_poller);
- uv_unref();
- }
-}
-
-
-// EIOWantPoll() is called from the EIO thread pool each time an EIO
-// request (that is, one of the node.fs.* functions) has completed.
-static void EIOWantPoll(void) {
- // Signal the main thread that eio_poll need to be processed.
- uv_async_send(&eio_want_poll_notifier);
-}
-
-
-static void EIODonePoll(void) {
- // Signal the main thread that we should stop calling eio_poll().
- // from the idle watcher.
- uv_async_send(&eio_done_poll_notifier);
-}
-
-
static inline const char *errno_string(int errorno) {
#define ERRNO_CASE(e) case e: return #e;
switch (errorno) {
@@ -2517,23 +2457,6 @@ char** Init(int argc, char *argv[]) {
uv_timer_init(&node::gc_timer);
uv_unref();
- // Setup the EIO thread pool. It requires 3, yes 3, watchers.
- {
- uv_idle_init(&node::eio_poller);
- uv_idle_start(&eio_poller, node::DoPoll);
-
- uv_async_init(&node::eio_want_poll_notifier, node::WantPollNotifier);
- uv_unref();
-
- uv_async_init(&node::eio_done_poll_notifier, node::DonePollNotifier);
- uv_unref();
-
- eio_init(node::EIOWantPoll, node::EIODonePoll);
- // Don't handle more than 10 reqs on each eio_poll(). This is to avoid
- // race conditions. See test/simple/test-eio-race.js
- eio_set_max_poll_reqs(10);
- }
-
V8::SetFatalErrorHandler(node::OnFatalError);
View
1 src/node.h
@@ -39,7 +39,6 @@
#endif
#include <uv.h>
-#include <eio.h>
#include <v8.h>
#include <sys/types.h> /* struct stat */
#include <sys/stat.h>
View
2 src/node_child_process.h
@@ -119,8 +119,6 @@ class ChildProcess : ObjectWrap {
#endif // __POSIX__
#ifdef __MINGW32__
- static int do_spawn(eio_req *req);
- static int after_spawn(eio_req *req);
static void watch(ChildProcess *child);
static void CALLBACK watch_wait_callback(void *data, BOOLEAN didTimeout);
static void notify_spawn_failure(ChildProcess *child);
View
17 src/node_crypto.cc
@@ -3770,7 +3770,7 @@ struct pbkdf2_req {
};
void
-EIO_PBKDF2(eio_req* req) {
+EIO_PBKDF2(uv_work_t* req) {
pbkdf2_req* request = (pbkdf2_req*)req->data;
request->err = PKCS5_PBKDF2_HMAC_SHA1(
request->pass,
@@ -3784,13 +3784,13 @@ EIO_PBKDF2(eio_req* req) {
memset(request->salt, 0, request->saltlen);
}
-int
-EIO_PBKDF2After(eio_req* req) {
+void
+EIO_PBKDF2After(uv_work_t* req) {
HandleScope scope;
- uv_unref();
-
pbkdf2_req* request = (pbkdf2_req*)req->data;
+ delete req;
+
Handle<Value> argv[2];
if (request->err) {
argv[0] = Undefined();
@@ -3814,8 +3814,6 @@ EIO_PBKDF2After(eio_req* req) {
request->callback.Dispose();
delete request;
-
- return 0;
}
Handle<Value>
@@ -3869,8 +3867,9 @@ PBKDF2(const Arguments& args) {
request->keylen = keylen;
request->callback = Persistent<Function>::New(callback);
- eio_custom(EIO_PBKDF2, EIO_PRI_DEFAULT, EIO_PBKDF2After, request);
- uv_ref();
+ uv_work_t* req = new uv_work_t();
+ uv_queue_work(req, EIO_PBKDF2, EIO_PBKDF2After);
+ req->data = request;
return Undefined();
}
View
359 src/node_file.cc
@@ -26,44 +26,19 @@
# include <node_stat_watcher.h>
#endif
+#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
-#if !defined(_MSC_VER)
-#include <sys/time.h>
-#include <dirent.h>
-#endif
-#include <fcntl.h>
-#include <stdlib.h>
-#if !defined(_MSC_VER)
-#include <unistd.h>
-#else
-#include <direct.h>
-#define chdir _chdir
-#define rmdir _rmdir
-#define mkdir _mkdir
-#include <io.h>
-#define ftruncate _chsize
-#endif
#include <assert.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
#if defined(__MINGW32__) || defined(_MSC_VER)
+# include <io.h>
# include <platform_win32.h>
#endif
-/* used for readlink, AIX doesn't provide it */
-#ifndef PATH_MAX
-#define PATH_MAX 4096
-#endif
-
-/* HACK to use pread/pwrite from eio because MINGW32 doesn't have it */
-/* TODO fixme */
-#if defined(__MINGW32__) || defined(_MSC_VER)
-# define pread eio__pread
-# define pwrite eio__pwrite
-#endif
namespace node {
@@ -77,14 +52,6 @@ static Persistent<String> encoding_symbol;
static Persistent<String> errno_symbol;
static Persistent<String> buf_symbol;
-// Buffer for readlink() and other misc callers; keep this scoped at
-// file-level rather than method-level to avoid excess stack usage.
-// Not used on windows atm
-#ifdef __POSIX__
- static char getbuf[PATH_MAX + 1];
-#endif
-
-
static inline bool SetCloseOnExec(int fd) {
#ifdef __POSIX__
return (fcntl(fd, F_SETFD, FD_CLOEXEC) != -1);
@@ -101,12 +68,11 @@ static inline int IsInt64(double x) {
#endif
-static int After(eio_req *req) {
+static void After(uv_fs_t *req) {
HandleScope scope;
Persistent<Function> *callback = cb_unwrap(req->data);
- uv_unref();
// there is always at least one argument. "error"
int argc = 1;
@@ -119,11 +85,12 @@ static int After(eio_req *req) {
// for a success, which is possible.
if (req->result == -1) {
// If the request doesn't have a path parameter set.
- if (!req->ptr1) {
+
+ // XXX if (!req->arg0) {
argv[0] = ErrnoException(req->errorno);
- } else {
- argv[0] = ErrnoException(req->errorno, NULL, "", static_cast<const char*>(req->ptr1));
- }
+ // XXX } else {
+ // XXX argv[0] = ErrnoException(req->errorno, NULL, "", static_cast<const char*>(req->arg0));
+ // XXX}
} else {
// error value is empty or null for non-error.
argv[0] = Local<Value>::New(Null());
@@ -131,63 +98,63 @@ static int After(eio_req *req) {
// All have at least two args now.
argc = 2;
- switch (req->type) {
+ switch (req->fs_type) {
// These all have no data to pass.
- case EIO_CLOSE:
- case EIO_RENAME:
- case EIO_UNLINK:
- case EIO_RMDIR:
- case EIO_MKDIR:
- case EIO_FTRUNCATE:
- case EIO_FSYNC:
- case EIO_FDATASYNC:
- case EIO_LINK:
- case EIO_SYMLINK:
- case EIO_CHMOD:
- case EIO_FCHMOD:
- case EIO_CHOWN:
- case EIO_FCHOWN:
+ case UV_FS_CLOSE:
+ case UV_FS_RENAME:
+ case UV_FS_UNLINK:
+ case UV_FS_RMDIR:
+ case UV_FS_MKDIR:
+ case UV_FS_FTRUNCATE:
+ case UV_FS_FSYNC:
+ case UV_FS_FDATASYNC:
+ case UV_FS_LINK:
+ case UV_FS_SYMLINK:
+ case UV_FS_CHMOD:
+ case UV_FS_FCHMOD:
+ case UV_FS_CHOWN:
+ case UV_FS_FCHOWN:
// These, however, don't.
argc = 1;
break;
- case EIO_UTIME:
- case EIO_FUTIME:
+ case UV_FS_UTIME:
+ case UV_FS_FUTIME:
argc = 0;
break;
- case EIO_OPEN:
+ case UV_FS_OPEN:
SetCloseOnExec(req->result);
/* pass thru */
- case EIO_SENDFILE:
+ case UV_FS_SENDFILE:
argv[1] = Integer::New(req->result);
break;
- case EIO_WRITE:
+ case UV_FS_WRITE:
argv[1] = Integer::New(req->result);
break;
- case EIO_STAT:
- case EIO_LSTAT:
- case EIO_FSTAT:
+ case UV_FS_STAT:
+ case UV_FS_LSTAT:
+ case UV_FS_FSTAT:
{
- NODE_STAT_STRUCT *s = reinterpret_cast<NODE_STAT_STRUCT*>(req->ptr2);
+ NODE_STAT_STRUCT *s = reinterpret_cast<NODE_STAT_STRUCT*>(req->ptr);
argv[1] = BuildStatsObject(s);
}
break;
- case EIO_READLINK:
- argv[1] = String::New(static_cast<char*>(req->ptr2), req->result);
+ case UV_FS_READLINK:
+ argv[1] = String::New(static_cast<char*>(req->ptr), req->result);
break;
- case EIO_READ:
+ case UV_FS_READ:
// Buffer interface
argv[1] = Integer::New(req->result);
break;
- case EIO_READDIR:
+ case UV_FS_READDIR:
{
- char *namebuf = static_cast<char*>(req->ptr2);
+ char *namebuf = static_cast<char*>(req->ptr);
int nnames = req->result;
Local<Array> names = Array::New(nnames);
@@ -221,16 +188,37 @@ static int After(eio_req *req) {
// Dispose of the persistent handle
cb_destroy(callback);
- return 0;
+ uv_fs_req_cleanup(req);
+ delete req;
}
+struct fs_req_wrap {
+ fs_req_wrap() {}
+ ~fs_req_wrap() { uv_fs_req_cleanup(&req); }
+ // Ensure that copy ctor and assignment operator are not used.
+ fs_req_wrap(const fs_req_wrap& req);
+ fs_req_wrap& operator=(const fs_req_wrap& req);
+ uv_fs_t req;
+};
+
#define ASYNC_CALL(func, callback, ...) \
- eio_req *req = eio_##func(__VA_ARGS__, EIO_PRI_DEFAULT, After, \
- cb_persist(callback)); \
- assert(req); \
- uv_ref(); \
+ uv_fs_t* req = new uv_fs_t(); \
+ int r = uv_fs_##func(req, __VA_ARGS__, After); \
+ assert(r == 0); \
+ req->data = cb_persist(callback); \
return Undefined();
+#define SYNC_CALL(func, path, ...) \
+ fs_req_wrap req_wrap; \
+ uv_fs_##func(&req_wrap.req, __VA_ARGS__, NULL); \
+ if (req_wrap.req.result == -1) { \
+ return ThrowException( \
+ ErrnoException(req_wrap.req.errorno, #func, "", path)); \
+ }
+
+#define SYNC_REQ req_wrap.req
+
+
static Handle<Value> Close(const Arguments& args) {
HandleScope scope;
@@ -243,8 +231,7 @@ static Handle<Value> Close(const Arguments& args) {
if (args[1]->IsFunction()) {
ASYNC_CALL(close, args[1], fd)
} else {
- int ret = close(fd);
- if (ret != 0) return ThrowException(ErrnoException(errno));
+ SYNC_CALL(close, 0, fd)
return Undefined();
}
}
@@ -344,10 +331,8 @@ static Handle<Value> Stat(const Arguments& args) {
if (args[1]->IsFunction()) {
ASYNC_CALL(stat, args[1], *path)
} else {
- NODE_STAT_STRUCT s;
- int ret = NODE_STAT(*path, &s);
- if (ret != 0) return ThrowException(ErrnoException(errno, NULL, "", *path));
- return scope.Close(BuildStatsObject(&s));
+ SYNC_CALL(stat, 0, *path)
+ return scope.Close(BuildStatsObject((NODE_STAT_STRUCT*)SYNC_REQ.ptr));
}
}
@@ -364,10 +349,8 @@ static Handle<Value> LStat(const Arguments& args) {
if (args[1]->IsFunction()) {
ASYNC_CALL(lstat, args[1], *path)
} else {
- NODE_STAT_STRUCT s;
- int ret = lstat(*path, &s);
- if (ret != 0) return ThrowException(ErrnoException(errno, NULL, "", *path));
- return scope.Close(BuildStatsObject(&s));
+ SYNC_CALL(lstat, *path, *path)
+ return scope.Close(BuildStatsObject((NODE_STAT_STRUCT*)SYNC_REQ.ptr));
}
}
#endif // __POSIX__
@@ -384,10 +367,8 @@ static Handle<Value> FStat(const Arguments& args) {
if (args[1]->IsFunction()) {
ASYNC_CALL(fstat, args[1], fd)
} else {
- NODE_STAT_STRUCT s;
- int ret = NODE_FSTAT(fd, &s);
- if (ret != 0) return ThrowException(ErrnoException(errno));
- return scope.Close(BuildStatsObject(&s));
+ SYNC_CALL(fstat, 0, fd)
+ return scope.Close(BuildStatsObject((NODE_STAT_STRUCT*)SYNC_REQ.ptr));
}
}
@@ -405,8 +386,7 @@ static Handle<Value> Symlink(const Arguments& args) {
if (args[2]->IsFunction()) {
ASYNC_CALL(symlink, args[2], *dest, *path)
} else {
- int ret = symlink(*dest, *path);
- if (ret != 0) return ThrowException(ErrnoException(errno));
+ SYNC_CALL(symlink, *path, *dest, *path)
return Undefined();
}
}
@@ -426,8 +406,7 @@ static Handle<Value> Link(const Arguments& args) {
if (args[2]->IsFunction()) {
ASYNC_CALL(link, args[2], *orig_path, *new_path)
} else {
- int ret = link(*orig_path, *new_path);
- if (ret != 0) return ThrowException(ErrnoException(errno, NULL, "", *orig_path));
+ SYNC_CALL(link, *orig_path, *orig_path, *new_path)
return Undefined();
}
}
@@ -446,10 +425,8 @@ static Handle<Value> ReadLink(const Arguments& args) {
if (args[1]->IsFunction()) {
ASYNC_CALL(readlink, args[1], *path)
} else {
- ssize_t bz = readlink(*path, getbuf, ARRAY_SIZE(getbuf) - 1);
- if (bz == -1) return ThrowException(ErrnoException(errno, NULL, "", *path));
- getbuf[ARRAY_SIZE(getbuf) - 1] = '\0';
- return scope.Close(String::New(getbuf, bz));
+ SYNC_CALL(readlink, *path, *path)
+ return scope.Close(String::New((char*)SYNC_REQ.ptr, SYNC_REQ.result));
}
}
#endif // __POSIX__
@@ -467,8 +444,7 @@ static Handle<Value> Rename(const Arguments& args) {
if (args[2]->IsFunction()) {
ASYNC_CALL(rename, args[2], *old_path, *new_path)
} else {
- int ret = rename(*old_path, *new_path);
- if (ret != 0) return ThrowException(ErrnoException(errno, NULL, "", *old_path));
+ SYNC_CALL(rename, *old_path, *old_path, *new_path)
return Undefined();
}
}
@@ -502,8 +478,7 @@ static Handle<Value> Truncate(const Arguments& args) {
if (args[2]->IsFunction()) {
ASYNC_CALL(ftruncate, args[2], fd, len)
} else {
- int ret = ftruncate(fd, len);
- if (ret != 0) return ThrowException(ErrnoException(errno));
+ SYNC_CALL(ftruncate, 0, fd, len)
return Undefined();
}
}
@@ -520,14 +495,7 @@ static Handle<Value> Fdatasync(const Arguments& args) {
if (args[1]->IsFunction()) {
ASYNC_CALL(fdatasync, args[1], fd)
} else {
-#if HAVE_FDATASYNC
- int ret = fdatasync(fd);
-#elif defined(__MINGW32__) || defined(_MSC_VER)
- int ret = FlushFileBuffers((HANDLE)_get_osfhandle(fd)) ? 0 : -1;
-#else
- int ret = fsync(fd);
-#endif
- if (ret != 0) return ThrowException(ErrnoException(errno));
+ SYNC_CALL(fdatasync, 0, fd)
return Undefined();
}
}
@@ -544,12 +512,7 @@ static Handle<Value> Fsync(const Arguments& args) {
if (args[1]->IsFunction()) {
ASYNC_CALL(fsync, args[1], fd)
} else {
-#if defined(__MINGW32__) || defined(_MSC_VER)
- int ret = FlushFileBuffers((HANDLE)_get_osfhandle(fd)) ? 0 : -1;
-#else
- int ret = fsync(fd);
-#endif
- if (ret != 0) return ThrowException(ErrnoException(errno));
+ SYNC_CALL(fsync, 0, fd)
return Undefined();
}
}
@@ -566,8 +529,7 @@ static Handle<Value> Unlink(const Arguments& args) {
if (args[1]->IsFunction()) {
ASYNC_CALL(unlink, args[1], *path)
} else {
- int ret = unlink(*path);
- if (ret != 0) return ThrowException(ErrnoException(errno, NULL, "", *path));
+ SYNC_CALL(unlink, *path, *path)
return Undefined();
}
}
@@ -584,8 +546,7 @@ static Handle<Value> RMDir(const Arguments& args) {
if (args[1]->IsFunction()) {
ASYNC_CALL(rmdir, args[1], *path)
} else {
- int ret = rmdir(*path);
- if (ret != 0) return ThrowException(ErrnoException(errno, NULL, "", *path));
+ SYNC_CALL(rmdir, *path, *path)
return Undefined();
}
}
@@ -598,17 +559,12 @@ static Handle<Value> MKDir(const Arguments& args) {
}
String::Utf8Value path(args[0]->ToString());
- eio_mode_t mode = static_cast<eio_mode_t>(args[1]->Int32Value());
+ int mode = static_cast<int>(args[1]->Int32Value());
if (args[2]->IsFunction()) {
ASYNC_CALL(mkdir, args[2], *path, mode)
} else {
-#if defined(__MINGW32__) || defined(_MSC_VER)
- int ret = mkdir(*path);
-#else
- int ret = mkdir(*path, mode);
-#endif
- if (ret != 0) return ThrowException(ErrnoException(errno, NULL, "", *path));
+ SYNC_CALL(mkdir, *path, *path, mode)
return Undefined();
}
}
@@ -632,10 +588,8 @@ static Handle<Value> SendFile(const Arguments& args) {
if (args[4]->IsFunction()) {
ASYNC_CALL(sendfile, args[4], out_fd, in_fd, in_offset, length)
} else {
- ssize_t sent = eio_sendfile_sync (out_fd, in_fd, in_offset, length);
- // XXX is this the right errno to use?
- if (sent < 0) return ThrowException(ErrnoException(errno));
- return scope.Close(Integer::New(sent));
+ SYNC_CALL(sendfile, 0, out_fd, in_fd, in_offset, length)
+ return scope.Close(Integer::New(SYNC_REQ.result));
}
}
@@ -651,50 +605,25 @@ static Handle<Value> ReadDir(const Arguments& args) {
if (args[1]->IsFunction()) {
ASYNC_CALL(readdir, args[1], *path, 0 /*flags*/)
} else {
-#if defined(__POSIX__)
- DIR *dir = opendir(*path);
- if (!dir) return ThrowException(ErrnoException(errno, NULL, "", *path));
- struct dirent *ent;
-#else
- WIN32_FIND_DATAA ent = {0};
- size_t len = strlen(*path);
- const char* fmt = !len ? "./*"
- : ((*path)[len - 1] == '/' || (*path)[len - 1] == '\\') ? "%s*"
- : "%s\\*";
- char* path2 = new char[len + 4];
- sprintf(path2, fmt, *path);
- HANDLE dir = FindFirstFileA(path2, &ent);
- delete [] path2;
- if(dir == INVALID_HANDLE_VALUE) return ThrowException(ErrnoException(GetLastError(), "FindFirstFileA", "", path2));
-#endif
-
- Local<Array> files = Array::New();
- char *name;
- int i = 0;
-
-#if defined(__POSIX__)
- while ((ent = readdir(dir))) {
- name = ent->d_name;
+ SYNC_CALL(readdir, *path, *path, 0 /*flags*/)
+
+ char *namebuf = static_cast<char*>(SYNC_REQ.ptr);
+ int nnames = req_wrap.req.result;
+ Local<Array> names = Array::New(nnames);
+
+ for (int i = 0; i < nnames; i++) {
+ Local<String> name = String::New(namebuf);
+ names->Set(Integer::New(i), name);
+#ifndef NDEBUG
+ namebuf += strlen(namebuf);
+ assert(*namebuf == '\0');
+ namebuf += 1;
#else
- do {
- name = ent.cFileName;
+ namebuf += strlen(namebuf) + 1;
#endif
- if (name[0] != '.' || (name[1] && (name[1] != '.' || name[2]))) {
- files->Set(Integer::New(i), String::New(name));
- i++;
- }
}
-#if !defined(__POSIX__)
- while(FindNextFileA(dir, &ent));
-#endif
-
-#if defined(__POSIX__)
- closedir(dir);
-#else
- FindClose(dir);
-#endif
- return scope.Close(files);
+ return scope.Close(names);
}
}
@@ -710,13 +639,13 @@ static Handle<Value> Open(const Arguments& args) {
String::Utf8Value path(args[0]->ToString());
int flags = args[1]->Int32Value();
- eio_mode_t mode = static_cast<eio_mode_t>(args[2]->Int32Value());
+ int mode = static_cast<int>(args[2]->Int32Value());
if (args[3]->IsFunction()) {
ASYNC_CALL(open, args[3], *path, flags, mode)
} else {
- int fd = open(*path, flags, mode);
- if (fd < 0) return ThrowException(ErrnoException(errno, NULL, "", *path));
+ SYNC_CALL(open, *path, *path, flags, mode)
+ int fd = SYNC_REQ.result;
SetCloseOnExec(fd);
return scope.Close(Integer::New(fd));
}
@@ -782,12 +711,10 @@ static Handle<Value> Write(const Arguments& args) {
Local<Value> cb = args[5];
if (cb->IsFunction()) {
-
ASYNC_CALL(write, cb, fd, buf, len, pos)
} else {
- ssize_t written = pos < 0 ? write(fd, buf, len) : pwrite(fd, buf, len, pos);
- if (written < 0) return ThrowException(ErrnoException(errno, "write"));
- return scope.Close(Integer::New(written));
+ SYNC_CALL(write, 0, fd, buf, len, pos)
+ return scope.Close(Integer::New(SYNC_REQ.result));
}
}
@@ -847,15 +774,10 @@ static Handle<Value> Read(const Arguments& args) {
cb = args[5];
if (cb->IsFunction()) {
-
ASYNC_CALL(read, cb, fd, buf, len, pos);
} else {
- // SYNC
- ssize_t ret;
-
- ret = pos < 0 ? read(fd, buf, len) : pread(fd, buf, len, pos);
- if (ret < 0) return ThrowException(ErrnoException(errno));
- Local<Integer> bytesRead = Integer::New(ret);
+ SYNC_CALL(read, 0, fd, buf, len, pos)
+ Local<Integer> bytesRead = Integer::New(SYNC_REQ.result);
return scope.Close(bytesRead);
}
}
@@ -871,13 +793,12 @@ static Handle<Value> Chmod(const Arguments& args) {
return THROW_BAD_ARGS;
}
String::Utf8Value path(args[0]->ToString());
- eio_mode_t mode = static_cast<eio_mode_t>(args[1]->Int32Value());
+ int mode = static_cast<int>(args[1]->Int32Value());
if(args[2]->IsFunction()) {
ASYNC_CALL(chmod, args[2], *path, mode);
} else {
- int ret = chmod(*path, mode);
- if (ret != 0) return ThrowException(ErrnoException(errno, "chmod", "", *path));
+ SYNC_CALL(chmod, *path, *path, mode);
return Undefined();
}
}
@@ -899,8 +820,7 @@ static Handle<Value> FChmod(const Arguments& args) {
if(args[2]->IsFunction()) {
ASYNC_CALL(fchmod, args[2], fd, mode);
} else {
- int ret = fchmod(fd, mode);
- if (ret != 0) return ThrowException(ErrnoException(errno, "fchmod", "", 0));
+ SYNC_CALL(fchmod, 0, fd, mode);
return Undefined();
}
}
@@ -929,8 +849,7 @@ static Handle<Value> Chown(const Arguments& args) {
if (args[3]->IsFunction()) {
ASYNC_CALL(chown, args[3], *path, uid, gid);
} else {
- int ret = chown(*path, uid, gid);
- if (ret != 0) return ThrowException(ErrnoException(errno, "chown", "", *path));
+ SYNC_CALL(chown, *path, *path, uid, gid);
return Undefined();
}
}
@@ -959,26 +878,12 @@ static Handle<Value> FChown(const Arguments& args) {
if (args[3]->IsFunction()) {
ASYNC_CALL(fchown, args[3], fd, uid, gid);
} else {
- int ret = fchown(fd, uid, gid);
- if (ret != 0) return ThrowException(ErrnoException(errno, "fchown", "", 0));
+ SYNC_CALL(fchown, 0, fd, uid, gid);
return Undefined();
}
}
#endif // __POSIX__
-
-// Utimes() and Futimes() helper function, converts 123.456 timestamps to timevals
-static inline void ToTimevals(eio_tstamp atime,
- eio_tstamp mtime,
- timeval times[2]) {
- times[0].tv_sec = atime;
- times[0].tv_usec = 10e5 * (atime - (long) atime);
- times[1].tv_sec = mtime;
- times[1].tv_usec = 10e5 * (mtime - (long) mtime);
-}
-
-
-#ifdef __POSIX__
static Handle<Value> UTimes(const Arguments& args) {
HandleScope scope;
@@ -991,24 +896,16 @@ static Handle<Value> UTimes(const Arguments& args) {
}
const String::Utf8Value path(args[0]->ToString());
- const eio_tstamp atime = static_cast<eio_tstamp>(args[1]->NumberValue());
- const eio_tstamp mtime = static_cast<eio_tstamp>(args[2]->NumberValue());
+ const double atime = static_cast<double>(args[1]->NumberValue());
+ const double mtime = static_cast<double>(args[2]->NumberValue());
if (args[3]->IsFunction()) {
ASYNC_CALL(utime, args[3], *path, atime, mtime);
} else {
- timeval times[2];
-
- ToTimevals(atime, mtime, times);
- if (utimes(*path, times) == -1) {
- return ThrowException(ErrnoException(errno, "utimes", "", *path));
- }
+ SYNC_CALL(utime, *path, *path, atime, mtime);
+ return Undefined();
}
-
- return Undefined();
}
-#endif // __POSIX__
-
static Handle<Value> FUTimes(const Arguments& args) {
HandleScope scope;
@@ -1022,26 +919,15 @@ static Handle<Value> FUTimes(const Arguments& args) {
}
const int fd = args[0]->Int32Value();
- const eio_tstamp atime = static_cast<eio_tstamp>(args[1]->NumberValue());
- const eio_tstamp mtime = static_cast<eio_tstamp>(args[2]->NumberValue());
+ const double atime = static_cast<double>(args[1]->NumberValue());
+ const double mtime = static_cast<double>(args[2]->NumberValue());
if (args[3]->IsFunction()) {
ASYNC_CALL(futime, args[3], fd, atime, mtime);
} else {
-#ifndef futimes
- // Some systems do not have futimes
- return ThrowException(ErrnoException(ENOSYS, "futimes", "", 0));
-#else
- timeval times[2];
-
- ToTimevals(atime, mtime, times);
- if (futimes(fd, times) == -1) {
- return ThrowException(ErrnoException(errno, "futimes", "", 0));
- }
-#endif // futimes
+ SYNC_CALL(futime, 0, fd, atime, mtime);
+ return Undefined();
}
-
- return Undefined();
}
@@ -1081,8 +967,8 @@ void File::Initialize(Handle<Object> target) {
NODE_SET_METHOD(target, "fchown", FChown);
//NODE_SET_METHOD(target, "lchown", LChown);
- NODE_SET_METHOD(target, "utimes", UTimes);
#endif // __POSIX__
+ NODE_SET_METHOD(target, "utimes", UTimes);
NODE_SET_METHOD(target, "futimes", FUTimes);
errno_symbol = NODE_PSYMBOL("errno");
@@ -1102,11 +988,6 @@ void InitFs(Handle<Object> target) {
#ifdef __POSIX__
StatWatcher::Initialize(target);
#endif
-
-#ifndef __POSIX__
- // Open files in binary mode by default
- _fmode = _O_BINARY;
-#endif
}
} // end namespace node
View
8 wscript
@@ -501,12 +501,6 @@ def configure(conf):
debug_env = conf.env.copy()
conf.set_env_name('Debug', debug_env)
- if (sys.platform.startswith("win32")):
- # Static pthread
- conf.env.append_value('LINKFLAGS', '../deps/pthread-win32/libpthreadGC2.a')
- debug_env.append_value('LINKFLAGS', '../deps/pthread-win32/libpthreadGC2d.a')
- conf.env.append_value('CPPFLAGS', "-DPTW32_STATIC_LIB")
-
# Configure debug variant
conf.setenv('Debug')
debug_env.set_variant('Debug')
@@ -641,7 +635,6 @@ def build_uv(bld):
uv.env.env = dict(os.environ)
uv.env.env['CC'] = sh_escape(bld.env['CC'][0])
uv.env.env['CXX'] = sh_escape(bld.env['CXX'][0])
- uv.env.env['CPPFLAGS'] = "-DPTW32_STATIC_LIB"
t = join(bld.srcnode.abspath(bld.env_of_name("Release")), uv.target)
bld.env_of_name('Release').append_value("LINKFLAGS_UV", t)
@@ -650,7 +643,6 @@ def build_uv(bld):
uv_debug = uv.clone("Debug")
uv_debug.rule = uv_cmd(bld, 'Debug')
uv_debug.env.env = dict(os.environ)
- uv_debug.env.env['CPPFLAGS'] = "-DPTW32_STATIC_LIB"
t = join(bld.srcnode.abspath(bld.env_of_name("Debug")), uv_debug.target)
bld.env_of_name('Debug').append_value("LINKFLAGS_UV", t)

0 comments on commit bce41fa

Please sign in to comment.
Something went wrong with that request. Please try again.