Re: write(2) fails for large sizes in 64 bit applications
Re: write(2) fails for large sizes in 64 bit applications
- Subject: Re: write(2) fails for large sizes in 64 bit applications
- From: mm w <email@hidden>
- Date: Fri, 29 May 2009 13:20:26 -0700
Hi Jeremy,
we know... what Robert pointed is a problem of behaviour regarding the
return errno and the size_t,
what Robert suggested to make the syscall not to fail is arguable and
this is a question a side of the first comment.
Robert noted a strange behaviour and certainly was disrupted by the
errno and the size_t returned values
I guess he was making a test; Robert did compare both architectures
only to describe his point of view.
There is something wrong, if you read the standard regarding the
returned errno, this is not a big deal, but as Robert
noticed: he was misleaded.
Best,
On Fri, May 29, 2009 at 12:26 PM, Jeremy Pereira <email@hidden> wrote:
>
> On 28 May 2009, at 10:22, Robert Homann wrote:
>
>> Hi all!
>>
>>
>> Therefore, I think the implementation of write() is buggy; or at
>> least, its unexpected behavior in 64 bit mode should be documented on
>> the man page. What do you think?
>
> I think the behaviour is probably correct in that the OS X kernel is a *32
> bit* mach-o object, at least it is on my 10.5.7 Core 2 Duo Macbook Pro.
>
> monica:/ jeremyp$ otool -h /mach_kernel
> /mach_kernel:
> Mach header
> magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
> 0xfeedface 7 3 0x00 2 12 2808 0x00000001
> ^^^^^^^^^^ note the magic number.
>
> In /usr/include/mach-o/loader.h:
> ===========
>
> << snip >>
>
> /* Constant for the magic field of the mach_header (32-bit architectures) */
> #define MH_MAGIC 0xfeedface /* the mach magic number */
> #define MH_CIGAM 0xcefaedfe /* NXSwapInt(MH_MAGIC) */
>
> /*
> * The 64-bit mach header appears at the very beginning of object files for
> * 64-bit architectures.
> */
>
> << snip >>
>
> /* Constant for the magic field of the mach_header_64 (64-bit architectures)
> */
> #define MH_MAGIC_64 0xfeedfacf /* the 64-bit mach magic number */
> #define MH_CIGAM_64 0xcffaedfe /* NXSwapInt(MH_MAGIC_64) */
> ===========
>
> write(2) is a system call. The implementation is inside the kernel, not in
> any user space library linked with your application. Internally, it is
> going to be subject to 32 bit limits and personally I think that is entirely
> reasonable.
>
> Whilst I admit the kernel could be changed to cope with larger buffers, I
> think it is a bit harsh to criticise it because the largest block it can
> write to a file in one go is a mere 2Gb, especially considering some other
> 32 bit kernels can't run 64 bit code at all.
>
>>
>>
>> Best regards,
>> Robert Homann
>>
>> --
>> Windows is not the answer.
>> Windows is the question.
>> The answer is "No".
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Darwin-kernel mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-kernel mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden