Re: [PATCH] fix compiler warnings in hurd/procfs
Hi! On Tue, 29 Dec 2015 23:11:26 +0100, Flavio Cruz wrote: > procfs: Fix compiler warnings. > > * include/sys/procfs.h: Change uintptr_t to vm_address_t. > * procfs/process.c: Fix format strings. > * procfs/rootdir.c: Add missing casts. (Note that the header file does not relate to the procfs translator.) > --- a/include/sys/procfs.h > +++ b/include/sys/procfs.h > @@ -63,8 +63,8 @@ struct elf_psinfo >char pr_psargs[ELF_PRARGSZ]; /* Initial part of argument list. */ >int pr_wstat; /* Zombie exit status (not really > used). */ >int pr_argc; /* The argument count at startup. */ > - uintptr_t pr_argv; /* Original argument vector address. */ > - uintptr_t pr_envp; /* Original environment vector address. */ > + vm_address_t pr_argv; /* Original argument vector address. */ > + vm_address_t pr_envp; /* Original environment vector address. > */ > }; > typedef struct elf_psinfo psinfo_t; Amended as follows. It may be some kind of layering/encapsulation/abstraction violation to be including a Mach header file in , but given that vm_address_t is a Mach type, it's what we should do. Maybe we shouldn't be using vm_address_t here, actually. commit 305e83c42624c8cf84452d5d0fa7669e2af6f997 Author: Thomas Schwinge Date: Mon May 23 11:23:57 2016 +0200 Make self-contained again Commit e914bfc3d6e5ddf6f8c5e93a4334873a48a24ddf made Autoconf/configure tests change as follows: checking sys/procfs.h usability... [-yes-]{+no+} checking sys/procfs.h presence... yes {+configure: WARNING: sys/procfs.h: present but cannot be compiled+} {+configure: WARNING: sys/procfs.h: check for missing prerequisite headers?+} {+configure: WARNING: sys/procfs.h: see the Autoconf documentation+} {+configure: WARNING: sys/procfs.h: section "Present But Cannot Be Compiled"+} {+configure: WARNING: sys/procfs.h: proceeding with the compiler's result+} checking for sys/procfs.h...[-yes-]{+no+} [-checking for prstatus_t in sys/procfs.h... no-] [-checking for prstatus32_t in sys/procfs.h... no-] [-checking for prstatus_t.pr_who in sys/procfs.h... no-] [-checking for prstatus32_t.pr_who in sys/procfs.h... no-] [-checking for pstatus_t in sys/procfs.h... yes-] [-checking for pxstatus_t in sys/procfs.h... no-] [-checking for pstatus32_t in sys/procfs.h... no-] [-checking for prpsinfo_t in sys/procfs.h... no-] [-checking for prpsinfo_t.pr_pid in sys/procfs.h... no-] [-checking for prpsinfo32_t in sys/procfs.h... no-] [-checking for prpsinfo32_t.pr_pid in sys/procfs.h... no-] [-checking for psinfo_t in sys/procfs.h... yes-] [-checking for psinfo_t.pr_pid in sys/procfs.h... yes-] [-checking for psinfo32_t in sys/procfs.h... no-] [-checking for psinfo32_t.pr_pid in sys/procfs.h... no-] [-checking for lwpstatus_t in sys/procfs.h... yes-] [-checking for lwpxstatus_t in sys/procfs.h... no-] [-checking for lwpstatus_t.pr_context in sys/procfs.h... no-] [-checking for lwpstatus_t.pr_reg in sys/procfs.h... yes-] [-checking for lwpstatus_t.pr_fpreg in sys/procfs.h... yes-] [-checking for win32_pstatus_t in sys/procfs.h... no-] That is because of: $ echo '#include ' | gcc -x c - -o /dev/null -S In file included from :1:0: /usr/include/sys/procfs.h:66:3: error: unknown type name ‘vm_address_t’ vm_address_t pr_argv; /* Original argument vector address. */ ^ /usr/include/sys/procfs.h:67:3: error: unknown type name ‘vm_address_t’ vm_address_t pr_envp; /* Original environment vector address. */ ^ * include/sys/procfs.h: Include to make file self-contained again. --- include/sys/procfs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git include/sys/procfs.h include/sys/procfs.h index 09d2030..4acc346 100644 --- include/sys/procfs.h +++ include/sys/procfs.h @@ -1,5 +1,5 @@ /* -- data structures describing ELF core file formats - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2015, 2016 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -29,6 +29,7 @@ #include #include +#include #include #include #include Grüße Thomas signature.asc Description: PGP signature
Re: [PATCH] fix compiler warnings in hurd/procfs
Applied, thanks!
[PATCH] fix compiler warnings in hurd/procfs
--- procfs: Fix compiler warnings. * include/sys/procfs.h: Change uintptr_t to vm_address_t. * procfs/process.c: Fix format strings. * procfs/rootdir.c: Add missing casts. diff --git a/include/sys/procfs.h b/include/sys/procfs.h index ec82308..09d2030 100644 --- a/include/sys/procfs.h +++ b/include/sys/procfs.h @@ -63,8 +63,8 @@ struct elf_psinfo char pr_psargs[ELF_PRARGSZ]; /* Initial part of argument list. */ int pr_wstat;/* Zombie exit status (not really used). */ int pr_argc; /* The argument count at startup. */ - uintptr_t pr_argv; /* Original argument vector address. */ - uintptr_t pr_envp; /* Original environment vector address. */ + vm_address_t pr_argv;/* Original argument vector address. */ + vm_address_t pr_envp;/* Original environment vector address. */ }; typedef struct elf_psinfo psinfo_t; diff --git a/procfs/process.c b/procfs/process.c index 2255bcd..ece37b7 100644 --- a/procfs/process.c +++ b/procfs/process.c @@ -149,7 +149,7 @@ process_file_gc_maps (struct proc_stat *ps, char **contents) if (err) break; - fprintf (s, "%0*x-%0*x %c%c%c%c %0*x %s %d ", + fprintf (s, "%0*lx-%0*lx %c%c%c%c %0*lx %s %d ", /* Address range. */ 2*sizeof s, addr, 2*sizeof s, addr + size, @@ -178,7 +178,7 @@ process_file_gc_maps (struct proc_stat *ps, char **contents) else mach_port_deallocate (mach_task_self (), obj); - fprintf (s, "[mem_obj=%d]\n", obj); + fprintf (s, "[mem_obj=%lu]\n", obj); } else fprintf (s, "\n"); diff --git a/procfs/rootdir.c b/procfs/rootdir.c index d68645e..1e9ec8f 100644 --- a/procfs/rootdir.c +++ b/procfs/rootdir.c @@ -432,7 +432,7 @@ rootdir_gc_slabinfo (void *hook, char **contents, ssize_t *contents_len) if (err) return err; - m = open_memstream (contents, contents_len); + m = open_memstream (contents, (size_t *) contents_len); if (m == NULL) { err = ENOMEM; @@ -467,8 +467,8 @@ rootdir_gc_slabinfo (void *hook, char **contents, ssize_t *contents_len) fclose (m); out: - vm_deallocate (mach_task_self (), - cache_info, cache_info_count * sizeof *cache_info); + vm_deallocate (mach_task_self (), (vm_address_t) cache_info, + cache_info_count * sizeof *cache_info); return err; } @@ -481,7 +481,7 @@ rootdir_gc_filesystems (void *hook, char **contents, ssize_t *contents_len) glob_t matches; FILE *m; - m = open_memstream (contents, contents_len); + m = open_memstream (contents, (size_t *) contents_len); if (m == NULL) return errno; @@ -574,7 +574,7 @@ rootdir_make_translated_node (void *dir_hook, const void *entry_hook) return np; } - np = procfs_make_node (entry_hook, entry_hook); + np = procfs_make_node (entry_hook, (void *) entry_hook); if (np == NULL) return NULL;