Remove __BEGIN_DECLS and __END_DECLS.

This commit is contained in:
Jonas 'Sortie' Termansen 2015-05-13 18:11:02 +02:00
parent 5915e2cd14
commit a79aeed0c1
131 changed files with 795 additions and 280 deletions

View File

@ -41,7 +41,7 @@ struct dispd_framebuffer
};
#if defined(__cplusplus)
} // extern "C"
} /* extern "C" */
#endif
#endif

View File

@ -41,7 +41,7 @@ struct dispd_session
bool dispd__session_initialize(int* argc, char*** argv);
#if defined(__cplusplus)
} // extern "C"
} /* extern "C" */
#endif
#endif

View File

@ -37,7 +37,7 @@ struct dispd_window
};
#if defined(__cplusplus)
} // extern "C"
} /* extern "C" */
#endif
#endif

View File

@ -30,11 +30,15 @@
#include <sortix/__/dt.h>
#include <sortix/__/stat.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define __IFTODT(mode) (((mode) & __S_IFMT) >> __S_IFMT_SHIFT)
#define __DTTOIF(dirtype) ((dirtype) << __S_IFMT_SHIFT)
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,7 +27,9 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define __DT_UNKNOWN 0x0
#define __DT_FIFO 0x1
@ -39,6 +41,8 @@ __BEGIN_DECLS
#define __DT_SOCK 0xC
#define __DT_BITS 0xF
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,10 +27,14 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define __SIGSET_NUM_SIGNALS 128
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -30,11 +30,15 @@
#include <sortix/__/dt.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define __S_IFMT_SHIFT 12
#define __S_IFMT_MASK __DT_BITS
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -31,7 +31,9 @@
#include <__/stdint.h>
#include <__/wordsize.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
typedef __intmax_t __blkcnt_t;
/*#define __BLKCNT_UNSIGNED*/
@ -400,6 +402,8 @@ typedef __uint64_t __uid_t;
#define __SCNuUID __SCNu64
#define __SCNxUID __SCNx64
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,7 +27,9 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define __WNATURE_EXITED 0
#define __WNATURE_SIGNALED 1
@ -50,6 +52,8 @@ __BEGIN_DECLS
((exitcode) & 0xFF) << 8 | \
((signal) & 0x7F) << 0)
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,7 +27,9 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define CLOCK_REALTIME 0 /* Current real time. */
#define CLOCK_MONOTONIC 1 /* Always increasing time. */
@ -40,6 +42,8 @@ __BEGIN_DECLS
#define CLOCK_THREAD_CPUTIME_ID 8
#define CLOCK_THREAD_SYSTIME_ID 9
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -34,7 +34,9 @@
#include <sortix/__/dirent.h>
#include <sortix/__/dt.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dev_t_defined
#define __dev_t_defined
@ -87,6 +89,8 @@ static __inline struct kernel_dirent* kernel_dirent_next(struct kernel_dirent* e
return (struct kernel_dirent*) ((uint8_t*) ent + ent->d_nextoff);
}
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -30,7 +30,9 @@
#include <stddef.h>
#include <stdint.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
const uint32_t DISPMSG_CONTROL_VALID = 1 << 0;
const uint32_t DISPMSG_CONTROL_VGA = 1 << 1;
@ -163,6 +165,8 @@ struct dispmsg_read_memory
uint8_t* dst; // in, *out
};
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <sys/__/types.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __size_t_defined
#define __size_t_defined
@ -55,6 +57,8 @@ struct exit_thread
#define EXIT_THREAD_PROCESS (1<<4)
#define EXIT_THREAD_DUMP_CORE (1<<5)
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,7 +27,9 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
/* Remember to update the flag classifications at the top of descriptor.cpp if
you add new flags here. */
@ -114,6 +116,8 @@ __BEGIN_DECLS
#define AT_REMOVEFILE (1<<3)
#define AT_SYMLINK_FOLLOW (1<<4)
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -32,7 +32,9 @@
#include <sortix/sigset.h>
#include <sortix/stack.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
/* The sfork system call is much like the rfork system call found in Plan 9 and
BSD systems, however it works slightly differently and was renamed to avoid
@ -122,6 +124,8 @@ struct tfork
stack_t altstack;
};
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define INITRD_ALGO_CRC32 0
@ -97,6 +99,8 @@ typedef struct initrd_dirent
char name[0];
} initrd_dirent_t;
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <sortix/timespec.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
struct itimerspec
{
@ -37,6 +39,8 @@ struct itimerspec
struct timespec it_value;
};
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -55,7 +55,7 @@ unsigned long kthread_cond_wait_signal(kthread_cond_t* cond, kthread_mutex_t* mu
void kthread_cond_signal(kthread_cond_t* cond);
void kthread_cond_broadcast(kthread_cond_t* cond);
} // extern "C"
} /* extern "C" */
class ScopedLock
{

View File

@ -27,10 +27,14 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define HOST_NAME_MAX 255
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,12 +27,16 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define UNMOUNT_FORCE (1 << 0)
#define UNMOUNT_DETACH (1 << 1)
#define UNMOUNT_NOFOLLOW (1 << 2)
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,7 +27,9 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
typedef __SIZE_TYPE__ nfds_t;
@ -52,6 +54,8 @@ struct pollfd
#define POLL__ONLY_REVENTS (POLLERR | POLLHUP | POLLNVAL)
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <__/stdint.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define PRIO_PROCESS 0
#define PRIO_PGRP 1
@ -60,6 +62,8 @@ struct rlimit
#define RLIMIT_NUM_DECLARED __RLIMIT_NUM_DECLARED
#endif
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,12 +27,16 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define SEEK_SET 0 /* Seek from beginning of file. */
#define SEEK_CUR 1 /* Seek from current position. */
#define SEEK_END 2 /* Seek from end of file. */
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -30,7 +30,9 @@
#include <sortix/siginfo.h>
#include <sortix/sigset.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define SA_NOCLDSTOP (1<<0)
#define SA_ONSTACK (1<<1)
@ -58,6 +60,8 @@ struct sigaction
int sa_flags;
};
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -33,7 +33,9 @@
#include <sortix/sigval.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#if __STDC_HOSTED__
#ifndef __pthread_attr_t_defined
@ -59,6 +61,8 @@ struct sigevent
#endif
};
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -31,7 +31,9 @@
#include <sortix/sigval.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __pid_t_defined
#define __pid_t_defined
@ -91,6 +93,8 @@ typedef struct
#define SI_ASYNCIO 34
#define SI_MSGQ 35
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,7 +27,9 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define SIGHUP 1 /* Hangup */
#define SIGINT 2 /* Interrupt */
@ -72,6 +74,8 @@ __BEGIN_DECLS
#define SIG_DFL ((void (*)(int)) 0)
#define SIG_IGN ((void (*)(int)) 1)
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,12 +27,16 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define SIG_BLOCK 0
#define SIG_UNBLOCK 1
#define SIG_SETMASK 2
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,13 +29,17 @@
#include <sortix/__/sigset.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
unsigned long __val[__SIGSET_NUM_SIGNALS / (8 * sizeof(unsigned long int))];
} sigset_t;
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,7 +27,9 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
union sigval
{
@ -35,6 +37,8 @@ union sigval
void* sival_ptr;
};
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,7 +27,9 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
/* TODO: Nicely wrap this in an enum, as in glibc's header? */
#define SOCK_TYPE_MASK ((1<<20)-1)
@ -40,6 +42,8 @@ __BEGIN_DECLS
#define SOCK_CLOEXEC (1<<21)
#define SOCK_CLOFORK (1<<22)
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <sys/__/types.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __size_t_defined
#define __size_t_defined
@ -49,6 +51,8 @@ typedef struct
int ss_flags;
} stack_t;
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -36,7 +36,9 @@
#include <sortix/timespec.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
struct stat
{
@ -87,6 +89,8 @@ struct stat
#define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
#define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <sys/__/types.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dev_t_defined
#define __dev_t_defined
@ -64,6 +66,8 @@ struct statvfs
#define ST_RDONLY (1 << 0)
#define ST_NOSUID (1 << 1)
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <sys/__/types.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __size_t_defined
#define __size_t_defined
@ -51,6 +53,8 @@ struct winsize
size_t ws_ypixel;
};
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,10 +27,14 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define TIMER_ABSTIME (1<<0)
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <sys/__/types.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __time_t_defined
#define __time_t_defined
@ -42,6 +44,8 @@ struct timespec
long tv_nsec;
};
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <sortix/timespec.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
struct tmns
{
@ -39,6 +41,8 @@ struct tmns
struct timespec tmns_cstime;
};
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -30,7 +30,9 @@
#include <sortix/sigset.h>
#include <sortix/stack.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
/* Register declarations for i386 */
#if defined(__i386__)
@ -150,6 +152,8 @@ typedef struct ucontext
mcontext_t uc_mcontext;
} ucontext_t;
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <sys/__/types.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __size_t_defined
#define __size_t_defined
@ -43,6 +45,8 @@ struct iovec
size_t iov_len;
};
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,13 +27,17 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define R_OK 4 /* Test for read permission. */
#define W_OK 2 /* Test for write permission. */
#define X_OK 1 /* Test for execute permission. */
#define F_OK 0 /* Test for existence. */
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -35,7 +35,9 @@
#include <stddef.h>
#endif
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define UTHREAD_FLAG_INITIAL (1UL << 0UL)
@ -56,6 +58,8 @@ struct uthread
size_t __uthread_reserved[4];
};
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,7 +27,9 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define COLOR8_BLACK 0
#define COLOR8_BLUE 1
@ -46,6 +48,8 @@ __BEGIN_DECLS
#define COLOR8_LIGHT_BROWN 14
#define COLOR8_WHITE 15
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <sortix/__/wait.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define WCONTINUED (1<<0)
#define WNOHANG (1<<1)
@ -54,6 +56,8 @@ __BEGIN_DECLS
#define WCONSTRUCT(nature, exitcode, signal) \
__WCONSTRUCT(nature, exitcode, signal)
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -190,7 +190,7 @@ void* syscall_list[SYSCALL_MAX_NUM + 1] =
[SYSCALL_CLOSEFROM] = (void*) sys_closefrom,
[SYSCALL_MAX_NUM] = (void*) sys_bad_syscall,
};
} // extern "C"
} /* extern "C" */
int sys_bad_syscall(void)
{

View File

@ -152,7 +152,7 @@ struct tss_entry tss =
#endif
};
} // extern "C"
} /* extern "C" */
#define GRAN_64_BIT_MODE (1 << 5)
#define GRAN_32_BIT_MODE (1 << 6)
@ -230,7 +230,7 @@ struct gdt_entry gdt[] =
uint16_t gdt_size_minus_one = sizeof(gdt) - 1;
} // extern "C"
} /* extern "C" */
uintptr_t GetKernelStack()
{

View File

@ -31,7 +31,9 @@
#include <pthread.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __size_t_defined
#define __size_t_defined
@ -72,6 +74,8 @@ extern DIR* __first_dir;
extern __pthread_mutex_t __first_dir_lock;
#endif
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -31,7 +31,9 @@
#include <pthread.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __off_t_defined
#define __off_t_defined
@ -104,6 +106,8 @@ extern FILE* __first_file;
extern __pthread_mutex_t __first_file_lock;
#endif
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,13 +27,17 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
/* Use compiler builtins for efficient byte swapping. */
#define __bswap_16(x) __builtin_bswap16(x)
#define __bswap_32(x) __builtin_bswap32(x)
#define __bswap_64(x) __builtin_bswap64(x)
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <__/byteswap.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
/* The compiler provides the type constants. */
#define __LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
@ -81,7 +83,9 @@ __BEGIN_DECLS
#endif
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
/* Sortix specific extensions only available in C++. */
#if defined(__cplusplus)

View File

@ -29,7 +29,9 @@
#include <__/wordsize.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
/* TODO: Make the compiler provide all this information using __ prefix. */
/* TODO: Use __XINTXX_TYPE__ constants when switching to gcc 4.7.x or newer. */
@ -500,6 +502,8 @@ typedef long long unsigned int __uintmax_t;
/* TODO: Should these come from a <__stddef.h>? */
#define __SIZE_MAX __SIZE_MAX__
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,7 +27,9 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
typedef __WCHAR_TYPE__ __wchar_t;
#define __WCHAR_MIN __WCHAR_MIN__
@ -39,6 +41,8 @@ typedef __WINT_TYPE__ __wint_t;
#define __WEOF __WINT_MAX
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <sys/__/types.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __size_t_defined
#define __size_t_defined
@ -52,6 +54,8 @@ void* alloca(size_t);
error if -fno-builtin is passed. */
#define alloca(size) __builtin_alloca(size)
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,7 +27,9 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
/* Archive files start with the ARMAG identifying string. Then follows a
`struct ar_hdr', and as many bytes of member file data as its `ar_size'
@ -53,6 +55,8 @@ struct ar_hdr
char ar_fmag[2]; /* Always contains ARFMAG. */
};
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,8 +29,12 @@
#include <errno.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <netinet/in.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
/* Functions from POSIX that is considered obsolete due to bad design. */
#if __USE_POSIX
@ -49,6 +51,8 @@ int inet_pton(int, const char* __restrict, void* __restrict);
/* TODO: char* inet_neta(in_addr_t, char*, size_t); */
#endif
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,7 +27,9 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
/* Determine how the value should be cast to void. */
#if defined __cplusplus
@ -45,7 +47,9 @@ __BEGIN_DECLS
__attribute__((noreturn))
void __assert(const char*, unsigned long, const char*, const char*);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,13 +29,17 @@
#include <__/byteswap.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
/* Easy byte swapping of integers. */
#define bswap_16(x) __bswap_16(x)
#define bswap_32(x) __bswap_32(x)
#define bswap_64(x) __bswap_64(x)
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,7 +27,9 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __locale_t_defined
#define __locale_t_defined
@ -68,6 +70,8 @@ int tolower(int c);
int toupper(int c);
/* TODO: toupper_l */
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -35,7 +35,9 @@
#include <DIR.h>
#endif
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dev_t_defined
#define __dev_t_defined
@ -130,6 +132,8 @@ void dunregister(DIR* dir);
int versionsort_r(const struct dirent**, const struct dirent**, void*);
#endif
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,7 +27,9 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define RTLD_LAZY (1<<0)
#define RTLD_NOW (1<<1)
@ -39,6 +41,8 @@ char* dlerror();
void* dlopen(const char* filename, int mode);
void* dlsym(void* handle, const char* name);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <stdint.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
/* Standard ELF types. */
@ -3086,6 +3088,8 @@ typedef Elf32_Addr Elf32_Conflict;
#define R_TILEGX_NUM 130
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <__/endian.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
/* Constans for each kind of known endian. */
#define LITTLE_ENDIAN __LITTLE_ENDIAN
@ -57,7 +59,9 @@ __BEGIN_DECLS
#define be64toh(x) __be64toh(x)
#define le64toh(x) __le64toh(x)
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
/* Sortix specific extensions only available in C++. */
#if defined(__cplusplus)

