Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 105422
b: refs/heads/master
c: 77d2720
h: refs/heads/master
v: v3
  • Loading branch information
Ulrich Drepper authored and Linus Torvalds committed Jul 24, 2008
1 parent d6bf059 commit 3dcffd2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 99829b832997d907c30669bfd17da32151e18f04
refs/heads/master: 77d2720059618b9b6e827a8b73831eb6c6fad63c
2 changes: 1 addition & 1 deletion trunk/include/linux/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include <linux/wait.h>
#include <linux/socket.h>
#include <linux/fcntl.h> /* For O_CLOEXEC */
#include <linux/fcntl.h> /* For O_CLOEXEC and O_NONBLOCK */
#include <asm/socket.h>

struct poll_table_struct;
Expand Down
20 changes: 10 additions & 10 deletions trunk/net/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ static int sock_alloc_fd(struct file **filep, int flags)
return fd;
}

static int sock_attach_fd(struct socket *sock, struct file *file)
static int sock_attach_fd(struct socket *sock, struct file *file, int flags)
{
struct dentry *dentry;
struct qstr name = { .name = "" };
Expand All @@ -391,7 +391,7 @@ static int sock_attach_fd(struct socket *sock, struct file *file)
init_file(file, sock_mnt, dentry, FMODE_READ | FMODE_WRITE,
&socket_file_ops);
SOCK_INODE(sock)->i_fop = &socket_file_ops;
file->f_flags = O_RDWR;
file->f_flags = O_RDWR | (flags & O_NONBLOCK);
file->f_pos = 0;
file->private_data = sock;

Expand All @@ -404,7 +404,7 @@ int sock_map_fd(struct socket *sock, int flags)
int fd = sock_alloc_fd(&newfile, flags);

if (likely(fd >= 0)) {
int err = sock_attach_fd(sock, newfile);
int err = sock_attach_fd(sock, newfile, flags);

if (unlikely(err < 0)) {
put_filp(newfile);
Expand Down Expand Up @@ -1223,7 +1223,7 @@ asmlinkage long sys_socket(int family, int type, int protocol)
int flags;

flags = type & ~SOCK_TYPE_MASK;
if (flags & ~SOCK_CLOEXEC)
if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK))
return -EINVAL;
type &= SOCK_TYPE_MASK;

Expand All @@ -1234,7 +1234,7 @@ asmlinkage long sys_socket(int family, int type, int protocol)
if (retval < 0)
goto out;

retval = sock_map_fd(sock, flags & O_CLOEXEC);
retval = sock_map_fd(sock, flags & (O_CLOEXEC | O_NONBLOCK));
if (retval < 0)
goto out_release;

Expand All @@ -1260,7 +1260,7 @@ asmlinkage long sys_socketpair(int family, int type, int protocol,
int flags;

flags = type & ~SOCK_TYPE_MASK;
if (flags & ~SOCK_CLOEXEC)
if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK))
return -EINVAL;
type &= SOCK_TYPE_MASK;

Expand Down Expand Up @@ -1298,12 +1298,12 @@ asmlinkage long sys_socketpair(int family, int type, int protocol,
goto out_release_both;
}

err = sock_attach_fd(sock1, newfile1);
err = sock_attach_fd(sock1, newfile1, flags & O_NONBLOCK);
if (unlikely(err < 0)) {
goto out_fd2;
}

err = sock_attach_fd(sock2, newfile2);
err = sock_attach_fd(sock2, newfile2, flags & O_NONBLOCK);
if (unlikely(err < 0)) {
fput(newfile1);
goto out_fd1;
Expand Down Expand Up @@ -1429,7 +1429,7 @@ long do_accept(int fd, struct sockaddr __user *upeer_sockaddr,
int err, len, newfd, fput_needed;
struct sockaddr_storage address;

if (flags & ~SOCK_CLOEXEC)
if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK))
return -EINVAL;

if (SOCK_NONBLOCK != O_NONBLOCK && (flags & SOCK_NONBLOCK))
Expand Down Expand Up @@ -1459,7 +1459,7 @@ long do_accept(int fd, struct sockaddr __user *upeer_sockaddr,
goto out_put;
}

err = sock_attach_fd(newsock, newfile);
err = sock_attach_fd(newsock, newfile, flags & O_NONBLOCK);
if (err < 0)
goto out_fd_simple;

Expand Down

0 comments on commit 3dcffd2

Please sign in to comment.