Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Aug 2001 09:53:52 +0200
From:      Gabriel Ambuehl <gabriel_ambuehl@buz.ch>
To:        Ian Dowse <iedowse@maths.tcd.ie>
Cc:        questions@freebsd.org
Subject:   Re[2]: write() failing..
Message-ID:  <138428502093.20010813095352@buz.ch>
In-Reply-To: <200108122255.aa54655@salmon.maths.tcd.ie>
References:  <200108122255.aa54655@salmon.maths.tcd.ie>

next in thread | previous in thread | raw e-mail | index | archive | help
-----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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?138428502093.20010813095352>