Deleted Added
full compact
ibcs2_misc.c (83366) ibcs2_misc.c (89306)
1/*
2 * Copyright (c) 1995 Steven Wallace
3 * Copyright (c) 1994, 1995 Scott Bartram
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This software was developed by the Computer Systems Engineering group
8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and

--- 31 unchanged lines hidden (view full) ---

40 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
41 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
42 * SUCH DAMAGE.
43 *
44 * from: Header: sun_misc.c,v 1.16 93/04/07 02:46:27 torek Exp
45 *
46 * @(#)sun_misc.c 8.1 (Berkeley) 6/18/93
47 *
1/*
2 * Copyright (c) 1995 Steven Wallace
3 * Copyright (c) 1994, 1995 Scott Bartram
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This software was developed by the Computer Systems Engineering group
8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and

--- 31 unchanged lines hidden (view full) ---

40 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
41 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
42 * SUCH DAMAGE.
43 *
44 * from: Header: sun_misc.c,v 1.16 93/04/07 02:46:27 torek Exp
45 *
46 * @(#)sun_misc.c 8.1 (Berkeley) 6/18/93
47 *
48 * $FreeBSD: head/sys/i386/ibcs2/ibcs2_misc.c 83366 2001-09-12 08:38:13Z julian $
48 * $FreeBSD: head/sys/i386/ibcs2/ibcs2_misc.c 89306 2002-01-13 11:58:06Z alfred $
49 */
50
51/*
52 * IBCS2 compatibility module.
53 *
54 * IBCS2 system calls that are implemented differently in BSD are
55 * handled here.
56 */

--- 254 unchanged lines hidden (view full) ---

311 int buflen, error, eofflag;
312 u_long *cookies = NULL, *cookiep;
313 int ncookies;
314#define BSD_DIRENT(cp) ((struct dirent *)(cp))
315#define IBCS2_RECLEN(reclen) (reclen + sizeof(u_short))
316
317 if ((error = getvnode(td->td_proc->p_fd, SCARG(uap, fd), &fp)) != 0)
318 return (error);
49 */
50
51/*
52 * IBCS2 compatibility module.
53 *
54 * IBCS2 system calls that are implemented differently in BSD are
55 * handled here.
56 */

--- 254 unchanged lines hidden (view full) ---

311 int buflen, error, eofflag;
312 u_long *cookies = NULL, *cookiep;
313 int ncookies;
314#define BSD_DIRENT(cp) ((struct dirent *)(cp))
315#define IBCS2_RECLEN(reclen) (reclen + sizeof(u_short))
316
317 if ((error = getvnode(td->td_proc->p_fd, SCARG(uap, fd), &fp)) != 0)
318 return (error);
319 if ((fp->f_flag & FREAD) == 0)
319 if ((fp->f_flag & FREAD) == 0) {
320 fdrop(fp, td);
320 return (EBADF);
321 return (EBADF);
322 }
321 vp = (struct vnode *)fp->f_data;
323 vp = (struct vnode *)fp->f_data;
322 if (vp->v_type != VDIR) /* XXX vnode readdir op should do this */
324 if (vp->v_type != VDIR) { /* XXX vnode readdir op should do this */
325 fdrop(fp, td);
323 return (EINVAL);
326 return (EINVAL);
327 }
324
325 off = fp->f_offset;
326#define DIRBLKSIZ 512 /* XXX we used to use ufs's DIRBLKSIZ */
327 buflen = max(DIRBLKSIZ, SCARG(uap, nbytes));
328 buflen = min(buflen, MAXBSIZE);
329 buf = malloc(buflen, M_TEMP, M_WAITOK);
330 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
331again:

--- 90 unchanged lines hidden (view full) ---

422 }
423 /* if we squished out the whole block, try again */
424 if (outp == SCARG(uap, buf))
425 goto again;
426 fp->f_offset = off; /* update the vnode offset */
427eof:
428 td->td_retval[0] = SCARG(uap, nbytes) - resid;
429out:
328
329 off = fp->f_offset;
330#define DIRBLKSIZ 512 /* XXX we used to use ufs's DIRBLKSIZ */
331 buflen = max(DIRBLKSIZ, SCARG(uap, nbytes));
332 buflen = min(buflen, MAXBSIZE);
333 buf = malloc(buflen, M_TEMP, M_WAITOK);
334 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
335again:

--- 90 unchanged lines hidden (view full) ---

