fix a few more minix specific warnings

. also disable stack protection feature for gcc,
	  causes build errors for pkgsrc gcc on minix

Change-Id: I1c6e2bcb4d948098d642543d7b2711284ee55c72
This commit is contained in:
Ben Gras 2013-08-26 16:43:05 +00:00
parent 60a61dffae
commit c8f3b10909
48 changed files with 162 additions and 84 deletions

View file

@ -4,7 +4,7 @@
.include <bsd.own.mk> .include <bsd.own.mk>
.if defined(__MINIX) .if defined(__MINIX)
WARNS=3 WARNS=2
.endif .endif
PROG= pax PROG= pax

View file

@ -246,6 +246,7 @@ typedef struct oplist {
#ifdef HOSTPROG #ifdef HOSTPROG
# include "pack_dev.h" /* explicitly use NetBSD's macros */ # include "pack_dev.h" /* explicitly use NetBSD's macros */
# define MAJOR(x) major_netbsd(x) # define MAJOR(x) major_netbsd(x)
# define MINOR(x) minor_netbsd(x) # define MINOR(x) minor_netbsd(x)
# define TODEV(x, y) makedev_netbsd((x), (y)) # define TODEV(x, y) makedev_netbsd((x), (y))

View file

@ -42,7 +42,7 @@
#define OMAP_UART_FCR_RX_FIFO_TRIG_SHIFT 6 #define OMAP_UART_FCR_RX_FIFO_TRIG_SHIFT 6
#define OMAP_UART_FCR_RX_FIFO_TRIG_MASK (0x3 << 6) #define OMAP_UART_FCR_RX_FIFO_TRIG_MASK (0x3 << 6)
#define OMAP_UART_FCR_TX_FIFO_TRIG_SHIFT 4 #define OMAP_UART_FCR_TX_FIFO_TRIG_SHIFT 4
#define OMAP_UART_FCR_RX_FIFO_TRIG_MASK (0x3 << 4) #define OMAP_UART_FCR_TX_FIFO_TRIG_MASK (0x3 << 4)
#define UART_FCR_ENABLE_FIFO 0x01 /* Enable the fifo */ #define UART_FCR_ENABLE_FIFO 0x01 /* Enable the fifo */
#define UART_FCR_CLR_RCVR 0x02 /* Clear the RCVR FIFO */ #define UART_FCR_CLR_RCVR 0x02 /* Clear the RCVR FIFO */
#define UART_FCR_CLR_XMIT 0x04 /* Clear the XMIT FIFO */ #define UART_FCR_CLR_XMIT 0x04 /* Clear the XMIT FIFO */

View file

@ -2,6 +2,8 @@
LIBISPRIVATE= yes LIBISPRIVATE= yes
WARNS=
LIB= mdoc LIB= mdoc
SRCS= mdoc_macro.c mdoc.c mdoc_hash.c mdoc_strings.c \ SRCS= mdoc_macro.c mdoc.c mdoc_hash.c mdoc_strings.c \
mdoc_argv.c mdoc_validate.c lib.c att.c \ mdoc_argv.c mdoc_validate.c lib.c att.c \

View file

@ -10,6 +10,11 @@ LDADD= -lgcc_s
LIBDPLIBS+= m ${.CURDIR}/../../../../../lib/libm LIBDPLIBS+= m ${.CURDIR}/../../../../../lib/libm
.if defined(__MINIX)
NOGCCERROR=yes
NOCLANGERROR=yes
.endif
UNSUPPORTED_COMPILER.clang= # defined UNSUPPORTED_COMPILER.clang= # defined
CWARNFLAGS.clang+= -Wno-logical-op-parentheses \ CWARNFLAGS.clang+= -Wno-logical-op-parentheses \
-Wno-deprecated-writable-strings -Wno-parentheses -Wno-deprecated-writable-strings -Wno-parentheses

View file

@ -5,7 +5,14 @@ NOLINT= # defined
NOPIC= # defined NOPIC= # defined
NOPROFILE= # defined NOPROFILE= # defined
.if defined(__MINIX)
WARNS=
NOGCCERROR=yes
NOCLANGERROR=yes
.else
CWARNFLAGS.clang+= -Wno-parentheses CWARNFLAGS.clang+= -Wno-parentheses
.endif
UNSUPPORTED_COMPILER.clang= # defined UNSUPPORTED_COMPILER.clang= # defined
.include <bsd.own.mk> .include <bsd.own.mk>

View file

@ -2,6 +2,11 @@
LIBISPRIVATE= yes LIBISPRIVATE= yes
.if defined(__MINIX)
NOGCCERROR=yes
NOCLANGERROR=yes
.endif
LIB= cpp LIB= cpp
SRCS= ${G_libcpp_a_OBJS:.o=.c} SRCS= ${G_libcpp_a_OBJS:.o=.c}

View file

@ -24,7 +24,11 @@ INCS+= base.h bcj.h block.h check.h container.h delta.h \
INCSDIR= /usr/include/lzma INCSDIR= /usr/include/lzma
LDFLAGS+= -Wl,-z,defs LDFLAGS+= -Wl,-z,defs
.if defined(__MINIX)
LDFLAGS+= -lc
.endif
CPPFLAGS+= -I${XZSRCDIR}/src/liblzma/check CPPFLAGS+= -I${XZSRCDIR}/src/liblzma/check
CPPFLAGS+= -I${XZSRCDIR}/src/liblzma/common CPPFLAGS+= -I${XZSRCDIR}/src/liblzma/common

View file

@ -10,7 +10,7 @@ struct gpio
#define GPIO_MODE_INPUT 0 #define GPIO_MODE_INPUT 0
#define GPIO_MODE_OUTPUT 1 #define GPIO_MODE_OUTPUT 1
int gpio_init(); int gpio_init(void);
/* request access to a gpio */ /* request access to a gpio */
int gpio_claim(char *owner, int nr, struct gpio **gpio); int gpio_claim(char *owner, int nr, struct gpio **gpio);
@ -30,5 +30,5 @@ int gpio_intr_read(struct gpio *gpio, int *value);
/* Interrupt hook */ /* Interrupt hook */
int gpio_intr_message(message * m); int gpio_intr_message(message * m);
int gpio_release(); int gpio_release(void);
#endif /* __INCLUDE_GPIO_H__ */ #endif /* __INCLUDE_GPIO_H__ */

View file

@ -314,8 +314,8 @@
#define CONTROL_CONF_PUDEN (1<<3) #define CONTROL_CONF_PUDEN (1<<3)
#define CONTROL_CONF_MUXMODE(X) (X&0x7) #define CONTROL_CONF_MUXMODE(X) (X&0x7)
int padconf_init(); int padconf_init(void);
int padconf_set(u32_t padconf, u32_t mask, u32_t value); int padconf_set(u32_t padconf, u32_t mask, u32_t value);
int padconf_release(); int padconf_release(void);
#endif /* __PADCONF_H__ */ #endif /* __PADCONF_H__ */

View file

@ -322,6 +322,7 @@ int unlinkat(int, const char *, int);
* Implementation-defined extensions * Implementation-defined extensions
*/ */
#ifdef __minix #ifdef __minix
int lseek64(int fd, u64_t _offset, int _whence, u64_t *_newpos); int lseek64(int fd, u64_t _offset, int _whence, u64_t *_newpos);
#if defined(_NETBSD_SOURCE) #if defined(_NETBSD_SOURCE)
#include <minix/type.h> #include <minix/type.h>
@ -334,7 +335,6 @@ int mapdriver(char *label, int major, int style, int flags);
pid_t getnpid(endpoint_t proc_ep); pid_t getnpid(endpoint_t proc_ep);
uid_t getnuid(endpoint_t proc_ep); uid_t getnuid(endpoint_t proc_ep);
gid_t getngid(endpoint_t proc_ep); gid_t getngid(endpoint_t proc_ep);
int getnucred(endpoint_t proc_ep, struct ucred *ucred);
ssize_t pread64(int fd, void *buf, size_t count, u64_t where); ssize_t pread64(int fd, void *buf, size_t count, u64_t where);
ssize_t pwrite64(int fd, const void *buf, size_t count, u64_t where); ssize_t pwrite64(int fd, const void *buf, size_t count, u64_t where);
#endif /* defined(_NETBSD_SOURCE) */ #endif /* defined(_NETBSD_SOURCE) */

View file

@ -17,6 +17,7 @@
#include "arch_proto.h" #include "arch_proto.h"
#include "serial.h" #include "serial.h"
#include "omap_rtc.h" #include "omap_rtc.h"
#include "omap_reset.h"
#include "kernel/proc.h" #include "kernel/proc.h"
#include "kernel/debug.h" #include "kernel/debug.h"
#include "direct_utils.h" #include "direct_utils.h"

View file

@ -19,6 +19,8 @@
#include "kernel/debug.h" #include "kernel/debug.h"
#include "omap_ccnt.h" #include "omap_ccnt.h"
#include "omap_padconf.h" #include "omap_padconf.h"
#include "omap_rtc.h"
#include "omap_reset.h"
#include "glo.h" #include "glo.h"

View file

@ -1,6 +1,8 @@
#ifndef __HW_INTR_ARM_H__ #ifndef __HW_INTR_ARM_H__
#define __HW_INTR_ARM_H__ #define __HW_INTR_ARM_H__
#include "omap_intr.h"
#include "kernel/kernel.h" #include "kernel/kernel.h"
void irq_handle(int irq); void irq_handle(int irq);

View file

@ -8,6 +8,7 @@
#include "kernel/vm.h" #include "kernel/vm.h"
#include "kernel/proto.h" #include "kernel/proto.h"
#include "arch_proto.h" #include "arch_proto.h"
#include "hw_intr.h"
#include "omap_intr.h" #include "omap_intr.h"
static struct omap_intr { static struct omap_intr {
@ -28,7 +29,8 @@ int intr_init(const int auto_eoi)
#endif #endif
omap_intr.size = 0x1000 ; /* 4K */ omap_intr.size = 0x1000 ; /* 4K */
kern_phys_map_ptr(omap_intr.base,omap_intr.size,&intr_phys_map,&omap_intr.base); kern_phys_map_ptr(omap_intr.base,omap_intr.size,
&intr_phys_map, (vir_bytes) &omap_intr.base);
return 0; return 0;
} }

View file

@ -45,7 +45,7 @@ omap3_reset_init(void)
{ {
#if defined(AM335X) || defined(DM37XX) #if defined(AM335X) || defined(DM37XX)
kern_phys_map_ptr(omap_reset.base, omap_reset.size, &reset_phys_map, kern_phys_map_ptr(omap_reset.base, omap_reset.size, &reset_phys_map,
&omap_reset.base); (vir_bytes) &omap_reset.base);
#endif /* AM335X || DM37XX */ #endif /* AM335X || DM37XX */
} }

View file

@ -51,7 +51,8 @@ void omap3_ser_init(){
omap_serial.size = 0x1000 ; /* 4k */ omap_serial.size = 0x1000 ; /* 4k */
kern_phys_map_ptr(omap_serial.base,omap_serial.size,&serial_phys_map,&omap_serial.base); kern_phys_map_ptr(omap_serial.base,omap_serial.size,
&serial_phys_map, (vir_bytes) &omap_serial.base);
assert(omap_serial.base); assert(omap_serial.base);
} }

