Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5014421ybi; Mon, 3 Jun 2019 23:08:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqw8HW/8vfN+YPVtoXVB56uVqMnzpC8ugtJTez0B9YLvQqAVrySO6LwVEMQ80alm/3XQUN7W X-Received: by 2002:a17:90a:730b:: with SMTP id m11mr34525124pjk.89.1559628509772; Mon, 03 Jun 2019 23:08:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559628509; cv=none; d=google.com; s=arc-20160816; b=NlhhMzT6WWfL2qtSee25DqBYZ2lny7ns7Bwe4gFxLDN+aayc26wYP3c3DFi5A7+Ilx tYb3IyybNvt0MpqCseVT6sRkIJVkfoxH6q8lvcOMkgSN25Eum1Gs6iZzdWiU2xFrBVpD WH+o3MWOf7KFMeGrPpbLyqc6oPNaBaHP4iECAItV/Hbkg5rFoTzahrIhaNixmBkU0hRC X/AnFX/t5KhpZT1+HrEOtpu5WfYmM8dqK+xgZRmoZiqMdzdH6bD40IecQQwep6asA10r tRzLcOsnu2VpuQWr3857uhF/kF64Xl3qlvSSWM0P/L+a3t1tA5hOt9a7zZG+Y2+x1y+8 oC1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=34Q4lDfUnqaJUBUaYtPo+IwpAxqcHX1caKK4K6PnfP0=; b=XQQR5oi3CMAo9f/kzPKtvKQxDGWAjvzK/bj/E3G0jEG+e65G8iaQI3m/eGBa3dQMF2 IyqQPVSKE+PtJoPL7gcP/ihP+LtbqU/c5TNCN0YBUgtwdJIoJkcZm7M1d3HAWXIkYpO6 Nj9y16bRxRxSaySPs/pOhJymTB9zOuThr5StXUYftMIV2tyAwqNUiZG8ipffgn59TT5D oxCf4z/SqOJsjkBe9cBzWJfTQjfbotf5iiv4nM5gggxuzznX0lGDEusNZOB7qEWxRnkh KipObLcn3TSH6i/FyZdD4dpixQcR2gYHHeA5bZas8XCO+bhqskLNgPnTWvDo+/AqyQMt Dttw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s21si21255241pgm.154.2019.06.03.23.08.06; Mon, 03 Jun 2019 23:08:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726710AbfFDGHx (ORCPT + 99 others); Tue, 4 Jun 2019 02:07:53 -0400 Received: from mga12.intel.com ([192.55.52.136]:8052 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726660AbfFDGHx (ORCPT ); Tue, 4 Jun 2019 02:07:53 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jun 2019 23:07:53 -0700 X-ExtLoop1: 1 Received: from ligangti-mobl3.ccr.corp.intel.com (HELO ingas-nuc1.sea.intel.com) ([10.254.84.181]) by fmsmga008.fm.intel.com with ESMTP; 03 Jun 2019 23:07:52 -0700 From: Inga Stotland To: linux-bluetooth@vger.kernel.org Cc: brian.gix@intel.com, marcel@holtmann.org, johan.hedberg@gmail.com, luiz.dentz@gmail.com, Inga Stotland Subject: [PATCH BlueZ 2/2 v3] mesh: Do not daemonize, run in foreground or as service Date: Mon, 3 Jun 2019 23:07:48 -0700 Message-Id: <20190604060748.3533-3-inga.stotland@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190604060748.3533-1-inga.stotland@intel.com> References: <20190604060748.3533-1-inga.stotland@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This removes call to daemon(). "--nodetach" option is retained to set umask(). Also, adds description for dbus-debug option. --- mesh/main.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/mesh/main.c b/mesh/main.c index a621300e6..3cecd8fbf 100644 --- a/mesh/main.c +++ b/mesh/main.c @@ -2,7 +2,7 @@ * * BlueZ - Bluetooth protocol stack for Linux * - * Copyright (C) 2017-2018 Intel Corporation. All rights reserved. + * Copyright (C) 2017-2019 Intel Corporation. All rights reserved. * * * This library is free software; you can redistribute it and/or @@ -41,6 +41,7 @@ static const struct option main_options[] = { { "config", optional_argument, NULL, 'c' }, { "nodetach", no_argument, NULL, 'n' }, { "debug", no_argument, NULL, 'd' }, + { "dbus-debug", no_argument, NULL, 'b' }, { "help", no_argument, NULL, 'h' }, { } }; @@ -49,12 +50,13 @@ static void usage(void) { l_info(""); l_info("Usage:\n" - "\tmeshd [options]\n"); + "\tbluetooth-meshd [options]\n"); l_info("Options:\n" "\t--index Use specified controller\n" "\t--config Configuration directory\n" "\t--nodetach Run in foreground\n" "\t--debug Enable debug output\n" + "\t--dbus-debug Enable D-Bus debugging\n" "\t--help Show %s information\n", __func__); } @@ -170,7 +172,8 @@ int main(int argc, char *argv[]) goto done; } - umask(0077); + if (!detached) + umask(0077); dbus = l_dbus_new_default(L_DBUS_SYSTEM_BUS); if (!dbus) { @@ -190,14 +193,6 @@ int main(int argc, char *argv[]) goto done; } - if (detached) { - if (daemon(0, 0)) { - perror("Failed to start meshd daemon"); - status = EXIT_FAILURE; - goto done; - } - } - status = l_main_run_with_signal(signal_handler, NULL); done: -- 2.21.0