]> Zhao Yanbai Git Server - minix.git/commitdiff
libsys: resolve clang warnings 53/2853/1
authorDavid van Moolenbroek <david@minix3.org>
Tue, 30 Sep 2014 20:08:54 +0000 (20:08 +0000)
committerDavid van Moolenbroek <david@minix3.org>
Tue, 30 Sep 2014 20:08:54 +0000 (20:08 +0000)
Change-Id: Ic954ba8667b4d039172b8e0d2ec57674a479b8aa

21 files changed:
minix/include/env.h
minix/include/minix/sef.h
minix/lib/libsys/Makefile
minix/lib/libsys/arch/i386/Makefile.inc
minix/lib/libsys/arch/i386/sys_readbios.c
minix/lib/libsys/arch/i386/sys_sdevio.c
minix/lib/libsys/arch/i386/timing.c [deleted file]
minix/lib/libsys/env_get_prm.c
minix/lib/libsys/env_panic.c
minix/lib/libsys/getsysinfo.c
minix/lib/libsys/sched_start.c
minix/lib/libsys/sched_stop.c
minix/lib/libsys/sef.c
minix/lib/libsys/sef_fi.c
minix/lib/libsys/stacktrace.c
minix/lib/libsys/sys_getinfo.c
minix/lib/libsys/sys_safecopy.c
minix/lib/libsys/sys_vircopy.c
minix/lib/libsys/sysutil.h
minix/lib/libsys/vm_cache.c
minix/lib/libsys/vm_map_phys.c

index 7f9c6fd753abbfdf17805e9facfeca3914ca3247..2f60f42f07912ec499c7e83361045ef3e2d43abe 100644 (file)
@@ -1,4 +1,4 @@
 int env_parse(const char *env, const char *fmt, int field, long *param, long min,
        long max);
-void env_panic(const char *env);
+void __dead env_panic(const char *env);
 int env_prefix(char *env, char *prefix);
index 25434410deddff20c1f1e73877a48ed3fddba728..6fb69fad97e1a7b32a037ae0125838ed7f90e3cd 100644 (file)
@@ -10,7 +10,7 @@ void sef_startup(void);
 int sef_receive_status(endpoint_t src, message *m_ptr, int *status_ptr);
 endpoint_t sef_self(void);
 void sef_cancel(void);
-void sef_exit(int status);
+void __dead sef_exit(int status);
 #define sef_receive(src, m_ptr) sef_receive_status(src, m_ptr, NULL)
 
 /* SEF Debug. */
index 39535b912e32356fead669ea72b5274f7a90fb66..a73c58c8925c023ff19d1906496600b1f7bd5f2a 100644 (file)
@@ -1,9 +1,8 @@
-NOGCCERROR=yes
-NOCLANGERROR=yes
-
 # Makefile for libsys
 .include <bsd.own.mk>
 
+NOGCCERROR=yes
+
 CPPFLAGS+= -D_MINIX_SYSTEM -D_SYSTEM
 
 LIB=           sys
index e35b04bd596208bc8cb43a2505c5481d72328a39..9b9aa2d383a7c4dd5cff2fcb822bd48b0c7aebdc 100644 (file)
@@ -22,7 +22,6 @@ SRCS+=  \
         sys_voutb.c \
         sys_voutl.c \
         sys_voutw.c \
-        timing.c \
         tsc_util.c \
         vbox.c
 
index 497f3c4bf059cb8465516a88a1d9f26af838cfd3..49350acec597060ca64f6264c1e5d32647251f1e 100644 (file)
@@ -10,6 +10,6 @@ size_t size;                  /* Amount of data to read */
 
   m.m_lsys_krn_readbios.size = size;
   m.m_lsys_krn_readbios.addr = address;
-  m.m_lsys_krn_readbios.buf = buf;
+  m.m_lsys_krn_readbios.buf = (vir_bytes)buf;
   return(_kernel_call(SYS_READBIOS, &m));
 }
