Add kf_file_nlink field to kf_file and populate it
authorJiajie Chen <c@jia.je>
Mon, 23 Jan 2023 16:36:59 +0000 (00:36 +0800)
committerMateusz Guzik <mjg@FreeBSD.org>
Mon, 23 Jan 2023 17:09:52 +0000 (17:09 +0000)
commitdec7db49602df75119f6b57d32f1eb58e0040abc
tree5779fe7f53c654751e8615a4ce01a5a6f684f38e
parent8089749d38781946c008372f4016d69eee549f1c
Add kf_file_nlink field to kf_file and populate it

This will allow user-space programs (e.g. lsof) to locate deleted files
whose nlink equals zero. Prior to this commit, programs has to use
stat(kf_path) to get nlink, but that will fail if the file is deleted.

[mjg: s/fail/file in the commit message]

Reviewed by: mjg
Differential Revision:  https://reviews.freebsd.org/D38169
sys/kern/vfs_vnops.c
sys/sys/user.h