svn commit: r348157 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Thu May 23 12:27:46 UTC 2019


Author: kib
Date: Thu May 23 12:27:45 2019
New Revision: 348157
URL: https://svnweb.freebsd.org/changeset/base/348157

Log:
  Report ref count of the backing object as st_nlink for posix shm fd.
  
  Unless there are transient references to the object, the ref count is
  equal to the number of the shared memory segment mappings plus one.
  
  Reviewed by:	jilles, tmunro
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week
  Differential revision:	https://reviews.freebsd.org/D20258

Modified:
  head/sys/kern/uipc_shm.c

Modified: head/sys/kern/uipc_shm.c
==============================================================================
--- head/sys/kern/uipc_shm.c	Thu May 23 12:25:03 2019	(r348156)
+++ head/sys/kern/uipc_shm.c	Thu May 23 12:27:45 2019	(r348157)
@@ -419,6 +419,7 @@ shm_stat(struct file *fp, struct stat *sb, struct ucre
 	mtx_unlock(&shm_timestamp_lock);
 	sb->st_dev = shm_dev_ino;
 	sb->st_ino = shmfd->shm_ino;
+	sb->st_nlink = shmfd->shm_object->ref_count;
 
 	return (0);
 }


More information about the svn-src-all mailing list