View File

@ -27,7 +27,9 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define ENOTBLK 12
#define ENODEV 13
@ -145,6 +147,8 @@ extern char* program_invocation_short_name;
#define program_invocation_name program_invocation_name
#define program_invocation_short_name program_invocation_short_name
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,13 +27,17 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
void gnu_error(int status, int errnum, const char* format, ...)
__attribute__((__format__(__printf__, 3, 4)));
void error(int status, int errnum, const char* format, ...) __asm__ ("gnu_error")
__attribute__((__format__(__printf__, 3, 4)));
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -34,7 +34,9 @@
#include <sortix/fcntl.h>
#include <sortix/seek.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
/* The kernel would like to simply deal with one bit for each base access mode,
but using the traditional names O_RDONLY, O_WRONLY and O_RDWR for this would
@ -59,6 +61,8 @@ int fcntl(int fd, int cmd, ...);
int open(const char* path, int oflag, ...);
int openat(int fd, const char* path, int oflag, ...);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,7 +27,9 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define FNM_NOMATCH 1
@ -37,6 +39,8 @@ __BEGIN_DECLS
int fnmatch(const char*, const char*, int);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -34,7 +34,9 @@
#include <sortix/termios.h>
#include <sortix/timespec.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define FSM_MOUNT_CLOEXEC (1 << 0)
#define FSM_MOUNT_CLOFORK (1 << 1)
@ -433,6 +435,8 @@ struct fsm_resp_tcgetwincurpos
#define FSM_MSG_NUM 53
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,13 +29,17 @@
#include <fsmarshall-msg.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
struct stat;
int fsm_fsbind(int, int, int);
int fsm_mountat(int, const char*, const struct stat*, int);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,7 +27,9 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
/* These declarations are repeated in <unistd.h>. */
#ifndef __getopt_unistd_shared_declared
@ -54,6 +56,8 @@ struct option
int getopt_long(int, char* const*, const char*, const struct option*, int*);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <sys/__/types.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __FILE_defined
#define __FILE_defined
@ -74,6 +76,8 @@ int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);
FILE* opengr(void);
void setgrent(void);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -203,7 +203,9 @@
#endif
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __wchar_t_defined
#define __wchar_t_defined
@ -224,6 +226,8 @@ uintmax_t strtoumax(const char* __restrict, char** __restrict, int);
intmax_t wcstoimax(const wchar_t* __restrict, wchar_t** __restrict, int);
uintmax_t wcstoumax(const wchar_t* __restrict, wchar_t** __restrict, int);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -32,7 +32,9 @@
#include <sys/__/types.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __off_t_defined
#define __off_t_defined
@ -54,6 +56,8 @@ size_t readleast(int fd, void* buf, size_t least, size_t max);
size_t writeall(int fd, const void* buf, size_t count);
size_t writeleast(int fd, const void* buf, size_t least, size_t max);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,11 +27,15 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
char* dirname(char* path);
char* basename(char* path);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <sys/__/types.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
struct lconv
{
@ -76,6 +78,8 @@ char* setlocale(int category, const char* locale);
#endif
struct lconv* localeconv(void);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -41,7 +41,9 @@
#include <stdint.h>
#endif
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
int heap_get_paranoia(void);
/* TODO: Operations to verify pointers and consistency check the heap. */
@ -632,7 +634,9 @@ struct heap_chunk* heap_chunk_combine_neighbors(struct heap_chunk* chunk)
#endif
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#if __is_sortix_libc
#include <assert.h>

View File

@ -32,7 +32,9 @@
#if defined(__i386__) || defined(__x86_64__)
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define MSRID_FSBASE __UINT32_C(0xC0000100)
#define MSRID_GSBASE __UINT32_C(0xC0000101)
@ -90,7 +92,9 @@ static __inline void wrmsr_split(uint32_t msrid, uint32_t low, uint32_t high)
wrmsr(msrid, (uint64_t) low << 0 | (uint64_t) high << 32);
}
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -31,7 +31,9 @@
#include <inttypes.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __in_port_t_defined
#define __in_port_t_defined
@ -144,6 +146,8 @@ void setnetent(int);
void setprotoent(int);
void setservent(int);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -32,7 +32,9 @@
#include <inttypes.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __in_port_t_defined
#define __in_port_t_defined
@ -140,6 +142,8 @@ IN6_IS_ADDR_MC_GLOBAL
&& (((__const uint32_t *) (a))[2] == ((__const uint32_t *) (b))[2]) \
&& (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3]))
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,11 +27,15 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
/* Options at the IPPROTO_TCP socket level. */
#define TCP_NODELAY 1
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,23 +29,31 @@
#include <sys/__/types.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __time_t_defined
#define __time_t_defined
typedef __time_t time_t;
#endif
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#include <sortix/poll.h>
#include <sortix/sigset.h>
#include <sortix/timespec.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
int poll(struct pollfd* fds, nfds_t nfds, int timeout);
int ppoll(struct pollfd* fds, nfds_t nfds, const struct timespec* timeout,
const sigset_t* sigmask);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <sys/__/types.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __FILE_defined
#define __FILE_defined
@ -83,6 +85,8 @@ int getpwuid_r(uid_t, struct passwd* __restrict, char* __restrict, size_t,
FILE* openpw(void);
void setpwent(void);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,10 +27,14 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
int sched_yield(void);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <sortix/__/sigset.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__x86_64__)
typedef unsigned long sigjmp_buf[8 + 1 + __SIGSET_NUM_SIGNALS / (sizeof(unsigned long int) * 8)];
@ -46,6 +48,8 @@ int setjmp(jmp_buf);
void siglongjmp(sigjmp_buf, int);
int sigsetjmp(sigjmp_buf, int);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -45,7 +45,9 @@
#include <sortix/timespec.h>
#include <sortix/ucontext.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __uid_t_defined
#define __uid_t_defined
@ -112,6 +114,8 @@ int sigsuspend(const sigset_t*);
/* TODO: int sigwait(const sigset_t* __restrict, int* __restrict); */
/* TODO: int sigwaitinfo(const sigset_t* __restrict, siginfo_t* __restrict); */
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -30,7 +30,9 @@
#include <__/stdint.h>
#include <__/wchar.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
/* Only define these constant macros in C++ if requested. */
#if __USE_SORTIX || defined(__STDC_CONSTANT_MACROS) || !defined(__cplusplus)
@ -168,6 +170,8 @@ typedef __uintptr_t uintptr_t;
typedef __intmax_t intmax_t;
typedef __uintmax_t uintmax_t;
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -44,7 +44,9 @@
#include <FILE.h>
#endif
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#if __USE_SORTIX || 2008 <= __USE_POSIX
#ifndef __off_t_defined
@ -317,6 +319,8 @@ int vscanf_callback(void* fp,
__attribute__((__format__ (scanf, 4, 0)));
#endif
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <stdio.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
size_t __fbufsize(FILE* fp);
size_t __fpending(FILE* fp);
@ -40,6 +42,8 @@ void __fseterr(FILE* fp);
int __fwritable(FILE* fp);
int __fwriting(FILE* fp);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -35,7 +35,9 @@
#include <sortix/wait.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#define EXIT_SUCCESS (0)
#define EXIT_FAILURE (1)
@ -181,6 +183,8 @@ uint32_t arc4random_uniform(uint32_t);
void* reallocarray(void*, size_t, size_t);
#endif
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <sys/__/types.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef NULL
#define __need_NULL
@ -169,6 +171,8 @@ const char* sortix_strsignal(int signum);
}))
#endif
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -37,15 +37,6 @@
string that contains the warning. */
#define __PRAGMA_WARNING(msg) _Pragma(__STRINGIFY(GCC warning msg))
/* C++ needs to know that types and declarations are C, not C++. */
#ifdef __cplusplus
#define __BEGIN_DECLS extern "C" {
#define __END_DECLS }
#else
#define __BEGIN_DECLS
#define __END_DECLS
#endif
/* Use the real restrict keyword if it is available. Not that this really
matters as gcc uses __restrict and __restrict__ as aliases for restrict, but
it will look nicer after preprocessing. */

