From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 83658 invoked by alias); 2 Jul 2018 15:11:19 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 83643 invoked by uid 89); 2 Jul 2018 15:11:19 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS,URIBL_RED autolearn=ham version=3.3.2 spammy=Hx-languages-length:1510, Joseph, joseph, emulated X-HELO: relay1.mentorg.com Date: Mon, 02 Jul 2018 15:11:00 -0000 From: Joseph Myers To: Yury Norov CC: Florian Weimer , Subject: Re: [PATCH] Add renameat2 function [BZ #17662] In-Reply-To: <20180701214901.GA32498@yury-thinkpad> Message-ID: References: <20180630121447.E4C8643994575@oldenburg.str.redhat.com> <20180701214901.GA32498@yury-thinkpad> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-SW-Source: 2018-07/txt/msg00025.txt.bz2 On Mon, 2 Jul 2018, Yury Norov wrote: > I think this function should look like this (not tested): > > int > renameat2 (int oldfd, const char *old, int newfd, const char *new, > unsigned int flags) > { > # ifdef __NR_renameat2 > return INLINE_SYSCALL_CALL (renameat2, oldfd, old, newfd, new, flags); > # else > /* Try renameat if possible. */ That's obviously wrong; it would mean that if you start building glibc with newer kernel headers, it would not support a fallback, on older kernels used at runtime, that is supported when building with older kernel headers. It is always the case that building with newer kernel headers should not regress support for older kernels at runtime, and that if you have a fallback, it's __ASSUME_*, defined based on the --enable-kernel version, that is used to decide whether the fallback can be disabled. (Whether you should have a fallback at all is a case-by-case question depending on whether some or all cases of the API can be effectively emulated on older kernels. But the starting point for any API, certainly any API that is added to the OS-independent GNU API, is that the semantics of that API may be implemented in any convenient way, not necessarily by calling a directly corresponding syscall. See e.g. how all the *at functions originally had fallbacks using /proc until the minimum kernel version for glibc was recent enough to assume the syscalls to be present.) -- Joseph S. Myers joseph@codesourcery.com