Deleted Added
full compact
kern_acct.c (104538) kern_acct.c (106412)
1/*-
2 * Copyright (c) 1994 Christopher G. Demetriou
3 * Copyright (c) 1982, 1986, 1989, 1993
4 * The Regents of the University of California. All rights reserved.
5 * (c) UNIX System Laboratories, Inc.
6 * All or some portions of this file are derived from material licensed
7 * to the University of California by American Telephone and Telegraph
8 * Co. or Unix System Laboratories, Inc. and are reproduced herein with

--- 23 unchanged lines hidden (view full) ---

32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 *
39 * @(#)kern_acct.c 8.1 (Berkeley) 6/14/93
1/*-
2 * Copyright (c) 1994 Christopher G. Demetriou
3 * Copyright (c) 1982, 1986, 1989, 1993
4 * The Regents of the University of California. All rights reserved.
5 * (c) UNIX System Laboratories, Inc.
6 * All or some portions of this file are derived from material licensed
7 * to the University of California by American Telephone and Telegraph
8 * Co. or Unix System Laboratories, Inc. and are reproduced herein with

--- 23 unchanged lines hidden (view full) ---

32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 *
39 * @(#)kern_acct.c 8.1 (Berkeley) 6/14/93
40 * $FreeBSD: head/sys/kern/kern_acct.c 104538 2002-10-05 20:05:23Z rwatson $
40 * $FreeBSD: head/sys/kern/kern_acct.c 106412 2002-11-04 15:13:36Z rwatson $
41 */
42
41 */
42
43#include "opt_mac.h"
44
43#include <sys/param.h>
44#include <sys/systm.h>
45#include <sys/lock.h>
46#include <sys/mutex.h>
47#include <sys/sysproto.h>
48#include <sys/proc.h>
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/lock.h>
48#include <sys/mutex.h>
49#include <sys/sysproto.h>
50#include <sys/proc.h>
51#include <sys/mac.h>
49#include <sys/mount.h>
50#include <sys/vnode.h>
51#include <sys/fcntl.h>
52#include <sys/syslog.h>
53#include <sys/kernel.h>
54#include <sys/sysent.h>
55#include <sys/sysctl.h>
56#include <sys/namei.h>

--- 82 unchanged lines hidden (view full) ---

139 if (SCARG(uap, path) != NULL) {
140 NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path),
141 td);
142 flags = FWRITE | O_APPEND;
143 error = vn_open(&nd, &flags, 0);
144 if (error)
145 goto done2;
146 NDFREE(&nd, NDF_ONLY_PNBUF);
52#include <sys/mount.h>
53#include <sys/vnode.h>
54#include <sys/fcntl.h>
55#include <sys/syslog.h>
56#include <sys/kernel.h>
57#include <sys/sysent.h>
58#include <sys/sysctl.h>
59#include <sys/namei.h>

--- 82 unchanged lines hidden (view full) ---

142 if (SCARG(uap, path) != NULL) {
143 NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path),
144 td);
145 flags = FWRITE | O_APPEND;
146 error = vn_open(&nd, &flags, 0);
147 if (error)
148 goto done2;
149 NDFREE(&nd, NDF_ONLY_PNBUF);
150#ifdef MAC
151 error = mac_check_system_acct(td->td_ucred, nd.ni_vp);
152 if (error) {
153 vn_close(nd.ni_vp, flags, td->td_ucred, td);
154 goto done2;
155 }
156#endif
147 VOP_UNLOCK(nd.ni_vp, 0, td);
148 if (nd.ni_vp->v_type != VREG) {
149 vn_close(nd.ni_vp, flags, td->td_ucred, td);
150 error = EACCES;
151 goto done2;
152 }
157 VOP_UNLOCK(nd.ni_vp, 0, td);
158 if (nd.ni_vp->v_type != VREG) {
159 vn_close(nd.ni_vp, flags, td->td_ucred, td);
160 error = EACCES;
161 goto done2;
162 }
163#ifdef MAC
164 } else {
165 error = mac_check_system_acct(td->td_ucred, NULL);
166 if (error)
167 goto done2;
168#endif
153 }
154
155 /*
156 * If accounting was previously enabled, kill the old space-watcher,
157 * close the file, and (if no new file was specified, leave).
158 */
159
160 /*

--- 239 unchanged lines hidden ---
169 }
170
171 /*
172 * If accounting was previously enabled, kill the old space-watcher,
173 * close the file, and (if no new file was specified, leave).
174 */
175
176 /*

--- 239 unchanged lines hidden ---