summaryrefslogtreecommitdiff
path: root/kern
diff options
context:
space:
mode:
Diffstat (limited to 'kern')
-rw-r--r--kern/boot_script.c21
-rw-r--r--kern/bootstrap.c12
-rw-r--r--kern/ipc_kobject.c2
-rw-r--r--kern/pc_sample.c2
-rw-r--r--kern/printf.c2
-rw-r--r--kern/printf.h2
-rw-r--r--kern/sched_prim.c2
-rw-r--r--kern/slab.c2
8 files changed, 23 insertions, 22 deletions
diff --git a/kern/boot_script.c b/kern/boot_script.c
index 9349126..aa6833b 100644
--- a/kern/boot_script.c
+++ b/kern/boot_script.c
@@ -17,7 +17,7 @@ struct sym
int type;
/* Symbol value. */
- int val;
+ long val;
/* For function symbols; type of value returned by function. */
int ret_type;
@@ -44,7 +44,7 @@ struct arg
int type;
/* Argument value. */
- int val;
+ long val;
};
/* List of commands. */
@@ -70,7 +70,7 @@ static int
create_task (struct cmd *cmd, int *val)
{
int err = boot_script_task_create (cmd);
- *val = (int) cmd->task;
+ *val = (long) cmd->task;
return err;
}
@@ -91,9 +91,9 @@ prompt_resume_task (struct cmd *cmd, int *val)
/* List of builtin symbols. */
static struct sym builtin_symbols[] =
{
- { "task-create", VAL_FUNC, (int) create_task, VAL_TASK, 0 },
- { "task-resume", VAL_FUNC, (int) resume_task, VAL_NONE, 1 },
- { "prompt-task-resume", VAL_FUNC, (int) prompt_resume_task, VAL_NONE, 1 },
+ { "task-create", VAL_FUNC, (long) create_task, VAL_TASK, 0 },
+ { "task-resume", VAL_FUNC, (long) resume_task, VAL_NONE, 1 },
+ { "prompt-task-resume", VAL_FUNC, (long) prompt_resume_task, VAL_NONE, 1 },
};
#define NUM_BUILTIN (sizeof (builtin_symbols) / sizeof (builtin_symbols[0]))
@@ -294,7 +294,8 @@ boot_script_parse_line (void *hook, char *cmdline)
for (p += 2;;)
{
char c;
- int i, val, type;
+ int i, type;
+ long val;
struct sym *s;
/* Parse symbol name. */
@@ -349,7 +350,7 @@ boot_script_parse_line (void *hook, char *cmdline)
if (! s->run_on_exec)
{
(error
- = ((*((int (*) (struct cmd *, int *)) s->val))
+ = ((*((int (*) (struct cmd *, long *)) s->val))
(cmd, &val)));
if (error)
goto bad;
@@ -371,7 +372,7 @@ boot_script_parse_line (void *hook, char *cmdline)
else if (s->type == VAL_NONE)
{
type = VAL_SYM;
- val = (int) s;
+ val = (long) s;
}
else
{
@@ -681,7 +682,7 @@ boot_script_define_function (const char *name, int ret_type,
if (sym)
{
sym->type = VAL_FUNC;
- sym->val = (int) func;
+ sym->val = (long) func;
sym->ret_type = ret_type;
sym->run_on_exec = ret_type == VAL_NONE;
}
diff --git a/kern/bootstrap.c b/kern/bootstrap.c
index 68f40b4..2b74073 100644
--- a/kern/bootstrap.c
+++ b/kern/bootstrap.c
@@ -154,19 +154,19 @@ void bootstrap_create()
/* Initialize boot script variables. We leak these send rights. */
losers = boot_script_set_variable
("host-port", VAL_PORT,
- (int)ipc_port_make_send(realhost.host_priv_self));
+ (long)ipc_port_make_send(realhost.host_priv_self));
if (losers)
panic ("cannot set boot-script variable host-port: %s",
boot_script_error_string (losers));
losers = boot_script_set_variable
("device-port", VAL_PORT,
- (int) ipc_port_make_send(master_device_port));
+ (long) ipc_port_make_send(master_device_port));
if (losers)
panic ("cannot set boot-script variable device-port: %s",
boot_script_error_string (losers));
losers = boot_script_set_variable ("kernel-command-line", VAL_STR,
- (int) kernel_cmdline);
+ (long) kernel_cmdline);
if (losers)
panic ("cannot set boot-script variable %s: %s",
"kernel-command-line", boot_script_error_string (losers));
@@ -185,12 +185,12 @@ void bootstrap_create()
get_compat_strings(flag_string, root_string);
losers = boot_script_set_variable ("boot-args", VAL_STR,
- (int) flag_string);
+ (long) flag_string);
if (losers)
panic ("cannot set boot-script variable %s: %s",
"boot-args", boot_script_error_string (losers));
losers = boot_script_set_variable ("root-device", VAL_STR,
- (int) root_string);
+ (long) root_string);
if (losers)
panic ("cannot set boot-script variable %s: %s",
"root-device", boot_script_error_string (losers));
@@ -232,7 +232,7 @@ void bootstrap_create()
if (eq == 0)
continue;
*eq++ = '\0';
- losers = boot_script_set_variable (word, VAL_STR, (int) eq);
+ losers = boot_script_set_variable (word, VAL_STR, (long) eq);
if (losers)
panic ("cannot set boot-script variable %s: %s",
word, boot_script_error_string (losers));
diff --git a/kern/ipc_kobject.c b/kern/ipc_kobject.c
index bd171a7..c922d7f 100644
--- a/kern/ipc_kobject.c
+++ b/kern/ipc_kobject.c
@@ -319,7 +319,7 @@ ipc_kobject_destroy(
default:
#if MACH_ASSERT
- printf("ipc_kobject_destroy: port 0x%p, kobj 0x%x, type %d\n",
+ printf("ipc_kobject_destroy: port 0x%p, kobj 0x%lx, type %d\n",
port, port->ip_kobject, ip_kotype(port));
#endif /* MACH_ASSERT */
break;
diff --git a/kern/pc_sample.c b/kern/pc_sample.c
index 2cec907..5700258 100644
--- a/kern/pc_sample.c
+++ b/kern/pc_sample.c
@@ -57,7 +57,7 @@ void take_pc_sample(
pc = interrupted_pc(t);
cp->seqno++;
sample = &((sampled_pc_t *)cp->buffer)[cp->seqno % MAX_PC_SAMPLES];
- sample->id = (natural_t)t;
+ sample->id = (vm_offset_t)t;
sample->pc = pc;
sample->sampletype = flavor;
}
diff --git a/kern/printf.c b/kern/printf.c
index 88a527b..658493c 100644
--- a/kern/printf.c
+++ b/kern/printf.c
@@ -601,7 +601,7 @@ snputc(char c, vm_offset_t arg)
}
int
-vsnprintf(char *buf, int size, const char *fmt, va_list args)
+vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
{
struct vsnprintf_cookie cookie
= { .buf = buf, .index = 0, .max_len = size };
diff --git a/kern/printf.h b/kern/printf.h
index 2268111..fcf2b3b 100644
--- a/kern/printf.h
+++ b/kern/printf.h
@@ -40,7 +40,7 @@ extern void printnum (unsigned long u, int base,
vm_offset_t putc_arg);
extern int sprintf (char *buf, const char *fmt, ...);
-extern int vsnprintf (char *buf, int size, const char *fmt, va_list args);
+extern int vsnprintf (char *buf, size_t size, const char *fmt, va_list args);
extern int printf (const char *fmt, ...);
diff --git a/kern/sched_prim.c b/kern/sched_prim.c
index 9d4e8af..a7b7a4e 100644
--- a/kern/sched_prim.c
+++ b/kern/sched_prim.c
@@ -146,7 +146,7 @@ decl_simple_lock_data(, wait_lock[NUMQUEUES])
/* NOTE: we want a small positive integer out of this */
#define wait_hash(event) \
- ((((int)(event) < 0) ? ~(int)(event) : (int)(event)) % NUMQUEUES)
+ ((((long)(event) < 0) ? ~(long)(event) : (long)(event)) % NUMQUEUES)
void wait_queue_init(void)
{
diff --git a/kern/slab.c b/kern/slab.c
index 38413e8..f95ec0b 100644
--- a/kern/slab.c
+++ b/kern/slab.c
@@ -1381,7 +1381,7 @@ void kalloc_init(void)
size = 1 << KALLOC_FIRST_SHIFT;
for (i = 0; i < ARRAY_SIZE(kalloc_caches); i++) {
- sprintf(name, "kalloc_%u", size);
+ sprintf(name, "kalloc_%lu", size);
kmem_cache_init(&kalloc_caches[i], name, size, 0, NULL,
kalloc_pagealloc, kalloc_pagefree, 0);
size <<= 1;