[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 55/75: fix compiler warnings in hurd/utils
From: |
Samuel Thibault |
Subject: |
[hurd] 55/75: fix compiler warnings in hurd/utils |
Date: |
Thu, 14 Jan 2016 01:04:10 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch dde
in repository hurd.
commit 5089d4a559eb3a0a0f008ad00ba8c5ed8bbc94c6
Author: Flavio Cruz <address@hidden>
Date: Tue Dec 29 23:15:01 2015 +0100
fix compiler warnings in hurd/utils
utils: Fix compiler warnings.
* utils/rpcscan.c (setup_extract_target): Remove name variable.
* utils/rpcscan.c (setup_extract_target): Fix bad initializer.
* utils/rpctrace.c (new_send_wrapper, wrap_all_threads, wrap_new_thread,
wrap_new_task, traced_spawn): Fix format strings.
* utils/rpctrace.c (trace_and_forward): Cast to unsigned int.
* utils/rpctrace.c (trace_and_forward): Use memcmp instead of pointer
dereferencing to compare structures.
* utils/rpctrace.c (wrap_all_threads): Cast to vm_address_t.
* utils/rpctrace.c (main): Fix bad initializer.
* utils/shd.c (run): Initialize save0.
* utils/vminfo.c: Fix format strings.
* utils/vmstat.c: Remove PSEP macro and expand the code.
* utils/w.c (add_utmp_procs): Remove unused pos variable.
---
utils/rpcscan.c | 3 +--
utils/rpctrace.c | 23 ++++++++++++-----------
utils/shd.c | 3 ++-
utils/vminfo.c | 22 +++++++++++-----------
utils/vmstat.c | 22 +++++++++++++++-------
utils/w.c | 3 +--
6 files changed, 42 insertions(+), 34 deletions(-)
diff --git a/utils/rpcscan.c b/utils/rpcscan.c
index 2270ea8..3ddf791 100644
--- a/utils/rpcscan.c
+++ b/utils/rpcscan.c
@@ -201,7 +201,6 @@ error_t
setup_extract_target (void)
{
error_t err;
- char *name = (char *) setup_argument;
mach_port_t request;
mach_msg_type_name_t requestType;
@@ -337,7 +336,7 @@ const struct argp_child children[] =
{ 0 }
};
-const struct argp argp = { options, parse_opt, args_doc, doc, &children };
+const struct argp argp = { options, parse_opt, args_doc, doc, children };
void
format_msgid (char *buf, size_t len, mach_msg_id_t id)
diff --git a/utils/rpctrace.c b/utils/rpctrace.c
index d53b510..276377c 100644
--- a/utils/rpctrace.c
+++ b/utils/rpctrace.c
@@ -353,7 +353,7 @@ new_send_wrapper (struct receiver_info *receive, task_t
task,
assert_perror (err);
TRACED_INFO (info)->name = 0;
- asprintf (&TRACED_INFO (info)->name, " %d<--%d(pid%d)",
+ asprintf (&TRACED_INFO (info)->name, " %lu<--%lu(pid%d)",
receive->forward, TRACED_INFO (info)->pi.port_right, task2pid
(task));
TRACED_INFO (info)->type = MACH_MSG_TYPE_MOVE_SEND;
info->task = task;
@@ -979,7 +979,7 @@ wrap_all_threads (task_t task)
task, &new_thread_port);
free (TRACED_INFO (thread_send_wrapper)->name);
asprintf (&TRACED_INFO (thread_send_wrapper)->name,
- "thread%d(pid%d)", threads[i], task2pid (task));
+ "thread%lu(pid%d)", threads[i], task2pid (task));
err = mach_port_insert_right (mach_task_self (),
new_thread_port, new_thread_port,
@@ -994,7 +994,8 @@ wrap_all_threads (task_t task)
mach_port_deallocate (mach_task_self (), new_thread_port);
}
}
- vm_deallocate (mach_task_self (), threads, nthreads * sizeof (thread_t));
+ vm_deallocate (mach_task_self (), (vm_address_t) threads,
+ nthreads * sizeof (thread_t));
}
/* Wrap the new thread port that is in the message. */
@@ -1030,7 +1031,7 @@ wrap_new_thread (mach_msg_header_t *inp, struct req_info
*req)
mach_port_deallocate (mach_task_self (), reply->child_thread);
free (TRACED_INFO (send_wrapper)->name);
- asprintf (&TRACED_INFO (send_wrapper)->name, "thread%d(pid%d)",
+ asprintf (&TRACED_INFO (send_wrapper)->name, "thread%lu(pid%d)",
thread_port, task2pid (req->from));
ports_port_deref (send_wrapper);
}
@@ -1077,10 +1078,10 @@ wrap_new_task (mach_msg_header_t *inp, struct req_info
*req)
pid = task2pid (task_port);
free (TRACED_INFO (task_wrapper1)->name);
- asprintf (&TRACED_INFO (task_wrapper1)->name, "task%d(pid%d)",
+ asprintf (&TRACED_INFO (task_wrapper1)->name, "task%lu(pid%d)",
task_port, task2pid (req->from));
free (TRACED_INFO (task_wrapper2)->name);
- asprintf (&TRACED_INFO (task_wrapper2)->name, "task%d(pid%d)",
+ asprintf (&TRACED_INFO (task_wrapper2)->name, "task%lu(pid%d)",
task_port, pid);
ports_port_deref (task_wrapper1);
}
@@ -1131,7 +1132,7 @@ trace_and_forward (mach_msg_header_t *inp,
mach_msg_header_t *outp)
MACH_MSGH_BITS_REMOTE (inp->msgh_bits),
is_notification (inp)? MACH_MSG_TYPE_MOVE_SEND_ONCE: info->type)
| MACH_MSGH_BITS_OTHER (inp->msgh_bits);
- inp->msgh_local_port = ports_payload_get_name (info);
+ inp->msgh_local_port = ports_payload_get_name ((unsigned int) info);
}
}
else
@@ -1276,8 +1277,8 @@ trace_and_forward (mach_msg_header_t *inp,
mach_msg_header_t *outp)
&& inp->msgh_size >= sizeof (mig_reply_header_t)
/* The notification message is considered as a request. */
&& (inp->msgh_id > 72 || inp->msgh_id < 64)
- && (*(int *) &((mig_reply_header_t *) inp)->RetCodeType
- == *(int *)&RetCodeType))
+ && !memcmp(&((mig_reply_header_t *) inp)->RetCodeType,
+ &RetCodeType, sizeof (RetCodeType)))
{
struct req_info *req = remove_request (inp->msgh_id - 100,
inp->msgh_remote_port);
@@ -1645,7 +1646,7 @@ traced_spawn (char **argv, char **envp)
ti = new_send_wrapper (receive_ti, traced_task, &task_wrapper);
ti->task = traced_task;
free (TRACED_INFO (ti)->name);
- asprintf (&TRACED_INFO (ti)->name, "task%d(pid%d)", traced_task, pid);
+ asprintf (&TRACED_INFO (ti)->name, "task%lu(pid%d)", traced_task, pid);
/* Replace the task's kernel port with the wrapper. When this task calls
`mach_task_self ()', it will get our wrapper send right instead of its
@@ -1741,7 +1742,7 @@ main (int argc, char **argv, char **envp)
{ .argp=&msgid_argp, },
{ 0 }
};
- const struct argp argp = { options, parse_opt, args_doc, doc, &children };
+ const struct argp argp = { options, parse_opt, args_doc, doc, children };
/* Parse our arguments. */
argp_parse (&argp, argc, argv, ARGP_IN_ORDER, 0, 0);
diff --git a/utils/shd.c b/utils/shd.c
index a1a4b26..feff613 100644
--- a/utils/shd.c
+++ b/utils/shd.c
@@ -106,7 +106,8 @@ run (char **argv, int fd0, int fd1)
}
else
{
- int save0, save1;
+ int save0 = -1;
+ int save1;
inline int movefd (int from, int to, int *save)
{
diff --git a/utils/vminfo.c b/utils/vminfo.c
index 6ead677..2718591 100644
--- a/utils/vminfo.c
+++ b/utils/vminfo.c
@@ -182,29 +182,29 @@ main (int argc, char **argv)
if ((what & (W_ADDRS|W_SIZES)) == (W_ADDRS|W_SIZES))
{
if (hex)
- printf (" [%#zx] (hole)\n", addr - hole_addr);
+ printf (" [%#lx] (hole)\n", addr - hole_addr);
else
- printf (" [%zd] (hole)\n", addr - hole_addr);
+ printf (" [%lu] (hole)\n", addr - hole_addr);
}
else if ((what & (W_ADDRS|W_SIZES)) == W_SIZES)
{
if (hex)
- printf ("%#10zx (hole)\n", addr - hole_addr);
+ printf ("%#10lx (hole)\n", addr - hole_addr);
else
- printf ("%10zu (hole)\n", addr - hole_addr);
+ printf ("%10lu (hole)\n", addr - hole_addr);
}
}
if ((what & (W_ADDRS|W_SIZES)) == (W_ADDRS|W_SIZES))
if (hex)
- printf ("%#10zx[%#zx]", addr, size);
+ printf ("%#10lx[%#zx]", addr, size);
else
- printf ("%10zu[%zd]", addr, size);
+ printf ("%10lu[%zd]", addr, size);
else if ((what & (W_ADDRS|W_SIZES)) == W_ADDRS)
if (hex)
- printf ("%#10zx", addr);
+ printf ("%#10lx", addr);
else
- printf ("%10zu", addr);
+ printf ("%10lu", addr);
else if ((what & (W_ADDRS|W_SIZES)) == W_SIZES)
{
if (hex)
@@ -222,13 +222,13 @@ main (int argc, char **argv)
if (shared)
printf (", shared");
if (obj != MACH_PORT_NULL)
- printf (", mem_obj=%d", obj);
+ printf (", mem_obj=%lu", obj);
if (offs != 0)
{
if (hex)
- printf (", offs=%#zx", offs);
+ printf (", offs=%#lx", offs);
else
- printf (", offs=%zd", offs);
+ printf (", offs=%lu", offs);
}
putchar (')');
}
diff --git a/utils/vmstat.c b/utils/vmstat.c
index 92a3672..bdd1d81 100644
--- a/utils/vmstat.c
+++ b/utils/vmstat.c
@@ -477,10 +477,6 @@ main (int argc, char **argv)
? size_units
\
: ((field)->type == PAGESZ ? 0 : state.vmstats.pagesize))
- /* Prints SEP if the variable FIRST is 0, otherwise, prints START (if
- it's non-zero), and sets first to 0. */
-#define PSEP(sep, start) \
- (first ? (first = 0, (start && fputs (start, stdout))) : fputs (sep,
stdout))
#define PVAL(val, field, width, sign) \
print_val (val, (field)->type, SIZE_UNITS (field), width, sign)
/* Intuit the likely maximum field width of FIELD. */
@@ -539,7 +535,13 @@ main (int argc, char **argv)
const_fields &= ~(1 << (field - fields));
else
{
- PSEP (", ", "(");
+ if (first)
+ {
+ first = 0;
+ fputs("(", stdout);
+ }
+ else
+ fputs(",", stdout);
printf ("%s: ", field->name);
PVAL (val, field, 0, 0);
}
@@ -570,7 +572,10 @@ main (int argc, char **argv)
for (field = fields, num = 0, first = 1; field->name; field++,
num++)
if (output_fields & (1 << (field - fields)))
{
- PSEP (" ", 0);
+ if (first)
+ first = 0;
+ else
+ fputs (" ", stdout);
fprintf (stdout, "%*s", fwidths[num], field->hdr);
}
putchar ('\n');
@@ -601,7 +606,10 @@ main (int argc, char **argv)
val -= vm_state_get_field (&prev_state, field);
}
- PSEP (" ", 0);
+ if (first)
+ first = 0;
+ else
+ fputs (" ", stdout);
PVAL (val, field, fwidths[num], sign);
}
}
diff --git a/utils/w.c b/utils/w.c
index 3755508..ac5e36f 100644
--- a/utils/w.c
+++ b/utils/w.c
@@ -258,7 +258,6 @@ add_utmp_procs (struct proc_stat_list *procs, struct utmp
*u)
io_t tty_node;
error_t err;
pid_t pid;
- int pos;
struct proc_stat *ps;
switch (u->ut_type)
@@ -300,7 +299,7 @@ add_utmp_procs (struct proc_stat_list *procs, struct utmp
*u)
}
/* The new process will get added at the end, so look for it there. */
- pos = proc_stat_list_num_procs (procs);
+ (void) proc_stat_list_num_procs (procs);
if (pid >= 0)
err = proc_stat_list_add_pid (procs, pid, &ps);
else
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 54/75: fix compiler warnings in hurd/trans, (continued)
- [hurd] 54/75: fix compiler warnings in hurd/trans, Samuel Thibault, 2016/01/13
- [hurd] 58/75: Define IO_OUTTRAN so that term_on_pty returns a mach_port_t, Samuel Thibault, 2016/01/13
- [hurd] 49/75: fix compiler warnings in hurd/nfs and hurd/nfsd, Samuel Thibault, 2016/01/13
- [hurd] 35/75: fix compiler warnings in hurd/console-client, Samuel Thibault, 2016/01/13
- [hurd] 40/75: fix compiler warnings in hurd/isofs, Samuel Thibault, 2016/01/13
- [hurd] 57/75: Add missing libraries to fix link errors, Samuel Thibault, 2016/01/13
- [hurd] 52/75: fix compiler warnings in hurd/random, Samuel Thibault, 2016/01/13
- [hurd] 62/75: fix mach-defpager static linking, Samuel Thibault, 2016/01/13
- [hurd] 60/75: Drop OTHERLIBS and use LDLIBS exclusively, Samuel Thibault, 2016/01/13
- [hurd] 63/75: allow pfinet to link using -O0, Samuel Thibault, 2016/01/13
- [hurd] 55/75: fix compiler warnings in hurd/utils,
Samuel Thibault <=
- [hurd] 48/75: drop the deprecated malloc/free hooks in hurd/mach-defpager, Samuel Thibault, 2016/01/13
- [hurd] 38/75: fix compiler warnings in hurd/ext2fs, Samuel Thibault, 2016/01/13
- [hurd] 39/75: fix compiler warnings in hurd/console-client, Samuel Thibault, 2016/01/13
- [hurd] 51/75: Include missing header file in hurd/proc, Samuel Thibault, 2016/01/13
- [hurd] 34/75: boot: Fix boot.c compiler warning., Samuel Thibault, 2016/01/13
- [hurd] 53/75: fix compiler warnings in hurd/startup, Samuel Thibault, 2016/01/13
- [hurd] 36/75: fix compiler warnings in hurd/daemons, Samuel Thibault, 2016/01/13
- [hurd] 37/75: fix compiler warnings in hurd/exec, Samuel Thibault, 2016/01/13
- [hurd] 44/75: fix compiler warnings in hurd/libihash, Samuel Thibault, 2016/01/13
- [hurd] 42/75: fix compiler warnings in hurd/isofs, Samuel Thibault, 2016/01/13