? sys/miscfs/procfs/ChangeLog
? sys/miscfs/procfs/vi.core
Index: sys/miscfs/procfs/procfs.h
===================================================================
RCS file: /cvsroot/src/sys/miscfs/procfs/procfs.h,v
retrieving revision 1.75
diff -p -u -r1.75 procfs.h
--- sys/miscfs/procfs/procfs.h	30 Mar 2019 23:28:30 -0000	1.75
+++ sys/miscfs/procfs/procfs.h	25 Apr 2019 20:46:45 -0000
@@ -115,6 +115,7 @@ typedef enum {
 #ifdef __HAVE_PROCFS_MACHDEP
 	PROCFS_MACHDEP_NODE_TYPES
 #endif
+	PFSlast,	/* track number of types */
 } pfstype;
 
 /*
@@ -163,11 +164,14 @@ struct procfs_args {
 
 #define UIO_MX 32
 
+#define PROCFS_FDLAST 2048
 #define PROCFS_FILENO(pid, type, fd) \
-    (((type) < PFSproc) ? ((type) + 2) : \
-	(((fd) == -1) ? ((((pid)+1) << 5) + ((int) (type))) : \
-	((((pid)+1) << 16) | ((fd) << 5) | ((int) (type)))))
-#define PROCFS_TYPE(type)	((type) & 0x1f)
+	(  (type) == PFSroot ? 2 \
+	 : (type) == PFScurproc ? 3 \
+	 : (type) == PFSself ? 4 \
+         : (fd) == -1 ? ((pid)+1) * PFSlast + (type) \
+         : (((pid)+1) * PROCFS_FDLAST + (fd)) * PFSlast + (type))
+#define PROCFS_TYPE(type)	((type) % PFSlast)
 
 struct procfsmount {
 	void *pmnt_exechook;
