Ticket #2870: ticket2870.diff
File ticket2870.diff, 15.8 KB (added by , 15 years ago) |
---|
-
kernel/OS.h
110 110 port_id port; 111 111 team_id team; 112 112 char name[B_OS_NAME_LENGTH]; 113 int32 capacity; / / queue depth114 int32 queue_count; / / # msgs waiting to be read115 int32 total_count; / / total # msgs read so far113 int32 capacity; /* queue depth */ 114 int32 queue_count; /* # msgs waiting to be read */ 115 int32 total_count; /* total # msgs read so far */ 116 116 } port_info; 117 117 118 118 extern port_id create_port(int32 capacity, const char *name); … … 142 142 _get_next_port_info((team), (cookie), (info), sizeof(*(info))) 143 143 144 144 145 / /WARNING: The following is Haiku experimental API. It might be removed or146 // changed in the future. 145 /* WARNING: The following is Haiku experimental API. It might be removed or 146 changed in the future. */ 147 147 148 148 typedef struct port_message_info { 149 149 size_t size; … … 152 152 team_id sender_team; 153 153 } port_message_info; 154 154 155 / / similar to port_buffer_size_etc(), but returns (more) info155 /* similar to port_buffer_size_etc(), but returns (more) info */ 156 156 extern status_t _get_port_message_info_etc(port_id port, 157 157 port_message_info *info, size_t infoSize, uint32 flags, 158 158 bigtime_t timeout); … … 174 174 175 175 /* semaphore flags */ 176 176 enum { 177 B_CAN_INTERRUPT = 0x01, / /acquisition of the semaphore can be178 // interrupted (system use only)179 B_CHECK_PERMISSION = 0x04, / /ownership will be checked (system use180 // only)181 B_KILL_CAN_INTERRUPT = 0x20, / /acquisition of the semaphore can be182 //interrupted by SIGKILL[THR], even183 //if not B_CAN_INTERRUPT (system use184 // only)177 B_CAN_INTERRUPT = 0x01, /* acquisition of the semaphore can be 178 interrupted (system use only) */ 179 B_CHECK_PERMISSION = 0x04, /* ownership will be checked (system use 180 only) */ 181 B_KILL_CAN_INTERRUPT = 0x20, /* acquisition of the semaphore can be 182 interrupted by SIGKILL[THR], even 183 if not B_CAN_INTERRUPT (system use 184 only) */ 185 185 186 186 /* release_sem_etc() only flags */ 187 B_DO_NOT_RESCHEDULE = 0x02, / / thread is not rescheduled188 B_RELEASE_ALL = 0x08, / /all waiting threads will be woken up,189 // count will be zeroed190 B_RELEASE_IF_WAITING_ONLY = 0x10 / /release count only if there are any191 // threads waiting187 B_DO_NOT_RESCHEDULE = 0x02, /* thread is not rescheduled */ 188 B_RELEASE_ALL = 0x08, /* all waiting threads will be woken up, 189 count will be zeroed */ 190 B_RELEASE_IF_WAITING_ONLY = 0x10 /* release count only if there are any 191 threads waiting */ 192 192 }; 193 193 194 194 extern sem_id create_sem(int32 count, const char *name); … … 197 197 extern status_t acquire_sem_etc(sem_id id, int32 count, uint32 flags, bigtime_t timeout); 198 198 extern status_t release_sem(sem_id id); 199 199 extern status_t release_sem_etc(sem_id id, int32 count, uint32 flags); 200 / /ToDo: the following two calls are not part of the BeOS API, and might be201 // changed or even removed for the final release of Haiku R1 200 /* ToDo: the following two calls are not part of the BeOS API, and might be 201 changed or even removed for the final release of Haiku R1 */ 202 202 extern status_t switch_sem(sem_id semToBeReleased, sem_id id); 203 203 extern status_t switch_sem_etc(sem_id semToBeReleased, sem_id id, int32 count, 204 204 uint32 flags, bigtime_t timeout); … … 382 382 */ 383 383 extern int disable_debugger(int state); 384 384 385 / / TODO: Remove. Temporary debug helper.385 /* TODO: Remove. Temporary debug helper. */ 386 386 extern void debug_printf(const char *format, ...) 387 387 __attribute__ ((format (__printf__, 1, 2))); 388 388 extern void debug_vprintf(const char *format, va_list args); … … 410 410 #define OBOS_CPU_TYPES 411 411 412 412 typedef enum cpu_types { 413 / / ToDo: add latest models413 /* ToDo: add latest models */ 414 414 415 415 /* Motorola/IBM */ 416 416 B_CPU_PPC_UNKNOWN = 0, … … 708 708 extern double is_computer_on_fire(void); 709 709 710 710 711 / / WARNING: Experimental API!711 /* WARNING: Experimental API! */ 712 712 713 713 enum { 714 714 B_OBJECT_TYPE_FD = 0, … … 718 718 }; 719 719 720 720 enum { 721 B_EVENT_READ = 0x0001, / / FD/port readable722 B_EVENT_WRITE = 0x0002, / / FD/port writable723 B_EVENT_ERROR = 0x0004, / / FD error724 B_EVENT_PRIORITY_READ = 0x0008, / / FD priority readable725 B_EVENT_PRIORITY_WRITE = 0x0010, / / FD priority writable726 B_EVENT_HIGH_PRIORITY_READ = 0x0020, / / FD high priority readable727 B_EVENT_HIGH_PRIORITY_WRITE = 0x0040, / / FD high priority writable728 B_EVENT_DISCONNECTED = 0x0080, / / FD disconnected721 B_EVENT_READ = 0x0001, /* FD/port readable */ 722 B_EVENT_WRITE = 0x0002, /* FD/port writable */ 723 B_EVENT_ERROR = 0x0004, /* FD error */ 724 B_EVENT_PRIORITY_READ = 0x0008, /* FD priority readable */ 725 B_EVENT_PRIORITY_WRITE = 0x0010, /* FD priority writable */ 726 B_EVENT_HIGH_PRIORITY_READ = 0x0020, /* FD high priority readable */ 727 B_EVENT_HIGH_PRIORITY_WRITE = 0x0040, /* FD high priority writable */ 728 B_EVENT_DISCONNECTED = 0x0080, /* FD disconnected */ 729 729 730 B_EVENT_ACQUIRE_SEMAPHORE = 0x0001, / / semaphore can be acquired730 B_EVENT_ACQUIRE_SEMAPHORE = 0x0001, /* semaphore can be acquired */ 731 731 732 B_EVENT_INVALID = 0x1000 / /FD/port/sem/thread ID not or733 //no longer valid (e.g. has been734 // close/deleted)732 B_EVENT_INVALID = 0x1000 /* FD/port/sem/thread ID not or 733 no longer valid (e.g. has been 734 close/deleted) */ 735 735 }; 736 736 737 737 typedef struct object_wait_info { 738 int32 object; / / ID of the object739 uint16 type; / / type of the object740 uint16 events; / / events mask738 int32 object; /* ID of the object */ 739 uint16 type; /* type of the object */ 740 uint16 events; /* events mask */ 741 741 } object_wait_info; 742 742 743 / /wait_for_objects[_etc]() waits until at least one of the specified events or,744 //if given, the timeout occurred. When entering the function the745 //object_wait_info::events field specifies the events for each object the746 //caller is interested in. When the function returns the fields reflect the747 //events that actually occurred. The events B_EVENT_INVALID, B_EVENT_ERROR,748 //and B_EVENT_DISCONNECTED don't need to be specified. They will always be749 // reported, when they occur. 743 /* wait_for_objects[_etc]() waits until at least one of the specified events or, 744 if given, the timeout occurred. When entering the function the 745 object_wait_info::events field specifies the events for each object the 746 caller is interested in. When the function returns the fields reflect the 747 events that actually occurred. The events B_EVENT_INVALID, B_EVENT_ERROR, 748 and B_EVENT_DISCONNECTED don't need to be specified. They will always be 749 reported, when they occur. */ 750 750 751 751 extern ssize_t wait_for_objects(object_wait_info* infos, int numInfos); 752 752 extern ssize_t wait_for_objects_etc(object_wait_info* infos, int numInfos, -
storage/FindDirectory.h
10 10 11 11 12 12 typedef enum { 13 / / Per volume directories13 /* Per volume directories */ 14 14 B_DESKTOP_DIRECTORY = 0, 15 15 B_TRASH_DIRECTORY, 16 16 17 / / System directories17 /* System directories */ 18 18 B_BEOS_DIRECTORY = 1000, 19 19 B_BEOS_SYSTEM_DIRECTORY, 20 20 B_BEOS_ADDONS_DIRECTORY, … … 32 32 B_BEOS_SOUNDS_DIRECTORY, 33 33 B_BEOS_DATA_DIRECTORY, 34 34 35 / / Common directories, shared among all users.35 /* Common directories, shared among all users. */ 36 36 B_COMMON_DIRECTORY = 2000, 37 37 B_COMMON_SYSTEM_DIRECTORY, 38 38 B_COMMON_ADDONS_DIRECTORY, … … 55 55 B_COMMON_DATA_DIRECTORY, 56 56 57 57 58 / /User directories. These are interpreted in the context59 // of the user making the find_directory call.58 /* User directories. These are interpreted in the context 59 of the user making the find_directory call. */ 60 60 B_USER_DIRECTORY = 3000, 61 61 B_USER_CONFIG_DIRECTORY, 62 62 B_USER_ADDONS_DIRECTORY, … … 72 72 B_USER_DATA_DIRECTORY, 73 73 B_USER_CACHE_DIRECTORY, 74 74 75 / / Global directories.75 /* Global directories. */ 76 76 B_APPS_DIRECTORY = 4000, 77 77 B_PREFERENCES_DIRECTORY, 78 78 B_UTILITIES_DIRECTORY … … 83 83 extern "C" { 84 84 #endif 85 85 86 / / C interface86 /* C interface */ 87 87 88 88 status_t find_directory(directory_which which, dev_t volume, bool createIt, 89 89 char* pathString, int32 length); … … 91 91 #ifdef __cplusplus 92 92 } 93 93 94 / / C++ interface94 /* C++ interface */ 95 95 96 96 class BVolume; 97 97 class BPath; … … 99 99 status_t find_directory(directory_which which, BPath* path, 100 100 bool createIt = false, BVolume* volume = NULL); 101 101 102 #endif / / __cplusplus102 #endif /* __cplusplus */ 103 103 104 #endif / / _FIND_DIRECTORY_H104 #endif /* _FIND_DIRECTORY_H */ -
storage/Mime.h
19 19 B_MINI_ICON = 16 20 20 }; 21 21 22 / / values for the "force" parameter of update_mime_info() (Haiku only)22 /* values for the "force" parameter of update_mime_info() (Haiku only) */ 23 23 enum { 24 24 B_UPDATE_MIME_INFO_NO_FORCE = 0, 25 25 B_UPDATE_MIME_INFO_FORCE_KEEP_TYPE = 1, … … 27 27 }; 28 28 29 29 30 / / C functions30 /* C functions */ 31 31 32 32 #ifdef __cplusplus 33 33 extern "C" { … … 42 42 #ifdef __cplusplus 43 43 } 44 44 45 / / C++ functions, Haiku only!45 /* C++ functions, Haiku only! */ 46 46 47 47 class BBitmap; 48 48 … … 54 54 status_t get_named_icon(const char* name, uint8** _data, size_t* _size, 55 55 type_code* _type); 56 56 57 / / include MimeType.h for convenience57 /* include MimeType.h for convenience */ 58 58 # include <MimeType.h> 59 #endif / / __cplusplus59 #endif /* __cplusplus */ 60 60 61 #endif / / _MIME_H61 #endif /* _MIME_H */ -
support/ByteOrder.h
10 10 #include <endian.h> 11 11 #include <SupportDefs.h> 12 12 #include <TypeConstants.h> 13 / / for convenience13 /* for convenience */ 14 14 15 15 16 / / swap directions16 /* swap directions */ 17 17 typedef enum { 18 18 B_SWAP_HOST_TO_LENDIAN, 19 19 B_SWAP_HOST_TO_BENDIAN, … … 23 23 } swap_action; 24 24 25 25 26 / / BSD/networking macros26 /* BSD/networking macros */ 27 27 #ifndef htonl 28 28 # define htonl(x) B_HOST_TO_BENDIAN_INT32(x) 29 29 # define ntohl(x) B_BENDIAN_TO_HOST_INT32(x) … … 31 31 # define ntohs(x) B_BENDIAN_TO_HOST_INT16(x) 32 32 #endif 33 33 34 / / always swap macros34 /* always swap macros */ 35 35 #define B_SWAP_DOUBLE(arg) __swap_double(arg) 36 36 #define B_SWAP_FLOAT(arg) __swap_float(arg) 37 37 #define B_SWAP_INT64(arg) __swap_int64(arg) … … 39 39 #define B_SWAP_INT16(arg) __swap_int16(arg) 40 40 41 41 #if BYTE_ORDER == __LITTLE_ENDIAN 42 / / Host is little endian42 /* Host is little endian */ 43 43 44 44 #define B_HOST_IS_LENDIAN 1 45 45 #define B_HOST_IS_BENDIAN 0 46 46 47 / / Host native to little endian47 /* Host native to little endian */ 48 48 #define B_HOST_TO_LENDIAN_DOUBLE(arg) (double)(arg) 49 49 #define B_HOST_TO_LENDIAN_FLOAT(arg) (float)(arg) 50 50 #define B_HOST_TO_LENDIAN_INT64(arg) (uint64)(arg) 51 51 #define B_HOST_TO_LENDIAN_INT32(arg) (uint32)(arg) 52 52 #define B_HOST_TO_LENDIAN_INT16(arg) (uint16)(arg) 53 53 54 / / Little endian to host native54 /* Little endian to host native */ 55 55 #define B_LENDIAN_TO_HOST_DOUBLE(arg) (double)(arg) 56 56 #define B_LENDIAN_TO_HOST_FLOAT(arg) (float)(arg) 57 57 #define B_LENDIAN_TO_HOST_INT64(arg) (uint64)(arg) 58 58 #define B_LENDIAN_TO_HOST_INT32(arg) (uint32)(arg) 59 59 #define B_LENDIAN_TO_HOST_INT16(arg) (uint16)(arg) 60 60 61 / / Host native to big endian61 /* Host native to big endian */ 62 62 #define B_HOST_TO_BENDIAN_DOUBLE(arg) __swap_double(arg) 63 63 #define B_HOST_TO_BENDIAN_FLOAT(arg) __swap_float(arg) 64 64 #define B_HOST_TO_BENDIAN_INT64(arg) __swap_int64(arg) 65 65 #define B_HOST_TO_BENDIAN_INT32(arg) __swap_int32(arg) 66 66 #define B_HOST_TO_BENDIAN_INT16(arg) __swap_int16(arg) 67 67 68 / / Big endian to host native68 /* Big endian to host native */ 69 69 #define B_BENDIAN_TO_HOST_DOUBLE(arg) __swap_double(arg) 70 70 #define B_BENDIAN_TO_HOST_FLOAT(arg) __swap_float(arg) 71 71 #define B_BENDIAN_TO_HOST_INT64(arg) __swap_int64(arg) 72 72 #define B_BENDIAN_TO_HOST_INT32(arg) __swap_int32(arg) 73 73 #define B_BENDIAN_TO_HOST_INT16(arg) __swap_int16(arg) 74 74 75 #else / / BYTE_ORDER76 / / Host is big endian75 #else /* BYTE_ORDER */ 76 /* Host is big endian */ 77 77 78 78 #define B_HOST_IS_LENDIAN 0 79 79 #define B_HOST_IS_BENDIAN 1 80 80 81 / / Host native to little endian81 /* Host native to little endian */ 82 82 #define B_HOST_TO_LENDIAN_DOUBLE(arg) __swap_double(arg) 83 83 #define B_HOST_TO_LENDIAN_FLOAT(arg) __swap_float(arg) 84 84 #define B_HOST_TO_LENDIAN_INT64(arg) __swap_int64(arg) 85 85 #define B_HOST_TO_LENDIAN_INT32(arg) __swap_int32(arg) 86 86 #define B_HOST_TO_LENDIAN_INT16(arg) __swap_int16(arg) 87 87 88 / / Little endian to host native88 /* Little endian to host native */ 89 89 #define B_LENDIAN_TO_HOST_DOUBLE(arg) __swap_double(arg) 90 90 #define B_LENDIAN_TO_HOST_FLOAT(arg) __swap_float(arg) 91 91 #define B_LENDIAN_TO_HOST_INT64(arg) __swap_int64(arg) 92 92 #define B_LENDIAN_TO_HOST_INT32(arg) __swap_int32(arg) 93 93 #define B_LENDIAN_TO_HOST_INT16(arg) __swap_int16(arg) 94 94 95 / / Host native to big endian95 /* Host native to big endian */ 96 96 #define B_HOST_TO_BENDIAN_DOUBLE(arg) (double)(arg) 97 97 #define B_HOST_TO_BENDIAN_FLOAT(arg) (float)(arg) 98 98 #define B_HOST_TO_BENDIAN_INT64(arg) (uint64)(arg) 99 99 #define B_HOST_TO_BENDIAN_INT32(arg) (uint32)(arg) 100 100 #define B_HOST_TO_BENDIAN_INT16(arg) (uint16)(arg) 101 101 102 / / Big endian to host native102 /* Big endian to host native */ 103 103 #define B_BENDIAN_TO_HOST_DOUBLE(arg) (double)(arg) 104 104 #define B_BENDIAN_TO_HOST_FLOAT(arg) (float)(arg) 105 105 #define B_BENDIAN_TO_HOST_INT64(arg) (uint64)(arg) 106 106 #define B_BENDIAN_TO_HOST_INT32(arg) (uint32)(arg) 107 107 #define B_BENDIAN_TO_HOST_INT16(arg) (uint16)(arg) 108 108 109 #endif / / BYTE_ORDER109 #endif /* BYTE_ORDER */ 110 110 111 111 112 112 #ifdef __cplusplus … … 118 118 extern bool is_type_swapped(type_code type); 119 119 120 120 121 / / Private implementations121 /* Private implementations */ 122 122 extern double __swap_double(double arg); 123 123 extern float __swap_float(float arg); 124 124 extern uint64 __swap_int64(uint64 arg); … … 129 129 } 130 130 #endif 131 131 132 #endif / / _BYTEORDER_H132 #endif /* _BYTEORDER_H */ -
support/SupportDefs.h
22 22 #include <sys/types.h> 23 23 24 24 25 / / Shorthand type formats25 /* Shorthand type formats */ 26 26 typedef signed char int8; 27 27 typedef unsigned char uint8; 28 28 typedef volatile signed char vint8; … … 57 57 typedef unsigned short unichar; 58 58 59 59 60 / / Descriptive formats60 /* Descriptive formats */ 61 61 typedef int32 status_t; 62 62 typedef int64 bigtime_t; 63 63 typedef uint32 type_code; 64 64 typedef uint32 perform_code; 65 65 66 66 67 / / Empty string ("")67 /* Empty string ("") */ 68 68 #ifdef __cplusplus 69 69 extern const char *B_EMPTY_STRING; 70 70 #endif 71 71 72 72 73 / / min and max comparisons73 /* min and max comparisons */ 74 74 #ifndef __cplusplus 75 75 # ifndef min 76 76 # define min(a,b) ((a)>(b)?(b):(a)) … … 80 80 # endif 81 81 #endif 82 82 83 / / min() and max() won't work in C++83 /* min() and max() won't work in C++ */ 84 84 #define min_c(a,b) ((a)>(b)?(b):(a)) 85 85 #define max_c(a,b) ((a)>(b)?(a):(b)) 86 86 87 87 88 / / Grandfathering88 /* Grandfathering */ 89 89 #ifndef __cplusplus 90 90 # include <stdbool.h> 91 91 #endif … … 99 99 extern "C" { 100 100 #endif 101 101 102 / / Atomic functions; previous value is returned102 /* Atomic functions; previous value is returned */ 103 103 extern int32 atomic_set(vint32 *value, int32 newValue); 104 104 extern int32 atomic_test_and_set(vint32 *value, int32 newValue, int32 testAgainst); 105 105 extern int32 atomic_add(vint32 *value, int32 addValue); … … 114 114 extern int64 atomic_or64(vint64 *value, int64 orValue); 115 115 extern int64 atomic_get64(vint64 *value); 116 116 117 / / Other stuff117 /* Other stuff */ 118 118 extern void* get_stack_frame(void); 119 119 120 120 #ifdef __cplusplus 121 121 } 122 122 #endif 123 123 124 / / Obsolete or discouraged API124 /* Obsolete or discouraged API */ 125 125 126 / / use 'true' and 'false'126 /* use 'true' and 'false' */ 127 127 #ifndef FALSE 128 128 # define FALSE 0 129 129 #endif … … 131 131 # define TRUE 1 132 132 #endif 133 133 134 #endif / / _SUPPORT_DEFS_H134 #endif /* _SUPPORT_DEFS_H */