Blame io/test-stat.c

Packit Service 82fcde
/* Copyright (C) 2000-2018 Free Software Foundation, Inc.
Packit Service 82fcde
   Contributed by Maciej W. Rozycki <macro@ds2.pg.gda.pl>, 2000.
Packit Service 82fcde
   This file is part of the GNU C Library.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 82fcde
   modify it under the terms of the GNU Lesser General Public
Packit Service 82fcde
   License as published by the Free Software Foundation; either
Packit Service 82fcde
   version 2.1 of the License, or (at your option) any later version.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 82fcde
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 82fcde
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 82fcde
   Lesser General Public License for more details.
Packit Service 82fcde
Packit Service 82fcde
   You should have received a copy of the GNU Lesser General Public
Packit Service 82fcde
   License along with the GNU C Library; if not, see
Packit Service 82fcde
   <http://www.gnu.org/licenses/>.  */
Packit Service 82fcde
Packit Service 82fcde
/* We need to define:
Packit Service 82fcde
#define _FILE_OFFSET_BITS 64
Packit Service 82fcde
#define _LARGEFILE64_SOURCE 1
Packit Service 82fcde
*/
Packit Service 82fcde
Packit Service 82fcde
#include <assert.h>
Packit Service 82fcde
#include <stddef.h>
Packit Service 82fcde
#include <sys/stat.h>
Packit Service 82fcde
Packit Service 82fcde
static int
Packit Service 82fcde
do_test (void)
Packit Service 82fcde
{
Packit Service 82fcde
  /* With _FILE_OFFSET_BITS=64 struct stat and struct stat64 should
Packit Service 82fcde
     be identical.  */
Packit Service 82fcde
  assert (sizeof (struct stat)
Packit Service 82fcde
	  == sizeof (struct stat64));
Packit Service 82fcde
  assert (offsetof (struct stat, st_dev)
Packit Service 82fcde
	  == offsetof (struct stat64, st_dev));
Packit Service 82fcde
  assert (offsetof (struct stat, st_ino)
Packit Service 82fcde
	  == offsetof (struct stat64, st_ino));
Packit Service 82fcde
  assert (offsetof (struct stat, st_mode)
Packit Service 82fcde
	  == offsetof (struct stat64, st_mode));
Packit Service 82fcde
  assert (offsetof (struct stat, st_nlink)
Packit Service 82fcde
	  == offsetof (struct stat64, st_nlink));
Packit Service 82fcde
  assert (offsetof (struct stat, st_uid)
Packit Service 82fcde
	  == offsetof (struct stat64, st_uid));
Packit Service 82fcde
  assert (offsetof (struct stat, st_gid)
Packit Service 82fcde
	  == offsetof (struct stat64, st_gid));
Packit Service 82fcde
  assert (offsetof (struct stat, st_rdev)
Packit Service 82fcde
	  == offsetof (struct stat64, st_rdev));
Packit Service 82fcde
  assert (offsetof (struct stat, st_size)
Packit Service 82fcde
	  == offsetof (struct stat64, st_size));
Packit Service 82fcde
  assert (offsetof (struct stat, st_atime)
Packit Service 82fcde
	  == offsetof (struct stat64, st_atime));
Packit Service 82fcde
  assert (offsetof (struct stat, st_mtime)
Packit Service 82fcde
	  == offsetof (struct stat64, st_mtime));
Packit Service 82fcde
  assert (offsetof (struct stat, st_ctime)
Packit Service 82fcde
	  == offsetof (struct stat64, st_ctime));
Packit Service 82fcde
  assert (offsetof (struct stat, st_blksize)
Packit Service 82fcde
	  == offsetof (struct stat64, st_blksize));
Packit Service 82fcde
  assert (offsetof (struct stat, st_blocks)
Packit Service 82fcde
	  == offsetof (struct stat64, st_blocks));
Packit Service 82fcde
#if 0
Packit Service 82fcde
  /* Some systems have st_fstype but not all.  Don't check it for now.  */
Packit Service 82fcde
  assert (offsetof (struct stat, st_fstype)
Packit Service 82fcde
	  == offsetof (struct stat64, st_fstype));
Packit Service 82fcde
#endif
Packit Service 82fcde
  return 0;
Packit Service 82fcde
}
Packit Service 82fcde
Packit Service 82fcde
#define TEST_FUNCTION do_test ()
Packit Service 82fcde
#include "../test-skeleton.c"