View file

@ -151,7 +151,9 @@ void omap3_frclock_init(void)
{ {
u32_t tisr; u32_t tisr;
kern_phys_map_ptr(fr_timer.base,ARM_PAGE_SIZE,&fr_timer_phys_map,&fr_timer.base); kern_phys_map_ptr(fr_timer.base,ARM_PAGE_SIZE,
&fr_timer_phys_map, (vir_bytes) &fr_timer.base);
/* enable the clock */ /* enable the clock */
#ifdef AM335X #ifdef AM335X
/* Disable the module and wait for the module to be disabled */ /* Disable the module and wait for the module to be disabled */
@ -210,7 +212,8 @@ void omap3_frclock_stop()
void omap3_timer_init(unsigned freq) void omap3_timer_init(unsigned freq)
{ {
u32_t tisr; u32_t tisr;
kern_phys_map_ptr(timer.base,ARM_PAGE_SIZE,&timer_phys_map,&timer.base); kern_phys_map_ptr(timer.base,ARM_PAGE_SIZE,
&timer_phys_map, (vir_bytes) &timer.base);
#ifdef AM335X #ifdef AM335X
/* disable the module and wait for the module to be disabled */ /* disable the module and wait for the module to be disabled */
set32(CM_WKUP_TIMER1_CLKCTRL, CM_MODULEMODE_MASK,CM_MODULEMODE_DISABLED); set32(CM_WKUP_TIMER1_CLKCTRL, CM_MODULEMODE_MASK,CM_MODULEMODE_DISABLED);

View file

@ -111,6 +111,10 @@ void bsp_finish_booting(void)
NOT_REACHABLE; NOT_REACHABLE;
} }
#ifdef __arm__
#include "omap_serial.h"
#endif
/*===========================================================================* /*===========================================================================*
* kmain * * kmain *
*===========================================================================*/ *===========================================================================*/

View file

@ -30,6 +30,8 @@ extern struct arch_watchdog *watchdog;
/* let the arch code do whatever it needs to setup or quit the watchdog */ /* let the arch code do whatever it needs to setup or quit the watchdog */
int arch_watchdog_init(void); int arch_watchdog_init(void);
void arch_watchdog_stop(void); void arch_watchdog_stop(void);
#ifdef __i386__
/* if the watchdog detects lockup, let the arch code to handle it */ /* if the watchdog detects lockup, let the arch code to handle it */
void arch_watchdog_lockup(const struct nmi_frame * frame); void arch_watchdog_lockup(const struct nmi_frame * frame);
@ -37,6 +39,7 @@ void arch_watchdog_lockup(const struct nmi_frame * frame);
* specific low level handler dumped CPU information and can be inspected by the * specific low level handler dumped CPU information and can be inspected by the
* arch specific code of the watchdog implementaion */ * arch specific code of the watchdog implementaion */
void nmi_watchdog_handler(struct nmi_frame * frame); void nmi_watchdog_handler(struct nmi_frame * frame);
#endif
/* /*
* start and stop profiling using the NMI watchdog * start and stop profiling using the NMI watchdog

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 += -Wall -D_NETBSD_SOURCE CFLAGS += -D_NETBSD_SOURCE
.include <bsd.lib.mk> .include <bsd.lib.mk>

View file

@ -4,6 +4,12 @@
USE_SHLIBDIR= yes USE_SHLIBDIR= yes
WIDECHAR ?= yes WIDECHAR ?= yes
.if defined(__MINIX)
NOGCCERROR=yes
NOCLANGERROR=yes
.endif
WARNS?= 5 WARNS?= 5
LIB= edit LIB= edit
@ -12,7 +18,10 @@ LIBDPLIBS+= terminfo ${.CURDIR}/../libterminfo
.include "bsd.own.mk" .include "bsd.own.mk"
COPTS+= -Wunused-parameter COPTS+= -Wunused-parameter
.if !defined(__MINIX)
CWARNFLAGS.gcc+= -Wconversion CWARNFLAGS.gcc+= -Wconversion
.endif
OSRCS= chared.c common.c el.c emacs.c fcns.c filecomplete.c help.c \ OSRCS= chared.c common.c el.c emacs.c fcns.c filecomplete.c help.c \
hist.c keymacro.c map.c chartype.c \ hist.c keymacro.c map.c chartype.c \

View file

@ -146,14 +146,14 @@ static struct omap_gpio_bank omap_gpio_banks[] = {
.irq_id = GPIO6_IRQ_HOOK_ID, .irq_id = GPIO6_IRQ_HOOK_ID,
.irq_hook_id = GPIO6_IRQ_HOOK_ID, .irq_hook_id = GPIO6_IRQ_HOOK_ID,
}, },
{NULL, 0, 0} {NULL, 0, 0, 0, 0, 0, 0, 0 }
}; };
#define GPIO_REVISION 0x00 #define GPIO_REVISION 0x00
#define GPIO_REVISION_MAJOR(X) ((X & 0xF0) >> 4) #define GPIO_REVISION_MAJOR(X) ((X & 0xF0) >> 4)
#define GPIO_REVISION_MINOR(X) (X & 0XF) #define GPIO_REVISION_MINOR(X) (X & 0XF)
struct omap_gpio_bank * static struct omap_gpio_bank *
omap_gpio_bank_get(int gpio_nr) omap_gpio_bank_get(int gpio_nr)
{ {
struct omap_gpio_bank *bank; struct omap_gpio_bank *bank;
@ -162,7 +162,7 @@ omap_gpio_bank_get(int gpio_nr)
return bank; return bank;
} }
int static int
omap_gpio_claim(char *owner, int nr, struct gpio **gpio) omap_gpio_claim(char *owner, int nr, struct gpio **gpio)
{ {
log_trace(&log, "%s s claiming %d\n", owner, nr); log_trace(&log, "%s s claiming %d\n", owner, nr);
@ -187,7 +187,7 @@ omap_gpio_claim(char *owner, int nr, struct gpio **gpio)
return OK; return OK;
} }
int static int
omap_gpio_pin_mode(struct gpio *gpio, int mode) omap_gpio_pin_mode(struct gpio *gpio, int mode)
{ {
struct omap_gpio_bank *bank; struct omap_gpio_bank *bank;
@ -213,7 +213,7 @@ omap_gpio_pin_mode(struct gpio *gpio, int mode)
return 0; return 0;
} }
int static int
omap_gpio_set(struct gpio *gpio, int value) omap_gpio_set(struct gpio *gpio, int value)
{ {
struct omap_gpio_bank *bank; struct omap_gpio_bank *bank;
@ -231,7 +231,7 @@ omap_gpio_set(struct gpio *gpio, int value)
return OK; return OK;
} }
int static int
omap_gpio_read(struct gpio *gpio, int *value) omap_gpio_read(struct gpio *gpio, int *value)
{ {
struct omap_gpio_bank *bank; struct omap_gpio_bank *bank;
@ -256,7 +256,7 @@ omap_gpio_read(struct gpio *gpio, int *value)
return OK; return OK;
} }
int static int
omap_gpio_intr_read(struct gpio *gpio, int *value) omap_gpio_intr_read(struct gpio *gpio, int *value)
{ {
struct omap_gpio_bank *bank; struct omap_gpio_bank *bank;
@ -273,7 +273,7 @@ omap_gpio_intr_read(struct gpio *gpio, int *value)
return OK; return OK;
} }
int static int
omap_message_hook(message * m) omap_message_hook(message * m)
{ {
unsigned long irq_set, i; unsigned long irq_set, i;
@ -312,8 +312,8 @@ omap_message_hook(message * m)
return OK; return OK;
} }
int static int
omap_gpio_init(struct gpio_driver *drv) omap_gpio_init(struct gpio_driver *gpdrv)
{ {
u32_t revision; u32_t revision;
int i; int i;
@ -382,12 +382,12 @@ omap_gpio_init(struct gpio_driver *drv)
clkconf_release(); clkconf_release();
drv->claim = omap_gpio_claim; gpdrv->claim = omap_gpio_claim;
drv->pin_mode = omap_gpio_pin_mode; gpdrv->pin_mode = omap_gpio_pin_mode;
drv->set = omap_gpio_set; gpdrv->set = omap_gpio_set;
drv->read = omap_gpio_read; gpdrv->read = omap_gpio_read;
drv->intr_read = omap_gpio_intr_read; gpdrv->intr_read = omap_gpio_intr_read;
drv->message_hook = omap_message_hook; gpdrv->message_hook = omap_message_hook;
return 0; return 0;
} }
@ -440,7 +440,7 @@ gpio_intr_message(message * m)
} }
int int
gpio_release() gpio_release(void)
{ {
return OK; return OK;
} }

View file

@ -136,7 +136,7 @@ struct pbuf_custom {
#endif /* PBUF_POOL_FREE_OOSEQ */ #endif /* PBUF_POOL_FREE_OOSEQ */
#if NO_SYS && PBUF_POOL_FREE_OOSEQ #if NO_SYS && PBUF_POOL_FREE_OOSEQ
extern volatile u8_t pbuf_free_ooseq_pending; extern volatile u8_t pbuf_free_ooseq_pending;
void pbuf_free_ooseq(); void pbuf_free_ooseq(void);
/** When not using sys_check_timeouts(), call PBUF_CHECK_FREE_OOSEQ() /** When not using sys_check_timeouts(), call PBUF_CHECK_FREE_OOSEQ()
at regular intervals from main level to check if ooseq pbufs need to be at regular intervals from main level to check if ooseq pbufs need to be
freed! */ freed! */

View file

@ -14,6 +14,6 @@ SRCS= \
scheduler.c \ scheduler.c \
key.c key.c
WARNS?= 5 WARNS?= 4
.include <bsd.lib.mk> .include <bsd.lib.mk>

View file

@ -39,7 +39,7 @@ void mthread_panic_s(void)
volatile int *sf; volatile int *sf;
sf = NULL; sf = NULL;
*((int *) sf ) = 1; /* Cause segfault to generate trace */ *((volatile int *) sf ) = 1; /* Cause segfault to generate trace */
exit(1); exit(1);
} }
#endif #endif

