headers: wrap declarations in extern "C".
authorZaheer Chothia <zchothia@student.ethz.ch>
Fri, 8 Feb 2013 17:32:03 +0000 (18:32 +0100)
committerZaheer Chothia <zchothia@student.ethz.ch>
Fri, 8 Feb 2013 17:32:03 +0000 (18:32 +0100)
Note: this change is not exhaustive and only touches some headers in //include

91 files changed:
include/arch/x86/bench/bench_arch.h
include/barrelfish/bulk_transfer.h
include/barrelfish/caddr.h
include/barrelfish/cap_predicates.h
include/barrelfish/capabilities.h
include/barrelfish/coreset.h
include/barrelfish/debug.h
include/barrelfish/deferred.h
include/barrelfish/dispatch.h
include/barrelfish/domain.h
include/barrelfish/event_mutex.h
include/barrelfish/event_queue.h
include/barrelfish/except.h
include/barrelfish/heap.h
include/barrelfish/idc.h
include/barrelfish/idc_export.h
include/barrelfish/inthandler.h
include/barrelfish/lmp_chan.h
include/barrelfish/lmp_endpoints.h
include/barrelfish/memobj.h
include/barrelfish/monitor_client.h
include/barrelfish/morecore.h
include/barrelfish/msgbuf.h
include/barrelfish/multihop_chan.h
include/barrelfish/nameservice_client.h
include/barrelfish/ram_alloc.h
include/barrelfish/resource_ctrl.h
include/barrelfish/slab.h
include/barrelfish/slot_alloc.h
include/barrelfish/spawn_client.h
include/barrelfish/sys_debug.h
include/barrelfish/syscalls.h
include/barrelfish/terminal.h
include/barrelfish/threads.h
include/barrelfish/ump_chan.h
include/barrelfish/ump_endpoint.h
include/barrelfish/ump_impl.h
include/barrelfish/vregion.h
include/barrelfish/vspace.h
include/barrelfish/vspace_common.h
include/barrelfish/vspace_layout.h
include/barrelfish/vspace_mmu_aware.h
include/barrelfish/waitset.h
include/barrelfish/waitset_chan.h
include/bench/bench.h
include/collections/flipbuffer.h
include/collections/list.h
include/collections/stack.h
include/concurrent/linked_list.h
include/contmng/contmng.h
include/contmng/netbench.h
include/cpiobin.h
include/dmalloc/dmalloc.h
include/elf/elf.h
include/flounder/flounder_support.h
include/flounder/flounder_support_caps.h
include/flounder/flounder_support_lmp.h
include/flounder/flounder_support_ump.h
include/getopt/getopt.h
include/hashtable/hashtable.h
include/hashtable/multimap.h
include/k_r_malloc.h
include/mdb/mdb.h
include/mdb/mdb_tree.h
include/mm/mm.h
include/mm/slot_alloc.h
include/netdb.h
include/nfs/nfs.h
include/nfs/xdr.h
include/nl_types.h
include/pager/pager.h
include/posixcompat.h
include/semaphore.h
include/signal.h
include/skb/skb.h
include/spawndomain/getopt.h
include/spawndomain/spawndomain.h
include/strings.h
include/sys/dirent.h
include/sys/shm.h
include/sys/socket.h
include/sys/stat.h
include/sys/time.h
include/timer/timer.h
include/unistd.h
include/utime.h
include/vfs/fdtab.h
include/vfs/mmap.h
include/vfs/vfs.h
include/vfs/vfs_fd.h
include/vfs/vfs_path.h

index eeb6cd8..89e6e87 100644 (file)
 #ifndef ARCH_X86_BARRELFISH_BENCH_H
 #define ARCH_X86_BARRELFISH_BENCH_H
 
-#include <bench/bench.h>
+#include <sys/cdefs.h>
+
 #include <arch/x86/barrelfish_kpi/asm_inlines_arch.h>
+#include <bench/bench.h>
+
+__BEGIN_DECLS
 
 extern bool rdtscp_flag;
 
@@ -34,5 +38,6 @@ static inline cycles_t bench_tsc(void)
 }
 
 uint64_t bench_tsc_to_ms(cycles_t tsc);
+__END_DECLS
 
 #endif // ARCH_X86_64_BARRELFISH_BENCH_H
index 3179e0e..175d9fe 100644 (file)
 #ifndef BULK_TRANSFER_H
 #define BULK_TRANSFER_H
 
+#include <sys/cdefs.h>
+
 #include <barrelfish/barrelfish.h>
 #include <barrelfish/bulk_transfer_arch.h>
 
+__BEGIN_DECLS
+
 struct bulk_transfer;
 
 struct bulk_buf {
@@ -124,4 +128,6 @@ static inline void bulk_slave_prepare_recv(struct bulk_transfer_slave *bt,
     bulk_arch_prepare_recv(mem, len);
 }
 
+__END_DECLS
+
 #endif
index 817dd29..ebeb739 100644 (file)
 #ifndef INCLUDEBARRELFISH_CADDR_H
 #define INCLUDEBARRELFISH_CADDR_H
 
+#include <sys/cdefs.h>
+
 #include <barrelfish_kpi/types.h>
 
+__BEGIN_DECLS
+
 /**
  * \brief User-level representation of a CNode, its CSpace address and size
  */
@@ -150,4 +154,6 @@ static inline struct cnoderef build_cnoderef(struct capref cap,
     return ret;
 }
 
+__END_DECLS
+
 #endif
index 0ac3210..0730013 100644 (file)
 #ifndef CAP_PREDICATES_H
 #define CAP_PREDICATES_H
 
+#include <sys/cdefs.h>
+
 #include <barrelfish/debug.h>
 
+__BEGIN_DECLS
+
 struct capability;
 enum objtype;
 
@@ -36,5 +40,7 @@ static inline lpaddr_t mem_to_local_phys(lvaddr_t addr)
     return 0;
 }
 
+__END_DECLS
+
 #endif
 
index 3f4bff5..06b8fbd 100644 (file)
 #define INCLUDEBARRELFISH_CAPABILITIES_H
 
 #include <stdint.h>
+#include <sys/cdefs.h>
+
 #include <barrelfish_kpi/types.h>
 #include <barrelfish_kpi/capabilities.h>
 #include <barrelfish_kpi/dispatcher_shared.h>
 #include <barrelfish/invocations_arch.h>
 
+__BEGIN_DECLS
+
 errval_t cnode_create(struct capref *ret_dest, struct cnoderef *cnoderef,
                  cslot_t slots, cslot_t *retslots);
 errval_t cnode_create_raw(struct capref dest, struct cnoderef *cnoderef,
@@ -126,4 +130,6 @@ static inline errval_t cap_copy(struct capref dest, struct capref src)
     return err;
 }
 
+__END_DECLS
+
 #endif //INCLUDEBARRELFISH_CAPABILITIES_H
index b51c43d..143f206 100644 (file)
 #ifndef LIBBARRELFISH_CORESET_H
 #define LIBBARRELFISH_CORESET_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 typedef coreid_t coreset_token_t;
 
 #define CORESET_INIT_TOKEN 0
@@ -46,4 +50,6 @@ errval_t coreset_from_coremask(coremask_t mask, struct coreset **set);
 
 coreid_t coreset_count(struct coreset *set);
 
+__END_DECLS
+
 #endif
index 832cfd1..11b38c4 100644 (file)
 #ifndef BARRELFISH_DEBUG_H
 #define BARRELFISH_DEBUG_H
 
+#include <sys/cdefs.h>
+
 #include <errors/errno.h>
 #include <barrelfish/caddr.h>
 #include <barrelfish_kpi/registers_arch.h>
 
