From patchwork Wed Mar 19 15:22:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 158 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx23.g.dreamhost.com (caibbdcaabja.dreamhost.com [208.113.200.190]) by wilcox.dreamhost.com (Postfix) with ESMTP id F2EFA3600D6 for ; Wed, 19 Mar 2014 08:22:23 -0700 (PDT) Received: by homiemail-mx23.g.dreamhost.com (Postfix, from userid 14307373) id 9247961C28C33; Wed, 19 Mar 2014 08:22:23 -0700 (PDT) X-Original-To: glibc@patchwork.siddhesh.in Delivered-To: x14307373@homiemail-mx23.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx23.g.dreamhost.com (Postfix) with ESMTPS id 6C5E761C79639 for ; Wed, 19 Mar 2014 08:22:23 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; q=dns; s=default; b=P0ocBXI3Na0J9L4Nr5mttGozP36JZ cMyPBX+8V3yi7h3PKlJHsFmqu2CN6q2QPapsyuCSM2ypUWQU8tNLY4UEvpka5n7X 2/U3qEwpzH1zT/PzfN5jLSuoeLNOwYmEzxNqa52sz/q0WC/KUiO723reUq71dPNv O2qIQ5ZsuhpJJo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:mime-version :content-type; s=default; bh=igAWiMrLFdN4/uyE7Ywz3543sjM=; b=KvH dbV/ZvshLMSCxTb0YTDF0ZUHR1bZUib9gCZPwkH0JNZuPI2YZKGvrryBjl0w8yRc gB4HnUBaHf5NcKKa4/e1HnRIfKjMJYC/i8O99jjn+bq6cJMmZpCdOAbVUK2RIsXe 0C2Vv+0IUW250/8PT9P3Me2qu8h0rpwBS737V2/0= Received: (qmail 10261 invoked by alias); 19 Mar 2014 15:22:20 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 10250 invoked by uid 89); 19 Mar 2014 15:22:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL, BAYES_00, LONGWORDS autolearn=no version=3.3.2 X-HELO: relay1.mentorg.com Date: Wed, 19 Mar 2014 15:22:11 +0000 From: "Joseph S. Myers" To: Subject: Fix futimesat for older MicroBlaze kernels (bug 16648) Message-ID: MIME-Version: 1.0 X-DH-Original-To: glibc@patchwork.siddhesh.in Continuing the fixes for __ASSUME_* issues in preparation for moving to a 2.6.32 minimum kernel version, this *untested* patch fixes bug 16648, the definition of __ASSUME_ATFCTS meaning that the futimesat syscall is assumed for all MicroBlaze kernels despite not being present until 2.6.33. __ASSUME_ATFCTS controls conditionals relating to a lot of different syscalls in Linux-specific code (fstatat64 faccessat fchmodat fchownat futimesat newfstatat linkat mkdirat openat readlinkat renameat symlinkat unlinkat mknodat), where whether newfstatat fstatat64 futimesat are used depends on the architecture, as well as controlling whether openat64_not_cancel_3 is expected to work in sysdeps/posix/getcwd.c. The assumptions are all OK as of 2.6.32 except for this MicroBlaze case, and it's generally desirable to get rid of as many of the __ASSUME_ATFCTS conditionals as possible, to simplify the code (the fallbacks include potential unbounded dynamic stack allocations). Thus, rather than the simplest approach of undefining __ASSUME_ATFCTS for older kernels on MicroBlaze, this patch takes the approach of using the linux-generic implementation of futimesat for MicroBlaze kernels before 2.6.33 (all such kernels have the utimensat syscall). 2014-03-19 Joseph Myers [BZ #16648] * sysdeps/unix/sysv/linux/microblaze/kernel-features.h [__LINUX_KERNEL_VERSION >= 0x020621] (__ASSUME_FUTIMESAT): Define. * sysdeps/unix/sysv/linux/microblaze/futimesat.c: New file. diff --git a/sysdeps/unix/sysv/linux/microblaze/futimesat.c b/sysdeps/unix/sysv/linux/microblaze/futimesat.c new file mode 100644 index 0000000..7037c04 --- /dev/null +++ b/sysdeps/unix/sysv/linux/microblaze/futimesat.c @@ -0,0 +1,30 @@ +/* Implement futimesat for MicroBlaze. + Copyright (C) 2014 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* MicroBlaze always had the utimensat syscall but gained the + futimesat syscall later, so use the linux-generic implementation of + futimesat in terms of the utimensat syscall unless the futimesat + syscall is known to be available. */ + +#include + +#ifdef __ASSUME_FUTIMESAT +# include +#else +# include +#endif diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h index f9a61a9..e7f6db2 100644 --- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h +++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h @@ -41,6 +41,11 @@ # define __ASSUME_SENDMMSG_SYSCALL 1 #endif +/* Support for the futimesat syscall was added in 2.6.33. */ +#if __LINUX_KERNEL_VERSION >= 0x020621 +# define __ASSUME_FUTIMESAT 1 +#endif + #include_next /* The MicroBlaze kernel does not support the pselect6, preadv and