| 1122 | } |
| 1123 | |
| 1124 | ssize_t |
| 1125 | ff_write(int fd, const void *buf, size_t nbytes) |
| 1126 | { |
| 1127 | struct uio auio; |
| 1128 | struct iovec aiov; |
| 1129 | int rc; |
| 1130 | |
| 1131 | if (nbytes > INT_MAX) { |
| 1132 | rc = EINVAL; |
| 1133 | goto kern_fail; |
| 1134 | } |
| 1135 | |
| 1136 | aiov.iov_base = (void *)(uintptr_t)buf; |
| 1137 | aiov.iov_len = nbytes; |
| 1138 | auio.uio_iov = &aiov; |
| 1139 | auio.uio_iovcnt = 1; |
| 1140 | auio.uio_resid = nbytes; |
| 1141 | auio.uio_segflg = UIO_SYSSPACE; |
| 1142 | if ((rc = kern_writev(curthread, fd, &auio))) |
| 1143 | goto kern_fail; |
| 1144 | rc = curthread->td_retval[0]; |
| 1145 | |
| 1146 | return (rc); |
| 1147 | kern_fail: |
| 1148 | ff_os_errno(rc); |
| 1149 | return (-1); |
| 1150 | } |
| 1151 | |
| 1152 | ssize_t |
| 1153 | ff_writev(int fd, const struct iovec *iov, int iovcnt) |
no test coverage detected