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

Side by Side Diff: session_manager_service.cc

Issue 5184005: login_manager: Add dbus API for restarting entd when enterprise extensions installed (Closed) Base URL: http://git.chromium.org/git/login_manager.git@master
Patch Set: Respond to cmasone review Created 10 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « session_manager_service.h ('k') | no next file » | 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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « session_manager_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698