View file

@ -13,7 +13,6 @@ char *key; /* environment variable whose value is bogus */
if (s != ESRCH) /* only error allowed */ if (s != ESRCH) /* only error allowed */
printf("WARNING: env_get_param() failed in env_panic(): %d\n", s); printf("WARNING: env_get_param() failed in env_panic(): %d\n", s);
} }
printf("Bad environment setting: '%s = %s'\n", key, value); panic("Bad environment setting: '%s = %s'\n", key, value);
panic("");
} }

View file

@ -42,7 +42,7 @@ int fs_putnode(void)
if (!rip) { if (!rip) {
printf("%s:%d put_inode: inode #%u dev: %d not found\n", __FILE__, printf("%s:%d put_inode: inode #%u dev: %d not found\n", __FILE__,
__LINE__, (ino_t) fs_m_in.REQ_INODE_NR, fs_dev); __LINE__, (unsigned int) fs_m_in.REQ_INODE_NR, fs_dev);
panic("fs_putnode failed"); panic("fs_putnode failed");
} }

View file

@ -308,7 +308,7 @@ int fs_rename()
struct inode *new_superdirp, *next_new_superdirp; struct inode *new_superdirp, *next_new_superdirp;
int r = OK; /* error flag; initially no error */ int r = OK; /* error flag; initially no error */
int odir, ndir; /* TRUE iff {old|new} file is dir */ int odir, ndir; /* TRUE iff {old|new} file is dir */
int same_pdir; /* TRUE iff parent dirs are the same */ int same_pdir = 0; /* TRUE iff parent dirs are the same */
char old_name[NAME_MAX + 1], new_name[NAME_MAX + 1]; char old_name[NAME_MAX + 1], new_name[NAME_MAX + 1];
ino_t numb; ino_t numb;
phys_bytes len; phys_bytes len;

