various warning/errorwarning fixes for gcc47

. warnings (sometimes promoted to errors) in servers/ and kernel/
 . -Os for ext2 boot module to make it small enough
This commit is contained in:
Ben Gras 2012-08-25 19:42:05 +02:00
parent 2af02e0d5d
commit e4ac80eb60
20 changed files with 23 additions and 72 deletions

View file

@ -122,7 +122,7 @@ void direct_print(const char *str)
int direct_read_char(unsigned char *ch)
{
unsigned long b, sb;
unsigned long sb;
sb = inb(KB_STATUS);
@ -130,7 +130,7 @@ int direct_read_char(unsigned char *ch)
return 0;
}
b = inb(KEYBD);
inb(KEYBD);
if (!(sb & KB_AUX_BYTE))
return 1;

View file

@ -560,7 +560,6 @@ static void vm_print(u32_t *root)
int vm_memset(endpoint_t who, phys_bytes ph, const u8_t c, phys_bytes bytes)
{
u32_t p;
int r = OK;
struct proc *whoptr = NULL;
/* NONE for physical, otherwise virtual */
@ -592,7 +591,6 @@ int vm_memset(endpoint_t who, phys_bytes ph, const u8_t c, phys_bytes bytes)
*/
if((pfa=phys_memset(ptr, p, chunk))) {
printf("kernel memset pagefault\n");
r = EFAULT;
break;
}
bytes -= chunk;

View file

@ -1168,7 +1168,6 @@ int try_deliver_senda(struct proc *caller_ptr,
for (i = 0; i < size; i++) {
/* Process each entry in the table and store the result in the table.
* If we're done handling a message, copy the result to the sender. */
int pending_recv = FALSE;
dst = NONE;
/* Copy message to kernel */
@ -1220,7 +1219,6 @@ int try_deliver_senda(struct proc *caller_ptr,
/* Inform receiver that something is pending */
set_sys_bit(priv(dst_ptr)->s_asyn_pending,
priv(caller_ptr)->s_id);
pending_recv = TRUE;
done = FALSE;
continue;
}

View file

@ -5,6 +5,7 @@
#include "fs.h"
#include <sys/stat.h>
#include <string.h>
#include <assert.h>
#include <minix/com.h>
#include "buf.h"
#include "inode.h"
@ -191,7 +192,7 @@ int fs_slink()
struct inode *ldirp; /* directory containing link */
register int r; /* error code */
char string[NAME_MAX]; /* last component of the new dir's path name */
char* link_target_buf; /* either sip->i_block or bp->b_data */
char* link_target_buf = NULL; /* either sip->i_block or bp->b_data */
struct buf *bp = NULL; /* disk buffer for link */
caller_uid = (uid_t) fs_m_in.REQ_UID;
@ -241,6 +242,7 @@ int fs_slink()
}
}
if (r == OK) {
assert(link_target_buf);
link_target_buf[fs_m_in.REQ_MEM_SIZE] = '\0';
sip->i_size = (off_t) strlen(link_target_buf);
if (sip->i_size != fs_m_in.REQ_MEM_SIZE) {

View file

@ -71,7 +71,7 @@ acc_t *pack;
ip_hdr_t *pack_hdr;
{
ip_ass_t *ass_ent;
size_t pack_hdr_len, pack_offset, tmp_offset;
size_t pack_offset, tmp_offset;
u16_t pack_flags_fragoff;
acc_t *prev_acc, *curr_acc, *next_acc, *head_acc, *tmp_acc;
ip_hdr_t *tmp_hdr;
@ -81,7 +81,6 @@ ip_hdr_t *pack_hdr;
pack_hdr->ih_proto, pack_hdr->ih_src, pack_hdr->ih_dst);
pack_flags_fragoff= ntohs(pack_hdr->ih_flags_fragoff);
pack_hdr_len= (pack_hdr->ih_vers_ihl & IH_IHL_MASK) * 4;
pack_offset= (pack_flags_fragoff & IH_FRAGOFF_MASK)*8;
pack->acc_ext_link= NULL;

View file

@ -34,15 +34,11 @@ size_t data_len;
{
tcp_fd_t *connuser;
int tcp_hdr_flags;
int ip_hdr_len, tcp_hdr_len;
u32_t seg_ack, seg_seq, rcv_hi, snd_una, snd_nxt;
u16_t seg_wnd, mtu;
size_t mss;
int acceptable_ACK, segm_acceptable, send_rst, close_connection;
ip_hdr_len= (ip_hdr->ih_vers_ihl & IH_IHL_MASK) << 2;
tcp_hdr_len= (tcp_hdr->th_data_off & TH_DO_MASK) >> 2;
tcp_hdr_flags= tcp_hdr->th_flags & TH_FLAGS_MASK;
seg_ack= ntohl(tcp_hdr->th_ack_nr);
seg_seq= ntohl(tcp_hdr->th_seq_nr);
@ -1394,12 +1390,9 @@ unsigned
tcp_sel_read(tcp_conn)
tcp_conn_t *tcp_conn;
{
tcp_fd_t *tcp_fd;
size_t data_size;
int fin_recv, urg, push;
tcp_fd= tcp_conn->tc_fd;
if (tcp_conn->tc_state == TCS_CLOSED)
return 1;
@ -1449,7 +1442,7 @@ int *bytesp;
{
tcp_conn_t *tcp_conn;
size_t data_size;
int fin_recv, urg, push;
int fin_recv, urg;
*bytesp= 0; /* The default is that nothing is available */
@ -1461,7 +1454,6 @@ int *bytesp;
return;
urg= tcp_Gmod4G(tcp_conn->tc_RCV_UP, tcp_conn->tc_RCV_LO);
push= (tcp_conn->tc_flags & TCF_RCV_PUSH);
fin_recv= (tcp_conn->tc_flags & TCF_FIN_RECV);
data_size= tcp_conn->tc_RCV_NXT-tcp_conn->tc_RCV_LO;

View file

@ -282,9 +282,9 @@ static int sr_rwio(m)
mq_t *m;
{
sr_fd_t *sr_fd;
mq_t **q_head_ptr, **q_tail_ptr;
int ip_flag, susp_flag, first_flag;
int r;
mq_t **q_head_ptr = NULL, **q_tail_ptr = NULL;
int ip_flag = 0, susp_flag = 0, first_flag = 0;
int r = OK;
ioreq_t request;
size_t size;

View file

@ -222,7 +222,7 @@ int do_shmctl(message *m)
int cmd = m->SHMCTL_CMD;
struct shmid_ds *ds = (struct shmid_ds *)m->SHMCTL_BUF;
struct shmid_ds tmp_ds;
struct shm_struct *shm;
struct shm_struct *shm = NULL;
struct shminfo sinfo;
struct shm_info s_info;
uid_t uid;

View file

@ -9,7 +9,7 @@
int fs_ftrunc(message *fs_m_in, message *fs_m_out)
{
struct inode *rip;
off_t start, end;
off_t start;
ino_t inumb;
inumb = (ino_t) fs_m_in->REQ_INODE_NR;
@ -17,7 +17,6 @@ int fs_ftrunc(message *fs_m_in, message *fs_m_out)
if( (rip = find_inode(inumb)) == NULL) return(EINVAL);
start = fs_m_in->REQ_TRC_START_LO;
end = fs_m_in->REQ_TRC_END_LO;
return truncate_inode(rip, start);
}

View file

@ -1092,7 +1092,6 @@ int do_getsockopt_peercred_old(message *dev_m_in, message *dev_m_out)
int do_getsockopt_sndbuf(message *dev_m_in, message *dev_m_out)
{
int minor;
int rc;
size_t sndbuf = PIPE_BUF;
@ -1102,8 +1101,6 @@ int do_getsockopt_sndbuf(message *dev_m_in, message *dev_m_out)
uds_minor(dev_m_in), ++call_count);
#endif
minor = uds_minor(dev_m_in);
rc = sys_safecopyto(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &(sndbuf), sizeof(size_t));
@ -1112,7 +1109,6 @@ int do_getsockopt_sndbuf(message *dev_m_in, message *dev_m_out)
int do_setsockopt_sndbuf(message *dev_m_in, message *dev_m_out)
{
int minor;
int rc;
size_t sndbuf;
@ -1122,9 +1118,6 @@ int do_setsockopt_sndbuf(message *dev_m_in, message *dev_m_out)
uds_minor(dev_m_in), ++call_count);
#endif
minor = uds_minor(dev_m_in);
rc = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &sndbuf,
sizeof(size_t));
@ -1146,7 +1139,6 @@ int do_setsockopt_sndbuf(message *dev_m_in, message *dev_m_out)
int do_getsockopt_rcvbuf(message *dev_m_in, message *dev_m_out)
{
int minor;
int rc;
size_t rcvbuf = PIPE_BUF;
@ -1156,8 +1148,6 @@ int do_getsockopt_rcvbuf(message *dev_m_in, message *dev_m_out)
uds_minor(dev_m_in), ++call_count);
#endif
minor = uds_minor(dev_m_in);
rc = sys_safecopyto(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &(rcvbuf), sizeof(size_t));
@ -1166,7 +1156,6 @@ int do_getsockopt_rcvbuf(message *dev_m_in, message *dev_m_out)
int do_setsockopt_rcvbuf(message *dev_m_in, message *dev_m_out)
{
int minor;
int rc;
size_t rcvbuf;
@ -1176,9 +1165,6 @@ int do_setsockopt_rcvbuf(message *dev_m_in, message *dev_m_out)
uds_minor(dev_m_in), ++call_count);
#endif
minor = uds_minor(dev_m_in);
rc = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) dev_m_in->IO_GRANT,
(vir_bytes) 0, (vir_bytes) &rcvbuf,
sizeof(size_t));

View file

@ -66,7 +66,7 @@ int do_newexec()
char *ptr;
struct mproc *rmp;
struct exec_info args;
int r, flags;
int r, flags = 0;
if (who_e != VFS_PROC_NR && who_e != RS_PROC_NR)
return EPERM;

View file

@ -1247,12 +1247,6 @@ int *length;
void share_exec(rp_dst, rp_src)
struct rproc *rp_dst, *rp_src;
{
struct rprocpub *rpub_src;
struct rprocpub *rpub_dst;
rpub_src = rp_src->r_pub;
rpub_dst = rp_dst->r_pub;
if(rs_verbose)
printf("RS: %s shares exec image with %s\n",
srv_to_string(rp_dst), srv_to_string(rp_src));

View file

@ -89,7 +89,6 @@ message *m_ptr; /* request message pointer */
int do_down(message *m_ptr)
{
register struct rproc *rp;
register struct rprocpub *rpub;
int s;
char label[RS_MAX_LABEL_LEN];
@ -107,7 +106,6 @@ int do_down(message *m_ptr)
printf("RS: do_down: service '%s' not found\n", label);
return(ESRCH);
}
rpub = rp->r_pub;
/* Check if the call can be allowed. */
if((s = check_call_permission(m_ptr->m_source, RS_DOWN, rp)) != OK)
@ -324,7 +322,6 @@ int do_edit(message *m_ptr)
int do_refresh(message *m_ptr)
{
register struct rproc *rp;
register struct rprocpub *rpub;
int s;
char label[RS_MAX_LABEL_LEN];
@ -342,7 +339,6 @@ int do_refresh(message *m_ptr)
printf("RS: do_refresh: service '%s' not found\n", label);
return(ESRCH);
}
rpub = rp->r_pub;
/* Check if the call can be allowed. */
if((s = check_call_permission(m_ptr->m_source, RS_REFRESH, rp)) != OK)
@ -833,7 +829,6 @@ void do_sigchld()
int status;
struct rproc *rp;
struct rproc **rps;
struct rprocpub *rpub;
int i, nr_rps;
if(rs_verbose)
@ -842,7 +837,6 @@ void do_sigchld()
while ( (pid = waitpid(-1, &status, WNOHANG)) != 0 ) {
rp = lookup_slot_by_pid(pid);
if(rp != NULL) {
rpub = rp->r_pub;
if(rs_verbose)
printf("RS: %s exited via another signal manager\n",

View file

@ -180,10 +180,6 @@ struct rproc *rp; /* pointer to process slot */
int code; /* status code */
{
/* If a caller is waiting for a reply, unblock it. */
struct rprocpub *rpub;
rpub = rp->r_pub;
if(rp->r_flags & RS_LATEREPLY) {
message m;
m.m_type = code;

View file

@ -304,11 +304,17 @@ static void dump_segments(struct filp *f, Elf_Phdr phdrs[], int phnum)
}
for (off = 0; off < (off_t) len; off += CLICK_SIZE) {
r = sys_vircopy(fp->fp_endpoint,
(vir_bytes) (seg_off + off),
vir_bytes p = (vir_bytes) (seg_off + off);
r = sys_vircopy(fp->fp_endpoint, p,
SELF, (vir_bytes) buf,
(phys_bytes) CLICK_SIZE);
if(r != OK) {
printf("VFS: vircopy failed for %d @ 0x%lx during coredump\n",
fp->fp_endpoint, p);
break;
}
write_buf(f, (char *) buf, (off + CLICK_SIZE <= (off_t) len) ?
CLICK_SIZE : (len - off));
}

View file

@ -330,14 +330,8 @@ static void unlock_pm(void)
/*===========================================================================*
* do_pm *
*===========================================================================*/
static void *do_pm(void *arg)
static void *do_pm(void *arg __unused)
{
struct job my_job;
struct fproc *rfp;
my_job = *((struct job *) arg);
rfp = fp = my_job.j_fp;
lock_pm();
service_pm();
unlock_pm();

View file

@ -30,8 +30,6 @@ inline int copy_name( size_t len, char *dest)
{
/* Go get path and put it in 'dest'.
*/
register char *rpu, *rpm;
if (len > PATH_MAX) { /* 'len' includes terminating-nul */
err_code = ENAMETOOLONG;
return(EGENERIC);
@ -45,8 +43,6 @@ inline int copy_name( size_t len, char *dest)
if (len <= M3_STRING) {
/* Just copy the path from the message */
rpu = &dest[0];
rpm = job_m_in.pathname; /* contained in input message */
strncpy(dest, job_m_in.pathname, len);
} else {
/* String is not contained in the message. */

View file

@ -78,7 +78,6 @@ int main(void)
message msg;
int result, who_e, rcv_sts;
int caller_slot;
struct vmproc *vmp_caller;
/* Initialize system so that all processes are runnable */
init_vm();
@ -112,7 +111,6 @@ int main(void)
who_e = msg.m_source;
if(vm_isokendpt(who_e, &caller_slot) != OK)
panic("invalid caller %d", who_e);
vmp_caller = &vmproc[caller_slot];
c = CALLNUMBER(msg.m_type);
result = ENOSYS; /* Out of range or restricted calls return this. */

View file

@ -35,7 +35,6 @@ int do_push_sig(message *msg)
int r, n;
endpoint_t ep;
vir_bytes sp;
struct vmproc *vmp;
ep = msg->VMPS_ENDPOINT;
@ -43,7 +42,6 @@ int do_push_sig(message *msg)
printf("VM: bogus endpoint %d from %d\n", ep, msg->m_source);
return r;
}
vmp = &vmproc[n];
if ((r=get_stack_ptr(ep, &sp)) != OK)
panic("couldn't get new stack pointer (for sig): %d", r);

View file

@ -3,5 +3,6 @@
FS=ext2fs
CLEANFILES= lib
CPPFLAGS+= -D_MINIX
CFLAGS+= -Os
.include <../Makefile.bootxx>