From owner-freebsd-current@freebsd.org Mon Aug 12 11:03:42 2019 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4B5E7AF47A; Mon, 12 Aug 2019 11:03:42 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 466Xyj3BKnz4CLs; Mon, 12 Aug 2019 11:03:41 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-pg1-f194.google.com with SMTP id x15so38948480pgg.8; Mon, 12 Aug 2019 04:03:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=RRR0XCQP3z/2zeJdSqlcwArQibmy44WNvk4Q1dSuGKQ=; b=hee2lpAicXLeYWOmdUG+XVgLdVRreOaCW19jGN8V4W0X9waFVLY+WrOQR0QE5sOIYH Yh23sh8/jr0+v/qrNUbq5t+u3/yWxNx0VFm7lZbAXEQrnOiTPWp3jxlA3ld1guaPdPLF HU1XWC/dbe/7LEYt7AeWfOUQueCwR2anrSOuvjLI8mL2zWAbndJC8VgdVJVmEvzLj5j7 Uo59AGxbEpyn8DLCfrfcx5o3ohDSmweLxDCAh0anOyY7EqwF1bkTcUhQ6ZYqSElOgS1/ HZ+MsrW9fGgCuFvvpe8z6VsHN2z32Dh6HSC5H8qancY8SBGZ0UkYPR/fIFV78GueG5bf POpA== X-Gm-Message-State: APjAAAX0n/dXt4WV/8IL0/xTCvQnuUrUBMOGp7p9UPG8RCla1hbZT41E SuYK5qUwk9WTzs1Y30R/W9XSOO9C X-Google-Smtp-Source: APXvYqxzcVENPbG4JbzXIRY7wJfGw+78mMJWuwykNqLg5cba5jsC2yuq0ESBmVo9OEcEBG9NnWiIrg== X-Received: by 2002:a63:6d6:: with SMTP id 205mr30440430pgg.262.1565607818831; Mon, 12 Aug 2019 04:03:38 -0700 (PDT) Received: from [192.168.1.36] (broadband-82-140-206-197.atc.tvcom.ru. [82.140.206.197]) by smtp.googlemail.com with ESMTPSA id s24sm71032523pgm.3.2019.08.12.04.03.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Aug 2019 04:03:37 -0700 (PDT) Subject: Re: rc script: manual stop vs system shutdown From: Andriy Gapon To: Konstantin Belousov Cc: Ian Lepore , Warner Losh , "Rodney W. Grimes" , FreeBSD Current , freebsd-rc@FreeBSD.org References: <2e50fb67-8a19-412b-19d2-14f5f20b61f8@FreeBSD.org> <201908011553.x71FrTCd060252@gndrsh.dnsmgr.net> <91d1a853-c449-481a-b001-7c1f54e28fdd@FreeBSD.org> <20190812104550.GA2738@kib.kiev.ua> <52b2eac3-83de-a7c7-5126-c742e2f195a8@FreeBSD.org> Openpgp: preference=signencrypt Message-ID: <7a72dcf7-899f-a67b-d66a-cc48a094c7cf@FreeBSD.org> Date: Mon, 12 Aug 2019 14:03:34 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <52b2eac3-83de-a7c7-5126-c742e2f195a8@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 466Xyj3BKnz4CLs X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of agapon@gmail.com designates 209.85.215.194 as permitted sender) smtp.mailfrom=agapon@gmail.com X-Spamd-Result: default: False [-4.13 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; RWL_MAILSPIKE_GOOD(0.00)[194.215.85.209.rep.mailspike.net : 127.0.0.18]; RCPT_COUNT_FIVE(0.00)[6]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_SHORT(-0.97)[-0.970,0]; FORGED_SENDER(0.30)[avg@FreeBSD.org,agapon@gmail.com]; FREEMAIL_TO(0.00)[gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[197.206.140.82.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[avg@FreeBSD.org,agapon@gmail.com]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[194.215.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-1.16)[ipnet: 209.85.128.0/17(-3.38), asn: 15169(-2.39), country: US(-0.05)]; RCVD_TLS_ALL(0.00)[] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Aug 2019 11:03:42 -0000 On 12/08/2019 13:57, Andriy Gapon wrote: > On 12/08/2019 13:45, Konstantin Belousov wrote: >> On Mon, Aug 12, 2019 at 10:46:29AM +0300, Andriy Gapon wrote: >>> I guess that there is more than one way to achieve what I want or >>> something similar to that. >>> Rather than "expend words" on a theoretical discussion, I decided to do >>> this: https://reviews.freebsd.org/D21221 >>> However, I am still open to the discussion and suggestions. >>> One thing that I would prefer, though, is to make the watchdogd service >>> as smart as possible -- but not smarter :-) -- that is, I would prefer >>> to do without adding any new command verbs to it. >> >> Did you considered exporting kern_shutdown.c:rebooting as a sysctl ? > > No, I didn't it. Thank you for the suggestion. > Let me investigate it. 'rebooting' seems to be too late, it's set when the actual reboot system call is made. rc.shutdown is run before that. I think that the kernel is generally[*] not aware of an imminent shutdown between the time init(8) is signaled and the time init(8) calls reboot(2). [*] -- except for cases where the kernel is an initiator of the shutdown. -- Andriy Gapon