From owner-svn-src-head@freebsd.org Mon Aug 3 18:08:04 2020 Return-Path: Delivered-To: svn-src-head@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 C47573A3C4B; Mon, 3 Aug 2020 18:08:04 +0000 (UTC) (envelope-from arichardson@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4BL5Tc4pdGz4Cl5; Mon, 3 Aug 2020 18:08:04 +0000 (UTC) (envelope-from arichardson@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 8470B17EFC; Mon, 3 Aug 2020 18:08:04 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 073I84OO052985; Mon, 3 Aug 2020 18:08:04 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 073I84oi052984; Mon, 3 Aug 2020 18:08:04 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202008031808.073I84oi052984@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Mon, 3 Aug 2020 18:08:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r363805 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 363805 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Aug 2020 18:08:04 -0000 Author: arichardson Date: Mon Aug 3 18:08:04 2020 New Revision: 363805 URL: https://svnweb.freebsd.org/changeset/base/363805 Log: Allow building setmode.c on Linux/macOS We bootstrap this file to allow compiling FreeBSD on Linux systems since some boostrap tools use setmode(). Unfortunately, glibc's sys/stat.h declares a non-static getumask() function (which is unimplemented!) and that conflicts with the local getumask() function. To work around this simply use a different name here. Reviewed By: brooks, emaste Differential Revision: https://reviews.freebsd.org/D25929 Modified: head/lib/libc/gen/setmode.c Modified: head/lib/libc/gen/setmode.c ============================================================================== --- head/lib/libc/gen/setmode.c Mon Aug 3 17:53:15 2020 (r363804) +++ head/lib/libc/gen/setmode.c Mon Aug 3 18:08:04 2020 (r363805) @@ -70,7 +70,7 @@ typedef struct bitcmd { #define CMD2_OBITS 0x08 #define CMD2_UBITS 0x10 -static mode_t getumask(void); +static mode_t get_current_umask(void); static BITCMD *addcmd(BITCMD *, mode_t, mode_t, mode_t, mode_t); static void compress_mode(BITCMD *); #ifdef SETMODE_DEBUG @@ -186,7 +186,7 @@ setmode(const char *p) * Get a copy of the mask for the permissions that are mask relative. * Flip the bits, we want what's not set. */ - mask = ~getumask(); + mask = ~get_current_umask(); setlen = SET_LEN + 2; @@ -343,13 +343,14 @@ out: } static mode_t -getumask(void) +get_current_umask(void) { sigset_t sigset, sigoset; size_t len; mode_t mask; u_short smask; +#ifdef KERN_PROC_UMASK /* * First try requesting the umask without temporarily modifying it. * Note that this does not work if the sysctl @@ -359,7 +360,7 @@ getumask(void) if (sysctl((int[4]){ CTL_KERN, KERN_PROC, KERN_PROC_UMASK, 0 }, 4, &smask, &len, NULL, 0) == 0) return (smask); - +#endif /* * Since it's possible that the caller is opening files inside a signal * handler, protect them as best we can.