socket.c (77d2720059618b9b6e827a8b73831eb6c6fad63c) | socket.c (e38b36f325153eaadd1c2a7abc5762079233e540) |
---|---|
1/* 2 * NET An implementation of the SOCKET network access protocol. 3 * 4 * Version: @(#)socket.c 1.1.93 18/02/95 5 * 6 * Authors: Orest Zborowski, <obz@Kodak.COM> 7 * Ross Biro 8 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> --- 1208 unchanged lines hidden (view full) --- 1217} 1218 1219asmlinkage long sys_socket(int family, int type, int protocol) 1220{ 1221 int retval; 1222 struct socket *sock; 1223 int flags; 1224 | 1/* 2 * NET An implementation of the SOCKET network access protocol. 3 * 4 * Version: @(#)socket.c 1.1.93 18/02/95 5 * 6 * Authors: Orest Zborowski, <obz@Kodak.COM> 7 * Ross Biro 8 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> --- 1208 unchanged lines hidden (view full) --- 1217} 1218 1219asmlinkage long sys_socket(int family, int type, int protocol) 1220{ 1221 int retval; 1222 struct socket *sock; 1223 int flags; 1224 |
1225 /* Check the SOCK_* constants for consistency. */ 1226 BUILD_BUG_ON(SOCK_CLOEXEC != O_CLOEXEC); 1227 BUILD_BUG_ON((SOCK_MAX | SOCK_TYPE_MASK) != SOCK_TYPE_MASK); 1228 BUILD_BUG_ON(SOCK_CLOEXEC & SOCK_TYPE_MASK); 1229 BUILD_BUG_ON(SOCK_NONBLOCK & SOCK_TYPE_MASK); 1230 |
|
1225 flags = type & ~SOCK_TYPE_MASK; 1226 if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK)) 1227 return -EINVAL; 1228 type &= SOCK_TYPE_MASK; 1229 1230 if (SOCK_NONBLOCK != O_NONBLOCK && (flags & SOCK_NONBLOCK)) 1231 flags = (flags & ~SOCK_NONBLOCK) | O_NONBLOCK; 1232 --- 1235 unchanged lines hidden --- | 1231 flags = type & ~SOCK_TYPE_MASK; 1232 if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK)) 1233 return -EINVAL; 1234 type &= SOCK_TYPE_MASK; 1235 1236 if (SOCK_NONBLOCK != O_NONBLOCK && (flags & SOCK_NONBLOCK)) 1237 flags = (flags & ~SOCK_NONBLOCK) | O_NONBLOCK; 1238 --- 1235 unchanged lines hidden --- |