From patchwork Sat Dec 16 01:45:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 849445 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-469405-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="QIe/3LuJ"; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 3yz9B66JHJz9s7m for ; Sat, 16 Dec 2017 12:46:03 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; q= dns; s=default; b=IU8FyDOIC4qWDt3OAT1iIP8MxF9L0Q0srn8L0MVrTWzyrM hm2/QhjQRkk8z4haR3tcXaH8rpPFy2Y3mHMxBBsNyG1FXXe2PxNR48dRSnR34rw2 Ar3IN4DPDqvACbKGFrq4YQ8KHUuv16fg0A2VEzsSTVeEoi7PmeuYjtN9UWl4w= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:from:date:message-id:subject:to:content-type; s= default; bh=zls1Xy5dzC1MrrLBbQSHL4+OmAs=; b=QIe/3LuJZdjZAVjXrTUu u0MKi0yl66Cax1GD7uVtnAjQqag7UIXb3DZZgxhRg5UY1GGa3+JVtszGXAEnq5VX YtbBuWRbJJWCW0GTUvA4qhCHFpYBKt5UKXt1bby3XPoC2z4dN47BQadumY76+38k aB7emi8ESjq+hBuRwCP3PLA= Received: (qmail 51658 invoked by alias); 16 Dec 2017 01:45:54 -0000 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 Received: (qmail 51638 invoked by uid 89); 16 Dec 2017 01:45:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f41.google.com Received: from mail-wm0-f41.google.com (HELO mail-wm0-f41.google.com) (74.125.82.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 16 Dec 2017 01:45:52 +0000 Received: by mail-wm0-f41.google.com with SMTP id y82so245606wmg.1 for ; Fri, 15 Dec 2017 17:45:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Qgs1irKkM7QhOvZuMNkJyOIxywtd9On2+U977xXGbUQ=; b=SVo+BV04gpdrObtOhRuABko9Qasm12IYWU2xIzjldXh4gzPXy0hPt5BBgAdH++L81V LOaCTCpZGJXhgP4z/ou5wLbFzrbGxwVlkDXwEa2t3pA6Q6ciZpx0Xz4uom4Py5QIhRan S+be7fubA9OS2A8O0tfihCSucY9JJQ9qcuNIGk4ofmL/JKpHFkdaXPffmn7Rzjrrk1tS iYJJdlT6zpG2lrvGKaHYE5wemOO2gcWDCfQzN+9MXG8h5faDh1rP8c10QnltSRpp59JV U8ht52zgDvGuWYkPW1a6JBZVCSuUIOGORwJ2NRC9yOA39UORyQ8izr32DqXa4W5wuOmv La6w== X-Gm-Message-State: AKGB3mK8kvrXQphHvmU8Mebf6LU9/pxKVXQ946haeN10DZvBpsX0yj+Z 9ODglzuLmrdNue+y9nkTu1kWQfgpuV5YhU1vU8YLRA== X-Google-Smtp-Source: ACJfBouyV0ob+1UNUoDTOlUIPSE+VU85Od0DeOOUHHMVRWD4ly0LzzgRJRahb9c6TVTmrNJJfUdDUf0ZmPoEwGQsLKw= X-Received: by 10.80.135.26 with SMTP id i26mr19509140edb.31.1513388749885; Fri, 15 Dec 2017 17:45:49 -0800 (PST) MIME-Version: 1.0 Received: by 10.80.179.221 with HTTP; Fri, 15 Dec 2017 17:45:47 -0800 (PST) From: Ian Lance Taylor Date: Fri, 15 Dec 2017 17:45:47 -0800 Message-ID: Subject: libgo patch committed: emulate Flock on AIX To: gcc-patches , gofrontend-dev@googlegroups.com This patch by Tony Reix adds an emulation of the Flock call to libgo's syscall package on AIX. Committed to mainline. Ian Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 255666) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -c02de8ca63f52a2475ce8645edee3203a3c908ac +d1f90c9b77baca5c33a398ab844fb4440c6a5ee7 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: libgo/go/syscall/libcall_aix.go =================================================================== --- libgo/go/syscall/libcall_aix.go (revision 255666) +++ libgo/go/syscall/libcall_aix.go (working copy) @@ -111,6 +111,28 @@ func Reboot(how int) (err error) { //sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) //fchownat(dirfd _C_int, path *byte, owner Uid_t, group Gid_t, flags _C_int) _C_int +// On AIX, there is no flock() system call, we emulate it. +func Flock(fd int, op int) (err error) { + lk := &Flock_t{} + if (op & LOCK_UN) != 0 { + lk.Type = F_UNLCK + } else if (op & LOCK_EX) != 0 { + lk.Type = F_WRLCK + } else if (op & LOCK_SH) != 0 { + lk.Type = F_RDLCK + } else { + return nil + } + if (op & LOCK_NB) != 0 { + err = FcntlFlock(uintptr(fd), F_SETLK, lk) + if err != nil && (err == EAGAIN || err == EACCES) { + return EWOULDBLOCK + } + return err + } + return FcntlFlock(uintptr(fd), F_SETLKW, lk) +} + //sys Fstatfs(fd int, buf *Statfs_t) (err error) //fstatfs64(fd _C_int, buf *Statfs_t) _C_int