mirror of
https://git.FreeBSD.org/src.git
synced 2026-06-02 11:24:32 +00:00
ntsync: add kinfo reporting
Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57038
This commit is contained in:
+44
-3
@@ -19,6 +19,7 @@
|
||||
#include <sys/proc.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/sysent.h>
|
||||
#include <sys/user.h>
|
||||
#include <dev/ntsync/ntsyncvar.h>
|
||||
|
||||
static struct cdev *ntsync_cdev;
|
||||
@@ -484,7 +485,19 @@ static int
|
||||
ntsync_sem_fill_kinfo(struct file *fp, struct kinfo_file *kif,
|
||||
struct filedesc *fdp)
|
||||
{
|
||||
// XXXKIB
|
||||
struct ntsync_obj *obj;
|
||||
struct ntsync_obj_sem *sem;
|
||||
|
||||
MPASS(fp->f_type == DTYPE_NTSYNC);
|
||||
obj = fp->f_data;
|
||||
MPASS(obj->type == NTSYNC_OBJ_SEM);
|
||||
sem = OBJ_TO_SEM(obj);
|
||||
|
||||
kif->kf_type = KF_TYPE_NTSYNC;
|
||||
kif->kf_un.kf_ntsync.kf_ntsync_type = KF_NTSYNC_TYPE_SEM;
|
||||
kif->kf_un.kf_ntsync.kf_ntsync_dev = (uintptr_t)obj->owner;
|
||||
kif->kf_un.kf_ntsync.kf_ntsync_un.kf_ntsync_sem.count = sem->a.count;
|
||||
kif->kf_un.kf_ntsync.kf_ntsync_un.kf_ntsync_sem.max = sem->a.max;
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -778,7 +791,21 @@ static int
|
||||
ntsync_mutex_fill_kinfo(struct file *fp, struct kinfo_file *kif,
|
||||
struct filedesc *fdp)
|
||||
{
|
||||
// XXXKIB
|
||||
struct ntsync_obj *obj;
|
||||
struct ntsync_obj_mutex *mutex;
|
||||
|
||||
MPASS(fp->f_type == DTYPE_NTSYNC);
|
||||
obj = fp->f_data;
|
||||
MPASS(obj->type == NTSYNC_OBJ_MUTEX);
|
||||
mutex = OBJ_TO_MUTEX(obj);
|
||||
|
||||
kif->kf_type = KF_TYPE_NTSYNC;
|
||||
kif->kf_un.kf_ntsync.kf_ntsync_type = KF_NTSYNC_TYPE_MUTEX;
|
||||
kif->kf_un.kf_ntsync.kf_ntsync_dev = (uintptr_t)obj->owner;
|
||||
kif->kf_un.kf_ntsync.kf_ntsync_un.kf_ntsync_mutex.owner =
|
||||
mutex->a.owner;
|
||||
kif->kf_un.kf_ntsync.kf_ntsync_un.kf_ntsync_mutex.count =
|
||||
mutex->a.count;
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -1053,7 +1080,21 @@ static int
|
||||
ntsync_event_fill_kinfo(struct file *fp, struct kinfo_file *kif,
|
||||
struct filedesc *fdp)
|
||||
{
|
||||
// XXXKIB
|
||||
struct ntsync_obj *obj;
|
||||
struct ntsync_obj_event *event;
|
||||
|
||||
MPASS(fp->f_type == DTYPE_NTSYNC);
|
||||
obj = fp->f_data;
|
||||
MPASS(obj->type == NTSYNC_OBJ_EVENT);
|
||||
event = OBJ_TO_EVENT(obj);
|
||||
|
||||
kif->kf_type = KF_TYPE_NTSYNC;
|
||||
kif->kf_un.kf_ntsync.kf_ntsync_type = KF_NTSYNC_TYPE_EVENT;
|
||||
kif->kf_un.kf_ntsync.kf_ntsync_dev = (uintptr_t)obj->owner;
|
||||
kif->kf_un.kf_ntsync.kf_ntsync_un.kf_ntsync_event.signaled =
|
||||
event->a.signaled;
|
||||
kif->kf_un.kf_ntsync.kf_ntsync_un.kf_ntsync_event.manual =
|
||||
event->a.manual;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
@@ -269,6 +269,7 @@ struct user {
|
||||
#define KF_TYPE_TIMERFD 14
|
||||
#define KF_TYPE_INOTIFY 15
|
||||
#define KF_TYPE_JAILDESC 16
|
||||
#define KF_TYPE_NTSYNC 17
|
||||
#define KF_TYPE_UNKNOWN 255
|
||||
|
||||
#define KF_VTYPE_VNON 0
|
||||
@@ -289,6 +290,11 @@ struct user {
|
||||
#define KF_FD_TYPE_TEXT -5 /* Text vnode */
|
||||
#define KF_FD_TYPE_CTTY -6 /* Controlling terminal */
|
||||
|
||||
#define KF_NTSYNC_TYPE_DEV 1 /* Not reported, reserved */
|
||||
#define KF_NTSYNC_TYPE_SEM 2
|
||||
#define KF_NTSYNC_TYPE_MUTEX 3
|
||||
#define KF_NTSYNC_TYPE_EVENT 4
|
||||
|
||||
#define KF_FLAG_READ 0x00000001
|
||||
#define KF_FLAG_WRITE 0x00000002
|
||||
#define KF_FLAG_APPEND 0x00000004
|
||||
@@ -467,6 +473,24 @@ struct kinfo_file {
|
||||
uint64_t kf_inotify_npending;
|
||||
uint64_t kf_inotify_nbpending;
|
||||
} kf_inotify;
|
||||
struct {
|
||||
uint32_t kf_ntsync_type;
|
||||
uint64_t kf_ntsync_dev;
|
||||
union {
|
||||
struct {
|
||||
uint32_t count;
|
||||
uint32_t max;
|
||||
} kf_ntsync_sem;
|
||||
struct{
|
||||
uint32_t owner;
|
||||
uint32_t count;
|
||||
} kf_ntsync_mutex;
|
||||
struct {
|
||||
uint32_t signaled;
|
||||
uint32_t manual;
|
||||
} kf_ntsync_event;
|
||||
} kf_ntsync_un;
|
||||
} kf_ntsync;
|
||||
} kf_un;
|
||||
};
|
||||
uint16_t kf_status; /* Status flags. */
|
||||
|
||||
Reference in New Issue
Block a user