Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/arch/usermode/usermode



In article <20111230110002.C9608175D0%cvs.netbsd.org@localhost>,
Reinoud Zandijk <source-changes-d%NetBSD.org@localhost> wrote:
>-=-=-=-=-=-
>
>Module Name:   src
>Committed By:  reinoud
>Date:          Fri Dec 30 11:00:02 UTC 2011
>
>Modified Files:
>       src/sys/arch/usermode/usermode: thunk.c
>
>Log Message:
>Use a wrapper around the send() to make sure it will transmit EVERYTHING and
>not just a part of the data
>
>
>To generate a diff of this commit:
>cvs rdiff -u -r1.57 -r1.58 src/sys/arch/usermode/usermode/thunk.c
>
>Please note that diffs are not public domain; they are subject to the
>copyright notices on the relevant files.
>
>
>-=-=-=-=-=-
>
>Modified files:
>
>Index: src/sys/arch/usermode/usermode/thunk.c
>diff -u src/sys/arch/usermode/usermode/thunk.c:1.57
>src/sys/arch/usermode/usermode/thunk.c:1.58
>--- src/sys/arch/usermode/usermode/thunk.c:1.57        Fri Dec 30 09:36:02 2011
>+++ src/sys/arch/usermode/usermode/thunk.c     Fri Dec 30 11:00:01 2011
>@@ -1,4 +1,4 @@
>-/* $NetBSD: thunk.c,v 1.57 2011/12/30 09:36:02 jmcneill Exp $ */
>+/* $NetBSD: thunk.c,v 1.58 2011/12/30 11:00:01 reinoud Exp $ */
> 
> /*-
>  * Copyright (c) 2011 Jared D. McNeill
><jmcneill%invisible.ca@localhost>
>@@ -28,7 +28,7 @@
> 
> #include <sys/cdefs.h>
> #ifdef __NetBSD__
>-__RCSID("$NetBSD: thunk.c,v 1.57 2011/12/30 09:36:02 jmcneill Exp $");
>+__RCSID("$NetBSD: thunk.c,v 1.58 2011/12/30 11:00:01 reinoud Exp $");
> #endif
> 
> #include <sys/types.h>
>@@ -896,6 +896,25 @@ thunk_rfb_open(thunk_rfb_t *rfb, uint16_
> }
> 
> static int
>+safe_send(int s, const void *msg, size_t len)
>+{
>+      const uint8_t *p;
>+      int sent_len;
>+
>+      p = msg;
>+      while (len) {
>+              assert(len >= 0);
>+              sent_len = send(s, p, len, MSG_NOSIGNAL);
>+              if (sent_len < 0) 
>+                      return -1;
>+      
>+              p   += sent_len;
>+              len -= sent_len;
>+      }
>+      return 0;
>+}

- Send returns ssize_t not int
- you should handle EAGAIN/EINTR.

christos



Home | Main Index | Thread Index | Old Index