1290001Sglebius/* 2290001Sglebius * Copyright (C) 2004, 2005, 2007, 2008 Internet Systems Consortium, Inc. ("ISC") 3290001Sglebius * Copyright (C) 2000, 2001 Internet Software Consortium. 4290001Sglebius * 5290001Sglebius * Permission to use, copy, modify, and/or distribute this software for any 6290001Sglebius * purpose with or without fee is hereby granted, provided that the above 7290001Sglebius * copyright notice and this permission notice appear in all copies. 8290001Sglebius * 9290001Sglebius * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 10290001Sglebius * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 11290001Sglebius * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 12290001Sglebius * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13290001Sglebius * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 14290001Sglebius * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15290001Sglebius * PERFORMANCE OF THIS SOFTWARE. 16290001Sglebius */ 17290001Sglebius 18290001Sglebius/* $Id: offset.h,v 1.17 2008/12/01 23:47:45 tbox Exp $ */ 19290001Sglebius 20290001Sglebius#ifndef ISC_OFFSET_H 21290001Sglebius#define ISC_OFFSET_H 1 22290001Sglebius 23290001Sglebius/*! \file 24290001Sglebius * \brief 25290001Sglebius * File offsets are operating-system dependent. 26290001Sglebius */ 27290001Sglebius#include <limits.h> /* Required for CHAR_BIT. */ 28290001Sglebius#include <sys/types.h> 29290001Sglebius#include <stddef.h> /* For Linux Standard Base. */ 30290001Sglebius 31290001Sglebiustypedef off_t isc_offset_t; 32290001Sglebius 33290001Sglebius/*% 34290001Sglebius * POSIX says "Additionally, blkcnt_t and off_t are extended signed integral 35290001Sglebius * types", so the maximum value is all 1s except for the high bit. 36290001Sglebius * This definition is more complex than it really needs to be because it was 37290001Sglebius * crafted to keep both the SunOS 5.6 and the HP/UX 11 compilers quiet about 38290001Sglebius * integer overflow. For example, though this is equivalent to just left 39290001Sglebius * shifting 1 to the high bit and then inverting the bits, the SunOS compiler 40290001Sglebius * is unhappy about shifting a positive "1" to negative in a signed integer. 41290001Sglebius */ 42290001Sglebius#define ISC_OFFSET_MAXIMUM \ 43290001Sglebius (~(((off_t)-1 >> (sizeof(off_t) * CHAR_BIT - 1)) \ 44290001Sglebius << (sizeof(off_t) * CHAR_BIT - 1))) 45290001Sglebius 46290001Sglebius#endif /* ISC_OFFSET_H */ 47