From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x32.google.com (mail-oa1-x32.google.com [IPv6:2001:4860:4864:20::32]) by sourceware.org (Postfix) with ESMTPS id AB6E4383D807 for ; Wed, 11 May 2022 13:28:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AB6E4383D807 Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-e93bbb54f9so2749892fac.12 for ; Wed, 11 May 2022 06:28:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=A1GJqt5JA83n1csNwIljsYOHFfe0+wwHWjd0+1wRNtI=; b=XPXQE1NfuDx6WmSuBNq3ECFgFxEFKq/P/armMGyJomtb0+O8q+fBmR2BnZYb+WIYRX xL4KDcLbkArBJ1Rn7AZqGjBgTXo4Nvr232H9sGfrkIgW2PmBjmBaDQFyX9IiaLP8Q2mt S/+61sOqB1P10479AEvGYQxezxmBiilIMELMqBrIS93cehLufE0pIqQzYtA24dv9KnBv 6I9q+tv29oZb75fPIKR7ALva6NR8rnx5HKRSflbZ4Vca7mDFpPYZrVB6IujQHYyxTl26 2jucV7xkqGkY5vkvG/lX7zJIGIs9uRHBmem8O0TMoW+rhAlChHaiSL4hBuwlGbhCJFVm rZrA== X-Gm-Message-State: AOAM532cHWaAFJZlZud9rq3qtEXaSP4sFDbcDnXdGTjUXbma+D3rc0m8 KcHpAEJrG56+FnPDfggdAy0D3Ipe/5F/6A== X-Google-Smtp-Source: ABdhPJw/lto6sFcrmNEia2RU2OeHG5CgTf8zOay4FkabgVg3xKgkf+ba3Gm6F5US0APqHm4NxnpgMQ== X-Received: by 2002:a05:6870:819a:b0:ed:a1e8:9ade with SMTP id k26-20020a056870819a00b000eda1e89ademr2589353oae.248.1652275680481; Wed, 11 May 2022 06:28:00 -0700 (PDT) Received: from ?IPV6:2804:431:c7ca:5fbd:9d46:f0f6:e4b6:b83b? ([2804:431:c7ca:5fbd:9d46:f0f6:e4b6:b83b]) by smtp.gmail.com with ESMTPSA id c10-20020a056870478a00b000e686d13890sm541496oaq.42.2022.05.11.06.27.59 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 May 2022 06:27:59 -0700 (PDT) Message-ID: Date: Wed, 11 May 2022 10:27:57 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v4 09/13] LoongArch: Linux ABI Content-Language: en-US To: libc-alpha@sourceware.org References: <20220509022611.1248063-1-caiyinyu@loongson.cn> <20220509022611.1248063-10-caiyinyu@loongson.cn> From: Adhemerval Zanella In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2022 13:28:03 -0000 On 11/05/2022 04:08, Arnd Bergmann wrote: > On Mon, May 9, 2022 at 4:26 AM caiyinyu wrote: >> + >> +#include >> + >> +/* In 64-bit ISA files are always with 64bit off_t and F_*LK64 are the same as >> + non-64-bit versions. It will need to be revised for 128-bit. */ >> +#if __WORDSIZE == 64 >> +#define __O_LARGEFILE 0 >> + >> +#define F_GETLK64 5 /* Get record locking info. */ >> +#define F_SETLK64 6 /* Set record locking info (non-blocking). */ >> +#define F_SETLKW64 7 /* Set record locking info (blocking). */ >> +#endif >> + >> +struct flock >> +{ >> + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ >> + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ >> +#ifndef __USE_FILE_OFFSET64 >> + __off_t l_start; /* Offset where the lock begins. */ >> + __off_t l_len; /* Size of the locked area; zero means until EOF. */ >> +#else >> + __off64_t l_start; /* Offset where the lock begins. */ >> + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ >> +#endif >> + __pid_t l_pid; /* Process holding the lock. */ >> +}; >> + >> +#ifdef __USE_LARGEFILE64 >> +struct flock64 >> +{ >> + short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */ >> + short int l_whence; /* Where `l_start' is relative to (like `lseek'). */ >> + __off64_t l_start; /* Offset where the lock begins. */ >> + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ >> + __pid_t l_pid; /* Process holding the lock. */ >> +}; >> +#endif > > Not sure why these are provided here, the kernel has no loongarch64 specific > interface for flock in the current version, so either this refers to > an older version > of the kernel port, or it is something that could be generalized into an > architecture-independent file in glibc. Indeed this is a missing spot in Linux support, the generic sysdeps/unix/sysv/linux/bits/fcntl.h is just a #error stating each architecture should define its own. glibc does have a generic interface on generic subfolder, sysdeps/unix/sysv/linux/generic/bits/fcntl.h; however loongarch is not using it because it does not add the folder on sysdeps/unix/sysv/linux/loongarch/Implies. NIOS2, for instance, which as the original architecture that pushed for the generic folder (as a easier way to provide the new UAPI kernel definitions) has: $ cat ./sysdeps/unix/sysv/linux/nios2/Implies nios2/nptl unix/sysv/linux/generic/wordsize-32 unix/sysv/linux/generic Making loongarch use it will change some implementation selections, so it would require to check it it is ok for the architecture. My long term plan is to just remove the generic and subfolder to avoid this exact confusion.