Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 May 2019 12:27:45 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r348157 - head/sys/kern
Message-ID:  <201905231227.x4NCRjIK074011@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905231227.x4NCRjIK074011>