View file

@ -171,7 +171,7 @@ int fs_mkdir()
/* It was not possible to enter . or .. probably disk was full - /* It was not possible to enter . or .. probably disk was full -
* links counts haven't been touched. */ * links counts haven't been touched. */
if (search_dir(ldirp, lastc, NULL, DELETE, IGN_PERM, 0) != OK) if (search_dir(ldirp, lastc, NULL, DELETE, IGN_PERM, 0) != OK)
panic("Dir disappeared: %d ", rip->i_num); panic("Dir disappeared: %d ", (int) rip->i_num);
rip->i_links_count--; /* undo the increment done in new_node() */ rip->i_links_count--; /* undo the increment done in new_node() */
} }
rip->i_dirt = IN_DIRTY; /* either way, i_links_count has changed */ rip->i_dirt = IN_DIRTY; /* either way, i_links_count has changed */

View file

@ -327,7 +327,7 @@ int opportunistic;
*/ */
struct buf *bp; struct buf *bp;
int index; int mindex;
block_t b; block_t b;
unsigned long excess, block_pos; unsigned long excess, block_pos;
static char first_time = TRUE; static char first_time = TRUE;
@ -358,7 +358,7 @@ int opportunistic;
/* It is not in the inode, so it must be single, double or triple indirect */ /* It is not in the inode, so it must be single, double or triple indirect */
if (block_pos < doub_ind_s) { if (block_pos < doub_ind_s) {
b = rip->i_block[EXT2_NDIR_BLOCKS]; /* address of single indirect block */ b = rip->i_block[EXT2_NDIR_BLOCKS]; /* address of single indirect block */
index = block_pos - EXT2_NDIR_BLOCKS; mindex = block_pos - EXT2_NDIR_BLOCKS;
} else if (block_pos >= out_range_s) { /* TODO: do we need it? */ } else if (block_pos >= out_range_s) { /* TODO: do we need it? */
return(NO_BLOCK); return(NO_BLOCK);
} else { } else {
@ -374,8 +374,8 @@ int opportunistic;
ASSERT(lmfs_dev(bp) != NO_DEV); ASSERT(lmfs_dev(bp) != NO_DEV);
ASSERT(lmfs_dev(bp) == rip->i_dev); ASSERT(lmfs_dev(bp) == rip->i_dev);
excess = block_pos - triple_ind_s; excess = block_pos - triple_ind_s;
index = excess / addr_in_block2; mindex = excess / addr_in_block2;
b = rd_indir(bp, index); /* num of double ind block */ b = rd_indir(bp, mindex); /* num of double ind block */
put_block(bp, INDIRECT_BLOCK); /* release triple ind block */ put_block(bp, INDIRECT_BLOCK); /* release triple ind block */
excess = excess % addr_in_block2; excess = excess % addr_in_block2;
} }
@ -387,10 +387,10 @@ int opportunistic;
} }
ASSERT(lmfs_dev(bp) != NO_DEV); ASSERT(lmfs_dev(bp) != NO_DEV);
ASSERT(lmfs_dev(bp) == rip->i_dev); ASSERT(lmfs_dev(bp) == rip->i_dev);
index = excess / addr_in_block; mindex = excess / addr_in_block;
b = rd_indir(bp, index); /* num of single ind block */ b = rd_indir(bp, mindex); /* num of single ind block */
put_block(bp, INDIRECT_BLOCK); /* release double ind block */ put_block(bp, INDIRECT_BLOCK); /* release double ind block */
index = excess % addr_in_block; /* index into single ind blk */ mindex = excess % addr_in_block; /* index into single ind blk */
} }
if (b == NO_BLOCK) return(NO_BLOCK); if (b == NO_BLOCK) return(NO_BLOCK);
bp = get_block(rip->i_dev, b, iomode); /* get single indirect block */ bp = get_block(rip->i_dev, b, iomode); /* get single indirect block */
@ -401,7 +401,7 @@ int opportunistic;
ASSERT(lmfs_dev(bp) != NO_DEV); ASSERT(lmfs_dev(bp) != NO_DEV);
ASSERT(lmfs_dev(bp) == rip->i_dev); ASSERT(lmfs_dev(bp) == rip->i_dev);
b = rd_indir(bp, index); b = rd_indir(bp, mindex);
put_block(bp, INDIRECT_BLOCK); /* release single ind block */ put_block(bp, INDIRECT_BLOCK); /* release single ind block */
return(b); return(b);
@ -421,14 +421,14 @@ struct buf *get_block_map(register struct inode *rip, u64_t position)
/*===========================================================================* /*===========================================================================*
* rd_indir * * rd_indir *
*===========================================================================*/ *===========================================================================*/
block_t rd_indir(bp, index) block_t rd_indir(bp, mindex)
struct buf *bp; /* pointer to indirect block */ struct buf *bp; /* pointer to indirect block */
int index; /* index into *bp */ int mindex; /* index into *bp */
{ {
if (bp == NULL) if (bp == NULL)
panic("rd_indir() on NULL"); panic("rd_indir() on NULL");
/* TODO: use conv call */ /* TODO: use conv call */
return conv4(le_CPU, b_ind(bp)[index]); return conv4(le_CPU, b_ind(bp)[mindex]);
} }
@ -678,13 +678,22 @@ int fs_getdents(void)
if (d_desc->d_ino == 0) if (d_desc->d_ino == 0)
continue; /* Entry is not in use */ continue; /* Entry is not in use */
#if 0
/* read.c:682: error: comparison is always false due to
* limited range of data type
*/
if (d_desc->d_name_len > NAME_MAX || if (d_desc->d_name_len > NAME_MAX ||
d_desc->d_name_len > EXT2_NAME_MAX) { d_desc->d_name_len > EXT2_NAME_MAX) {
len = min(NAME_MAX, EXT2_NAME_MAX); len = min(NAME_MAX, EXT2_NAME_MAX);
} else { } else
#endif
{
len = d_desc->d_name_len; len = d_desc->d_name_len;
} }
assert(len <= NAME_MAX);
assert(len <= EXT2_NAME_MAX);
/* Compute record length */ /* Compute record length */
reclen = offsetof(struct dirent, d_name) + len + 1; reclen = offsetof(struct dirent, d_name) + len + 1;
o = (reclen % sizeof(long)); o = (reclen % sizeof(long));