+__BEGIN_DECLS
+
 struct capability;
 errval_t debug_cap_identify(struct capref cap, struct capability *ret);
 void debug_cspace(struct capref root);
@@ -67,4 +71,6 @@ void user_panic_fn(const char *file, const char *func, int line,
 #define USER_PANIC(msg...)                                 \
     user_panic_fn(__FILE__, __func__, __LINE__, msg);      \
 
+__END_DECLS
+
 #endif //BARRELFISH_DEBUG_H
index 24e6b19..9a512ff 100644 (file)
 #ifndef BARRELFISH_DEFERRED_H
 #define BARRELFISH_DEFERRED_H
 
+#include <sys/cdefs.h>
 #include <barrelfish/waitset.h>
 
+__BEGIN_DECLS
+
 struct deferred_event {
     struct waitset_chanstate waitset_state; ///< Waitset state
     struct deferred_event *next, *prev; ///< Next/prev in dispatcher queue
@@ -45,4 +48,6 @@ errval_t periodic_event_cancel(struct periodic_event *event);
 // XXX: internal to libbarrelfish; should be in another header file
 void trigger_deferred_events_disabled(dispatcher_handle_t dh, systime_t now);
 
+__END_DECLS
+
 #endif // BARRELFISH_DEFERRED_H
index 4de2df6..b1d4ffc 100644 (file)
 
 #ifndef __ASSEMBLER__
 
+#include <sys/cdefs.h>
 #include <barrelfish_kpi/dispatcher_handle.h>
 
+__BEGIN_DECLS
+
 #ifdef  NDEBUG
 #define assert_disabled(e)      ((void)sizeof(e))
 #define warn_disabled(v,e)      ((void)sizeof(e))
@@ -109,6 +112,8 @@ void disp_assert_fail(const char *exp, const char *file, const char *func,
 void disp_warn_fail(const char *exp, const char *file, const char *func,
                    const char *line);
 
+__END_DECLS
+
 #endif //__ASSEMBLER__
 
 #endif
index 87a3bf4..92cc613 100644 (file)
 #ifndef BARRELFISH_DOMAIN_H
 #define BARRELFISH_DOMAIN_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 typedef void (*domain_spanned_callback_t)(void *arg, errval_t err);
 
 struct mem_rpc_client;
@@ -69,4 +73,6 @@ errval_t domain_wakeup_on_disabled(dispatcher_handle_t disp,
                                    dispatcher_handle_t mydisp);
 errval_t domain_thread_move_to(struct thread *thread, coreid_t core_id);
 
+__END_DECLS
+
 #endif
index 2aec5d0..a22d3ab 100644 (file)
 #ifndef BARRELFISH_EVENT_MUTEX_H
 #define BARRELFISH_EVENT_MUTEX_H
 
+#include <sys/cdefs.h>
+
 #include <barrelfish/event_queue.h>
 #include <barrelfish/threads.h>
 
+__BEGIN_DECLS
+
 struct event_mutex {
     struct thread_mutex tmutex;
     struct event_queue equeue;
@@ -32,4 +36,6 @@ bool event_mutex_enqueue_lock(struct event_mutex *em,
 void event_mutex_threaded_lock(struct event_mutex *em);
 void event_mutex_unlock(struct event_mutex *em);
 
+__END_DECLS
+
 #endif // BARRELFISH_EVENT_MUTEX_H
index 31a6a16..c23946f 100644 (file)
 #ifndef BARRELFISH_EVENT_QUEUE_H
 #define BARRELFISH_EVENT_QUEUE_H
 
+#include <sys/cdefs.h>
+
 #include <barrelfish/waitset.h>
 #include <barrelfish/threads.h>
 
+__BEGIN_DECLS
+
 /// What mode does an event queue operate in?
 enum event_queue_mode {
     /// Run events continuously, as the waitset allows
@@ -48,4 +52,6 @@ void event_queue_add(struct event_queue *q, struct event_queue_node *qn,
 errval_t event_queue_cancel(struct event_queue *q, struct event_queue_node *qn);
 errval_t event_queue_trigger(struct event_queue *q);
 
+__END_DECLS
+
 #endif // BARRELFISH_EVENT_QUEUE_H
index 118c50a..35fcf18 100644 (file)
 #ifndef LIBBARRELFISH_EXCEPT_H
 #define LIBBARRELFISH_EXCEPT_H
 
+#include <sys/cdefs.h>
 #include <barrelfish_kpi/registers_arch.h>
 
+__BEGIN_DECLS
+
 enum exception_type {
     EXCEPT_NULL = 0,
     EXCEPT_PAGEFAULT,   ///< Page fault (or other memory access fault)
@@ -55,4 +58,6 @@ errval_t thread_set_exception_handler(exception_handler_fn newhandler,
                                       void *new_stack_base, void *new_stack_top,
                                       void **old_stack_base, void **old_stack_top);
 
+__END_DECLS
+
 #endif
index 9ebdbdb..36eda16 100644 (file)
 #ifndef LIBBARRELFISH_HEAP_H
 #define LIBBARRELFISH_HEAP_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 union heap_header {                 /* block header */
     struct {
         union heap_header *ptr;     /* next block if on free list */
@@ -39,4 +43,6 @@ void *heap_alloc(struct heap *heap, size_t nbytes);
 void heap_free(struct heap *heap, void *ap);
 union heap_header *heap_default_morecore(struct heap *h, unsigned nu);
 
+__END_DECLS
+
 #endif // LIBBARRELFISH_HEAP_H
index 9b380cd..c8072bd 100644 (file)
 #ifndef BARRELFISH_IDC_H
 #define BARRELFISH_IDC_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 /// Generic control operations on an established IDC binding
 typedef enum idc_control {
     IDC_CONTROL_TEARDOWN,   ///< Initiate connection teardown
@@ -62,4 +66,6 @@ typedef enum idc_bind_flags {
 
 void idc_init(void);
 
+__END_DECLS
+
 #endif // BARRELFISH_IDC_H
index 2314d77..7a3db3d 100644 (file)
 #ifndef LIBBARRELFISH_IDC_EXPORT_H
 #define LIBBARRELFISH_IDC_EXPORT_H
 
+#include <sys/cdefs.h>
 #include <barrelfish/idc.h>
 
+__BEGIN_DECLS
+
 typedef void idc_export_callback_fn(void *st, errval_t err, iref_t iref);
 
 #ifdef CONFIG_INTERCONNECT_DRIVER_LMP
@@ -60,4 +63,6 @@ struct idc_export {
 errval_t idc_export_service(struct idc_export *e);
 void idc_export_init(void);
 
+__END_DECLS
+
 #endif
index ae2ef40..e63557d 100644 (file)
 #ifndef _BARRELFISH_INTHANDLER_H
 #define _BARRELFISH_INTHANDLER_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 typedef void (*interrupt_handler_fn)(void *);
 
 errval_t inthandler_setup(interrupt_handler_fn handler, void *handler_arg,
                           uint32_t *ret_vector);
 
+__END_DECLS
+
 #endif
index 6138f65..61ce975 100644 (file)
 #ifndef BARRELFISH_LMP_CHAN_H
 #define BARRELFISH_LMP_CHAN_H
 
+#include <sys/cdefs.h>
+
 #include <barrelfish/waitset.h>
 #include <barrelfish/lmp_endpoints.h>
 #include <barrelfish/idc.h>
 
+__BEGIN_DECLS
+
 struct lmp_chan;
 struct event_queue_node;
 
@@ -176,4 +180,6 @@ static inline lmp_send_flags_t idc_control_to_lmp_flags(idc_control_t control,
 
 #include <barrelfish/lmp_chan_arch.h>
 
+__END_DECLS
+
 #endif // BARRELFISH_LMP_CHAN_H
index 5704c9b..9ed3a9b 100644 (file)
 #ifndef LIBBARRELFISH_LMP_ENDPOINTS_H
 #define LIBBARRELFISH_LMP_ENDPOINTS_H
 
+#include <sys/cdefs.h>
+
 #include <barrelfish/waitset.h>
 #include <barrelfish_kpi/lmp.h>
 
+__BEGIN_DECLS
+
 /// In-endpoint size of a maximum-sized LMP message plus header
 #define LMP_RECV_LENGTH         (LMP_MSG_LENGTH + LMP_RECV_HEADER_LENGTH)
 
@@ -78,4 +82,6 @@ void lmp_endpoint_store_lrpc_disabled(struct lmp_endpoint *ep, uint32_t bufpos,
                                       uintptr_t arg3, uintptr_t arg4);
 void lmp_endpoint_init(void);
 
+__END_DECLS
+
 #endif // LIBBARRELFISH_LMP_ENDPOINTS_H
index d58e8c4..fac10c5 100644 (file)
 #ifndef LIBBARRELFISH_MEMOBJ_H
 #define LIBBARRELFISH_MEMOBJ_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 // FIXME: these enum names need to be scoped (e.g. MEMOBJ_X rather than X) -AB
 enum memobj_type {
     ANONYMOUS,
@@ -120,4 +124,6 @@ errval_t memobj_create_one_frame_lazy(struct memobj_one_frame_lazy *memobj,
 errval_t memobj_create_one_frame_one_map(struct memobj_one_frame_one_map *memobj,
                                          size_t size, memobj_flags_t flags);
 
+__END_DECLS
+
 #endif // LIBBARRELFISH_MEMOBJ_H
index c2e339e..482e3de 100644 (file)
 #ifndef BARRELFISH_MONITOR_CLIENT_H
 #define BARRELFISH_MONITOR_CLIENT_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 struct monitor_lmp_binding;
 
 /// Handlers for incoming/outgoing capabilities on the monitor binding
@@ -43,4 +47,6 @@ errval_t monitor_client_blocking_rpc_init(void);
 
 errval_t monitor_cap_set_remote(struct capref cap, bool remote);
 
+__END_DECLS
+
 #endif // BARRELFISH_MONITOR_CLIENT_H
index 7794675..37bcf76 100644 (file)
 #ifndef BARRELFISH_MORECORE_H
 #define BARRELFISH_MORECORE_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 errval_t morecore_init(void);
 void morecore_use_optimal(void);
 
+__END_DECLS
+
 #endif
index 9457b3e..30bdaf2 100644 (file)
 #ifndef BARRELFISH_MSGBUF_H
 #define BARRELFISH_MSGBUF_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 /// A generic message buffer into which things can be marshalled
 struct msgbuf {
     char *buf;      ///< Pointer to start of message buffer
@@ -66,4 +70,6 @@ DECLARE_PRIM_MARSHALLING(iref, iref_t)
 
 #undef DECLARE_PRIM_MARSHALLING
 
+__END_DECLS
+
 #endif // BARRELFISH_MSGBUF_H
index 3a0a48f..8b56d2e 100644 (file)
 #ifndef BARRELFISH_MULTIHOP_CHAN_H
 #define BARRELFISH_MULTIHOP_CHAN_H
 
+#include <sys/cdefs.h>
+
+#include <barrelfish/monitor_client.h>
 #include <barrelfish/waitset.h>
 #include <flounder/flounder_support_caps.h>
-#include <barrelfish/monitor_client.h>
+
+__BEGIN_DECLS
 
 // turn on / off debugging of the multi-hop interconnect driver
 #define MULTIHOP_DEBUG_ENABLED 0
@@ -184,4 +188,6 @@ errval_t multihop_send_capability(struct multihop_chan *mc,
         struct event_closure _continuation,
         struct flounder_cap_state *cap_state, struct capref cap);
 
+__END_DECLS
+
 #endif // BARRELFISH_MULTIHOP_CHAN_H
index c083d31..dc44b7c 100644 (file)
 #ifndef BARRELFISH_NAMESERVICE_CLIENT_H
 #define BARRELFISH_NAMESERVICE_CLIENT_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 errval_t nameservice_lookup(const char *iface, iref_t *retiref);
 errval_t nameservice_blocking_lookup(const char *iface, iref_t *retiref);
 errval_t nameservice_register(const char *iface, iref_t iref);
@@ -19,4 +23,6 @@ errval_t nameservice_get_capability(const char *key, struct capref *retcap);
 errval_t nameservice_put_capability(const char *key, struct capref cap);
 errval_t nameservice_remove_capability(const char *key);
 
+__END_DECLS
+
 #endif // BARRELFISH_NAMESERVICE_CLIENT_H
index 325792d..3770021 100644 (file)
 #ifndef BARRELFISH_RAM_ALLOC_H
 #define BARRELFISH_RAM_ALLOC_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 typedef errval_t (* ram_alloc_func_t)(struct capref *ret, uint8_t size_bits,
                                       uint64_t minbase, uint64_t maxlimit);
 
@@ -28,4 +32,6 @@ void ram_set_affinity(uint64_t minbase, uint64_t maxlimit);
 void ram_get_affinity(uint64_t *minbase, uint64_t *maxlimit);
 void ram_alloc_init(void);
 
+__END_DECLS
+
 #endif // BARRELFISH_RAM_ALLOC_H
index 2bbe6a0..f7b3f09 100644 (file)
 #ifndef LIBBARRELFISH_RESOURCE_CTRL_H
 #define LIBBARRELFISH_RESOURCE_CTRL_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 errval_t rsrc_manifest(const char *manifest, rsrcid_t *id);
 errval_t rsrc_join(rsrcid_t id);
 errval_t rsrc_phase(rsrcid_t id, uint32_t phase);
 
+__END_DECLS
+
 #endif
index 6aa8a66..2f3ffff 100644 (file)
 #ifndef LIBBARRELFISH_SLAB_H
 #define LIBBARRELFISH_SLAB_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 // forward declarations
 struct slab_alloc;
 struct block_head;
@@ -47,4 +51,6 @@ errval_t slab_default_refill(struct slab_alloc *slabs);
 #define SLAB_STATIC_SIZE(nblocks, blocksize) \
         ((nblocks) * ((blocksize) + sizeof(void *)) + sizeof(struct slab_head))
 
+__END_DECLS
+
 #endif // LIBBARRELFISH_SLAB_H
index dc06365..cceea58 100644 (file)
 #ifndef SLOT_ALLOC_H
 #define SLOT_ALLOC_H
 
+#include <sys/cdefs.h>
+
 #include <barrelfish/threads.h>
 #include <barrelfish/slab.h>
 #include <barrelfish/vspace_common.h>
 
+__BEGIN_DECLS
+
 struct slot_allocator {
     errval_t (*alloc)(struct slot_allocator *ca, struct capref *cap);
     errval_t (*free)(struct slot_allocator *ca, struct capref cap);
@@ -94,4 +98,6 @@ errval_t range_slot_free(struct range_slot_allocator *alloc, struct capref cap,
 errval_t range_slot_alloc_init(struct range_slot_allocator *ret,
                                cslot_t nslots, cslot_t *retslots);
 
+__END_DECLS
+
 #endif // SLOT_ALLOC_H
index 2115ce4..e08cadc 100644 (file)
 #ifndef BARRELFISH_SPAWN_CLIENT_H
 #define BARRELFISH_SPAWN_CLIENT_H
 
+#include <sys/cdefs.h>
 #include <barrelfish_kpi/types.h>
 
+__BEGIN_DECLS
+
 /// Flags for spawning a program
 typedef enum spawn_flags {
     SPAWN_NEW_DOMAIN    = 1 << 0, ///< allocate a new domain ID
@@ -51,4 +54,6 @@ errval_t alloc_inheritcn_with_fdcap(struct capref *inheritcn_capp,
 errval_t alloc_inheritcn_with_sidcap(struct capref *inheritcn_capp,
                                      struct capref sidcap);
 
+__END_DECLS
+
 #endif // BARRELFISH_SPAWN_CLIENT_H
index 3cc87c6..16c2482 100644 (file)
 #ifndef BARRELFISH_SYS_DEBUG_H
 #define BARRELFISH_SYS_DEBUG_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 // XXX: arguments to sys_debug_set_breakpoint, which are clearly x86-specific!!
 #define X86_DEBUG_MODE_EXECONLY     (0) ///< Break on instruction execution only.
 #define X86_DEBUG_MODE_WRITEONLY    (1) ///< Break on data writes only.
@@ -43,4 +47,6 @@ errval_t sys_debug_feign_frame_cap(struct capref slot, lpaddr_t base,
                                    uint8_t bits);
 #endif
 
+__END_DECLS
+
 #endif //BARRELFISH_SYS_DEBUG_H
index 826b0d0..bf4eb92 100644 (file)
 
 /* Proper Barrelfish system calls */
 
+#include <sys/cdefs.h>    /* for __BEGIN_DECLS, __END_DECLS */
+#include <errors/errno.h> /* for errval_t */
+
+__BEGIN_DECLS
+
 /**
  * \brief Yield the CPU.
  *
@@ -47,4 +52,6 @@ errval_t sys_reboot(void);
  */
 errval_t sys_print(const char *string, size_t length);
 
+__END_DECLS
+
 #endif //LIBBARRELFISH_SYSCALL_H
index d9b56ff..0179c29 100644 (file)
 #ifndef TERMINAL_H
 #define TERMINAL_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 /**
  * \brief Callback function to be called when input arrives at the terminal.
  *
@@ -38,4 +42,6 @@ errval_t terminal_want_stdin(unsigned int sources);
 #define TERMINAL_SOURCE_SERIAL   0x1
 #define TERMINAL_SOURCE_KEYBOARD 0x2
 
+__END_DECLS
+
 #endif
index 6da13e9..b0530f3 100644 (file)
@@ -16,6 +16,9 @@
 #define LIBBARRELFISH_THREADS_H
 
 #include <barrelfish/thread_sync.h>
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
 
 typedef int (*thread_func_t)(void *);
 
@@ -59,4 +62,6 @@ void thread_sem_post(struct thread_sem *sem);
 void thread_set_tls(void *);
 void *thread_get_tls(void);
 
+__END_DECLS
+
 #endif
index 719cd39..a5089c7 100644 (file)
 #ifndef BARRELFISH_UMP_CHAN_H
 #define BARRELFISH_UMP_CHAN_H
 
+#include <sys/cdefs.h>
+
 #include <barrelfish/ump_endpoint.h>
 #include <barrelfish/monitor_client.h>
 
+__BEGIN_DECLS
+
 struct ump_chan;
 struct monitor_binding;
 
@@ -136,4 +140,6 @@ static inline void ump_chan_migrate_recv(struct ump_chan *lc,
     ump_endpoint_migrate(&lc->endpoint, ws);
 }
 
+__END_DECLS
+
 #endif // BARRELFISH_UMP_CHAN_H
index 8ed7d28..899f024 100644 (file)
 #ifndef LIBBARRELFISH_UMP_ENDPOINT_H
 #define LIBBARRELFISH_UMP_ENDPOINT_H
 
+#include <sys/cdefs.h>
+
 #include <barrelfish/waitset.h>
 #include <barrelfish/ump_impl.h>
 
+__BEGIN_DECLS
+
 /// Incoming UMP endpoint
 struct ump_endpoint {
     struct waitset_chanstate waitset_state; ///< Waitset per-channel state
@@ -60,4 +64,6 @@ static inline errval_t ump_endpoint_recv(struct ump_endpoint *ep,
     }
 }
 
+__END_DECLS
+
 #endif // LIBBARRELFISH_UMP_ENDPOINT_H
index 31ecff8..71e9021 100644 (file)
@@ -18,6 +18,9 @@
 #include <stddef.h>
 #include <stdint.h>
 #include <stdbool.h>
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
 
 /**
  * UMP message size is fixed to cache-line size (64 bytes on x86_64).
@@ -205,4 +208,6 @@ static inline volatile struct ump_message *ump_impl_get_next(
     return msg;
 }
 
+__END_DECLS
+
 #endif // UMP_IMPL_H
index 6fa0bdb..d868063 100644 (file)
 #ifndef LIBBARRELFISH_VREGION_H
 #define LIBBARRELFISH_VREGION_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 #define VREGION_FLAGS_READ     0x01 // Reading allowed
 #define VREGION_FLAGS_WRITE    0x02 // Writing allowed
 #define VREGION_FLAGS_EXECUTE  0x04 // Execute allowed
@@ -114,4 +118,6 @@ errval_t vregion_destroy(struct vregion* region);
 errval_t vregion_pagefault_handler(struct vregion* region, genvaddr_t addr,
                                    vm_fault_type_t type);
 
+__END_DECLS
+
 #endif // LIBBARRELFISH_VREGION_H
index d794f1e..c474a19 100644 (file)
 #ifndef LIBBARRELFISH_VSPACE_H
 #define LIBBARRELFISH_VSPACE_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 struct vspace {
     struct pmap *pmap;           ///< Pmap associated with the vspace
     struct vspace_layout layout; ///< The layout of the address space
@@ -41,4 +45,6 @@ struct vregion* vspace_get_region(struct vspace* vspace, const void *addr);
 errval_t vspace_pagefault_handler(struct vspace* vspace, lvaddr_t addr,
                                   vm_fault_type_t type);
 
+__END_DECLS
+
 #endif // LIBBARRELFISH_VSPACE_H
index 3c95257..804838b 100644 (file)
@@ -23,6 +23,8 @@ typedef uint32_t vregion_flags_t;
 #define PRIuVREGIONFLAGS PRIu32
 #define PRIxVREGIONFLAGS PRIx32
 
+#include <sys/cdefs.h>
+
 #include <barrelfish/memobj.h>
 #include <barrelfish/vregion.h>
 #include <barrelfish/pmap_arch.h>
@@ -30,6 +32,8 @@ typedef uint32_t vregion_flags_t;
 #include <barrelfish/vspace.h>
 #include <barrelfish/vspace_mmu_aware.h>
 
+__BEGIN_DECLS
+
 errval_t vspace_unmap(const void *buf);
 errval_t vspace_map_anon_attr(void **retaddr, struct memobj **ret_memobj,
                               struct vregion **ret_vregion, size_t size,
@@ -66,4 +70,6 @@ errval_t vspace_map_one_frame_fixed_attr(lvaddr_t addr, size_t size,
                                     struct memobj **retmemobj,
                                          struct vregion **retvregion);
 
+__END_DECLS
+
 #endif // LIBBARRELFISH_VSPACE_COMMON_H
index 76f8d23..3662fa9 100644 (file)
 #ifndef LIBBARRELFISH_VSPACE_LAYOUT_H
 #define LIBBARRELFISH_VSPACE_LAYOUT_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 struct vspace_layout;
 struct vspace_layout_funcs {
     errval_t (*alloc)(struct vspace_layout *layout, genvaddr_t *addr);
@@ -66,4 +70,6 @@ static inline lvaddr_t vspace_layout_genvaddr_to_lvaddr(struct vspace_layout *l,
 
 errval_t vspace_layout_init(struct vspace_layout *l);
 
+__END_DECLS
+
 #endif // LIBBARRELFISH_VSPACE_LAYOUT_H
index 96331ff..5ca6705 100644 (file)
 #ifndef LIBBARRELFISH_VSPACE_MMU_AWARE_H
 #define LIBBARRELFISH_VSPACE_MMU_AWARE_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 struct vspace_mmu_vregion_list {
     struct vregion vregion;
     struct vspace_mmu_vregion_list *next;
@@ -37,4 +41,6 @@ errval_t vspace_mmu_aware_map(struct vspace_mmu_aware *state,
 errval_t vspace_mmu_aware_unmap(struct vspace_mmu_aware *state,
                                 lvaddr_t base, size_t bytes);
 
+__END_DECLS
+
 #endif // LIBBARRELFISH_VSPACE_MMU_AWARE_H
index c67f8ad..40da504 100644 (file)
 #ifndef BARRELFISH_WAITSET_H
 #define BARRELFISH_WAITSET_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 struct waitset;
 struct thread;
 
@@ -92,4 +96,6 @@ errval_t check_for_event(struct waitset *ws, struct event_closure *retclosure);
 errval_t event_dispatch(struct waitset *ws);
 errval_t event_dispatch_non_block(struct waitset *ws);
 
+__END_DECLS
+
 #endif // BARRELFISH_WAITSET_H
index 605936f..8c60a42 100644 (file)
 #ifndef BARRELFISH_WAITSET_CHAN_H
 #define BARRELFISH_WAITSET_CHAN_H
 
+#include <sys/cdefs.h>
 #include <barrelfish/waitset.h>
 
+__BEGIN_DECLS
+
 static inline bool waitset_chan_is_registered(struct waitset_chanstate *chan)
 {
     return chan->waitset != NULL &&
@@ -36,4 +39,6 @@ errval_t waitset_chan_register(struct waitset *ws, struct waitset_chanstate *cha
 void waitset_chan_migrate(struct waitset_chanstate *chan,
                           struct waitset *new_ws);
 
+__END_DECLS
+
 #endif // BARRELFISH_WAITSET_CHAN_H
index cb8bc96..73ce190 100644 (file)
 
 #include <barrelfish/types.h> // for cycles_t
 #include <bench/bench_arch.h>
+#include <sys/cdefs.h>
 
 #define BENCH_IGNORE_WATERMARK 0XDEADBEEF
 
+__BEGIN_DECLS
 void bench_init(void);
 cycles_t bench_avg(cycles_t *array, size_t len);
 cycles_t bench_variance(cycles_t *array, size_t len);
 cycles_t bench_tscoverhead(void);
+__END_DECLS
 
 #endif // BENCH_H
index 4f78fea..9b9479f 100644 (file)
@@ -17,6 +17,9 @@
 
 #include <stdbool.h>
 #include <stdlib.h>
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
 
 struct collections_fbuf {
     void *front;        /// < front buffer (currently active buffer)
@@ -46,4 +49,6 @@ bool   collections_fbuf_other_is_empty(struct collections_fbuf *fbuf);
 
 void   collections_fbuf_release(struct collections_fbuf *fbuf);
 
+__END_DECLS
+
 #endif // _COLLECTIONS_FLIPBUFFER_H_
index efb36a6..ca6a1ee 100644 (file)
 #ifndef _LIST_H_\r
 #define _LIST_H_\r
 \r
+#include <assert.h>\r
 #include <stdio.h>\r
 #include <string.h>\r
 #include <stdlib.h>\r
-#include <assert.h>\r
+#include <sys/cdefs.h>\r
 \r
 #ifdef WIN32\r
 #include <malloc.h>\r
@@ -29,6 +30,7 @@
 #include <barrelfish/barrelfish.h>\r
 #endif // BARRELFISH\r
 \r
+__BEGIN_DECLS\r
 \r
 /*\r
  * Predicate function.\r
@@ -115,4 +117,6 @@ typedef int (*collections_list_visitor_func)(void *data, void *arg);
 int collections_list_visit(collections_listnode *start,\r
                            collections_list_visitor_func f, void *arg);\r
 \r
+__END_DECLS\r
+\r
 #endif\r
index f4c6497..d554436 100644 (file)
 #ifndef _COLLECTIONS_STACK_H_
 #define _COLLECTIONS_STACK_H_
 
+#include <sys/cdefs.h>
+
 #include <collections/list.h>
 
+__BEGIN_DECLS
+
 struct collections_stack {
     /**
      * total number of elements
@@ -39,4 +43,6 @@ void *collections_stack_top(struct collections_stack *stack);
 
 void  collections_stack_release(struct collections_stack *stack);
 
+__END_DECLS
+
 #endif // _COLLECTIONS_STACK_H_
index d39672d..76f6b8e 100644 (file)
 #ifndef LINKED_LIST_H_
 #define LINKED_LIST_H_
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 struct ll_element {
     struct ll_element *next;
     void* key;
@@ -60,4 +64,6 @@ static inline const uintptr_t get_marked_reference(const uintptr_t p)
     return p | 0x1;
 }
 
+__END_DECLS
+
 #endif /* LINKED_LIST_H_ */
index a300d07..a1fcd7a 100644 (file)
 
 #ifndef CONTMNG_H_
 #define CONTMNG_H_
+
 #include <stdio.h>
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
 
 /*********************************************************************/
 /* Implementation of generic queue */
@@ -63,4 +67,6 @@ int queue_free_slots(struct cont_queue *q);
 
 void show_binary_blob (void *data, int len);
 
+__END_DECLS
+
 #endif // CONTMNG_H_
index 74d5faf..8eb0065 100644 (file)
@@ -18,6 +18,9 @@
 
 #include <barrelfish/barrelfish.h>
 #include <stdio.h>
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
 
 #if 0
 #define CONVERT_TO_SEC
@@ -92,4 +95,6 @@ void netbench_print_all_stats(struct netbench_details *nbp);
 uint64_t my_avg(uint64_t sum, uint64_t n);
 float in_seconds(uint64_t cycles);
 
+__END_DECLS
+
 #endif // CONTMNG_H_
index f481858..8f54aa6 100644 (file)
@@ -11,6 +11,9 @@
 #define __CPIOBIN_H__
 
 #include <stdint.h>
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
 
 typedef enum
 {
@@ -134,4 +137,6 @@ cpio_visit(
     void*                  arg
 );
 
+__END_DECLS
+
 #endif // __CPIOBIN_H__
index 0f3cc49..76f2433 100644 (file)
@@ -1,6 +1,10 @@
 #ifndef __DMALLOC_H__
 #define __DMALLOC_H__
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
   malloc(size_t n)
   Returns a pointer to a newly allocated chunk of at least n bytes, or
@@ -58,4 +62,8 @@ void* dlcalloc(size_t, size_t);
 
 void* dlrealloc(void*, size_t);
 
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
 #endif
index 2ff6033..66bdcfb 100644 (file)
 #ifndef ELF_H
 #define ELF_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 /* Indexes into the e_ident array.  Keep synced with
    http://www.sco.com/developers/gabi/latest/ch4.eheader.html */
 #define EI_MAG0         0       /* Magic number, byte 0. */
@@ -760,4 +764,6 @@ genvaddr_t elf_virtual_base32(struct Elf32_Ehdr *ehead);
 genvaddr_t elf_virtual_base64(struct Elf64_Ehdr *ehead);
 genvaddr_t elf_virtual_base(lvaddr_t base);
 
+__END_DECLS
+
 #endif // ELF_H
index 36548f0..600412d 100644 (file)
@@ -16,6 +16,9 @@
 #define __FLOUNDER_SUPPORT_H
 
 #include <flounder/flounder.h>
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
 
 /// State associated with an ongoing generic bind attempt
 struct flounder_generic_bind_attempt {
@@ -59,4 +62,6 @@ void flounder_support_migrate_notify(struct waitset_chanstate *chan,
 # define FL_DEBUG(msg...) ((void)0)
 #endif
 
+__END_DECLS
+
 #endif // __FLOUNDER_SUPPORT_H
index c0276cd..dd81b0d 100644 (file)
 #ifndef __FLOUNDER_SUPPORT_CAPS_H
 #define __FLOUNDER_SUPPORT_CAPS_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 /// State for indirect (via monitor) cap tx/rx machinery
 struct flounder_cap_state {
     bool tx_cap_ack;    ///< Waiting to send a cap ack (for current rx message)
@@ -35,4 +39,6 @@ errval_t flounder_stub_send_cap(struct flounder_cap_state *s,
                                 struct capref cap, bool give_away,
                                 void (*cont)(void *st));
 
+__END_DECLS
+
 #endif // __FLOUNDER_SUPPORT_CAPS_H
index a89ed5b..42f8e98 100644 (file)
 #ifndef __FLOUNDER_SUPPORT_LMP_H
 #define __FLOUNDER_SUPPORT_LMP_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 struct lmp_chan;
 struct lmp_recv_msg;
 
@@ -31,4 +35,6 @@ errval_t flounder_stub_lmp_send_buf(struct lmp_chan *chan,
 errval_t flounder_stub_lmp_recv_buf(struct lmp_recv_msg *msg, void **buf,
                                     size_t *len, size_t *pos);
 
+__END_DECLS
+
 #endif // __FLOUNDER_SUPPORT_LMP_H
index 3d1b6c4..80df3d7 100644 (file)
 #ifndef __FLOUNDER_SUPPORT_UMP_H
 #define __FLOUNDER_SUPPORT_UMP_H
 
+#include <sys/cdefs.h>
+
 #include <barrelfish/ump_chan.h>
 #include <flounder/flounder_support_caps.h>
 #include <trace/trace.h>
 
+__BEGIN_DECLS
+
 /// Number of bits available for the message type in the header
 #define FL_UMP_MSGTYPE_BITS (UMP_HEADER_BITS - UMP_INDEX_BITS)
 
@@ -133,4 +137,6 @@ static inline void flounder_stub_ump_send_cap_ack(struct flounder_ump_state *s)
     msg->header.control = ctrl;
 }
 
+__END_DECLS
+
 #endif // __FLOUNDER_SUPPORT_UMP_H
index 4d15ed4..45a38bd 100644 (file)
 #ifndef GETOPT_H
 #define GETOPT_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 enum argtype {
     ArgType_Int,
     ArgType_UInt,
@@ -38,4 +42,6 @@ struct cmdarg {
 
 extern void parse_commandline(const char *cmdline, struct cmdarg *cmdargs);
 
+__END_DECLS
+
 #endif // GETOPT_H
index bd12da1..8285bd0 100644 (file)
@@ -16,6 +16,9 @@
 
 #include <hashtable/dictionary.h>
 #include <stdio.h>
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
 
 /**
  * \brief an entry of a hashtable
@@ -59,4 +62,6 @@ struct hashtable* create_hashtable(void);
 
 void print_hashtable(FILE *stream, struct hashtable *ht);
 
+__END_DECLS
+
 #endif /*HASHTABLE_H_*/
index 4b8783c..befa3bd 100644 (file)
@@ -16,6 +16,9 @@
 #define MULTIMAP_H_
 
 #include <hashtable/hashtable.h>
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
 
 struct multimap {
     struct hashtable h;
@@ -27,4 +30,6 @@ struct multimap {
 
 struct multimap* create_multimap(void);
 
+__END_DECLS
+
 #endif /* MULTIMAP_H_ */
index c7bd41c..9488030 100644 (file)
@@ -1,6 +1,10 @@
 #ifndef _LIBC_K_R_MALLOC_H_
 #define _LIBC_K_R_MALLOC_H_
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 #define NALLOC  0x10000                /* minimum #units to request */
 
 typedef long long Align;       /* for alignment to long long boundary */
@@ -19,4 +23,7 @@ Header  *morecore(unsigned nu);
 void lesscore(void);
 void __free_locked(void *ap);
 void __malloc_init(void*, void*);
+
+__END_DECLS
+
 #endif /* _LIBC_K_R_MALLOC_H_ */
index 31b3a75..13c3034 100644 (file)
 #ifndef LIBMDB_MDB_H
 #define LIBMDB_MDB_H
 
+#include <sys/cdefs.h>
+
 #include <barrelfish/types.h>
 #include <errors/errno.h> // For errval_t
 #include <barrelfish_kpi/capabilities.h>
 #include <mdb/types.h>
 
+__BEGIN_DECLS
+
 struct capability;
 struct cte;
 
@@ -28,4 +32,6 @@ bool mdb_is_sane(void);
 void set_cap_remote(struct cte *cte, bool is_remote);
 bool is_cap_remote(struct cte *cte);
 
+__END_DECLS
+
 #endif // LIBMDB_MDB_H
index edc8323..3d79286 100644 (file)
 #ifndef LIBMDB_MDB_TREE_H
 #define LIBMDB_MDB_TREE_H
 
+#include <sys/cdefs.h>
+
 #include <errors/errno.h>
 #include <barrelfish/types.h>
 #include <mdb/types.h>
 
+__BEGIN_DECLS
+
 struct capability;
 struct cte;
 
@@ -99,4 +103,6 @@ errval_t mdb_find_range(mdb_root_t root, genpaddr_t address, gensize_t size,
 
 errval_t mdb_find_cap_for_address(genpaddr_t address, struct cte **ret_node);
 
+__END_DECLS
+
 #endif // LIBMDB_MDB_TREE_H
index 4ecbdf1..1415183 100644 (file)
 #ifndef BARRELFISH_MM_H
 #define BARRELFISH_MM_H
 
+#include <sys/cdefs.h>
+
 #include <barrelfish/slab.h>
 #include <mm/slot_alloc.h>
 
+__BEGIN_DECLS
+
 enum nodetype {
     NodeType_Dummy,     ///< The whole region doesn't exist, but it has children
     NodeType_Chunked,   ///< This region exists and has been split up
@@ -86,4 +90,6 @@ size_t mm_relinquish_all(struct mm *mm, struct mem_cap *ret, size_t retlen);
 size_t mm_relinquish_range(struct mm *mm, genpaddr_t base, genpaddr_t limit,
                            struct mem_cap *ret, size_t retlen);
 
+__END_DECLS
+
 #endif /* BARRELFISH_MM_H */
index 43deca9..0f2442a 100644 (file)
 #ifndef MM_SLOT_ALLOC_H
 #define MM_SLOT_ALLOC_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 /// Generic interface to slot allocator function
 typedef errval_t (*slot_alloc_t)(void *inst, uint64_t nslots, struct capref *ret);
 
@@ -70,4 +74,6 @@ struct slot_alloc_basecn {
 /// Initialiser for the single-cnode implementation
 errval_t slot_alloc_basecn_init(struct slot_alloc_basecn *slot_alloc);
 
+__END_DECLS
+
 #endif // MM_SLOT_ALLOC_H
index d7027a2..f71e30e 100644 (file)
@@ -69,6 +69,9 @@
 #define NETDB_H
 
 #include <lwip/netdb.h>
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
 
 /*
  * Flag values for getaddrinfo()
@@ -98,4 +101,6 @@ int getaddrinfo(const char *nodename,
 void freeaddrinfo(struct addrinfo *ai);
 const char *gai_strerror(int ecode);
 
+__END_DECLS
+
 #endif
index 23e7358..55b5142 100644 (file)
@@ -15,6 +15,8 @@
 #ifndef BARRELFISH_NFS_H
 #define BARRELFISH_NFS_H
 
+#include <sys/cdefs.h>
+
 #include <lwip/err.h> // for err_t
 #include <lwip/ip_addr.h> // for struct ip_addr
 #include <errors/errno.h>
@@ -23,6 +25,8 @@
 #include <nfs/mount_rpc.h>
 #include <nfs/nfs_rpc.h>
 
+__BEGIN_DECLS
+
 #define NFS_READDIR_COOKIE 0        ///< initial cookie for readdir
 #define NFS_READDIR_COOKIEVERF NULL ///< initial cookie verifier for readder
 
@@ -228,4 +232,6 @@ void nfs_freefh(struct nfs_fh3 fh);
 errval_t nfsstat_to_errval(enum nfsstat3 s);
 errval_t mountstat_to_errval(enum mountstat3 s);
 
+__END_DECLS
+
 #endif // BARRELFISH_NFS_H
index 7746c15..4956a8f 100644 (file)
@@ -49,6 +49,8 @@
 #include <sys/types.h>
 #include <sys/cdefs.h>
 
+__BEGIN_DECLS
+
 /* nasty typedefs needed by RPC/XDR code */
 typedef int enum_t;
 typedef bool bool_t;
@@ -261,4 +263,6 @@ extern bool xdr_wrapstring(XDR *, char **);
 //extern void xdr_free(xdrproc_t, void *);
 //extern unsigned long xdr_sizeof(xdrproc_t func, void *data);
 
+__END_DECLS
+
 #endif /* !_RPC_XDR_H */
index 8a343bf..f281154 100644 (file)
 #ifndef _NL_TYPES_H_
 #define _NL_TYPES_H_
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 #define        NL_SETD         0
 #define        NL_CAT_LOCALE   1
 
@@ -27,4 +31,6 @@ nl_catd  catopen(const char *, int);
 char    *catgets(nl_catd, int, int, const char *);
 int     catclose(nl_catd);
 
+__END_DECLS
+
 #endif
index 8d19852..e3ffd74 100644 (file)
@@ -1,8 +1,15 @@
 #ifndef __PAGER_H
 #define __PAGER_H
+
+#include <sys/cdefs.h>
+
 #include <barrelfish/barrelfish.h>
 #include <barrelfish/except.h>
 
+__BEGIN_DECLS
+
 errval_t pager_install_handler(char *ex_stack, size_t stack_size);
 
+__END_DECLS
+
 #endif // __PAGER_H
index 40f9ec5..42eb4b1 100644 (file)
 #ifndef POSIXCOMPAT_H
 #define POSIXCOMPAT_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 errval_t spawn_setup_fds(struct capref *frame, int rfd);
 errval_t posixcompat_unpack_fds(void);
 
+__END_DECLS
+
 #endif
index f868863..6821b75 100644 (file)
@@ -11,6 +11,9 @@
 #define SEMAPHORE_H
 
 #include <barrelfish/thread_sync.h>
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
 
 struct posix_semaphore {
     int pshared;
@@ -26,4 +29,6 @@ int sem_wait(sem_t *sem);
 int sem_trywait(sem_t *sem);
 int sem_post(sem_t *sem);
 
+__END_DECLS
+
 #endif
index 60f403f..e8df812 100644 (file)
@@ -51,6 +51,8 @@
 #include <sys/_types.h>
 #include <sys/_sigset.h>
 
+__BEGIN_DECLS
+
 #define SIGHUP          1       /* hangup */
 #define SIGINT          2       /* interrupt */
 #define SIGQUIT         3       /* quit */
@@ -125,4 +127,6 @@ int sigemptyset(sigset_t *set);
 int sigfillset(sigset_t *set);
 int sigismember(const sigset_t *set, int signo);
 
+__END_DECLS
+
 #endif // BARRELFISH_SIGNAL_H_
index 88d10c4..1429791 100644 (file)
 #ifndef SKB_H_
 #define SKB_H_
 
-#include <stdint.h> /* int32_t */
+#include <stdint.h>    /* for int32_t */
+#include <sys/cdefs.h> /* for __BEGIN_DECLS, __END_DECLS */
+
+__BEGIN_DECLS
 
 errval_t skb_client_connect(void);
 errval_t skb_evaluate(char *query, char **result, char **str_error, int32_t *int_error);
@@ -43,5 +46,6 @@ void skb_read_list_init(struct list_parser_status *status);
 bool skb_read_list(struct list_parser_status *status, char *fmt, ...)
     __attribute__((format(scanf, 2, 3)));
 
+__END_DECLS
 
 #endif // SKB_H_
index 95da8c8..17a253c 100644 (file)
 #define SPAWN_GETOPT_H
 
 #include <stddef.h>
+#include <sys/cdefs.h>
 
+__BEGIN_DECLS
 const char *getopt(const char **optstring, char *buf, size_t buflen,
                    size_t *optlen);
+__END_DECLS
 
 #endif // SPAWN_GETOPT_H
index 327916b..969dae5 100644 (file)
@@ -15,6 +15,7 @@
 #ifndef SPAWNDOMAIN_H
 #define SPAWNDOMAIN_H
 
+#include <sys/cdefs.h>
 
 //XXX: added alignment to workaround an arm-gcc bug
 //which generated (potentially) unaligned access code to those fields
@@ -54,6 +55,7 @@ struct spawninfo {
     size_t tls_init_len, tls_total_len;
 };
 
+__BEGIN_DECLS
 errval_t spawn_get_cmdline_args(struct mem_region *module,
                                 char **retargs);
 int spawn_tokenize_cmdargs(char *args, char *argv[], size_t argv_len);
@@ -113,5 +115,6 @@ errval_t spawn_span_domain(struct spawninfo *si, struct capref vroot,
 /* errval_t spawn_memory(struct spawninfo *si, const char *name, uint8_t core_id, */
 /*                       int argc, char *argv[], lvaddr_t binary, */
 /*                       size_t binary_size); */
+__END_DECLS
 
 #endif //SPAWNDOMAIN_H
index 1cba223..aa00efa 100644 (file)
@@ -37,7 +37,7 @@
 //#define      _SIZE_T_DECLARED
 //#endif
 
-//__BEGIN_DECLS
+__BEGIN_DECLS
 //int   bcmp(const void *, const void *, size_t) __pure;       /* LEGACY */
 //void  bcopy(const void *, void *, size_t);                   /* LEGACY */
 //void  bzero(void *, size_t);                                 /* LEGACY */
@@ -53,6 +53,6 @@
 //char *rindex(const char *, int) __pure;                      /* LEGACY */
 int     strcasecmp(const char *, const char *) __pure;
 int     strncasecmp(const char *, const char *, size_t) __pure;
-//__END_DECLS
+__END_DECLS
 
 #endif /* _STRINGS_H_ */
index 44253f2..0ade7bb 100644 (file)
@@ -10,6 +10,8 @@
 #ifndef DIRENT_H_
 #define DIRENT_H_
 
+#include <sys/cdefs.h>
+
 #define NAME_MAX 512
 
 struct dirent {
@@ -24,8 +26,10 @@ typedef struct {
     void *vh; // really a vfs_handle_t
 } DIR;
 
+__BEGIN_DECLS
 DIR *opendir(const char *pathname);
 struct dirent *readdir(DIR* dir);
 int closedir(DIR *dir);
+__END_DECLS
 
 #endif
index b155b6c..39ac412 100644 (file)
@@ -55,16 +55,18 @@ struct shmid_ds {
     time_t shm_ctime;
 };
 
-#include <sys/cdefs.h>
-
 #ifndef _SIZE_T_DECLARED
 typedef __size_t        size_t;
 #define _SIZE_T_DECLARED
 #endif
 
+__BEGIN_DECLS
+
 void *shmat(int, const void *, int);
 int shmget(key_t, size_t, int);
 int shmctl(int, int, struct shmid_ds *);
 int shmdt(const void *);
 
+__END_DECLS
+
 #endif
index bc75452..dad3207 100644 (file)
@@ -33,6 +33,7 @@
 #ifndef SOCKET_H
 #define SOCKET_H
 
+#include <sys/cdefs.h>
 #include <lwip/sockets.h>
 
 #if __BSD_VISIBLE
@@ -48,6 +49,7 @@ typedef __sa_family_t sa_family_t;
 #define _SA_FAMILY_T_DECLARED
 #endif
 
+__BEGIN_DECLS
 ssize_t recv(int sockfd, void *buf, size_t len, int flags);
 ssize_t recvfrom(int sockfd, void *buf, size_t len, int flags,
                  struct sockaddr *src_addr, socklen_t *addrlen);
@@ -67,5 +69,6 @@ int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
 int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
 int shutdown(int sockfd, int how);
 int socketpair(int domain, int type, int protocol, int sockfd[2]);
+__END_DECLS
 
 #endif
index a05c191..d898b1e 100644 (file)
@@ -10,6 +10,7 @@
 #ifndef STAT_BARRELFISH_H_
 #define STAT_BARRELFISH_H_
 
+#include <sys/cdefs.h>
 #include <sys/types.h> // for mode_t and dev_t
 
 struct stat {
@@ -64,10 +65,12 @@ struct stat {
 #define S_ISCHR(mode)    (((mode) & S_IFMT) == S_IFCHR)
 #define S_ISFIFO(mode)   (((mode) & S_IFMT) == S_IFIFO)
 
+__BEGIN_DECLS
 mode_t umask(mode_t mask);
 //int chmod(const char *path, mode_t mode);
 int stat(const char *pathname, struct stat *buf);
 int fstat(int fd, struct stat*buf);
 int lstat(const char *path, struct stat *buf);
+__END_DECLS
 
 #endif //  STAT_BARRELFISH_H_
index fd657f9..cb3c513 100644 (file)
@@ -42,6 +42,7 @@
 #ifndef SYS_TIME_BARRELFISH_H_
 #define SYS_TIME_BARRELFISH_H_
 
+#include <sys/cdefs.h>
 #include <time.h>
 
 struct timezone {
@@ -82,8 +83,10 @@ struct itimerval {
            ((tvp)->tv_usec cmp (uvp)->tv_usec) :                       \
            ((tvp)->tv_sec cmp (uvp)->tv_sec))
 
+__BEGIN_DECLS
 int gettimeofday(struct timeval *tv, struct timezone *tz);
 int setitimer(int which, const struct itimerval *new_value,
               struct itimerval *old_value);
+__END_DECLS
 
 #endif
index 0374c07..1e886ca 100644 (file)
@@ -17,6 +17,9 @@
 
 #include <stdbool.h>
 #include <stdint.h>
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
 
 struct timer;
 
@@ -82,4 +85,6 @@ static inline struct timer *timer_create(uint64_t duration, bool periodic,
     return newtimer;
 }
 
+__END_DECLS
+
 #endif
index 4625eff..43006f4 100644 (file)
@@ -43,6 +43,7 @@
 #define __BF_UNISTD_H
 
 #include <stddef.h>
+#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <pwd.h>
 #include <fcntl.h> // for pid_t
 struct stat;
 extern char **environ;
 
+__BEGIN_DECLS
 #if (__XSI_VISIBLE && __XSI_VISIBLE <= 500) || __BSD_VISIBLE
 int          chroot(const char *path);
 #endif
@@ -253,5 +255,6 @@ int          symlink(const char *oldpath, const char *newpath);
 long         sysconf(int name);
 int          unlink(const char*pathname);
 int          write(int fd, const void *buf, size_t len);
+__END_DECLS
 
 #endif // __BF_UNISTD_H
index 76af873..e3f706c 100644 (file)
@@ -10,6 +10,7 @@
 #ifndef UTIME_BARRELFISH_H_
 #define UTIME_BARRELFISH_H_
 
+#include <sys/cdefs.h>
 #include <time.h>
 
 struct utimbuf {
@@ -17,6 +18,8 @@ struct utimbuf {
     time_t modtime;
 };
 
+__BEGIN_DECLS
 int utime(const char *filename, const struct utimbuf *times);
+__END_DECLS
 
 #endif // UTIME_BARRELFISH_H_
index bc12f9e..519de15 100644 (file)
 #ifndef _FDTAB_H
 #define _FDTAB_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 #define MIN_FD  0
 #define MAX_FD  132
 
@@ -39,4 +43,6 @@ int fdtab_search_alloc(struct fdtab_entry *h);
 struct fdtab_entry *fdtab_get(int fd);
 void fdtab_free(int fd);
 
+__END_DECLS
+
 #endif // _FDTAB_H
index a477be2..3dbb1f5 100644 (file)
 #ifndef VFS_MMAP_H
 #define VFS_MMAP_H
 
+#include <sys/cdefs.h>
+
 #include <barrelfish/memobj.h>
 #include <vfs/vfs.h>
 
+__BEGIN_DECLS
+
 struct memobj_vfs {
     struct memobj_anon anon; // underlying anon memobj that manages the frames
     vfs_handle_t vh; // VFS handle for file
@@ -41,4 +45,6 @@ errval_t vspace_map_file_aligned(size_t alignment, size_t size,
                                  struct vregion **ret_vregion,
                                  struct memobj **ret_memobj);
 
+__END_DECLS
+
 #endif
index 99e67e2..7f97ca3 100644 (file)
@@ -11,6 +11,7 @@
 #define VFS_H
 
 #include <stddef.h>
+#include <sys/cdefs.h>
 #include <sys/types.h>
 
 typedef void *vfs_handle_t;
@@ -50,6 +51,8 @@ struct vfs_fileinfo {
     size_t size;            ///< Size of the object (in bytes, for a regular file)
 };
 
+__BEGIN_DECLS
+
 // initialization
 void vfs_init(void);
 
@@ -80,4 +83,6 @@ errval_t vfs_closedir(vfs_handle_t dhandle);
 errval_t vfs_mount(const char *mountpoint, const char *uri);
 errval_t vfs_unmount(const char *mountpoint);
 
+__END_DECLS
+
 #endif
index f4b6eaa..316812e 100644 (file)
 #ifndef VFS_FD_H
 #define VFS_FD_H
 
+#include <sys/cdefs.h> /* for __BEGIN_DECLS, __END_DECLS */
 #include <sys/types.h> /* for off_t */
 
+__BEGIN_DECLS
+
 int   vfsfd_open(const char *pathname, int flags);
 int   vfsfd_read(int fd, void *buf, size_t len);
 int   vfsfd_write(int fd, const void *buf, size_t len);
 int   vfsfd_close(int fd);
 off_t vfsfd_lseek(int fd, off_t off, int whence);
 
+__END_DECLS
 
 #endif /* VFS_FD_H */
index 9ab46f4..a66b6e0 100644 (file)
 #ifndef VFS_PATH_H
 #define VFS_PATH_H
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+
 /// path separator used by the VFS
 #define VFS_PATH_SEP        '/'
 /// path separator used by the VFS, as a string constant
@@ -19,4 +23,6 @@ void vfs_path_normalise(char *path);
 char *vfs_path_mkabsolute(const char *cwd, const char *path);
 char *vfs_path_mkabs(const char *path);
 
+__END_DECLS
+
 #endif