libsys: resolve clang warnings
Change-Id: Ic954ba8667b4d039172b8e0d2ec57674a479b8aa
This commit is contained in:
parent
d794ecc9ef
commit
685aa79304
21 changed files with 35 additions and 133 deletions
|
@ -1,4 +1,4 @@
|
||||||
int env_parse(const char *env, const char *fmt, int field, long *param, long min,
|
int env_parse(const char *env, const char *fmt, int field, long *param, long min,
|
||||||
long max);
|
long max);
|
||||||
void env_panic(const char *env);
|
void __dead env_panic(const char *env);
|
||||||
int env_prefix(char *env, char *prefix);
|
int env_prefix(char *env, char *prefix);
|
||||||
|
|
|
@ -10,7 +10,7 @@ void sef_startup(void);
|
||||||
int sef_receive_status(endpoint_t src, message *m_ptr, int *status_ptr);
|
int sef_receive_status(endpoint_t src, message *m_ptr, int *status_ptr);
|
||||||
endpoint_t sef_self(void);
|
endpoint_t sef_self(void);
|
||||||
void sef_cancel(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)
|
#define sef_receive(src, m_ptr) sef_receive_status(src, m_ptr, NULL)
|
||||||
|
|
||||||
/* SEF Debug. */
|
/* SEF Debug. */
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
NOGCCERROR=yes
|
|
||||||
NOCLANGERROR=yes
|
|
||||||
|
|
||||||
# Makefile for libsys
|
# Makefile for libsys
|
||||||
.include <bsd.own.mk>
|
.include <bsd.own.mk>
|
||||||
|
|
||||||
|
NOGCCERROR=yes
|
||||||
|
|
||||||
CPPFLAGS+= -D_MINIX_SYSTEM -D_SYSTEM
|
CPPFLAGS+= -D_MINIX_SYSTEM -D_SYSTEM
|
||||||
|
|
||||||
LIB= sys
|
LIB= sys
|
||||||
|
|
|
@ -22,7 +22,6 @@ SRCS+= \
|
||||||
sys_voutb.c \
|
sys_voutb.c \
|
||||||
sys_voutl.c \
|
sys_voutl.c \
|
||||||
sys_voutw.c \
|
sys_voutw.c \
|
||||||
timing.c \
|
|
||||||
tsc_util.c \
|
tsc_util.c \
|
||||||
vbox.c
|
vbox.c
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,6 @@ size_t size; /* Amount of data to read */
|
||||||
|
|
||||||
m.m_lsys_krn_readbios.size = size;
|
m.m_lsys_krn_readbios.size = size;
|
||||||
m.m_lsys_krn_readbios.addr = address;
|
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));
|
return(_kernel_call(SYS_READBIOS, &m));
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.request = req;
|
||||||
m_io.m_lsys_krn_sys_sdevio.port = port;
|
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_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.vec_size = count;
|
||||||
m_io.m_lsys_krn_sys_sdevio.offset = offset;
|
m_io.m_lsys_krn_sys_sdevio.offset = offset;
|
||||||
|
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
|
@ -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.request = GET_MONPARAMS;
|
||||||
m.m_lsys_krn_sys_getinfo.endpt = SELF;
|
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_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) {
|
if ((s=_kernel_call(SYS_GETINFO, &m)) != OK) {
|
||||||
printf("SYS_GETINFO: %d (size %u)\n", s, sizeof(mon_params));
|
printf("SYS_GETINFO: %d (size %u)\n", s, sizeof(mon_params));
|
||||||
return(s);
|
return(s);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "sysutil.h"
|
#include "sysutil.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <env.h>
|
||||||
|
|
||||||
/*=========================================================================*
|
/*=========================================================================*
|
||||||
* env_panic *
|
* env_panic *
|
||||||
|
|
|
@ -26,7 +26,7 @@ int getsysinfo(
|
||||||
|
|
||||||
memset(&m, 0, sizeof(m));
|
memset(&m, 0, sizeof(m));
|
||||||
m.m_lsys_getsysinfo.what = what;
|
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;
|
m.m_lsys_getsysinfo.size = size;
|
||||||
return _taskcall(who, call_nr, &m);
|
return _taskcall(who, call_nr, &m);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,9 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <machine/archtypes.h>
|
#include <machine/archtypes.h>
|
||||||
#include <minix/timers.h>
|
#include <minix/timers.h>
|
||||||
|
#include <minix/sched.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "kernel/config.h"
|
|
||||||
#include "kernel/const.h"
|
|
||||||
#include "kernel/type.h"
|
|
||||||
#include "kernel/proc.h"
|
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* sched_inherit *
|
* sched_inherit *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "syslib.h"
|
#include "syslib.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <minix/sched.h>
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* sched_stop *
|
* sched_stop *
|
||||||
|
|
|
@ -17,6 +17,7 @@ int sef_self_receiving;
|
||||||
/* Debug. */
|
/* Debug. */
|
||||||
#if SEF_INIT_DEBUG || SEF_LU_DEBUG || SEF_PING_DEBUG || SEF_SIGNAL_DEBUG
|
#if SEF_INIT_DEBUG || SEF_LU_DEBUG || SEF_PING_DEBUG || SEF_SIGNAL_DEBUG
|
||||||
#define SEF_DEBUG_HEADER_MAXLEN 32
|
#define SEF_DEBUG_HEADER_MAXLEN 32
|
||||||
|
static int sef_debug_init = 0;
|
||||||
static time_t sef_debug_boottime = 0;
|
static time_t sef_debug_boottime = 0;
|
||||||
static u32_t sef_debug_system_hz = 0;
|
static u32_t sef_debug_system_hz = 0;
|
||||||
static time_t sef_debug_time_sec = 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
|
/* System services use a special version of exit() that generates a
|
||||||
* self-termination signal.
|
* self-termination signal.
|
||||||
*/
|
*/
|
||||||
message m;
|
|
||||||
|
|
||||||
/* Ask the kernel to exit. */
|
/* Ask the kernel to exit. */
|
||||||
sys_exit();
|
sys_exit();
|
||||||
|
@ -262,40 +262,26 @@ static void sef_debug_refresh_params(void)
|
||||||
{
|
{
|
||||||
/* Refresh SEF debug params. */
|
/* Refresh SEF debug params. */
|
||||||
clock_t uptime;
|
clock_t uptime;
|
||||||
int r;
|
|
||||||
|
|
||||||
/* Get boottime the first time. */
|
/* Get boottime and system hz the first time. */
|
||||||
if(!sef_debug_boottime) {
|
if(!sef_debug_init) {
|
||||||
r = sys_times(NONE, NULL, NULL, NULL, &sef_debug_boottime);
|
if (sys_times(NONE, NULL, NULL, NULL, &sef_debug_boottime) != OK)
|
||||||
if ( r != OK) {
|
sef_debug_init = -1;
|
||||||
sef_debug_boottime = -1;
|
else if (sys_getinfo(GET_HZ, &sef_debug_system_hz,
|
||||||
}
|
sizeof(sef_debug_system_hz), 0, 0) != OK)
|
||||||
}
|
sef_debug_init = -1;
|
||||||
|
else
|
||||||
/* Get system hz the first time. */
|
sef_debug_init = 1;
|
||||||
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 uptime. */
|
/* Get uptime. */
|
||||||
uptime = -1;
|
uptime = -1;
|
||||||
if(sef_debug_boottime!=-1 && sef_debug_system_hz!=-1) {
|
if (sef_debug_init < 1 || sys_times(NONE, NULL, NULL, &uptime, NULL) != OK) {
|
||||||
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) {
|
|
||||||
sef_debug_time_sec = 0;
|
sef_debug_time_sec = 0;
|
||||||
sef_debug_time_us = 0;
|
sef_debug_time_us = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
/* Compute current time. */
|
||||||
sef_debug_time_sec = (time_t) (sef_debug_boottime
|
sef_debug_time_sec = (time_t) (sef_debug_boottime
|
||||||
+ (uptime/sef_debug_system_hz));
|
+ (uptime/sef_debug_system_hz));
|
||||||
sef_debug_time_us = (uptime%sef_debug_system_hz)
|
sef_debug_time_us = (uptime%sef_debug_system_hz)
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
|
|
||||||
EXTERN __attribute__((weak)) int edfi_ctl_process_request(void *ctl_request);
|
EXTERN __attribute__((weak)) int edfi_ctl_process_request(void *ctl_request);
|
||||||
|
|
||||||
|
EXTERN int do_sef_fi_request(message *m_ptr);
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
* do_sef_fi_request *
|
* do_sef_fi_request *
|
||||||
*===========================================================================*/
|
*===========================================================================*/
|
||||||
|
|
|
@ -8,6 +8,7 @@ Copyright 1995 Philip Homburg
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <minix/sysutil.h>
|
||||||
|
|
||||||
typedef unsigned int reg_t;
|
typedef unsigned int reg_t;
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,9 @@ int len2; /* length or process nr */
|
||||||
|
|
||||||
m.m_lsys_krn_sys_getinfo.request = request;
|
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.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_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;
|
m.m_lsys_krn_sys_getinfo.val_len2_e = len2;
|
||||||
|
|
||||||
return(_kernel_call(SYS_GETINFO, &m));
|
return(_kernel_call(SYS_GETINFO, &m));
|
||||||
|
|
|
@ -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.from_to = src_e;
|
||||||
copy_mess.m_lsys_kern_safecopy.gid = gr_id;
|
copy_mess.m_lsys_kern_safecopy.gid = gr_id;
|
||||||
copy_mess.m_lsys_kern_safecopy.offset = offset;
|
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;
|
copy_mess.m_lsys_kern_safecopy.bytes = bytes;
|
||||||
|
|
||||||
return(_kernel_call(SYS_SAFECOPYFROM, ©_mess));
|
return(_kernel_call(SYS_SAFECOPYFROM, ©_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.from_to = dst_e;
|
||||||
copy_mess.m_lsys_kern_safecopy.gid = gr_id;
|
copy_mess.m_lsys_kern_safecopy.gid = gr_id;
|
||||||
copy_mess.m_lsys_kern_safecopy.offset = offset;
|
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;
|
copy_mess.m_lsys_kern_safecopy.bytes = bytes;
|
||||||
|
|
||||||
return(_kernel_call(SYS_SAFECOPYTO, ©_mess));
|
return(_kernel_call(SYS_SAFECOPYTO, ©_mess));
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "syslib.h"
|
#include "syslib.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
int sys_vircopy(src_proc, src_vir,
|
int sys_vircopy(src_proc, src_vir,
|
||||||
dst_proc, dst_vir, bytes, flags)
|
dst_proc, dst_vir, bytes, flags)
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
/* sysutil.h - System library utilities. */
|
/* sysutil.h - System library utilities. */
|
||||||
|
|
||||||
#define _SYSTEM
|
|
||||||
|
|
||||||
#include <lib.h> /* common to all libraries */
|
#include <lib.h> /* common to all libraries */
|
||||||
#include <minix/com.h> /* need task numbers + message types */
|
#include <minix/com.h> /* need task numbers + message types */
|
||||||
#include <minix/syslib.h> /* need ipc_sendrec, _taskcall, etc */
|
#include <minix/syslib.h> /* need ipc_sendrec, _taskcall, etc */
|
||||||
|
|
|
@ -12,8 +12,9 @@
|
||||||
#include <machine/param.h>
|
#include <machine/param.h>
|
||||||
#include <machine/vmparam.h>
|
#include <machine/vmparam.h>
|
||||||
|
|
||||||
int vm_cachecall(message *m, int call, void *addr, dev_t dev, off_t dev_offset,
|
static int vm_cachecall(message *m, int call, void *addr, dev_t dev,
|
||||||
ino_t ino, off_t ino_offset, u32_t *flags, int blocksize)
|
off_t dev_offset, ino_t ino, off_t ino_offset, u32_t *flags,
|
||||||
|
int blocksize)
|
||||||
{
|
{
|
||||||
if(blocksize % PAGE_SIZE)
|
if(blocksize % PAGE_SIZE)
|
||||||
panic("blocksize %d should be a multiple of pagesize %d\n",
|
panic("blocksize %d should be a multiple of pagesize %d\n",
|
||||||
|
|
|
@ -13,7 +13,7 @@ vm_map_phys(endpoint_t who, void *phaddr, size_t len)
|
||||||
|
|
||||||
memset(&m, 0, sizeof(m));
|
memset(&m, 0, sizeof(m));
|
||||||
m.m_lsys_vm_map_phys.ep = who;
|
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;
|
m.m_lsys_vm_map_phys.len = len;
|
||||||
|
|
||||||
r = _taskcall(VM_PROC_NR, VM_MAP_PHYS, &m);
|
r = _taskcall(VM_PROC_NR, VM_MAP_PHYS, &m);
|
||||||
|
|
Loading…
Reference in a new issue