]> git.ipfire.org Git - thirdparty/glibc.git/blame - io/test-stat.c
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / io / test-stat.c
CommitLineData
04277e02 1/* Copyright (C) 2000-2019 Free Software Foundation, Inc.
ffce1bc7
AJ
2 Contributed by Maciej W. Rozycki <macro@ds2.pg.gda.pl>, 2000.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
ffce1bc7
AJ
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 13 Lesser General Public License for more details.
ffce1bc7 14
41bdb6e2 15 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
ffce1bc7 18
514f9e32
UD
19/* We need to define:
20#define _FILE_OFFSET_BITS 64
21#define _LARGEFILE64_SOURCE 1
22*/
23
24#include <assert.h>
25#include <stddef.h>
26#include <sys/stat.h>
27
29955b5d
AS
28static int
29do_test (void)
514f9e32
UD
30{
31 /* With _FILE_OFFSET_BITS=64 struct stat and struct stat64 should
32 be identical. */
33 assert (sizeof (struct stat)
34 == sizeof (struct stat64));
35 assert (offsetof (struct stat, st_dev)
36 == offsetof (struct stat64, st_dev));
37 assert (offsetof (struct stat, st_ino)
38 == offsetof (struct stat64, st_ino));
39 assert (offsetof (struct stat, st_mode)
40 == offsetof (struct stat64, st_mode));
41 assert (offsetof (struct stat, st_nlink)
42 == offsetof (struct stat64, st_nlink));
43 assert (offsetof (struct stat, st_uid)
44 == offsetof (struct stat64, st_uid));
45 assert (offsetof (struct stat, st_gid)
46 == offsetof (struct stat64, st_gid));
47 assert (offsetof (struct stat, st_rdev)
48 == offsetof (struct stat64, st_rdev));
49 assert (offsetof (struct stat, st_size)
50 == offsetof (struct stat64, st_size));
51 assert (offsetof (struct stat, st_atime)
52 == offsetof (struct stat64, st_atime));
53 assert (offsetof (struct stat, st_mtime)
54 == offsetof (struct stat64, st_mtime));
55 assert (offsetof (struct stat, st_ctime)
56 == offsetof (struct stat64, st_ctime));
57 assert (offsetof (struct stat, st_blksize)
58 == offsetof (struct stat64, st_blksize));
59 assert (offsetof (struct stat, st_blocks)
60 == offsetof (struct stat64, st_blocks));
61#if 0
62 /* Some systems have st_fstype but not all. Don't check it for now. */
63 assert (offsetof (struct stat, st_fstype)
64 == offsetof (struct stat64, st_fstype));
65#endif
66 return 0;
67}
29955b5d
AS
68
69#define TEST_FUNCTION do_test ()
70#include "../test-skeleton.c"