diff --git a/build/jam/OptionalPackages b/build/jam/OptionalPackages index c105ba85cb..89e4f59904 100644 --- a/build/jam/OptionalPackages +++ b/build/jam/OptionalPackages @@ -413,6 +413,7 @@ if [ IsOptionalHaikuImagePackageAdded DevelopmentMin ] && $(TARGET_ARCH) = x86 { AddFilesToHaikuImage develop etc : $(makefileEngineFiles) ; # headers + AddHeaderDirectoryToHaikuImage config ; AddHeaderDirectoryToHaikuImage glibc ; AddHeaderDirectoryToHaikuImage os ; AddHeaderDirectoryToHaikuImage posix ; @@ -465,15 +466,15 @@ if [ IsOptionalHaikuImagePackageAdded Firefox ] { InstallOptionalHaikuImagePackage BeZillaBrowser-2.0.0.22pre-x86-gcc4-2009-09-28 : $(baseURL)/BeZillaBrowser-2.0.0.22pre-x86-gcc4-2009-09-28.zip - : + : ; AddSymlinkToHaikuImage home config be Applications : /boot/apps/BeZillaBrowser/BeZillaBrowser ; } else { - InstallOptionalHaikuImagePackage + InstallOptionalHaikuImagePackage BeZillaBrowser-2.0.0.22pre-x86-gcc2-2009-09-27 : $(baseURL)/BeZillaBrowser-2.0.0.22pre-x86-gcc2-2009-09-27.zip - : + : ; AddSymlinkToHaikuImage home config be Applications : /boot/apps/BeZillaBrowser/BeZillaBrowser ; diff --git a/build/scripts/build_cross_tools b/build/scripts/build_cross_tools index 1d32a45838..f12012130a 100755 --- a/build/scripts/build_cross_tools +++ b/build/scripts/build_cross_tools @@ -88,6 +88,7 @@ copy_headers() done } +copy_headers $haikuSourceDir/headers/config $tmpIncludeDir/config copy_headers $haikuSourceDir/headers/os $tmpIncludeDir/os copy_headers $haikuSourceDir/headers/posix $tmpIncludeDir/posix diff --git a/build/scripts/build_cross_tools_gcc4 b/build/scripts/build_cross_tools_gcc4 index 4084bb0762..7370582561 100755 --- a/build/scripts/build_cross_tools_gcc4 +++ b/build/scripts/build_cross_tools_gcc4 @@ -126,6 +126,7 @@ copy_headers() done } +copy_headers $haikuSourceDir/headers/config $tmpIncludeDir/config copy_headers $haikuSourceDir/headers/os $tmpIncludeDir/os copy_headers $haikuSourceDir/headers/posix $tmpIncludeDir/posix diff --git a/headers/config/HaikuConfig.h b/headers/config/HaikuConfig.h new file mode 100644 index 0000000000..0453c0a99a --- /dev/null +++ b/headers/config/HaikuConfig.h @@ -0,0 +1,70 @@ +/* + * Copyright 2009, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _CONFIG_HAIKU_CONFIG_H +#define _CONFIG_HAIKU_CONFIG_H + + +/* Determine the architecture and define macros for some fundamental + properties: + __HAIKU_ARCH - short name of the architecture (used in paths) + __HAIKU_ARCH_ - defined to 1 for the respective architecture + __HAIKU_ARCH_64_BIT - defined to 1 on 64 bit architectures + __HAIKU_BIG_ENDIAN - defined to 1 on big endian architectures +*/ +#ifdef __INTEL__ +# ifdef __x86_64__ +# define __HAIKU_ARCH x86_64 +# define __HAIKU_ARCH_X86_64 1 +# define __HAIKU_ARCH_64_BIT 1 +# else +# define __HAIKU_ARCH x86 +# define __HAIKU_ARCH_X86 1 +# endif +#elif __POWERPC__ +# define __HAIKU_ARCH ppc +# define __HAIKU_ARCH_PPC 1 +# define __HAIKU_BIG_ENDIAN 1 +#elif __M68K__ +# define __HAIKU_ARCH m68k 1 +# define __HAIKU_ARCH_M68K 1 +# define __HAIKU_BIG_ENDIAN 1 +#elif __MIPSEL__ +# define __HAIKU_ARCH mipsel +# define __HAIKU_ARCH_MIPSEL 1 +#elif __ARM__ +# define __HAIKU_ARCH arm +# define __HAIKU_ARCH_ARM 1 +#else +# error Unsupported architecture! +#endif + +/* implied properties */ +#ifndef __HAIKU_ARCH_64_BIT +# define __HAIKU_ARCH_32_BIT 1 +#endif +#ifndef __HAIKU_BIG_ENDIAN +# define __HAIKU_LITTLE_ENDIAN 1 +#endif + +/* architecture specific include macros */ +#define __HAIKU_ARCH_HEADER(header) +#define __HAIKU_SUBDIR_ARCH_HEADER(subdir, header) \ + + +/* BeOS R5 binary compatibility (gcc 2 on x86) */ +#if defined(__HAIKU_ARCH_X86) && __GNUC__ == 2 +# define __HAIKU_BEOS_COMPATIBLE 1 +#endif + +/* BeOS R5 compatible types */ +#ifdef __HAIKU_ARCH_X86 + /* TODO: This should be "#ifdef __HAIKU_BEOS_COMPATIBLE", but this will + break all gcc 4 C++ optional packages. I.e. switch that at a suitable + time. + */ +# define __HAIKU_BEOS_COMPATIBLE_TYPES 1 +#endif + +#endif /* _CONFIG_HAIKU_CONFIG_H */ diff --git a/headers/config/types.h b/headers/config/types.h new file mode 100644 index 0000000000..47567a2194 --- /dev/null +++ b/headers/config/types.h @@ -0,0 +1,78 @@ +/* + * Copyright 2009, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _CONFIG_TYPES_H +#define _CONFIG_TYPES_H + + +#include + + +/* fixed-width types -- the __haiku_std_[u]int* types correspond to the POSIX + [u]int*_t types, the _haiku_[u]int* types to the BeOS [u]int* types. If + __HAIKU_BEOS_COMPATIBLE_TYPES is not defined both sets are identical. Once + we drop compatibility for good, we can consolidate the types. +*/ +typedef signed char __haiku_std_int8; +typedef unsigned char __haiku_std_uint8; +typedef signed short __haiku_std_int16; +typedef unsigned short __haiku_std_uint16; +typedef signed int __haiku_std_int32; +typedef unsigned int __haiku_std_uint32; +typedef signed long long __haiku_std_int64; +typedef unsigned long long __haiku_std_uint64; + +typedef __haiku_std_int8 __haiku_int8; +typedef __haiku_std_uint8 __haiku_uint8; +typedef __haiku_std_int16 __haiku_int16; +typedef __haiku_std_uint16 __haiku_uint16; +#ifdef __HAIKU_BEOS_COMPATIBLE_TYPES +typedef signed long int __haiku_int32; +typedef unsigned long int __haiku_uint32; +#else +typedef __haiku_std_int32 __haiku_int32; +typedef __haiku_std_uint32 __haiku_uint32; +#endif +typedef __haiku_std_int64 __haiku_int64; +typedef __haiku_std_uint64 __haiku_uint64; + +/* address types */ +#ifdef __HAIKU_ARCH_64_BIT + typedef __haiku_int64 __haiku_saddr_t; + typedef __haiku_uint64 __haiku_addr_t; +#else + typedef __haiku_int32 __haiku_saddr_t; + typedef __haiku_uint32 __haiku_addr_t; +#endif + +/* address type limits */ +#ifdef __HAIKU_ARCH_64_BIT +# define __HAIKU_SADDR_MAX (9223372036854775807LL) +# define __HAIKU_ADDR_MAX (18446744073709551615ULL) +#else +# define __HAIKU_SADDR_MAX (2147483647) +# define __HAIKU_ADDR_MAX (4294967295U) +#endif +#define __HAIKU_SADDR_MIN (-__HAIKU_SADDR_MIN-1) + + +/* printf()/scanf() format prefixes */ +#define __HAIKU_STD_PRI_PREFIX_32 "" +#define __HAIKU_STD_PRI_PREFIX_64 "ll" + +#ifdef __HAIKU_BEOS_COMPATIBLE_TYPES +# define __HAIKU_PRI_PREFIX_32 "l" +#else +# define __HAIKU_PRI_PREFIX_32 __HAIKU_STD_PRI_PREFIX_32 +#endif +#define __HAIKU_PRI_PREFIX_64 __HAIKU_STD_PRI_PREFIX_64 + +#ifdef __HAIKU_ARCH_64_BIT +# define __HAIKU_PRI_PREFIX_ADDR __HAIKU_STD_PRI_PREFIX_64 +#else +# define __HAIKU_PRI_PREFIX_ADDR __HAIKU_STD_PRI_PREFIX_32 +#endif + + +#endif /* _CONFIG_TYPES_H */ diff --git a/headers/cpp/std/bastring.h b/headers/cpp/std/bastring.h index 625a1ebaa2..8f95a7c92c 100644 --- a/headers/cpp/std/bastring.h +++ b/headers/cpp/std/bastring.h @@ -38,6 +38,10 @@ // NOTE : This does NOT conform to the draft standard and is likely to change #include +#ifdef __HAIKU__ +# include +#endif + extern "C++" { class istream; class ostream; @@ -61,12 +65,10 @@ extern void __length_error (const char *); #endif -#if (defined(__BEOS__) || defined(__HAIKU__)) -// Needed for atomic_add(): -typedef long int32; -typedef volatile long vint32; -extern "C" int32 atomic_add(vint32* value, int32 addvalue); -#endif /* __BEOS__ */ +#ifdef __HAIKU__ +extern "C" __haiku_int32 atomic_add(volatile __haiku_int32* value, + __haiku_int32 addvalue); +#endif /* __HAIKU__ */ template , class Allocator = alloc > @@ -79,9 +81,9 @@ private: charT* data () { return reinterpret_cast(this + 1); } charT& operator[] (size_t s) { return data () [s]; } -#if (defined(__BEOS__) || defined(__HAIKU__)) - charT* grab () { if (selfish) return clone (); atomic_add((vint32*) &ref, 1); return data (); } - void release() { if (atomic_add((int32*) &ref, -1) == 1) delete this; } +#ifdef __HAIKU__ + charT* grab () { if (selfish) return clone (); atomic_add((volatile __haiku_int32*) &ref, 1); return data (); } + void release() { if (atomic_add((__haiku_int32*) &ref, -1) == 1) delete this; } #else charT* grab () { if (selfish) return clone (); ++ref; return data (); } #if defined __i486__ || defined __i586__ || defined __i686__ @@ -89,8 +91,8 @@ private: { size_t __val; // This opcode exists as a .byte instead of as a mnemonic for the - // benefit of SCO OpenServer 5. The system assembler (which is - // essentially required on this target) can't assemble xaddl in + // benefit of SCO OpenServer 5. The system assembler (which is + // essentially required on this target) can't assemble xaddl in //COFF mode. asm (".byte 0xf0, 0x0f, 0xc1, 0x02" // lock; xaddl %eax, (%edx) : "=a" (__val) @@ -119,7 +121,7 @@ private: #else void release () { if (--ref == 0) delete this; } #endif -#endif /* __BEOS__ */ +#endif /* __HAIKU__ */ inline static void * operator new (size_t, size_t); inline static void operator delete (void *); inline static Rep* create (size_t); @@ -221,7 +223,7 @@ public: void push_back(charT __c) { append(1, __c); } - + basic_string& assign (const basic_string& str, size_type pos = 0, size_type n = npos) { return replace (0, npos, str, pos, n); } diff --git a/headers/os/BeBuild.h b/headers/os/BeBuild.h index 6bf1fbbc06..6875361536 100644 --- a/headers/os/BeBuild.h +++ b/headers/os/BeBuild.h @@ -6,6 +6,9 @@ #define _BE_BUILD_H +#include + + #define B_BEOS_VERSION_4 0x0400 #define B_BEOS_VERSION_4_5 0x0450 #define B_BEOS_VERSION_5 0x0500 @@ -41,6 +44,15 @@ #endif +#ifdef __HAIKU_ARCH_64_BIT +# define B_HAIKU_64_BIT 1 +#endif + +#ifdef __HAIKU_BEOS_COMPATIBLE +# define B_HAIKU_BEOS_COMPATIBLE 1 +#endif + + #define _UNUSED(argument) argument #define _PACKED __attribute__((packed)) #define _PRINTFLIKE(_format_, _args_) \ diff --git a/headers/os/device/CAM.h b/headers/os/device/CAM.h index fab94c068e..a23d21ea42 100644 --- a/headers/os/device/CAM.h +++ b/headers/os/device/CAM.h @@ -6,9 +6,9 @@ * Definitions for the SCSI Common Access Method as implemented in Haiku. * * See also "Draft Proposed American National Standard, SCSI-2 Common - * Access Method Transport and SCSI Interface Module", Revision 12, + * Access Method Transport and SCSI Interface Module", Revision 12, * ANSI refernce number X3.232-199x. - * + * */ #ifndef _CAM_H @@ -18,20 +18,21 @@ #include + #ifdef __cplusplus extern "C" { #endif #ifndef U32 -typedef unsigned long U32; +typedef uint32 U32; #endif #ifndef I32 -typedef long I32; +typedef int32 I32; #endif #ifndef U16 -typedef unsigned short U16; +typedef uint16 U16; #endif /* Haiku specific additions */ @@ -43,7 +44,7 @@ typedef struct { uchar path; /* target SIM ID */ uchar target; /* target device ID */ uchar sgcount; /* # of sg segments (0 if non-sg operation) */ - uchar scsi_op; /* scsi operation byte */ + uchar scsi_op; /* scsi operation byte */ } cam_iostat; /* End of Haiku specific additions */ @@ -89,7 +90,7 @@ typedef struct { #define HBA_ID 16 /* ASCII string len for HBA ID */ #define BE_SIM_CCB_SIZE 1536 /* we want to allocate 1.5k chunks */ -#define BE_SIM_SCSIIO_SIZE 88 /* sizeof(CAM_CCB_SCSIIO) - SIM_PRIV */ +#define BE_SIM_SCSIIO_SIZE 88 /* sizeof(CAM_CCB_SCSIIO) - SIM_PRIV */ #define SIM_PRIV (BE_SIM_CCB_SIZE - BE_SIM_SCSIIO_SIZE) /* Length of SIM private data area */ /* SIM_PRIV (sim private data area) Terms and Conditions: @@ -97,7 +98,7 @@ typedef struct { - the size of SIM_PRIV shall be such that sizeof(CCB_SIZE_UNION) = 1.5k - all CCB's shall be allocated from locked, contiguous memory - CCB's shall be aligned on 512 byte boundaries - - SIM_PRIV will be >= 1408 bytes + - SIM_PRIV will be >= 1408 bytes - this provides 128 8byte sg entries (512mb worth of pages, worstcase fragmentation) - and 256 bytes for sense data and 128 bytes for whatever else the SIM needs @@ -116,7 +117,7 @@ typedef struct ccb_header uint16 cam_ccb_len; /* Length of the entire CCB */ uchar cam_func_code; /* XPT function code */ uchar cam_status; /* Returned CAM subsystem status */ - uchar cam_hrsvd0; /* Reserved field, for alignment */ + uchar cam_hrsvd0; /* Reserved field, for alignment */ uchar cam_path_id; /* Path ID for the request */ uchar cam_target_id; /* Target device ID */ uchar cam_target_lun; /* Target LUN number */ @@ -174,7 +175,7 @@ typedef struct ccb_scsiio uchar* cam_pdrv_ptr; /* Ptr used by the Peripheral driver */ CCB_HEADER* cam_next_ccb; /* Ptr to the next CCB for action */ uchar* cam_req_map; /* Ptr for mapping info on the Req. */ - void (*cam_cbfcnp)(struct ccb_scsiio*); + void (*cam_cbfcnp)(struct ccb_scsiio*); /* Callback on completion function */ uchar* cam_data_ptr; /* Pointer to the data buf/SG list */ uint32 cam_dxfer_len; /* Data xfer length */ @@ -642,7 +643,7 @@ enum { typedef struct cam_for_driver_module_info cam_for_driver_module_info; struct cam_for_driver_module_info { - bus_manager_info minfo; + bus_manager_info minfo; CCB_HEADER* (*xpt_ccb_alloc)(void); void (*xpt_ccb_free)(void* ccb); long (*xpt_action)(CCB_HEADER* ccbh); @@ -657,7 +658,7 @@ struct cam_for_driver_module_info { typedef struct cam_for_sim_module_info cam_for_sim_module_info; struct cam_for_sim_module_info { - bus_manager_info minfo; + bus_manager_info minfo; long (*xpt_bus_register)(CAM_SIM_ENTRY* sim); long (*xpt_bus_deregister)(long path); }; diff --git a/headers/os/support/SupportDefs.h b/headers/os/support/SupportDefs.h index 4017bcfb02..b01866ac88 100644 --- a/headers/os/support/SupportDefs.h +++ b/headers/os/support/SupportDefs.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007, Haiku, Inc. All Rights Reserved. + * Copyright 2004-2009, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Author: @@ -9,39 +9,32 @@ #define _SUPPORT_DEFS_H -/* this must be located before the include of sys/types.h */ -#if !defined(_SYS_TYPES_H) && !defined(_SYS_TYPES_H_) -typedef unsigned long ulong; -typedef unsigned int uint; -typedef unsigned short ushort; -#endif - #include #include +#include #include -/* Shorthand type formats */ -typedef signed char int8; -typedef unsigned char uint8; -typedef volatile signed char vint8; -typedef volatile unsigned char vuint8; +/* fixed-size integer types */ +typedef __haiku_int8 int8; +typedef __haiku_uint8 uint8; +typedef __haiku_int16 int16; +typedef __haiku_uint16 uint16; +typedef __haiku_int32 int32; +typedef __haiku_uint32 uint32; +typedef __haiku_int64 int64; +typedef __haiku_uint64 uint64; -typedef short int16; -typedef unsigned short uint16; -typedef volatile short vint16; -typedef volatile unsigned short vuint16; - -typedef long int32; -typedef unsigned long uint32; -typedef volatile long vint32; -typedef volatile unsigned long vuint32; - -typedef long long int64; -typedef unsigned long long uint64; -typedef volatile long long vint64; -typedef volatile unsigned long long vuint64; +/* shorthand types */ +typedef volatile int8 vint8; +typedef volatile uint8 vuint8; +typedef volatile int16 vint16; +typedef volatile uint16 vuint16; +typedef volatile int32 vint32; +typedef volatile uint32 vuint32; +typedef volatile int64 vint64; +typedef volatile uint64 vuint64; typedef volatile long vlong; typedef volatile int vint; @@ -56,14 +49,85 @@ typedef volatile unsigned char vuchar; typedef unsigned char uchar; typedef unsigned short unichar; - -/* Descriptive formats */ +/* descriptive types */ typedef int32 status_t; typedef int64 bigtime_t; typedef uint32 type_code; typedef uint32 perform_code; +/* printf()/scanf() format strings for [u]int* types */ +# define B_PRId8 "d" +# define B_PRIi8 "i" +# define B_PRId16 "d" +# define B_PRIi16 "i" +# define B_PRId32 __HAIKU_PRI_PREFIX_32 "d" +# define B_PRIi32 __HAIKU_PRI_PREFIX_32 "i" +# define B_PRId64 __HAIKU_PRI_PREFIX_64 "d" +# define B_PRIi64 __HAIKU_PRI_PREFIX_64 "i" +# define B_PRIu8 "u" +# define B_PRIo8 "o" +# define B_PRIx8 "x" +# define B_PRIX8 "X" +# define B_PRIu16 "u" +# define B_PRIo16 "o" +# define B_PRIx16 "x" +# define B_PRIX16 "X" +# define B_PRIu32 __HAIKU_PRI_PREFIX_32 "u" +# define B_PRIo32 __HAIKU_PRI_PREFIX_32 "o" +# define B_PRIx32 __HAIKU_PRI_PREFIX_32 "x" +# define B_PRIX32 __HAIKU_PRI_PREFIX_32 "X" +# define B_PRIu64 __HAIKU_PRI_PREFIX_64 "u" +# define B_PRIo64 __HAIKU_PRI_PREFIX_64 "o" +# define B_PRIx64 __HAIKU_PRI_PREFIX_64 "x" +# define B_PRIX64 __HAIKU_PRI_PREFIX_64 "X" + +# define B_SCNd8 "hhd" +# define B_SCNi8 "hhi" +# define B_SCNd16 "hd" +# define B_SCNi16 "hi" +# define B_SCNd32 __HAIKU_PRI_PREFIX_32 "d" +# define B_SCNi32 __HAIKU_PRI_PREFIX_32 "i" +# define B_SCNd64 __HAIKU_PRI_PREFIX_64 "d" +# define B_SCNi64 __HAIKU_PRI_PREFIX_64 "i" +# define B_SCNu8 "hhu" +# define B_SCNo8 "hho" +# define B_SCNx8 "hhx" +# define B_SCNu16 "hu" +# define B_SCNo16 "ho" +# define B_SCNx16 "hx" +# define B_SCNu32 __HAIKU_PRI_PREFIX_32 "u" +# define B_SCNo32 __HAIKU_PRI_PREFIX_32 "o" +# define B_SCNx32 __HAIKU_PRI_PREFIX_32 "x" +# define B_SCNu64 __HAIKU_PRI_PREFIX_64 "u" +# define B_SCNo64 __HAIKU_PRI_PREFIX_64 "o" +# define B_SCNx64 __HAIKU_PRI_PREFIX_64 "x" + +/* printf() format strings for some standard types */ +/* size_t */ +#define B_PRIuSIZE __HAIKU_PRI_PREFIX_ADDR "u" +#define B_PRIoSIZE __HAIKU_PRI_PREFIX_ADDR "o" +#define B_PRIxSIZE __HAIKU_PRI_PREFIX_ADDR "x" +#define B_PRIXSIZE __HAIKU_PRI_PREFIX_ADDR "X" +/* ssize_t */ +#define B_PRIdSSIZE __HAIKU_PRI_PREFIX_ADDR "d" +#define B_PRIiSSIZE __HAIKU_PRI_PREFIX_ADDR "i" +/* addr_t */ +#define B_PRIuADDR __HAIKU_PRI_PREFIX_ADDR "u" +#define B_PRIoADDR __HAIKU_PRI_PREFIX_ADDR "o" +#define B_PRIxADDR __HAIKU_PRI_PREFIX_ADDR "x" +#define B_PRIXADDR __HAIKU_PRI_PREFIX_ADDR "X" +/* off_t */ +#define B_PRIdOFF B_PRId64 +#define B_PRIiOFF B_PRIi64 +/* dev_t */ +#define B_PRIdDEV B_PRId32 +#define B_PRIiDEV B_PRIi32 +/* ino_t */ +#define B_PRIdINO B_PRId64 +#define B_PRIiINO B_PRIi64 + + /* Empty string ("") */ #ifdef __cplusplus extern const char *B_EMPTY_STRING; @@ -78,9 +142,9 @@ extern const char *B_EMPTY_STRING; # ifndef max # define max(a,b) ((a)>(b)?(a):(b)) # endif -#endif +#endif -/* min() and max() won't work in C++ */ +/* min() and max() are functions in C++ */ #define min_c(a,b) ((a)>(b)?(b):(a)) #define max_c(a,b) ((a)>(b)?(a):(b)) @@ -88,7 +152,7 @@ extern const char *B_EMPTY_STRING; /* Grandfathering */ #ifndef __cplusplus # include -#endif +#endif #ifndef NULL # define NULL (0) @@ -104,14 +168,14 @@ extern int32 atomic_set(vint32 *value, int32 newValue); extern int32 atomic_test_and_set(vint32 *value, int32 newValue, int32 testAgainst); extern int32 atomic_add(vint32 *value, int32 addValue); extern int32 atomic_and(vint32 *value, int32 andValue); -extern int32 atomic_or(vint32 *value, int32 orValue); +extern int32 atomic_or(vint32 *value, int32 orValue); extern int32 atomic_get(vint32 *value); extern int64 atomic_set64(vint64 *value, int64 newValue); extern int64 atomic_test_and_set64(vint64 *value, int64 newValue, int64 testAgainst); extern int64 atomic_add64(vint64 *value, int64 addValue); extern int64 atomic_and64(vint64 *value, int64 andValue); -extern int64 atomic_or64(vint64 *value, int64 orValue); +extern int64 atomic_or64(vint64 *value, int64 orValue); extern int64 atomic_get64(vint64 *value); /* Other stuff */ diff --git a/headers/posix/endian.h b/headers/posix/endian.h index 7725d6d588..aaa0d8a64a 100644 --- a/headers/posix/endian.h +++ b/headers/posix/endian.h @@ -1,8 +1,12 @@ +/* + * Copyright 2003-2008 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + */ #ifndef _ENDIAN_H_ #define _ENDIAN_H_ -/* -** Distributed under the terms of the OpenBeOS License. -*/ + + +#include /* Defines architecture dependent endian constants. @@ -10,11 +14,11 @@ * significant byte, "1" the least significant one. */ -#if defined(__INTEL__) || defined(__ARM__) || defined(__MIPSEL__) +#if defined(__HAIKU_LITTLE_ENDIAN) # define LITTLE_ENDIAN 1234 # define BIG_ENDIAN 0 # define BYTE_ORDER LITTLE_ENDIAN -#elif defined(__POWERPC__) || defined(__M68K__) +#elif defined(__HAIKU_BIG_ENDIAN) # define BIG_ENDIAN 4321 # define LITTLE_ENDIAN 0 # define BYTE_ORDER BIG_ENDIAN diff --git a/headers/posix/inttypes.h b/headers/posix/inttypes.h index a488f0d180..04add0a6da 100644 --- a/headers/posix/inttypes.h +++ b/headers/posix/inttypes.h @@ -1,6 +1,6 @@ /* - * Copyright 2002-2008 Haiku inc. All rights reserved. - * Distributed under the terms of the MIT License + * Copyright 2002-2009 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. */ #ifndef _INTTYPES_H_ #define _INTTYPES_H_ @@ -30,24 +30,24 @@ typedef struct { # define PRIiLEAST16 "i" # define PRIiFAST16 "i" -# define PRId32 "d" -# define PRIdLEAST32 "d" -# define PRIdFAST32 "d" -# define PRIi32 "i" -# define PRIiLEAST32 "i" -# define PRIiFAST32 "i" +# define PRId32 __HAIKU_STD_PRI_PREFIX_32 "d" +# define PRIdLEAST32 PRId32 +# define PRIdFAST32 PRId32 +# define PRIi32 __HAIKU_STD_PRI_PREFIX_32 "i" +# define PRIiLEAST32 PRIi32 +# define PRIiFAST32 PRIi32 -# define PRId64 "lld" -# define PRIdLEAST64 "lld" -# define PRIdFAST64 "lld" -# define PRIi64 "lli" -# define PRIiLEAST64 "lli" -# define PRIiFAST64 "lli" +# define PRId64 __HAIKU_STD_PRI_PREFIX_64 "d" +# define PRIdLEAST64 PRId64 +# define PRIdFAST64 PRId64 +# define PRIi64 __HAIKU_STD_PRI_PREFIX_64 "i" +# define PRIiLEAST64 PRIi64 +# define PRIiFAST64 PRIi64 -# define PRIdMAX "lld" -# define PRIdPTR "d" -# define PRIiMAX "lli" -# define PRIiPTR "i" +# define PRIdMAX PRId64 +# define PRIdPTR __HAIKU_PRI_PREFIX_ADDR "d" +# define PRIiMAX PRIi64 +# define PRIiPTR __HAIKU_PRI_PREFIX_ADDR "i" /* fprintf() macros for unsigned integers */ # define PRIu8 "u" @@ -76,40 +76,40 @@ typedef struct { # define PRIXLEAST16 "X" # define PRIXFAST16 "X" -# define PRIu32 "u" -# define PRIuLEAST32 "u" -# define PRIuFAST32 "u" -# define PRIo32 "o" -# define PRIoLEAST32 "o" -# define PRIoFAST32 "o" -# define PRIx32 "x" -# define PRIxLEAST32 "x" -# define PRIxFAST32 "x" -# define PRIX32 "X" -# define PRIXLEAST32 "X" -# define PRIXFAST32 "X" +# define PRIu32 __HAIKU_STD_PRI_PREFIX_32 "u" +# define PRIuLEAST32 PRIu32 +# define PRIuFAST32 PRIu32 +# define PRIo32 __HAIKU_STD_PRI_PREFIX_32 "o" +# define PRIoLEAST32 PRIo32 +# define PRIoFAST32 PRIo32 +# define PRIx32 __HAIKU_STD_PRI_PREFIX_32 "x" +# define PRIxLEAST32 PRIx32 +# define PRIxFAST32 PRIx32 +# define PRIX32 __HAIKU_STD_PRI_PREFIX_32 "X" +# define PRIXLEAST32 PRIX32 +# define PRIXFAST32 PRIX32 -# define PRIu64 "llu" -# define PRIuLEAST64 "llu" -# define PRIuFAST64 "llu" -# define PRIo64 "llo" -# define PRIoLEAST64 "llo" -# define PRIoFAST64 "llo" -# define PRIx64 "llx" -# define PRIxLEAST64 "llx" -# define PRIxFAST64 "llx" -# define PRIX64 "llX" -# define PRIXLEAST64 "llX" -# define PRIXFAST64 "llX" +# define PRIu64 __HAIKU_STD_PRI_PREFIX_64 "u" +# define PRIuLEAST64 PRIu64 +# define PRIuFAST64 PRIu64 +# define PRIo64 __HAIKU_STD_PRI_PREFIX_64 "o" +# define PRIoLEAST64 PRIo64 +# define PRIoFAST64 PRIo64 +# define PRIx64 __HAIKU_STD_PRI_PREFIX_64 "x" +# define PRIxLEAST64 PRIx64 +# define PRIxFAST64 PRIx64 +# define PRIX64 __HAIKU_STD_PRI_PREFIX_64 "X" +# define PRIXLEAST64 PRIX64 +# define PRIXFAST64 PRIX64 -# define PRIuMAX "llu" -# define PRIuPTR "u" -# define PRIoMAX "llo" -# define PRIoPTR "o" -# define PRIxMAX "llx" -# define PRIxPTR "x" -# define PRIXMAX "llX" -# define PRIXPTR "X" +# define PRIuMAX PRIu64 +# define PRIuPTR __HAIKU_PRI_PREFIX_ADDR "u" +# define PRIoMAX PRIo64 +# define PRIoPTR __HAIKU_PRI_PREFIX_ADDR "o" +# define PRIxMAX PRIx64 +# define PRIxPTR __HAIKU_PRI_PREFIX_ADDR "x" +# define PRIXMAX PRIX64 +# define PRIXPTR __HAIKU_PRI_PREFIX_ADDR "X" /* fscanf() macros for signed integers */ # define SCNd8 "hhd" @@ -126,24 +126,24 @@ typedef struct { # define SCNiLEAST16 "hi" # define SCNiFAST16 "i" -# define SCNd32 "d" -# define SCNdLEAST32 "d" -# define SCNdFAST32 "d" -# define SCNi32 "i" -# define SCNiLEAST32 "i" -# define SCNiFAST32 "i" +# define SCNd32 __HAIKU_STD_PRI_PREFIX_32 "d" +# define SCNdLEAST32 SCNd32 +# define SCNdFAST32 SCNd32 +# define SCNi32 __HAIKU_STD_PRI_PREFIX_32 "i" +# define SCNiLEAST32 SCNi32 +# define SCNiFAST32 SCNi32 -# define SCNd64 "lld" -# define SCNdLEAST64 "lld" -# define SCNdFAST64 "lld" -# define SCNi64 "lli" -# define SCNiLEAST64 "lli" -# define SCNiFAST64 "lli" +# define SCNd64 __HAIKU_STD_PRI_PREFIX_64 "d" +# define SCNdLEAST64 SCNd64 +# define SCNdFAST64 SCNd64 +# define SCNi64 __HAIKU_STD_PRI_PREFIX_64 "i" +# define SCNiLEAST64 SCNi64 +# define SCNiFAST64 SCNi64 -# define SCNdMAX "lld" -# define SCNdPTR "d" -# define SCNiMAX "lli" -# define SCNiPTR "i" +# define SCNdMAX SCNd64 +# define SCNdPTR __HAIKU_PRI_PREFIX_ADDR "d" +# define SCNiMAX SCNi64 +# define SCNiPTR __HAIKU_PRI_PREFIX_ADDR "i" /* fscanf() macros for unsigned integers */ # define SCNu8 "hhu" @@ -166,32 +166,32 @@ typedef struct { # define SCNxLEAST16 "hx" # define SCNxFAST16 "x" -# define SCNu32 "u" -# define SCNuLEAST32 "u" -# define SCNuFAST32 "u" -# define SCNo32 "o" -# define SCNoLEAST32 "o" -# define SCNoFAST32 "o" -# define SCNx32 "x" -# define SCNxLEAST32 "x" -# define SCNxFAST32 "x" +# define SCNu32 __HAIKU_STD_PRI_PREFIX_32 "u" +# define SCNuLEAST32 SCNu32 +# define SCNuFAST32 SCNu32 +# define SCNo32 __HAIKU_STD_PRI_PREFIX_32 "o" +# define SCNoLEAST32 SCNo32 +# define SCNoFAST32 SCNo32 +# define SCNx32 __HAIKU_STD_PRI_PREFIX_32 "x" +# define SCNxLEAST32 SCNx32 +# define SCNxFAST32 SCNx32 -# define SCNu64 "llu" -# define SCNuLEAST64 "llu" -# define SCNuFAST64 "llu" -# define SCNo64 "llo" -# define SCNoLEAST64 "llo" -# define SCNoFAST64 "llo" -# define SCNx64 "llx" -# define SCNxLEAST64 "llx" -# define SCNxFAST64 "llx" +# define SCNu64 __HAIKU_STD_PRI_PREFIX_64 "u" +# define SCNuLEAST64 SCNu64 +# define SCNuFAST64 SCNu64 +# define SCNo64 __HAIKU_STD_PRI_PREFIX_64 "o" +# define SCNoLEAST64 SCNo64 +# define SCNoFAST64 SCNo64 +# define SCNx64 __HAIKU_STD_PRI_PREFIX_64 "x" +# define SCNxLEAST64 SCNx64 +# define SCNxFAST64 SCNx64 -# define SCNuMAX "llu" -# define SCNuPTR "u" -# define SCNoMAX "llo" -# define SCNoPTR "o" -# define SCNxMAX "llx" -# define SCNxPTR "x" +# define SCNuMAX SCNu64 +# define SCNuPTR __HAIKU_PRI_PREFIX_ADDR "u" +# define SCNoMAX SCNo64 +# define SCNoPTR __HAIKU_PRI_PREFIX_ADDR "o" +# define SCNxMAX SCNx64 +# define SCNxPTR __HAIKU_PRI_PREFIX_ADDR "x" #endif /* !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) */ @@ -211,4 +211,5 @@ extern uintmax_t strtoumax(const char *string, char **_end, int base); } #endif + #endif /* _INTTYPES_H_ */ diff --git a/headers/posix/limits.h b/headers/posix/limits.h index 9732efba3c..805008cc06 100644 --- a/headers/posix/limits.h +++ b/headers/posix/limits.h @@ -1,7 +1,14 @@ +/* + * Copyright 2001-2009 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + */ #ifndef _LIBC_LIMITS_H_ #define _LIBC_LIMITS_H_ /* Note: The header guard is checked in gcc's limits.h. */ + +#include + #include /* for DBL_DIG, FLT_DIG, etc */ /* _GCC_LIMITS_H_ is defined by GCC's internal limits.h to avoid @@ -13,7 +20,7 @@ #define LONGLONG_MIN (-9223372036854775807LL - 1) /* these are Be specific */ #define LONGLONG_MAX (9223372036854775807LL) -#define ULONGLONG_MAX (0xffffffffffffffffULL) +#define ULONGLONG_MAX (0xffffffffffffffffULL) #define ULLONG_MAX ULONGLONG_MAX #define LLONG_MAX LONGLONG_MAX @@ -43,7 +50,7 @@ #define PIPE_MAX (512) #define PTHREAD_KEYS_MAX 256 #define PTHREAD_STACK_MIN 4096 -#define SSIZE_MAX (2147483647L) +#define SSIZE_MAX __HAIKU_SADDR_MAX #define TTY_NAME_MAX (256) #define TZNAME_MAX (32) #define SYMLINK_MAX (1024) @@ -55,12 +62,12 @@ #define _POSIX_LOGIN_NAME_MAX (9) #define _POSIX_MAX_CANON (255) #define _POSIX_MAX_INPUT (255) -#define _POSIX_NAME_MAX (255) -#define _POSIX_NGROUPS_MAX (8) +#define _POSIX_NAME_MAX (255) +#define _POSIX_NGROUPS_MAX (8) #define _POSIX_OPEN_MAX (128) #define _POSIX_PATH_MAX (1024) -#define _POSIX_PIPE_BUF (512) -#define _POSIX_SSIZE_MAX (2147483647L) +#define _POSIX_PIPE_BUF (512) +#define _POSIX_SSIZE_MAX __HAIKU_SADDR_MAX #define _POSIX_STREAM_MAX (8) #define _POSIX_TTY_NAME_MAX (256) #define _POSIX_TZNAME_MAX (3) diff --git a/headers/posix/regex.h b/headers/posix/regex.h index 63c2fef696..a3f9da4de0 100644 --- a/headers/posix/regex.h +++ b/headers/posix/regex.h @@ -23,6 +23,10 @@ #ifndef _REGEX_H #define _REGEX_H 1 + +#include + + /* Allow the use in C++ code. */ #ifdef __cplusplus extern "C" { @@ -41,15 +45,15 @@ extern "C" { wide enough to hold a value of a pointer. For most ANSI compilers ptrdiff_t and size_t should be likely OK. Still size of these two types is 2 for Microsoft C. Ugh... */ -typedef long int s_reg_t; -typedef unsigned long int active_reg_t; +typedef __haiku_saddr_t s_reg_t; +typedef __haiku_addr_t active_reg_t; /* The following bits are used to determine the regexp syntax we recognize. The set/not-set meanings are chosen so that Emacs syntax remains the value 0. The bits are given in alphabetical order, and the definitions shifted by one from the previous bit; thus, when we add or remove a bit, only one other definition need change. */ -typedef unsigned long int reg_syntax_t; +typedef __haiku_uint32 reg_syntax_t; /* If this bit is not set, then \ inside a bracket expression is literal. If set, then such a \ quotes the following character. */ @@ -170,7 +174,7 @@ typedef unsigned long int reg_syntax_t; stored in the pattern buffer, so changing this does not affect already-compiled regexps. */ extern reg_syntax_t re_syntax_options; - + /* Define combinations of the above bits for the standard possibilities. (The [[[ comments delimit what gets put into the Texinfo file, so don't delete them!) */ @@ -240,7 +244,7 @@ extern reg_syntax_t re_syntax_options; | RE_NO_BK_PARENS | RE_NO_BK_REFS \ | RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD) /* [[[end syntaxes]]] */ - + /* Maximum number of duplicates an interval can allow. Some systems (erroneously) define this in other header files, but we want our value, so remove any previous define. */ @@ -315,7 +319,7 @@ typedef enum REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */ REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */ } reg_errcode_t; - + /* This data structure represents a compiled pattern. Before calling the pattern compiler, the fields `buffer', `allocated', `fastmap', `translate', and `no_sub' can be set. After the pattern has been @@ -395,7 +399,7 @@ struct re_pattern_buffer }; typedef struct re_pattern_buffer regex_t; - + /* Type for byte offsets within the string. POSIX mandates this. */ typedef int regoff_t; @@ -426,7 +430,7 @@ typedef struct regoff_t rm_so; /* Byte offset from string's start to substring's start. */ regoff_t rm_eo; /* Byte offset from string's start to substring's end. */ } regmatch_t; - + /* Declarations for routines. */ /* To avoid duplicating every routine declaration -- once with a @@ -556,7 +560,7 @@ extern void regfree _RE_ARGS ((regex_t *__preg)); #endif /* C++ */ #endif /* regex.h */ - + /* Local variables: make-backup-files: t diff --git a/headers/posix/setjmp.h b/headers/posix/setjmp.h index caebcab495..e85d372508 100644 --- a/headers/posix/setjmp.h +++ b/headers/posix/setjmp.h @@ -1,26 +1,17 @@ /* - * Copyright 2004-2005, Haiku, Inc. + * Copyright 2004-2009, Haiku, Inc. * Distributed under the terms of the MIT License. */ #ifndef _SETJMP_H_ #define _SETJMP_H_ + +#include + #include /* include architecture specific definitions */ -#ifdef __INTEL__ - #include -#elif __POWERPC__ - #include -#elif __M68K__ - #include -#elif __MIPSEL__ - #include -#elif __ARM__ - #include -#else - #error #include /arch_setjmp.h> -#endif +#include __HAIKU_ARCH_HEADER(arch_setjmp.h) typedef struct __jmp_buf_tag { __jmp_buf regs; /* saved registers, stack & program pointer */ diff --git a/headers/posix/signal.h b/headers/posix/signal.h index 97703c8976..e6c702fef7 100644 --- a/headers/posix/signal.h +++ b/headers/posix/signal.h @@ -10,7 +10,7 @@ typedef int sig_atomic_t; -typedef long sigset_t; +typedef __haiku_int32 sigset_t; typedef void (*sighandler_t)(int); /* GNU-like signal handler typedef */ @@ -249,19 +249,7 @@ int pthread_sigmask(int how, const sigset_t *set, sigset_t *oset); typedef struct vregs vregs; /* include architecture specific definitions */ -#ifdef __INTEL__ - #include -#elif __POWERPC__ - #include -#elif __M68K__ - #include -#elif __MIPSEL__ - #include -#elif __ARM__ - #include -#else - #error #include /signal.h> -#endif +#include __HAIKU_ARCH_HEADER(signal.h) #endif /* _SIGNAL_H_ */ diff --git a/headers/posix/stdint.h b/headers/posix/stdint.h index 693862cf22..abac2dcb2d 100644 --- a/headers/posix/stdint.h +++ b/headers/posix/stdint.h @@ -1,25 +1,26 @@ /* - * Copyright 2003-2008, Haiku Inc. All Rights Reserved. + * Copyright 2003-2009, Haiku Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _STDINT_H_ #define _STDINT_H_ -/* ToDo: this is a compiler and architecture dependent header */ +#include + /* Exact-width integer types */ -typedef signed char int8_t; -typedef unsigned char uint8_t; +typedef __haiku_std_int8 int8_t; +typedef __haiku_std_uint8 uint8_t; -typedef signed short int16_t; -typedef unsigned short uint16_t; +typedef __haiku_std_int16 int16_t; +typedef __haiku_std_uint16 uint16_t; -typedef signed int int32_t; -typedef unsigned int uint32_t; +typedef __haiku_std_int32 int32_t; +typedef __haiku_std_uint32 uint32_t; -typedef signed long long int64_t; -typedef unsigned long long uint64_t; +typedef __haiku_std_int64 int64_t; +typedef __haiku_std_uint64 uint64_t; /* Minimum-width integer types */ typedef int8_t int_least8_t; @@ -48,12 +49,12 @@ typedef int64_t int_fast64_t; typedef uint64_t uint_fast64_t; /* Integer types capable of holding object pointers */ -typedef int32_t intptr_t; -typedef uint32_t uintptr_t; +typedef __haiku_saddr_t intptr_t; +typedef __haiku_addr_t uintptr_t; /* Greatest-width integer types */ -typedef signed long long intmax_t; -typedef unsigned long long uintmax_t; +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; /* Limits of exact-width integer types */ #define INT8_MIN (-128) @@ -107,9 +108,9 @@ typedef unsigned long long uintmax_t; #define UINT_FAST64_MAX UINT64_MAX /* Limits of Integer types capable of holding object pointers */ -#define INTPTR_MIN INT32_MIN -#define INTPTR_MAX INT32_MAX -#define UINTPTR_MAX UINT32_MAX +#define INTPTR_MIN __HAIKU_SADDR_MIN +#define INTPTR_MAX __HAIKU_SADDR_MAX +#define UINTPTR_MAX __HAIKU_ADDR_MAX /* Limits of Greatest-width integer types */ #define INTMAX_MIN INT64_MIN @@ -117,13 +118,13 @@ typedef unsigned long long uintmax_t; #define UINTMAX_MAX UINT64_MAX /* Limits of other integer types */ -#define PTDIFF_MIN INT32_MIN -#define PTDIFF_MAX INT32_MAX +#define PTDIFF_MIN __HAIKU_SADDR_MIN +#define PTDIFF_MAX __HAIKU_SADDR_MAX #define SIG_ATOMIC_MIN INT32_MIN #define SIG_ATOMIC_MAX INT32_MAX -#define SIZE_MAX UINT32_MAX +#define SIZE_MAX __HAIKU_ADDR_MAX #define WINT_MIN 0 #define WINT_MAX ((wint_t)-1) @@ -155,4 +156,5 @@ typedef uint16_t u_int16_t; typedef uint32_t u_int32_t; typedef uint64_t u_int64_t; + #endif /* _STDINT_H_ */ diff --git a/headers/posix/sys/msg.h b/headers/posix/sys/msg.h index 03a66f4eb6..219d41c887 100644 --- a/headers/posix/sys/msg.h +++ b/headers/posix/sys/msg.h @@ -1,16 +1,19 @@ /* - * Copyright 2008, Haiku Inc. All Rights Reserved. + * Copyright 2008-2009, Haiku Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_MSG_H #define _SYS_MSG_H + +#include + #include #include #include -typedef unsigned long msgqnum_t; -typedef unsigned long msglen_t; +typedef __haiku_uint32 msgqnum_t; +typedef __haiku_uint32 msglen_t; /* No error if big message */ #define MSG_NOERROR 010000 diff --git a/headers/posix/sys/resource.h b/headers/posix/sys/resource.h index 7ca7b593f6..4774faef50 100644 --- a/headers/posix/sys/resource.h +++ b/headers/posix/sys/resource.h @@ -5,13 +5,16 @@ #ifndef _SYS_RESOURCE_H #define _SYS_RESOURCE_H + +#include + #include #include /* getrlimit()/setrlimit() definitions */ -typedef unsigned long rlim_t; +typedef __haiku_addr_t rlim_t; struct rlimit { rlim_t rlim_cur; /* current soft limit */ diff --git a/headers/posix/sys/select.h b/headers/posix/sys/select.h index ac83d9c81a..587f7e062e 100644 --- a/headers/posix/sys/select.h +++ b/headers/posix/sys/select.h @@ -1,11 +1,13 @@ /* - * Copyright 2002-2006, Haiku Inc. All Rights Reserved. + * Copyright 2002-2009, Haiku Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_SELECT_H #define _SYS_SELECT_H +#include + #include #include @@ -22,7 +24,7 @@ # define FD_SETSIZE 1024 #endif -typedef unsigned long fd_mask; +typedef __haiku_uint32 fd_mask; #ifndef _howmany # define _howmany(x, y) (((x) + ((y) - 1)) / (y)) @@ -55,7 +57,7 @@ extern "C" { extern int pselect(int numBits, struct fd_set *readBits, struct fd_set *writeBits, struct fd_set *errorBits, const struct timespec *timeout, const sigset_t *sigMask); -extern int select(int numBits, struct fd_set *readBits, struct fd_set *writeBits, +extern int select(int numBits, struct fd_set *readBits, struct fd_set *writeBits, struct fd_set *errorBits, struct timeval *timeout); #ifdef __cplusplus diff --git a/headers/posix/sys/stat.h b/headers/posix/sys/stat.h index 615b6131d9..42fdebf74c 100644 --- a/headers/posix/sys/stat.h +++ b/headers/posix/sys/stat.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008, Haiku Inc. All Rights Reserved. + * Copyright 2002-2009, Haiku Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_STAT_H_ @@ -24,7 +24,7 @@ struct stat { struct timespec st_mtim; /* last modification time */ struct timespec st_ctim; /* last change time, not creation time */ struct timespec st_crtim; /* creation time */ - unsigned int st_type; /* attribute/index type */ + __haiku_uint32 st_type; /* attribute/index type */ blkcnt_t st_blocks; /* number of blocks allocated for object */ }; diff --git a/headers/posix/sys/types.h b/headers/posix/sys/types.h index d6b4bea5f8..d5b0ae6b1e 100644 --- a/headers/posix/sys/types.h +++ b/headers/posix/sys/types.h @@ -1,11 +1,13 @@ /* - * Copyright 2002-2006, Haiku Inc. All Rights Reserved. + * Copyright 2002-2009, Haiku Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _SYS_TYPES_H #define _SYS_TYPES_H +#include + #include @@ -17,36 +19,38 @@ typedef unsigned char u_char; /* sysV compatibility */ -#ifndef _SUPPORT_DEFS_H - typedef unsigned long ulong; - typedef unsigned short ushort; - typedef unsigned int uint; -#endif +typedef unsigned long ulong; +typedef unsigned short ushort; +typedef unsigned int uint; typedef unsigned char unchar; -typedef long long blkcnt_t; -typedef int blksize_t; -typedef long long fsblkcnt_t; -typedef long long fsfilcnt_t; -typedef long long off_t; -typedef long long ino_t; -typedef int cnt_t; -typedef long dev_t; -typedef long pid_t; -typedef long id_t; +typedef __haiku_int64 blkcnt_t; +typedef __haiku_std_int32 blksize_t; +typedef __haiku_int64 fsblkcnt_t; +typedef __haiku_int64 fsfilcnt_t; +typedef __haiku_int64 off_t; +typedef __haiku_int64 ino_t; +typedef __haiku_std_int32 cnt_t; +typedef __haiku_int32 dev_t; +typedef __haiku_int32 pid_t; +typedef __haiku_int32 id_t; -typedef unsigned int uid_t; -typedef unsigned int gid_t; -typedef unsigned int mode_t; -typedef unsigned int umode_t; -typedef int nlink_t; +typedef __haiku_std_uint32 uid_t; +typedef __haiku_std_uint32 gid_t; +typedef __haiku_std_uint32 mode_t; +typedef __haiku_std_uint32 umode_t; +typedef __haiku_std_int32 nlink_t; -typedef int daddr_t; -typedef char * caddr_t; +#ifdef __HAIKU_BEOS_COMPATIBLE_TYPES + typedef int daddr_t; /* disk address */ +#else + typedef off_t daddr_t; /* disk address */ +#endif +typedef char* caddr_t; -typedef unsigned long addr_t; -typedef long key_t; +typedef __haiku_addr_t addr_t; +typedef __haiku_int32 key_t; #include #include diff --git a/headers/posix/termios.h b/headers/posix/termios.h index ad7461300d..59540629e1 100644 --- a/headers/posix/termios.h +++ b/headers/posix/termios.h @@ -1,5 +1,5 @@ /* - * Copyright 2004-2008, Haiku Inc. All Rights Reserved. + * Copyright 2004-2009, Haiku Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _TERMIOS_H_ @@ -9,7 +9,7 @@ #include -typedef unsigned long tcflag_t; +typedef __haiku_uint32 tcflag_t; typedef unsigned char speed_t; typedef unsigned char cc_t; @@ -54,7 +54,7 @@ struct termios { #define IUCLC 0x200 /* map all upper case to lower */ #define IXON 0x400 /* enable input SW flow control */ #define IXANY 0x800 /* any character will restart input */ -#define IXOFF 0x1000 /* enable output SW flow control */ +#define IXOFF 0x1000 /* enable output SW flow control */ /* c_oflag - output control modes */ #define OPOST 0x01 /* enable postprocessing of output */ diff --git a/headers/posix/time.h b/headers/posix/time.h index aa5be1b204..97471f7b39 100644 --- a/headers/posix/time.h +++ b/headers/posix/time.h @@ -9,10 +9,10 @@ #include -typedef long clock_t; -typedef long time_t; -typedef long suseconds_t; -typedef unsigned long useconds_t; +typedef __haiku_int32 clock_t; +typedef __haiku_int32 time_t; +typedef __haiku_int32 suseconds_t; +typedef __haiku_uint32 useconds_t; #define CLOCKS_PER_SEC 1000 #define CLK_TCK CLOCKS_PER_SEC @@ -64,7 +64,7 @@ extern char *asctime_r(const struct tm *timep, char *buffer); extern char *ctime(const time_t *timer); extern char *ctime_r(const time_t *timer, char *buffer); extern struct tm *gmtime(const time_t *timer); -extern struct tm *gmtime_r(const time_t *timer, struct tm *tm); +extern struct tm *gmtime_r(const time_t *timer, struct tm *tm); extern struct tm *localtime(const time_t *timer); extern struct tm *localtime_r(const time_t *timer, struct tm *tm); extern int nanosleep(const struct timespec *, struct timespec *); diff --git a/headers/private/fs_shell/fssh_api_wrapper.h b/headers/private/fs_shell/fssh_api_wrapper.h index 15615cff1c..3f8af443de 100644 --- a/headers/private/fs_shell/fssh_api_wrapper.h +++ b/headers/private/fs_shell/fssh_api_wrapper.h @@ -1,5 +1,5 @@ /* - * Copyright 2007-2008, Ingo Weinhold, bonefish@cs.tu-berlin.de. + * Copyright 2007-2009, Ingo Weinhold, bonefish@cs.tu-berlin.de. * Distributed under the terms of the MIT License. */ #ifndef _FSSH_API_WRAPPER_H @@ -1503,6 +1503,81 @@ #define gid_t fssh_gid_t #define pid_t fssh_pid_t +#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) + +/* printf()/scanf() format strings for [u]int* types */ +#define B_PRId8 FSSH_B_PRId8 +#define B_PRIi8 FSSH_B_PRIi8 +#define B_PRId16 FSSH_B_PRId16 +#define B_PRIi16 FSSH_B_PRIi16 +#define B_PRId32 FSSH_B_PRId32 +#define B_PRIi32 FSSH_B_PRIi32 +#define B_PRId64 FSSH_B_PRId64 +#define B_PRIi64 FSSH_B_PRIi64 +#define B_PRIu8 FSSH_B_PRIu8 +#define B_PRIo8 FSSH_B_PRIo8 +#define B_PRIx8 FSSH_B_PRIx8 +#define B_PRIX8 FSSH_B_PRIX8 +#define B_PRIu16 FSSH_B_PRIu16 +#define B_PRIo16 FSSH_B_PRIo16 +#define B_PRIx16 FSSH_B_PRIx16 +#define B_PRIX16 FSSH_B_PRIX16 +#define B_PRIu32 FSSH_B_PRIu32 +#define B_PRIo32 FSSH_B_PRIo32 +#define B_PRIx32 FSSH_B_PRIx32 +#define B_PRIX32 FSSH_B_PRIX32 +#define B_PRIu64 FSSH_B_PRIu64 +#define B_PRIo64 FSSH_B_PRIo64 +#define B_PRIx64 FSSH_B_PRIx64 +#define B_PRIX64 FSSH_B_PRIX64 + +#define B_SCNd8 FSSH_B_SCNd8 +#define B_SCNi8 FSSH_B_SCNi8 +#define B_SCNd16 FSSH_B_SCNd16 +#define B_SCNi16 FSSH_B_SCNi16 +#define B_SCNd32 FSSH_B_SCNd32 +#define B_SCNi32 FSSH_B_SCNi32 +#define B_SCNd64 FSSH_B_SCNd64 +#define B_SCNi64 FSSH_B_SCNi64 +#define B_SCNu8 FSSH_B_SCNu8 +#define B_SCNo8 FSSH_B_SCNo8 +#define B_SCNx8 FSSH_B_SCNx8 +#define B_SCNu16 FSSH_B_SCNu16 +#define B_SCNu16 FSSH_B_SCNu16 +#define B_SCNx16 FSSH_B_SCNx16 +#define B_SCNu32 FSSH_B_SCNu32 +#define B_SCNo32 FSSH_B_SCNo32 +#define B_SCNx32 FSSH_B_SCNx32 +#define B_SCNu64 FSSH_B_SCNu64 +#define B_SCNo64 FSSH_B_SCNo64 +#define B_SCNx64 FSSH_B_SCNx64 + +/* printf() format strings for some standard types */ +/* size_t */ +#define B_PRIuSIZE FSSH_B_PRIuSIZE +#define B_PRIoSIZE FSSH_B_PRIoSIZE +#define B_PRIxSIZE FSSH_B_PRIxSIZE +#define B_PRIXSIZE FSSH_B_PRIXSIZE +/* ssize_t */ +#define B_PRIdSSIZE FSSH_B_PRIdSSIZE +#define B_PRIiSSIZE FSSH_B_PRIiSSIZE +/* addr_t */ +#define B_PRIuADDR FSSH_B_PRIuADDR +#define B_PRIoADDR FSSH_B_PRIoADDR +#define B_PRIxADDR FSSH_B_PRIxADDR +#define B_PRIXADDR FSSH_B_PRIXADDR +/* off_t */ +#define B_PRIdOFF FSSH_B_PRIdOFF +#define B_PRIiOFF FSSH_B_PRIiOFF +/* dev_t */ +#define B_PRIdDEV FSSH_B_PRIdDEV +#define B_PRIiDEV FSSH_B_PRIiDEV +/* ino_t */ +#define B_PRIdINO FSSH_B_PRIdINO +#define B_PRIiINO FSSH_B_PRIiINO + +#endif /* !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) */ + //////////////////////////////////////////////////////////////////////////////// // #pragma mark - fssh_uio.h diff --git a/headers/private/fs_shell/fssh_time.h b/headers/private/fs_shell/fssh_time.h index 3e1479b1c9..f8b7bbec91 100644 --- a/headers/private/fs_shell/fssh_time.h +++ b/headers/private/fs_shell/fssh_time.h @@ -1,5 +1,5 @@ /* - * Copyright 2005-2007, Haiku Inc. All Rights Reserved. + * Copyright 2005-2009, Haiku Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _FSSH_TIME_H_ @@ -9,10 +9,10 @@ #include "fssh_defs.h" -typedef long fssh_clock_t; -typedef long fssh_time_t; -typedef long fssh_suseconds_t; -typedef unsigned long fssh_useconds_t; +typedef int32_t fssh_clock_t; +typedef int32_t fssh_time_t; +typedef int32_t fssh_suseconds_t; +typedef uint32_t fssh_useconds_t; #define FSSH_CLOCKS_PER_SEC 1000 #define FSSH_CLK_TCK FSSH_CLOCKS_PER_SEC @@ -66,7 +66,7 @@ extern char *fssh_ctime(const fssh_time_t *timer); extern char *fssh_ctime_r(const fssh_time_t *timer, char *buffer); extern struct fssh_tm *fssh_gmtime(const fssh_time_t *timer); extern struct fssh_tm *fssh_gmtime_r(const fssh_time_t *timer, - struct fssh_tm *tm); + struct fssh_tm *tm); extern struct fssh_tm *fssh_localtime(const fssh_time_t *timer); extern struct fssh_tm *fssh_localtime_r(const fssh_time_t *timer, struct fssh_tm *tm); diff --git a/headers/private/fs_shell/fssh_types.h b/headers/private/fs_shell/fssh_types.h index 4b66b68b41..a5624b8596 100644 --- a/headers/private/fs_shell/fssh_types.h +++ b/headers/private/fs_shell/fssh_types.h @@ -1,8 +1,14 @@ +/* + * Copyright 2007-2009, Ingo Weinhold, bonefish@cs.tu-berlin.de. + * Distributed under the terms of the MIT License. + */ #ifndef _FSSH_TYPES_H #define _FSSH_TYPES_H + #include + typedef uint32_t fssh_ulong; typedef volatile int32_t vint32_t; typedef volatile int64_t vint64_t; @@ -35,4 +41,88 @@ typedef int32_t fssh_pid_t; #define NULL (0) #endif + +// NOTE: For this to work the __STDC_FORMAT_MACROS feature macro must be +// defined. + +/* printf()/scanf() format strings for [u]int* types */ +#define FSSH_B_PRId8 PRId8 +#define FSSH_B_PRIi8 PRIi8 +#define FSSH_B_PRId16 PRId16 +#define FSSH_B_PRIi16 PRIi16 +#define FSSH_B_PRId32 PRId32 +#define FSSH_B_PRIi32 PRIi32 +#define FSSH_B_PRId64 PRId64 +#define FSSH_B_PRIi64 PRIi64 +#define FSSH_B_PRIu8 PRIu8 +#define FSSH_B_PRIo8 PRIo8 +#define FSSH_B_PRIx8 PRIx8 +#define FSSH_B_PRIX8 PRIX8 +#define FSSH_B_PRIu16 PRIu16 +#define FSSH_B_PRIo16 PRIo16 +#define FSSH_B_PRIx16 PRIx16 +#define FSSH_B_PRIX16 PRIX16 +#define FSSH_B_PRIu32 PRIu32 +#define FSSH_B_PRIo32 PRIo32 +#define FSSH_B_PRIx32 PRIx32 +#define FSSH_B_PRIX32 PRIX32 +#define FSSH_B_PRIu64 PRIu64 +#define FSSH_B_PRIo64 PRIo64 +#define FSSH_B_PRIx64 PRIx64 +#define FSSH_B_PRIX64 PRIX64 + +#define FSSH_B_SCNd8 SCNd8 +#define FSSH_B_SCNi8 SCNi8 +#define FSSH_B_SCNd16 SCNd16 +#define FSSH_B_SCNi16 SCNi16 +#define FSSH_B_SCNd32 SCNd32 +#define FSSH_B_SCNi32 SCNi32 +#define FSSH_B_SCNd64 SCNd64 +#define FSSH_B_SCNi64 SCNi64 +#define FSSH_B_SCNu8 SCNu8 +#define FSSH_B_SCNo8 SCNo8 +#define FSSH_B_SCNx8 SCNx8 +#define FSSH_B_SCNu16 SCNu16 +#define FSSH_B_SCNu16 SCNu16 +#define FSSH_B_SCNx16 SCNx16 +#define FSSH_B_SCNu32 SCNu32 +#define FSSH_B_SCNo32 SCNo32 +#define FSSH_B_SCNx32 SCNx32 +#define FSSH_B_SCNu64 SCNu64 +#define FSSH_B_SCNo64 SCNo64 +#define FSSH_B_SCNx64 SCNx64 + + +/* printf() format strings for some standard types */ +/* size_t */ +#define FSSH_B_PRIuSIZE FSSH_B_PRIu32 +#define FSSH_B_PRIoSIZE FSSH_B_PRIo32 +#define FSSH_B_PRIxSIZE FSSH_B_PRIx32 +#define FSSH_B_PRIXSIZE FSSH_B_PRIX32 +/* ssize_t */ +#define FSSH_B_PRIdSSIZE FSSH_B_PRId32 +#define FSSH_B_PRIiSSIZE FSSH_B_PRIi32 +/* addr_t */ +#ifdef HAIKU_HOST_PLATFORM_64_BIT +# define FSSH_B_PRIuADDR FSSH_B_PRIu64 +# define FSSH_B_PRIoADDR FSSH_B_PRIo64 +# define FSSH_B_PRIxADDR FSSH_B_PRIx64 +# define FSSH_B_PRIXADDR FSSH_B_PRIX64 +#else +# define FSSH_B_PRIuADDR FSSH_B_PRIu32 +# define FSSH_B_PRIoADDR FSSH_B_PRIo32 +# define FSSH_B_PRIxADDR FSSH_B_PRIx32 +# define FSSH_B_PRIXADDR FSSH_B_PRIX32 +#endif +/* off_t */ +#define FSSH_B_PRIdOFF FSSH_B_PRId64 +#define FSSH_B_PRIiOFF FSSH_B_PRIi64 +/* dev_t */ +#define FSSH_B_PRIdDEV FSSH_B_PRId32 +#define FSSH_B_PRIiDEV FSSH_B_PRIi32 +/* ino_t */ +#define FSSH_B_PRIdINO FSSH_B_PRId64 +#define FSSH_B_PRIiINO FSSH_B_PRIi64 + + #endif // _FSSH_TYPES_H diff --git a/src/tools/bfs_shell/Jamfile b/src/tools/bfs_shell/Jamfile index 83fbf51cbd..99a190fff5 100644 --- a/src/tools/bfs_shell/Jamfile +++ b/src/tools/bfs_shell/Jamfile @@ -5,6 +5,7 @@ SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems bfs ] ; # set some additional defines { local defines = + __STDC_FORMAT_MACROS #BFS_BIG_ENDIAN_ONLY BFS_SHELL ;