_MINIX_SYSTEM - fixes for in-minix crossbuild

. define _MINIX_SYSTEM for all system code from minix.service.mk
	. hide some system-level declarations and definitions
	  behind _MINIX_SYSTEM to cleanly fix host tool build problems on
	  Minix (such as: NONE being defined and paddr_t being used but not
	  declared)
	. the similar definition _SYSTEM is unsuitable as it changes the
	  values of errno definitions

Change-Id: I407de79e2575115243a074b16e79546a279cfa3e
This commit is contained in:
Ben Gras 2014-03-05 12:21:55 +01:00 committed by Lionel Sambuc
parent aa6ee31737
commit 3f38115c7b
38 changed files with 63 additions and 13 deletions

View file

@ -39,6 +39,8 @@
* user space and converted into a concatenated argument list). * user space and converted into a concatenated argument list).
*/ */
#define _MINIX_SYSTEM 1
#include <minix/config.h> #include <minix/config.h>
#include <minix/endpoint.h> #include <minix/endpoint.h>
#include <minix/paths.h> #include <minix/paths.h>

View file

@ -1,4 +1,6 @@
#define _MINIX_SYSTEM 1
#include <stdarg.h> #include <stdarg.h>
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>

View file

@ -1,3 +1,5 @@
#define _MINIX_SYSTEM 1
#include <sys/svrctl.h> #include <sys/svrctl.h>
#include <sys/types.h> #include <sys/types.h>
#include <ctype.h> #include <ctype.h>

View file

@ -3,6 +3,8 @@
#ifndef _MINIX_DS_H #ifndef _MINIX_DS_H
#define _MINIX_DS_H #define _MINIX_DS_H
#ifdef _MINIX_SYSTEM
#include <sys/types.h> #include <sys/types.h>
#include <minix/endpoint.h> #include <minix/endpoint.h>
@ -66,5 +68,7 @@ int ds_delete_label(const char *ds_name);
int ds_subscribe(const char *regex, int flags); int ds_subscribe(const char *regex, int flags);
int ds_check(char *ds_name, int *type, endpoint_t *owner_e); int ds_check(char *ds_name, int *type, endpoint_t *owner_e);
#endif /* _MINIX_SYSTEM */
#endif /* _MINIX_DS_H */ #endif /* _MINIX_DS_H */

View file

@ -2,6 +2,8 @@
#ifndef _MINIX_ENDPOINT_H #ifndef _MINIX_ENDPOINT_H
#define _MINIX_ENDPOINT_H 1 #define _MINIX_ENDPOINT_H 1
#ifdef _MINIX_SYSTEM
#include <minix/sys_config.h> #include <minix/sys_config.h>
#include <minix/com.h> #include <minix/com.h>
#include <limits.h> #include <limits.h>
@ -68,4 +70,6 @@
#define _ENDPOINT_P(e) \ #define _ENDPOINT_P(e) \
((((e)+MAX_NR_TASKS) & (_ENDPOINT_GENERATION_SIZE - 1)) - MAX_NR_TASKS) ((((e)+MAX_NR_TASKS) & (_ENDPOINT_GENERATION_SIZE - 1)) - MAX_NR_TASKS)
#endif /* _MINIX_SYSTEM */
#endif #endif

View file

