Commit Graph

27 Commits

Author SHA1 Message Date
gram@google.com 3601944836 Revised CL for customisable logging (replacing printfs).
Review URL: https://codereview.chromium.org//11312242

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15096 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-19 17:38:15 +00:00
kustermann@google.com d0fe9360a9 Fixed missing O_CLOEXEC in Mac OS
TBR=ager@google.com

Review URL: https://codereview.chromium.org//11416009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14964 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-15 14:13:28 +00:00
kustermann@google.com fb093fd342 Added O_CLOEXEC to the flags parameter of open() calls
To prevent sub-processes from inheriting open file descriptors of
the current process, the O_CLOEXEC flag is necessary.

Review URL: https://codereview.chromium.org//11419008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14963 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-15 13:46:15 +00:00
ager@google.com d166fef422 Remove file name from File C++ structure. It is not used.
Currently, the field is being assigned a string that we
immediately deallocate leaving the field invalid. Since
it is not used we should get rid of it.

R=aprelev@gmail.com,sgjesse@google.com
BUG=

Review URL: https://codereview.chromium.org//11348006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14188 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-29 12:02:35 +00:00
ager@google.com 52230ca22b Support posting of external data into dart as external uint8 arrays through the Dart API.
The native ports use the snapshot reader to create the dart objects. Added support for reading external arrays from snapshots but no support for writing them. The only way an external array is written to a snapshot is through the api message writer.

This allows dart:io to avoid one copy of data read from files and sockets. This change only contains one use of the new API.

R=asiva@google.com,iposva@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10698011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9281 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-02 07:22:32 +00:00
ager@google.com 379695ee2b Implement File.lastModified.
R=sgjesse@google.com,ajohnsen@google.com
BUG=dartbug/2988
TEST=standalone/io/file*

Review URL: https://chromiumcodereview.appspot.com//10443008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7945 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-24 13:10:02 +00:00
ager@google.com 2596d556a9 Deal with symbolic links for file and directories on Mac and Linux.
R=sgjesse@google.com
BUG=dartbug.com/2516
TEST=

Review URL: https://chromiumcodereview.appspot.com//10309004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7228 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-02 11:39:21 +00:00
ager@google.com aba2e48950 Support length operation without opening file.
Use fstat instead of multiple seek calls to get length of
opened files.

R=sgjesse@google.com
BUG=dartbug.com/1592
TEST=standalone/io/File*Test

Review URL: https://chromiumcodereview.appspot.com//10065013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6459 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-12 11:47:32 +00:00
sgjesse@google.com cdc29b23f0 Add error handling to random access file
Now all both sync and async methods on File and RandomAccessFile
should have correct error handling.

Changed readByte and readByteSync to return -1 instead of
reporting an error when end of file is reached. It seems to make
the most sense.

The amount of boiler-plate code in both the native functions and
native port functions in file.cc is growing. Maybe we should
consider some refactoring, e.g. with a table of the expected
argument types for each native port functions together with known
position of the FILE* argument.

R=ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9839053

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5812 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-26 05:54:49 +00:00
sgjesse@google.com e06beb7f89 Fix Mac OS build
TBR=ager@google.com

BUG=none
TEST=none

Review URL: https://chromiumcodereview.appspot.com//9692045

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5397 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 13:09:24 +00:00
sgjesse@google.com 84836f8c56 Error reporting on File in dart:io
This implements consistent error reporting on all methods on File in dart:io. The async onError method is called with an exception argument which is the same exception as would have been thrown from the corresponding sync method.

The one method on Directory which already did this has been updated as well.

R=ager@google.com

BUG=none
TEST=tests/standalone/src/io/FileTest.dart, tests/standalone/src/io/FileInvalidArgumentsTest.dart

Review URL: https://chromiumcodereview.appspot.com//9630012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5396 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 13:00:47 +00:00
rice@google.com 0b4c8203fc Allow std{in,out,err} to be a socket
Review URL: http://chromiumcodereview.appspot.com/9617012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5056 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-06 21:36:07 +00:00
ager@google.com 7e4a36278f Implement File.directory() and File.directorySync() to get
containing directory for a file.

BUG=dart:1618
TEST=standalone/FileTest

Review URL: https://chromiumcodereview.appspot.com//9416096

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4464 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 16:18:39 +00:00
sgjesse@google.com b4d571dcdd Handle stdio redirection in standalone VM
The recent change to epoll on Linux and kqueue on Mac OS for getting
notifications from file descriptors caused the redirection of stdin,
stdout and stderr for the stand alone VM to stop working.

