Hi,

I see a problem in the fallback (fake) code, I decided there to use 
__X_nocancel for lseek*, read, write...
The comment below describes this situation in 6.a., but for master branch I 
think it would be better to use X instead, haven't checked, if all needed 
function's nocancel variants are implemented...

> + * 6. if functions are needed to implement __NC(NAME), that themselves
> are cancellable,
> + * decide how the cancellation should be solved, two variants are
> possible:
> + *  a. use the other function as __NC(FUNC), this way you access the
> non-cancellable
> + *  variant and provide by CANCELLABLE_SYSCALL(...) the dedicated
> cancellation for NAME.
> + *  be aware, that for this case __NC(FUNC) has to be hidden (not static)
> + *  b. use the other function with it's name (FUNC) and add
> LIBC_CANCEL_HANDLED(); at
> + *  the end of file with a comment telling us which function took care of
> the cancellation
> + * Note: LIBC_CANCEL_HANDLED() is noop on uClibc, glibc uses it only for
> tests, we use
> + * it only for "documentation".

[snip]
here comes the affected code, see __NC(lseek[64]), __NC(write) and __NC(read)

Peter

>       /* Since we must not change the file pointer preserve the
>        * value so that we can restore it later.  */
> -     if ((old_offset=lseek(fd, 0, SEEK_CUR)) == (off_t) -1)
> +     if ((old_offset = __NC(lseek)(fd, 0, SEEK_CUR)) == (off_t) -1)
>               return -1;
>  
>       /* Set to wanted position.  */
> -     if (lseek(fd, offset, SEEK_SET) == (off_t) -1)
> +     if (__NC(lseek)(fd, offset, SEEK_SET) == (off_t) -1)
>               return -1;
>  
>       if (do_pwrite == 1) {
>               /* Write the data.  */
> -             result = write(fd, buf, count);
> +             result = __NC(write)(fd, buf, count);
>       } else {
>               /* Read the data.  */
> -             result = read(fd, buf, count);
> +             result = __NC(read)(fd, buf, count);
>       }
>  
>       /* Now we have to restore the position.  If this fails we
>        * have to return this as an error.  */
>       save_errno = errno;
> -     if (lseek(fd, old_offset, SEEK_SET) == (off_t) -1)
> +     if (__NC(lseek)(fd, old_offset, SEEK_SET) == (off_t) -1)
>       {
>               if (result == -1)
>                       __set_errno(save_errno);
> @@ -113,10 +92,10 @@ static ssize_t __fake_pread_write(int fd, void *buf,
>       return(result);
>  }
>  
> -# ifdef __UCLIBC_HAS_LFS__
> -
> +# if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 32
>  static ssize_t __fake_pread_write64(int fd, void *buf,
> -             size_t count, off64_t offset, int do_pwrite)
> +                                 size_t count, off64_t offset,
> +                                 int do_pwrite)
>  {
>       int save_errno;
>       ssize_t result;
> @@ -124,24 +103,24 @@ static ssize_t __fake_pread_write64(int fd, void
> *buf,
>  
>       /* Since we must not change the file pointer preserve the
>        * value so that we can restore it later.  */
> -     if ((old_offset=lseek64(fd, 0, SEEK_CUR)) == (off64_t) -1)
> +     if ((old_offset = __NC(lseek64)(fd, 0, SEEK_CUR)) == (off64_t) -1)
>               return -1;
>  
>       /* Set to wanted position.  */
> -     if (lseek64(fd, offset, SEEK_SET) == (off64_t) -1)
> +     if (__NC(lseek64)(fd, offset, SEEK_SET) == (off64_t) -1)
>               return -1;
>  
>       if (do_pwrite == 1) {
>               /* Write the data.  */
> -             result = write(fd, buf, count);
> +             result = __NC(write)(fd, buf, count);
>       } else {
>               /* Read the data.  */
> -             result = read(fd, buf, count);
> +             result = __NC(read)(fd, buf, count);
>       }
>  
>       /* Now we have to restore the position. */
>       save_errno = errno;
> -     if (lseek64(fd, old_offset, SEEK_SET) == (off64_t) -1) {
> +     if (__NC(lseek64)(fd, old_offset, SEEK_SET) == (off64_t) -1) {
>               if (result == -1)
>                       __set_errno (save_errno);
>               return -1;
-- 
NEU: FreePhone - kostenlos mobil telefonieren und surfen!                       
Jetzt informieren: http://www.gmx.net/de/go/freephone
_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to