From owner-svn-src-stable-12@freebsd.org Tue Sep 3 16:38:26 2019 Return-Path: Delivered-To: svn-src-stable-12@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 9B616E3BB4; Tue, 3 Sep 2019 16:38:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46NCLp3h78z3N6N; Tue, 3 Sep 2019 16:38:26 +0000 (UTC) (envelope-from mav@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6216F5BD0; Tue, 3 Sep 2019 16:38:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x83GcQrZ047619; Tue, 3 Sep 2019 16:38:26 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x83GcQXA047618; Tue, 3 Sep 2019 16:38:26 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909031638.x83GcQXA047618@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Sep 2019 16:38:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351759 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 351759 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Sep 2019 16:38:26 -0000 Author: mav Date: Tue Sep 3 16:38:25 2019 New Revision: 351759 URL: https://svnweb.freebsd.org/changeset/base/351759 Log: MFC r351134: Add support for 'j', 't' and 'z' flags to kernel sscanf(). Modified: stable/12/sys/kern/subr_scanf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/subr_scanf.c ============================================================================== --- stable/12/sys/kern/subr_scanf.c Tue Sep 3 16:33:02 2019 (r351758) +++ stable/12/sys/kern/subr_scanf.c Tue Sep 3 16:38:25 2019 (r351759) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /* * Note that stdarg.h and the ANSI style va_start macro is used for both @@ -61,6 +62,9 @@ __FBSDID("$FreeBSD$"); #define POINTER 0x10 /* weird %p pointer (`fake hex') */ #define NOSKIP 0x20 /* do not skip blanks */ #define QUAD 0x400 +#define INTMAXT 0x800 /* j: intmax_t */ +#define PTRDIFFT 0x1000 /* t: ptrdiff_t */ +#define SIZET 0x2000 /* z: size_t */ #define SHORTSHORT 0x4000 /** hh: char */ /* @@ -162,6 +166,9 @@ literal: case '*': flags |= SUPPRESS; goto again; + case 'j': + flags |= INTMAXT; + goto again; case 'l': if (flags & LONG){ flags &= ~LONG; @@ -173,6 +180,12 @@ literal: case 'q': flags |= QUAD; goto again; + case 't': + flags |= PTRDIFFT; + goto again; + case 'z': + flags |= SIZET; + goto again; case 'h': if (flags & SHORT){ flags &= ~SHORT; @@ -256,6 +269,12 @@ literal: *va_arg(ap, long *) = nread; else if (flags & QUAD) *va_arg(ap, quad_t *) = nread; + else if (flags & INTMAXT) + *va_arg(ap, intmax_t *) = nread; + else if (flags & SIZET) + *va_arg(ap, size_t *) = nread; + else if (flags & PTRDIFFT) + *va_arg(ap, ptrdiff_t *) = nread; else *va_arg(ap, int *) = nread; continue; @@ -533,6 +552,12 @@ literal: *va_arg(ap, long *) = res; else if (flags & QUAD) *va_arg(ap, quad_t *) = res; + else if (flags & INTMAXT) + *va_arg(ap, intmax_t *) = res; + else if (flags & PTRDIFFT) + *va_arg(ap, ptrdiff_t *) = res; + else if (flags & SIZET) + *va_arg(ap, size_t *) = res; else *va_arg(ap, int *) = res; nassigned++;