View file

@ -24,16 +24,16 @@ static int empty_indir(struct buf *, struct super_block *);
/*===========================================================================* /*===========================================================================*
* write_map * * write_map *
*===========================================================================*/ *===========================================================================*/
int write_map(rip, position, new_block, op) int write_map(rip, position, new_wblock, op)
struct inode *rip; /* pointer to inode to be changed */ struct inode *rip; /* pointer to inode to be changed */
off_t position; /* file address to be mapped */ off_t position; /* file address to be mapped */
block_t new_block; /* block # to be inserted */ block_t new_wblock; /* block # to be inserted */
int op; /* special actions */ int op; /* special actions */
{ {
/* Write a new block into an inode. /* Write a new block into an inode.
* *
* If op includes WMAP_FREE, free the block corresponding to that position * If op includes WMAP_FREE, free the block corresponding to that position
* in the inode ('new_block' is ignored then). Also free the indirect block * in the inode ('new_wblock' is ignored then). Also free the indirect block
* if that was the last entry in the indirect block. * if that was the last entry in the indirect block.
* Also free the double/triple indirect block if that was the last entry in * Also free the double/triple indirect block if that was the last entry in
* the double/triple indirect block. * the double/triple indirect block.
@ -73,7 +73,7 @@ int op; /* special actions */
rip->i_block[block_pos] = NO_BLOCK; rip->i_block[block_pos] = NO_BLOCK;
rip->i_blocks -= rip->i_sp->s_sectors_in_block; rip->i_blocks -= rip->i_sp->s_sectors_in_block;
} else { } else {
rip->i_block[block_pos] = new_block; rip->i_block[block_pos] = new_wblock;
rip->i_blocks += rip->i_sp->s_sectors_in_block; rip->i_blocks += rip->i_sp->s_sectors_in_block;
} }
return(OK); return(OK);
@ -222,7 +222,7 @@ int op; /* special actions */
} }
} }
} else { } else {
wr_indir(bp, index1, new_block); wr_indir(bp, index1, new_wblock);
rip->i_blocks += rip->i_sp->s_sectors_in_block; rip->i_blocks += rip->i_sp->s_sectors_in_block;
} }
/* b1 equals NO_BLOCK only when we are freeing up the indirect block. */ /* b1 equals NO_BLOCK only when we are freeing up the indirect block. */
@ -272,9 +272,9 @@ int op; /* special actions */
/*===========================================================================* /*===========================================================================*
* wr_indir * * wr_indir *
*===========================================================================*/ *===========================================================================*/
static void wr_indir(bp, index, block) static void wr_indir(bp, wrindex, block)
struct buf *bp; /* pointer to indirect block */ struct buf *bp; /* pointer to indirect block */
int index; /* index into *bp */ int wrindex; /* index into *bp */
block_t block; /* block to write */ block_t block; /* block to write */
{ {
/* Given a pointer to an indirect block, write one entry. */ /* Given a pointer to an indirect block, write one entry. */
@ -283,7 +283,7 @@ block_t block; /* block to write */
panic("wr_indir() on NULL"); panic("wr_indir() on NULL");
/* write a block into an indirect block */ /* write a block into an indirect block */
b_ind(bp)[index] = conv4(le_CPU, block); b_ind(bp)[wrindex] = conv4(le_CPU, block);
} }

