From: Thomas Veerman Date: Thu, 8 Sep 2011 13:57:03 +0000 (+0000) Subject: Cleanup servers to make GCC/Clang a little happier X-Git-Tag: v3.2.0~313 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/expt.png?a=commitdiff_plain;h=d4b72e81b2a363a7d5551fd8be8c9eaf6ddcc6db;p=minix.git Cleanup servers to make GCC/Clang a little happier --- diff --git a/lib/liblwip/include/arch/cc.h b/lib/liblwip/include/arch/cc.h index 6109ee23c..f21655c1e 100644 --- a/lib/liblwip/include/arch/cc.h +++ b/lib/liblwip/include/arch/cc.h @@ -7,8 +7,6 @@ #include #include -#define BYTE_ORDER LITTLE_ENDIAN - typedef i8_t s8_t; typedef i16_t s16_t; typedef i32_t s32_t; diff --git a/nbsd_include/unistd.h b/nbsd_include/unistd.h index 986c0b909..c7621e8ec 100644 --- a/nbsd_include/unistd.h +++ b/nbsd_include/unistd.h @@ -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 + +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 diff --git a/servers/apfs/dev_uds.c b/servers/apfs/dev_uds.c index 05b3adf25..7250f071e 100644 --- a/servers/apfs/dev_uds.c +++ b/servers/apfs/dev_uds.c @@ -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: diff --git a/servers/avfs/Makefile b/servers/avfs/Makefile index 1fc72128e..3dad05917 100644 --- a/servers/avfs/Makefile +++ b/servers/avfs/Makefile @@ -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 diff --git a/servers/avfs/mount.c b/servers/avfs/mount.c index 05e4ff0b2..a0096e6a8 100644 --- a/servers/avfs/mount.c +++ b/servers/avfs/mount.c @@ -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; diff --git a/servers/devman/bind.c b/servers/devman/bind.c index c81baf828..9815552e5 100644 --- a/servers/devman/bind.c +++ b/servers/devman/bind.c @@ -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; diff --git a/servers/ext2/cache.c b/servers/ext2/cache.c index 776ea6c64..e4a213b9d 100644 --- a/servers/ext2/cache.c +++ b/servers/ext2/cache.c @@ -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(); diff --git a/servers/ext2/inode.c b/servers/ext2/inode.c index eeaa755cb..ee6c44931 100644 --- a/servers/ext2/inode.c +++ b/servers/ext2/inode.c @@ -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"); } diff --git a/servers/inet/generic/tcp.c b/servers/inet/generic/tcp.c index 6f060680c..df1295336 100644 --- a/servers/inet/generic/tcp.c +++ b/servers/inet/generic/tcp.c @@ -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);); } diff --git a/servers/inet/generic/tcp_lib.c b/servers/inet/generic/tcp_lib.c index 558b11311..6cf6616aa 100644 --- a/servers/inet/generic/tcp_lib.c +++ b/servers/inet/generic/tcp_lib.c @@ -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(" "); if (tcp_hdr->th_flags & THF_SYN) @@ -507,7 +507,7 @@ tcp_hdr_t *tcp_hdr; if (tcp_hdr->th_flags & THF_PSH) printf(" "); if (tcp_hdr->th_flags & THF_ACK) - printf(" ", ntohl(tcp_hdr->th_ack_nr), + printf(" ", ntohl(tcp_hdr->th_ack_nr), ntohs(tcp_hdr->th_window)); if (tcp_hdr->th_flags & THF_URG) printf(" ", 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); diff --git a/servers/inet/generic/tcp_recv.c b/servers/inet/generic/tcp_recv.c index e4bb3a8a4..b48a7de0b 100644 --- a/servers/inet/generic/tcp_recv.c +++ b/servers/inet/generic/tcp_recv.c @@ -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; } diff --git a/servers/init/init.c b/servers/init/init.c index 2fe6787a0..f2abc0893 100644 --- a/servers/init/init.c +++ b/servers/init/init.c @@ -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 diff --git a/servers/is/dmp_kernel.c b/servers/is/dmp_kernel.c index 87eb3f538..28b8e1efd 100644 --- a/servers/is/dmp_kernel.c +++ b/servers/is/dmp_kernel.c @@ -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, diff --git a/servers/is/dmp_vm.c b/servers/is/dmp_vm.c index 13ef4ca87..6fafb5b05 100644 --- a/servers/is/dmp_vm.c +++ b/servers/is/dmp_vm.c @@ -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), diff --git a/servers/iso9660fs/cache.c b/servers/iso9660fs/cache.c index 4a5166ab3..d58e93e4f 100644 --- a/servers/iso9660fs/cache.c +++ b/servers/iso9660fs/cache.c @@ -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); diff --git a/servers/lwip/Makefile b/servers/lwip/Makefile index 0929d6530..4d06a045a 100644 --- a/servers/lwip/Makefile +++ b/servers/lwip/Makefile @@ -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= diff --git a/servers/lwip/driver.c b/servers/lwip/driver.c index 0fd000026..12ba42c8e 100644 --- a/servers/lwip/driver.c +++ b/servers/lwip/driver.c @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include #include @@ -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; } diff --git a/servers/lwip/inet_config.h b/servers/lwip/inet_config.h index 743ab9a58..9608268b9 100644 --- a/servers/lwip/inet_config.h +++ b/servers/lwip/inet_config.h @@ -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 */ diff --git a/servers/lwip/raw_ip.c b/servers/lwip/raw_ip.c index 36efdcf4c..d22abb609 100644 --- a/servers/lwip/raw_ip.c +++ b/servers/lwip/raw_ip.c @@ -1,6 +1,6 @@ #include -#include +#include #include #include diff --git a/servers/lwip/socket.c b/servers/lwip/socket.c index 373a88b57..75be4a275 100644 --- a/servers/lwip/socket.c +++ b/servers/lwip/socket.c @@ -13,7 +13,7 @@ #include -#include +#include #include "inet_config.h" #include "proto.h" diff --git a/servers/lwip/tcp.c b/servers/lwip/tcp.c index 78e3c4225..f38df285e 100644 --- a/servers/lwip/tcp.c +++ b/servers/lwip/tcp.c @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include #include diff --git a/servers/lwip/udp.c b/servers/lwip/udp.c index 2a38dc8ca..fafb0dc58 100644 --- a/servers/lwip/udp.c +++ b/servers/lwip/udp.c @@ -2,7 +2,7 @@ #include -#include +#include #include #include #include diff --git a/servers/rs/main.c b/servers/rs/main.c index cd287241c..fa1d55b02 100644 --- a/servers/rs/main.c +++ b/servers/rs/main.c @@ -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 }; diff --git a/servers/rs/manager.c b/servers/rs/manager.c index 7f0c57ee8..c5eba016e 100644 --- a/servers/rs/manager.c +++ b/servers/rs/manager.c @@ -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; diff --git a/servers/vfs/misc.c b/servers/vfs/misc.c index c2dab242c..db45ef9ef 100644 --- a/servers/vfs/misc.c +++ b/servers/vfs/misc.c @@ -21,7 +21,8 @@ #include "fs.h" #include #include -#include /* cc runs out of memory with unistd.h :-( */ +#include +#include #include #include #include @@ -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"); } diff --git a/servers/vfs/select.c b/servers/vfs/select.c index 6d84ff35e..ae9a8ded0 100644 --- a/servers/vfs/select.c +++ b/servers/vfs/select.c @@ -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; } } diff --git a/servers/vm/mmap.c b/servers/vm/mmap.c index f3260f836..e458fc5cc 100644 --- a/servers/vm/mmap.c +++ b/servers/vm/mmap.c @@ -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; } diff --git a/servers/vm/queryexit.c b/servers/vm/queryexit.c index 3774c7936..3ef55e18d 100644 --- a/servers/vm/queryexit.c +++ b/servers/vm/queryexit.c @@ -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;