From owner-p4-projects@FreeBSD.ORG Sat Apr 29 22:58:06 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 278B116A407; Sat, 29 Apr 2006 22:58:06 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ED27116A400 for ; Sat, 29 Apr 2006 22:58:05 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 66DEC43D46 for ; Sat, 29 Apr 2006 22:58:05 +0000 (GMT) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k3TMw5pr088337 for ; Sat, 29 Apr 2006 22:58:05 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k3TMw5FM088331 for perforce@freebsd.org; Sat, 29 Apr 2006 22:58:05 GMT (envelope-from jb@freebsd.org) Date: Sat, 29 Apr 2006 22:58:05 GMT Message-Id: <200604292258.k3TMw5FM088331@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 96378 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Apr 2006 22:58:06 -0000 http://perforce.freebsd.org/chv.cgi?CH=96378 Change 96378 by jb@jb_freebsd2 on 2006/04/29 22:57:29 Add Solaris compatibility definitions which are only visible if _SOLARIS_C_SOURCE is defined. The purpose of these changes is to reduce the amount of munging that is necessary to compile Solaris-centric source files. If isn't possible to make the Solaris files compile out-of-the-box without any #ifdefs because they have headers that FreeBSD doesn't have and adding those headers to FreeBSD feels like the wrong thing to do. Affected files ... .. //depot/projects/dtrace/src/sys/sys/param.h#3 edit .. //depot/projects/dtrace/src/sys/sys/stat.h#2 edit .. //depot/projects/dtrace/src/sys/sys/time.h#2 edit .. //depot/projects/dtrace/src/sys/sys/types.h#2 edit Differences ... ==== //depot/projects/dtrace/src/sys/sys/param.h#3 (text+ko) ==== @@ -331,4 +331,11 @@ #define ctodb(db) /* calculates pages to devblks */ \ ((db) << (PAGE_SHIFT - DEV_BSHIFT)) +/* + * Solaris compatibility definitions. + */ +#ifdef _SOLARIS_C_SOURCE +#define PAGESIZE PAGE_SIZE +#endif + #endif /* _SYS_PARAM_H_ */ ==== //depot/projects/dtrace/src/sys/sys/stat.h#2 (text+ko) ==== @@ -304,6 +304,14 @@ #endif /* __BSD_VISIBLE */ +/* + * Solaris compatibility definitions. + */ +#ifdef _SOLARIS_C_SOURCE +#define stat64 stat +#define fstat64 fstat +#endif + #ifndef _KERNEL __BEGIN_DECLS #if __BSD_VISIBLE ==== //depot/projects/dtrace/src/sys/sys/time.h#2 (text+ko) ==== @@ -322,4 +322,27 @@ #endif /* !_KERNEL */ +/* + * Solaris compatibility definitions. + */ +#ifdef _SOLARIS_C_SOURCE +/* + * Definitions for commonly used resolutions. + */ +#define SEC 1 +#define MILLISEC 1000 +#define MICROSEC 1000000 +#define NANOSEC 1000000000 + +typedef longlong_t hrtime_t; + +#ifndef _KERNEL +static __inline hrtime_t gethrtime() { + struct timespec ts; + clock_gettime(CLOCK_UPTIME,&ts); + return (ts.tv_sec * NANOSEC + ts.tv_nsec); +} +#endif +#endif /* _SOLARIS_C_SOURCE */ + #endif /* !_SYS_TIME_H_ */ ==== //depot/projects/dtrace/src/sys/sys/types.h#2 (text+ko) ==== @@ -297,6 +297,36 @@ #endif /* !_KERNEL */ /* + * Solaris compatibility definitions. + */ +#ifdef _SOLARIS_C_SOURCE +typedef u_int uint_t; +typedef u_char uchar_t; +typedef u_short ushort_t; +typedef u_long ulong_t; + +typedef long long longlong_t; +typedef unsigned long long u_longlong_t; + +typedef off_t off64_t; + +typedef id_t taskid_t; +typedef id_t projid_t; +typedef id_t poolid_t; +typedef id_t zoneid_t; +typedef id_t ctid_t; + +#ifndef _KERNEL +#if defined(__XOPEN_OR_POSIX) +typedef enum { _B_FALSE, _B_TRUE } boolean_t; +#else +typedef enum { B_FALSE, B_TRUE } boolean_t; +#endif /* defined(__XOPEN_OR_POSIX) */ +#endif + +#endif /* _SOLARIS_C_SOURCE */ + +/* * The following are all things that really shouldn't exist in this header, * since its purpose is to provide typedefs, not miscellaneous doodads. */