index 8516fb8dd660ffd2f78715777995dc479d091d91..c589f63f56c1754fffd438c4912075384c34c26b 100644 (file)
@@ -16,7 +16,7 @@ vir_bytes offset;                     /* offset from grant */
     m_io.m_lsys_krn_sys_sdevio.request = req;
     m_io.m_lsys_krn_sys_sdevio.port = port;
     m_io.m_lsys_krn_sys_sdevio.vec_endpt = proc_nr;
-    m_io.m_lsys_krn_sys_sdevio.vec_addr = buffer;
+    m_io.m_lsys_krn_sys_sdevio.vec_addr = (vir_bytes)buffer;
     m_io.m_lsys_krn_sys_sdevio.vec_size = count;
     m_io.m_lsys_krn_sys_sdevio.offset = offset;
 
diff --git a/minix/lib/libsys/arch/i386/timing.c b/minix/lib/libsys/arch/i386/timing.c
deleted file mode 100644 (file)
index 51acc7b..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-
-#include <minix/sysutil.h>
-#include <minix/syslib.h>
-#include <minix/config.h>
-#include <minix/const.h>
-#include <minix/minlib.h>
-
-#define HIGHCOUNT      0
-#define LOWCOUNT       1
-
-#define START          0
-#define END            1
-
-void util_timer_start(util_timingdata_t *timingdata, char *name)
-{
-       size_t i;
-
-       if(timingdata->names[0] == '\0') {
-               for(i = 0; i < sizeof(timingdata->names) && *name; i++)
-                       timingdata->names[i] = *name++;
-               timingdata->names[sizeof(timingdata->names)-1] = '\0';
-       }
-
-       if (timingdata->starttimes[HIGHCOUNT]) {
-               panic("restart timer?");
-               return;
-       }
-
-       read_tsc((u32_t *) &timingdata->starttimes[HIGHCOUNT],
-                (u32_t *) &timingdata->starttimes[LOWCOUNT]);
-}
-
-void util_timer_end(util_timingdata_t *timingdata)
-{
-       unsigned long h, l, d = 0;
-       int bin;
-
-       read_tsc((u32_t *) &h, (u32_t *) &l);
-       if (!timingdata->starttimes[HIGHCOUNT]) {
-               panic("timer stopped but not started");
-               return;
-       }
-       if (timingdata->starttimes[HIGHCOUNT] == h) {
-               d = (l - timingdata->starttimes[LOWCOUNT]);
-       } else if (timingdata->starttimes[HIGHCOUNT] == h-1 &&
-               timingdata->starttimes[LOWCOUNT] > l) {
-               d = ((ULONG_MAX - timingdata->starttimes[LOWCOUNT]) + l);
-       } else {
-               timingdata->misses++;
-               return;
-       }
-       timingdata->starttimes[HIGHCOUNT] = 0;
-       if (!timingdata->lock_timings_range[START] ||
-               d < timingdata->lock_timings_range[START] ||
-               d > timingdata->lock_timings_range[END]) {
-               int t;
-               if (!timingdata->lock_timings_range[START] ||
-                       d < timingdata->lock_timings_range[START])
-                       timingdata->lock_timings_range[START] = d;
-               if (!timingdata->lock_timings_range[END] ||
-                       d > timingdata->lock_timings_range[END])
-                       timingdata->lock_timings_range[END] = d;
-               for(t = 0; t < TIMING_POINTS; t++)
-                       timingdata->lock_timings[t] = 0;
-               timingdata->binsize =
-                (timingdata->lock_timings_range[END] -
-                timingdata->lock_timings_range[START])/(TIMING_POINTS+1);
-               if (timingdata->binsize < 1)
-                 timingdata->binsize = 1;
-               timingdata->resets++;
-       }
-       bin = (d-timingdata->lock_timings_range[START]) /
-               timingdata->binsize;
-       if (bin < 0 || bin >= TIMING_POINTS) {
-               /* not serious, but can't happen, so shouldn't */
-               panic("bin out of range: %d", bin);
-       } else {
-               timingdata->lock_timings[bin]++;
-               timingdata->measurements++;
-       }
-
-       return;
-}
index 590c6888a2f5bd7e785ca6aeb78f531e8f8853e9..de6d556b16ac37c8c27617ef0a406dace0253cea 100644 (file)
@@ -50,7 +50,7 @@ int env_get_param(const char *key, char *value, int max_len)
   m.m_lsys_krn_sys_getinfo.request = GET_MONPARAMS;
   m.m_lsys_krn_sys_getinfo.endpt = SELF;
   m.m_lsys_krn_sys_getinfo.val_len = sizeof(mon_params);
