From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) (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 EF79D138495 for ; Mon, 3 Jun 2024 18:27:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717439250; cv=none; b=n8HbTzxs/hFo3UjzOYyTk40c6lS2+6QIzSmDj8MD6DLwYLtFwv83SWeyi0AWfTOqOPTIswgpqP9AnOXx9euizXchC4McLp3PjLYxGNOSuwlQUNYhHsjlDzbGoDQg0dgqrRfP8w283zLmX9RqY5KG29vI252+7sC0YGKpQW+V9I0= 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.215.181 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="BSMO5vOY" Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-6c8c880f526so1453519a12.3 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=S6v1XDJ0HIb1eWwdrb6SuSZ3FyCLDuVViPmG2DjC0cCwDm89Z7UYqc85ma/md2a8if rqUrBFSeb9Dwo5jBfY4qSeNqkru32/rT0ObVNEUjutc2NpBOw68yDTTIkFPVehIFm79L mjc/JwG/z0CqT/0bz+gV+vNIhzWT6xPNubnm+NdQW8T8WSx/24CSTlu+qWy5C1z4kyd+ ZnEakKcWwjdO1A4p89YazyTBh41/FIQv/Zd3htXF8OzrCyGGaAgUl15fpBS9ETvO5/Rc 61+Ui0TqFoevK+DNhoFGAuZqfOWjmUR462GXcQEBeKglr8Y/vR3w92QKT+VRcHBqCGK+ scNg== X-Forwarded-Encrypted: i=1; AJvYcCU7RSKB+L2kX2HYvlEsUhCcgAsk9s+0iJXWsmiKsPhDcrECnAOQlvhwPMSSlHHTorFT4hc6HA/mmLrFUuqSnjOiyyX/sFLaOnz7 X-Gm-Message-State: AOJu0Yw6K5iNSY6deiEboaqpO7fjhFMI5YlTQ1XuYUzyXETl54zGawSK vyvUZEZHlmKOQ5ZRIsEOo5vnN7otHvjCZzeXR0TUXPtV7gNWZCeaueltWSlpig== X-Google-Smtp-Source: AGHT+IG9pOSZfsbyN0C6+FoYiF185CBi2wu43FjbL73OSlUP60i5AI74/j2vAb6zJ6bCnI6Vjzs60g== 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-api@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