| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
1. In DirectoryWatcherImpl::Watch we have to initialize delegate_, root_path_
and other members before calling InotifyReader::AddWatch, because otherwise
the following race is possible:
1. InotifyReader::AddWatch
2. DirectoryWatcherImpl::OnInotifyEvent, where we want to use delegate_
and root_path_
3. Now-late initialization of delegate_ and root_path_ in DirectoryWatcherImpl::Watch
2. In InotifyReader::OnInotifyEvent we can't just copy things under a lock
and notify without a lock. Otherwise the following race is possible:
1. Things get copied in InotifyReader::OnInotifyEvent, lock is released
2. DirectoryWatcherImpl is destroyed, removing its watch
3. But it's still in the copied set of watchers to be notified. When we get
to notifying it, it's invalid, and we have a crash.
To fix race #2, I decided to just do everything under the lock. Notifications
shouldn't be a bottleneck, and I don't want to prematurely add more complexity.
TEST=Manually with RaceChecker, see bug.
http://crbug.com/15473
Review URL: http://codereview.chromium.org/149630
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20730 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
|
| |
signaling the event dtor waits on.
http://crbug.com/15055
Review URL: http://codereview.chromium.org/147052
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19151 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
After this patch DirectoryWatcher when asked for recursive watch will scan the
subtree and add inotify watches for each subfolder, but further changes to the
tree structure won't trigger adding/removing watches.
Support for really recursive watches is planned. This is just to divide the
work, because the task is not easy.
Based on patch by Janwar Dinata <j.dinata@gmail.com> reviewed at http://codereview.chromium.org/92151
http://crbug.com/8968
Review URL: http://codereview.chromium.org/115229
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16070 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On POSIX systems, system calls can be interrupted by signals. In this
case, they'll return EINTR, indicating that the system call needs to
be restarted.
(The situation is a little more complicated than this with SA_RESTART,
but you can read man 7 signal if you like.)
The short of it is that you need to catch EINTR and restart the call
for these system calls:
* read, readv, write, writev, ioctl
* open() when dealing with a fifo
* wait*
* Anything socket based (send*, recv*, connect, accept etc)
* flock and lock control with fcntl
* mq_ functions which can block
* futex
* sem_wait (and timed wait)
* pause, sigsuspend, sigtimedwait, sigwaitinfo
* poll, epoll_wait, select and 'p' versions of the same
* msgrcv, msgsnd, semop, semtimedop
* close (although, on Linux, EINTR won't happen here)
* any sleep functions (careful, you need to handle this are restart
with different arguments)
We've been a little sloppy with this until now. This patch adds a
macro for dealing with this and corrects every case of these system
calls (that I found).
The macro is HANDLE_EINTR in base/eintr_wrapper.h. It's safe to
include on Windows and is a no-op there.
On POSIX, it uses GCC magic to return the correct type based on the
expression and restarts the system call if it throws EINTR.
And you can use it like:
HANDLE_EINTR(close(fd));
Or:
ssize_t bytes_read = HANDLE_EINTR(read(fd, buffer, len));
*BEWARE* that it will evaluate the argument multiple times, so this is
not safe:
HANDLE_EINTR(close(FireMissiles()));
http://groups.google.com/group/chromium-dev/browse_thread/thread/41a35b2a457d73a0
http://codereview.chromium.org/100225
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15102 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
| |
- check return value of write to self-pipe
Review URL: http://codereview.chromium.org/42403
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12150 0039d316-1c4b-4281-b951-d872f2087c98
|
|
|
|
|
|
|
|
|
|
|
| |
- share more code between different platforms
- put more code inside anonymous namespace
- add more DISALLOW_COPY_AND_ASSIGNs
- small #include cleanup
Review URL: http://codereview.chromium.org/42343
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12007 0039d316-1c4b-4281-b951-d872f2087c98
|
|
Review URL: http://codereview.chromium.org/42037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11962 0039d316-1c4b-4281-b951-d872f2087c98
|