From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 5B920139694 for ; Mon, 22 May 2017 16:30:20 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9B4BB21C06B; Mon, 22 May 2017 16:30:19 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 742A321C06B for ; Mon, 22 May 2017 16:30:19 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5B9EA3416AF for ; Mon, 22 May 2017 16:30:18 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id F1E0A745A for ; Mon, 22 May 2017 16:30:16 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <1495470563.a77ee2e94191ba1a286b8a6835f76556481566ba.williamh@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: src/rc/ X-VCS-Repository: proj/openrc X-VCS-Files: src/rc/openrc-init.c X-VCS-Directories: src/rc/ X-VCS-Committer: williamh X-VCS-Committer-Name: William Hubbs X-VCS-Revision: a77ee2e94191ba1a286b8a6835f76556481566ba X-VCS-Branch: master Date: Mon, 22 May 2017 16:30:16 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: e7cc85dc-0e11-4c05-b063-494e36548154 X-Archives-Hash: 2fcfb572689248a2dc394475b92fdff1 commit: a77ee2e94191ba1a286b8a6835f76556481566ba Author: William Hubbs gmail com> AuthorDate: Mon May 22 16:29:14 2017 +0000 Commit: William Hubbs gentoo org> CommitDate: Mon May 22 16:29:23 2017 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=a77ee2e9 init: add ability to switch to single user mode src/rc/openrc-init.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/rc/openrc-init.c b/src/rc/openrc-init.c index 8abe0dd6..398259cc 100644 --- a/src/rc/openrc-init.c +++ b/src/rc/openrc-init.c @@ -105,6 +105,14 @@ static void handle_shutdown(const char *runlevel, int cmd) reboot(cmd); } +static void handle_single(void) +{ + pid_t pid; + + pid = do_openrc("single"); + while (waitpid(pid, NULL, 0) != pid); +} + static void reap_zombies(void) { pid_t pid; @@ -201,6 +209,8 @@ int main(int argc, char **argv) handle_shutdown("reboot", RB_AUTOBOOT); else if (strcmp(buf, "reexec") == 0) handle_reexec(argv[0]); + else if (strcmp(buf, "single") == 0) + handle_single(); } return 0; }