View file

@ -12,7 +12,7 @@ SRCS= buf.c clock.c inet.c inet_config.c \
.PATH: ${.CURDIR}/generic .PATH: ${.CURDIR}/generic
WARNS=2 WARNS=
DPADD+= ${LIBCHARDRIVER} ${LIBSYS} ${LIBMINIXUTIL} DPADD+= ${LIBCHARDRIVER} ${LIBSYS} ${LIBMINIXUTIL}
LDADD+= -lchardriver -lsys LDADD+= -lchardriver -lsys

View file

@ -19,7 +19,7 @@ MAN=
BINDIR?= /usr/sbin BINDIR?= /usr/sbin
WARNS?=5 WARNS?=2
CPPFLAGS+= -I${NETBSDSRCDIR}/lib/liblwip/include CPPFLAGS+= -I${NETBSDSRCDIR}/lib/liblwip/include
CPPFLAGS+= -I${NETBSDSRCDIR}/lib/liblwip/include/ipv4 CPPFLAGS+= -I${NETBSDSRCDIR}/lib/liblwip/include/ipv4

View file

@ -418,8 +418,8 @@ void driver_up(const char * label, endpoint_t ep)
* at the very begining. dhcp should use raw socket but it is a little * at the very begining. dhcp should use raw socket but it is a little
* tricy in the current dhcp implementation * tricy in the current dhcp implementation
*/ */
if (!netif_add(&nic->netif, (ip_addr_t *) &ip_addr_any, &ip_addr_none, if (!netif_add(&nic->netif, (ip_addr_t *) __UNCONST( &ip_addr_any),
&ip_addr_none, nic, ethernetif_init, ethernet_input)) { &ip_addr_none, &ip_addr_none, nic, ethernetif_init, ethernet_input)) {
printf("LWIP : failed to add device /dev/%s\n", nic->name); printf("LWIP : failed to add device /dev/%s\n", nic->name);
nic->drv_ep = NONE; nic->drv_ep = NONE;
} }

