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
This commit is contained in:
Konstantin Belousov 2019-05-23 12:27:45 +00:00
parent bc2d137acb
commit e4b7754848

View File

@ -419,6 +419,7 @@ shm_stat(struct file *fp, struct stat *sb, struct ucred *active_cred,
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);
}