-  m.m_lsys_krn_sys_getinfo.val_ptr = mon_params;
+  m.m_lsys_krn_sys_getinfo.val_ptr = (vir_bytes)mon_params;
   if ((s=_kernel_call(SYS_GETINFO, &m)) != OK) {
        printf("SYS_GETINFO: %d (size %u)\n", s, sizeof(mon_params));
        return(s);
index 4ca0dcd42bca01d5db613061f5e909f921e121f1..6e0c9357fbc3d401881dc126079a281f119e02e8 100644 (file)
@@ -1,5 +1,6 @@
 #include "sysutil.h"
 #include <string.h>
+#include <env.h>
 
 /*=========================================================================*
  *                             env_panic                                  *
index 7154b5852c940dba5f1775a38a24ad87fe8ddbf7..8bdc1ec2694dceb577254fb4cd903566d70a25b3 100644 (file)
@@ -26,7 +26,7 @@ int getsysinfo(
 
   memset(&m, 0, sizeof(m));
   m.m_lsys_getsysinfo.what = what;
-  m.m_lsys_getsysinfo.where = where;
+  m.m_lsys_getsysinfo.where = (vir_bytes)where;
   m.m_lsys_getsysinfo.size = size;
   return _taskcall(who, call_nr, &m);
 }
index 1cd2e510e65b174b1024dd1afa0f5a62e0aa60cc..6cce480f48076c59abf443460bd3439612bcf67c 100644 (file)
@@ -2,13 +2,9 @@
 #include <assert.h>
 #include <machine/archtypes.h>
 #include <minix/timers.h>
+#include <minix/sched.h>
 #include <string.h>
 
-#include "kernel/config.h"
-#include "kernel/const.h"
-#include "kernel/type.h"
-#include "kernel/proc.h"
-
 /*===========================================================================*
  *                             sched_inherit                                *
  *===========================================================================*/
index 889a03bcc3a429cd6b5a5d2e973aa4068002ea09..d6ad73cdc5b4c44b83d0414044df8332f3662c9e 100644 (file)
@@ -1,6 +1,7 @@
 #include "syslib.h"
 #include <assert.h>
 #include <string.h>
+#include <minix/sched.h>
 
 /*===========================================================================*
  *                             sched_stop                                   *
index 389118719a7924b48aa9ddf15e7f3fd805cca4fa..c9bdd49d8aa26f125d1e429edc04dbc892b88c87 100644 (file)
@@ -17,6 +17,7 @@ int sef_self_receiving;
 /* Debug. */
 #if SEF_INIT_DEBUG || SEF_LU_DEBUG || SEF_PING_DEBUG || SEF_SIGNAL_DEBUG
 #define SEF_DEBUG_HEADER_MAXLEN 32
+static int sef_debug_init = 0;
 static time_t sef_debug_boottime = 0;
 static u32_t sef_debug_system_hz = 0;
 static time_t sef_debug_time_sec = 0;
@@ -239,7 +240,6 @@ void sef_exit(int status)
 /* System services use a special version of exit() that generates a
  * self-termination signal.
  */
-  message m;
 
   /* Ask the kernel to exit. */
   sys_exit();
@@ -262,40 +262,26 @@ static void sef_debug_refresh_params(void)
 {
 /* Refresh SEF debug params. */
   clock_t uptime;
-  int r;
 
-  /* Get boottime the first time. */
-  if(!sef_debug_boottime) {
-      r = sys_times(NONE, NULL, NULL, NULL, &sef_debug_boottime);
-      if ( r != OK) {
-          sef_debug_boottime = -1;
-      }
-  }
-
-  /* Get system hz the first time. */
-  if(!sef_debug_system_hz) {
-      r = sys_getinfo(GET_HZ, &sef_debug_system_hz,
-          sizeof(sef_debug_system_hz), 0, 0);
-      if ( r != OK) {
-          sef_debug_system_hz = -1;
-      }
+  /* Get boottime and system hz the first time. */
+  if(!sef_debug_init) {
+      if (sys_times(NONE, NULL, NULL, NULL, &sef_debug_boottime) != OK)
+         sef_debug_init = -1;
+      else if (sys_getinfo(GET_HZ, &sef_debug_system_hz,
+        sizeof(sef_debug_system_hz), 0, 0) != OK)
+         sef_debug_init = -1;
+      else
+         sef_debug_init = 1;
   }
 
   /* Get uptime. */
   uptime = -1;
-  if(sef_debug_boottime!=-1 && sef_debug_system_hz!=-1) {
-      r = sys_times(NONE, NULL, NULL, &uptime, NULL);
-      if ( r != OK) {
-            uptime = -1;
-      }
-  }
-
-  /* Compute current time. */
-  if(sef_debug_boottime==-1 || sef_debug_system_hz==-1 || uptime==-1) {
+  if (sef_debug_init < 1 || sys_times(NONE, NULL, NULL, &uptime, NULL) != OK) {
       sef_debug_time_sec = 0;
       sef_debug_time_us = 0;
   }
   else {
+      /* Compute current time. */
       sef_debug_time_sec = (time_t) (sef_debug_boottime
           + (uptime/sef_debug_system_hz));
       sef_debug_time_us = (uptime%sef_debug_system_hz)
index 36ae8d6f16f3a4fd92ce74f155448d62ccc7c811..9f5265969f12b5fb76e89c708da247617f76e179 100644 (file)
@@ -5,6 +5,8 @@
 
 EXTERN __attribute__((weak)) int edfi_ctl_process_request(void *ctl_request);
 
+EXTERN int do_sef_fi_request(message *m_ptr);
+
 /*===========================================================================*
  *                            do_sef_fi_request                             *
  *===========================================================================*/
index 8185956a92492aa1f838ab66afc245d688da5524..d7e87eb9c7140027525ce5ae728aa8199d22adac 100644 (file)
@@ -8,6 +8,7 @@ Copyright 1995 Philip Homburg
 
 #include <stdio.h>
 #include <string.h>
+#include <minix/sysutil.h>
 
 typedef unsigned int reg_t;
 
index a9a463d1ecabd67bc27deafdcf1229943cd96a58..1b1076bdf526346059a0c43c3df2ae19b17cfb27 100644 (file)
@@ -17,9 +17,9 @@ int len2;                             /* length or process nr */
 
     m.m_lsys_krn_sys_getinfo.request = request;
     m.m_lsys_krn_sys_getinfo.endpt = SELF;     /* always store values at caller */
-    m.m_lsys_krn_sys_getinfo.val_ptr = ptr;
+    m.m_lsys_krn_sys_getinfo.val_ptr = (vir_bytes)ptr;
     m.m_lsys_krn_sys_getinfo.val_len = len;
-    m.m_lsys_krn_sys_getinfo.val_ptr2 = ptr2;
+    m.m_lsys_krn_sys_getinfo.val_ptr2 = (vir_bytes)ptr2;
     m.m_lsys_krn_sys_getinfo.val_len2_e = len2;
 
     return(_kernel_call(SYS_GETINFO, &m));
index 2db46f9a87690d87631a8f5677847a06b6d4f8a0..1b097b24db4d734ec13cbb41cd3a26e58cddd2e9 100644 (file)
@@ -16,7 +16,7 @@ int sys_safecopyfrom(endpoint_t src_e,
   copy_mess.m_lsys_kern_safecopy.from_to = src_e;
   copy_mess.m_lsys_kern_safecopy.gid = gr_id;
   copy_mess.m_lsys_kern_safecopy.offset = offset;
-  copy_mess.m_lsys_kern_safecopy.address = address;
+  copy_mess.m_lsys_kern_safecopy.address = (void *)address;
   copy_mess.m_lsys_kern_safecopy.bytes = bytes;
 
   return(_kernel_call(SYS_SAFECOPYFROM, &copy_mess));
@@ -36,7 +36,7 @@ int sys_safecopyto(endpoint_t dst_e,
   copy_mess.m_lsys_kern_safecopy.from_to = dst_e;
   copy_mess.m_lsys_kern_safecopy.gid = gr_id;
   copy_mess.m_lsys_kern_safecopy.offset = offset;
-  copy_mess.m_lsys_kern_safecopy.address = address;
+  copy_mess.m_lsys_kern_safecopy.address = (void *)address;
   copy_mess.m_lsys_kern_safecopy.bytes = bytes;
 
   return(_kernel_call(SYS_SAFECOPYTO, &copy_mess));
index 28492950a78bcf3920388bf94e96510363656170..4ee5033ad6e7e4db3ddb73c3c999d0436ec034d3 100644 (file)
@@ -1,4 +1,5 @@
 #include "syslib.h"
+#include <string.h>
 
 int sys_vircopy(src_proc, src_vir, 
        dst_proc, dst_vir, bytes, flags)
index 497f755f9e15107b734dce40acbcec994f29fafe..88be29f594ebbd46bcc7f86655d99ae3eeac7b03 100644 (file)
@@ -1,7 +1,5 @@
 /*     sysutil.h - System library utilities.   */
 
-#define _SYSTEM
-
 #include <lib.h>               /* common to all libraries */
 #include <minix/com.h>         /* need task numbers + message types */
 #include <minix/syslib.h>      /* need ipc_sendrec, _taskcall, etc */
index 75a193be7636c8704bd9f54a32d4abcd04b9b67e..c94c1e2f8c6222875e455749ed360a33a8415326 100644 (file)
@@ -12,8 +12,9 @@
 #include <machine/param.h>
 #include <machine/vmparam.h>
 
-int vm_cachecall(message *m, int call, void *addr, dev_t dev, off_t dev_offset,
-       ino_t ino, off_t ino_offset, u32_t *flags, int blocksize)
+static int vm_cachecall(message *m, int call, void *addr, dev_t dev,
+       off_t dev_offset, ino_t ino, off_t ino_offset, u32_t *flags,
+       int blocksize)
 {
     if(blocksize % PAGE_SIZE)
        panic("blocksize %d should be a multiple of pagesize %d\n",
index 1635c0e6e49bc85e0956fef7cb81fc6bcc6af2cd..40b59f8583a259ebbeefaa507d9b85081b2bfe02 100644 (file)
@@ -13,7 +13,7 @@ vm_map_phys(endpoint_t who, void *phaddr, size_t len)
 
        memset(&m, 0, sizeof(m));
        m.m_lsys_vm_map_phys.ep = who;
-       m.m_lsys_vm_map_phys.phaddr = phaddr;
+       m.m_lsys_vm_map_phys.phaddr = (phys_bytes)phaddr;
        m.m_lsys_vm_map_phys.len = len;
 
        r = _taskcall(VM_PROC_NR, VM_MAP_PHYS, &m);