View file

@ -91,7 +91,7 @@ static int sef_cb_init_fresh(__unused int type, __unused sef_init_info_t *info)
set_timer(&tcp_stmr, tcp_sticks, tcp_swatchdog, 0); set_timer(&tcp_stmr, tcp_sticks, tcp_swatchdog, 0);
netif_init(); netif_init();
netif_lo = netif_find((char *) "lo0"); netif_lo = netif_find(__UNCONST("lo0"));
/* Read configuration. */ /* Read configuration. */
#if 0 #if 0
@ -145,7 +145,7 @@ static int sef_cb_init_fresh(__unused int type, __unused sef_init_info_t *info)
return(OK); return(OK);
} }
static void sef_local_startup() static void sef_local_startup(void)
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);

View file

@ -327,8 +327,7 @@ int ksig; /* non-zero means signal comes from kernel */
slot = (int) (rmp - mproc); slot = (int) (rmp - mproc);
if ((rmp->mp_flags & (IN_USE | EXITING)) != IN_USE) { if ((rmp->mp_flags & (IN_USE | EXITING)) != IN_USE) {
printf("PM: signal %d sent to exiting process %d\n", signo, slot); panic("PM: signal %d sent to exiting process %d\n", signo, slot);
panic("");
} }
#if USE_TRACE #if USE_TRACE

View file

@ -673,8 +673,8 @@ struct filp *f;
f->filp_mode = FILP_CLOSED; f->filp_mode = FILP_CLOSED;
f->filp_count = 0; f->filp_count = 0;
} else if (f->filp_count < 0) { } else if (f->filp_count < 0) {
panic("VFS: invalid filp count: %d ino %d/%u", f->filp_count, panic("VFS: invalid filp count: %d ino %d/%u",
vp->v_dev, vp->v_inode_nr); (int) f->filp_count, (int) vp->v_dev, (unsigned int) vp->v_inode_nr);
} else { } else {
unlock_vnode(f->filp_vno); unlock_vnode(f->filp_vno);
} }

View file

@ -336,7 +336,7 @@ int dupvm(struct fproc *rfp, int pfd, int *vmfd, struct filp **newfilp)
if (!S_ISREG(f->filp_vno->v_mode) && !S_ISBLK(f->filp_vno->v_mode)) { if (!S_ISREG(f->filp_vno->v_mode) && !S_ISBLK(f->filp_vno->v_mode)) {
printf("VFS: mmap regular/blockdev only; dev 0x%x ino %d has mode 0%o\n", printf("VFS: mmap regular/blockdev only; dev 0x%x ino %d has mode 0%o\n",
f->filp_vno->v_dev, f->filp_vno->v_inode_nr, f->filp_vno->v_mode); (int) f->filp_vno->v_dev, (int) f->filp_vno->v_inode_nr, (int) f->filp_vno->v_mode);
unlock_filp(f); unlock_filp(f);
return EINVAL; return EINVAL;
} }

View file

@ -947,6 +947,7 @@ MKLINT:= no
# LSC MINIX does not support these features ATM. # LSC MINIX does not support these features ATM.
USE_FORT:= no USE_FORT:= no
USE_SSP:= no
MKYP:= no MKYP:= no
MKPF:= no MKPF:= no
MKNLS:= no MKNLS:= no

View file

@ -52,7 +52,11 @@ CPUFLAGS= -march=i386 -mtune=i386
CFLAGS+= -mno-sse -mno-sse2 -mno-sse3 CFLAGS+= -mno-sse -mno-sse2 -mno-sse3
COPTS+= -ffreestanding COPTS+= -ffreestanding
.if defined(__MINIX)
CFLAGS+= -Wmissing-prototypes -Wstrict-prototypes
.else
CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes
.endif
CPPFLAGS+= -nostdinc -D_STANDALONE CPPFLAGS+= -nostdinc -D_STANDALONE
CPPFLAGS+= -I$S CPPFLAGS+= -I$S

View file

@ -70,7 +70,11 @@ CPPFLAGS+= -DEPIA_HACK
CPUFLAGS= -march=i386 -mtune=i386 CPUFLAGS= -march=i386 -mtune=i386
.endif .endif
.if defined(__MINIX)
CFLAGS+= -Wmissing-prototypes -Wstrict-prototypes
.else
CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes
.endif
CPPFLAGS+= -nostdinc -D_STANDALONE CPPFLAGS+= -nostdinc -D_STANDALONE
CPPFLAGS+= -I$S CPPFLAGS+= -I$S

View file

@ -35,6 +35,8 @@ __KERNEL_RCSID(0, "$NetBSD: pickmode.c,v 1.4 2011/04/09 20:53:39 christos Exp $"
#include <dev/videomode/videomode.h> #include <dev/videomode/videomode.h>
#ifndef __minix #ifndef __minix
#include "opt_videomode.h" #include "opt_videomode.h"
#else
#include <minix/sysutil.h>
#endif #endif
#ifndef abs #ifndef abs
#define abs(x) (((x) < 0) ? -(x) : (x)) #define abs(x) (((x) < 0) ? -(x) : (x))

View file

@ -59,4 +59,9 @@ struct uucred {
gid_t cr_groups[NGROUPS_MAX]; /* groups */ gid_t cr_groups[NGROUPS_MAX]; /* groups */
}; };
#ifdef __minix
#include <minix/type.h>
int getnucred(endpoint_t proc_ep, struct ucred *ucred);
#endif
#endif /* !_SYS_UCRED_H_ */ #endif /* !_SYS_UCRED_H_ */

