Deleted Added
full compact
kern_acct.c (118094) kern_acct.c (125454)
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

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

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 */
41
42#include <sys/cdefs.h>
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

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

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 */
41
42#include <sys/cdefs.h>
43__FBSDID("$FreeBSD: head/sys/kern/kern_acct.c 118094 2003-07-27 17:04:56Z phk $");
43__FBSDID("$FreeBSD: head/sys/kern/kern_acct.c 125454 2004-02-04 21:52:57Z jhb $");
44
45#include "opt_mac.h"
46
47#include <sys/param.h>
48#include <sys/systm.h>
49#include <sys/lock.h>
50#include <sys/mutex.h>
51#include <sys/sysproto.h>

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

223{
224 struct proc *p = td->td_proc;
225 struct acct acct;
226 struct rusage *r;
227 struct timeval ut, st, tmp;
228 int t, ret;
229 struct vnode *vp;
230 struct ucred *uc;
44
45#include "opt_mac.h"
46
47#include <sys/param.h>
48#include <sys/systm.h>
49#include <sys/lock.h>
50#include <sys/mutex.h>
51#include <sys/sysproto.h>

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

223{
224 struct proc *p = td->td_proc;
225 struct acct acct;
226 struct rusage *r;
227 struct timeval ut, st, tmp;
228 int t, ret;
229 struct vnode *vp;
230 struct ucred *uc;
231 struct plimit *newlim, *oldlim;
231
232 mtx_lock(&acct_mtx);
233
234 /* If accounting isn't enabled, don't bother */
235 vp = acctp;
236 if (vp == NULLVP) {
237 mtx_unlock(&acct_mtx);
238 return (0);

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

295 */
296 uc = crhold(acctcred);
297 vref(vp);
298 mtx_unlock(&acct_mtx);
299
300 /*
301 * Eliminate any file size rlimit.
302 */
232
233 mtx_lock(&acct_mtx);
234
235 /* If accounting isn't enabled, don't bother */
236 vp = acctp;
237 if (vp == NULLVP) {
238 mtx_unlock(&acct_mtx);
239 return (0);

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

296 */
297 uc = crhold(acctcred);
298 vref(vp);
299 mtx_unlock(&acct_mtx);
300
301 /*
302 * Eliminate any file size rlimit.
303 */
303 if (p->p_limit->p_refcnt > 1) {
304 p->p_limit->p_refcnt--;
305 p->p_limit = limcopy(p->p_limit);
306 }
307 p->p_rlimit[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
304 newlim = lim_alloc();
305 PROC_LOCK(p);
306 oldlim = p->p_limit;
307 lim_copy(newlim, oldlim);
308 newlim->pl_rlimit[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
309 p->p_limit = newlim;
310 PROC_UNLOCK(p);
311 lim_free(oldlim);
308
309 VOP_LEASE(vp, td, uc, LEASE_WRITE);
310 ret = vn_rdwr(UIO_WRITE, vp, (caddr_t)&acct, sizeof (acct),
311 (off_t)0, UIO_SYSSPACE, IO_APPEND|IO_UNIT, uc, NOCRED,
312 (int *)0, td);
313 vrele(vp);
314 crfree(uc);
315 return (ret);

--- 105 unchanged lines hidden ---
312
313 VOP_LEASE(vp, td, uc, LEASE_WRITE);
314 ret = vn_rdwr(UIO_WRITE, vp, (caddr_t)&acct, sizeof (acct),
315 (off_t)0, UIO_SYSSPACE, IO_APPEND|IO_UNIT, uc, NOCRED,
316 (int *)0, td);
317 vrele(vp);
318 crfree(uc);
319 return (ret);

--- 105 unchanged lines hidden ---