| 1528 | } |
| 1529 | |
| 1530 | int |
| 1531 | kern_fstat(struct thread *td, int fd, struct stat *sbp) |
| 1532 | { |
| 1533 | struct file *fp; |
| 1534 | int error; |
| 1535 | |
| 1536 | AUDIT_ARG_FD(fd); |
| 1537 | |
| 1538 | error = fget(td, fd, &cap_fstat_rights, &fp); |
| 1539 | if (__predict_false(error != 0)) |
| 1540 | return (error); |
| 1541 | |
| 1542 | AUDIT_ARG_FILE(td->td_proc, fp); |
| 1543 | |
| 1544 | error = fo_stat(fp, sbp, td->td_ucred, td); |
| 1545 | fdrop(fp, td); |
| 1546 | #ifdef __STAT_TIME_T_EXT |
| 1547 | sbp->st_atim_ext = 0; |
| 1548 | sbp->st_mtim_ext = 0; |
| 1549 | sbp->st_ctim_ext = 0; |
| 1550 | sbp->st_btim_ext = 0; |
| 1551 | #endif |
| 1552 | #ifdef KTRACE |
| 1553 | if (KTRPOINT(td, KTR_STRUCT)) |
| 1554 | ktrstat_error(sbp, error); |
| 1555 | #endif |
| 1556 | return (error); |
| 1557 | } |
| 1558 | |
| 1559 | #if defined(COMPAT_FREEBSD11) |
| 1560 | /* |
no test coverage detected