From owner-freebsd-questions Tue Sep 29 05:52:34 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id FAA15382 for freebsd-questions-outgoing; Tue, 29 Sep 1998 05:52:34 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from doughnut.remcomp.fr (doughnut.remcomp.fr [194.51.30.251]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id FAA15368 for ; Tue, 29 Sep 1998 05:52:25 -0700 (PDT) (envelope-from cdkit.remcomp.fr!dockes@remcomp.fr) Received: from cdkit.remcomp.fr (y-100 [192.168.3.3]) by yquem.cdkit.remcomp.fr (8.8.5/8.8.5) with ESMTP id OAA09113; Tue, 29 Sep 1998 14:45:14 +0200 (MET DST) Message-ID: <3610D659.12230F56@cdkit.remcomp.fr> Date: Tue, 29 Sep 1998 14:45:13 +0200 From: Jean-Francois Dockes Organization: CDKIT X-Mailer: Mozilla 4.05 [en] (X11; I; FreeBSD 2.2.7-RELEASE i386) MIME-Version: 1.0 To: freebsd-questions@FreeBSD.ORG Subject: Partial blocking sendto(2) with libc_r Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I'm running FreeBSD 2.2.7 release, and trying to add multithreading to an existing program. I have a problem with the send/sendto call: send() sometimes returns an incomplete count. The file descriptor is not set as non blocking by my program (of course, I guess that the underlying threads implementation sets O_NONBLOCK, but this should be transparent). The program does not actually create threads right now, it's just linked with libc_r. When linking with the normal libc, everything works fine. It also works fine under SOLARIS and LINUX (both with and without the threads library). The non threaded version of the program has transferred several terabytes of data to/from FreeBSD servers, so I guess it's more or less working. Also, I checked uthread_sendto.c and uthread_write.c, and they do work different. write() loops until the byte count is complete, sendto() does not. So my question is: Is it normal that send() could return an incomplete count on a blocking descriptor ? The manual page is not clear on the subject. The kernel comments are not exactly clear either. It seems to me that the normal sosend() will loop until something bad happens or everything is sent. Of course my workaround is to use write() except for OOB, but this doesn't look clean. --- Jean-Francois Dockes, CDKIT SA dockes@cdkit.remcomp.fr Tel: +33 1 41 12 04 44 Fax: +33 1 41 12 04 47 56 Boulevard de la Republique 92210 SAINT CLOUD. FRANCE To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message