Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: session_manager_service.cc

Issue 3336018: Send SIGTERM and SIGABRT signals to a process group (Closed) Base URL: ssh://git@chromiumos-git//login_manager.git
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | session_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "login_manager/session_manager_service.h" 5 #include "login_manager/session_manager_service.h"
6 6
7 #include <dbus/dbus-glib-lowlevel.h> 7 #include <dbus/dbus-glib-lowlevel.h>
8 #include <errno.h> 8 #include <errno.h>
9 #include <glib.h> 9 #include <glib.h>
10 #include <grp.h> 10 #include <grp.h>
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 // And SIGHUP, for when the terminal disappears. On shutdown, many Linux 823 // And SIGHUP, for when the terminal disappears. On shutdown, many Linux
824 // distros send SIGHUP, SIGTERM, and then SIGKILL. 824 // distros send SIGHUP, SIGTERM, and then SIGKILL.
825 action.sa_handler = SIGHUPHandler; 825 action.sa_handler = SIGHUPHandler;
826 CHECK(sigaction(SIGHUP, &action, NULL) == 0); 826 CHECK(sigaction(SIGHUP, &action, NULL) == 0);
827 } 827 }
828 828
829 void SessionManagerService::CleanupChildren(int timeout) { 829 void SessionManagerService::CleanupChildren(int timeout) {
830 for (size_t i_child = 0; i_child < child_pids_.size(); ++i_child) { 830 for (size_t i_child = 0; i_child < child_pids_.size(); ++i_child) {
831 int child_pid = child_pids_[i_child]; 831 int child_pid = child_pids_[i_child];
832 if (child_pid > 0) { 832 if (child_pid > 0) {
833 system_->kill(child_pid, (session_started_ ? SIGTERM: SIGKILL)); 833 system_->kill(-child_pid, (session_started_ ? SIGTERM : SIGKILL));
834 if (!system_->ChildIsGone(child_pid, timeout)) 834 if (!system_->ChildIsGone(child_pid, timeout))
835 system_->kill(child_pid, SIGABRT); 835 system_->kill(-child_pid, SIGABRT);
836 } 836 }
837 } 837 }
838 } 838 }
839 839
840 void SessionManagerService::SetGError(GError** error, 840 void SessionManagerService::SetGError(GError** error,
841 ChromeOSLoginError code, 841 ChromeOSLoginError code,
842 const char* message) { 842 const char* message) {
843 g_set_error(error, CHROMEOS_LOGIN_ERROR, code, "Login error: %s", message); 843 g_set_error(error, CHROMEOS_LOGIN_ERROR, code, "Login error: %s", message);
844 } 844 }
845 845
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 arg_list.push_back(args[i_arg]); 880 arg_list.push_back(args[i_arg]);
881 } 881 }
882 } 882 }
883 if (arg_list.size()) { 883 if (arg_list.size()) {
884 arg_lists.push_back(arg_list); 884 arg_lists.push_back(arg_list);
885 } 885 }
886 return arg_lists; 886 return arg_lists;
887 } 887 }
888 888
889 } // namespace login_manager 889 } // namespace login_manager
OLDNEW
« no previous file with comments | « no previous file | session_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698