From owner-freebsd-questions Mon Aug 13 0:51:17 2001 Delivered-To: freebsd-questions@freebsd.org Received: from gamma.root-servers.ch (gamma.root-servers.ch [195.49.62.126]) by hub.freebsd.org (Postfix) with SMTP id 8F5F237B40A for ; Mon, 13 Aug 2001 00:51:11 -0700 (PDT) (envelope-from gabriel_ambuehl@buz.ch) Received: (qmail 59429 invoked from network); 13 Aug 2001 07:51:10 -0000 Received: from dclient217-162-128-224.hispeed.ch (HELO athlon550) (217.162.128.224) by 0 with SMTP; 13 Aug 2001 07:51:10 -0000 Date: Mon, 13 Aug 2001 09:53:52 +0200 From: Gabriel Ambuehl X-Mailer: The Bat! (v1.53bis) Educational Organization: BUZ Internet Services X-Priority: 3 (Normal) Message-ID: <138428502093.20010813095352@buz.ch> To: Ian Dowse Cc: questions@freebsd.org Subject: Re[2]: write() failing.. In-Reply-To: <200108122255.aa54655@salmon.maths.tcd.ie> References: <200108122255.aa54655@salmon.maths.tcd.ie> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG -----BEGIN PGP SIGNED MESSAGE----- Hello Ian, Sunday, August 12, 2001, 11:55:11 PM, you wrote: >>which I can't exactly understand as a failing write() should set >>errno > Try running ktrace on the program, and looking at the kdump output > to see what it's really doing. The use of c++ cout operations could > easily be changing or resetting errno, though I don't know for > sure. I suppose the following is the important info, C++ io got stripped from the source to ease debugging (there are various open() calls to read from libs which all use descriptor 3 but afterwards close it): 58204 test_logfile CALL open(0x804f1f0,0x328,0xbfbffb80) 58204 test_logfile NAMI "/var/log/some_log" 58204 test_logfile RET open 3 # so open returns with the correct file descriptor 58204 test_logfile CALL write(0x3,0x8050010,0xb) # write writes 0B bytes (which is about the length of hello world ;-)to file descriptor 3 58204 test_logfile RET write -1 errno 9 Bad file descriptor # and the bad file descriptor bites 58204 test_logfile CALL write(0x3,0x8050010,0xb) # write writes 0x0B bytes (which is about the length of hello world ;-)to file descriptor 3 58204 test_logfile RET write -1 errno 9 Bad file descriptor # and the bad file descriptor bites 58204 test_logfile CALL sigprocmask(0x1,0x2805faa0,0xbfbffb38) 58204 test_logfile RET sigprocmask 0 58204 test_logfile CALL sigprocmask(0x3,0x2805fab0,0) 58204 test_logfile RET sigprocmask 0 58204 test_logfile CALL exit(0) I think I'll try again with C++ ofstream instead of write() which I suppose is slower but it might help. Best regards, Gabriel -----BEGIN PGP SIGNATURE----- Version: PGP 6.5i iQEVAwUBO3d5g8Za2WpymlDxAQGr6wgAuw6O6sKFf0PDesQzZIAfNRdZQ9/iU/Iv TmeuhEN31WrodbeK/u/BypcTL4AoJpeji3bO4dy5S3Sb3pOmIjRcYI8eWHwqhu0y QgVZauzdyXRWgUStDD4ZGLfPmjujCJdyYcrRNMv3rxzT/Ir9+3Zxo/w6jswuxbpo UEOYHgaQV6iQLtgMzn25OnoDtfrJS/0g/jOH5a0waIOw6oYmOBATpoP143+nkI3l q1Fi6Hnme9X/dncsIePF9dzthVTTp1bjJleW/fZ21soHO43QOgr8hqsfIUdzrXEj WT/cC5pYiSpLDiwvG6oNpOYRzvPGicMDsQIRKOk+kmoriXVnEoordw== =zI+B -----END PGP SIGNATURE----- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message