mirror of
https://github.com/torvalds/linux.git
synced 2024-12-29 06:12:08 +00:00
[PATCH] uml: add some EINTR protection
Add some more uses of the CATCH_EINTR wrapper. Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
108ffa8cbf
commit
9ead6feedd
@ -105,9 +105,7 @@ int net_recvfrom(int fd, void *buf, int len)
|
|||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
while(((n = recvfrom(fd, buf, len, 0, NULL, NULL)) < 0) &&
|
CATCH_EINTR(n = recvfrom(fd, buf, len, 0, NULL, NULL));
|
||||||
(errno == EINTR)) ;
|
|
||||||
|
|
||||||
if(n < 0){
|
if(n < 0){
|
||||||
if(errno == EAGAIN)
|
if(errno == EAGAIN)
|
||||||
return 0;
|
return 0;
|
||||||
@ -135,7 +133,7 @@ int net_send(int fd, void *buf, int len)
|
|||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
while(((n = send(fd, buf, len, 0)) < 0) && (errno == EINTR)) ;
|
CATCH_EINTR(n = send(fd, buf, len, 0));
|
||||||
if(n < 0){
|
if(n < 0){
|
||||||
if(errno == EAGAIN)
|
if(errno == EAGAIN)
|
||||||
return 0;
|
return 0;
|
||||||
@ -150,8 +148,8 @@ int net_sendto(int fd, void *buf, int len, void *to, int sock_len)
|
|||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
while(((n = sendto(fd, buf, len, 0, (struct sockaddr *) to,
|
CATCH_EINTR(n = sendto(fd, buf, len, 0, (struct sockaddr *) to,
|
||||||
sock_len)) < 0) && (errno == EINTR)) ;
|
sock_len));
|
||||||
if(n < 0){
|
if(n < 0){
|
||||||
if(errno == EAGAIN)
|
if(errno == EAGAIN)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "user.h"
|
#include "user.h"
|
||||||
#include "kern_util.h"
|
#include "kern_util.h"
|
||||||
|
#include "user_util.h"
|
||||||
|
|
||||||
static void copy_stat(struct uml_stat *dst, struct stat64 *src)
|
static void copy_stat(struct uml_stat *dst, struct stat64 *src)
|
||||||
{
|
{
|
||||||
@ -42,10 +43,7 @@ int os_stat_fd(const int fd, struct uml_stat *ubuf)
|
|||||||
struct stat64 sbuf;
|
struct stat64 sbuf;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
do {
|
CATCH_EINTR(err = fstat64(fd, &sbuf));
|
||||||
err = fstat64(fd, &sbuf);
|
|
||||||
} while((err < 0) && (errno == EINTR)) ;
|
|
||||||
|
|
||||||
if(err < 0)
|
if(err < 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user