Cleanup servers to make GCC/Clang a little happier

This commit is contained in:
Thomas Veerman 2011-09-08 13:57:03 +00:00
parent f78fb05676
commit d4b72e81b2
28 changed files with 62 additions and 48 deletions

View file

@ -7,8 +7,6 @@
#include <errno.h>
#include <assert.h>
#define BYTE_ORDER LITTLE_ENDIAN
typedef i8_t s8_t;
typedef i16_t s16_t;
typedef i32_t s32_t;

View file

@ -311,9 +311,26 @@ ssize_t pwrite(int, const void *, size_t, off_t);
/*
* Implementation-defined extensions
*/
#if defined(__minix)
#ifdef __minix
int lseek64(int fd, u64_t _offset, int _whence, u64_t *_newpos);
#endif /* !__minix */
#if defined(_MINIX)
#include <minix/type.h>
int getsigset(sigset_t *sigset);
int getprocnr(void);
int getnprocnr(pid_t pid);
int getpprocnr(void);
int _pm_findproc(char *proc_name, int *proc_nr);
int mapdriver(char *label, int major, int style, int flags);
int adddma(endpoint_t proc_e, phys_bytes start, phys_bytes size);
int deldma(endpoint_t proc_e, phys_bytes start, phys_bytes size);
int getdma(endpoint_t *procp, phys_bytes *basep, phys_bytes *sizep);
pid_t getnpid(endpoint_t proc_ep);
uid_t getnuid(endpoint_t proc_ep);
gid_t getngid(endpoint_t proc_ep);
int getnucred(endpoint_t proc_ep, struct ucred *ucred);
#endif /* __MINIX */
#endif /* __minix */
#if defined(_NETBSD_SOURCE)
#ifndef __minix

View file

@ -962,7 +962,7 @@ PUBLIC int uds_ioctl(message *dev_m_in, message *dev_m_out)
PUBLIC int uds_unsuspend(endpoint_t m_source, int minor)
{
int r, bytes;
int r = OK, bytes;
message m_out;
uds_fd_t *fdp;
@ -976,7 +976,6 @@ PUBLIC int uds_unsuspend(endpoint_t m_source, int minor)
/* prepare the response */
uds_sel_reply(&m_out, DEV_SEL_REPL2, minor, fdp->sel_ops_out);
r = OK;
} else if (fdp->ready_to_revive == 1) {
/* clear the ready to revive flag */
@ -999,7 +998,6 @@ PUBLIC int uds_unsuspend(endpoint_t m_source, int minor)
uds_set_reply(&m_out, DEV_REVIVE, fdp->endpoint,
fdp->io_gr, bytes);
r = OK;
break;
case UDS_SUSPENDED_WRITE:
@ -1017,7 +1015,6 @@ PUBLIC int uds_unsuspend(endpoint_t m_source, int minor)
uds_set_reply(&m_out, DEV_REVIVE, fdp->endpoint,
fdp->io_gr, bytes);
r = OK;
break;
case UDS_SUSPENDED_CONNECT:
@ -1035,7 +1032,6 @@ PUBLIC int uds_unsuspend(endpoint_t m_source, int minor)
uds_set_reply(&m_out, DEV_REVIVE, fdp->endpoint,
fdp->io_gr, OK);
r = OK;
break;
default:

View file

@ -17,6 +17,10 @@ CPPFLAGS+= -DUSE_COVERAGE
DPADD+= ${LIBSYS} ${LIBTIMERS} ${LIBEXEC}
LDADD+= -lsys -ltimers -lexec -lmthread
.if ${COMPILER_TYPE} == "gnu"
LDADD+= -lc
.endif
MAN=
BINDIR?= /usr/sbin

View file

@ -170,7 +170,7 @@ char mount_label[LABEL_MAX] )
int i, r = OK, found, isroot, mount_root, con_reqs;
struct fproc *tfp;
struct dmap *dp;
struct vnode *root_node, *vp = NULL, *bspec;
struct vnode *root_node, *vp = NULL;
struct vmnt *new_vmp, *parent_vmp;
char *label;
struct node_details res;

