Deleted Added
full compact
kern_acct.c (107839) kern_acct.c (107849)
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 107839 2002-12-13 22:41:47Z alfred $
40 * $FreeBSD: head/sys/kern/kern_acct.c 107849 2002-12-14 01:56:26Z alfred $
41 */
42
43#include "opt_mac.h"
44
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/lock.h>
48#include <sys/mutex.h>

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

134 if (error)
135 return (error);
136
137 mtx_lock(&Giant);
138 /*
139 * If accounting is to be started to a file, open that file for
140 * appending and make sure it's a 'normal'.
141 */
41 */
42
43#include "opt_mac.h"
44
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/lock.h>
48#include <sys/mutex.h>

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

134 if (error)
135 return (error);
136
137 mtx_lock(&Giant);
138 /*
139 * If accounting is to be started to a file, open that file for
140 * appending and make sure it's a 'normal'.
141 */
142 if (SCARG(uap, path) != NULL) {
143 NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path),
142 if (uap->path != NULL) {
143 NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, 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);

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

182 callout_stop(&acctwatch_callout);
183 error = vn_close((acctp != NULLVP ? acctp : savacctp),
184 (acctp != NULLVP ? acctflags : savacctflags),
185 (acctcred != NOCRED ? acctcred : savacctcred), td);
186 acctp = savacctp = NULLVP;
187 crfree(acctcred != NOCRED ? acctcred : savacctcred);
188 acctcred = savacctcred = NOCRED;
189 }
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);

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

182 callout_stop(&acctwatch_callout);
183 error = vn_close((acctp != NULLVP ? acctp : savacctp),
184 (acctp != NULLVP ? acctflags : savacctflags),
185 (acctcred != NOCRED ? acctcred : savacctcred), td);
186 acctp = savacctp = NULLVP;
187 crfree(acctcred != NOCRED ? acctcred : savacctcred);
188 acctcred = savacctcred = NOCRED;
189 }
190 if (SCARG(uap, path) == NULL) {
190 if (uap->path == NULL) {
191 mtx_unlock(&acct_mtx);
192 goto done2;
193 }
194
195 /*
196 * Save the new accounting file vnode, and schedule the new
197 * free space watcher.
198 */

--- 218 unchanged lines hidden ---
191 mtx_unlock(&acct_mtx);
192 goto done2;
193 }
194
195 /*
196 * Save the new accounting file vnode, and schedule the new
197 * free space watcher.
198 */

--- 218 unchanged lines hidden ---