Like HOST_ARCH_*, HOST_OS_* describes the OS the VM is running on, which may be different from the OS the VM is generating code for during AOT compilation.
Currently we conflate the two when emitting AOT as assembly, and we get away with it because Flutter only uses assembly for targeting iOS and one can only target iOS from a Mac, but we expect to use assembly for Android as well so native tools can unwind Dart frames.
R=zra@google.com
Review-Url: https://codereview.chromium.org/2750843003 .
Somtimes execve() fails and then we fall back to exit(1) in the fork()ed but not
exeve()ed subprocess.
One of the issues is e.g. that we don't want to run LSAN in the fork()ed but not
execve()ed subprocess, the results will be bogus (plus the output of
LSAN is not read on the other side (i.e. the unix pipe is not drained) which
blocks the subprocess indefinitely).
R=vegorov@google.com
Review-Url: https://codereview.chromium.org/2632483002 .
About this CL:
The only purpose of `if (fork() == 0) exit(0)` is to wake up
a thread in the parent process which might be blocked on `wait()`.
There is no need to run atexit() handlers in the `fork()`ed child.
This is a *workaround attempt* for a deadlocked `free()` call inside the
processing of atexit handlers in glibc.
(Side note: There might be better ways of notifying the thread, like sending a
signal to the particular pthread with `pthread_kill` which would make the
`wait()` syscall be interrupted.)
About the issue:
It is still unclear why, in this particular case, the tcmalloc locks should
be hold during the `exit()` call:
* via a static initializer tcmalloc uses
`pthread_atfork(before=ObtainAllLocks(),
after_parent=ReleaseAllLocks(),
after_child=ReleaseAllLocks())`
to register locking & unlocking around `fork()`
* glibc's `fork()` runs the either `after_parent` or `after_child` handlers
(unconditionally) which should free the locks
* the `exit()` call later should be free to malloc/free
The [BUG] describes more in detail how we can hit a tcmalloc deadlock in a
different situation (it's a linux kernel bug).
Namely, if the linux kernel runs OOM during `fork()` and therefore fails to
set the new thread-id. The glibc code hits an assert and tries to allocate
memory before `after_parent`/`after_child` handlers were executed which
deadlocks.
BUG=https://github.com/dart-lang/sdk/issues/28246R=vegorov@google.com
Review-Url: https://codereview.chromium.org/2618723002 .
Now, failing to allocate a buffer for stderr or stdout will generate
an ENOMEM OSError exception.
Also previously, read() returning an error would cause buffers for
stderr and stdout to leak. After this change, they'll be reclaimed.
R=asiva@google.com
Review-Url: https://codereview.chromium.org/2596543002 .
Previously we would compile in implementaitions of native calls for
IO functions that would never be used. This CL provides implementations
that throw a Dart exception if they're called by mistake. It also uses
a DART_IO_DISABLED preprocessor define to clean up the build files and
check that we're not including code we shouldn't.
R=iposva@google.com, johnmccutchan@google.com
Review URL: https://codereview.chromium.org/1839463002 .
Also some style cleanups.
Decided to fix these leaks by using Dart_ScopeAllocate
instead of malloc and new. Leaks are noted in the CL.
I haven't finished looking over all the code in
//runtime/bin yet, but this CL was getting big.
Review URL: https://codereview.chromium.org/1781883002 .
When calling a non-existent executable, a pair of file descriptors will be
created with pipe(). One end goes to the exitcode handler thread, the other end
goes to the epoll() thread.
If an error occurs during process creation, the pipe is still created and the
exit handler thread writes the exitcode to the pipe, but the other file
descriptor is not added to the epoll() set and is therefore leaked. (i.e.
Process_Start ignores the other end of the pipe if exec() failed in
Proces::Start()).
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//15980006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23534 260f80e4-7a28-3924-810f-c04153c831b5
Split directory_posix -> directory_(android|linux|macos)
This allows us to cleanly make Android-specific changes to
directory_android.cc
Copy all _linux files to _android files and edit as needed to account
for the differences between Linux and Android:
+ getcwd(0, NULL) doesn't work on Android, have to emulate
+ Android doesn't have a '/tmp' directory, have to emulate
+ Android doesn't provide mkdtemp(), have to emulate.
+ Small differences in the available system include files.
+ Use pthread_cond_timedwait_monotonic instead of
pthread_condattr_setclock
Review URL: https://chromiumcodereview.appspot.com//10826233
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10613 260f80e4-7a28-3924-810f-c04153c831b5