Deleted Added
full compact
sys_socket.c (130398) sys_socket.c (130480)
1/*
2 * Copyright (c) 1982, 1986, 1990, 1993
3 * The Regents of the University of California. 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

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

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)sys_socket.c 8.1 (Berkeley) 6/10/93
30 */
31
32#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1982, 1986, 1990, 1993
3 * The Regents of the University of California. 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

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

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)sys_socket.c 8.1 (Berkeley) 6/10/93
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/kern/sys_socket.c 130398 2004-06-13 02:50:07Z rwatson $");
33__FBSDID("$FreeBSD: head/sys/kern/sys_socket.c 130480 2004-06-14 18:16:22Z rwatson $");
34
35#include "opt_mac.h"
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/file.h>
40#include <sys/filedesc.h>
41#include <sys/mac.h>

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

163 case SIOCSPGRP:
164 return (fsetown(-(*(int *)data), &so->so_sigio));
165
166 case SIOCGPGRP:
167 *(int *)data = -fgetown(&so->so_sigio);
168 return (0);
169
170 case SIOCATMARK:
34
35#include "opt_mac.h"
36
37#include <sys/param.h>
38#include <sys/systm.h>
39#include <sys/file.h>
40#include <sys/filedesc.h>
41#include <sys/mac.h>

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

163 case SIOCSPGRP:
164 return (fsetown(-(*(int *)data), &so->so_sigio));
165
166 case SIOCGPGRP:
167 *(int *)data = -fgetown(&so->so_sigio);
168 return (0);
169
170 case SIOCATMARK:
171 *(int *)data = (so->so_state&SS_RCVATMARK) != 0;
171 *(int *)data = (so->so_rcv.sb_state & SBS_RCVATMARK) != 0;
172 return (0);
173 }
174 /*
175 * Interface/routing/protocol specific ioctls:
176 * interface and routing ioctls should have a
177 * different entry since a socket's unnecessary
178 */
179 if (IOCGROUP(cmd) == 'i')

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

202 struct ucred *active_cred;
203 struct thread *td;
204{
205 struct socket *so = fp->f_data;
206
207 bzero((caddr_t)ub, sizeof (*ub));
208 ub->st_mode = S_IFSOCK;
209 /*
172 return (0);
173 }
174 /*
175 * Interface/routing/protocol specific ioctls:
176 * interface and routing ioctls should have a
177 * different entry since a socket's unnecessary
178 */
179 if (IOCGROUP(cmd) == 'i')

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

202 struct ucred *active_cred;
203 struct thread *td;
204{
205 struct socket *so = fp->f_data;
206
207 bzero((caddr_t)ub, sizeof (*ub));
208 ub->st_mode = S_IFSOCK;
209 /*
210 * If SS_CANTRCVMORE is set, but there's still data left in the
210 * If SBS_CANTRCVMORE is set, but there's still data left in the
211 * receive buffer, the socket is still readable.
212 */
211 * receive buffer, the socket is still readable.
212 */
213 if ((so->so_state & SS_CANTRCVMORE) == 0 ||
213 if ((so->so_rcv.sb_state & SBS_CANTRCVMORE) == 0 ||
214 so->so_rcv.sb_cc != 0)
215 ub->st_mode |= S_IRUSR | S_IRGRP | S_IROTH;
214 so->so_rcv.sb_cc != 0)
215 ub->st_mode |= S_IRUSR | S_IRGRP | S_IROTH;
216 if ((so->so_state & SS_CANTSENDMORE) == 0)
216 if ((so->so_snd.sb_state & SBS_CANTSENDMORE) == 0)
217 ub->st_mode |= S_IWUSR | S_IWGRP | S_IWOTH;
218 ub->st_size = so->so_rcv.sb_cc - so->so_rcv.sb_ctl;
219 ub->st_uid = so->so_cred->cr_uid;
220 ub->st_gid = so->so_cred->cr_gid;
221 return ((*so->so_proto->pr_usrreqs->pru_sense)(so, ub));
222}
223
224/*

--- 22 unchanged lines hidden ---
217 ub->st_mode |= S_IWUSR | S_IWGRP | S_IWOTH;
218 ub->st_size = so->so_rcv.sb_cc - so->so_rcv.sb_ctl;
219 ub->st_uid = so->so_cred->cr_uid;
220 ub->st_gid = so->so_cred->cr_gid;
221 return ((*so->so_proto->pr_usrreqs->pru_sense)(so, ub));
222}
223
224/*

--- 22 unchanged lines hidden ---