Re: [ccextractor-users] [ISSUE] lseek64 does not work on my 32-bit system
Brought to you by:
cfsmp3
|
From: Carlos F. <cf...@gm...> - 2014-05-21 06:27:26
|
OK... let's take care of this. Please send me a patch that doesn't
break CCExtractor for Windows or 64 bits linux :-)
On Wed, May 21, 2014 at 8:15 AM, anshul <ans...@gm...> wrote:
> HI
>
> I wrote small program to test lseek64 on my system,
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <unistd.h>
> #include <fcntl.h>
> #include <stdio.h>
> int main(int argc, char*argv[])
> {
>
> off_t var;
> int fd = open(argv[1],O_RDONLY);
> if (fd < 0)
> {
> perror("open");
> return -1;
> }
>
> var = LSEEK(fd,0,SEEK_END);
> perror("lseek");
>
> printf("%jd \n",var);
> return 0;
>
> }
>
>
> previously our system was running, since it was getting compiled using cpp
> and file size was valid
> [anshul@daku_daddy C]$ g++ -Wall -D_FILE_OFFSET_BITS=64 -DLSEEK=lseek64
> lseek.c
> [anshul@daku_daddy C]$ ./a.out ~/Videos/testfile_5GB
> lseek: Success
> 5054653440
>
> after changing to c, compiler doe not get correct declaration of lseek64 and
> middle argument
> is not typecasted before passing,and at compile time it give warning and run
> time error.
> [anshul@daku_daddy C]$ gcc -Wall -D_FILE_OFFSET_BITS=64 -DLSEEK=lseek64
> lseek.c
> lseek.c: In function ‘main’:
> lseek.c:17:2: warning: implicit declaration of function ‘lseek64’
> [-Wimplicit-function-declaration]
> [anshul@daku_daddy C]$ ./a.out ~/Videos/testfile_5GB
> lseek: Invalid argument
> -1
>
> over here if you look lseek(not lseek64) with FILE_OFFSET_BITS macro works
> on my system.
> [anshul@daku_daddy C]$ gcc -Wall -D_FILE_OFFSET_BITS=64 -DLSEEK=lseek
> lseek.c
> [anshul@daku_daddy C]$ ./a.out ~/Videos/testfile_5GB
> lseek: Success
> 5054653440
>
>
> There was another thing that i noticed, if i typecast "0" offset to long
> long, i don't get
> invalid argument error.
>
>
> On 05/21/2014 10:13 AM, anshul wrote:
>
> Hi
>
> lseek64 return -1 at run time and while compiling compiler gives following
> warning.
> gcc -c -Wno-write-strings -DGPAC_CONFIG_LINUX -D_FILE_OFFSET_BITS=64
> -I../src/gpacmp4/ -I../src/libpng -I../src/zlib -O3 -std=gnu99
> ../src/file_functions.c -o objs/file_functions.o
> ../src/file_functions.c: In function ‘getfilesize’:
> ../src/file_functions.c:14:5: warning: implicit declaration of function
> ‘lseek64’ [-Wimplicit-function-declaration]
> ../src/file_functions.c: In function ‘gettotalfilessize’:
> ../src/file_functions.c:31:9: warning: implicit declaration of function
> ‘open64’ [-Wimplicit-function-declaration]
>
>
> I have gone through man 7 feature_test_macro on linux , in which i
> interpreted that no need to use xxxx64,
> linux will do those things automatically if _FILE_OFFSET_BITS=64 is defined.
>
>
> following is variables from linux manuals:
>
> _LARGEFILE64_SOURCE:
>
> Expose definitions for the alternative API specified by the LFS (Large File
> Summit) as a "transitional extension" to the Single UNIX Specification.
> (See ⟨http://opengroup.org/platform/lfs.html⟩) The alternative API consists
> of a set of new objects (i.e., functions and types) whose names are
> suffixed with "64" (e.g., off64_t versus off_t, lseek64() versus lseek(),
> etc.). New programs should not employ this interface; instead
> _FILE_OFFSET_BITS=64 should be employed.
>
>
>
> _FILE_OFFSET_BITS:
>
> Defining this macro with the value 64 automatically converts references to
> 32-bit functions and data types related to file I/O and file system
> operations into references to their 64-bit counterparts. This is useful for
> performing I/O on large files (> 2 Gigabytes) on 32-bit systems. (Defining
> this macro permits correctly written programs to use large files with only a
> recompilation being required.) 64-bit systems naturally permit file
> sizes greater than 2 Gigabytes, and on those systems this macro has no
> effect.
>
>
> As our test server is 64bit the same issue is not reproduced there.
>
> Thanks
> Anshul
>
>
>
> ------------------------------------------------------------------------------
> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
> Instantly run your Selenium tests across 300+ browser/OS combos.
> Get unparalleled scalability from the best Selenium testing platform
> available
> Simple to use. Nothing to install. Get started now for free."
> http://p.sf.net/sfu/SauceLabs
> _______________________________________________
> ccextractor-users mailing list
> cce...@li...
> https://lists.sourceforge.net/lists/listinfo/ccextractor-users
>
|