| OLD | NEW |
| 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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 string arguments_string(arguments_buffer); | 627 string arguments_string(arguments_buffer); |
| 628 | 628 |
| 629 child_jobs_[child_index]->SetArguments(arguments_string); | 629 child_jobs_[child_index]->SetArguments(arguments_string); |
| 630 child_pids_[child_index] = RunChild(child_jobs_[child_index]); | 630 child_pids_[child_index] = RunChild(child_jobs_[child_index]); |
| 631 | 631 |
| 632 // To set "logged-in" state for BWSI mode. | 632 // To set "logged-in" state for BWSI mode. |
| 633 return StartSession(const_cast<gchar*>(kIncognitoUser), NULL, | 633 return StartSession(const_cast<gchar*>(kIncognitoUser), NULL, |
| 634 OUT_done, error); | 634 OUT_done, error); |
| 635 } | 635 } |
| 636 | 636 |
| 637 gboolean SessionManagerService::RestartEntd(GError** error) { |
| 638 LOG(INFO) << "Restarting entd."; |
| 639 // Shutdown entd if it is currently running, blocking this thread and |
| 640 // method call until it has finished shutting down. |
| 641 int stop_status = system("/sbin/initctl stop entd"); |
| 642 // Stop may have failed, but it may be ok if not already running. Error |
| 643 // messages will go to session manager log. |
| 644 LOG_IF(INFO, stop_status != 0) |
| 645 << "Could not stop entd, likely was not running."; |
| 646 string command = StringPrintf("/sbin/initctl start entd " |
| 647 "CHROMEOS_USER=%s", |
| 648 current_user_.c_str()); |
| 649 // Start entd with the current user passed in, blocking this thread |
| 650 // and method call until it has finished starting. |
| 651 bool restarted = (system(command.c_str()) == 0); |
| 652 LOG(INFO) << "Restart was " << (restarted ? "" : "not ") |
| 653 << "successful."; |
| 654 return restarted; |
| 655 } |
| 656 |
| 637 /////////////////////////////////////////////////////////////////////////////// | 657 /////////////////////////////////////////////////////////////////////////////// |
| 638 // glib event handlers | 658 // glib event handlers |
| 639 | 659 |
| 640 void SessionManagerService::HandleChildExit(GPid pid, | 660 void SessionManagerService::HandleChildExit(GPid pid, |
| 641 gint status, | 661 gint status, |
| 642 gpointer data) { | 662 gpointer data) { |
| 643 // If I could wait for descendants here, I would. Instead, I kill them. | 663 // If I could wait for descendants here, I would. Instead, I kill them. |
| 644 kill(-pid, SIGKILL); | 664 kill(-pid, SIGKILL); |
| 645 | 665 |
| 646 DLOG(INFO) << "Handling child process exit."; | 666 DLOG(INFO) << "Handling child process exit."; |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 arg_list.push_back(args[i_arg]); | 1008 arg_list.push_back(args[i_arg]); |
| 989 } | 1009 } |
| 990 } | 1010 } |
| 991 if (arg_list.size()) { | 1011 if (arg_list.size()) { |
| 992 arg_lists.push_back(arg_list); | 1012 arg_lists.push_back(arg_list); |
| 993 } | 1013 } |
| 994 return arg_lists; | 1014 return arg_lists; |
| 995 } | 1015 } |
| 996 | 1016 |
| 997 } // namespace login_manager | 1017 } // namespace login_manager |
| OLD | NEW |