svn commit: r276111 - in projects/ino64/sys: compat/freebsd32 kern sys
Gleb Kurtsou
gleb at FreeBSD.org
Tue Dec 23 08:10:07 UTC 2014
Author: gleb
Date: Tue Dec 23 08:10:03 2014
New Revision: 276111
URL: https://svnweb.freebsd.org/changeset/base/276111
Log:
Kernel compat shims for kinfo_proc and kinfo_file
Modified:
projects/ino64/sys/compat/freebsd32/freebsd32.h
projects/ino64/sys/kern/kern_descrip.c
projects/ino64/sys/kern/kern_proc.c
projects/ino64/sys/kern/sys_socket.c
projects/ino64/sys/kern/tty_pts.c
projects/ino64/sys/kern/uipc_sem.c
projects/ino64/sys/kern/uipc_shm.c
projects/ino64/sys/kern/vfs_vnops.c
projects/ino64/sys/sys/user.h
Modified: projects/ino64/sys/compat/freebsd32/freebsd32.h
==============================================================================
--- projects/ino64/sys/compat/freebsd32/freebsd32.h Tue Dec 23 08:10:00 2014 (r276110)
+++ projects/ino64/sys/compat/freebsd32/freebsd32.h Tue Dec 23 08:10:03 2014 (r276111)
@@ -317,7 +317,7 @@ struct kinfo_proc32 {
pid_t ki_tsid;
short ki_jobc;
short ki_spare_short1;
- dev_t ki_tdev;
+ uint32_t ki_tdev_freebsd10;
sigset_t ki_siglist;
sigset_t ki_sigmask;
sigset_t ki_sigignore;
@@ -364,6 +364,7 @@ struct kinfo_proc32 {
char ki_loginclass[LOGINCLASSLEN+1];
char ki_sparestrings[50];
int ki_spareints[KI_NSPARE_INT];
+ uint64_t ki_tdev;
int ki_oncpu;
int ki_lastcpu;
int ki_tracer;
Modified: projects/ino64/sys/kern/kern_descrip.c
==============================================================================
--- projects/ino64/sys/kern/kern_descrip.c Tue Dec 23 08:10:00 2014 (r276110)
+++ projects/ino64/sys/kern/kern_descrip.c Tue Dec 23 08:10:03 2014 (r276111)
@@ -3301,8 +3301,13 @@ kinfo_to_okinfo(struct kinfo_file *kif,
okif->kf_sock_type = kif->kf_sock_type;
okif->kf_sock_protocol = kif->kf_sock_protocol;
strlcpy(okif->kf_path, kif->kf_path, sizeof(okif->kf_path));
- okif->kf_sa_local = kif->kf_sa_local;
- okif->kf_sa_peer = kif->kf_sa_peer;
+ if (kif->kf_type == KF_TYPE_SOCKET) {
+ okif->kf_sa_local = kif->kf_un.kf_sock.kf_sa_local;
+ okif->kf_sa_peer = kif->kf_un.kf_sock.kf_sa_peer;
+ } else {
+ okif->kf_sa_local.ss_family = AF_UNSPEC;
+ okif->kf_sa_peer.ss_family = AF_UNSPEC;
+ }
}
static int
Modified: projects/ino64/sys/kern/kern_proc.c
==============================================================================
--- projects/ino64/sys/kern/kern_proc.c Tue Dec 23 08:10:00 2014 (r276110)
+++ projects/ino64/sys/kern/kern_proc.c Tue Dec 23 08:10:03 2014 (r276111)
@@ -910,11 +910,14 @@ fill_kinfo_proc_only(struct proc *p, str
}
if ((p->p_flag & P_CONTROLT) && tp != NULL) {
kp->ki_tdev = tty_udev(tp);
+ kp->ki_tdev_freebsd10 = kp->ki_tdev; /* truncate */
kp->ki_tpgid = tp->t_pgrp ? tp->t_pgrp->pg_id : NO_PID;
if (tp->t_session)
kp->ki_tsid = tp->t_session->s_sid;
- } else
+ } else {
kp->ki_tdev = NODEV;
+ kp->ki_tdev_freebsd10 = kp->ki_tdev; /* truncate */
+ }
if (p->p_comm[0] != '\0')
strlcpy(kp->ki_comm, p->p_comm, sizeof(kp->ki_comm));
if (p->p_sysent && p->p_sysent->sv_name != NULL &&
@@ -1149,6 +1152,7 @@ freebsd32_kinfo_proc_out(const struct ki
CP(*ki, *ki32, ki_tsid);
CP(*ki, *ki32, ki_jobc);
CP(*ki, *ki32, ki_tdev);
+ CP(*ki, *ki32, ki_tdev_freebsd10);
CP(*ki, *ki32, ki_siglist);
CP(*ki, *ki32, ki_sigmask);
CP(*ki, *ki32, ki_sigignore);
@@ -2141,6 +2145,7 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A
vn_lock(vp, LK_SHARED | LK_RETRY);
if (VOP_GETATTR(vp, &va, cred) == 0) {
kve->kve_fileid = va.va_fileid;
+ /* truncate */
kve->kve_fsid = va.va_fsid;
}
vput(vp);
@@ -2372,10 +2377,16 @@ kern_proc_vmmap_out(struct proc *p, stru
if (VOP_GETATTR(vp, &va, cred) == 0) {
kve->kve_vn_fileid = va.va_fileid;
kve->kve_vn_fsid = va.va_fsid;
+ kve->kve_vn_fsid_freebsd10 =
+ kve->kve_vn_fsid; /* truncate */
kve->kve_vn_mode =
MAKEIMODE(va.va_type, va.va_mode);
+ kve->kve_vn_mode_freebsd10 =
+ kve->kve_vn_mode; /* truncate */
kve->kve_vn_size = va.va_size;
kve->kve_vn_rdev = va.va_rdev;
+ kve->kve_vn_rdev_freebsd10 =
+ kve->kve_vn_rdev; /* truncate */
kve->kve_status = KF_ATTR_VALID;
}
vput(vp);
Modified: projects/ino64/sys/kern/sys_socket.c
==============================================================================
--- projects/ino64/sys/kern/sys_socket.c Tue Dec 23 08:10:00 2014 (r276110)
+++ projects/ino64/sys/kern/sys_socket.c Tue Dec 23 08:10:03 2014 (r276111)
@@ -350,13 +350,15 @@ soo_fill_kinfo(struct file *fp, struct k
break;
}
error = so->so_proto->pr_usrreqs->pru_sockaddr(so, &sa);
- if (error == 0 && sa->sa_len <= sizeof(kif->kf_sa_local)) {
- bcopy(sa, &kif->kf_sa_local, sa->sa_len);
+ if (error == 0 &&
+ sa->sa_len <= sizeof(kif->kf_un.kf_sock.kf_sa_local)) {
+ bcopy(sa, &kif->kf_un.kf_sock.kf_sa_local, sa->sa_len);
free(sa, M_SONAME);
}
error = so->so_proto->pr_usrreqs->pru_peeraddr(so, &sa);
- if (error == 0 && sa->sa_len <= sizeof(kif->kf_sa_peer)) {
- bcopy(sa, &kif->kf_sa_peer, sa->sa_len);
+ if (error == 0 &&
+ sa->sa_len <= sizeof(kif->kf_un.kf_sock.kf_sa_peer)) {
+ bcopy(sa, &kif->kf_un.kf_sock.kf_sa_peer, sa->sa_len);
free(sa, M_SONAME);
}
strncpy(kif->kf_path, so->so_proto->pr_domain->dom_name,
Modified: projects/ino64/sys/kern/tty_pts.c
==============================================================================
--- projects/ino64/sys/kern/tty_pts.c Tue Dec 23 08:10:00 2014 (r276110)
+++ projects/ino64/sys/kern/tty_pts.c Tue Dec 23 08:10:03 2014 (r276111)
@@ -592,6 +592,8 @@ ptsdev_fill_kinfo(struct file *fp, struc
kif->kf_type = KF_TYPE_PTS;
tp = fp->f_data;
kif->kf_un.kf_pts.kf_pts_dev = tty_udev(tp);
+ kif->kf_un.kf_pts.kf_pts_dev_freebsd10 =
+ kif->kf_un.kf_pts.kf_pts_dev; /* truncate */
strlcpy(kif->kf_path, tty_devname(tp), sizeof(kif->kf_path));
return (0);
}
Modified: projects/ino64/sys/kern/uipc_sem.c
==============================================================================
--- projects/ino64/sys/kern/uipc_sem.c Tue Dec 23 08:10:00 2014 (r276110)
+++ projects/ino64/sys/kern/uipc_sem.c Tue Dec 23 08:10:03 2014 (r276111)
@@ -265,6 +265,8 @@ ksem_fill_kinfo(struct file *fp, struct
mtx_lock(&sem_lock);
kif->kf_un.kf_sem.kf_sem_value = ks->ks_value;
kif->kf_un.kf_sem.kf_sem_mode = S_IFREG | ks->ks_mode; /* XXX */
+ kif->kf_un.kf_sem.kf_sem_mode_freebsd10 =
+ kif->kf_un.kf_sem.kf_sem_mode; /* truncate */
mtx_unlock(&sem_lock);
if (ks->ks_path != NULL) {
sx_slock(&ksem_dict_lock);
Modified: projects/ino64/sys/kern/uipc_shm.c
==============================================================================
--- projects/ino64/sys/kern/uipc_shm.c Tue Dec 23 08:10:00 2014 (r276110)
+++ projects/ino64/sys/kern/uipc_shm.c Tue Dec 23 08:10:03 2014 (r276111)
@@ -1035,6 +1035,8 @@ shm_fill_kinfo(struct file *fp, struct k
mtx_lock(&shm_timestamp_lock);
kif->kf_un.kf_file.kf_file_mode = S_IFREG | shmfd->shm_mode; /* XXX */
+ kif->kf_un.kf_file.kf_file_mode_freebsd10 =
+ kif->kf_un.kf_file.kf_file_mode; /* truncate */
mtx_unlock(&shm_timestamp_lock);
kif->kf_un.kf_file.kf_file_size = shmfd->shm_size;
if (shmfd->shm_path != NULL) {
Modified: projects/ino64/sys/kern/vfs_vnops.c
==============================================================================
--- projects/ino64/sys/kern/vfs_vnops.c Tue Dec 23 08:10:00 2014 (r276110)
+++ projects/ino64/sys/kern/vfs_vnops.c Tue Dec 23 08:10:03 2014 (r276111)
@@ -2340,9 +2340,15 @@ vn_fill_kinfo_vnode(struct vnode *vp, st
else
kif->kf_un.kf_file.kf_file_fsid =
vp->v_mount->mnt_stat.f_fsid.val[0];
+ kif->kf_un.kf_file.kf_file_fsid_freebsd10 =
+ kif->kf_un.kf_file.kf_file_fsid; /* truncate */
kif->kf_un.kf_file.kf_file_fileid = va.va_fileid;
kif->kf_un.kf_file.kf_file_mode = MAKEIMODE(va.va_type, va.va_mode);
+ kif->kf_un.kf_file.kf_file_mode_freebsd10 =
+ kif->kf_un.kf_file.kf_file_mode; /* truncate */
kif->kf_un.kf_file.kf_file_size = va.va_size;
kif->kf_un.kf_file.kf_file_rdev = va.va_rdev;
+ kif->kf_un.kf_file.kf_file_rdev_freebsd10 =
+ kif->kf_un.kf_file.kf_file_rdev; /* truncate */
return (0);
}
Modified: projects/ino64/sys/sys/user.h
==============================================================================
--- projects/ino64/sys/sys/user.h Tue Dec 23 08:10:00 2014 (r276110)
+++ projects/ino64/sys/sys/user.h Tue Dec 23 08:10:03 2014 (r276111)
@@ -84,7 +84,7 @@
* it in two places: function fill_kinfo_proc in sys/kern/kern_proc.c and
* function kvm_proclist in lib/libkvm/kvm_proc.c .
*/
-#define KI_NSPARE_INT 4
+#define KI_NSPARE_INT 2
#define KI_NSPARE_LONG 12
#define KI_NSPARE_PTR 6
@@ -135,7 +135,7 @@ struct kinfo_proc {
pid_t ki_tsid; /* Terminal session ID */
short ki_jobc; /* job control counter */
short ki_spare_short1; /* unused (just here for alignment) */
- dev_t ki_tdev; /* controlling tty dev */
+ uint32_t ki_tdev_freebsd10; /* controlling tty dev */
sigset_t ki_siglist; /* Signals arrived but not delivered */
sigset_t ki_sigmask; /* Current signal mask */
sigset_t ki_sigignore; /* Signals being ignored */
@@ -187,6 +187,7 @@ struct kinfo_proc {
*/
char ki_sparestrings[50]; /* spare string space */
int ki_spareints[KI_NSPARE_INT]; /* spare room for growth */
+ uint64_t ki_tdev; /* controlling tty dev */
int ki_oncpu; /* Which cpu we are on */
int ki_lastcpu; /* Last cpu we were on */
int ki_tracer; /* Pid of tracing process */
@@ -344,10 +345,12 @@ struct kinfo_file {
int kf_sock_domain; /* Socket domain. */
int kf_sock_type; /* Socket type. */
int kf_sock_protocol; /* Socket protocol. */
- struct sockaddr_storage kf_sa_local; /* Socket address. */
- struct sockaddr_storage kf_sa_peer; /* Peer address. */
union {
struct {
+ /* Socket address. */
+ struct sockaddr_storage kf_sa_local;
+ /* Peer address. */
+ struct sockaddr_storage kf_sa_peer;
/* Address of so_pcb. */
uint64_t kf_sock_pcb;
/* Address of inp_ppcb. */
@@ -362,25 +365,38 @@ struct kinfo_file {
uint32_t kf_sock_pad0;
} kf_sock;
struct {
+ /* Space for future use */
+ uint64_t kf_spareint64[30];
+ /* Vnode filesystem id. */
+ uint64_t kf_file_fsid;
+ /* File device. */
+ uint64_t kf_file_rdev;
/* Global file id. */
uint64_t kf_file_fileid;
/* File size. */
uint64_t kf_file_size;
- /* Vnode filesystem id. */
- uint32_t kf_file_fsid;
- /* File device. */
- uint32_t kf_file_rdev;
- /* File mode. */
- uint16_t kf_file_mode;
+ /* Vnode filesystem id, FreeBSD 10 compat. */
+ uint32_t kf_file_fsid_freebsd10;
+ /* File device, FreeBSD 10 compat. */
+ uint32_t kf_file_rdev_freebsd10;
+ /* File mode, FreeBSD 10 compat. */
+ uint16_t kf_file_mode_freebsd10;
/* Round to 64 bit alignment. */
uint16_t kf_file_pad0;
- uint32_t kf_file_pad1;
+ /* File mode. */
+ uint32_t kf_file_mode;
} kf_file;
struct {
+ /* Space for future use */
+ uint64_t kf_spareint64[32];
uint32_t kf_sem_value;
- uint16_t kf_sem_mode;
+ uint16_t kf_sem_mode_freebsd10;
+ uint16_t kf_sem_pad0;
+ uint32_t kf_sem_mode;
} kf_sem;
struct {
+ /* Space for future use */
+ uint64_t kf_spareint64[32];
uint64_t kf_pipe_addr;
uint64_t kf_pipe_peer;
uint32_t kf_pipe_buffer_cnt;
@@ -388,11 +404,17 @@ struct kinfo_file {
uint32_t kf_pipe_pad0[3];
} kf_pipe;
struct {
- uint32_t kf_pts_dev;
+ /* Space for future use */
+ uint64_t kf_spareint64[32];
+ uint32_t kf_pts_dev_freebsd10;
+ uint32_t kf_pts_pad0;
+ uint64_t kf_pts_dev;
/* Round to 64 bit alignment. */
- uint32_t kf_pts_pad0[7];
+ uint32_t kf_pts_pad1[4];
} kf_pts;
struct {
+ /* Space for future use */
+ uint64_t kf_spareint64[32];
pid_t kf_pid;
} kf_proc;
} kf_un;
@@ -453,7 +475,7 @@ struct kinfo_ovmentry {
void *_kve_pspare[8]; /* Space for more stuff. */
off_t kve_offset; /* Mapping offset in object */
uint64_t kve_fileid; /* inode number if vnode */
- dev_t kve_fsid; /* dev_t of vnode location */
+ uint32_t kve_fsid; /* dev_t of vnode location */
int _kve_ispare[3]; /* Space for more stuff. */
};
@@ -468,7 +490,7 @@ struct kinfo_vmentry {
uint64_t kve_end; /* Finishing address. */
uint64_t kve_offset; /* Mapping offset in object */
uint64_t kve_vn_fileid; /* inode number if vnode */
- uint32_t kve_vn_fsid; /* dev_t of vnode location */
+ uint32_t kve_vn_fsid_freebsd10; /* dev_t of vnode location */
int kve_flags; /* Flags on map entry. */
int kve_resident; /* Number of resident pages. */
int kve_private_resident; /* Number of private pages. */
@@ -477,10 +499,14 @@ struct kinfo_vmentry {
int kve_shadow_count; /* VM obj shadow count. */
int kve_vn_type; /* Vnode type. */
uint64_t kve_vn_size; /* File size. */
- uint32_t kve_vn_rdev; /* Device id if device. */
- uint16_t kve_vn_mode; /* File mode. */
+ uint32_t kve_vn_rdev_freebsd10; /* Device id if device. */
+ uint16_t kve_vn_mode_freebsd10; /* File mode. */
uint16_t kve_status; /* Status flags. */
- int _kve_ispare[12]; /* Space for more stuff. */
+ uint64_t kve_vn_fsid; /* dev_t of vnode location */
+ uint64_t kve_vn_rdev; /* Device id if device. */
+ uint32_t kve_vn_mode; /* File mode. */
+ uint32_t _kve_ispare0; /* Space for more stuff. */
+ int _kve_ispare[6]; /* Space for more stuff. */
/* Truncated before copyout in sysctl */
char kve_path[PATH_MAX]; /* Path to VM obj, if any. */
};
More information about the svn-src-projects
mailing list