| 565 | }; |
| 566 | #endif |
| 567 | int |
| 568 | ogetrlimit(struct thread *td, struct ogetrlimit_args *uap) |
| 569 | { |
| 570 | struct orlimit olim; |
| 571 | struct rlimit rl; |
| 572 | int error; |
| 573 | |
| 574 | if (uap->which >= RLIM_NLIMITS) |
| 575 | return (EINVAL); |
| 576 | lim_rlimit(td, uap->which, &rl); |
| 577 | |
| 578 | /* |
| 579 | * XXX would be more correct to convert only RLIM_INFINITY to the |
| 580 | * old RLIM_INFINITY and fail with EOVERFLOW for other larger |
| 581 | * values. Most 64->32 and 32->16 conversions, including not |
| 582 | * unimportant ones of uids are even more broken than what we |
| 583 | * do here (they blindly truncate). We don't do this correctly |
| 584 | * here since we have little experience with EOVERFLOW yet. |
| 585 | * Elsewhere, getuid() can't fail... |
| 586 | */ |
| 587 | olim.rlim_cur = rl.rlim_cur > 0x7fffffff ? 0x7fffffff : rl.rlim_cur; |
| 588 | olim.rlim_max = rl.rlim_max > 0x7fffffff ? 0x7fffffff : rl.rlim_max; |
| 589 | error = copyout(&olim, uap->rlp, sizeof(olim)); |
| 590 | return (error); |
| 591 | } |
| 592 | #endif /* COMPAT_43 */ |
| 593 | |
| 594 | #ifndef _SYS_SYSPROTO_H_ |
nothing calls this directly
no test coverage detected