Main Page | Namespace List | Class List | Directories | File List | Class Members | File Members

atomicio.c File Reference

#include "includes.h"
#include "atomicio.h"

Go to the source code of this file.

Functions

 RCSID ("$OpenBSD: atomicio.c,v 1.13 2005/05/24 17:32:43 avsm Exp $")
size_t atomicio (ssize_t *f, int fd, void *_s, size_t n)


Function Documentation

size_t atomicio ssize_t f,
int  fd,
void *  _s,
size_t  n
 

Definition at line 36 of file atomicio.c.

Referenced by auth2_read_banner(), client_input_channel_req(), client_suspend_self(), congreet(), conread(), do_download(), get_msg(), get_random_bytes_prngd(), key_load_private_rsa1(), key_load_public_rsa1(), key_save_private_rsa1(), main(), mm_request_receive(), mm_request_send(), prng_read_seedfile(), prng_write_seedfile(), refresh_progress_meter(), response(), rsource(), seed_rng(), send_msg(), sink(), source(), ssh_exchange_identification(), ssh_msg_recv(), ssh_msg_send(), ssh_request_reply(), sshd_exchange_identification(), and stop_progress_meter().

00041 {
00042         char *s = _s;
00043         size_t pos = 0;
00044         ssize_t res;
00045 
00046         while (n > pos) {
00047                 res = (f) (fd, s + pos, n - pos);
00048                 switch (res) {
00049                 case -1:
00050 #ifdef EWOULDBLOCK
00051                         if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK)
00052 #else
00053                         if (errno == EINTR || errno == EAGAIN)
00054 #endif
00055                                 continue;
00056                         return 0;
00057                 case 0:
00058                         errno = EPIPE;
00059                         return pos;
00060                 default:
00061                         pos += (u_int)res;
00062                 }
00063         }
00064         return (pos);
00065 }

RCSID "$OpenBSD: atomicio.  c,
v 1.13 2005/05/24 17:32:43 avsm Exp $" 
 


© sourcejam.com 2005-2008