Deleted Added
full compact
svr4_stream.c (193014) svr4_stream.c (224778)
1/*-
2 * Copyright (c) 1998 Mark Newton. All rights reserved.
3 * Copyright (c) 1994, 1996 Christos Zoulas. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

31/*
32 * Pretend that we have streams...
33 * Yes, this is gross.
34 *
35 * ToDo: The state machine for getmsg needs re-thinking
36 */
37
38#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1998 Mark Newton. All rights reserved.
3 * Copyright (c) 1994, 1996 Christos Zoulas. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

31/*
32 * Pretend that we have streams...
33 * Yes, this is gross.
34 *
35 * ToDo: The state machine for getmsg needs re-thinking
36 */
37
38#include <sys/cdefs.h>
39__FBSDID("$FreeBSD: head/sys/compat/svr4/svr4_stream.c 193014 2009-05-29 05:58:46Z delphij $");
39__FBSDID("$FreeBSD: head/sys/compat/svr4/svr4_stream.c 224778 2011-08-11 12:30:23Z rwatson $");
40
41#include "opt_compat.h"
42#include "opt_ktrace.h"
43
44#include <sys/param.h>
45#include <sys/systm.h>
40
41#include "opt_compat.h"
42#include "opt_ktrace.h"
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/capability.h>
46#include <sys/fcntl.h>
47#include <sys/filedesc.h>
48#include <sys/filio.h>
49#include <sys/lock.h>
50#include <sys/malloc.h>
51#include <sys/file.h> /* Must come after sys/malloc.h */
52#include <sys/mbuf.h>
53#include <sys/mutex.h>

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

1443int
1444svr4_sys_putmsg(td, uap)
1445 struct thread *td;
1446 struct svr4_sys_putmsg_args *uap;
1447{
1448 struct file *fp;
1449 int error;
1450
47#include <sys/fcntl.h>
48#include <sys/filedesc.h>
49#include <sys/filio.h>
50#include <sys/lock.h>
51#include <sys/malloc.h>
52#include <sys/file.h> /* Must come after sys/malloc.h */
53#include <sys/mbuf.h>
54#include <sys/mutex.h>

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

1444int
1445svr4_sys_putmsg(td, uap)
1446 struct thread *td;
1447 struct svr4_sys_putmsg_args *uap;
1448{
1449 struct file *fp;
1450 int error;
1451
1451 if ((error = fget(td, uap->fd, &fp)) != 0) {
1452 if ((error = fget(td, uap->fd, CAP_WRITE, &fp)) != 0) {
1452#ifdef DEBUG_SVR4
1453 uprintf("putmsg: bad fp\n");
1454#endif
1455 return EBADF;
1456 }
1457 error = svr4_do_putmsg(td, uap, fp);
1458 fdrop(fp, td);
1459 return (error);

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

1615int
1616svr4_sys_getmsg(td, uap)
1617 struct thread *td;
1618 struct svr4_sys_getmsg_args *uap;
1619{
1620 struct file *fp;
1621 int error;
1622
1453#ifdef DEBUG_SVR4
1454 uprintf("putmsg: bad fp\n");
1455#endif
1456 return EBADF;
1457 }
1458 error = svr4_do_putmsg(td, uap, fp);
1459 fdrop(fp, td);
1460 return (error);

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

1616int
1617svr4_sys_getmsg(td, uap)
1618 struct thread *td;
1619 struct svr4_sys_getmsg_args *uap;
1620{
1621 struct file *fp;
1622 int error;
1623
1623 if ((error = fget(td, uap->fd, &fp)) != 0) {
1624 if ((error = fget(td, uap->fd, CAP_READ, &fp)) != 0) {
1624#ifdef DEBUG_SVR4
1625 uprintf("getmsg: bad fp\n");
1626#endif
1627 return EBADF;
1628 }
1629 error = svr4_do_getmsg(td, uap, fp);
1630 fdrop(fp, td);
1631 return (error);

--- 406 unchanged lines hidden ---
1625#ifdef DEBUG_SVR4
1626 uprintf("getmsg: bad fp\n");
1627#endif
1628 return EBADF;
1629 }
1630 error = svr4_do_getmsg(td, uap, fp);
1631 fdrop(fp, td);
1632 return (error);

--- 406 unchanged lines hidden ---