View file

@ -1,3 +1,6 @@
# $NetBSD: Makefile.inc,v 1.2 2011/09/16 16:30:18 joerg Exp $ # $NetBSD: Makefile.inc,v 1.2 2011/09/16 16:30:18 joerg Exp $
WARNS ?= 4 WARNS ?= 4
CWARNFLAGS+= -Wno-missing-noreturn CWARNFLAGS+= -Wno-missing-noreturn
NOGCCERROR=yes
NOCLANGERROR=yes

View file

@ -4,7 +4,7 @@ DPADD= ${LIBM}
LDADD= -lm LDADD= -lm
# BJG # BJG
WARNS=3 WARNS=
.include <bsd.prog.mk> .include <bsd.prog.mk>

View file

@ -230,12 +230,12 @@ static int print_memory(void)
{ {
FILE *fp; FILE *fp;
unsigned int pagesize; unsigned int pagesize;
unsigned long total, free, largest, cached; unsigned long total, freemem, largest, cached;
if ((fp = fopen("meminfo", "r")) == NULL) if ((fp = fopen("meminfo", "r")) == NULL)
return 0; return 0;
if (fscanf(fp, "%u %lu %lu %lu %lu", &pagesize, &total, &free, if (fscanf(fp, "%u %lu %lu %lu %lu", &pagesize, &total, &freemem,
&largest, &cached) != 5) { &largest, &cached) != 5) {
fclose(fp); fclose(fp);
return 0; return 0;
@ -245,7 +245,7 @@ static int print_memory(void)
printf("main memory: %ldK total, %ldK free, %ldK contig free, " printf("main memory: %ldK total, %ldK free, %ldK contig free, "
"%ldK cached\n", "%ldK cached\n",
(pagesize * total)/1024, (pagesize * free)/1024, (pagesize * total)/1024, (pagesize * freemem)/1024,
(pagesize * largest)/1024, (pagesize * cached)/1024); (pagesize * largest)/1024, (pagesize * cached)/1024);
return 1; return 1;
@ -290,7 +290,8 @@ struct tp {
static int cmp_procs(const void *v1, const void *v2) static int cmp_procs(const void *v1, const void *v2)
{ {
struct tp *p1 = (struct tp *) v1, *p2 = (struct tp *) v2; const struct tp *p1 = (const struct tp *) v1,
*p2 = (const struct tp *) v2;
int p1blocked, p2blocked; int p1blocked, p2blocked;
if(order == ORDER_MEMORY) { if(order == ORDER_MEMORY) {

View file

@ -290,18 +290,18 @@ static char * parse_mode(int mode){
} }
static int static int
dump_entry(FILE * out, int index, const char *base_dir) dump_entry(FILE * out, int mindex, const char *base_dir)
{ {
int space; int space;
int i; int i;
struct entry *entry = &entries[index]; struct entry *entry = &entries[mindex];
if (entry->type == ENTRY_DIR) { if (entry->type == ENTRY_DIR) {
for (space = 0; space < entries[index].depth; space++) { for (space = 0; space < entries[mindex].depth; space++) {
fprintf(out, " "); fprintf(out, " ");
} }
if (entries[index].depth > 0) { if (entries[mindex].depth > 0) {
fprintf(out, "%s ", entry->filename); fprintf(out, "%s ", entry->filename);
} }
fprintf(out, "d%s", parse_mode(entry->mode)); fprintf(out, "d%s", parse_mode(entry->mode));
@ -313,12 +313,12 @@ dump_entry(FILE * out, int index, const char *base_dir)
dump_entry(out, i, base_dir); dump_entry(out, i, base_dir);
} }
} }
for (space = 0; space < entries[index].depth; space++) { for (space = 0; space < entries[mindex].depth; space++) {
fprintf(out, " "); fprintf(out, " ");
} }
fprintf(out, "$\n"); fprintf(out, "$\n");
} else if (entry->type == ENTRY_FILE) { } else if (entry->type == ENTRY_FILE) {
for (space = 0; space < entries[index].depth; space++) { for (space = 0; space < entries[mindex].depth; space++) {
fprintf(out, " "); fprintf(out, " ");
} }
/* hack skipping the first . in the path */ /* hack skipping the first . in the path */
@ -326,7 +326,7 @@ dump_entry(FILE * out, int index, const char *base_dir)
parse_mode(entry->mode), entry->uid, entry->gid, base_dir, parse_mode(entry->mode), entry->uid, entry->gid, base_dir,
&entry->path[1]); &entry->path[1]);
} else if (entry->type == ENTRY_LINK) { } else if (entry->type == ENTRY_LINK) {
for (space = 0; space < entries[index].depth; space++) { for (space = 0; space < entries[mindex].depth; space++) {
fprintf(out, " "); fprintf(out, " ");
} }
/* hack skipping the first . in the path */ /* hack skipping the first . in the path */
@ -335,7 +335,7 @@ dump_entry(FILE * out, int index, const char *base_dir)
} else { } else {
/* missing "b" and "c" for block and char device? */ /* missing "b" and "c" for block and char device? */
fprintf(out, "# "); fprintf(out, "# ");
for (space = 1; space < entries[index].depth; space++) { for (space = 1; space < entries[mindex].depth; space++) {
fprintf(out, " "); fprintf(out, " ");
} }
fprintf(out, "%i %s\n", entry->type, entry->path); fprintf(out, "%i %s\n", entry->type, entry->path);
@ -360,7 +360,7 @@ dump_proto(FILE * out, const char *base_dir)
} }
static void static void
print_usage() print_usage(void)
{ {
printf("Usage: toproto [OPTION]...\n"); printf("Usage: toproto [OPTION]...\n");
printf printf