[PATCH] PowerPC64 - Fix INTERNAL_[V]SYSCALL_NCS macros to not cast return val to (int)

Roland McGrath roland@redhat.com
Mon Feb 14 19:18:00 GMT 2011


> Corrected the formatting.

Some of it is now correct, but plenty is still wrong.

> Fixed, though I have a question, what's the difference between
> UIO_MAXIOV and IOV_MAX?  POSIX specifies using IOV_MAX in the writev
> documentation but I used UIO_MAXIOV as you indicated.

IOV_MAX is the proper POSIX name.  Use that.

> /* writev should report that it has written EXPECTED number of bytes.  */
> #define EXPECTED ((ssize_t)INT32_MAX+1)

You can make this size_t and then use a cast on the return value to avoid
the compiler warning in the comparison.

> /* How big does each buffer have to be to fit EXPECTED into UIO_MAXIOV iovec
>  * structs?  We do this because not all systems will support an EXPECTED size
>  * malloc.  */
> const ssize_t bufsz = (EXPECTED / (UIO_MAXIOV - 1));
> 
> /* The last buffer is only partially full.  */
> const ssize_t bufrem = (EXPECTED % (UIO_MAXIOV - 1));

These should be size_t and there is no reason to make them globals.

Why - 1?


Thanks,
Roland



More information about the Libc-alpha mailing list