~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to config.tests/unix/largefile/largefiletest.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Sample program for configure to test Large File support on target
 
2
platforms.
 
3
*/
 
4
 
 
5
#define _LARGEFILE_SOURCE
 
6
#define _LARGE_FILES
 
7
#define _FILE_OFFSET_BITS 64
 
8
#include <unistd.h>
 
9
#include <sys/types.h>
 
10
#include <sys/stat.h>
 
11
#include <assert.h>
 
12
#include <stdio.h>
 
13
 
 
14
int main( int, char **argv )
 
15
{
 
16
// check that off_t can hold 2^63 - 1 and perform basic operations...
 
17
#define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
 
18
    if (OFF_T_64 % 2147483647 != 1)
 
19
        return 1;
 
20
 
 
21
    // stat breaks on SCO OpenServer
 
22
    struct stat buf;
 
23
    stat( argv[0], &buf );
 
24
    if (!S_ISREG(buf.st_mode))
 
25
        return 2;
 
26
 
 
27
    FILE *file = fopen( argv[0], "r" );
 
28
    off_t offset = ftello( file );
 
29
    fseek( file, offset, SEEK_CUR );
 
30
    fclose( file );
 
31
    return 0;
 
32
}