On Linux epoll failed when file descriptor 0, 1 or 2 redirected from
or to a file war registered. On Mac OS there was just no events
generated from kqueue.

The streams created for stdio, stdout and stderr is now of the correct
type and for file redirections no longer a socket object holding a
file descriptor for a regular file.

Added testing of stdio redirection using both pipes and files. These
tests are currently skipped on Windows.

Fixed handlin of short socket read when reading the process exit code.

Always close the socket port when not waiting for any events.

R=iposva@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9360040

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4226 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-14 15:20:27 +00:00
ricow@google.com 7c524e3e3c Change file opening operation to set position at the end of the file when FileMode.APPEND is used.
Additionally, allow File.openOutputStream to take a FileMode enum (only FileMode.WRITE and FileMode.APPEND is allowed).
Review URL: https://chromiumcodereview.appspot.com//9346015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3984 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-07 09:34:12 +00:00
sgjesse@google.com bf67f24098 Move assert.h/assert.cc from runtime/vm to runtime/platform
The purpose of this change is twofold:

1. Source in the bin directory can now use the same assertions as
   source in the vm directory. The ASSERT macro used by the code
   in runtime/bin was just defined to use assert from the standard
   C library.
2. Moving other implementation parts from runtime/vm to
   runtime/platform (e.g. classes Monitor and Mutex) for sharing
   between runtime/bin and runtime/vm will be easier as these
   implementations rely on these assertion macros.

Created two gypi files for the platform directory. One for the
headers and one for the source. The source one is only included
when building the VM library and will be present in libdart.a
when the dart executable is linked.

All the code for asserts is still in the dart namespace.

Also re-arranged the order of includes to be alphabetically in
the files touched.

R=ager@google.com, iposva@google.com

BUG=
TEST=

Review URL: http://codereview.chromium.org//9189003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3335 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-16 12:28:10 +00:00
sgjesse@google.com 0122a33a76 Handle EINTR on all IO operations
There have been spurious FileIOExceptions seen on some Mac OS machines.

R=ager@google.com,whesse@google.com

BUG=
TEST=

Review URL: http://codereview.chromium.org//9139011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3185 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-11 15:12:27 +00:00
ager@google.com d5696e2026 Change the behavior of open on files to not truncate by default
when opening for writing.

We have an explicit truncate method in the API and truncating
the file is a bit hostile to users who want to modify or append
to an existing file. :-)

R=whesse@google.com
BUG=
TEST=

Review URL: http://codereview.chromium.org//9034005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2941 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-04 12:23:01 +00:00
ager@google.com fed5e6d99c Add truncate operation to File API.
R=whesse@google.com
BUG=264
TEST=

Review URL: http://codereview.chromium.org//8679005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1800 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-23 15:42:20 +00:00
ager@google.com eb2ed9e25f Implement delete on File objects.
R=whesse@google.com
BUG=
TEST=

Review URL: http://codereview.chromium.org//8598011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1652 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-18 12:27:56 +00:00
ager@google.com c4fb2b2f4d Implement setPosition on File to seek to a byte position.
R=sgjesse@google.com
BUG=dart:263
TEST=standalone/FileTest

Review URL: http://codereview.chromium.org//8578003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1573 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-16 15:50:55 +00:00
ager@google.com f74ecd22fd Implemented File create API.
R=sgjesse@google.com
BUG=
TEST=

Review URL: http://codereview.chromium.org//8437056

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1095 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-02 15:57:54 +00:00
asiva@google.com 9c7db339b8 Allocate and pass a resolved_path buffer to realpath as older macos versions
do not work when a NULL is passed in for resolved_path
Review URL: http://codereview.chromium.org//8400070

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@917 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-28 20:22:34 +00:00
asiva@google.com ac94efb33f Fix infinite recursion when dealing with cyclic library dependencies.
Review URL: http://codereview.chromium.org//8371016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@714 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-25 21:01:07 +00:00
ager@google.com 60300b4c0e Fix Mac build.
R=sgjesse@google.com
BUG=
TEST=

Review URL: http://codereview.chromium.org//8375052

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@691 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-25 12:20:33 +00:00
ager@google.com 86284155b9 Improve error handling in the process library.
Verify that the arguments have the types expected by the
implementation. Require a List instance containing builtin
Strings as the arguments. Require a builtin String path.

R=sgjesse@google.com
BUG=
TEST=

Review URL: http://codereview.chromium.org//8383037

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@690 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-25 12:16:04 +00:00
dgrove@google.com 4c0f559d23 Initial checkin.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-05 05:20:07 +00:00