svn commit: r359865 - head/lib/libc/sys

Kyle Evans kevans at FreeBSD.org
Mon Apr 13 15:59:15 UTC 2020


Author: kevans
Date: Mon Apr 13 15:59:15 2020
New Revision: 359865
URL: https://svnweb.freebsd.org/changeset/base/359865

Log:
  libc: remove shm_open(2)'s compat fallback
  
  This had been introduced to ease any pain for using slightly older kernels
  with a newer libc, e.g., for bisecting a kernel across the introduction of
  shm_open2(2). 6 months has passed, retire the fallback and let shm_open()
  unconditionally call shm_open2().
  
  Stale includes are removed as well.

Modified:
  head/lib/libc/sys/shm_open.c

Modified: head/lib/libc/sys/shm_open.c
==============================================================================
--- head/lib/libc/sys/shm_open.c	Mon Apr 13 14:44:44 2020	(r359864)
+++ head/lib/libc/sys/shm_open.c	Mon Apr 13 15:59:15 2020	(r359865)
@@ -33,12 +33,10 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/types.h>
 #include <sys/mman.h>
-#include <sys/syscall.h>
 
 #include <errno.h>
 #include <fcntl.h>
 #include <limits.h>
-#include <unistd.h>
 #include <stdio.h>
 #include <string.h>
 
@@ -47,25 +45,13 @@ __FBSDID("$FreeBSD$");
 __weak_reference(shm_open, _shm_open);
 __weak_reference(shm_open, __sys_shm_open);
 
-#define	SHM_OPEN2_OSREL		1300048
-
 #define	MEMFD_NAME_PREFIX	"memfd:"
 
 int
 shm_open(const char *path, int flags, mode_t mode)
 {
 
-	if (__getosreldate() >= SHM_OPEN2_OSREL)
-		return (__sys_shm_open2(path, flags | O_CLOEXEC, mode, 0,
-		    NULL));
-
-	/*
-	 * Fallback to shm_open(2) on older kernels.  The kernel will enforce
-	 * O_CLOEXEC in this interface, unlike the newer shm_open2 which does
-	 * not enforce it.  The newer interface allows memfd_create(), for
-	 * instance, to not have CLOEXEC on the returned fd.
-	 */
-	return (syscall(SYS_freebsd12_shm_open, path, flags, mode));
+	return (__sys_shm_open2(path, flags | O_CLOEXEC, mode, 0, NULL));
 }
 
 /*


More information about the svn-src-head mailing list