chiark / gitweb /
Apply https://sourceware.org/git/?p=glibc.git;a=commit;h=d5dd6189d506068ed11c8bfa1e1e...
[eglibc.git] / io / test-stat.c
1 /* Copyright (C) 2000 Free Software Foundation, Inc.
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
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.
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
13    Lesser General Public License for more details.
14
15    You should have received a copy of the GNU Lesser General Public
16    License along with the GNU C Library; if not, write to the Free
17    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18    02111-1307 USA.  */
19
20 /* We need to define:
21 #define _FILE_OFFSET_BITS 64
22 #define _LARGEFILE64_SOURCE 1
23 */
24
25 #include <assert.h>
26 #include <stddef.h>
27 #include <sys/stat.h>
28
29 int
30 main (void)
31 {
32   /* With _FILE_OFFSET_BITS=64 struct stat and struct stat64 should
33      be identical.  */
34   assert (sizeof (struct stat)
35           == sizeof (struct stat64));
36   assert (offsetof (struct stat, st_dev)
37           == offsetof (struct stat64, st_dev));
38   assert (offsetof (struct stat, st_ino)
39           == offsetof (struct stat64, st_ino));
40   assert (offsetof (struct stat, st_mode)
41           == offsetof (struct stat64, st_mode));
42   assert (offsetof (struct stat, st_nlink)
43           == offsetof (struct stat64, st_nlink));
44   assert (offsetof (struct stat, st_uid)
45           == offsetof (struct stat64, st_uid));
46   assert (offsetof (struct stat, st_gid)
47           == offsetof (struct stat64, st_gid));
48   assert (offsetof (struct stat, st_rdev)
49           == offsetof (struct stat64, st_rdev));
50   assert (offsetof (struct stat, st_size)
51           == offsetof (struct stat64, st_size));
52   assert (offsetof (struct stat, st_atime)
53           == offsetof (struct stat64, st_atime));
54   assert (offsetof (struct stat, st_mtime)
55           == offsetof (struct stat64, st_mtime));
56   assert (offsetof (struct stat, st_ctime)
57           == offsetof (struct stat64, st_ctime));
58   assert (offsetof (struct stat, st_blksize)
59           == offsetof (struct stat64, st_blksize));
60   assert (offsetof (struct stat, st_blocks)
61           == offsetof (struct stat64, st_blocks));
62 #if 0
63   /* Some systems have st_fstype but not all.  Don't check it for now.  */
64   assert (offsetof (struct stat, st_fstype)
65           == offsetof (struct stat64, st_fstype));
66 #endif
67   return 0;
68 }