Initial release for Tizen
[platform/upstream/ecryptfs-utils.git] / tests / userspace / lfs / test.c
1 /*
2  * Author: Tyler Hicks <tyhicks@canonical.com>
3  *
4  * Copyright (C) 2013 Canonical, Ltd.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 /*
22  * This test is to ensure that off_t is the same size as off64_t in all
23  * ecryptfs-utils builds. On 64 bit machines, this is the default. On 32 bit
24  * machines, the build system must define special variables to enable what is
25  * known as Large File Support (LFS).
26  *
27  * In configure.ac, we enable LFS by using the AC_SYS_LARGEFILE autoconf macro.
28  * It defines _FILE_OFFSET_BITS=64, when needed by the target architecture, in
29  * config.h. Also in configure.ac, we force all .c files to #include config.h
30  * so the entire ecryptfs-utils build should always have LFS enabled.
31  *
32  * IMPORTANT: We intentionally do not include config.h in this file, because it
33  * is expected that the build system automatically does it for us. This test
34  * verifies that the inclusion on config.h happens.
35  *
36  * We must define _LARGEFILE64_SOURCE in this file so that off64_t is
37  * available. However, defining it does not enable large file support.
38  */
39
40 #define _LARGEFILE64_SOURCE 1
41 #include <sys/types.h>
42
43 int main(void)
44 {
45         return sizeof(off_t) == sizeof(off64_t) ? 0 : 1;
46 }