svn commit: r195885 - projects/libprocstat/usr.bin/fstat
Stanislav Sedov
stas at FreeBSD.org
Sun Jul 26 08:14:01 UTC 2009
Author: stas
Date: Sun Jul 26 08:14:01 2009
New Revision: 195885
URL: http://svn.freebsd.org/changeset/base/195885
Log:
- Style(9) nitpicking.
Modified:
projects/libprocstat/usr.bin/fstat/fstat.c
projects/libprocstat/usr.bin/fstat/fuser.c
projects/libprocstat/usr.bin/fstat/libprocstat.c
Modified: projects/libprocstat/usr.bin/fstat/fstat.c
==============================================================================
--- projects/libprocstat/usr.bin/fstat/fstat.c Sun Jul 26 08:06:38 2009 (r195884)
+++ projects/libprocstat/usr.bin/fstat/fstat.c Sun Jul 26 08:14:01 2009 (r195885)
@@ -209,11 +209,11 @@ do_fstat(int argc, char **argv)
static void
dofiles(struct procstat *procstat, struct kinfo_proc *kp)
{
- struct filestat_list *head;
const char *cmd;
const char *uname;
- int pid;
struct filestat *fst;
+ struct filestat_list *head;
+ int pid;
uname = user_from_uid(kp->ki_uid, 0);
pid = kp->ki_pid;
@@ -231,11 +231,10 @@ static void
print_file_info(struct procstat *procstat, struct filestat *fst,
const char *uname, const char *cmd, int pid)
{
- const char *filename;
struct vnstat vn;
- int error;
- int fsmatch = 0;
DEVS *d;
+ const char *filename;
+ int error, fsmatch = 0;
filename = NULL;
if (checkfile != 0) {
@@ -318,10 +317,10 @@ print_socket_info(struct procstat *procs
};
#define STYPEMAX 5
struct sockstat sock;
- char errbuf[_POSIX2_LINE_MAX];
- static int isopen;
struct protoent *pe;
+ char errbuf[_POSIX2_LINE_MAX];
int error;
+ static int isopen;
error = procstat_get_socket_info(procstat, fst, &sock, errbuf);
if (error != 0) {
@@ -427,9 +426,9 @@ static void
print_vnode_info(struct procstat *procstat, struct filestat *fst)
{
struct vnstat vn;
- const char *badtype;
char errbuf[_POSIX2_LINE_MAX];
char mode[15];
+ const char *badtype;
int error;
badtype = NULL;
Modified: projects/libprocstat/usr.bin/fstat/fuser.c
==============================================================================
--- projects/libprocstat/usr.bin/fstat/fuser.c Sun Jul 26 08:06:38 2009 (r195884)
+++ projects/libprocstat/usr.bin/fstat/fuser.c Sun Jul 26 08:14:01 2009 (r195885)
@@ -166,9 +166,9 @@ do_fuser(int argc, char *argv[])
struct kinfo_proc *p;
struct procstat *procstat;
struct reqfile *reqfiles;
+ char *ep, *nlistf, *memf;
int ch, cnt, sig;
unsigned int i, nfiles;
- char *ep, *nlistf, *memf;
sig = SIGKILL; /* Default to kill. */
nlistf = NULL;
@@ -288,10 +288,10 @@ static void
dofiles(struct procstat *procstat, struct kinfo_proc *kp,
struct reqfile *reqfiles, size_t nfiles)
{
+ struct vnstat vn;
struct consumer *cons;
struct filestat *fst;
struct filestat_list *head;
- struct vnstat vn;
int error, match;
unsigned int i;
Modified: projects/libprocstat/usr.bin/fstat/libprocstat.c
==============================================================================
--- projects/libprocstat/usr.bin/fstat/libprocstat.c Sun Jul 26 08:06:38 2009 (r195884)
+++ projects/libprocstat/usr.bin/fstat/libprocstat.c Sun Jul 26 08:14:01 2009 (r195885)
@@ -136,9 +136,9 @@ procstat_close(struct procstat *procstat
struct procstat *
procstat_open(const char *nlistf, const char *memf)
{
+ struct procstat *procstat;
kvm_t *kd;
char buf[_POSIX2_LINE_MAX];
- struct procstat *procstat;
procstat = calloc(1, sizeof(*procstat));
if (procstat == NULL) {
@@ -259,25 +259,23 @@ filestat_new_entry(void *typedep, int ty
static struct filestat_list *
procstat_getfiles_kvm(kvm_t *kd, struct kinfo_proc *kp, int mmapped)
{
- int i;
struct file file;
struct filedesc filed;
- unsigned int nfiles;
+ struct vm_map_entry vmentry;
+ struct vm_object object;
+ struct vmspace vmspace;
+ vm_map_entry_t entryp;
+ vm_map_t map;
+ vm_object_t objp;
struct file **ofiles;
struct filestat *entry;
struct filestat_list *head;
- int type;
void *data;
- vm_map_t map;
- struct vmspace vmspace;
- struct vm_map_entry vmentry;
- vm_map_entry_t entryp;
- struct vm_object object;
- vm_object_t objp;
- int prot, fflags;
+ int i, fflags;
+ int prot, type;
+ unsigned int nfiles;
assert(kd);
-
if (kp->ki_fd == NULL)
return (NULL);
if (!kvm_read_all(kd, (unsigned long)kp->ki_fd, &filed,
@@ -513,6 +511,7 @@ kinfo_fflags2fst(int kfflags)
static int
kinfo_uflags2fst(int fd)
{
+
switch (fd) {
case KF_FD_TYPE_CWD:
return (PS_FST_UFLAG_CDIR);
@@ -533,12 +532,11 @@ procstat_getfiles_sysctl(struct kinfo_pr
{
struct kinfo_file *kif, *files;
struct filestat_list *head;
- int fd, fflags, uflags, type;
struct filestat *entry;
- int cnt, i;
+ int cnt, fd, fflags;
+ int i, type, uflags;
assert(kp);
-
if (kp->ki_fd == NULL)
return (NULL);
@@ -837,8 +835,8 @@ static int
procstat_get_vnode_info_sysctl(struct filestat *fst, struct vnstat *vn,
char *errbuf __unused)
{
- struct kinfo_file *kif;
struct statfs stbuf;
+ struct kinfo_file *kif;
char *name;
assert(fst);
@@ -895,10 +893,10 @@ static int
procstat_get_socket_info_kvm(kvm_t *kd, struct filestat *fst,
struct sockstat *sock, char *errbuf)
{
- struct socket s;
- struct protosw proto;
struct domain dom;
struct inpcb inpcb;
+ struct protosw proto;
+ struct socket s;
struct unpcb unpcb;
ssize_t len;
void *so;
More information about the svn-src-projects
mailing list