summaryrefslogtreecommitdiff
path: root/src/node_file.cc
Commit message (Collapse)AuthorAgeFilesLines
* deps: update uv to v1.0.0-rc1Fedor Indutny2014-09-231-27/+34
|
* src: add missing Isolate argumentsYazhong Liu2014-08-191-1/+1
| | | | Reviewed-by: Trevor Norris <trev.norris@gmail.com>
* Merge remote-tracking branch 'upstream/v0.10'Timothy J Fontaine2014-06-101-18/+19
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: AUTHORS ChangeLog deps/v8/src/api.cc deps/v8/src/unicode-inl.h deps/v8/src/unicode.h lib/_stream_readable.js lib/http.js src/cares_wrap.cc src/node.cc src/node_crypto.cc src/node_dtrace.cc src/node_file.cc src/node_stat_watcher.cc src/node_version.h src/process_wrap.cc src/string_bytes.cc src/string_bytes.h src/udp_wrap.cc src/util.h test/simple/test-buffer.js test/simple/test-stream2-compatibility.js
| * src: replace usage of String::Utf8ValueTimothy J Fontaine2014-06-061-18/+19
| | | | | | | | | | v8::String::Utf8Value previously could allow invalid surrogates when interpreting values.
* | fs: return blksize on stats objectTrevor Norris2014-04-141-0/+1
| | | | | | | | | | | | | | Oversight to not pass blksize to fs.Stats on initialization. Also added a test to make sure the object property has been set. Since now on Windows both blksize and blocks will simply be set to undefined.
* | fs: improve performance of all stat functionsJames Pickard2014-03-311-37/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | By building the fs.Stats object in JS, which is returned by all fs stat functions, calls to v8::Object::Set() are removed. This also includes creating all associated Date objects in JS, rather than using v8::Date::New(). Both these changes have significant performance gains. Note that the returned value from fs.stat changes slightly for non-POSIX systems. Whereas before the stats object would be missing blocks and blksize keys, it now has these keys with undefined as the value. Signed-off-by: Trevor Norris <trev.norris@gmail.com>
* | src: update to v8 3.24 APIsFedor Indutny2014-03-131-16/+19
| |
* | src: update to latest libuv apiTimothy J Fontaine2014-02-261-7/+13
| | | | | | | | | | | | | | | | libuv gyp builds now require you to define the library disposition (static or shared). Also, libuv now supports vectored IO for file system reads and writes, update to those function signatures
* | src: remove `node_isolate` from sourceFedor Indutny2014-02-221-53/+77
| | | | | | | | fix #6899
* | Merge remote-tracking branch 'upstream/v0.10'Timothy J Fontaine2014-02-081-4/+3
|\ \ | |/ | | | | | | | | | | | | | | | | | | Conflicts: deps/v8/src/preparser.cc deps/v8/src/win32-math.h doc/api/http.markdown src/node_buffer.h src/node_crypto.cc src/node_file.cc src/node_http_parser.cc
| * src: refactor buffer bounds checkingTimothy J Fontaine2014-02-081-2/+2
| | | | | | | | | | Consolidate buffer bounds checking logic into Buffer namespace and use it consistently throughout the source.
* | node: register modules from DSO constructorsKeith M Wesolowski2014-01-271-2/+3
| | | | | | | | | | | | | | Built-in modules should be automatically registered, replacing the static module list. Add-on modules should also be automatically registered via DSO constructors. This improves flexibility in adding built-in modules and is also a prerequisite to pure-C addon modules.
* | Merge branch 'v0.10'Fedor Indutny2013-12-101-17/+58
|\ \ | |/ | | | | | | Conflicts: src/node_file.cc
| * fs: report correct path when EEXISTFedor Indutny2013-12-101-17/+61
| | | | | | | | | | | | | | | | When `symlink`, `link` or `rename` report EEXIST, ENOTEMPTY or EPERM - the destination file name should be included in the error message, instead of source file name. fix #6510
* | src: fix Context::Scope usageBen Noordhuis2013-11-121-1/+1
| | | | | | | | | | env->context() may or may not create a new Local. It currently does not but don't depend on that behavior, create a HandleScope first.
* | src: fix Environment::GetCurrent() usageBen Noordhuis2013-11-111-1/+1
| | | | | | | | | | | | Create a HandleScope before calling the Environment::GetCurrent() that takes a v8::Isolate* as an argument because it creates a handle with the call to v8::Isolate::CurrentContext().
* | node: add AsyncListener supportTrevor Norris2013-10-311-2/+2
| | | | | | | | | | | | | | | | | | AsyncListener is a JS API that works in tandem with the AsyncWrap class to allow the user to be alerted to key events in the life cycle of an asynchronous event. The AsyncWrap class has its own MakeCallback implementation that core will be migrated to use, and uses state sharing techniques to allow quicker communication between JS and C++ whether the async event callbacks need to be called.
* | Merge remote-tracking branch 'upstream/v0.10'Timothy J Fontaine2013-10-251-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: ChangeLog deps/uv/ChangeLog deps/uv/include/uv-darwin.h deps/uv/src/unix/fsevents.c deps/uv/src/unix/process.c deps/uv/src/version.c doc/api/addons.markdown doc/api/cluster.markdown doc/api/http.markdown lib/http.js lib/tls.js src/node_crypto.cc src/node_http_parser.cc src/node_version.h src/pipe_wrap.cc src/v8abbr.h src/v8ustack.d test/simple/test-http-pipeline-flood.js
| * src: IsInt64() should return bool, not intBen Noordhuis2013-10-231-1/+1
| |
* | cpplint: disallow if one-linersFedor Indutny2013-10-171-60/+120
| |
* | cpplint: disallow comma-first in C++Fedor Indutny2013-10-171-3/+3
| |
* | src: add multi-context supportBen Noordhuis2013-09-061-95/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit makes it possible to use multiple V8 execution contexts within a single event loop. Put another way, handle and request wrap objects now "remember" the context they belong to and switch back to that context when the time comes to call into JS land. This could have been done in a quick and hacky way by calling v8::Object::GetCreationContext() on the wrap object right before making a callback but that leaves a fairly wide margin for bugs. Instead, we make the context explicit through a new Environment class that encapsulates everything (or almost everything) that belongs to the context. Variables that used to be a static or a global are now members of the aforementioned class. An additional benefit is that this approach should make it relatively straightforward to add full isolate support in due course. There is no JavaScript API yet but that will be added in the near future. This work was graciously sponsored by GitHub, Inc.
* | fs: Expose birthtime on stat objectsisaacs2013-08-271-0/+3
| | | | | | | | | | | | | | Just do the best we can with whatever libuv gives us. Also, document the semantics of `ctime` and the compatibility with Windows.
* | src: remove redundant symbol init in node_file.ccBen Noordhuis2013-08-141-3/+0
| | | | | | | | | | Don't lazy-init the oncomplete symbol string in the After() function, it has already been created at module init time.
* | src: clean up FSReqWrapBen Noordhuis2013-08-131-31/+34
| | | | | | | | Move the 'free FSReqWrap data?' logic into the class itself.
* | src: move ReqWrap::data_ to FSReqWrapBen Noordhuis2013-08-131-3/+5
| | | | | | | | | | FSReqWrap is the only ReqWrap child class that uses the data_ field so move it out of ReqWrap and into FSReqWrap.
* | src: don't obj->Set(Integer::New(...), val)Ben Noordhuis2013-08-121-6/+6
| | | | | | | | | | | | | | | | Don't create an Integer when setting a numeric index on an object or an array, use the version of v8::Object::Set() that takes an uint32_t. Change the types of the variables from int to uint32_t and clean up some code consistency issues while we're here.
* | src: use v8::String::NewFrom*() functionsBen Noordhuis2013-08-091-21/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Change calls to String::New() and String::NewSymbol() to their respective one-byte, two-byte and UTF-8 counterparts. * Add a FIXED_ONE_BYTE_STRING macro that takes a string literal and turns it into a v8::Local<v8::String>. * Add helper functions that make v8::String::NewFromOneByte() easier to work with. Said function expects a `const uint8_t*` but almost every call site deals with `const char*` or `const unsigned char*`. Helps us avoid doing reinterpret_casts all over the place. * Code that handles file system paths keeps using UTF-8 for backwards compatibility reasons. At least now the use of UTF-8 is explicit. * Remove v8::String::NewSymbol() entirely. Almost all call sites were effectively minor de-optimizations. If you create a string only once, there is no point in making it a symbol. If you are create the same string repeatedly, it should probably be cached in a persistent handle.
* | src: use static_cast for void-to-T castsBen Noordhuis2013-08-031-1/+1
| | | | | | | | | | Code cleanup, replace a few uses of reinterpret_cast<T*>(void_ptr) with static_cast<T*>(void_ptr).
* | src: remove non-isolate PersistentToLocal()Ben Noordhuis2013-08-021-1/+2
| | | | | | | | | | There is no need for it and it's a tiny bit slower than the version of PersistentToLocal() that takes a v8::Isolate* as its first argument.
* | src: lint c++ codeFedor Indutny2013-07-311-10/+10
| |
* | fs: write strings directly to diskTrevor Norris2013-07-301-29/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior, strings would first be converted to a Buffer before being written to disk. Now the intermediary step has been removed. Other changes of note: * Class member "must_free" was added to req_wrap so to track if the memory needs to be manually cleaned up after use. * External String Resource support, so the memory will be used directly instead of copying out the data. * Docs have been updated to reflect that if position is not a number then it will assume null. Previously it specified the argument must be null, but that was not how the code worked. An attempt was made to only support == null, but there were too many tests that assumed != number would be enough. * Docs update show some of the write/writeSync arguments are optional.
* | Merge remote-tracking branch 'origin/v0.10'Ben Noordhuis2013-07-301-8/+8
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | Conflicts: AUTHORS ChangeLog deps/uv/ChangeLog deps/uv/src/version.c deps/uv/src/win/fs.c src/node.cc src/node_crypto.cc src/node_os.cc src/node_version.h
| * fs: uids and gids must be unsigned intsBen Noordhuis2013-07-231-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, fs.chown() and fs.fchown() coerced the uid and gid arguments to signed integers which is wrong because uid_t and gid_t are unsigned on most all platforms and IDs that don't fit in a signed integer do exist. This commit changes the aforementioned functions to take unsigned ints instead. No test because we can't assume the system has [GU]IDs that large. This change depends on joyent/libuv@d779eb5. Fixes #5890.
* | src, lib: update after internal api changeBen Noordhuis2013-07-201-19/+13
| | | | | | | | | | | | | | | | Libuv now returns errors directly. Make everything in src/ and lib/ follow suit. The changes to lib/ are not strictly necessary but they remove the need for the abominations that are process._errno and node::SetErrno().
* | src: remove unnecessary calls to Local<T>::New()Ben Noordhuis2013-07-071-1/+1
| |
* | src: cast strong persistent handles to localsBen Noordhuis2013-07-071-3/+1
| | | | | | | | | | Avoids the overhead of creating a new Local every time we unwrap a Persistent handle.
* | lib, src: upgrade after v8 api changeBen Noordhuis2013-07-061-113/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a big commit that touches just about every file in the src/ directory. The V8 API has changed in significant ways. The most important changes are: * Binding functions take a const v8::FunctionCallbackInfo<T>& argument rather than a const v8::Arguments& argument. * Binding functions return void rather than v8::Handle<v8::Value>. The return value is returned with the args.GetReturnValue().Set() family of functions. * v8::Persistent<T> no longer derives from v8::Handle<T> and no longer allows you to directly dereference the object that the persistent handle points to. This means that the common pattern of caching oft-used JS values in a persistent handle no longer quite works, you first need to reconstruct a v8::Local<T> from the persistent handle with the Local<T>::New(isolate, persistent) factory method. A handful of (internal) convenience classes and functions have been added to make dealing with the new API a little easier. The most visible one is node::Cached<T>, which wraps a v8::Persistent<T> with some template sugar. It can hold arbitrary types but so far it's exclusively used for v8::Strings (which was by far the most commonly cached handle type.)
* | fs: uv_[fl]stat now reports subsecond resolutionTimothy J Fontaine2013-03-231-10/+12
| | | | | | | | | | | | While libuv supports reporting subsecond stat resolution across platforms, to actually get that resolution your platform and filesystem must support it (not HFS, ext[23], fat), otherwise the nsecs are 0
* | src: pass Isolate to all applicable apiTrevor Norris2013-03-201-54/+54
| | | | | | | | | | | | Update the api to pass node_isolate to all supported methods. Much thanks to Ben Noordhuis and his work in 51f6e6a.
* | bindings: update apiTrevor Norris2013-03-201-1/+2
|/ | | | | | | | | | | | | | | | | | | | | All compile time warnings about using deprecated APIs have been suppressed by updating node's API. Though there are still many function calls that can accept Isolate, and still need to be updated. node_isolate had to be added as an extern variable in node.h and node_object_wrap.h Also a couple small fixes for Error handling. Before v8 3.16.6 the error stack message was lazily written when it was needed, which allowed you to change the message after instantiation. Then the stack would be written with the new message the first time it was accessed. Though that has changed. Now it creates the stack message on instantiation. So setting a different message afterwards won't be displayed. This is not a complete fix for the problem. Getting error without any message isn't very useful.
* src: remove unused symbols in node_file.ccBen Noordhuis2013-03-061-7/+0
|
* src, test: downgrade to v8 3.14 apiBen Noordhuis2013-02-251-26/+26
|
* src: pass node_isolate to Undefined()Ben Noordhuis2013-01-071-16/+16
|
* src: pass node_isolate to Null()Ben Noordhuis2013-01-071-1/+1
|
* src: pass node_isolate to Local<>::NewBen Noordhuis2013-01-071-1/+1
|
* src: pass node_isolate to Integer::NewBen Noordhuis2013-01-071-9/+9
|
* fs: remove fs.sendfile()Ben Noordhuis2012-12-281-27/+0
| | | | | | Said function has been broken (and useless) since v0.6.0. Remove it altogether. Fixes #3854.
* Merge remote-tracking branch 'ry/v0.8' into v0.8-mergeisaacs2012-09-281-40/+53
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: AUTHORS ChangeLog deps/openssl/openssl.gyp deps/uv/src/unix/linux/linux-core.c deps/uv/src/unix/process.c deps/uv/src/unix/stream.c deps/v8/src/arm/builtins-arm.cc deps/v8/src/arm/code-stubs-arm.cc deps/v8/src/arm/full-codegen-arm.cc lib/tls.js src/node_version.h test/simple/test-http-client-timeout-agent.js
| * fs: fix stat() reporting for large filesBen Noordhuis2012-09-261-2/+12
| | | | | | | | | | | | Use Number::New(), not Integer::New(). Large values won't fit in an Integer. Apply to the size, ino and blocks fields.