diff options
Diffstat (limited to 'kernel/acct.c')
-rw-r--r-- | kernel/acct.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/kernel/acct.c b/kernel/acct.c index 24f0f8b2ba72..fce53d8df8a7 100644 --- a/kernel/acct.c +++ b/kernel/acct.c | |||
@@ -329,16 +329,16 @@ static comp_t encode_comp_t(unsigned long value) | |||
329 | } | 329 | } |
330 | 330 | ||
331 | /* | 331 | /* |
332 | * If we need to round up, do it (and handle overflow correctly). | 332 | * If we need to round up, do it (and handle overflow correctly). |
333 | */ | 333 | */ |
334 | if (rnd && (++value > MAXFRACT)) { | 334 | if (rnd && (++value > MAXFRACT)) { |
335 | value >>= EXPSIZE; | 335 | value >>= EXPSIZE; |
336 | exp++; | 336 | exp++; |
337 | } | 337 | } |
338 | 338 | ||
339 | /* | 339 | /* |
340 | * Clean it up and polish it off. | 340 | * Clean it up and polish it off. |
341 | */ | 341 | */ |
342 | exp <<= MANTSIZE; /* Shift the exponent into place */ | 342 | exp <<= MANTSIZE; /* Shift the exponent into place */ |
343 | exp += value; /* and add on the mantissa. */ | 343 | exp += value; /* and add on the mantissa. */ |
344 | return exp; | 344 | return exp; |
@@ -361,30 +361,30 @@ static comp_t encode_comp_t(unsigned long value) | |||
361 | 361 | ||
362 | static comp2_t encode_comp2_t(u64 value) | 362 | static comp2_t encode_comp2_t(u64 value) |
363 | { | 363 | { |
364 | int exp, rnd; | 364 | int exp, rnd; |
365 | 365 | ||
366 | exp = (value > (MAXFRACT2>>1)); | 366 | exp = (value > (MAXFRACT2>>1)); |
367 | rnd = 0; | 367 | rnd = 0; |
368 | while (value > MAXFRACT2) { | 368 | while (value > MAXFRACT2) { |
369 | rnd = value & 1; | 369 | rnd = value & 1; |
370 | value >>= 1; | 370 | value >>= 1; |
371 | exp++; | 371 | exp++; |
372 | } | 372 | } |
373 | 373 | ||
374 | /* | 374 | /* |
375 | * If we need to round up, do it (and handle overflow correctly). | 375 | * If we need to round up, do it (and handle overflow correctly). |
376 | */ | 376 | */ |
377 | if (rnd && (++value > MAXFRACT2)) { | 377 | if (rnd && (++value > MAXFRACT2)) { |
378 | value >>= 1; | 378 | value >>= 1; |
379 | exp++; | 379 | exp++; |
380 | } | 380 | } |
381 | 381 | ||
382 | if (exp > MAXEXP2) { | 382 | if (exp > MAXEXP2) { |
383 | /* Overflow. Return largest representable number instead. */ | 383 | /* Overflow. Return largest representable number instead. */ |
384 | return (1ul << (MANTSIZE2+EXPSIZE2-1)) - 1; | 384 | return (1ul << (MANTSIZE2+EXPSIZE2-1)) - 1; |
385 | } else { | 385 | } else { |
386 | return (value & (MAXFRACT2>>1)) | (exp << (MANTSIZE2-1)); | 386 | return (value & (MAXFRACT2>>1)) | (exp << (MANTSIZE2-1)); |
387 | } | 387 | } |
388 | } | 388 | } |
389 | #endif | 389 | #endif |
390 | 390 | ||
@@ -501,14 +501,14 @@ static void do_acct_process(struct file *file) | |||
501 | ac.ac_swaps = encode_comp_t(0); | 501 | ac.ac_swaps = encode_comp_t(0); |
502 | 502 | ||
503 | /* | 503 | /* |
504 | * Kernel segment override to datasegment and write it | 504 | * Kernel segment override to datasegment and write it |
505 | * to the accounting file. | 505 | * to the accounting file. |
506 | */ | 506 | */ |
507 | fs = get_fs(); | 507 | fs = get_fs(); |
508 | set_fs(KERNEL_DS); | 508 | set_fs(KERNEL_DS); |
509 | /* | 509 | /* |
510 | * Accounting records are not subject to resource limits. | 510 | * Accounting records are not subject to resource limits. |
511 | */ | 511 | */ |
512 | flim = current->signal->rlim[RLIMIT_FSIZE].rlim_cur; | 512 | flim = current->signal->rlim[RLIMIT_FSIZE].rlim_cur; |
513 | current->signal->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY; | 513 | current->signal->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY; |
514 | file->f_op->write(file, (char *)&ac, | 514 | file->f_op->write(file, (char *)&ac, |