summaryrefslogtreecommitdiffstats
path: root/chrome/browser/process_singleton_linux.cc
Commit message (Collapse)AuthorAgeFilesLines
* Add -profile command line switchdavemoore@chromium.org2009-11-301-0/+14
| | | | | | Review URL: http://codereview.chromium.org/384062 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33335 0039d316-1c4b-4281-b951-d872f2087c98
* Revert "Revert r31175 r31176 r31187"hclam@chromium.org2009-11-061-4/+6
| | | | | | | | | | | | The bustage seems to be a WebKit change upstream. It is not reverted in WebKit and merger. So bring the innocent change back in. TBR=jam TEST=green tree Review URL: http://codereview.chromium.org/375009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31214 0039d316-1c4b-4281-b951-d872f2087c98
* Rever r31175 r31176 r31187hclam@chromium.org2009-11-061-6/+4
| | | | | | | | | | | XP tests are failing, the guess is r31175 and r31176. TBR=beng TEST=XP tests go green Review URL: http://codereview.chromium.org/376008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31201 0039d316-1c4b-4281-b951-d872f2087c98
* Fifth patch in making destructors of refcounted objects private.jam@chromium.org2009-11-061-4/+6
| | | | | | | | BUG=26749 Review URL: http://codereview.chromium.org/361025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31175 0039d316-1c4b-4281-b951-d872f2087c98
* Simplify threading in browser thread by making only ChromeThread deal with ↵jam@chromium.org2009-10-271-2/+1
| | | | | | | | different thread lifetimes.The rest of the code doesn't get MessageLoop pointers since they're not thread-safe and instead just call PostTask on ChromeThread. If the target thread is not alive, then the task is simply deleted.In a followup change, I'll remove any remaining MessageLoop* caching. With this change, there's little to be gained by caching since no locks are involved if the target MessageLoop is guaranteed to outlive the current thread (inferred automatically by the order of the chrome_threads_ array).BUG=25354 Review URL: http://codereview.chromium.org/306032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30163 0039d316-1c4b-4281-b951-d872f2087c98
* Linux: Prevent another Chrome instance when First Run UI is active.kuchhal@chromium.org2009-10-141-9/+9
| | | | | | | | | BUG=24485 TEST=On Ubuntu, delete 'First Run' file and launch Chrome to bring up First Run UI and then again launch Chrome which should not crash. Review URL: http://codereview.chromium.org/278006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29007 0039d316-1c4b-4281-b951-d872f2087c98
* Fix a whole bunch of style nits.erg@google.com2009-10-131-1/+1
| | | | | | | | (Long term intention is to add a subset of cpplint.py to the presubmit script.) Review URL: http://codereview.chromium.org/276008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28914 0039d316-1c4b-4281-b951-d872f2087c98
* Eliminate all uses of strerror() in code that uses src/base. strerror() is ↵tschmelcher@chromium.org2009-10-131-15/+16
| | | | | | | | | | | inherently unsafe in multi-threaded apps because it stores the string in a global buffer. It should never be used. If you want to log an error, use PLOG and friends, or if that's too high-level then use safe_strerror(). TEST=built on Linux in 32-bit and 64-bit mode; ran base_unittests in each case; ran Chromium itself in each case; try servers BUG=none Review URL: http://codereview.chromium.org/261055 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28850 0039d316-1c4b-4281-b951-d872f2087c98
* CommandLine: rejigger how initialization works.evan@chromium.org2009-10-121-3/+4
| | | | | | | | | | I'm attempting to clean up CommandLine. This change rearranges how initialization is done. I am trying to eliminate redundant functions; more will come in subsequent changes. Review URL: http://codereview.chromium.org/273018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28752 0039d316-1c4b-4281-b951-d872f2087c98
* linux: expose the ProcessSingleton timeout to speed testsevan@chromium.org2009-09-171-2/+7
| | | | | | | | | We have a 20-second timeout normally, but for testing purposes 1 second is plenty. Review URL: http://codereview.chromium.org/209018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26483 0039d316-1c4b-4281-b951-d872f2087c98
* Log an error message when deleting lockfile or socket fails in ↵mattm@chromium.org2009-09-141-3/+4
| | | | | | | | | | | | | ProcessSingletonLinux. Also, include full path in error about creating the lock. BUG=20982 TEST=chown your profile & lockfile to root.root and run. Should print error about unlink ... permission denied. Review URL: http://codereview.chromium.org/193105 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26169 0039d316-1c4b-4281-b951-d872f2087c98
* Gtk: Add error dialog when profile was in use on a different computer.mattm@chromium.org2009-08-211-1/+9
| | | | | | | | | BUG=17549 TEST=see bug Review URL: http://codereview.chromium.org/173222 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24008 0039d316-1c4b-4281-b951-d872f2087c98
* Make ProcessSingletonLinux check the hostname to avoid multiple uses of a ↵mattm@chromium.org2009-08-211-73/+140
| | | | | | | | | | | | | profile over NFS. In order to avoid the singleton socket filename from exceeding the max socket name length, the socket is just named "SingletonSocket" and a new file "SingletonLock" is used for the hostname&pid. BUG=17549 TEST=see bug Review URL: http://codereview.chromium.org/174041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23930 0039d316-1c4b-4281-b951-d872f2087c98
* It's a copy of http://codereview.chromium.org/155772, with the fix for ↵suzhe@chromium.org2009-08-041-90/+330
| | | | | | | | | | | | | | | | valgrind test failure. This CL implements the second TODO item of issue 12343: 2) We should send back an ACK to the second process. If the second process doesn't get an ACK in the given timeout, it should kill the first process and go ahead and start. The approach of this CL is to append process id to the singleton's socket filename, such as "SingletonSocket-12345", and creates a symbol link "SingletonSocket" to the real socket file. In ProcessSingleton::NotifyOtherProcess() if it's successfully connected to "SingletonSocket" but no ACK received, then the original process can be killed by its process id retrieved from the symbol link. BUG=12343 ProcessSingleton Linux cleanups TEST=In one terminal, launch chrome and stop the process by pressing ctrl-z, then launch chrome again in another terminal. The second chrome shall be started in 5 seconds, and the first one shall be killed. Review URL: http://codereview.chromium.org/160436 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22365 0039d316-1c4b-4281-b951-d872f2087c98
* linux: set FD_CLOEXEC on the singleton socketevan@chromium.org2009-08-031-0/+14
| | | | | | | | | | | The IME library may spawn a subprocess, which will then hold open our singleton socket after we've shut down. BUG=17952 Review URL: http://codereview.chromium.org/160523 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22281 0039d316-1c4b-4281-b951-d872f2087c98
* Reverting 22144.suzhe@chromium.org2009-07-311-328/+88
| | | | | | | | still broke valgrind ui_tests. Review URL: http://codereview.chromium.org/159694 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22145 0039d316-1c4b-4281-b951-d872f2087c98
* It's a copy of http://codereview.chromium.org/155772, with the fix for ↵suzhe@chromium.org2009-07-311-88/+328
| | | | | | | | | | | | | | | | valgrind test failure. This CL implements the second TODO item of issue 12343: 2) We should send back an ACK to the second process. If the second process doesn't get an ACK in the given timeout, it should kill the first process and go ahead and start. The approach of this CL is to append process id to the singleton's socket filename, such as "SingletonSocket-12345", and creates a symbol link "SingletonSocket" to the real socket file. In ProcessSingleton::NotifyOtherProcess() if it's successfully connected to "SingletonSocket" but no ACK received, then the original process can be killed by its process id retrieved from the symbol link. BUG=http://crbug.com/12343 ProcessSingleton Linux cleanups TEST=In one terminal, launch chrome and stop the process by pressing ctrl-z, then launch chrome again in another terminal. The second chrome shall be started in 5 seconds, and the first one shall be killed. Review URL: http://codereview.chromium.org/160436 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22144 0039d316-1c4b-4281-b951-d872f2087c98
* Reverting 21943.willchan@chromium.org2009-07-291-328/+88
| | | | | | | Broke valgrind ui_tests Review URL: http://codereview.chromium.org/160320 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21945 0039d316-1c4b-4281-b951-d872f2087c98
* Linux: Adds ACKs to ProcessSingletonLinux.willchan@chromium.org2009-07-291-88/+328
| | | | | | | | | | | | Patch contributed by suzhe@google.com (http://codereview.chromium.org/155772) BUG=http://crbug.com/12343 TEST=In one terminal, launch chrome and stop the process by pressing ctrl-z, then launch chrome again in another terminal. The second chrome shall be started in 5 seconds, and the first one shall be killed. Review URL: http://codereview.chromium.org/159577 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21943 0039d316-1c4b-4281-b951-d872f2087c98
* Linux: fail more gracefully when ProcessSingleton fails to bind.agl@chromium.org2009-06-241-1/+8
| | | | | | | | | | | | | For users with AFS home directories, we cannot create UNIX domain sockets for ProcessSingleton. Before this patch we would spin because the socket would be constantly 'readable' for accept. http://codereview.chromium.org/139008 BUG=14237 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19178 0039d316-1c4b-4281-b951-d872f2087c98
* Fixes a number of issues with ProcessSingletonLinux.willchan@chromium.org2009-05-221-64/+154
| | | | | | | | | | | | | | (1) Use nonblocking sockets. Blocking the IO thread is bad. (2) Handle multiple SocketReaders. (3) Stop leaking file descriptors in SocketReader. Old code used to stop watching the fds, but not close them. (4) Handle partial reads and writes. SocketReader reads until the sender shuts down his side of the socket. (5) Timeout readers after 5 seconds so they don't hang forever. BUG=http://www.crbug.com/12343 TEST=Open a chrome instance. Check /proc/<pid>/fd/ to see how many descriptors there are. Run "chrome www.google.com" on the command line a bunch of times, which should create a bunch of tabs. Make sure you close all these new tabs that pop up.a Check /proc/<pid>/fd/ to see how many descriptors there are. There shouldn't be many more (although some of the new renderers that got created take awhile because they get cleaned up). Keep repeating, you should be at a steady state of file descriptors. Review URL: http://codereview.chromium.org/112054 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16811 0039d316-1c4b-4281-b951-d872f2087c98
* Remove trailing NULL is data sent between chrome processes.tc@google.com2009-05-211-5/+4
| | | | | | | | | | | | Since we split on NULL, the final NULL results in an extra command line token passed to the original browser process. Bug found by willchan. Review URL: http://codereview.chromium.org/113714 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16629 0039d316-1c4b-4281-b951-d872f2087c98
* Fix a invalid read found by valgrind in process singleton linux.tc@google.com2009-05-211-7/+26
| | | | | | | | | | | | | We set up a listener on the IO thread, but the listener lived longer than the IO thread. Instead, register a listener to stop listening when the IO thread goes away. We have to register the destruction listener on the thread that we're listening to, so there's an new StartListening method dispatched from ProcessSingleton::Create. Review URL: http://codereview.chromium.org/115605 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16606 0039d316-1c4b-4281-b951-d872f2087c98
* Implement process singleton on linux so if the user tries totc@google.com2009-05-201-13/+264
| | | | | | | | | | | | | | open multiple chrome processes, the first one just opens a new window. This is based on http://codereview.chromium.org/88067 by Nikita Ofitserov (himikof). BUG=8073 Review URL: http://codereview.chromium.org/115572 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16528 0039d316-1c4b-4281-b951-d872f2087c98
* Put test_user_data in a temp directory instead of using base::DIR_EXE. (try 2)thestig@chromium.org2009-05-111-0/+2
| | | | | | | | | base::DIR_EXE could be a very long path, which causes socket creation to fail because socket paths have a limited length. Let's use a temp directory instead. We should also clean up the temp dir when we're done. Also abort if the socket path is too long. Reviewed in issue 115107 Review URL: http://codereview.chromium.org/113193 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15749 0039d316-1c4b-4281-b951-d872f2087c98
* Revert r15607hclam@chromium.org2009-05-081-2/+0
| | | | | | | | r15607 broke the build TBR=brg, thestig git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15608 0039d316-1c4b-4281-b951-d872f2087c98
* Put test_user_data in a temp directory instead of using base::DIR_EXE.thestig@chromium.org2009-05-081-0/+2
| | | | | | | | | base::DIR_EXE could be a very long path, which causes socket creation to fail because socket paths have a limited length. Let's use a temp directory instead. We should also clean up the temp dir when we're done. Also abort if the socket path is too long. Review URL: http://codereview.chromium.org/115107 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15607 0039d316-1c4b-4281-b951-d872f2087c98
* POSIX: Add a macro for handling EINTR.agl@chromium.org2009-05-011-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* More solid detection of browser process in chrome_process_util_linux.cc:phajdan.jr@chromium.org2009-04-211-1/+2
| | | | | | | | | | | | | | | | - use GetAppOutput instead of popen - make unexpected conditions fatal (otherwise the tests using this code would mistakenly assume that there is no running browser process) Also add a constant for SingletonSocket. Make necessary adjustments to GetAppOutput - ignore stderr (because fuser prints the file name to stderr and having stderr in |output| would require more parsing). Review URL: http://codereview.chromium.org/77031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14091 0039d316-1c4b-4281-b951-d872f2087c98
* Implement chrome_proces_util for linux and enable download ui test.estade@chromium.org2009-04-141-1/+1
| | | | | | | | | | To get the PID from the socket, we use lsof (fuser doesn't work with unix sockets apparently). The download shelf, save page, and browser ui tests now pass. Review URL: http://codereview.chromium.org/66071 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13716 0039d316-1c4b-4281-b951-d872f2087c98
* Removed zombie hunter codemaruel@chromium.org2009-03-231-6/+0
| | | | | | | | BUG=6468 Review URL: http://codereview.chromium.org/46076 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12314 0039d316-1c4b-4281-b951-d872f2087c98
* Add bug links for ProcessSingleton.evan@chromium.org2009-02-251-2/+3
| | | | | | Review URL: http://codereview.chromium.org/28142 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10395 0039d316-1c4b-4281-b951-d872f2087c98
* Implement skeletal ProcessSingleton on Linux to cut down on NOTIMPLEMENTED()s.evan@chromium.org2009-02-181-0/+71
We now will refuse to run a second browser process if one is already running; making the second invocation bring up new windows in the first remains left to be implemented. Review URL: http://codereview.chromium.org/20448 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9980 0039d316-1c4b-4281-b951-d872f2087c98