Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1145559lqj; Mon, 3 Jun 2024 11:27:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWqM4wHkZWQ4F4nFls7Tymfz49fGQlwqF2B1mdefgkylu1x8STWbhOojhCZh+GGoChY0KhRticOi7fVXGoAk6eKe6k563TTWqPsRhnt/w== X-Google-Smtp-Source: AGHT+IEmOQUClf0GxZUwoeqQ17FG0Hz574atwgxFf3rbTy7iPKXIjjUQlNeLiRoJUe8c6/Z8wxS0 X-Received: by 2002:a05:6358:5119:b0:186:1128:bca7 with SMTP id e5c5f4694b2df-19b48adae6dmr972778155d.6.1717439256909; Mon, 03 Jun 2024 11:27:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717439256; cv=pass; d=google.com; s=arc-20160816; b=C77lkY6eNJxyKMmFjQLMAApYCfCNq/pn1SwOz4U0XcaXbG6fUvQUL/G9GymXKJuT/T YiNnou2UWOLs0lUm1xwNuwI/giR/BHeBGPHKJf2QDU3v7KvebeNbGsxdQOsgKavk7zXi 7vJ57q5WDwXguE0BVAkzgqNSWklRLJlszn7pFytrDey+w0qsg+X7nPijUEpdrNcDi+wY +sfpA2u78WKpNWoQcoN/mkvCniFRV2wT7h2aEcMBXg1XCS2PNDV5HvJcUNwC1v14SuTH YwS0KCKqQCFFMCmpKCBgeetThZ1qNnsqeYEO7ML1DayMA9G/n2QEgvK1CVIbymJnJgcx AJqg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:message-id :subject:cc:to:from:date:dkim-signature; bh=ZQZ7pJhWzrnWrAArcMbWFf+ClUA0PNfqT/R1+wW2GPg=; fh=BeaWVbXotq1uHMGmIbyWj/c2pY39HGPtz6HGPW8fbeI=; b=tDaoqk/R+PnjSixcZhtuWJm3ZdHHBwL5Quw88eoeFjRb1rAmBovK9xmXHxwZojDdJn 0IEsl4afzIQr/JMOthMZHqmnQ05e9DFYqba8OWNHAfjnqDaoHAVLLCHhQmzFaFsh2Azv st60rof8k871HETu/TSq5mgKt+s5fMMoI7NWpClBexMTyQ+dbRuyuvZeXvNmc2aMezex zyFJCSboHLKeLQy8h5VFfCtC7gvZwHZw/qAbkfY+swFu2oh8l9VIydZyZLSput9H2dWy 5S+xQA0kv+SVD82QzL3He5lZfIeYdP0emI6gLkJdcvk459c/efWPPnY8YcRAAWJR7lTe kKig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=BSMO5vOY; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-199562-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199562-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c35c18092esi7126893a12.652.2024.06.03.11.27.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 11:27:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199562-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=BSMO5vOY; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-199562-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199562-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 43A20281E15 for ; Mon, 3 Jun 2024 18:27:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 031F71386B5; Mon, 3 Jun 2024 18:27:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="BSMO5vOY" Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC7A2132804 for ; Mon, 3 Jun 2024 18:27:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717439250; cv=none; b=OLENR2buCrEgrKbEStZDc7yh6HdTGTtasPa3bu+EHtm37db/nw7hNK9Zr9mwWEvyjvQ1OFQmhOAnQ9b5K2vRhSF4Ae/JpfiTGe7gyCp9bv+TX4PXgE8+FzLmncwcwJlRYwkVqmzwpePw9oc9P+OfllEc9C9WILu1RCUFX+20PtM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717439250; c=relaxed/simple; bh=a2ix+CxhqvYcsQIN8fnCjkHy/IPdu8haOIon0MmL5S8=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=JwCgP/2UmA9dgfFKUAMeKsF9VjmqsWUdlzdb3D8dADhHipagDJqfSVsE4fo6aDLl4+CDXX1WJGKm2riqN9w0dUAYzzdQjnSlc6sKIvCANJ9NiTdpHwZgSaAkIMV0743Duso1Mx2+9eZlLVoAcuBofGMIIwpH8IKJnrwpAN+CqPQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=BSMO5vOY; arc=none smtp.client-ip=209.85.210.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-70264bcb631so1297660b3a.2 for ; Mon, 03 Jun 2024 11:27:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717439248; x=1718044048; darn=vger.kernel.org; h=content-transfer-encoding:content-disposition:mime-version :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=ZQZ7pJhWzrnWrAArcMbWFf+ClUA0PNfqT/R1+wW2GPg=; b=BSMO5vOYCYPy5iQBI+Ghb2MyGAZh/JSRZpK5e/mZa0fY9T9j6YkixA+JURrKev7F+s /2hrLaampD4vpjnWNCZxTA6PZRSd8GfEK2VDB+fSl6ViN/ymY42iWhz+YRatBVKNZ2gP 1M5+ynpCLz2dEWj1Zd5uJddIxPosd9CLXG5sZyS5mSQW/zsio1/nKYaePAk6KzBCsXo/ 9RY2TeTKB8/KrqhGy2YL1hZrhzkmE4aY1sp9SA6Qq3Bkp1C1m/+s2zorVLo3WLqLNII7 9z3C86W1UqHYwJhFn7qAafwN1hNEsoUZCWZqZ0w/3ROm+qVHiUGwH7vftfC/4En/Qrg2 346g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717439248; x=1718044048; h=content-transfer-encoding:content-disposition:mime-version :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZQZ7pJhWzrnWrAArcMbWFf+ClUA0PNfqT/R1+wW2GPg=; b=AuSYg9H8EQzuUvXzS0k4TY4N9O1ipUExstP/D+nnzdE/c9s6ERYT+m8yjbtvJAOT2n 0x10FgaxS83SeJ+bsNLDQGHNPdwL5ByblIT1f+1QVPNMLzIo7rIfx52VSqqGjCw8RjYw bkvDKZ600iLfW3/JY4G2tPo1XdemXW3uTH48VLWfGeNX06d+HYgrj61YYuyzy0yAvItn qyVW8GJ3nTP9aTLA8MLU79+QBYAti7KwJSH23wSONZoNsC0g9vNl1kTXkYgAfEWrfpem 5z2MZ+4lbWoqd7DaZLmGb7Bw5eJB4lrf4cPLuw76X5PAV+ADB52WoOBnbxT7zSH6w7Lb Qb5Q== X-Forwarded-Encrypted: i=1; AJvYcCVcby/I55FxPlVNY5NxYVRq3uoAmFyWwHMiIlFU91iRNlZVTTSAnEuIzFEgC58u5PmydykYeDF1jjwDJsjm1nshzpwrlwX5p4+X6H8n X-Gm-Message-State: AOJu0YwQ+XholQ29ssjiyiHSymZhHRVHLEIz6gyBCkCDzI7jwrdZOA3Q ThbxFIaQ+7nyb5xLGpHHpnxgllcpQlph5njLJX0ATTJq8NSkmFoyuWWzDZ2m+g== X-Received: by 2002:a05:6a21:3393:b0:1b2:5e40:bc63 with SMTP id adf61e73a8af0-1b26f18577bmr10388643637.28.1717439247870; Mon, 03 Jun 2024 11:27:27 -0700 (PDT) Received: from google.com (226.75.127.34.bc.googleusercontent.com. [34.127.75.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-70259fe3e6asm3682729b3a.52.2024.06.03.11.27.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 11:27:27 -0700 (PDT) Date: Mon, 3 Jun 2024 18:27:23 +0000 From: Carlos Llamas To: linux-mm@kvack.org Cc: Mike Kravetz , Andi Kleen , Hugh Dickins , Edward Liaw , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org Subject: Header conflicts with shmget() and SHM_HUGE_2MB Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Hi, I'm trying to figure out how one would use SHM_HUGE_{2MB/1GB} defines through shmget() from userspace. After having a look at the man-pages I thought the #include pattern would be similar to that of mmap(), e.g.: #include #include [...] mmap(NULL, size, prot, flags | MAP_HUGETLB | MAP_HUGE_2MB, fd, 0); However, when doing the shmem equivalent with the headers I get several redefinition conflicts. When attempting to compile something like this: #include #include [...] shmid = shmget(key, size, flags | SHM_HUGETLB | SHM_HUGE_2MB); I run into the following type of issues: /usr/include/linux/shm.h:26:8: error: redefinition of ‘struct shmid_ds’ 26 | struct shmid_ds { | ^~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/bits/shm.h:45, from /usr/include/x86_64-linux-gnu/sys/shm.h:30: /usr/include/x86_64-linux-gnu/bits/types/struct_shmid_ds.h:24:8: note: originally defined here 24 | struct shmid_ds | ^~~~~~~~ I can see such definitions are tagged as "obsolete" in the uapi headers. Do we need some ifndef protection with the glibc headers? What is the advice to follow for userspace? Skip and openly redefine the SHM_HUGE_* wherever needed? Thanks, -- Carlos Llamas