From owner-svn-src-all@freebsd.org Sat Jun 10 01:20:09 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 615D1C091CC; Sat, 10 Jun 2017 01:20:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F43382DB7; Sat, 10 Jun 2017 01:20:09 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v5A1K8F8085082; Sat, 10 Jun 2017 01:20:08 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v5A1K8A7085081; Sat, 10 Jun 2017 01:20:08 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201706100120.v5A1K8A7085081@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 10 Jun 2017 01:20:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r319765 - head/lib/libsysdecode X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jun 2017 01:20:09 -0000 Author: jhb Date: Sat Jun 10 01:20:08 2017 New Revision: 319765 URL: https://svnweb.freebsd.org/changeset/base/319765 Log: Improve decoding of RB_AUTOBOOT in the 'howto' argument to reboot(). The reboot() system call accepts a mode (RB_AUTOBOOT, RB_HALT, RB_POWEROFF, or RB_REROOT) as well as zero or more optional flags in 'howto'. However, RB_AUTOBOOT was only displayed if 'howto' was exactly 0. Combinations like 'RB_AUTOBOOT | RB_DUMP' were decoded as 'RB_DUMP'. Instead, imply that RB_AUTOBOOT was specified if none of the other "mode" flags were specified. Modified: head/lib/libsysdecode/flags.c Modified: head/lib/libsysdecode/flags.c ============================================================================== --- head/lib/libsysdecode/flags.c Sat Jun 10 00:53:00 2017 (r319764) +++ head/lib/libsysdecode/flags.c Sat Jun 10 01:20:08 2017 (r319765) @@ -634,8 +634,19 @@ sysdecode_quotactl_cmd(FILE *fp, int cmd) bool sysdecode_reboot_howto(FILE *fp, int howto, int *rem) { + bool printed; - return (print_mask_int(fp, rebootopt, howto, rem)); + /* + * RB_AUTOBOOT is special in that its value is zero, but it is + * also an implied argument if a different operation is not + * requested via RB_HALT, RB_POWEROFF, or RB_REROOT. + */ + if (howto != 0 && (howto & (RB_HALT | RB_POWEROFF | RB_REROOT)) == 0) { + fputs("RB_AUTOBOOT|", fp); + printed = true; + } else + printed = false; + return (print_mask_int(fp, rebootopt, howto, rem) || printed); } bool