From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 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 dcvr.yhbt.net (Postfix) with ESMTPS id A70DE1F463 for ; Tue, 31 Dec 2019 15:50:31 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=UQOnDK+janvMC7Az 1InunzA7WtrirQiJGpDgZdABSThSfP1ZorMLc73BKQXALgBBFR3bMlsX8wAtfDH5 OfKBSlSJY42UD7tt7OrQENDAQp+ZgFxjh7uSUoI8J2UtoPxbBXEJO7HliOEgXS3g uY3fb4UrzuNusSREGsnGBvsYRfY= 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:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=4Sf7ztN0Yc5RZKIf4ecRKo bwCPM=; b=dMp6/mLnuNwDF+WYgDBIO572qwY5ewDGHAQALKeYLYyCrhqblCqrJV y+5JPvnwFOHG+iLfYIaahfdJyzsOdFmJa+wGl7yjQuraqJnHssEExLBrjh5m4RRe i5j1ohH4SlPnyYsSN/KNo1iphP6Eul5R97Tklvo1rs1sY/WiORUbY= Received: (qmail 100874 invoked by alias); 31 Dec 2019 15:50:29 -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 Received: (qmail 100866 invoked by uid 89); 31 Dec 2019 15:50:29 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: caracal.birch.relay.mailchannels.net X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Wide-Eyed-Relation: 708bd47d1b2e7ec4_1577807425401_3321061275 X-MC-Loop-Signature: 1577807425400:2360521792 X-MC-Ingress-Time: 1577807425400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gotplt.org; h=subject:to :cc:references:from:message-id:date:mime-version:in-reply-to :content-type:content-transfer-encoding; s=gotplt.org; bh=4Sf7zt N0Yc5RZKIf4ecRKobwCPM=; b=h6GBw3BGI+lVeF+SXf4NCL4rfTe5rKS1BSUOx7 2OKc5c5cBbmHVApipUJKKesMdWC0MDlRtL2wBg6ROPjrswsg/ww3spRJ7wHyrJhR jpcypQSxZsPb8XbEIrlS/Js2w2BFSNItebuiD56xFQa2IK+BPLuDHAXo9O7owMCw Nx6X8= Subject: Re: [PATCH 1/5] Linux: Add tables with system call numbers To: Florian Weimer Cc: libc-alpha@sourceware.org References: <56247f60-bee7-9624-37bf-1453c06c7088@gotplt.org> <87zhf8n3j4.fsf@mid.deneb.enyo.de> X-DH-BACKEND: pdx1-sub0-mail-a23 From: Siddhesh Poyarekar Message-ID: <0b6f5557-e67f-b92f-269d-163c8df2d3c8@gotplt.org> Date: Tue, 31 Dec 2019 21:20:13 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <87zhf8n3j4.fsf@mid.deneb.enyo.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrvdefjedgjeekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefjeenucfhrhhomhepufhiugguhhgvshhhucfrohihrghrvghkrghruceoshhiugguhhgvshhhsehgohhtphhlthdrohhrgheqnecukfhppedutdeirddvtdeirdejjedrudegvdenucfrrghrrghmpehmohguvgepshhmthhppdhhvghloheplgduledvrdduieekrdegfedrudeiiegnpdhinhgvthepuddtiedrvddtiedrjeejrddugedvpdhrvghtuhhrnhdqphgrthhhpefuihguughhvghshhcurfhohigrrhgvkhgrrhcuoehsihguughhvghshhesghhothhplhhtrdhorhhgqedpmhgrihhlfhhrohhmpehsihguughhvghshhesghhothhplhhtrdhorhhgpdhnrhgtphhtthhopehffiesuggvnhgvsgdrvghnhihordguvgenucevlhhushhtvghrufhiiigvpedt On 31/12/19 4:52 pm, Florian Weimer wrote: >> Prefix the auto-generated files with a comment header like so: >> >> /* AUTOGENERATED by update-syscall-lists.py. DO NOT EDIT. */ > > I'm concerned that this unnecessarily makes processing by tools more > difficult, so I'd like to avoid this. The tools only need to filter out \/\*.*\*\/ (or een simpler, omit the first line if it's just for these files) which shouldn't be more than a line or two of code. Do you see any other challenges here? It's a very useful comment IMO and definitely worth the extra line of code one would have to add to omit comments or even the first line. > I copied the linux_kernel_version function from > sysdeps/unix/sysv/linux/tst-mman-consts.py, which is why I kept the > 2018 year. OK. >>> + # Merge the architecture-specific system call names into the >>> + # global names list, syscall-names.list. This file contains names >>> + # from other architectures (and comments), so it is necessary to >>> + # merge the existing files with the names obtained from the >>> + # kernel. >>> + with open(args.names_list, "r+") as list_file: >>> + os.lockf(list_file.fileno(), os.F_LOCK, 0) >>> + names_list = glibcsyscalls.SyscallNamesList(list_file) >>> + merged = names_list.merge(kernel_constants.keys()) >>> + list_file.truncate() >>> + list_file.seek(0) >>> + for line in merged: >>> + list_file.write(line) >> >> I think the cleaner way would be to write out the output as a temp first >> and then rename over the old file. This ought to replicate what we do >> in Makefiles. > > But we need locking if this is used from build-many-glibcs.py, > otherwise we'll lose updates even with the rename approach. Locking > the file being updated is the easiest way to achieve this. It's true > that we have data loss if the script is terminated between the > truncate and seek, but most editors have the same issue. Therefore, I > want to leave this as-is. It would be nice to make build-many-glibcs.py smarter about this. The problem with locking seems limited to syscall-names.list and not arch-syscalls.h since the latter ought to be different files for build-many-glibcs, right? I don't want to hold up this patchset for it, but want to make sure we at least fully understand and document the limitations for posterity. > New patch below. Commit message is unchanged. > Rest looks OK, so lets find common ground on the above two points. Siddhesh