- if (access(ip, IWRITE) ||
- (ip->i_mode&IFMT) != IFREG ||
- ip->i_nlink != 1) {
- u.u_error = EFAULT;
- goto out;
- }
- itrunc(ip, (u_long)0);
- u.u_acflag |= ACORE;
- u.u_error = rdwri(UIO_WRITE, ip,
- (caddr_t)&u,
- ctob(UPAGES),
- 0, 1, (int *)0);
- if (u.u_error == 0)
- u.u_error = rdwri(UIO_WRITE, ip,
- (caddr_t)ctob(dptov(u.u_procp, 0)),
- ctob(u.u_dsize),
- ctob(UPAGES), 0, (int *)0);
- if (u.u_error == 0)
- u.u_error = rdwri(UIO_WRITE, ip,
- (caddr_t)ctob(sptov(u.u_procp, u.u_ssize - 1)),
- ctob(u.u_ssize),
- ctob(UPAGES)+ctob(u.u_dsize), 0, (int *)0);
-out:
- iput(ip);
- return (u.u_error == 0);
+ VATTR_NULL(&vattr);
+ vattr.va_size = 0;
+ VOP_SETATTR(vp, &vattr, cred);
+ p->p_acflag |= ACORE;
+#ifdef HPUXCOMPAT
+ /*
+ * BLETCH! If we loaded from an HPUX format binary file
+ * we have to dump an HPUX style user struct so that the
+ * HPUX debuggers can grok it.
+ */
+ if (u.u_pcb.pcb_flags & PCB_HPUXBIN)
+ error = hpuxdumpu(vp, cred);
+ else
+#endif
+ error = vn_rdwr(UIO_WRITE, vp, (caddr_t)&u, ctob(UPAGES), (off_t)0,
+ UIO_SYSSPACE, IO_NODELOCKED|IO_UNIT, cred, (int *)0);
+ if (error == 0)
+ error = vn_rdwr(UIO_WRITE, vp, vm->vm_daddr,
+ (int)ctob(vm->vm_dsize), (off_t)ctob(UPAGES), UIO_USERSPACE,
+ IO_NODELOCKED|IO_UNIT, cred, (int *)0);
+ if (error == 0)
+ error = vn_rdwr(UIO_WRITE, vp,
+ trunc_page(USRSTACK - ctob(vm->vm_ssize)),
+ round_page(ctob(vm->vm_ssize)),
+ (off_t)ctob(UPAGES) + ctob(vm->vm_dsize), UIO_USERSPACE,
+ IO_NODELOCKED|IO_UNIT, cred, (int *)0);
+ vput(vp);
+ return (error);
+}
+
+/*
+ * Nonexistent system call-- signal process (may want to handle it).
+ * Flag error in case process won't see signal immediately (blocked or ignored).
+ */
+/* ARGSUSED */
+nosys(p, args, retval)
+ struct proc *p;
+ void *args;
+ int *retval;
+{
+
+ psignal(p, SIGSYS);
+ return (EINVAL);