- if ( fp != NULL ) {
- /* NB: tell dofilewrite the offset, and to use the proc cred */
- error = dofilewrite( entryp->procp,
- fp,
- entryp->aiocb.aio_fildes,
- entryp->aiocb.aio_buf,
- entryp->aiocb.aio_nbytes,
- entryp->aiocb.aio_offset,
- FOF_OFFSET | FOF_PCRED,
- &entryp->returnval);
-
- fp_drop(entryp->procp, entryp->aiocb.aio_fildes, fp, 0);
- }
- else {
- fp_drop(entryp->procp, entryp->aiocb.aio_fildes, fp, 0);
- error = EBADF;
- }
+
+ /*
+ * <rdar://4714366>
+ * Needs vfs_context_t from vfs_context_create() in entryp!
+ */
+ context.vc_thread = proc_thread(entryp->procp); /* XXX */
+ context.vc_ucred = fp->f_fglob->fg_cred;
+
+ /* NB: tell dofilewrite the offset, and to use the proc cred */
+ error = dofilewrite(&context,
+ fp,
+ entryp->aiocb.aio_buf,
+ entryp->aiocb.aio_nbytes,
+ entryp->aiocb.aio_offset,
+ FOF_OFFSET | FOF_PCRED,
+ &entryp->returnval);
+
+ fp_drop(entryp->procp, entryp->aiocb.aio_fildes, fp, 0);