Applied, thanks! Flavio Cruz, le sam. 08 avril 2023 01:03:31 -0400, a ecrit: > Most of the changes land in one of these buckets: > * Removed unused declarations. > * Used (void) to represent no parameters instead of () which means an > undeterminate number of parameters. > * Included missing header files whenever necessary (stdlib.h, > sys/mman.h, etc) > * Typedefed function pointers to be able to fully declare the parameter > types. > * Added declarations of library functions that are used elsewhere > (example is libps/ps.h). > * Made functions static whenever they are only used in that file. > * Forwarded declarations of some methods that were made static. > --- > Makeconf | 1 + > boot/boot.c | 9 ++-- > console-client/xkb/parser.y | 6 +-- > console-client/xkb/xkb.h | 2 +- > daemons/getty.c | 4 +- > eth-multiplexer/vdev.h | 6 +-- > ext2fs/ext2fs.h | 6 +-- > fatfs/fatfs.h | 2 +- > libdiskfs/boot-start.c | 2 +- > libdiskfs/diskfs.h | 14 +++--- > libfshelp/fshelp.h | 1 + > libnetfs/fsys-get-children.c | 1 + > libports/manage-multithread.c | 2 +- > libports/ports.h | 2 +- > libps/proclist.c | 6 +-- > libps/ps.h | 48 +++++++++++++++++--- > libps/spec.c | 70 +++++++++++++++-------------- > libshouldbeinlibc/idvec-verify.c | 12 ++++- > libshouldbeinlibc/ugids.h | 2 +- > libtrivfs/dyn-classes.c | 4 +- > libtrivfs/trivfs.h | 12 ++--- > lwip/port/include/netif/hurdethif.h | 2 +- > lwip/port/include/netif/hurdtunif.h | 2 +- > lwip/startup.h | 2 +- > mach-defpager/default_pager.c | 11 ++--- > mach-defpager/default_pager.h | 5 ++- > mach-defpager/main.c | 4 -- > mach-defpager/wiring.h | 6 +-- > nfs/main.c | 2 +- > nfs/mount.c | 4 +- > pfinet/stubs.c | 2 +- > pflocal/sock.h | 4 +- > pflocal/sserver.h | 2 +- > term/devio.c | 2 +- > term/hurdio.c | 2 +- > term/term.h | 2 +- > trans/firmlink.c | 2 +- > utils/rpcscan.c | 2 +- > utils/w.c | 8 +--- > 39 files changed, 161 insertions(+), 115 deletions(-) > > diff --git a/Makeconf b/Makeconf > index b6acd382..c2bf9926 100644 > --- a/Makeconf > +++ b/Makeconf > @@ -79,6 +79,7 @@ CPPFLAGS += $(INCLUDES) \ > -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 \ > $($*-CPPFLAGS) > CFLAGS += -std=gnu99 $(gnu89-inline-CFLAGS) -Wall > -Werror=old-style-definition \ > + -Werror=implicit-function-declaration > -Werror=strict-prototypes \ > -g -O3 -fno-strict-aliasing $($*-CFLAGS) > > # Include the configure-generated file of parameters. > diff --git a/boot/boot.c b/boot/boot.c > index 93dd9386..ac5ecbd5 100644 > --- a/boot/boot.c > +++ b/boot/boot.c > @@ -147,9 +147,6 @@ int console_mscount; > vm_address_t fs_stack_base; > vm_size_t fs_stack_size; > > -void init_termstate (); > -void restore_termstate (); > - > char *fsname; > > char bootstrap_args[100] = "-"; > @@ -273,8 +270,8 @@ boot_demuxer (mach_msg_header_t *inp, > return FALSE; > } > > -void read_reply (); > -void * msg_thread (void *); > +static void read_reply (void); > +static void * msg_thread (void *); > > const char *argp_program_version = STANDARD_HURD_VERSION (boot); > > @@ -836,7 +833,7 @@ queue_read (enum read_type type, > static int should_read = 0; > > /* Reply to a queued read. */ > -void > +static void > read_reply (void) > { > int avail; > diff --git a/console-client/xkb/parser.y b/console-client/xkb/parser.y > index 8f265681..c8ba404e 100644 > --- a/console-client/xkb/parser.y > +++ b/console-client/xkb/parser.y > @@ -27,7 +27,7 @@ static error_t include_section (char *incl, int > sectionsymbol, char *dirname, > mergemode); > static error_t include_sections (char *incl, int sectionsymbol, char > *dirname, > mergemode); > -void close_include (); > +void close_include (void); > static void skipsection (void); > static error_t set_default_action (struct xkb_action *, struct xkb_action > **); > static void key_set_keysym (struct key *key, group_t group, int level, > @@ -1234,8 +1234,8 @@ include_section (char *incl, int sectionsymbol, char > *dirname, > mergemode new_mm) > { > void include_file (FILE *, mergemode, char *); > - int scanner_get_current_location (); > - const char* scanner_get_current_file (); > + int scanner_get_current_location (void); > + const char* scanner_get_current_file (void); > > char *filename; > char *sectionname = NULL; > diff --git a/console-client/xkb/xkb.h b/console-client/xkb/xkb.h > index e38b5ae7..bfc93a53 100644 > --- a/console-client/xkb/xkb.h > +++ b/console-client/xkb/xkb.h > @@ -404,7 +404,7 @@ int vmod_find (char *vmodname); > error_t vmod_add (char *vmodname); > > /* Initialize the list for keysyms to realmodifiers mappings. */ > -void ksrm_init (); > +void ksrm_init (void); > > /* Add keysym to realmodifier mapping. */ > error_t ksrm_add (symbol ks, int rmod); > diff --git a/daemons/getty.c b/daemons/getty.c > index 3b0adc48..b5b162d5 100644 > --- a/daemons/getty.c > +++ b/daemons/getty.c > @@ -36,8 +36,8 @@ > #include <sys/ioctl.h> > #include <termios.h> > > -/* XXX */ > -extern char *localhost (); > +/* XXX: should include directly from libshouldbeinlibc */ > +extern char *localhost (void); > > #define _PATH_LOGIN "/bin/login" > #define _PATH_ISSUE "/etc/issue" > diff --git a/eth-multiplexer/vdev.h b/eth-multiplexer/vdev.h > index 113bb514..40e4a176 100644 > --- a/eth-multiplexer/vdev.h > +++ b/eth-multiplexer/vdev.h > @@ -62,15 +62,15 @@ struct vether_device > typedef int (*dev_act_func) (struct vether_device *); > > int serv_connect (mach_port_t port); > -int serv_disconnect (); > +int serv_disconnect (void); > struct vether_device *lookup_dev_by_name (const char *name); > int remove_dead_port_from_dev (mach_port_t dead_port); > struct vether_device *add_vdev (char *name, size_t size); > void destroy_vdev (void *port); > -boolean_t all_dev_close (); > +boolean_t all_dev_close (void); > int broadcast_pack (char *data, int datalen, struct vether_device > *from_vdev); > int broadcast_msg (struct net_rcv_msg *msg); > -int get_dev_num (); > +int get_dev_num (void); > int foreach_dev_do (dev_act_func func); > > /* dev_stat.c */ > diff --git a/ext2fs/ext2fs.h b/ext2fs/ext2fs.h > index c17cf37c..99e93555 100644 > --- a/ext2fs/ext2fs.h > +++ b/ext2fs/ext2fs.h > @@ -307,13 +307,13 @@ extern vm_address_t zeroblock; > > /* Get the superblock from the disk, point `sblock' to it, and setup > various global info from it. */ > -void get_hypermetadata (); > +void get_hypermetadata (void); > > /* Map `group_desc_image' pointers to disk cache. Also, establish a > non-exported mapping to the superblock that will be used by > diskfs_set_hypermetadata to update the superblock from the cache > `sblock' points to. */ > -void map_hypermetadata (); > +void map_hypermetadata (void); > > /* ---------------------------------------------------------------- */ > /* Random stuff calculated from the super block. */ > @@ -444,7 +444,7 @@ _dino_deref (struct ext2_inode *inode) > /* inode.c */ > > /* Write all active disknodes into the inode pager. */ > -void write_all_disknodes (); > +void write_all_disknodes (void); > > /* ---------------------------------------------------------------- */ > > diff --git a/fatfs/fatfs.h b/fatfs/fatfs.h > index 54c3426a..9e5dc563 100644 > --- a/fatfs/fatfs.h > +++ b/fatfs/fatfs.h > @@ -126,7 +126,7 @@ void resume_fat_pager (void); > > void flush_node_pager (struct node *node); > > -void write_all_disknodes (); > +void write_all_disknodes (void); > > error_t fat_get_next_cluster (cluster_t cluster, cluster_t *next_cluster); > void fat_to_unix_filename (const char *, char *); > diff --git a/libdiskfs/boot-start.c b/libdiskfs/boot-start.c > index 7aaf3669..e8c09bcb 100644 > --- a/libdiskfs/boot-start.c > +++ b/libdiskfs/boot-start.c > @@ -52,7 +52,7 @@ static pthread_cond_t execstarted; > > const char *diskfs_boot_init_program = _HURD_STARTUP; > > -static void start_execserver (); > +static void start_execserver (void); > > char **diskfs_argv = 0; > > diff --git a/libdiskfs/diskfs.h b/libdiskfs/diskfs.h > index a9d1f6bb..be4061b4 100644 > --- a/libdiskfs/diskfs.h > +++ b/libdiskfs/diskfs.h > @@ -532,7 +532,7 @@ void diskfs_sync_everything (int wait); > > /* Shutdown all pagers; this is done when the filesystem is exiting and is > irreversable. */ > -void diskfs_shutdown_pager (); > +void diskfs_shutdown_pager (void); > > /* The user must define this function. Return a memory object port (send > right) for the file contents of NP. PROT is the maximum allowable > @@ -542,11 +542,11 @@ mach_port_t diskfs_get_filemap (struct node *np, > vm_prot_t prot); > /* The user must define this function. Return true if there are pager > ports exported that might be in use by users. If this returns false, then > further pager creation is also blocked. */ > -int diskfs_pager_users (); > +int diskfs_pager_users (void); > > /* Return the bitwise or of the maximum prot parameter (the second arg to > diskfs_get_filemap) for all active user pagers. */ > -vm_prot_t diskfs_max_user_pager_prot (); > +vm_prot_t diskfs_max_user_pager_prot (void); > > /* The user must define this function. Return a `struct pager *' suitable > for use as an argument to diskfs_register_memory_fault_area that > @@ -565,7 +565,7 @@ void diskfs_readonly_changed (int readonly); > It is always called with DISKFS_READONLY true. diskfs_node_reload is > subsequently called on all active nodes, so this call needn't re-read any > node-specific data. */ > -error_t diskfs_reload_global_state (); > +error_t diskfs_reload_global_state (void); > > /* The user must define this function. It must re-read all data specific to > NODE from disk, without writing anything. It is always called with > @@ -644,7 +644,7 @@ void diskfs_spawn_first_thread (ports_demuxer_type > demuxer); > /* Once diskfs_root_node is set, call this if we are a bootstrap > filesystem. If you call this, then the library will call > diskfs_init_completed once it has a valid proc and auth port. */ > -void diskfs_start_bootstrap (); > +void diskfs_start_bootstrap (void); > > /* Node NP now has no more references; clean all state. NP must be > locked. */ > @@ -1067,7 +1067,7 @@ error_t diskfs_set_readonly (int readonly); > /* Re-read all incore data structures from disk. This will only work if > DISKFS_READONLY is true. DISKFS_FSYS_LOCK should be held while calling > this routine. */ > -error_t diskfs_remount (); > +error_t diskfs_remount (void); > > /* Called by S_fsys_startup for execserver bootstrap. The execserver > is able to function without a real node, hence this fraud. Arguments > @@ -1158,7 +1158,7 @@ struct store *diskfs_init_main (struct argp > *startup_argp, > underlying filesystem. */ > > /* Make errors go somewhere reasonable. */ > -void diskfs_console_stdio (); > +void diskfs_console_stdio (void); > > > /* The following extracts from io_S.h and fs_S.h catch loff_t erroneously > diff --git a/libfshelp/fshelp.h b/libfshelp/fshelp.h > index aa48867e..8ecfbd57 100644 > --- a/libfshelp/fshelp.h > +++ b/libfshelp/fshelp.h > @@ -37,6 +37,7 @@ > #include <hurd/iohelp.h> > #include <sys/stat.h> > #include <maptime.h> > +#include <stdlib.h> > #include <fcntl.h> > > > diff --git a/libnetfs/fsys-get-children.c b/libnetfs/fsys-get-children.c > index 9c5a8f95..1f57efab 100644 > --- a/libnetfs/fsys-get-children.c > +++ b/libnetfs/fsys-get-children.c > @@ -21,6 +21,7 @@ > #include "fsys_S.h" > > #include <argz.h> > +#include <sys/mman.h> > > /* Return any active child translators. NAMES is an argz vector > containing file names relative to the root of the translator. > diff --git a/libports/manage-multithread.c b/libports/manage-multithread.c > index d42cf97a..d138092b 100644 > --- a/libports/manage-multithread.c > +++ b/libports/manage-multithread.c > @@ -104,7 +104,7 @@ ports_manage_port_operations_multithread (struct > port_bucket *bucket, > ports_demuxer_type demuxer, > int thread_timeout, > int global_timeout, > - void (*hook)()) > + void (*hook)(void)) > { > /* totalthreads is the number of total threads created. nreqthreads > is the number of threads not currently servicing any client. The > diff --git a/libports/ports.h b/libports/ports.h > index 2d6f6a60..c0f0a22a 100644 > --- a/libports/ports.h > +++ b/libports/ports.h > @@ -436,7 +436,7 @@ void ports_interrupt_rpcs (void *port); > > /* If the current thread's rpc has been interrupted with > ports_interrupt_rpcs, return true (and clear the interrupted flag). */ > -int ports_self_interrupted (); > +int ports_self_interrupted (void); > > /* Add RPC to the list of rpcs that have been interrupted. */ > void _ports_record_interruption (struct rpc_info *rpc); > diff --git a/libps/proclist.c b/libps/proclist.c > index c9ceaf0a..814ae30e 100644 > --- a/libps/proclist.c > +++ b/libps/proclist.c > @@ -459,9 +459,7 @@ proc_stat_list_filter (struct proc_stat_list *pp, > error_t > proc_stat_list_sort1 (struct proc_stat_list *pp, > const struct ps_getter *getter, > - int (*cmp_fn)(struct proc_stat *ps1, > - struct proc_stat *ps2, > - const struct ps_getter *getter), > + proc_stat_cmp_fun cmp_fn, > int reverse) > { > int needs = ps_getter_needs (getter); > @@ -521,7 +519,7 @@ error_t > proc_stat_list_sort (struct proc_stat_list *pp, > const struct ps_fmt_spec *key, int reverse) > { > - int (*cmp_fn)() = ps_fmt_spec_compare_fn (key); > + proc_stat_cmp_fun cmp_fn = ps_fmt_spec_compare_fn (key); > if (cmp_fn == NULL) > return EINVAL; > else > diff --git a/libps/ps.h b/libps/ps.h > index 2725b1f4..a3c938e1 100644 > --- a/libps/ps.h > +++ b/libps/ps.h > @@ -535,7 +535,7 @@ struct ps_getter > > /* A function that will get the value; the protocol between this function > and its caller is type-dependent. */ > - void (*fn) (); > + void (*fn) (void); > }; > > /* Access macros: */ > @@ -987,15 +987,17 @@ error_t proc_stat_list_filter1 (struct proc_stat_list > *pp, > error_t proc_stat_list_filter (struct proc_stat_list *pp, > const struct ps_filter *filter, int invert); > > +typedef int (*proc_stat_cmp_fun)(struct proc_stat *ps1, > + struct proc_stat *ps2, > + const struct ps_getter *getter); > + > /* Destructively sort proc_stats in PP by ascending value of the field > returned by GETTER, and compared by CMP_FN; If REVERSE is true, use the > opposite order. If a fatal error occurs, the error code is returned, it > returns 0. */ > error_t proc_stat_list_sort1 (struct proc_stat_list *pp, > const struct ps_getter *getter, > - int (*cmp_fn)(struct proc_stat *ps1, > - struct proc_stat *ps2, > - const struct ps_getter *getter), > + proc_stat_cmp_fun cmp_fn, > int reverse); > > /* Destructively sort proc_stats in PP by ascending value of the field KEY; > @@ -1044,7 +1046,7 @@ int proc_stat_list_spec_nominal (struct proc_stat_list > *pp, > information on the data types these routines return. */ > > /* Return the current host port. */ > -mach_port_t ps_get_host (); > +mach_port_t ps_get_host (void); > > /* Return a pointer to basic info about the current host in HOST_INFO. Since > this is static global information we just use a static buffer. If a > @@ -1062,4 +1064,40 @@ error_t ps_host_sched_info (host_sched_info_t > *host_info); > to). If a system error occurs, the error code is returned, otherwise 0. > */ > error_t ps_host_load_info (host_load_info_t *host_info); > > +error_t ps_emit_string (struct proc_stat *ps, struct ps_fmt_field *field, > + struct ps_stream *stream); > + > +/* Returns 1 if string from GETTER is empty or -. */ > +int ps_nominal_string (struct proc_stat *ps, const struct ps_getter *getter); > + > +/* Emits user name from FIELD into STREAM. */ > +error_t > +ps_emit_user_name (struct proc_stat *ps, struct ps_fmt_field *field, > + struct ps_stream *stream); > + > +/* Emits time from FIELD into STREAM. */ > +error_t > +ps_emit_past_time (struct proc_stat *ps, struct ps_fmt_field *field, > + struct ps_stream *stream); > + > +/* Emits minutes from FIELD into STREAM. */ > +error_t > +ps_emit_minutes (struct proc_stat *ps, struct ps_fmt_field *field, > + struct ps_stream *stream); > + > +/* Emits minutes from FIELD into STREAM. */ > +int > +ps_cmp_times (struct proc_stat *ps1, struct proc_stat *ps2, > + const struct ps_getter *getter); > + > +/* Compares the times between PS1 and PS2 using GETTER. */ > +int > +ps_cmp_strings (struct proc_stat *ps1, struct proc_stat *ps2, > + const struct ps_getter *getter); > + > +/* Compares user names of PS1 and PS2 using GETTER. */ > +int > +ps_cmp_unames (struct proc_stat *ps1, struct proc_stat *ps2, > + const struct ps_getter *getter); > + > #endif /* __PS_H__ */ > diff --git a/libps/spec.c b/libps/spec.c > index adca2e9c..dec57044 100644 > --- a/libps/spec.c > +++ b/libps/spec.c > @@ -46,7 +46,7 @@ static char *get_rpc_name (mach_msg_id_t it) > /* ---------------------------------------------------------------- */ > /* Getter definitions */ > > -typedef void (*vf)(); > +typedef void (*vf)(struct proc_stat *); > > static int > ps_get_pid (struct proc_stat *ps) > @@ -387,25 +387,29 @@ const struct ps_getter ps_comm_getter = > /* some printing functions */ > > /* G () is a helpful macro that just returns the getter G's access function > - cast into a function pointer returning TYPE, as how the function should be > + cast into a function pointer with type TYPE, as how the function should be > called varies depending on the getter. */ > -#define G(getter,type) ((type (*)())((getter)->fn)) > +#define G(getter,type) ((type)((getter)->fn)) > + > +#define G_PROC_STAT(getter, type) G(getter, type (*)(struct proc_stat *)) > > /* Similar to G, but takes a fmt field and uses its getter. */ > #define FG(field,type) G(field->spec->getter, type) > > +#define FG_PROC_STAT(field,type) FG(field, type (*)(struct proc_stat *)) > + > error_t > ps_emit_int (struct proc_stat *ps, struct ps_fmt_field *field, > struct ps_stream *stream) > { > - return ps_stream_write_int_field (stream, FG (field, int)(ps), > field->width); > + return ps_stream_write_int_field (stream, FG_PROC_STAT (field, int)(ps), > field->width); > } > > error_t > ps_emit_nz_int (struct proc_stat *ps, struct ps_fmt_field *field, > struct ps_stream *stream) > { > - int value = FG (field, int)(ps); > + int value = FG_PROC_STAT (field, int)(ps); > if (value) > return ps_stream_write_int_field (stream, value, field->width); > else > @@ -418,7 +422,7 @@ ps_emit_priority (struct proc_stat *ps, struct > ps_fmt_field *field, > { > return > ps_stream_write_int_field (stream, > - MACH_PRIORITY_TO_NICE (FG (field, int)(ps)), > + MACH_PRIORITY_TO_NICE (FG_PROC_STAT (field, > int)(ps)), > field->width); > } > > @@ -427,7 +431,7 @@ ps_emit_num_blocks (struct proc_stat *ps, struct > ps_fmt_field *field, > struct ps_stream *stream) > { > char buf[20]; > - sprintf(buf, "%d", FG (field, int)(ps) / 1024); > + sprintf(buf, "%d", FG_PROC_STAT (field, int)(ps) / 1024); > return ps_stream_write_field (stream, buf, field->width); > } > > @@ -471,7 +475,7 @@ ps_emit_percent (struct proc_stat *ps, struct > ps_fmt_field *field, > { > char buf[20]; > int width = field->width; > - float perc = FG (field, float)(ps) * 100; > + float perc = FG_PROC_STAT (field, float)(ps) * 100; > > if (width == 0) > sprintf (buf, "%g", perc); > @@ -489,7 +493,7 @@ ps_emit_nice_size_t (struct proc_stat *ps, struct > ps_fmt_field *field, > struct ps_stream *stream) > { > char buf[20]; > - size_t value = FG (field, size_t)(ps); > + size_t value = FG_PROC_STAT (field, size_t)(ps); > char *sfx = " KMG"; > size_t frac = 0; > > @@ -515,7 +519,7 @@ ps_emit_seconds (struct proc_stat *ps, struct > ps_fmt_field *field, > struct timeval tv; > int width = field->width, prec = field->precision; > > - FG (field, void)(ps, &tv); > + FG (field, void (*)(struct proc_stat *, struct timeval *))(ps, &tv); > > if ((field->flags & PS_FMT_FIELD_COLON_MOD) && tv.tv_sec == 0) > strcpy (buf, "-"); > @@ -534,7 +538,7 @@ ps_emit_minutes (struct proc_stat *ps, struct > ps_fmt_field *field, > struct timeval tv; > int width = field->width; > > - FG (field, void)(ps, &tv); > + FG (field, void (*)(struct proc_stat *, struct timeval *))(ps, &tv); > > if ((field->flags & PS_FMT_FIELD_COLON_MOD) && tv.tv_sec < 60) > strcpy (buf, "-"); > @@ -554,7 +558,7 @@ ps_emit_past_time (struct proc_stat *ps, struct > ps_fmt_field *field, > struct timeval tv; > int width = field->width; > > - FG (field, void)(ps, &tv); > + FG (field, void (*)(struct proc_stat *, struct timeval *))(ps, &tv); > > if (now.tv_sec == 0 && gettimeofday (&now, 0) < 0) > return errno; > @@ -568,7 +572,7 @@ error_t > ps_emit_uid (struct proc_stat *ps, struct ps_fmt_field *field, > struct ps_stream *stream) > { > - int uid = FG (field, int)(ps); > + int uid = FG_PROC_STAT (field, int)(ps); > if (uid < 0) > return ps_stream_write_field (stream, "-", field->width); > else > @@ -580,7 +584,7 @@ ps_emit_uname (struct proc_stat *ps, struct ps_fmt_field > *field, > struct ps_stream *stream) > { > int width = field->width; > - struct ps_user *u = FG (field, struct ps_user *)(ps); > + struct ps_user *u = FG_PROC_STAT (field, struct ps_user *)(ps); > if (u) > { > struct passwd *pw = ps_user_passwd (u); > @@ -598,7 +602,7 @@ ps_emit_user_name (struct proc_stat *ps, struct > ps_fmt_field *field, > struct ps_stream *stream) > { > int width = field->width; > - struct ps_user *u = FG (field, struct ps_user *)(ps); > + struct ps_user *u = FG_PROC_STAT (field, struct ps_user *)(ps); > if (u) > { > struct passwd *pw = ps_user_passwd (u); > @@ -627,7 +631,7 @@ ps_emit_args (struct proc_stat *ps, struct ps_fmt_field > *field, > char static_buf[200]; > char *buf = static_buf; > > - FG (field, void)(ps, &s0, &s0len); > + FG (field, void (*)(struct proc_stat *, char **, int *))(ps, &s0, &s0len); > > if (!s0 || s0len == 0 ) > strcpy (buf, "-"); > @@ -669,7 +673,7 @@ ps_emit_string (struct proc_stat *ps, struct ps_fmt_field > *field, > char *str; > int len; > > - FG (field, void)(ps, &str, &len); > + FG (field, void (*)(struct proc_stat *, char **, int *))(ps, &str, &len); > > if (!str || len == 0) > str = "-"; > @@ -682,7 +686,7 @@ ps_emit_tty_name (struct proc_stat *ps, struct > ps_fmt_field *field, > struct ps_stream *stream) > { > const char *name = "-"; > - struct ps_tty *tty = FG (field, struct ps_tty *)(ps); > + struct ps_tty *tty = FG_PROC_STAT (field, struct ps_tty *)(ps); > > if (tty) > { > @@ -727,7 +731,7 @@ ps_emit_state (struct proc_stat *ps, struct ps_fmt_field > *field, > struct ps_stream *stream) > { > char *tags; > - int raw_state = FG (field, int)(ps); > + int raw_state = FG (field, int (*)(struct proc_stat *))(ps); > int state = raw_state; > char buf[20], *p = buf; > const struct state_shadow *shadow = state_shadows; > @@ -758,7 +762,7 @@ ps_emit_wait (struct proc_stat *ps, struct ps_fmt_field > *field, > char *wait; > char buf[80]; > > - FG (field, void)(ps, &wait, &rpc); > + FG (field, void (*)(struct proc_stat *, char **, int *))(ps, &wait, &rpc); > > if (wait == 0) > return ps_stream_write_field (stream, "?", field->width); > @@ -834,7 +838,7 @@ int > ps_cmp_ints (struct proc_stat *ps1, struct proc_stat *ps2, > const struct ps_getter *getter) > { > - int (*gf)() = G (getter, int); > + int (*gf)(struct proc_stat *) = G_PROC_STAT (getter, int); > int v1 = gf(ps1), v2 = gf (ps2); > return v1 == v2 ? 0 : v1 < v2 ? -1 : 1; > } > @@ -843,7 +847,7 @@ int > ps_cmp_floats (struct proc_stat *ps1, struct proc_stat *ps2, > const struct ps_getter *getter) > { > - float (*gf)() = G (getter, float); > + float (*gf)(struct proc_stat *) = G_PROC_STAT (getter, float); > float v1 = gf(ps1), v2 = gf (ps2); > return v1 == v2 ? 0 : v1 < v2 ? -1 : 1; > } > @@ -852,7 +856,7 @@ int > ps_cmp_size_ts (struct proc_stat *ps1, struct proc_stat *ps2, > const struct ps_getter *getter) > { > - size_t (*gf)() = G (getter, size_t); > + size_t (*gf)(struct proc_stat *) = G_PROC_STAT (getter, size_t); > size_t v1 = gf(ps1), v2 = gf (ps2); > return v1 == v2 ? 0 : v1 < v2 ? -1 : 1; > } > @@ -861,7 +865,7 @@ int > ps_cmp_uids (struct proc_stat *ps1, struct proc_stat *ps2, > const struct ps_getter *getter) > { > - struct ps_user *(*gf)() = G (getter, struct ps_user *); > + struct ps_user *(*gf)(struct proc_stat *) = G_PROC_STAT (getter, struct > ps_user *); > struct ps_user *u1 = gf (ps1), *u2 = gf (ps2); > return (u1 ? ps_user_uid (u1) : -1) - (u2 ? ps_user_uid (u2) : -1); > } > @@ -870,7 +874,7 @@ int > ps_cmp_unames (struct proc_stat *ps1, struct proc_stat *ps2, > const struct ps_getter *getter) > { > - struct ps_user *(*gf)() = G (getter, struct ps_user *); > + struct ps_user *(*gf)(struct proc_stat *) = G_PROC_STAT (getter, struct > ps_user *); > struct ps_user *u1 = gf (ps1), *u2 = gf (ps2); > struct passwd *pw1 = u1 ? ps_user_passwd (u1) : 0; > struct passwd *pw2 = u2 ? ps_user_passwd (u2) : 0; > @@ -881,7 +885,7 @@ int > ps_cmp_strings (struct proc_stat *ps1, struct proc_stat *ps2, > const struct ps_getter *getter) > { > - void (*gf)() = G (getter, void); > + void (*gf)(struct proc_stat *, char **, int *) = G (getter, void > (*)(struct proc_stat *, char **, int *)); > char *s1, *s2; > int s1len, s2len; > > @@ -896,7 +900,7 @@ int > ps_cmp_times (struct proc_stat *ps1, struct proc_stat *ps2, > const struct ps_getter *getter) > { > - void (*g)() = G (getter, void); > + void (*g)(struct proc_stat *, struct timeval *) = G (getter, void > (*)(struct proc_stat *, struct timeval *)); > struct timeval tv1, tv2; > > g (ps1, &tv1); > @@ -917,7 +921,7 @@ ps_cmp_times (struct proc_stat *ps1, struct proc_stat > *ps2, > int > ps_nominal_zint (struct proc_stat *ps, const struct ps_getter *getter) > { > - return G (getter, int)(ps) == 0; > + return G_PROC_STAT (getter, int)(ps) == 0; > } > > /* Neither is an empty string. */ > @@ -926,7 +930,7 @@ ps_nominal_string (struct proc_stat *ps, const struct > ps_getter *getter) > { > char *str; > size_t len; > - G (getter, char *)(ps, &str, &len); > + G (getter, char *(*)(struct proc_stat *, char **, size_t *))(ps, &str, > &len); > return !str || len == 0 || (len == 1 && *str == '-'); > } > > @@ -935,7 +939,7 @@ ps_nominal_string (struct proc_stat *ps, const struct > ps_getter *getter) > int > ps_nominal_pri (struct proc_stat *ps, const struct ps_getter *getter) > { > - return MACH_PRIORITY_TO_NICE(G (getter, int)(ps)) == 0; > + return MACH_PRIORITY_TO_NICE(G_PROC_STAT (getter, int)(ps)) == 0; > } > > /* Hurd processes usually have 2 threads; XXX is there someplace we get get > @@ -943,7 +947,7 @@ ps_nominal_pri (struct proc_stat *ps, const struct > ps_getter *getter) > int > ps_nominal_nth (struct proc_stat *ps, const struct ps_getter *getter) > { > - return G (getter, int)(ps) == 2; > + return G_PROC_STAT (getter, int)(ps) == 2; > } > > static int own_uid = -2; /* -1 means no uid at all. */ > @@ -952,7 +956,7 @@ static int own_uid = -2; /* -1 means no uid at all. */ > int > ps_nominal_user (struct proc_stat *ps, const struct ps_getter *getter) > { > - struct ps_user *u = G (getter, struct ps_user *)(ps); > + struct ps_user *u = G_PROC_STAT (getter, struct ps_user *)(ps); > if (own_uid == -2) > own_uid = getuid (); > return own_uid >= 0 && u && u->uid == own_uid; > @@ -962,7 +966,7 @@ ps_nominal_user (struct proc_stat *ps, const struct > ps_getter *getter) > int > ps_nominal_uid (struct proc_stat *ps, const struct ps_getter *getter) > { > - uid_t uid = G (getter, uid_t)(ps); > + uid_t uid = G_PROC_STAT (getter, uid_t)(ps); > if (own_uid == -2) > own_uid = getuid (); > return own_uid >= 0 && uid == own_uid; > diff --git a/libshouldbeinlibc/idvec-verify.c > b/libshouldbeinlibc/idvec-verify.c > index 1c4bc494..64d3c573 100644 > --- a/libshouldbeinlibc/idvec-verify.c > +++ b/libshouldbeinlibc/idvec-verify.c > @@ -36,7 +36,17 @@ > > #define SHADOW_PASSWORD_STRING "x" /* pw_passwd contents for shadow > passwd */ > > -static error_t verify_id (); /* FWD */ > +/* Forward declaration */ > +static error_t > +verify_id (uid_t id, int is_group, int multiple, > + char *(*getpass_fn) (const char *prompt, > + uid_t id, int is_group, > + void *pwd_or_grp, void *hook), > + void *getpass_hook, > + error_t (*verify_fn) (const char *password, > + uid_t id, int is_group, > + void *pwd_or_grp, void *hook), > + void *verify_hook); > > /* Get a password from the user, returning it in malloced storage. */ > static char * > diff --git a/libshouldbeinlibc/ugids.h b/libshouldbeinlibc/ugids.h > index 5d0e1134..37a8668f 100644 > --- a/libshouldbeinlibc/ugids.h > +++ b/libshouldbeinlibc/ugids.h > @@ -50,7 +50,7 @@ struct ugids > #define UGIDS_INIT { IDVEC_INIT, IDVEC_INIT, IDVEC_INIT, IDVEC_INIT, > IDVEC_INIT, IDVEC_INIT } > > /* Return a new ugids structure, or 0 if an allocation error occurs. */ > -struct ugids *make_ugids (); > +struct ugids *make_ugids (void); > > extern void ugids_fini (struct ugids *ugids); > > diff --git a/libtrivfs/dyn-classes.c b/libtrivfs/dyn-classes.c > index edc13a0f..ad72192b 100644 > --- a/libtrivfs/dyn-classes.c > +++ b/libtrivfs/dyn-classes.c > @@ -23,7 +23,7 @@ > /* Auxiliary info for each vector element. */ > struct aux > { > - void (*free_el)(); > + void (*free_el)(void *); > unsigned refs; > }; > > @@ -63,7 +63,7 @@ static pthread_mutex_t dyn_lock = PTHREAD_MUTEX_INITIALIZER; > cases: (1) An error is encountered trying to grow one of the vectors, (2) > when the element is eventually freed by drop_el. */ > static error_t > -add_el (void *el, void (*free_el)(), > +add_el (void *el, void (*free_el)(void *), > void *vec_v, struct aux **aux_vec, > size_t *sz, size_t *num) > { > diff --git a/libtrivfs/trivfs.h b/libtrivfs/trivfs.h > index 4802f5fc..25b601ff 100644 > --- a/libtrivfs/trivfs.h > +++ b/libtrivfs/trivfs.h > @@ -146,11 +146,7 @@ extern void (*trivfs_protid_destroy_hook) (struct > trivfs_protid *); > is about to be destroyed. */ > extern void (*trivfs_peropen_destroy_hook) (struct trivfs_peropen *); > > -/* If this variable is set, it is called by trivfs_S_fsys_getroot before any > - other processing takes place; if the return value is EAGAIN, normal trivfs > - getroot processing continues, otherwise the rpc returns with that return > - value. */ > -extern error_t (*trivfs_getroot_hook) (struct trivfs_control *cntl, > +typedef error_t (*trivfs_getroot_hook_fun) (struct trivfs_control *cntl, > mach_port_t reply_port, > mach_msg_type_name_t reply_port_type, > mach_port_t dotdot, > @@ -159,6 +155,12 @@ extern error_t (*trivfs_getroot_hook) (struct > trivfs_control *cntl, > retry_type *do_retry, char *retry_name, > mach_port_t *node, mach_msg_type_name_t > *node_type); > > +/* If this variable is set, it is called by trivfs_S_fsys_getroot before any > + other processing takes place; if the return value is EAGAIN, normal trivfs > + getroot processing continues, otherwise the rpc returns with that return > + value. */ > +extern trivfs_getroot_hook_fun trivfs_getroot_hook; > + > /* Creates a control port for this filesystem and sends it to BOOTSTRAP with > fsys_startup. CONTROL_CLASS & CONTROL_BUCKET are passed to the ports > library to create the control port, and PROTID_CLASS & PROTID_BUCKET are > diff --git a/lwip/port/include/netif/hurdethif.h > b/lwip/port/include/netif/hurdethif.h > index 0ecbbd91..d4c70c41 100644 > --- a/lwip/port/include/netif/hurdethif.h > +++ b/lwip/port/include/netif/hurdethif.h > @@ -34,6 +34,6 @@ typedef struct ifcommon hurdethif; > err_t hurdethif_device_init (struct netif *netif); > > /* Module initialization */ > -error_t hurdethif_module_init (); > +error_t hurdethif_module_init (void); > > #endif /* LWIP_HURDETHIF_H */ > diff --git a/lwip/port/include/netif/hurdtunif.h > b/lwip/port/include/netif/hurdtunif.h > index 43d55348..eef7ecb0 100644 > --- a/lwip/port/include/netif/hurdtunif.h > +++ b/lwip/port/include/netif/hurdtunif.h > @@ -60,6 +60,6 @@ extern struct port_class *tunnel_class; > err_t hurdtunif_device_init (struct netif *netif); > > /* Module initialization */ > -error_t hurdtunif_module_init (); > +error_t hurdtunif_module_init (void); > > #endif /* LWIP_HURDTUNIF_H */ > diff --git a/lwip/startup.h b/lwip/startup.h > index 0c197bf0..75b909c5 100644 > --- a/lwip/startup.h > +++ b/lwip/startup.h > @@ -21,6 +21,6 @@ > #ifndef LWIP_STARTUP_H > #define LWIP_STARTUP_H > > -void arrange_shutdown_notification (); > +void arrange_shutdown_notification (void); > > #endif /* LWIP_STARTUP_H */ > diff --git a/mach-defpager/default_pager.c b/mach-defpager/default_pager.c > index b8158b35..0e7f20ed 100644 > --- a/mach-defpager/default_pager.c > +++ b/mach-defpager/default_pager.c > @@ -2762,11 +2762,12 @@ boolean_t > default_pager_notify_server(mach_msg_header_t *in, mach_msg_header_t * > return TRUE; > } > > -extern boolean_t seqnos_memory_object_default_server(); > -extern boolean_t default_pager_server(); > -extern boolean_t exc_server(); > -extern boolean_t bootstrap_server(); > -extern void bootstrap_compat(); > +extern boolean_t seqnos_memory_object_default_server(mach_msg_header_t > *in, > + mach_msg_header_t *out); > +extern boolean_t default_pager_server(mach_msg_header_t *in, > + mach_msg_header_t *out); > +extern boolean_t exc_server(mach_msg_header_t *in, > + mach_msg_header_t *out); > > mach_msg_size_t default_pager_msg_size_object = 128; > > diff --git a/mach-defpager/default_pager.h b/mach-defpager/default_pager.h > index 9de3b551..97d2a343 100644 > --- a/mach-defpager/default_pager.h > +++ b/mach-defpager/default_pager.h > @@ -24,7 +24,10 @@ > > #include <file_io.h> > > -void partition_init(); > +void default_pager(void); > +void default_pager_initialize(mach_port_t host_port); > + > +void partition_init(void); > > void create_paging_partition(const char *name, struct file_direct *fdp, > int isa_file, int linux_signature); > diff --git a/mach-defpager/main.c b/mach-defpager/main.c > index f70b42f0..8fbe2adc 100644 > --- a/mach-defpager/main.c > +++ b/mach-defpager/main.c > @@ -54,10 +54,6 @@ const char *defpager_server_name = "mach-defpager"; > mach_port_t bootstrap_master_device_port; /* local name */ > mach_port_t bootstrap_master_host_port; /* local name */ > > -extern void default_pager(); > -extern void default_pager_initialize(); > -extern void default_pager_setup(); > - > /* initialized in default_pager_initialize */ > extern mach_port_t default_pager_exception_port; > > diff --git a/mach-defpager/wiring.h b/mach-defpager/wiring.h > index e545834d..9d99f33a 100644 > --- a/mach-defpager/wiring.h > +++ b/mach-defpager/wiring.h > @@ -29,6 +29,6 @@ > #include <mach.h> > #include <mach_init.h> > > -extern void wire_setup(/* mach_port_t host_priv */); > -extern void wire_thread(); > -extern void wire_all_memory(); > +extern void wire_setup(mach_port_t host_priv); > +extern void wire_thread(void); > +extern void wire_all_memory(void); > diff --git a/nfs/main.c b/nfs/main.c > index 9ea6f0bc..3f4365c7 100644 > --- a/nfs/main.c > +++ b/nfs/main.c > @@ -39,7 +39,7 @@ int main_udp_socket; > char *hostname; > volatile struct mapped_time_value *mapped_time; > > -extern char *localhost (); > +extern char *localhost (void); > > /* Default number of times to retry RPCs when mounted soft. */ > #define DEFAULT_SOFT_RETRIES 3 > diff --git a/nfs/mount.c b/nfs/mount.c > index f8318c27..45a2ad4f 100644 > --- a/nfs/mount.c > +++ b/nfs/mount.c > @@ -18,13 +18,11 @@ > along with this program; if not, write to the Free Software > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ > > -#define malloc a_byte_for_every_bozotic_sun_lossage_and_youd_need_a_lotta_ram > #include <rpc/types.h> > #include <rpc/xdr.h> > +#include <rpc/pmap_prot.h> > #undef TRUE /* Get rid of sun defs. */ > #undef FALSE > -#undef malloc > -#include <rpc/pmap_prot.h> > #include <errno.h> > #include <error.h> > #include <sys/socket.h> > diff --git a/pfinet/stubs.c b/pfinet/stubs.c > index cdb8a6de..9affcff5 100644 > --- a/pfinet/stubs.c > +++ b/pfinet/stubs.c > @@ -50,7 +50,7 @@ void dev_activate (struct device *) > __attribute__ ((alias ("dev_init_scheduler"))); > void dev_deactivate (struct device *) > __attribute__ ((alias ("dev_init_scheduler"))); > -void tcp_ioctl () __attribute__ ((alias ("dev_init_scheduler"))); > +void tcp_ioctl (void) __attribute__ ((alias ("dev_init_scheduler"))); > > /* This isn't quite a stub, but it's not quite right either. */ > __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr, > diff --git a/pflocal/sock.h b/pflocal/sock.h > index 64b030e5..c686dec4 100644 > --- a/pflocal/sock.h > +++ b/pflocal/sock.h > @@ -184,11 +184,11 @@ error_t addr_create (struct addr **addr); > error_t addr_get_sock (struct addr *addr, struct sock **sock); > > /* Prepare for socket creation. */ > -error_t sock_global_init (); > +error_t sock_global_init (void); > > /* Try to shutdown any active sockets, returning EBUSY if we can't. Assumes > non-socket RPCS's have been disabled. */ > -error_t sock_global_shutdown (); > +error_t sock_global_shutdown (void); > > /* Mostly here for use by mig-decls.h. */ > extern struct port_class *sock_user_port_class; > diff --git a/pflocal/sserver.h b/pflocal/sserver.h > index 3769b7f9..bf668c87 100644 > --- a/pflocal/sserver.h > +++ b/pflocal/sserver.h > @@ -25,7 +25,7 @@ > a server if necessary. This routine should be called *after* creating the > port(s) which need server, as the server routine only operates while there > are any ports. */ > -void ensure_sock_server (); > +void ensure_sock_server (void); > > /* A port bucket to handle SOCK_USERs and ADDRs. */ > extern struct port_bucket *sock_port_bucket; > diff --git a/term/devio.c b/term/devio.c > index 6024acc2..65dea5d5 100644 > --- a/term/devio.c > +++ b/term/devio.c > @@ -98,7 +98,7 @@ static int output_stopped; > static int char_size_mask_xxx = 0xff; > > /* Forward */ > -static error_t devio_desert_dtr (); > +static error_t devio_desert_dtr (void); > > static error_t > devio_init (void) > diff --git a/term/hurdio.c b/term/hurdio.c > index 20a939f3..b4ef7c41 100644 > --- a/term/hurdio.c > +++ b/term/hurdio.c > @@ -82,7 +82,7 @@ static pthread_cond_t hurdio_assert_dtr_condition; > > > /* Forward */ > -static error_t hurdio_desert_dtr (); > +static error_t hurdio_desert_dtr (void); > static void *hurdio_reader_loop (void *arg); > static void *hurdio_writer_loop (void *arg); > static error_t hurdio_set_bits (struct termios *state); > diff --git a/term/term.h b/term/term.h > index 1e6be5f2..d68598d0 100644 > --- a/term/term.h > +++ b/term/term.h > @@ -374,7 +374,7 @@ void report_carrier_error (error_t); > /* Other decls */ > error_t drop_output (void); > void send_signal (int); > -error_t drain_output (); > +error_t drain_output (void); > void output_character (int); > void copy_rawq (void); > void rescan_inputq (void); > diff --git a/trans/firmlink.c b/trans/firmlink.c > index e216146a..5101b1bb 100644 > --- a/trans/firmlink.c > +++ b/trans/firmlink.c > @@ -164,7 +164,7 @@ getroot (struct trivfs_control *cntl, > /* Called by trivfs_S_fsys_getroot before any other processing takes place; > if the return value is EAGAIN, normal trivfs getroot processing continues, > otherwise the rpc returns with that return value. */ > -error_t (*trivfs_getroot_hook) () = getroot; > +trivfs_getroot_hook_fun trivfs_getroot_hook = getroot; > > void > trivfs_modify_stat (struct trivfs_protid *cred, struct stat *st) > diff --git a/utils/rpcscan.c b/utils/rpcscan.c > index c5a8addc..dc7dec3c 100644 > --- a/utils/rpcscan.c > +++ b/utils/rpcscan.c > @@ -83,7 +83,7 @@ send (mach_msg_id_t msgid) > return Message.Reply.RetCode; > } > > -typedef error_t (*setup_function_t) (); > +typedef error_t (*setup_function_t) (void); > setup_function_t setup_target; > void *setup_argument; > > diff --git a/utils/w.c b/utils/w.c > index ac5e36f8..d6977c4e 100644 > --- a/utils/w.c > +++ b/utils/w.c > @@ -48,7 +48,7 @@ > > extern char *canon_host (char *host); > extern char *shared_domain (char *host1, char *host2); > -extern char *localhost (); > +extern char *localhost (void); > > const char *argp_program_version = STANDARD_HURD_VERSION (w); > > @@ -218,7 +218,7 @@ w_get_user (struct proc_stat *ps) > return hook->user; > } > const struct ps_getter w_user_getter = > -{"user", W_PSTAT_USER, (void (*)())w_get_user}; > +{"user", W_PSTAT_USER, (void (*)(void))w_get_user}; > > static void > w_get_host (struct proc_stat *ps, char **host, unsigned *host_len) > @@ -230,10 +230,6 @@ w_get_host (struct proc_stat *ps, char **host, unsigned > *host_len) > const struct ps_getter w_host_getter = > {"host", W_PSTAT_HOST, w_get_host}; > > -extern error_t ps_emit_past_time (), ps_emit_string (), ps_emit_minutes (); > -extern error_t ps_emit_user_name (); > -extern int ps_cmp_times (), ps_cmp_strings (), ps_cmp_unames (); > -extern int ps_nominal_string (); > const struct ps_fmt_spec _w_specs[] = > { > {"User", 0, 8, -1,0, &w_uname_getter,ps_emit_string, ps_cmp_strings}, > -- > 2.40.0 > > >
-- Samuel --- Pour une évaluation indépendante, transparente et rigoureuse ! Je soutiens la Commission d'Évaluation de l'Inria.