View file

@ -36,7 +36,7 @@ PUBLIC int do_bind_device(message *m)
m->DEVMAN_RESULT= res;
} else if (m->DEVMAN_RESULT != OK) {
printf("[W] devman.do_bind_device(): driver could"
" not bind device (%d)\n", m->DEVMAN_RESULT);
" not bind device (%ld)\n", m->DEVMAN_RESULT);
} else {
dev->state = DEVMAN_DEVICE_BOUND;
devman_get_device(dev);
@ -85,7 +85,7 @@ PUBLIC int do_unbind_device(message *m)
} else if (m->DEVMAN_RESULT != OK && m->DEVMAN_RESULT != 19) {
/* device drive deleted device already? */
printf("[W] devman.do_unbind_device(): driver could"
" not unbind device (%d)\n", m->DEVMAN_RESULT);
" not unbind device (%ld)\n", m->DEVMAN_RESULT);
} else {
if (dev->state != DEVMAN_DEVICE_ZOMBIE) {
dev->state = DEVMAN_DEVICE_UNBOUND;

View file

@ -298,7 +298,7 @@ PRIVATE void rw_block(
op = (rw_flag == READING ? MFS_DEV_READ : MFS_DEV_WRITE);
r = block_dev_io(op, dev, SELF_E, bp->b_data, pos, fs_block_size);
if (r < 0) {
printf("Ext2(%d) I/O error on device %d/%d, block %lu\n",
printf("Ext2(%d) I/O error on device %d/%d, block %u\n",
SELF_E, major(dev), minor(dev), bp->b_blocknr);
op_failed = 1;
} else if( (unsigned) r != fs_block_size) {
@ -426,7 +426,7 @@ PUBLIC void rw_scattered(
/* Transfer failed. An error? Do we care? */
if (r != OK && i == 0) {
printf(
"fs: I/O error on device %d/%d, block %lu\n",
"fs: I/O error on device %d/%d, block %u\n",
major(dev), minor(dev), bp->b_blocknr);
bp->b_dev = NO_DEV; /* invalidate block */
vm_forgetblocks();

View file

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

View file

@ -2629,7 +2629,7 @@ tcp_conn_t *tcp_conn;
if (mtu > tcp_conn->tc_max_mtu)
mtu= tcp_conn->tc_max_mtu;
tcp_conn->tc_mtu= mtu;
DBLOCK(0x1, printf("tcp_mtu_incr: new mtu %ld for conn %d\n",
DBLOCK(0x1, printf("tcp_mtu_incr: new mtu %u for conn %u\n",
mtu, tcp_conn-tcp_conn_table););
}

View file

@ -366,7 +366,7 @@ tcp_conn_t *tcp_conn;
{
printf("RCV_NXT-RCV_LO != 0\n");
tcp_print_conn(tcp_conn);
printf("lo_queue= %lu, hi_queue= %lu\n",
printf("lo_queue= %u, hi_queue= %u\n",
lo_queue, hi_queue);
allright= FALSE;
}
@ -376,7 +376,7 @@ tcp_conn_t *tcp_conn;
printf("RCV_NXT-RCV_LO != sizeof tc_rcvd_data\n");
tcp_print_conn(tcp_conn);
printf(
"lo_queue= %lu, hi_queue= %lu, sizeof tc_rcvd_data= %d\n",
"lo_queue= %u, hi_queue= %u, sizeof tc_rcvd_data= %d\n",
lo_queue, hi_queue, bf_bufsize(tcp_conn->tc_rcvd_data));
allright= FALSE;
}
@ -497,7 +497,7 @@ tcp_hdr_t *tcp_hdr;
else
printf("???");
printf(",%u ", ntohs(tcp_hdr->th_dstport));
printf(" 0x%lx", ntohl(tcp_hdr->th_seq_nr));
printf(" 0x%x", ntohl(tcp_hdr->th_seq_nr));
if (tcp_hdr->th_flags & THF_FIN)
printf(" <FIN>");
if (tcp_hdr->th_flags & THF_SYN)
@ -507,7 +507,7 @@ tcp_hdr_t *tcp_hdr;
if (tcp_hdr->th_flags & THF_PSH)
printf(" <PSH>");
if (tcp_hdr->th_flags & THF_ACK)
printf(" <ACK 0x%lx %u>", ntohl(tcp_hdr->th_ack_nr),
printf(" <ACK 0x%x %u>", ntohl(tcp_hdr->th_ack_nr),
ntohs(tcp_hdr->th_window));
if (tcp_hdr->th_flags & THF_URG)
printf(" <URG %u>", tcp_hdr->th_urgptr);
@ -527,15 +527,15 @@ tcp_conn_t *tcp_conn;
tcp_print_state (tcp_conn);
printf(
" ISS 0x%lx UNA +0x%lx(0x%lx) TRM +0x%lx(0x%lx) NXT +0x%lx(0x%lx)",
" ISS 0x%x UNA +0x%x(0x%x) TRM +0x%x(0x%x) NXT +0x%x(0x%x)",
iss, tcp_conn->tc_SND_UNA-iss, tcp_conn->tc_SND_UNA,
tcp_conn->tc_SND_TRM-iss, tcp_conn->tc_SND_TRM,
tcp_conn->tc_SND_NXT-iss, tcp_conn->tc_SND_NXT);
printf(
" UP +0x%lx(0x%lx) PSH +0x%lx(0x%lx) ",
" UP +0x%x(0x%x) PSH +0x%x(0x%x) ",
tcp_conn->tc_SND_UP-iss, tcp_conn->tc_SND_UP,
tcp_conn->tc_SND_PSH-iss, tcp_conn->tc_SND_PSH);
printf(" snd_cwnd +0x%lx(0x%lx)",
printf(" snd_cwnd +0x%x(0x%x)",
tcp_conn->tc_snd_cwnd-tcp_conn->tc_SND_UNA,
tcp_conn->tc_snd_cwnd);
printf(" transmit_seq ");
@ -543,10 +543,10 @@ tcp_conn_t *tcp_conn;
printf("0");
else
{
printf("+0x%lx(0x%lx)", tcp_conn->tc_transmit_seq-iss,
printf("+0x%x(0x%x)", tcp_conn->tc_transmit_seq-iss,
tcp_conn->tc_transmit_seq);
}
printf(" IRS 0x%lx LO +0x%lx(0x%lx) NXT +0x%lx(0x%lx) HI +0x%lx(0x%lx)",
printf(" IRS 0x%x LO +0x%x(0x%x) NXT +0x%x(0x%x) HI +0x%x(0x%x)",
irs, tcp_conn->tc_RCV_LO-irs, tcp_conn->tc_RCV_LO,
tcp_conn->tc_RCV_NXT-irs, tcp_conn->tc_RCV_NXT,
tcp_conn->tc_RCV_HI-irs, tcp_conn->tc_RCV_HI);

View file

@ -716,7 +716,7 @@ TIME-WAIT:
tcp_conn_write(tcp_conn, 1);
DBLOCK(1, printf(
"got an ack of something I haven't send\n");
printf( "seg_ack= %lu, SND_NXT= %lu\n",
printf( "seg_ack= %u, SND_NXT= %u\n",
seg_ack, snd_nxt));
break;
}

View file

@ -237,7 +237,9 @@ void startup(int linenr, struct ttyent *ttyp)
pid_t pid; /* new pid */
int err[2]; /* error reporting pipe */
char line[32]; /* tty device name */
#ifndef __NBSD_LIBC
int status;
#endif
#ifdef __NBSD_LIBC
char **ty_getty_argv;
#endif

View file

@ -420,7 +420,7 @@ PUBLIC void memmap_dmp()
size = rp->p_memmap[T].mem_len
+ ((rp->p_memmap[S].mem_phys + rp->p_memmap[S].mem_len)
- rp->p_memmap[D].mem_phys);
printf("%-7.7s%7lx %8lx %4x %4x %4x %4x %5x %5x %8lu\n",
printf("%-7.7s%7lx %8lx %4x %4x %4x %4x %5x %5x %8u\n",
rp->p_name,
(unsigned long) rp->p_reg.pc,
(unsigned long) rp->p_reg.sp,

View file

@ -77,7 +77,7 @@ PUBLIC void vm_dmp()
return;
}
printf("Total %u kB, free %u kB, largest free %u kB, cached %u kB\n",
printf("Total %lu kB, free %lu kB, largest free %lu kB, cached %lu kB\n",
vsi.vsi_total * (vsi.vsi_pagesize / 1024),
vsi.vsi_free * (vsi.vsi_pagesize / 1024),
vsi.vsi_largest * (vsi.vsi_pagesize / 1024),

View file

@ -103,7 +103,7 @@ register struct buf *bp; /* buffer pointer */
if (r != block_size) {
if (r >= 0) r = END_OF_FILE;
if (r != END_OF_FILE)
printf("ISOFS(%d) I/O error on device %d/%d, block %ld\n",
printf("ISOFS(%d) I/O error on device %d/%d, block %u\n",
SELF_E, (fs_dev>>MAJOR)&BYTE, (fs_dev>>MINOR)&BYTE,
bp->b_blocknr);

View file

@ -11,7 +11,7 @@ SRCS= lwip.c \
.PATH: ${.CURDIR}/generic
DPADD+= ${LIBDRIVER} ${LIBSYS} ${LIBMINIXUTIL}
DPADD+= ${LIBDRIVER} ${LIBSYS} ${LIBMINIXUTIL} ${LIBLWIP}
LDADD+= -ldriver -lsys -lminixutil -ltimers -llwip
MAN=

View file

@ -10,7 +10,7 @@
#include <minix/sysutil.h>
#include <minix/safecopies.h>
#include <net/ioctl.h>
#include <sys/ioc_net.h>
#include <net/gen/in.h>
#include <net/gen/ip_io.h>
#include <net/gen/route.h>
@ -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
* tricy in the current dhcp implementation
*/
if (!netif_add(&nic->netif, &ip_addr_any, &ip_addr_none, &ip_addr_none,
nic, ethernetif_init, ethernet_input)) {
if (!netif_add(&nic->netif, (ip_addr_t *) &ip_addr_any, &ip_addr_none,
&ip_addr_none, nic, ethernetif_init, ethernet_input)) {
printf("LWIP : failed to add device /dev/%s\n", nic->name);
nic->drv_ep = NONE;
}

View file

@ -79,7 +79,6 @@ extern struct ip_conf ip_conf[IP_PORT_MAX];
extern struct tcp_conf tcp_conf[IP_PORT_MAX];
extern struct udp_conf udp_conf[IP_PORT_MAX];
void read_conf(void);
extern char *sbrk(int);
void *alloc(size_t size);
/* Options */

View file

@ -1,6 +1,6 @@
#include <stdlib.h>
#include <net/ioctl.h>
#include <sys/ioc_net.h>
#include <net/gen/in.h>
#include <net/gen/ip_io.h>

View file

@ -13,7 +13,7 @@
#include <lwip/tcp.h>
#include <net/ioctl.h>
#include <sys/ioc_net.h>
#include "inet_config.h"
#include "proto.h"

View file

@ -2,7 +2,7 @@
#include <assert.h>
#include <minix/sysutil.h>
#include <net/ioctl.h>
#include <sys/ioc_net.h>
#include <net/gen/in.h>
#include <net/gen/tcp.h>
#include <net/gen/tcp_io.h>

View file

@ -2,7 +2,7 @@
#include <minix/sysutil.h>
#include <net/ioctl.h>
#include <sys/ioc_net.h>
#include <net/gen/in.h>
#include <net/gen/udp.h>
#include <net/gen/udp_io.h>

View file

@ -168,14 +168,11 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
int s,i;
int nr_image_srvs, nr_image_priv_srvs, nr_uncaught_init_srvs;
struct rproc *rp;
struct rproc *replica_rp;
struct rprocpub *rpub;
struct boot_image image[NR_BOOT_PROCS];
struct boot_image_priv *boot_image_priv;
struct boot_image_sys *boot_image_sys;
struct boot_image_dev *boot_image_dev;
int pid, replica_pid;
endpoint_t replica_endpoint;
int ipc_to;
int *calls;
int all_c[] = { ALL_C, NULL_C };

View file

@ -749,7 +749,7 @@ struct rproc *rp; /* pointer to service slot */
r = ds_retrieve_label_endpt("devman",&ep);
if (r != OK) {
printf("RS: devman not running?", r);
printf("RS: devman not running?");
} else {
m.m_type = DEVMAN_UNBIND;
m.DEVMAN_ENDPOINT = rpub->endpoint;

View file

@ -21,7 +21,8 @@
#include "fs.h"
#include <fcntl.h>
#include <assert.h>
#include <unistd.h> /* cc runs out of memory with unistd.h :-( */
#include <unistd.h>
#include <string.h>
#include <minix/callnr.h>
#include <minix/safecopies.h>
#include <minix/endpoint.h>
@ -387,11 +388,11 @@ int cpid; /* Child process id */
* as it isn't blocking on i/o.
*/
if(GRANT_VALID(fp->fp_grant)) {
printf("vfs: fork: fp (endpoint %d) has grant %ld\n", fp->fp_endpoint, fp->fp_grant);
printf("vfs: fork: fp (endpoint %d) has grant %d\n", fp->fp_endpoint, fp->fp_grant);
panic("fp contains valid grant");
}
if(GRANT_VALID(cp->fp_grant)) {
printf("vfs: fork: cp (endpoint %d) has grant %ld\n", cp->fp_endpoint, cp->fp_grant);
printf("vfs: fork: cp (endpoint %d) has grant %d\n", cp->fp_endpoint, cp->fp_grant);
panic("cp contains valid grant");
}

View file

@ -786,7 +786,7 @@ int status;
assert((vp->v_mode & I_TYPE) == I_CHAR_SPECIAL); /* Must be char. special */
if (vp->v_sdev != dev) {
printf("VFS (%s:%d): expected reply from dev %d not %d\n",
vp->v_sdev, dev);
__FILE__, __LINE__, vp->v_sdev, dev);
return;
}
}

View file

@ -71,7 +71,7 @@ PUBLIC int do_mmap(message *m)
if(m->VMM_FLAGS & MAP_IPC_SHARED) {
vrflags |= VR_SHARED;
/* Shared memory has to be preallocated. */
if(m->VMM_FLAGS & (MAP_PREALLOC|MAP_ANON) !=
if((m->VMM_FLAGS & (MAP_PREALLOC|MAP_ANON)) !=
(MAP_PREALLOC|MAP_ANON)) {
return EINVAL;
}

View file

@ -67,7 +67,7 @@ PUBLIC int do_query_exit(message *m)
*===========================================================================*/
PUBLIC int do_notify_sig(message *m)
{
int i, avails = 0, p;
int i, avails = 0;
endpoint_t ep = m->VM_NOTIFY_SIG_ENDPOINT;
endpoint_t ipc_ep = m->VM_NOTIFY_SIG_IPC;
int r;