From owner-freebsd-hackers Sun Nov 12 12:43:50 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id MAA06998 for hackers-outgoing; Sun, 12 Nov 1995 12:43:50 -0800 Received: from rah.star-gate.com (rah.star-gate.com [204.188.121.18]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id MAA06991 for ; Sun, 12 Nov 1995 12:43:48 -0800 Received: from rah.star-gate.com (localhost [127.0.0.1]) by rah.star-gate.com (8.6.12/8.6.9) with ESMTP id MAA01434 for ; Sun, 12 Nov 1995 12:43:38 -0800 Message-Id: <199511122043.MAA01434@rah.star-gate.com> X-Mailer: exmh version 1.6.2 7/18/95 To: hackers@FreeBSD.ORG Subject: linux's lseek vs freebsd's lseek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 12 Nov 1995 12:43:37 -0800 From: "Amancio Hasty Jr." Sender: owner-hackers@FreeBSD.ORG Precedence: bulk Howdy, While in the process of getting Linux's music server for Doom (musserver) working, I discovered that on linux you can issue a seek with a negative offset. So I changed the addition of an offset to a file position to be a of type "int". In vfs_syscalls.c, lseek(p, uap, retval) struct proc *p; register struct lseek_args *uap; int *retval; { struct ucred *cred = p->p_ucred; register struct filedesc *fdp = p->p_fd; register struct file *fp; struct vattr vattr; int error; if ((u_int)uap->fd >= fdp->fd_nfiles || (fp = fdp->fd_ofiles[uap->fd]) == NULL) return (EBADF); if (fp->f_type != DTYPE_VNODE) return (ESPIPE); switch (uap->whence) { case L_INCR: (int)fp->f_offset += (int)uap->offset; ^^^^ ^^^^ --------------- The question is what is the implication of doing a signed addition as supposed to an unsigned addition as it is in the original file. Tnks, Amancio