View File

@ -31,10 +31,14 @@
#include <stdint.h>
#include <sortix/display.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
int dispmsg_issue(void* ptr, size_t size);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -27,10 +27,14 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
int ioctl(int fd, int request, ...);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,7 +29,9 @@
#include <sys/__/types.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __size_t_defined
#define __size_t_defined
@ -44,6 +46,8 @@ typedef __ssize_t ssize_t;
ssize_t kernelinfo(const char* req, char* resp, size_t resplen);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -31,7 +31,9 @@
#include <sortix/mman.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __mode_t_defined
#define __mode_t_defined
@ -53,6 +55,8 @@ void* mmap(void*, size_t, int, int, int, off_t);
int mprotect(const void*, size_t, int);
int munmap(void*, size_t);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -29,11 +29,15 @@
#include <sortix/mount.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
int unmount(const char*, int);
int unmountat(int, const char*, int);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -34,7 +34,9 @@
#include <stdint.h>
#include <sortix/dirent.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __size_t_defined
#define __size_t_defined
@ -44,6 +46,8 @@ __BEGIN_DECLS
ssize_t readdirents(int fd, struct kernel_dirent* dirent, size_t size);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -31,7 +31,9 @@
#include <sortix/resource.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __id_t_defined
#define __id_t_defined
@ -78,6 +80,8 @@ int prlimit(pid_t, int, const struct rlimit*, struct rlimit*);
int setpriority(int, id_t, int);
int setrlimit(int, const struct rlimit*);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -32,7 +32,9 @@
#include <string.h> /* TODO: HACK: for FD_ZERO */
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __time_t_defined
#define __time_t_defined
@ -53,10 +55,14 @@ struct timeval
};
#endif
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#include <sortix/sigset.h>
#include <sortix/timespec.h>
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#define FD_SETSIZE 1024
#define __FD_ELEM_SIZE ((int) sizeof(__fd_mask))
@ -81,6 +87,8 @@ typedef struct
int select(int, fd_set* __restrict, fd_set* __restrict, fd_set* __restrict,
struct timeval* __restrict);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

View File

@ -31,7 +31,9 @@
#include <sortix/socket.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __socklen_t_defined
#define __socklen_t_defined
@ -54,11 +56,15 @@ typedef __ssize_t ssize_t;
typedef unsigned short int sa_family_t;
#endif
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#include <sortix/uio.h>
__BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif
struct sockaddr
{
@ -181,6 +187,8 @@ int sockatmark(int);
int socket(int, int, int);
int socketpair(int, int, int, int[2]);
__END_DECLS
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif

Some files were not shown because too many files have changed in this diff Show More