Make some headers C89 safe again

- Allows to use FindDirectory.h in C89 sourcecode (no C++ style comments
  allowed)
This commit is contained in:
Adrien Destugues 2016-03-27 16:58:38 +02:00
parent af6cb5f94e
commit 97dfeb9670
3 changed files with 31 additions and 33 deletions

View File

@ -5,7 +5,7 @@
#ifndef _OS_H
#define _OS_H
//! Kernel specific structures and functions
/** Kernel specific structures and functions */
#include <pthread.h>
#include <stdarg.h>
@ -87,9 +87,9 @@ typedef struct area_info {
#define B_WRITE_AREA 2
#define B_EXECUTE_AREA 4
#define B_STACK_AREA 8
// "stack" protection is not available on most platforms - it's used
// to only commit memory as needed, and have guard pages at the
// bottom of the stack.
/* "stack" protection is not available on most platforms - it's used
to only commit memory as needed, and have guard pages at the
bottom of the stack. */
extern area_id create_area(const char *name, void **startAddress,
uint32 addressSpec, size_t size, uint32 lock,
@ -381,7 +381,7 @@ extern bigtime_t system_time(void);
extern nanotime_t system_time_nsecs(void);
/* time since booting in nanoseconds */
// deprecated (is no-op)
/* deprecated (is no-op) */
extern status_t set_timezone(const char *timezone);
/* Alarm */

View File

@ -34,44 +34,42 @@ typedef struct {
int32 text_size;
int32 data_size;
// Haiku R1 extensions
int32 api_version; // the Haiku API version used by the image
int32 abi; // the Haiku ABI used by the image
/* Haiku R1 extensions */
int32 api_version; /* the Haiku API version used by the image */
int32 abi; /* the Haiku ABI used by the image */
} image_info;
// flags for clear_caches()
/* flags for clear_caches() */
#define B_FLUSH_DCACHE 0x0001 /* data cache */
#define B_FLUSH_ICACHE 0x0004 /* instruction cache */
#define B_INVALIDATE_DCACHE 0x0002
#define B_INVALIDATE_ICACHE 0x0008
// symbol types
/* symbol types */
#define B_SYMBOL_TYPE_DATA 0x1
#define B_SYMBOL_TYPE_TEXT 0x2
#define B_SYMBOL_TYPE_ANY 0x5
// initialization/termination functions of shared objects
/* initialization/termination functions of shared objects */
#define B_INIT_BEFORE_FUNCTION_NAME "initialize_before"
#define B_INIT_AFTER_FUNCTION_NAME "initialize_after"
#define B_TERM_BEFORE_FUNCTION_NAME "terminate_before"
#define B_TERM_AFTER_FUNCTION_NAME "terminate_after"
#define B_APP_IMAGE_SYMBOL ((void*)(addr_t)0)
// value that can be used instead of a pointer to a symbol in the program
// image.
/* value that can be used instead of a pointer to a symbol in the program
image. */
#define B_CURRENT_IMAGE_SYMBOL ((void*)&__haiku_init_before)
// pointer to a symbol in the callers image
/* pointer to a symbol in the callers image */
// flags for _kern_load_image() (private API)
/* flags for _kern_load_image() (private API) */
enum {
B_WAIT_TILL_LOADED = 0x01,
// Wait till the loader has loaded and relocated
// (but not yet initialized) the application
// image and all dependencies. If not supplied,
// the function returns before the loader
// started to do anything at all, i.e. it
// returns success, even if the executable
// doesn't exist.
/* Wait till the loader has loaded and relocated (but not yet
initialized) the application image and all dependencies. If not
supplied, the function returns before the loader started to do
anything at all, i.e. it returns success, even if the executable
doesn't exist. */
};
#ifdef __cplusplus

View File

@ -11,7 +11,7 @@
#include <limits.h>
// Limits
/* Limits */
#define B_DEV_NAME_LENGTH 128
#define B_FILE_NAME_LENGTH NAME_MAX
#define B_PATH_NAME_LENGTH MAXPATHLEN
@ -19,17 +19,17 @@
#define B_MIME_TYPE_LENGTH (B_ATTR_NAME_LENGTH - 15)
#define B_MAX_SYMLINKS SYMLOOP_MAX
// Open Modes
#define B_READ_ONLY O_RDONLY // read only
#define B_WRITE_ONLY O_WRONLY // write only
#define B_READ_WRITE O_RDWR // read and write
/* Open Modes */
#define B_READ_ONLY O_RDONLY /* read only */
#define B_WRITE_ONLY O_WRONLY /* write only */
#define B_READ_WRITE O_RDWR /* read and write */
#define B_FAIL_IF_EXISTS O_EXCL // exclusive create
#define B_CREATE_FILE O_CREAT // create the file
#define B_ERASE_FILE O_TRUNC // erase the file's data
#define B_OPEN_AT_END O_APPEND // point to the end of the data
#define B_FAIL_IF_EXISTS O_EXCL /* exclusive create */
#define B_CREATE_FILE O_CREAT /* create the file */
#define B_ERASE_FILE O_TRUNC /* erase the file's data */
#define B_OPEN_AT_END O_APPEND /* point to the end of the data */
// Node Flavors
/* Node Flavors */
enum node_flavor {
B_FILE_NODE = 0x01,
B_SYMLINK_NODE = 0x02,
@ -38,4 +38,4 @@ enum node_flavor {
};
#endif // _DEF_STORAGE_H
#endif /* _DEF_STORAGE_H */