426 }
427 /* if we squished out the whole block, try again */
428 if (outp == SCARG(uap, buf))
429 goto again;
430 fp->f_offset = off; /* update the vnode offset */
431eof:
432 td->td_retval[0] = SCARG(uap, nbytes) - resid;
433out:
434 VOP_UNLOCK(vp, 0, td);
435 fdrop(fp, td);
430 if (cookies)
431 free(cookies, M_TEMP);
436 if (cookies)
437 free(cookies, M_TEMP);
432 VOP_UNLOCK(vp, 0, td);
433 free(buf, M_TEMP);
434 return (error);
435}
436
437int
438ibcs2_read(td, uap)
439 struct thread *td;
440 struct ibcs2_read_args *uap;

--- 16 unchanged lines hidden (view full) ---

457 int ncookies;
458
459 if ((error = getvnode(td->td_proc->p_fd, SCARG(uap, fd), &fp)) != 0) {
460 if (error == EINVAL)
461 return read(td, (struct read_args *)uap);
462 else
463 return error;
464 }
438 free(buf, M_TEMP);
439 return (error);
440}
441
442int
443ibcs2_read(td, uap)
444 struct thread *td;
445 struct ibcs2_read_args *uap;

--- 16 unchanged lines hidden (view full) ---

462 int ncookies;
463
464 if ((error = getvnode(td->td_proc->p_fd, SCARG(uap, fd), &fp)) != 0) {
465 if (error == EINVAL)
466 return read(td, (struct read_args *)uap);
467 else
468 return error;
469 }
465 if ((fp->f_flag & FREAD) == 0)
470 if ((fp->f_flag & FREAD) == 0) {
471 fdrop(fp, td);
466 return (EBADF);
472 return (EBADF);
473 }
467 vp = (struct vnode *)fp->f_data;
474 vp = (struct vnode *)fp->f_data;
475 if (vp->v_type != VDIR) {
476 fdrop(fp, td);
477 return read(td, (struct read_args *)uap);
478 }
479
480 off = fp->f_offset;
468 if (vp->v_type != VDIR)
469 return read(td, (struct read_args *)uap);
470
471 DPRINTF(("ibcs2_read: read directory\n"));
472
481 if (vp->v_type != VDIR)
482 return read(td, (struct read_args *)uap);
483
484 DPRINTF(("ibcs2_read: read directory\n"));
485
473 off = fp->f_offset;
474 buflen = max(DIRBLKSIZ, SCARG(uap, nbytes));
475 buflen = min(buflen, MAXBSIZE);
476 buf = malloc(buflen, M_TEMP, M_WAITOK);
477 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
478again:
479 aiov.iov_base = buf;
480 aiov.iov_len = buflen;
481 auio.uio_iov = &aiov;

--- 91 unchanged lines hidden (view full) ---

573 }
574 /* if we squished out the whole block, try again */
575 if (outp == SCARG(uap, buf))
576 goto again;
577 fp->f_offset = off; /* update the vnode offset */
578eof:
579 td->td_retval[0] = SCARG(uap, nbytes) - resid;
580out:
486 buflen = max(DIRBLKSIZ, SCARG(uap, nbytes));
487 buflen = min(buflen, MAXBSIZE);
488 buf = malloc(buflen, M_TEMP, M_WAITOK);
489 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
490again:
491 aiov.iov_base = buf;
492 aiov.iov_len = buflen;
493 auio.uio_iov = &aiov;

--- 91 unchanged lines hidden (view full) ---

585 }
586 /* if we squished out the whole block, try again */
587 if (outp == SCARG(uap, buf))
588 goto again;
589 fp->f_offset = off; /* update the vnode offset */
590eof:
591 td->td_retval[0] = SCARG(uap, nbytes) - resid;
592out:
593 VOP_UNLOCK(vp, 0, td);
594 fdrop(fp, td);
581 if (cookies)
582 free(cookies, M_TEMP);
595 if (cookies)
596 free(cookies, M_TEMP);
583 VOP_UNLOCK(vp, 0, td);
584 free(buf, M_TEMP);
585 return (error);
586}
587
588int
589ibcs2_mknod(td, uap)
590 struct thread *td;
591 struct ibcs2_mknod_args *uap;

--- 593 unchanged lines hidden ---
597 free(buf, M_TEMP);
598 return (error);
599}
600
601int
602ibcs2_mknod(td, uap)
603 struct thread *td;
604 struct ibcs2_mknod_args *uap;

--- 593 unchanged lines hidden ---