@ -8,6 +8,7 @@
/* Number of processes contained in the system image. */ /* Number of processes contained in the system image. */
#define NR_BOOT_PROCS (NR_TASKS + LAST_SPECIAL_PROC_NR + 1) #define NR_BOOT_PROCS (NR_TASKS + LAST_SPECIAL_PROC_NR + 1)
#ifdef _MINIX_SYSTEM
/* This is used to obtain system information through SYS_GETINFO. */ /* This is used to obtain system information through SYS_GETINFO. */
#define MAXMEMMAP 40 #define MAXMEMMAP 40
typedef struct kinfo { typedef struct kinfo {
@ -44,5 +45,6 @@ typedef struct kinfo {
int kernel_allocated_bytes; /* used by kernel */ int kernel_allocated_bytes; /* used by kernel */
int kernel_allocated_bytes_dynamic; /* used by kernel (runtime) */ int kernel_allocated_bytes_dynamic; /* used by kernel (runtime) */
} kinfo_t; } kinfo_t;
#endif /* _MINIX_SYSTEM */
#endif #endif

View file

@ -1,6 +1,7 @@
# Makefile for the common audio framework # Makefile for the common audio framework
NOGCCERROR=yes NOGCCERROR=yes
NOCLANGERROR=yes NOCLANGERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM
LIB= audiodriver LIB= audiodriver
SRCS= audio_fw.c liveupdate.c SRCS= audio_fw.c liveupdate.c

View file

@ -1,5 +1,6 @@
NOGCCERROR=yes NOGCCERROR=yes
NOCLANGERROR=yes NOCLANGERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM
# Makefile for libbdev # Makefile for libbdev
.include <bsd.own.mk> .include <bsd.own.mk>

View file

@ -1,5 +1,6 @@
NOGCCERROR=yes NOGCCERROR=yes
NOCLANGERROR=yes NOCLANGERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM
# Makefile for libblockdriver # Makefile for libblockdriver
.include <bsd.own.mk> .include <bsd.own.mk>

View file

@ -1,4 +1,5 @@
#define _SYSTEM 1 #define _SYSTEM 1
#define _MINIX_SYSTEM 1
#include <sys/cdefs.h> #include <sys/cdefs.h>

View file

@ -1,4 +1,5 @@
#define _SYSTEM 1 #define _SYSTEM 1
#define _MINIX_SYSTEM 1
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include "namespace.h" #include "namespace.h"
#include <lib.h> #include <lib.h>

View file

@ -1,5 +1,6 @@
#define __USE_MISC #define __USE_MISC
#define _SYSTEM 1 #define _SYSTEM 1
#define _MINIX_SYSTEM 1
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <lib.h> #include <lib.h>

View file

@ -1,4 +1,5 @@
#define _SYSTEM 1 #define _SYSTEM 1
#define _MINIX_SYSTEM 1
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <lib.h> #include <lib.h>

View file

@ -1,4 +1,5 @@
#define _SYSTEM 1 #define _SYSTEM 1
#define _MINIX_SYSTEM 1
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <lib.h> #include <lib.h>

View file

@ -3,6 +3,8 @@
* Author: Lionel A. Sambuc. * Author: Lionel A. Sambuc.
*/ */
#define _MINIX_SYSTEM
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include "namespace.h" #include "namespace.h"
#include <lib.h> #include <lib.h>

View file

@ -1,5 +1,6 @@
NOGCCERROR=yes NOGCCERROR=yes
NOCLANGERROR=yes NOCLANGERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM
# Makefile for libchardriver # Makefile for libchardriver
.include <bsd.own.mk> .include <bsd.own.mk>

View file

@ -3,7 +3,7 @@ NOCLANGERROR=yes
# #
# Makefile for libclkconf # Makefile for libclkconf
CPPFLAGS+= -D_SYSTEM CPPFLAGS+= -D_SYSTEM -D_MINIX_SYSTEM
LIB= clkconf LIB= clkconf

View file

@ -7,7 +7,7 @@ VPATH = $(SRC_DIR)
SRCS = pci.c printf.c mem.c pgtab.c dde.c initcall.c thread.c condvar.c lock.c semaphore.c timer.c panic.c irq.c resource.c msg_queue.c SRCS = pci.c printf.c mem.c pgtab.c dde.c initcall.c thread.c condvar.c lock.c semaphore.c timer.c panic.c irq.c resource.c msg_queue.c
CFLAGS += -D_NETBSD_SOURCE CPPFLAGS += -D_NETBSD_SOURCE -D_MINIX_SYSTEM
.include <bsd.lib.mk> .include <bsd.lib.mk>

View file

@ -1,6 +1,6 @@
# Makefile for libgpio # Makefile for libgpio
CPPFLAGS+= -D_SYSTEM CPPFLAGS+= -D_SYSTEM -D_MINIX_SYSTEM
LIB= gpio LIB= gpio

View file

@ -1,6 +1,8 @@
NOGCCERROR=yes NOGCCERROR=yes
NOCLANGERROR=yes NOCLANGERROR=yes
CPPFLAGS+=-D_MINIX_SYSTEM
# Makefile for libi2cdriver # Makefile for libi2cdriver
LIB= i2cdriver LIB= i2cdriver

View file

@ -1,5 +1,6 @@
# Makefile for libinputdriver # Makefile for libinputdriver
.include <bsd.own.mk> .include <bsd.own.mk>
CPPFLAGS+= -D_MINIX_SYSTEM
LIB= inputdriver LIB= inputdriver

View file

@ -1,5 +1,6 @@
NOGCCERROR=yes NOGCCERROR=yes
NOCLANGERROR=yes NOCLANGERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM
# Makefile for libminixfs # Makefile for libminixfs
.include <bsd.own.mk> .include <bsd.own.mk>

View file

@ -1,5 +1,6 @@
NOGCCERROR=yes NOGCCERROR=yes
NOCLANGERROR=yes NOCLANGERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM
# Makefile for libnetdriver # Makefile for libnetdriver

View file

@ -1,5 +1,6 @@
NOGCCERROR=yes NOGCCERROR=yes
NOCLANGERROR=yes NOCLANGERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM
LIB = netsock LIB = netsock

View file

@ -23,6 +23,7 @@ SRCS+= inode.c link.c misc.c mount.c open.c path.c path_puffs.c \
protect.c read.c stadir.c time.c utility.c table.c protect.c read.c stadir.c time.c utility.c table.c
CPFFLAGS+=-Dlchown=chown -Dlchmod=chmod CPFFLAGS+=-Dlchown=chown -Dlchmod=chmod
CPPFLAGS+= -D_MINIX_SYSTEM
NOGCCERROR=yes NOGCCERROR=yes
NOCLANGERROR=yes NOCLANGERROR=yes

View file

@ -1,5 +1,6 @@
NOGCCERROR=yes NOGCCERROR=yes
NOCLANGERROR=yes NOCLANGERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM
# Makefile for libsffs # Makefile for libsffs
.include <bsd.own.mk> .include <bsd.own.mk>

View file

@ -4,6 +4,8 @@ NOCLANGERROR=yes
# Makefile for libsys # Makefile for libsys
.include <bsd.own.mk> .include <bsd.own.mk>
CPPFLAGS+= -D_MINIX_SYSTEM -D_SYSTEM
LIB= sys LIB= sys
CFLAGS+= -fno-builtin CFLAGS+= -fno-builtin

View file

@ -1,4 +1,3 @@
#define _SYSTEM 1
#include <minix/config.h> #include <minix/config.h>
#include <assert.h> #include <assert.h>

View file

@ -1,7 +1,5 @@
/* syslib.h - System library common definitions. */ /* syslib.h - System library common definitions. */
#define _SYSTEM
#include <lib.h> #include <lib.h>
#include <minix/com.h> #include <minix/com.h>
#include <minix/syslib.h> #include <minix/syslib.h>

View file

@ -1,5 +1,6 @@
NOGCCERROR=yes NOGCCERROR=yes
NOCLANGERROR=yes NOCLANGERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM
# Makefile for libvirtio # Makefile for libvirtio
.include <bsd.own.mk> .include <bsd.own.mk>

View file

@ -1,5 +1,6 @@
NOGCCERROR=yes NOGCCERROR=yes
NOCLANGERROR=yes NOCLANGERROR=yes
CPPFLAGS+= -D_MINIX_SYSTEM
# Makefile for libvtreefs # Makefile for libvtreefs

View file

@ -35,4 +35,7 @@ LDFLAGS+= ${${ACTIVE_CC} == "gcc":? -lgcc_eh:}
.endif # ${MACHINE_ARCH} == "earm" .endif # ${MACHINE_ARCH} == "earm"
# Get (more) internal minix definitions and declarations.
CPPFLAGS += -D_MINIX_SYSTEM=1
.include <bsd.prog.mk> .include <bsd.prog.mk>

View file

@ -43,9 +43,12 @@
#define MULTIBOOT_HEADER_HAS_VBE 0x00000004 #define MULTIBOOT_HEADER_HAS_VBE 0x00000004
#define MULTIBOOT_HEADER_HAS_ADDR 0x00010000 #define MULTIBOOT_HEADER_HAS_ADDR 0x00010000
#if defined(__minix) && !defined(__ASSEMBLY__) #if defined(__minix) && !defined(__ASSEMBLY__) && (defined(_MINIX_SYSTEM) || defined(_STANDALONE))
#if !defined(_LOCORE) #if !defined(_LOCORE)
#include <machine/types.h>
struct multiboot_header { struct multiboot_header {
uint32_t mh_magic; uint32_t mh_magic;
uint32_t mh_flags; uint32_t mh_flags;
@ -73,7 +76,7 @@ struct multiboot_header {
extern struct multiboot_header *Multiboot_Header; extern struct multiboot_header *Multiboot_Header;
#endif /* !defined(_LOCORE) && defined(_KERNEL) */ #endif /* !defined(_LOCORE) && defined(_KERNEL) */
#endif /* defined(__minix) && !defined(__ASSEMBLY__) */ #endif /* defined(__minix) && !defined(__ASSEMBLY__) && (defined(_MINIX_SYSTEM) || defined(_STANDALONE))*/
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
@ -94,7 +97,7 @@ extern struct multiboot_header *Multiboot_Header;
#define MULTIBOOT_INFO_HAS_APM_TABLE 0x00000400 #define MULTIBOOT_INFO_HAS_APM_TABLE 0x00000400
#define MULTIBOOT_INFO_HAS_VBE 0x00000800 #define MULTIBOOT_INFO_HAS_VBE 0x00000800
#if defined(__minix) && !defined(__ASSEMBLY__) #if defined(__minix) && !defined(__ASSEMBLY__) && (defined(_MINIX_SYSTEM) || defined(_STANDALONE))
#if !defined(_LOCORE) #if !defined(_LOCORE)
struct multiboot_info { struct multiboot_info {
@ -197,7 +200,7 @@ struct multiboot_module {
#endif /* !defined(_LOCORE) */ #endif /* !defined(_LOCORE) */
#endif /* defined(__minix) && !defined(__ASSEMBLY__) */ #endif /* defined(__minix) && !defined(__ASSEMBLY__) && (defined(_MINIX_SYSTEM) || defined(_STANDALONE))*/
#if defined(__minix) #if defined(__minix)
@ -240,4 +243,4 @@ bool multiboot_ksyms_addsyms_elf(void);
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
#endif /* _MACHINE_MULTIBOOT_H */ #endif /* _MACHINE_MULTIBOOT_H */

View file

@ -200,14 +200,14 @@ void * mremap(void *, size_t, void *, size_t, int);
#endif #endif
int posix_madvise(void *, size_t, int); int posix_madvise(void *, size_t, int);
#if defined(__minix) #if defined(__minix) && defined(_MINIX_SYSTEM)
#include <minix/endpoint.h> #include <minix/endpoint.h>
void * vm_remap(endpoint_t d, endpoint_t s, void *da, void *sa, size_t si); void * vm_remap(endpoint_t d, endpoint_t s, void *da, void *sa, size_t si);
void * vm_remap_ro(endpoint_t d, endpoint_t s, void *da, void *sa, size_t si); void * vm_remap_ro(endpoint_t d, endpoint_t s, void *da, void *sa, size_t si);
int vm_unmap(endpoint_t endpt, void *addr); int vm_unmap(endpoint_t endpt, void *addr);
unsigned long vm_getphys(endpoint_t endpt, void *addr); unsigned long vm_getphys(endpoint_t endpt, void *addr);
u8_t vm_getrefcount(endpoint_t endpt, void *addr); u8_t vm_getrefcount(endpoint_t endpt, void *addr);
#endif /* defined(__minix) */ #endif /* defined(__minix) && defined(_MINIX_SYSTEM) */
__END_DECLS __END_DECLS

View file

@ -1,4 +1,6 @@
#define _MINIX_SYSTEM
#include <stdio.h> #include <stdio.h>
#include <minix/endpoint.h> #include <minix/endpoint.h>
#include <minix/sys_config.h> #include <minix/sys_config.h>

View file

@ -3,6 +3,8 @@
* Exercise the caching functionality of libminixfs in isolation. * Exercise the caching functionality of libminixfs in isolation.
*/ */
#define _MINIX_SYSTEM
#include <minix/libminixfs.h> #include <minix/libminixfs.h>
#include <minix/sysutil.h> #include <minix/sysutil.h>
#include <minix/syslib.h> #include <minix/syslib.h>

View file

@ -4,6 +4,8 @@
* in testvm.c, started as a service by this test program. * in testvm.c, started as a service by this test program.
*/ */
#define _MINIX_SYSTEM 1
#include <minix/libminixfs.h> #include <minix/libminixfs.h>
#include <minix/sysutil.h> #include <minix/sysutil.h>
#include <minix/syslib.h> #include <minix/syslib.h>

View file

@ -2,6 +2,8 @@
/* Author: Ben Gras <beng@few.vu.nl> 17 march 2006 */ /* Author: Ben Gras <beng@few.vu.nl> 17 march 2006 */
/* Modified for ProcFS by Alen Stojanov and David van Moolenbroek */ /* Modified for ProcFS by Alen Stojanov and David van Moolenbroek */
#define _MINIX_SYSTEM 1
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <pwd.h> #include <pwd.h>