From patchwork Sat Feb 18 01:22:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 142028 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id A50E1B6F62 for ; Sat, 18 Feb 2012 12:22:27 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1330132948; h=Comment: DomainKey-Signature:Received:Received:Received:Received: Received-SPF:Received:Received:Received:Received:From:To:Subject: Date:Message-ID:User-Agent:MIME-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=7IREHmOAfmMVgqe2aUPr i5vFp0Q=; b=yGdJeGtW1ayXKF2eMwqpPsxYd3ZhZK14SIi2oUntWcHmzcHyOtQ3 wGcwelbsHerpw8lh69y/nDVdjNOyUJhv9NkAD63GRlYJjkaqOmzWM217YZisEvGw FBLoTj0qp2Cg7v/56JxDxRpKWeQc2Ia8l2dcsnszgPnMhZcLMKR77As= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received-SPF:Authentication-Results:Received:Received:Received:Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=nxk4g/1VEGbYVNG8zhr4np6k/wTBnXhjfG7fp0NXLZtxW/FDUOUyAc62h4hxPg pnpza0Xe6s7qMaEN8PzYMQQljGUwhVl7//FXKL5FLCFCS/nSEjEzbNTeT6Q85QaI 5aWcfpAuyihVD6/2np47wueFxVHP9eGpsMWREQapP5+Gg=; Received: (qmail 10540 invoked by alias); 18 Feb 2012 01:22:24 -0000 Received: (qmail 10531 invoked by uid 22791); 18 Feb 2012 01:22:23 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, TW_MK, T_FRT_FREE, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mail-pz0-f47.google.com (HELO mail-pz0-f47.google.com) (209.85.210.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 18 Feb 2012 01:22:08 +0000 Received: by daln34 with SMTP id n34so3775986dal.20 for ; Fri, 17 Feb 2012 17:22:08 -0800 (PST) Received-SPF: pass (google.com: domain of iant@google.com designates 10.68.223.68 as permitted sender) client-ip=10.68.223.68; Authentication-Results: mr.google.com; spf=pass (google.com: domain of iant@google.com designates 10.68.223.68 as permitted sender) smtp.mail=iant@google.com; dkim=pass header.i=iant@google.com Received: from mr.google.com ([10.68.223.68]) by 10.68.223.68 with SMTP id qs4mr36123065pbc.112.1329528128276 (num_hops = 1); Fri, 17 Feb 2012 17:22:08 -0800 (PST) Received: by 10.68.223.68 with SMTP id qs4mr29182294pbc.112.1329528128227; Fri, 17 Feb 2012 17:22:08 -0800 (PST) Received: by 10.68.223.68 with SMTP id qs4mr29182271pbc.112.1329528128098; Fri, 17 Feb 2012 17:22:08 -0800 (PST) Received: from coign.google.com ([67.218.103.10]) by mx.google.com with ESMTPS id b4sm18099365pbc.7.2012.02.17.17.22.06 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 17 Feb 2012 17:22:07 -0800 (PST) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: libgo patch committed: Add mount flags, fallocate, statfs. Date: Fri, 17 Feb 2012 17:22:04 -0800 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQkElP96EbVcpbVGrKP32c2//+sy79FHeEOP9BkVCPqMVPMsYSJyJI1jeT1B7R+3/Jq5yavGha5AiaWHNAEBfkVd6T6Iai983MxX0b9TkdPc9kwfcue52R+iGZRrUdbXHkmWVG2i5Iqu+AqQyHxtYuw2karnEYD1HDDrU0AqG5MUKCRjOv8= X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch to libgo adds the mount flags, the GNU/Linux specific fallocate function, and the GNU/Linux version of the statfs function. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r 2b6e531380f6 libgo/configure.ac --- a/libgo/configure.ac Fri Feb 17 16:42:08 2012 -0800 +++ b/libgo/configure.ac Fri Feb 17 17:12:38 2012 -0800 @@ -453,7 +453,7 @@ ;; esac -AC_CHECK_HEADERS(sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h sys/prctl.h) +AC_CHECK_HEADERS(sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h) AC_CHECK_HEADERS([linux/filter.h linux/netlink.h linux/rtnetlink.h], [], [], [#ifdef HAVE_SYS_SOCKET_H @@ -467,7 +467,8 @@ AM_CONDITIONAL(HAVE_STRERROR_R, test "$ac_cv_func_strerror_r" = yes) AM_CONDITIONAL(HAVE_WAIT4, test "$ac_cv_func_wait4" = yes) -AC_CHECK_FUNCS(epoll_create1 faccessat fchmodat fchownat futimesat inotify_add_watch inotify_init inotify_rm_watch mkdirat mknodat openat renameat splice tee unlinkat unshare) +AC_CHECK_FUNCS(epoll_create1 faccessat fallocate fchmodat fchownat futimesat inotify_add_watch inotify_init inotify_rm_watch mkdirat mknodat openat renameat splice tee unlinkat unshare) +AC_TYPE_OFF_T AC_CHECK_TYPES([loff_t]) CFLAGS_hold="$CFLAGS" diff -r 2b6e531380f6 libgo/go/syscall/libcall_linux.go --- a/libgo/go/syscall/libcall_linux.go Fri Feb 17 16:42:08 2012 -0800 +++ b/libgo/go/syscall/libcall_linux.go Fri Feb 17 17:12:38 2012 -0800 @@ -178,9 +178,8 @@ //sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error) //faccessat(dirfd int, pathname *byte, mode int, flags int) int -// FIXME: Only in glibc 2.10 and later. -// //sys Fallocate(fd int, mode uint32, off int64, len int64) (err error) -// //fallocate(fd int, mode int, offset Offset_t, len Offset_t) int +//sys Fallocate(fd int, mode uint32, off int64, len int64) (err error) +//fallocate(fd int, mode int, offset Offset_t, len Offset_t) int //sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) //fchmodat(dirfd int, pathname *byte, mode Mode_t, flags int) int @@ -191,9 +190,8 @@ //sys Flock(fd int, how int) (err error) //flock(fd int, how int) int -// FIXME: mksysinfo statfs -// //sys Fstatfs(fd int, buf *Statfs_t) (err error) -// //fstatfs(fd int, buf *Statfs_t) int +//sys Fstatfs(fd int, buf *Statfs_t) (err error) +//fstatfs(fd int, buf *Statfs_t) int func Gettid() (tid int) { r1, _, _ := Syscall(SYS_GETTID, 0, 0, 0) @@ -283,9 +281,8 @@ return } -// FIXME: mksysinfo statfs -// //sys Statfs(path string, buf *Statfs_t) (err error) -// //statfs(path *byte, buf *Statfs_t) int +//sys Statfs(path string, buf *Statfs_t) (err error) +//statfs(path *byte, buf *Statfs_t) int // FIXME: Only in glibc 2.6 and later. // //sys SyncFileRange(fd int, off int64, n int64, flags int) (err error) diff -r 2b6e531380f6 libgo/mksysinfo.sh --- a/libgo/mksysinfo.sh Fri Feb 17 16:42:08 2012 -0800 +++ b/libgo/mksysinfo.sh Fri Feb 17 17:12:38 2012 -0800 @@ -93,6 +93,15 @@ #if defined(HAVE_NET_IF_H) #include #endif +#if defined(HAVE_SYS_MOUNT_H) +#include +#endif +#if defined(HAVE_SYS_VFS_H) +#include +#endif +#if defined(HAVE_STATFS_H) +#include +#endif /* Constants that may only be defined as expressions on some systems, expressions too complex for -fdump-go-spec to handle. These are @@ -766,4 +775,35 @@ sed -e 's/^\(const \)_\([^=]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} done +# The mount flags +grep '^const _MS_' gen-sysinfo.go | + sed -e 's/^\(const \)_\(MS_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} + +# The fallocate flags. +grep '^const _FALLOC_' gen-sysinfo.go | + sed -e 's/^\(const \)_\(FALLOC_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} + +# The statfs struct. +# Prefer largefile variant if available. +statfs=`grep '^type _statfs64 ' gen-sysinfo.go || true` +if test "$statfs" != ""; then + grep '^type _statfs64 ' gen-sysinfo.go +else + grep '^type _statfs ' gen-sysinfo.go +fi | sed -e 's/type _statfs64/type Statfs_t/' \ + -e 's/type _statfs/type Statfs_t/' \ + -e 's/f_type/Type/' \ + -e 's/f_bsize/Bsize/' \ + -e 's/f_blocks/Blocks/' \ + -e 's/f_bfree/Bfree/' \ + -e 's/f_bavail/Bavail/' \ + -e 's/f_files/Files/' \ + -e 's/f_ffree/Ffree/' \ + -e 's/f_fsid/Fsid/' \ + -e 's/f_namelen/Namelen/' \ + -e 's/f_frsize/Frsize/' \ + -e 's/f_flags/Flags/' \ + -e 's/f_spare/Spare/' \ + >> ${OUT} + exit $? diff -r 2b6e531380f6 libgo/runtime/go-nosys.c --- a/libgo/runtime/go-nosys.c Fri Feb 17 16:42:08 2012 -0800 +++ b/libgo/runtime/go-nosys.c Fri Feb 17 17:12:38 2012 -0800 @@ -48,6 +48,18 @@ } #endif +#ifndef HAVE_FALLOCATE +int +fallocate (int fd __attribute__ ((unused)), + int mode __attribute__ ((unused)), + off_t offset __attribute __ ((unused)), + off_t len __attribute__ ((unused))) +{ + errno = ENOSYS; + return -1; +} +#endif + #ifndef HAVE_FCHMODAT int fchmodat (int dirfd __attribute__ ((unused)),