svn commit: r222333 - projects/jbuild/usr.bin/jbuild/filemon
David E. O'Brien
obrien at FreeBSD.org
Thu May 26 23:30:29 UTC 2011
Author: obrien
Date: Thu May 26 23:30:28 2011
New Revision: 222333
URL: http://svn.freebsd.org/changeset/base/222333
Log:
style(9)
Modified:
projects/jbuild/usr.bin/jbuild/filemon/Makefile
projects/jbuild/usr.bin/jbuild/filemon/filemon.c
projects/jbuild/usr.bin/jbuild/filemon/filemon_lock.c
projects/jbuild/usr.bin/jbuild/filemon/filemon_wrapper.c
Modified: projects/jbuild/usr.bin/jbuild/filemon/Makefile
==============================================================================
--- projects/jbuild/usr.bin/jbuild/filemon/Makefile Thu May 26 23:27:39 2011 (r222332)
+++ projects/jbuild/usr.bin/jbuild/filemon/Makefile Thu May 26 23:30:28 2011 (r222333)
@@ -1,7 +1,9 @@
# $FreeBSD$
-KMOD = filemon
-SRCS = filemon.c
-SRCS += vnode_if.h
+KMOD= filemon
+SRCS= filemon.c
+SRCS+= vnode_if.h
+
+SUBDIR= test
.include <bsd.kmod.mk>
Modified: projects/jbuild/usr.bin/jbuild/filemon/filemon.c
==============================================================================
--- projects/jbuild/usr.bin/jbuild/filemon/filemon.c Thu May 26 23:27:39 2011 (r222332)
+++ projects/jbuild/usr.bin/jbuild/filemon/filemon.c Thu May 26 23:30:28 2011 (r222333)
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2009, 2010, Juniper Networks, Inc.
+ * Copyright (c) 2009-2011, Juniper Networks, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$");
#include <compat/freebsd32/freebsd32_proto.h>
extern struct sysentvec ia32_freebsd_sysvec;
-
#endif
extern struct sysentvec elf32_freebsd_sysvec;
@@ -129,7 +128,7 @@ filemon_clone(void *arg, struct ucred *c
if (len != 7)
return;
- if (bcmp(name,"filemon",7) != 0)
+ if (bcmp(name,"filemon", 7) != 0)
return;
/* Clone the device to the new minor number. */
@@ -180,7 +179,8 @@ filemon_dtr(void *data)
}
static int
-filemon_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag __unused, struct thread *td)
+filemon_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag __unused,
+ struct thread *td)
{
int error = 0;
struct filemon *filemon;
@@ -210,7 +210,7 @@ filemon_ioctl(struct cdev *dev, u_long c
break;
}
- return(error);
+ return (error);
}
static int
@@ -229,7 +229,8 @@ filemon_open(struct cdev *dev, int oflag
filemon_unlock_write();
if (filemon == NULL) {
- filemon = malloc(sizeof(struct filemon), M_FILEMON, M_WAITOK | M_ZERO);
+ filemon = malloc(sizeof(struct filemon), M_FILEMON,
+ M_WAITOK | M_ZERO);
filemon->fp = NULL;
@@ -294,7 +295,6 @@ filemon_load(void *dummy __unused)
#endif
}
-
static int
filemon_unload(void)
{
Modified: projects/jbuild/usr.bin/jbuild/filemon/filemon_lock.c
==============================================================================
--- projects/jbuild/usr.bin/jbuild/filemon/filemon_lock.c Thu May 26 23:27:39 2011 (r222332)
+++ projects/jbuild/usr.bin/jbuild/filemon/filemon_lock.c Thu May 26 23:30:28 2011 (r222333)
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2009, 2010, Juniper Networks, Inc.
+ * Copyright (c) 2009-2011, Juniper Networks, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -91,7 +91,8 @@ filemon_lock_write(void)
while (access_owner != curthread) {
if (access_owner == NULL &&
- (access_requester == NULL || access_requester == curthread)) {
+ (access_requester == NULL ||
+ access_requester == curthread)) {
access_owner = curthread;
access_requester = NULL;
} else {
Modified: projects/jbuild/usr.bin/jbuild/filemon/filemon_wrapper.c
==============================================================================
--- projects/jbuild/usr.bin/jbuild/filemon/filemon_wrapper.c Thu May 26 23:27:39 2011 (r222332)
+++ projects/jbuild/usr.bin/jbuild/filemon/filemon_wrapper.c Thu May 26 23:30:28 2011 (r222333)
@@ -58,11 +58,11 @@ filemon_pid_check(struct proc *p)
TAILQ_FOREACH(filemon, &filemons_inuse, link) {
if (p->p_pid == filemon->pid)
- return(filemon);
+ return (filemon);
}
if (p->p_pptr == NULL)
- return(NULL);
+ return (NULL);
return (filemon_pid_check(p->p_pptr));
}
@@ -70,8 +70,8 @@ filemon_pid_check(struct proc *p)
static void
filemon_comment(struct filemon *filemon)
{
- struct timeval now;
int len;
+ struct timeval now;
/* Load timestamp before locking. Less accurate but less contention. */
getmicrotime(&now);
@@ -112,9 +112,11 @@ filemon_wrapper_chdir(struct thread *td,
/* Lock the found filemon structure. */
filemon_filemon_lock(filemon);
- copyinstr(uap->path, filemon->fname1, sizeof(filemon->fname1), &done);
+ copyinstr(uap->path, filemon->fname1,
+ sizeof(filemon->fname1), &done);
- len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr), "C %d %s\n",
+ len = snprintf(filemon->msgbufr,
+ sizeof(filemon->msgbufr), "C %d %s\n",
curproc->p_pid, filemon->fname1);
filemon_output(filemon, filemon->msgbufr, len);
@@ -127,7 +129,7 @@ filemon_wrapper_chdir(struct thread *td,
filemon_unlock_read();
}
- return(ret);
+ return (ret);
}
static int
@@ -149,7 +151,8 @@ filemon_wrapper_execve(struct thread *td
/* Lock the found filemon structure. */
filemon_filemon_lock(filemon);
- len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr), "E %d %s\n",
+ len = snprintf(filemon->msgbufr,
+ sizeof(filemon->msgbufr), "E %d %s\n",
curproc->p_pid, fname);
filemon_output(filemon, filemon->msgbufr, len);
@@ -162,12 +165,13 @@ filemon_wrapper_execve(struct thread *td
filemon_unlock_read();
}
- return(ret);
+ return (ret);
}
#ifdef COMPAT_IA32
static int
-filemon_wrapper_freebsd32_execve(struct thread *td, struct freebsd32_execve_args *uap)
+filemon_wrapper_freebsd32_execve(struct thread *td,
+ struct freebsd32_execve_args *uap)
{
char fname[MAXPATHLEN];
int ret;
@@ -185,7 +189,8 @@ filemon_wrapper_freebsd32_execve(struct
/* Lock the found filemon structure. */
filemon_filemon_lock(filemon);
- len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr), "E %d %s\n",
+ len = snprintf(filemon->msgbufr,
+ sizeof(filemon->msgbufr), "E %d %s\n",
curproc->p_pid, fname);
filemon_output(filemon, filemon->msgbufr, len);
@@ -198,7 +203,7 @@ filemon_wrapper_freebsd32_execve(struct
filemon_unlock_read();
}
- return(ret);
+ return (ret);
}
#endif
@@ -217,8 +222,9 @@ filemon_wrapper_fork(struct thread *td,
/* Lock the found filemon structure. */
filemon_filemon_lock(filemon);
- len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr), "F %d %ld\n",
- curproc->p_pid, (long)curthread->td_retval[0]);
+ len = snprintf(filemon->msgbufr,
+ sizeof(filemon->msgbufr), "F %d %ld\n",
+ curproc->p_pid, (long)curthread->td_retval[0]);
filemon_output(filemon, filemon->msgbufr, len);
@@ -230,7 +236,7 @@ filemon_wrapper_fork(struct thread *td,
filemon_unlock_read();
}
- return(ret);
+ return (ret);
}
static int
@@ -249,10 +255,13 @@ filemon_wrapper_open(struct thread *td,
/* Lock the found filemon structure. */
filemon_filemon_lock(filemon);
- copyinstr(uap->path, filemon->fname1, sizeof(filemon->fname1), &done);
+ copyinstr(uap->path, filemon->fname1,
+ sizeof(filemon->fname1), &done);
- len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr), "%c %d %s\n",
- (uap->flags & O_ACCMODE) ? 'W':'R', curproc->p_pid, filemon->fname1);
+ len = snprintf(filemon->msgbufr,
+ sizeof(filemon->msgbufr), "%c %d %s\n",
+ (uap->flags & O_ACCMODE) ? 'W':'R',
+ curproc->p_pid, filemon->fname1);
filemon_output(filemon, filemon->msgbufr, len);
@@ -264,7 +273,7 @@ filemon_wrapper_open(struct thread *td,
filemon_unlock_read();
}
- return(ret);
+ return (ret);
}
static int
@@ -283,10 +292,13 @@ filemon_wrapper_rename(struct thread *td
/* Lock the found filemon structure. */
filemon_filemon_lock(filemon);
- copyinstr(uap->from, filemon->fname1, sizeof(filemon->fname1), &done);
- copyinstr(uap->to, filemon->fname2, sizeof(filemon->fname2), &done);
+ copyinstr(uap->from, filemon->fname1,
+ sizeof(filemon->fname1), &done);
+ copyinstr(uap->to, filemon->fname2,
+ sizeof(filemon->fname2), &done);
- len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr), "M %d '%s' '%s'\n",
+ len = snprintf(filemon->msgbufr,
+ sizeof(filemon->msgbufr), "M %d '%s' '%s'\n",
curproc->p_pid, filemon->fname1, filemon->fname2);
filemon_output(filemon, filemon->msgbufr, len);
@@ -299,7 +311,7 @@ filemon_wrapper_rename(struct thread *td
filemon_unlock_read();
}
- return(ret);
+ return (ret);
}
static int
@@ -318,10 +330,13 @@ filemon_wrapper_link(struct thread *td,
/* Lock the found filemon structure. */
filemon_filemon_lock(filemon);
- copyinstr(uap->path, filemon->fname1, sizeof(filemon->fname1), &done);
- copyinstr(uap->link, filemon->fname2, sizeof(filemon->fname2), &done);
+ copyinstr(uap->path, filemon->fname1,
+ sizeof(filemon->fname1), &done);
+ copyinstr(uap->link, filemon->fname2,
+ sizeof(filemon->fname2), &done);
- len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr), "L %d '%s' '%s'\n",
+ len = snprintf(filemon->msgbufr,
+ sizeof(filemon->msgbufr), "L %d '%s' '%s'\n",
curproc->p_pid, filemon->fname1, filemon->fname2);
filemon_output(filemon, filemon->msgbufr, len);
@@ -334,7 +349,7 @@ filemon_wrapper_link(struct thread *td,
filemon_unlock_read();
}
- return(ret);
+ return (ret);
}
static int
@@ -353,10 +368,13 @@ filemon_wrapper_symlink(struct thread *t
/* Lock the found filemon structure. */
filemon_filemon_lock(filemon);
- copyinstr(uap->path, filemon->fname1, sizeof(filemon->fname1), &done);
- copyinstr(uap->link, filemon->fname2, sizeof(filemon->fname2), &done);
+ copyinstr(uap->path, filemon->fname1,
+ sizeof(filemon->fname1), &done);
+ copyinstr(uap->link, filemon->fname2,
+ sizeof(filemon->fname2), &done);
- len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr), "L %d '%s' '%s'\n",
+ len = snprintf(filemon->msgbufr,
+ sizeof(filemon->msgbufr), "L %d '%s' '%s'\n",
curproc->p_pid, filemon->fname1, filemon->fname2);
filemon_output(filemon, filemon->msgbufr, len);
@@ -369,7 +387,7 @@ filemon_wrapper_symlink(struct thread *t
filemon_unlock_read();
}
- return(ret);
+ return (ret);
}
#if __FreeBSD_version > 800032
@@ -393,10 +411,13 @@ filemon_wrapper_linkat(struct thread *td
/* Lock the found filemon structure. */
filemon_filemon_lock(filemon);
- copyinstr(uap->path1, filemon->fname1, sizeof(filemon->fname1), &done);
- copyinstr(uap->path2, filemon->fname2, sizeof(filemon->fname2), &done);
+ copyinstr(uap->path1, filemon->fname1,
+ sizeof(filemon->fname1), &done);
+ copyinstr(uap->path2, filemon->fname2,
+ sizeof(filemon->fname2), &done);
- len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr), "L %d '%s' '%s'\n",
+ len = snprintf(filemon->msgbufr,
+ sizeof(filemon->msgbufr), "L %d '%s' '%s'\n",
curproc->p_pid, filemon->fname1, filemon->fname2);
filemon_output(filemon, filemon->msgbufr, len);
@@ -409,9 +430,10 @@ filemon_wrapper_linkat(struct thread *td
filemon_unlock_read();
}
- return(ret);
+ return (ret);
}
#endif
+
static int
filemon_wrapper_stat(struct thread *td, struct stat_args *uap)
{
@@ -428,9 +450,11 @@ filemon_wrapper_stat(struct thread *td,
/* Lock the found filemon structure. */
filemon_filemon_lock(filemon);
- copyinstr(uap->path, filemon->fname1, sizeof(filemon->fname1), &done);
+ copyinstr(uap->path, filemon->fname1,
+ sizeof(filemon->fname1), &done);
- len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr), "S %d %s\n",
+ len = snprintf(filemon->msgbufr,
+ sizeof(filemon->msgbufr), "S %d %s\n",
curproc->p_pid, filemon->fname1);
filemon_output(filemon, filemon->msgbufr, len);
@@ -443,12 +467,13 @@ filemon_wrapper_stat(struct thread *td,
filemon_unlock_read();
}
- return(ret);
+ return (ret);
}
#ifdef COMPAT_IA32
static int
-filemon_wrapper_freebsd32_stat(struct thread *td, struct freebsd32_stat_args *uap)
+filemon_wrapper_freebsd32_stat(struct thread *td,
+ struct freebsd32_stat_args *uap)
{
int ret;
size_t done;
@@ -463,9 +488,11 @@ filemon_wrapper_freebsd32_stat(struct th
/* Lock the found filemon structure. */
filemon_filemon_lock(filemon);
- copyinstr(uap->path, filemon->fname1, sizeof(filemon->fname1), &done);
+ copyinstr(uap->path, filemon->fname1,
+ sizeof(filemon->fname1), &done);
- len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr), "S %d %s\n",
+ len = snprintf(filemon->msgbufr,
+ sizeof(filemon->msgbufr), "S %d %s\n",
curproc->p_pid, filemon->fname1);
filemon_output(filemon, filemon->msgbufr, len);
@@ -478,16 +505,16 @@ filemon_wrapper_freebsd32_stat(struct th
filemon_unlock_read();
}
- return(ret);
+ return (ret);
}
#endif
static void
filemon_wrapper_sys_exit(struct thread *td, struct sys_exit_args *uap)
{
- struct timeval now;
size_t len;
struct filemon *filemon;
+ struct timeval now;
/* Get timestamp before locking. */
getmicrotime(&now);
@@ -540,9 +567,11 @@ filemon_wrapper_unlink(struct thread *td
/* Lock the found filemon structure. */
filemon_filemon_lock(filemon);
- copyinstr(uap->path, filemon->fname1, sizeof(filemon->fname1), &done);
+ copyinstr(uap->path, filemon->fname1,
+ sizeof(filemon->fname1), &done);
- len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr), "D %d %s\n",
+ len = snprintf(filemon->msgbufr,
+ sizeof(filemon->msgbufr), "D %d %s\n",
curproc->p_pid, filemon->fname1);
filemon_output(filemon, filemon->msgbufr, len);
@@ -555,7 +584,7 @@ filemon_wrapper_unlink(struct thread *td
filemon_unlock_read();
}
- return(ret);
+ return (ret);
}
static int
@@ -573,7 +602,8 @@ filemon_wrapper_vfork(struct thread *td,
/* Lock the found filemon structure. */
filemon_filemon_lock(filemon);
- len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr), "F %d %ld\n",
+ len = snprintf(filemon->msgbufr,
+ sizeof(filemon->msgbufr), "F %d %ld\n",
curproc->p_pid, (long)curthread->td_retval[0]);
filemon_output(filemon, filemon->msgbufr, len);
@@ -586,7 +616,7 @@ filemon_wrapper_vfork(struct thread *td,
filemon_unlock_read();
}
- return(ret);
+ return (ret);
}
static void
@@ -632,9 +662,7 @@ filemon_wrapper_install(void)
#ifdef FILEMON_HAS_LINKAT
sv_table[FREEBSD32_SYS_linkat].sy_call = (sy_call_t *) filemon_wrapper_linkat;
#endif
-#endif
-
-
+#endif /* COMPAT_IA32 */
}
static void
@@ -680,6 +708,5 @@ filemon_wrapper_deinstall(void)
#ifdef FILEMON_HAS_LINKAT
sv_table[FREEBSD32_SYS_linkat].sy_call = (sy_call_t *) linkat;
#endif
-#endif
-
+#endif /* COMPAT_IA32 */
}
More information about the svn-src-projects
mailing list