diff options
-rw-r--r-- | libps/ChangeLog | 35 | ||||
-rw-r--r-- | libps/fmt.c | 20 | ||||
-rw-r--r-- | libps/procstat.c | 122 | ||||
-rw-r--r-- | libstore/rdwr.c | 30 | ||||
-rw-r--r-- | libstore/typed.c | 20 | ||||
-rw-r--r-- | nfsd/ChangeLog | 36 | ||||
-rw-r--r-- | nfsd/cache.c | 151 | ||||
-rw-r--r-- | pflocal/ChangeLog | 4 | ||||
-rw-r--r-- | pflocal/io.c | 36 | ||||
-rw-r--r-- | storeio/ChangeLog | 4 | ||||
-rw-r--r-- | storeio/dev.c | 24 | ||||
-rw-r--r-- | sutils/ChangeLog | 5 | ||||
-rw-r--r-- | sutils/fstab.c | 28 | ||||
-rw-r--r-- | trans/ChangeLog | 7 | ||||
-rw-r--r-- | trans/fifo.c | 60 | ||||
-rw-r--r-- | trans/new-fifo.c | 62 | ||||
-rw-r--r-- | ufs-utils/ChangeLog | 9 | ||||
-rw-r--r-- | ufs-utils/mkfs.c | 32 | ||||
-rw-r--r-- | usermux/ChangeLog | 3 | ||||
-rw-r--r-- | usermux/mux.c | 38 | ||||
-rw-r--r-- | utils/ChangeLog | 24 | ||||
-rw-r--r-- | utils/parse.c | 20 | ||||
-rw-r--r-- | utils/ping.c | 89 | ||||
-rw-r--r-- | utils/portinfo.c | 4 | ||||
-rw-r--r-- | utils/psout.c | 22 | ||||
-rw-r--r-- | utils/settrans.c | 16 | ||||
-rw-r--r-- | utils/showtrans.c | 10 | ||||
-rw-r--r-- | utils/vminfo.c | 50 | ||||
-rw-r--r-- | utils/w.c | 46 |
29 files changed, 537 insertions, 470 deletions
diff --git a/libps/ChangeLog b/libps/ChangeLog index 73d7612c..72147552 100644 --- a/libps/ChangeLog +++ b/libps/ChangeLog @@ -1,3 +1,11 @@ +1998-10-19 Roland McGrath <roland@baalperazim.frob.com> + + * fmt.c (_fmt_create): Add braces to silence gcc warning. + * procstat.c (summarize_thread_waits): Likewise. + (proc_stat_set_flags): Likewise. + (proc_stat_set_flags): Likewise. + (proc_stat_set_flags): Likewise. + Sat Jun 7 21:35:37 1997 Miles Bader <miles@gnu.ai.mit.edu> * spec.c (ps_emit_wait): Provide slightly better abbreviations for @@ -119,7 +127,7 @@ Mon Jun 3 10:17:43 1996 Miles Bader <miles@gnu.ai.mit.edu> correctly (it's an error_t). * ps.h (struct proc_stat): Add PROC_INFO_VM_ALLOCED, - THREAD_WAITS_VM_ALLOCED, and ARGS_VM_ALLOCED fields, + THREAD_WAITS_VM_ALLOCED, and ARGS_VM_ALLOCED fields, * procstat.c (merge_procinfo) Take a struct proc_stat as an arg, not all the individual fields. Correctly set OLD_PI_HDR. Correctly calculate REALLY_NEED. @@ -133,7 +141,7 @@ Mon Jun 3 10:17:43 1996 Miles Bader <miles@gnu.ai.mit.edu> Sat Jun 1 11:18:58 1996 Miles Bader <miles@gnu.ai.mit.edu> * procstat.c (set_procinfo_flags): New function. - (proc_stat_set_flags): Use it, to get msgport validity testing right. + (proc_stat_set_flags): Use it, to get msgport validity testing right. (merge_procinfo): Take and return HAVE instead of using a reference parameter. Clean up malloced storage if we get an error. @@ -190,7 +198,7 @@ Fri May 24 13:33:14 1996 Michael I. Bushnell, p/BSG <mib@gnu.ai.mit.edu> * procstat.c (fetch_procinfo): Always turn on PSTAT_PROC_INFO if proc_getprocinfo returns successfully. (merge_procinfo): Update *HAVE with PSTAT_PROC_INFO from - REALLY_HAVE here. + REALLY_HAVE here. Wed May 22 19:55:04 1996 Miles Bader <miles@gnu.ai.mit.edu> @@ -366,7 +374,7 @@ Wed Feb 14 17:49:17 1996 Miles Bader <miles@gnu.ai.mit.edu> Mon Feb 12 14:34:22 1996 Miles Bader <miles@gnu.ai.mit.edu> - * spec.c (ps_emit_wait): For rpcs, put the port first. + * spec.c (ps_emit_wait): For rpcs, put the port first. Fri Feb 9 15:55:35 1996 Miles Bader <miles@gnu.ai.mit.edu> @@ -455,7 +463,7 @@ Thu Dec 21 12:04:24 1995 Miles Bader <miles@gnu.ai.mit.edu> * fmt.c (ps_fmt_create): Use the new spec fields. (ps_fmt_write_proc_stat): Support new inval field in FMT. - * spec.c (ps_fmt_specs_find): Renamed from find_ps_fmt_spec; now + * spec.c (ps_fmt_specs_find): Renamed from find_ps_fmt_spec; now uses a struct ps_fmt_specs instead of an array of specs. (specs): Renamed from ps_std_fmt_specs; (ps_std_fmt_specs): Now of type struct ps_fmt_specs, pointing to specs. @@ -505,7 +513,7 @@ Sat Dec 16 23:42:27 1995 Miles Bader <miles@gnu.ai.mit.edu> (own_uid): New variable (was function local). * filters.c (ps_own_filter): Depend on PSTAT_OWNER_UID. (ps_own_p): Account for there being no uid. - + Thu Nov 16 12:51:34 1995 Miles Bader <miles@gnu.ai.mit.edu> * write.c (ps_stream_write_field): Trim spaces from BUF. @@ -526,7 +534,7 @@ Wed Nov 15 18:55:26 1995 Miles Bader <miles@gnu.ai.mit.edu> (ps_stream_write_field): Renamed from ps_write_field. (ps_stream_write_int_field): Renamed from ps_write_int_field. (ps_stream_newline): New declaration. - + * fmt.c (ps_fmt_write_titles, ps_fmt_write_proc_stat): Use new write function names. Use new STREAM parameter instead of old one and count. @@ -534,7 +542,7 @@ Wed Nov 15 18:55:26 1995 Miles Bader <miles@gnu.ai.mit.edu> * spec.c (ps_emit_int, ps_emit_nz_int, ps_emit_priority, ps_emit_percent, ps_emit_num_blocks, ps_emit_nice_int, ps_emit_nice_seconds, ps_emit_seconds, ps_emit_uid, ps_emit_uname, - ps_emit_string0, ps_emit_string, ps_emit_tty_name, ps_emit_state): + ps_emit_string0, ps_emit_string, ps_emit_tty_name, ps_emit_state): Ditto. (ps_emit_seconds): Remove leading spaces from what we print. @@ -581,7 +589,7 @@ Tue Oct 31 14:03:53 1995 Miles Bader <miles@gnu.ai.mit.edu> * ps.h (PSTAT_STATE_P_LOGINLDR, PSTAT_STATE_P_WAIT, PSTAT_STATE_P_GETMSG): New flags. * procstat.c (add_preconditions): Don't require PSTAT_EXEC_FLAGS for - getting the state anymore (but do require PSTAT_{TASK,THREAD}_BASIC). + getting the state anymore (but do require PSTAT_{TASK,THREAD}_BASIC). (proc_stat_state_tags): Update to reflect new flags. (proc_stat_set_flags): Set new flags. @@ -605,7 +613,7 @@ Tue Oct 31 14:03:53 1995 Miles Bader <miles@gnu.ai.mit.edu> (ps_get_ppid, ps_get_pgrp, ps_get_session, ps_get_login_col): Use proc_stat_proc_info, not proc_stat_info. (ps_vsize_getter, ps_rsize_getter, ps_rmem_frac_getter, - ps_proc_susp_count_getter): Use PSTAT_TASK_BASIC, not PSTAT_INFO. + ps_proc_susp_count_getter): Use PSTAT_TASK_BASIC, not PSTAT_INFO. (ps_get_vsize, ps_get_rsize, ps_get_rmem_frac, ps_get_proc_susp_count): Use proc_stat_task_basic_info, not proc_stat_info. (ps_cur_priority_getter, ps_base_priority_getter, @@ -613,7 +621,7 @@ Tue Oct 31 14:03:53 1995 Miles Bader <miles@gnu.ai.mit.edu> (ps_usr_time_getter, ps_sys_time_getter, ps_tot_time_getter, ps_cpu_frac_getter, ps_sleep_getter): Use PSTAT_THREAD_BASIC, not PSTAT_THREAD_INFO. - + * filters.c (ps_own_filter): Use PSTAT_PROC_INFO, not PSTAT_INFO. (ps_own_p): Use proc_stat_proc_info, not proc_stat_info. @@ -628,7 +636,7 @@ Tue Oct 31 14:03:53 1995 Miles Bader <miles@gnu.ai.mit.edu> (struct proc_stat): info & info_len --> proc_info & proc_info_len. Add the num_threads, task_basic_info, and thread_rpc fields. thread_basic_info & thread_sched_info are now pointers. - + Mon Oct 9 14:57:48 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> * Makefile: Specify shared library dependencies. @@ -660,7 +668,7 @@ Fri Aug 18 16:43:41 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu> (ps_emit_state): Use the state_shadows list to turn off some states. * filters.c (ps_not_sess_leader_p, ps_unorphaned_p, ps_parent_p): Use the new state bits. - + Sat Jul 8 13:34:20 1995 Miles Bader <miles@churchy.gnu.ai.mit.edu> * tty.c (ps_tty_short_name): That assignment around which extra @@ -830,4 +838,3 @@ Mon Mar 20 20:51:51 1995 Michael I Bushnell <mib@duality.gnu.ai.mit.edu> * New ChangeLog, moved into canonical directory structure. Old ChangeLog is in .../hurd/utils/ps.ChangeLog. - diff --git a/libps/fmt.c b/libps/fmt.c index 764711ae..eae08ffe 100644 --- a/libps/fmt.c +++ b/libps/fmt.c @@ -1,7 +1,7 @@ /* Implements the ps_fmt type, which describes how to output a user-readable version of a proc_stat. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.ai.mit.edu> @@ -240,11 +240,13 @@ _fmt_create (char *src, int posix, struct ps_fmt_specs *fmt_specs, } if (! field->title) - /* No explicit title specified in the fmt string. */ - if (field->spec->title) - field->title = field->spec->title; /* But the spec has one. */ - else - field->title = field->spec->name; /* Just use the field name. */ + { + /* No explicit title specified in the fmt string. */ + if (field->spec->title) + field->title = field->spec->title; /* But the spec has one. */ + else + field->title = field->spec->name; /* Just use field name. */ + } /* Add FIELD's required pstat_flags to FMT's set */ needs |= ps_getter_needs (ps_fmt_spec_getter (field->spec)); @@ -255,7 +257,7 @@ _fmt_create (char *src, int posix, struct ps_fmt_specs *fmt_specs, field->precision = field->spec->precision; field->flags = (field->spec->flags & ~clr_flags) ^ inv_flags; - + if (quoted_name && *src == '}') /* Skip optional trailing `}' after the spec name. */ src++; @@ -324,7 +326,7 @@ ps_fmt_creation_error (char *src, int posix, struct ps_fmt_specs *fmt_specs, } /* Free FMT, and any resources it consumes. */ -void +void ps_fmt_free (struct ps_fmt *fmt) { FREE (fmt->src); @@ -475,7 +477,7 @@ ps_fmt_squash (struct ps_fmt *fmt, int (*fn)(struct ps_fmt_field *field)) { /* Save the old prefix, in case we're deleting the first field, and need to prepend it to the next field. */ - const char *beg_pfx = field->pfx; + const char *beg_pfx = field->pfx; int beg_pfx_len = field->pfx_len; nfields--; diff --git a/libps/procstat.c b/libps/procstat.c index 6b1c38cf..b9a3e632 100644 --- a/libps/procstat.c +++ b/libps/procstat.c @@ -1,6 +1,6 @@ /* The proc_stat type, which holds information about a hurd process. - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.ai.mit.edu> @@ -43,7 +43,7 @@ typedef threadinfo_data_t *threadinfo_t; /* Return the PSTAT_STATE_ bits describing the state of an individual thread, from that thread's thread_basic_info_t struct */ -static int +static int thread_state (thread_basic_info_t bi) { int state = 0; @@ -93,7 +93,7 @@ thread_state (thread_basic_info_t bi) (PSTAT_PROCINFO_TASK_THREAD_DEP | PSTAT_PROC_INFO | PSTAT_TASK_BASIC) /* The set of PSTAT_ flags that we get using proc_getprocinfo. */ -#define PSTAT_PROCINFO PSTAT_PROCINFO_TASK +#define PSTAT_PROCINFO PSTAT_PROCINFO_TASK /* The set of things in PSTAT_PROCINFO that we will not attempt to refetch on subsequent getprocinfo calls. */ @@ -156,7 +156,7 @@ fetch_procinfo (process_t server, pid_t pid, vm_alloced memory for the procinfo structure returned by getprocinfo. Here we just give enough for four threads. */ #define PROCINFO_MALLOC_SIZE \ - (sizeof (struct procinfo) + 4 * sizeof (threadinfo_data_t)) + (sizeof (struct procinfo) + 4 * sizeof (threadinfo_data_t)) #define WAITS_MALLOC_SIZE 128 @@ -272,7 +272,7 @@ merge_procinfo (struct proc_stat *ps, ps_flags_t need, ps_flags_t have) /* Returns FLAGS augmented with any other flags that are necessary preconditions to setting them. */ -static ps_flags_t +static ps_flags_t add_preconditions (ps_flags_t flags, struct ps_context *context) { /* Implement any inter-flag dependencies: if the new flags in FLAGS depend on @@ -453,7 +453,7 @@ summarize_thread_sched_info (struct procinfo *pi) bzero (tsi, sizeof *tsi); for (i = 0; i < pi->nthreads; i++) - if (! pi->threadinfos[i].died + if (! pi->threadinfos[i].died && ! (pi->threadinfos[i].pis_bi.flags & TH_FLAGS_IDLE)) { thread_sched_info_t si = &pi->threadinfos[i].pis_si; @@ -504,33 +504,35 @@ summarize_thread_waits (struct procinfo *pi, char *waits, size_t waits_len, for (i = 0; i < pi->nthreads; i++) if (! pi->threadinfos[i].died) - if (next_wait > waits + waits_len) - break; - else - { - int left = waits + waits_len - next_wait; - - if (pi->threadinfos[i].pis_bi.flags & TH_FLAGS_IDLE) - ; /* kernel idle thread; ignore */ - else if (strncmp (next_wait, "msgport", left) == 0 - || strncmp (next_wait, "itimer", left) == 0) - ; /* libc internal threads; ignore. */ - else if (*wait) - /* There are multiple user threads. Punt. */ - { - *wait = "*"; - *rpc = 0; - break; - } - else - { - *wait = next_wait; - *rpc = pi->threadinfos[i].rpc_block; - } - - /* Advance NEXT_WAIT to the next wait string. */ - next_wait += strnlen (next_wait, left) + 1; - } + { + if (next_wait > waits + waits_len) + break; + else + { + int left = waits + waits_len - next_wait; + + if (pi->threadinfos[i].pis_bi.flags & TH_FLAGS_IDLE) + ; /* kernel idle thread; ignore */ + else if (strncmp (next_wait, "msgport", left) == 0 + || strncmp (next_wait, "itimer", left) == 0) + ; /* libc internal threads; ignore. */ + else if (*wait) + /* There are multiple user threads. Punt. */ + { + *wait = "*"; + *rpc = 0; + break; + } + else + { + *wait = next_wait; + *rpc = pi->threadinfos[i].rpc_block; + } + + /* Advance NEXT_WAIT to the next wait string. */ + next_wait += strnlen (next_wait, left) + 1; + } + } } /* Returns the number of threads in PI that aren't marked dead. */ @@ -875,13 +877,15 @@ proc_stat_set_flags (struct proc_stat *ps, ps_flags_t flags) ps->state = 0; if (have & PSTAT_THREAD_BASIC) - /* Thread states. */ - if (have & PSTAT_THREAD) - ps->state |= thread_state (ps->thread_basic_info); - else - /* For a process, we use the thread list instead of - PS->thread_basic_info because it contains more information. */ - ps->state |= summarize_thread_states (ps->proc_info); + { + /* Thread states. */ + if (have & PSTAT_THREAD) + ps->state |= thread_state (ps->thread_basic_info); + else + /* For a process, we use the thread list instead of + PS->thread_basic_info because it contains more information. */ + ps->state |= summarize_thread_states (ps->proc_info); + } if (have & PSTAT_PROC_INFO) /* Process state. */ @@ -921,15 +925,17 @@ proc_stat_set_flags (struct proc_stat *ps, ps_flags_t flags) ps->args_len = 100; ps->args = buf; if (ps->args) - if (proc_getprocargs (server, ps->pid, &ps->args, &ps->args_len)) - free (buf); - else - { - have |= PSTAT_ARGS; - ps->args_vm_alloced = (ps->args != buf); - if (ps->args_vm_alloced) - free (buf); - } + { + if (proc_getprocargs (server, ps->pid, &ps->args, &ps->args_len)) + free (buf); + else + { + have |= PSTAT_ARGS; + ps->args_vm_alloced = (ps->args != buf); + if (ps->args_vm_alloced) + free (buf); + } + } } /* The ctty id port; note that this is just a magic cookie; @@ -967,13 +973,15 @@ proc_stat_set_flags (struct proc_stat *ps, ps_flags_t flags) /* A ps_user object for the process's owner. */ if (NEED (PSTAT_OWNER, PSTAT_OWNER_UID)) - if (ps->owner_uid < 0) - { - ps->owner = 0; + { + if (ps->owner_uid < 0) + { + ps->owner = 0; + have |= PSTAT_OWNER; + } + else if (! ps_context_find_user (ps->context, ps->owner_uid, &ps->owner)) have |= PSTAT_OWNER; - } - else if (! ps_context_find_user (ps->context, ps->owner_uid, &ps->owner)) - have |= PSTAT_OWNER; + } /* A ps_tty for the process's controlling terminal, or NULL if it doesn't have one. */ @@ -1005,7 +1013,7 @@ proc_stat_set_flags (struct proc_stat *ps, ps_flags_t flags) /* ---------------------------------------------------------------- */ /* Discard PS and any resources it holds. */ -void +void _proc_stat_free (ps) struct proc_stat *ps; { @@ -1019,7 +1027,7 @@ _proc_stat_free (ps) ? mach_port_deallocate(mach_task_self (), (ps->port)) : 0) /* If FLAG is set in PS's flags, then if VM_ALLOCED is zero, free the malloced - field MEM in PS; othrewise, vm_deallocate MEM, consisting of SIZE + field MEM in PS; othrewise, vm_deallocate MEM, consisting of SIZE elements of type ELTYPE, *unless* MEM == SBUF, which usually means that MEM points to a static buffer somewhere instead of vm_alloc'd memory. */ diff --git a/libstore/rdwr.c b/libstore/rdwr.c index bb3f3079..4b3cf84f 100644 --- a/libstore/rdwr.c +++ b/libstore/rdwr.c @@ -1,6 +1,6 @@ /* Store I/O - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1995, 96, 97, 98 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.ai.mit.edu> This file is part of the GNU Hurd. @@ -259,20 +259,22 @@ store_read (struct store *store, /* Deallocate any amount of WHOLE_BUF we didn't use. */ if (whole_buf != *buf) - if (err) - vm_deallocate (mach_task_self (), - (vm_address_t)whole_buf, whole_buf_len); - else - { - vm_size_t unused = whole_buf_len - round_page (*len); - if (unused) - vm_deallocate (mach_task_self (), - (vm_address_t)whole_buf + whole_buf_len - unused, - unused); - *buf = whole_buf; - } + { + if (err) + vm_deallocate (mach_task_self (), + (vm_address_t)whole_buf, whole_buf_len); + else + { + vm_size_t unused = whole_buf_len - round_page (*len); + if (unused) + vm_deallocate (mach_task_self (), + (vm_address_t)whole_buf + whole_buf_len + - unused, + unused); + *buf = whole_buf; + } + } return err; } } - diff --git a/libstore/typed.c b/libstore/typed.c index 09b92f8d..05083eea 100644 --- a/libstore/typed.c +++ b/libstore/typed.c @@ -1,6 +1,6 @@ /* Support for opening `typed' stores - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.ai.mit.edu> @@ -55,13 +55,15 @@ store_typed_open (const char *name, int flags, break; if (! *cl) - /* No class with the given name found. */ - if (*clname_end) - /* NAME really should be a class name, which doesn't exist. */ - return EINVAL; - else - /* Try opening NAME by querying it as a file instead. */ - return store_open (name, flags, classes, store); + { + /* No class with the given name found. */ + if (*clname_end) + /* NAME really should be a class name, which doesn't exist. */ + return EINVAL; + else + /* Try opening NAME by querying it as a file instead. */ + return store_open (name, flags, classes, store); + } if (! (*cl)->open) /* CL cannot be opened. */ @@ -75,7 +77,7 @@ store_typed_open (const char *name, int flags, /* The class-specific portion of the name is empty, so make it *really* empty. */ clname_end = 0; - + return (*(*cl)->open) (clname_end, flags, classes, store); } diff --git a/nfsd/ChangeLog b/nfsd/ChangeLog index 91170a5c..dc10bde9 100644 --- a/nfsd/ChangeLog +++ b/nfsd/ChangeLog @@ -1,3 +1,9 @@ +1998-10-20 Roland McGrath <roland@baalperazim.frob.com> + + * cache.c (scan_creds): Add braces to silence gcc warning. + (scan_fhs): Likewise. + (scan_replies): Likewise. + Thu Sep 26 14:09:20 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> * nfsd.h (enum_t): New type. @@ -15,7 +21,7 @@ Tue Sep 3 14:15:50 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> "../nfs/rpcsvc/mount.h". * ops.c: Likewise. * nfsd.h: Include "../nfs/nfs-spec.h" instead of - "../nfs/rpcsvc/nfs_prot.h". + "../nfs/rpcsvc/nfs_prot.h". Wed Aug 14 13:46:45 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> @@ -26,18 +32,18 @@ Wed Aug 14 13:46:45 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> * nfsd.h, cache.c, ops.c, xdr.c: Use new names for things that have just been changed in ../nfs/rpcsvc/nfs_prot.h. * xdr.c (hurd_mode_to_nfs_type): New parm VERSION; all callers - changed. + changed. (encode_fattr): New parm VERSION; all callers changed. * nfsd.h (encode_fattr): New parm VERSION. Tue Aug 13 14:38:36 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> - + * ops.c (op_create): Sun's NFS client implementation actually bombs if do do what RFC 1094 says to do in section 2.2.10. So don't pass O_EXCL, but do pass O_TRUNC. That's what NetBSD does. * ops.c (op_setattr): Fill in an fattr in reply. - + Mon Aug 12 11:15:15 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> * Makefile (installationdir): Include quotes in variable expansion @@ -62,33 +68,33 @@ Wed Aug 7 11:39:31 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> * main.c (index_file): New var. (index_file_name): Initialize from index_file. (main): Don't initialize index_file_name here. - + * ops.c (op_null, op_getattr, op_setattr, op_lookup, op_readlink, count_read_buffersize, op_read, op_write, op_create, op_remove, op_rename, op_link, op_symlink, op_mkdir, op_rmdir, count_readdir_buffersize, op_statfs, op_mnt, op_getport): Add new parm `version'. * loop.c (server_loop): Supply VERSION to PROC->alloc_reply and - PROC->func. + PROC->func. * nfsd.h (struct procedure): Add new parm to `func' and `alloc_reply' members to specify protocol version. * ops.c (mounttable): Use op_null for MOUNTPROC_UMNT and - MOUNTPROC_UMNTALL. - + MOUNTPROC_UMNTALL. + * ops.c (op_create): Ignore most of setattr structure given. (op_mkdir): Likewise. (complete_setattr): Clean up and be less active when possible. * ops.c (op_readdir): Correctly end list of directory entries. - + * nfsd.h (authserver): New variable. n * main.c: Include <hurd.h>. (main): Initialize AUTHSERVER. * cache.c: Include <hurd/io.h> and <hurd/auth.h>. (create_cached_handle): Reauthenticate port before calling - file_getfh. - + file_getfh. + * fsys.c (init_filesystems): When setting NFSYS, it needs to be at least as big as INDEX + 1, and install the control port into the correct slot. @@ -100,17 +106,17 @@ Tue Aug 6 13:18:40 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> * cache.c (create_cached_handle): Always call fsys_getfile when creating a new cached handle instead of relying upon the passed in - port. + port. * xdr.c (hurd_mode_to_nfs_mode): Specify octal number in octal - notation. + notation. (encode_fattr): Bother filling in all the fields. * loop.c (server_loop): Don't attempt to call cache_handle_rele if C is null. * cache.c (fh_hash): Mod-ulize HASH before returning it. - + * cache.c (process_cred): Arrange to skip VERF field for non-AUTH_UNIX creds too. @@ -132,5 +138,3 @@ Tue Aug 6 13:18:40 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> * main.c (main): Stringify LOCALSTATEDIR; but for now just pound in /var. Call asprintf correctly. - - diff --git a/nfsd/cache.c b/nfsd/cache.c index 4230c24f..808f1648 100644 --- a/nfsd/cache.c +++ b/nfsd/cache.c @@ -1,5 +1,5 @@ -/* - Copyright (C) 1996 Free Software Foundation, Inc. +/* + Copyright (C) 1996, 1998 Free Software Foundation, Inc. Written by Michael I. Bushnell, p/BSG. This file is part of the GNU Hurd. @@ -57,11 +57,11 @@ idspec_compare (struct idspec *i, int nuids, int ngids, return 0; assert (sizeof (int) == sizeof (uid_t)); - + if (bcmp (i->uids, uids, nuids * sizeof (uid_t)) || bcmp (i->gids, gids, ngids * sizeof (gid_t))) return 0; - + return 1; } @@ -70,7 +70,7 @@ static int idspec_hash (int nuids, int ngids, int *uids, int *gids) { int hash, n; - + hash = nuids + ngids; for (n = 0; n < ngids; n++) hash += gids[n]; @@ -99,7 +99,7 @@ idspec_lookup (int nuids, int ngids, int *uids, int *gids) spin_unlock (&idhashlock); return i; } - + assert (sizeof (uid_t) == sizeof (int)); i = malloc (sizeof (struct idspec)); i->nuids = nuids; @@ -130,7 +130,7 @@ process_cred (int *p, struct idspec **credp) int ngids; int firstgid; int i; - + type = ntohl (*p++); if (type != AUTH_UNIX) @@ -145,32 +145,32 @@ process_cred (int *p, struct idspec **credp) p++; /* skip seconds */ len = ntohl (*p++); p += INTSIZE (len); /* skip hostname */ - + uid = p++; /* remember loc of uid */ *uid = ntohl (*uid); - + firstgid = *p++; /* remember first gid */ gids = p; /* here's where the array will start */ ngids = ntohl (*p++); - + /* Now swap the first gid to be the first element of the array */ *gids = firstgid; ngids++; /* and count it */ - + /* And byteswap the gids */ for (i = 0; i < ngids; i++) gids[i] = ntohl (gids[i]); - + p += ngids - 1; *credp = idspec_lookup (1, ngids, uid, gids); } - + /* Next is the verf field; skip it entirely */ p++; /* skip id */ len = htonl (*p++); p += INTSIZE (len); - + return p; } @@ -209,20 +209,21 @@ scan_creds () if (mapped_time->seconds - leastidlastuse > ID_KEEP_TIMEOUT) for (n = 0; n < IDHASH_TABLE_SIZE && nfreeids; n++) for (i = idhashtable[n]; i && nfreeids; i = i->next) - if (!i->references - && mapped_time->seconds - i->lastuse > ID_KEEP_TIMEOUT) - { - nfreeids--; - *i->prevp = i->next; - if (i->next) - i->next->prevp = i->prevp; - free (i->uids); - free (i->gids); - free (i); - } - else - if (!i->references && newleast > i->lastuse) + { + if (!i->references + && mapped_time->seconds - i->lastuse > ID_KEEP_TIMEOUT) + { + nfreeids--; + *i->prevp = i->next; + if (i->next) + i->next->prevp = i->prevp; + free (i->uids); + free (i->gids); + free (i); + } + else if (!i->references && newleast > i->lastuse) newleast = i->lastuse; + } /* If we didn't bail early, then this is valid */ if (nfreeids) @@ -241,7 +242,7 @@ static int fh_hash (char *fhandle, struct idspec *i) { int hash = 0, n; - + for (n = 0; n < NFS2_FHSIZE; n++) hash += fhandle[n]; hash += (int) i >> 6; @@ -255,7 +256,7 @@ lookup_cache_handle (int *p, struct cache_handle **cp, struct idspec *i) struct cache_handle *c; fsys_t fsys; file_t port; - + hash = fh_hash ((char *)p, i); mutex_lock (&fhhashlock); for (c = fhhashtable[hash]; c; c = c->next) @@ -268,9 +269,9 @@ lookup_cache_handle (int *p, struct cache_handle **cp, struct idspec *i) *cp = c; return p + NFS2_FHSIZE / sizeof (int); } - + /* Not found */ - + /* First four bytes are our internal table of filesystems */ fsys = lookup_filesystem (*p); if (fsys == MACH_PORT_NULL @@ -281,7 +282,7 @@ lookup_cache_handle (int *p, struct cache_handle **cp, struct idspec *i) *cp = 0; return p + NFS2_FHSIZE / sizeof (int); } - + c = malloc (sizeof (struct cache_handle)); bcopy (p, c->handle, NFS2_FHSIZE); cred_ref (i); @@ -294,7 +295,7 @@ lookup_cache_handle (int *p, struct cache_handle **cp, struct idspec *i) c->next->prevp = &c->next; c->prevp = &fhhashtable[hash]; fhhashtable[hash] = c; - + mutex_unlock (&fhhashlock); *cp = c; return p + NFS2_FHSIZE / sizeof (int); @@ -315,32 +316,33 @@ cache_handle_rele (struct cache_handle *c) mutex_unlock (&fhhashlock); } -void +void scan_fhs () { struct cache_handle *c; int n; int newleast = mapped_time->seconds; - + mutex_lock (&fhhashlock); if (mapped_time->seconds - leastfhlastuse > FH_KEEP_TIMEOUT) for (n = 0; n < FHHASH_TABLE_SIZE && nfreefh; n++) for (c = fhhashtable[n]; c && nfreefh; c = c->next) - if (!c->references - && mapped_time->seconds - c->lastuse > FH_KEEP_TIMEOUT) - { - nfreefh--; - *c->prevp = c->next; - if (c->next) - c->next->prevp = c->prevp; - cred_rele (c->ids); - mach_port_deallocate (mach_task_self (), c->port); - free (c); - } - else - if (!c->references && newleast > c->lastuse) - newleast = c->lastuse; - + { + if (!c->references + && mapped_time->seconds - c->lastuse > FH_KEEP_TIMEOUT) + { + nfreefh--; + *c->prevp = c->next; + if (c->next) + c->next->prevp = c->prevp; + cred_rele (c->ids); + mach_port_deallocate (mach_task_self (), c->port); + free (c); + } + else if (!c->references && newleast > c->lastuse) + newleast = c->lastuse; + } + /* If we didn't bail early, then this is valid. */ if (nfreefh) leastfhlastuse = newleast; @@ -371,7 +373,7 @@ create_cached_handle (int fs, struct cache_handle *credc, file_t userport) else mach_port_deallocate (mach_task_self (), userport); mach_port_destroy (mach_task_self (), ref); - + /* Fetch the file handle */ *(int *)fhandle = fs; err = file_getfh (newport, &bp, &handlelen); @@ -383,7 +385,7 @@ create_cached_handle (int fs, struct cache_handle *credc, file_t userport) bcopy (bp, fhandle + sizeof (int), NFS2_FHSIZE - sizeof (int)); vm_deallocate (mach_task_self (), (vm_address_t) bp, handlelen); } - + /* Cache it */ hash = fh_hash (fhandle, credc->ids); mutex_lock (&fhhashlock); @@ -401,8 +403,8 @@ create_cached_handle (int fs, struct cache_handle *credc, file_t userport) /* Always call fsys_getfile so that we don't depend on the particular open modes of the port passed in. */ - err = fsys_getfile (lookup_filesystem (fs), - credc->ids->uids, credc->ids->nuids, + err = fsys_getfile (lookup_filesystem (fs), + credc->ids->uids, credc->ids->nuids, credc->ids->gids, credc->ids->ngids, fhandle + sizeof (int), NFS2_FHSIZE - sizeof (int), &newport); @@ -411,7 +413,7 @@ create_cached_handle (int fs, struct cache_handle *credc, file_t userport) mutex_unlock (&fhhashlock); return 0; } - + /* Create it anew */ c = malloc (sizeof (struct cache_handle)); bcopy (fhandle, c->handle, NFS2_FHSIZE); @@ -419,7 +421,7 @@ create_cached_handle (int fs, struct cache_handle *credc, file_t userport) c->ids = credc->ids; c->port = newport; c->references = 1; - + /* And add it to the hash table */ c->next = fhhashtable[hash]; if (c->next) @@ -427,7 +429,7 @@ create_cached_handle (int fs, struct cache_handle *credc, file_t userport) c->prevp = &fhhashtable[hash]; fhhashtable[hash] = c; mutex_unlock (&fhhashlock); - + return c; } @@ -442,17 +444,17 @@ static int leastreplylastuse; previous transaction; if so, return the cache record. Otherwise, create a new cache record. */ struct cached_reply * -check_cached_replies (int xid, +check_cached_replies (int xid, struct sockaddr_in *sender) { struct cached_reply *cr; int hash; hash = xid % REPLYHASH_TABLE_SIZE; - + spin_lock (&replycachelock); for (cr = replyhashtable[hash]; cr; cr = cr->next) - if (cr->xid == xid + if (cr->xid == xid && !bcmp (sender, &cr->source, sizeof (struct sockaddr_in))) { cr->references++; @@ -504,25 +506,26 @@ scan_replies () struct cached_reply *cr; int n; int newleast = mapped_time->seconds; - + spin_lock (&replycachelock); if (mapped_time->seconds - leastreplylastuse > REPLY_KEEP_TIMEOUT) for (n = 0; n < REPLYHASH_TABLE_SIZE && nfreereplies; n++) for (cr = replyhashtable[n]; cr && nfreereplies; cr = cr->next) - if (!cr->references - && mapped_time->seconds - cr->lastuse > REPLY_KEEP_TIMEOUT) - { - nfreereplies--; - *cr->prevp = cr->next; - if (cr->next) - cr->next->prevp = cr->prevp; - if (cr->data) - free (cr->data); - } - else - if (!cr->references && newleast > cr->lastuse) + { + if (!cr->references + && mapped_time->seconds - cr->lastuse > REPLY_KEEP_TIMEOUT) + { + nfreereplies--; + *cr->prevp = cr->next; + if (cr->next) + cr->next->prevp = cr->prevp; + if (cr->data) + free (cr->data); + } + else if (!cr->references && newleast > cr->lastuse) newleast = cr->lastuse; - + } + /* If we didn't bail early, then this is valid */ if (nfreereplies) leastreplylastuse = newleast; diff --git a/pflocal/ChangeLog b/pflocal/ChangeLog index 4224a54e..b4ea9e2d 100644 --- a/pflocal/ChangeLog +++ b/pflocal/ChangeLog @@ -1,3 +1,7 @@ +1998-10-20 Roland McGrath <roland@baalperazim.frob.com> + + * io.c (S_io_select): Add braces to silence gcc warning. + 1998-07-20 Roland McGrath <roland@baalperazim.frob.com> * pflocal.c (main): Fix return type to int, and use return. diff --git a/pflocal/io.c b/pflocal/io.c index 02dfbd40..58522ac6 100644 --- a/pflocal/io.c +++ b/pflocal/io.c @@ -1,6 +1,6 @@ /* Socket I/O operations - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.ai.mit.edu> @@ -117,7 +117,7 @@ S_io_write (struct sock_user *user, /* Tell how much data can be read from the object without blocking for a "long time" (this should be the same meaning of "long time" used by the nonblocking flag. */ -error_t +error_t S_io_readable (struct sock_user *user, mach_msg_type_number_t *amount) { error_t err; @@ -196,17 +196,19 @@ S_io_select (struct sock_user *user, *select_type &= SELECT_READ; if (*select_type & SELECT_READ) - /* Wait for a connect. Passing in NULL for REQ means that the - request won't be dequeued. */ - if (connq_listen (sock->listen_queue, 1, NULL, NULL) == 0) - /* We can satisfy this request immediately. */ - return 0; - else - /* Gotta wait... */ - { - ports_interrupt_self_on_port_death (user, reply); - return connq_listen (sock->listen_queue, 0, NULL, NULL); - } + { + /* Wait for a connect. Passing in NULL for REQ means that the + request won't be dequeued. */ + if (connq_listen (sock->listen_queue, 1, NULL, NULL) == 0) + /* We can satisfy this request immediately. */ + return 0; + else + /* Gotta wait... */ + { + ports_interrupt_self_on_port_death (user, reply); + return connq_listen (sock->listen_queue, 0, NULL, NULL); + } + } } else /* Sock is a normal read/write socket. */ @@ -402,14 +404,14 @@ S_io_reauthenticate (struct sock_user *user, mach_port_t rendezvous) return err; auth_server = getauth (); - err = mach_port_insert_right (mach_task_self (), new_user_port, + err = mach_port_insert_right (mach_task_self (), new_user_port, new_user_port, MACH_MSG_TYPE_MAKE_SEND); assert_perror (err); do err = - auth_server_authenticate (auth_server, + auth_server_authenticate (auth_server, rendezvous, MACH_MSG_TYPE_COPY_SEND, - new_user_port, MACH_MSG_TYPE_COPY_SEND, + new_user_port, MACH_MSG_TYPE_COPY_SEND, &uids, &num_uids, &aux_uids, &num_aux_uids, &gids, &num_gids, &aux_gids, &num_aux_gids); while (err == EINTR); @@ -526,7 +528,7 @@ S_io_mod_owner(struct sock_user *user, pid_t owner) return EOPNOTSUPP; } -error_t +error_t S_io_get_owner(struct sock_user *user, pid_t *owner) { return EOPNOTSUPP; diff --git a/storeio/ChangeLog b/storeio/ChangeLog index 98c0ef8f..0653d9fb 100644 --- a/storeio/ChangeLog +++ b/storeio/ChangeLog @@ -1,3 +1,7 @@ +1998-10-20 Roland McGrath <roland@baalperazim.frob.com> + + * dev.c (dev_buf_fill): Add braces to silence gcc warning. + 1998-07-20 Roland McGrath <roland@baalperazim.frob.com> * storeio.c (main): Fix return type to int, and use return. diff --git a/storeio/dev.c b/storeio/dev.c index 9d9c375b..2f81f32a 100644 --- a/storeio/dev.c +++ b/storeio/dev.c @@ -1,6 +1,6 @@ /* store `device' I/O - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.ai.mit.edu> @@ -70,14 +70,16 @@ dev_buf_fill (struct dev *dev, off_t offs) size_t buf_len = store->block_size; if (dev_buf_is_active (dev)) - if ((dev->buf_offs & ~block_mask) == (offs & ~block_mask)) - return 0; /* Correct block alredy in buffer. */ - else - { - err = dev_buf_discard (dev); - if (err) - return err; - } + { + if ((dev->buf_offs & ~block_mask) == (offs & ~block_mask)) + return 0; /* Correct block alredy in buffer. */ + else + { + err = dev_buf_discard (dev); + if (err) + return err; + } + } err = store_read (store, offs >> store->log2_block_size, store->block_size, &buf, &buf_len); @@ -171,7 +173,7 @@ dev_open (struct store_parsed *name, int flags, struct dev **dev) } /* Free DEV and any resources it consumes. */ -void +void dev_close (struct dev *dev) { if (dev->pager != NULL) @@ -400,4 +402,4 @@ dev_read (struct dev *dev, off_t offs, size_t whole_amount, vm_deallocate (mach_task_self (), (vm_address_t)*buf, whole_amount); return err; -} +} diff --git a/sutils/ChangeLog b/sutils/ChangeLog index bbbe1982..4fafd389 100644 --- a/sutils/ChangeLog +++ b/sutils/ChangeLog @@ -1,3 +1,8 @@ +1998-10-20 Roland McGrath <roland@baalperazim.frob.com> + + * fstab.c (fstab_add_mntent): Add braces to silence gcc warning. + (fs_readonly): Likewise. + 1998-07-19 Roland McGrath <roland@baalperazim.frob.com> * swapon.c (main): Fix return type to int, and use return. diff --git a/sutils/fstab.c b/sutils/fstab.c index 6c756922..f46c2886 100644 --- a/sutils/fstab.c +++ b/sutils/fstab.c @@ -1,6 +1,6 @@ /* Fstab filesystem frobbing - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.ai.mit.edu> @@ -330,10 +330,12 @@ fs_readonly (struct fs *fs, int *readonly) err = fs_fsys (fs, &fsys); if (! err) - if (fsys == MACH_PORT_NULL) - fs->readonly = 1; - else - err = fsys_get_readonly (fsys, &fs->readonly); + { + if (fsys == MACH_PORT_NULL) + fs->readonly = 1; + else + err = fsys_get_readonly (fsys, &fs->readonly); + } } if (!err && readonly) @@ -453,7 +455,7 @@ fstab_add_mntent (struct fstab *fstab, struct mntent *mntent, fs = mounted_fs; mounted_fs = 0; } - + if (! fs) /* No old entry, make a new one. */ { @@ -474,15 +476,17 @@ fstab_add_mntent (struct fstab *fstab, struct mntent *mntent, err = fs_set_mntent (fs, mntent); if (new) - if (! err) - _fstab_add (fstab, fs); - else if (fs) - free (fs); + { + if (! err) + _fstab_add (fstab, fs); + else if (fs) + free (fs); + } if (!err && mounted_fs) /* Get rid of the conflicting entry MOUNTED_FS. */ fs_free (mounted_fs); - + if (!err && result) *result = fs; @@ -537,7 +541,7 @@ fstab_merge (struct fstab *dst, struct fstab *src) if (old_fs) fs_free (old_fs); } - + /* Now that we know there are no conflicts, steal all SRC's entries and cons them onto DST. */ for (fs = src->entries; fs; fs = fs->next) diff --git a/trans/ChangeLog b/trans/ChangeLog index 712dd1c3..14dee01f 100644 --- a/trans/ChangeLog +++ b/trans/ChangeLog @@ -1,3 +1,10 @@ +1998-10-20 Roland McGrath <roland@baalperazim.frob.com> + + * fifo.c (open_hook: WAIT): Add braces to silence gcc warning. + (trivfs_S_io_select): Likewise. + * new-fifo.c (fifo_trans_open): Likewise. + (trivfs_S_io_select): Likewise. + 1998-07-20 Roland McGrath <roland@baalperazim.frob.com> * firmlink.c (main): Fix return type to int, and use return. diff --git a/trans/fifo.c b/trans/fifo.c index 0646db02..4ad1e1db 100644 --- a/trans/fifo.c +++ b/trans/fifo.c @@ -123,15 +123,17 @@ open_hook (struct trivfs_peropen *po) mutex_lock (&active_fifo_lock); /* Wait until the active fifo has changed so that CONDITION is true. */ -#define WAIT(condition, noblock_err) \ - while (!err && !(condition)) \ - if (flags & O_NONBLOCK) \ - { \ - err = noblock_err; \ - break; \ - } \ - else if (hurd_condition_wait (&active_fifo_changed, &active_fifo_lock)) \ - err = EINTR; +#define WAIT(condition, noblock_err) \ + while (!err && !(condition)) \ + { \ + if (flags & O_NONBLOCK) \ + { \ + err = noblock_err; \ + break; \ + } \ + else if (hurd_condition_wait (&active_fifo_changed, &active_fifo_lock)) \ + err = EINTR; \ + } if (flags & O_READ) /* When opening for read, what we do depends on what mode this server @@ -415,26 +417,30 @@ trivfs_S_io_select (struct trivfs_protid *cred, pipe = cred->po->hook; if (*select_type & SELECT_READ) - if (cred->po->openmodes & O_READ) - { - mutex_lock (&pipe->lock); - if (pipe_wait_readable (pipe, 1, 1) != EWOULDBLOCK) - ready |= SELECT_READ; /* Data immediately readable (or error). */ - mutex_unlock (&pipe->lock); - } - else - ready |= SELECT_READ; /* Error immediately available... */ + { + if (cred->po->openmodes & O_READ) + { + mutex_lock (&pipe->lock); + if (pipe_wait_readable (pipe, 1, 1) != EWOULDBLOCK) + ready |= SELECT_READ; /* Data immediately readable (or error). */ + mutex_unlock (&pipe->lock); + } + else + ready |= SELECT_READ; /* Error immediately available... */ + } if (*select_type & SELECT_WRITE) - if (cred->po->openmodes & O_WRITE) - { - mutex_lock (&pipe->lock); - if (pipe_wait_writable (pipe, 1) != EWOULDBLOCK) - ready |= SELECT_WRITE; /* Data immediately writable (or error). */ - mutex_unlock (&pipe->lock); - } - else - ready |= SELECT_WRITE; /* Error immediately available... */ + { + if (cred->po->openmodes & O_WRITE) + { + mutex_lock (&pipe->lock); + if (pipe_wait_writable (pipe, 1) != EWOULDBLOCK) + ready |= SELECT_WRITE; /* Data immediately writable (or error). */ + mutex_unlock (&pipe->lock); + } + else + ready |= SELECT_WRITE; /* Error immediately available... */ + } if (ready) *select_type = ready; diff --git a/trans/new-fifo.c b/trans/new-fifo.c index 9266b1e5..203a7d4d 100644 --- a/trans/new-fifo.c +++ b/trans/new-fifo.c @@ -245,16 +245,18 @@ fifo_trans_open (struct fifo_trans *trans, int flags, void **hook) mutex_lock (&trans->active_fifo_lock); /* Wait until the active fifo has changed so that CONDITION is true. */ -#define WAIT(condition, noblock_err) \ - while (!err && !(condition)) \ - if (flags & O_NONBLOCK) \ - { \ - err = noblock_err; \ - break; \ - } \ - else if (hurd_condition_wait (&trans->active_fifo_changed, \ - &trans->active_fifo_lock)) \ - err = EINTR; +#define WAIT(condition, noblock_err) \ + while (!err && !(condition)) \ + { \ + if (flags & O_NONBLOCK) \ + { \ + err = noblock_err; \ + break; \ + } \ + else if (hurd_condition_wait (&trans->active_fifo_changed, \ + &trans->active_fifo_lock)) \ + err = EINTR; \ + } if (flags & O_READ) /* When opening for read, what we do depends on what mode this server @@ -600,26 +602,30 @@ trivfs_S_io_select (struct trivfs_protid *cred, pipe = cred->po->hook; if (*select_type & SELECT_READ) - if (cred->po->openmodes & O_READ) - { - mutex_lock (&pipe->lock); - if (pipe_wait_readable (pipe, 1, 1) != EWOULDBLOCK) - ready |= SELECT_READ; /* Data immediately readable (or error). */ - mutex_unlock (&pipe->lock); - } - else - ready |= SELECT_READ; /* Error immediately available... */ + { + if (cred->po->openmodes & O_READ) + { + mutex_lock (&pipe->lock); + if (pipe_wait_readable (pipe, 1, 1) != EWOULDBLOCK) + ready |= SELECT_READ; /* Data immediately readable (or error). */ + mutex_unlock (&pipe->lock); + } + else + ready |= SELECT_READ; /* Error immediately available... */ + } if (*select_type & SELECT_WRITE) - if (cred->po->openmodes & O_WRITE) - { - mutex_lock (&pipe->lock); - if (pipe_wait_writable (pipe, 1) != EWOULDBLOCK) - ready |= SELECT_WRITE; /* Data immediately writable (or error). */ - mutex_unlock (&pipe->lock); - } - else - ready |= SELECT_WRITE; /* Error immediately available... */ + { + if (cred->po->openmodes & O_WRITE) + { + mutex_lock (&pipe->lock); + if (pipe_wait_writable (pipe, 1) != EWOULDBLOCK) + ready |= SELECT_WRITE; /* Data immediately writable (or error). */ + mutex_unlock (&pipe->lock); + } + else + ready |= SELECT_WRITE; /* Error immediately available... */ + } if (ready) *select_type = ready; diff --git a/ufs-utils/ChangeLog b/ufs-utils/ChangeLog index 997bb089..9e402e66 100644 --- a/ufs-utils/ChangeLog +++ b/ufs-utils/ChangeLog @@ -1,3 +1,7 @@ +1998-09-04 Roland McGrath <roland@baalperazim.frob.com> + + * mkfs.c (main): Fix return type to int, use return. + Fri Jun 20 13:39:02 1997 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu> * mkfs.c (mkfs): Set SBLOCK.fs_clean. New file systems are always @@ -100,7 +104,7 @@ Thu Nov 24 18:39:30 1994 Roland McGrath <roland@churchy.gnu.ai.mit.edu> Wed Oct 12 12:59:01 1994 Michael I Bushnell <mib@churchy.gnu.ai.mit.edu> - * mkfs.c (main): MAXCONTIG should be zero because we don't + * mkfs.c (main): MAXCONTIG should be zero because we don't do clustering. Fri Sep 9 09:45:23 1994 Michael I Bushnell <mib@churchy.gnu.ai.mit.edu> @@ -117,7 +121,7 @@ Fri Sep 9 09:45:23 1994 Michael I Bushnell <mib@churchy.gnu.ai.mit.edu> (main): Comment out check for already-mounted partition. (main): Comment out MFS specific open of FSI. - * mkfs.c (fsinit): Use DI_MODE to read mode from NODE, and + * mkfs.c (fsinit): Use DI_MODE to read mode from NODE, and set di_model and di_modeh instead of di_mode. (mkfs): Don't set fields in *PP. @@ -129,4 +133,3 @@ Thu Sep 8 15:52:05 1994 Michael I Bushnell <mib@churchy.gnu.ai.mit.edu> * mkfs.c: Include ufs header files with "../ufs/foo.h" instead of <ufs/ufs/foo.h>. Don't include <sys/disklabel.h>. - diff --git a/ufs-utils/mkfs.c b/ufs-utils/mkfs.c index 5770293a..e8513b70 100644 --- a/ufs-utils/mkfs.c +++ b/ufs-utils/mkfs.c @@ -33,7 +33,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)mkfs.c 8.3 (Berkeley) 2/3/94";*/ -static char *rcsid = "$Id: mkfs.c,v 1.17 1997/06/23 17:35:37 thomas Exp $"; +static char *rcsid = "$Id: mkfs.c,v 1.18 1998/10/20 09:46:39 roland Exp $"; #endif /* not lint */ #include <unistd.h> @@ -63,7 +63,7 @@ static char *rcsid = "$Id: mkfs.c,v 1.17 1997/06/23 17:35:37 thomas Exp $"; /* Begin misc additions for GNU Hurd */ -/* For GNU Hurd: the ufs DIRSIZ macro is different than the BSD +/* For GNU Hurd: the ufs DIRSIZ macro is different than the BSD 4.4 version that mkfs expects. So we provide here the BSD version. */ #undef DIRSIZ #if (BYTE_ORDER == LITTLE_ENDIAN) @@ -174,22 +174,22 @@ static const struct argp_option options[] = { {"just-print", 'N', 0, 0, "Just print the file system parameters that would be used"}, {"old-format", 'O', 0, 0, "Create a 4.3BSD format filesystem"}, - {"max-contig", 'a', "BLOCKS", 0, + {"max-contig", 'a', "BLOCKS", 0, "The maximum number of contiguous blocks that will be laid out before" " forcing a rotational delay; the default is no limit"}, {"block-size", 'b', "BYTES", 0, "The block size of the file system"}, {"group-cylinders", 'c', "N", 0, "The number of cylinders per cylinder group; the default 16"}, - {"rot-delay", 'd', "MSEC", 0, + {"rot-delay", 'd', "MSEC", 0, "The expected time to service a transfer completion interrupt and" " initiate a new transfer on the same disk; the default is 0"}, - {"max-bpg", 'e', "BLOCKS", 0, + {"max-bpg", 'e', "BLOCKS", 0, "Maximum number of blocks any single file can allocate out of a cylinder" " group before it is forced to begin allocating blocks from another" " cylinder group; the default is about one quarter of the total blocks" " in a cylinder group"}, {"frag-size", 'f', "BYTES", 0, "The fragment size"}, - {"inode-density", 'i', "BYTES", 0, + {"inode-density", 'i', "BYTES", 0, "The density of inodes in the file system, in bytes of data space per" " inode; the default is one inode per 4 filesystem frags"}, {"minfree", 'm', "PERCENT", 0, @@ -211,7 +211,7 @@ static const struct argp_option options[] = { {"tracks", 't', "N", 0, "The number of tracks/cylinder"}, {"sectors", 'u', "N", 0, "The number of sectors per track (does not include sectors reserved for" - " bad block replacement"}, + " bad block replacement"}, {"spare-sectors", 'p', "N", 0, "Spare sectors (for bad sector replacement) at the end of each track"}, {"cyl-spare-sectors", 'x', "N", 0, @@ -261,7 +261,7 @@ char *device = 0; #define deverr(code, err, fmt, args...) \ error (code, err, "%s: " fmt, device , ##args) -void +int main (int argc, char **argv) { int fdo, fdi; @@ -277,7 +277,7 @@ main (int argc, char **argv) { case 'N': Nflag = 1; break; case 'O': Oflag = 1; break; - + /* Mark &VAR as being a uparam, and return a lvalue for VAR. */ #define UP(var) (amarks_add (&uparams, &var), var) /* Record an integer uparam into VAR. */ @@ -302,7 +302,7 @@ main (int argc, char **argv) case 'p': UP_INT (nspares); break; case 'x': UP_INT (ncspares); break; - case 'o': + case 'o': amarks_add (&uparams, &opt); if (strcmp (arg, "time") == 0) opt = FS_OPTTIME; @@ -413,7 +413,7 @@ main (int argc, char **argv) nphyssectors = nsectors + nspares; secpercyl = nsectors * ntracks; - + DEFAULT (rpm, DL_INT (0, d_rpm)); DEFAULT (interleave, DL_INT (0, d_interleave)); DEFAULT (trackskew, DL_SECS (0, d_trackskew)); @@ -422,7 +422,7 @@ main (int argc, char **argv) DEFAULT (fsize, 1024); DEFAULT (bsize, 8192); - + DEFAULT (cpg, 16); DEFAULT (minfree, MINFREE); DEFAULT (opt, DEFAULTOPT); @@ -439,7 +439,7 @@ main (int argc, char **argv) mkfs (0, device, fdi, fdo); - exit (0); + return 0; } void @@ -656,7 +656,7 @@ mkfs(pp, fsys, fi, fo) } else exit(23); - /* + /* * Calculate the number of cylinders per group */ sblock.fs_cpg = cpg; @@ -905,7 +905,7 @@ next: sblock.fs_cssize - i < sblock.fs_bsize ? sblock.fs_cssize - i : sblock.fs_bsize, ((char *)fscs) + i); - /* + /* * Write out the duplicate super blocks */ for (cylno = 0; cylno < sblock.fs_ncg; cylno++) @@ -963,7 +963,7 @@ initcg(cylno, utime) acg.cg_nclusterblks = acg.cg_ndblk / sblock.fs_frag; acg.cg_btotoff = &acg.cg_space[0] - (u_char *)(&acg.cg_link); acg.cg_boff = acg.cg_btotoff + sblock.fs_cpg * sizeof(long); - acg.cg_iusedoff = acg.cg_boff + + acg.cg_iusedoff = acg.cg_boff + sblock.fs_cpg * sblock.fs_nrpos * sizeof(short); acg.cg_freeoff = acg.cg_iusedoff + howmany(sblock.fs_ipg, NBBY); if (sblock.fs_contigsumsize <= 0) { diff --git a/usermux/ChangeLog b/usermux/ChangeLog index e69de29b..f4602d55 100644 --- a/usermux/ChangeLog +++ b/usermux/ChangeLog @@ -0,0 +1,3 @@ +1998-10-20 Roland McGrath <roland@baalperazim.frob.com> + + * mux.c (get_dirents): Add braces to silence gcc warning. diff --git a/usermux/mux.c b/usermux/mux.c index 932361fd..54468ba7 100644 --- a/usermux/mux.c +++ b/usermux/mux.c @@ -1,6 +1,6 @@ /* Root usermux node - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 1998 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.ai.mit.edu> This file is part of the GNU Hurd. @@ -52,7 +52,7 @@ static error_t lookup_user (struct usermux *mux, const char *user, (*NODE, if found, should be locked, this call should unlock DIR no matter what.) */ error_t -netfs_attempt_lookup (struct iouser *user, struct node *dir, +netfs_attempt_lookup (struct iouser *user, struct node *dir, char *name, struct node **node) { error_t err; @@ -106,7 +106,7 @@ get_dirents (struct node *dir, { struct passwd *pw; char *p = *data; - int count = 0; + int count = 0; int entry_type = (S_ISLNK (dir->nn->mux->stat_template.st_mode) ? DT_LNK : DT_REG); @@ -119,18 +119,20 @@ get_dirents (struct node *dir, size_t sz = DIRENT_LEN (name_len); if ((p - *data) + sz > size) - if (max_data_len > 0) - break; - else - /* Try to grow our return buffer. */ - { - vm_address_t extension = (vm_address_t)(*data + size); - err = vm_allocate (mach_task_self (), &extension, - DIRENTS_CHUNK_SIZE, 0); - if (err) - break; - size += DIRENTS_CHUNK_SIZE; - } + { + if (max_data_len > 0) + break; + else + /* Try to grow our return buffer. */ + { + vm_address_t extension = (vm_address_t)(*data + size); + err = vm_allocate (mach_task_self (), &extension, + DIRENTS_CHUNK_SIZE, 0); + if (err) + break; + size += DIRENTS_CHUNK_SIZE; + } + } hdr.d_namlen = name_len; hdr.d_fileno = pw->pw_uid + USERMUX_FILENO_UID_OFFSET; @@ -223,7 +225,7 @@ netfs_get_dirents (struct iouser *cred, struct node *dir, rwlock_reader_unlock (&cache_lock); return EINVAL; } - + first += e->d_reclen; bytes_left -= e->d_reclen; entries_left--; @@ -255,7 +257,7 @@ netfs_get_dirents (struct iouser *cred, struct node *dir, *data_len = bytes_left; *data_entries = entries_left; - + err = vm_allocate (mach_task_self (), (vm_address_t *)data, bytes_left, 1); if (! err) bcopy (cached_data, *data, bytes_left); @@ -364,7 +366,7 @@ lookup_pwent (struct usermux *mux, const char *user, struct passwd *pw, } return 0; -} +} /* Lookup the user USER in MUX, and return the resulting node in NODE, with an additional reference, or an error. */ diff --git a/utils/ChangeLog b/utils/ChangeLog index b6799f0c..47771afc 100644 --- a/utils/ChangeLog +++ b/utils/ChangeLog @@ -1,3 +1,27 @@ +1998-10-20 Roland McGrath <roland@baalperazim.frob.com> + + * Makefile (OBJS): Use % pattern instead of explicit list. + + * parse.c (parse_enum): Add braces to silence gcc warning. + * psout.c (psout): Likewise. + * settrans.c (main): Likewise. + * showtrans.c (main): Likewise. + * w.c (w_fetch): Likewise. + * vminfo.c (main): Likewise. + +1998-09-05 Roland McGrath <roland@baalperazim.frob.com> + + * ping.c: <linux/icmp.h> -> <netinet/ip_icmp.h>; + struct icmphdr -> struct icmp; + Remove macro hacks to cope with old headers. + (pinger_wrapper): Take and return void *, so we're a cthread_fn_t. + +1998-09-04 Roland McGrath <roland@baalperazim.frob.com> + + * portinfo.c (hold): Declare explicit `int' to silence warning. + + * Makefile (OBJS): Use pattern %.sh instead of explicit list. + Fri Aug 21 19:25:12 1998 Jose M. Moya <josem@gnu.org> * msgport.c: Comments added. diff --git a/utils/parse.c b/utils/parse.c index 5f82a393..5334dbda 100644 --- a/utils/parse.c +++ b/utils/parse.c @@ -1,6 +1,6 @@ /* Random helpful option parsing functions - Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.ai.mit.edu> @@ -149,7 +149,7 @@ parse_numlist (char *arg, that ARG matches no entry , otherwise, an error message is printed and the program exits in this event. If ARG is an ambiguous match, an error message is printed and the program exits. */ -int +int parse_enum (const char *arg, const char *(*choice_fn)(unsigned n), const char *kind, int allow_mismatches, @@ -166,13 +166,15 @@ parse_enum (const char *arg, else { if (strncasecmp (choice, arg, arglen) == 0) - if (partial_match >= 0) - { - argp_error (state, "%s: Ambiguous %s", arg, kind); - return -1; - } - else - partial_match = n; + { + if (partial_match >= 0) + { + argp_error (state, "%s: Ambiguous %s", arg, kind); + return -1; + } + else + partial_match = n; + } n++; } diff --git a/utils/ping.c b/utils/ping.c index 525707b2..2f979e2c 100644 --- a/utils/ping.c +++ b/utils/ping.c @@ -40,7 +40,7 @@ char copyright[] = /* * From: @(#)ping.c 5.9 (Berkeley) 5/12/91 */ -char rcsid[] = "$Id: ping.c,v 1.2 1998/04/22 20:44:38 tb Exp $"; +char rcsid[] = "$Id: ping.c,v 1.3 1998/10/20 09:42:49 roland Exp $"; char pkg[] = "netkit-base-0.10"; /* @@ -69,8 +69,7 @@ char pkg[] = "netkit-base-0.10"; #include <netinet/in.h> #include <netinet/ip.h> -#include <linux/icmp.h> -/* #include <netinet/ip_icmp.h> */ +#include <netinet/ip_icmp.h> #include <arpa/inet.h> #include <netdb.h> #include <unistd.h> @@ -91,38 +90,6 @@ char pkg[] = "netkit-base-0.10"; #define SAFE_TO_DROP_ROOT #endif -#if defined(__GLIBC__) && (__GLIBC__ >= 2) && (__GLIBC_MINOR__ != 0) -#define icmphdr icmp -#define ICMP_DEST_UNREACH ICMP_UNREACH -#define ICMP_NET_UNREACH ICMP_UNREACH_NET -#define ICMP_HOST_UNREACH ICMP_UNREACH_HOST -#define ICMP_PORT_UNREACH ICMP_UNREACH_PORT -#define ICMP_PROT_UNREACH ICMP_UNREACH_PROTOCOL -#define ICMP_FRAG_NEEDED ICMP_UNREACH_NEEDFRAG -#define ICMP_SR_FAILED ICMP_UNREACH_SRCFAIL -#define ICMP_NET_UNKNOWN ICMP_UNREACH_NET_UNKNOWN -#define ICMP_HOST_UNKNOWN ICMP_UNREACH_HOST_UNKNOWN -#define ICMP_HOST_ISOLATED ICMP_UNREACH_ISOLATED -#define ICMP_NET_UNR_TOS ICMP_UNREACH_TOSNET -#define ICMP_HOST_UNR_TOS ICMP_UNREACH_TOSHOST -#define ICMP_SOURCE_QUENCH ICMP_SOURCEQUENCH -#define ICMP_REDIR_NET ICMP_REDIRECT_NET -#define ICMP_REDIR_HOST ICMP_REDIRECT_HOST -#define ICMP_REDIR_NETTOS ICMP_REDIRECT_TOSNET -#define ICMP_REDIR_HOSTTOS ICMP_REDIRECT_TOSHOST -#define ICMP_TIME_EXCEEDED ICMP_TIMXCEED -#define ICMP_EXC_TTL ICMP_TIMXCEED_INTRANS -#define ICMP_EXC_FRAGTIME ICMP_TIMXCEED_REASS -#define ICMP_PARAMETERPROB ICMP_PARAMPROB -#define ICMP_TIMESTAMP ICMP_TSTAMP -#define ICMP_TIMESTAMPREPLY ICMP_TSTAMPREPLY -#define ICMP_INFO_REQUEST ICMP_IREQ -#define ICMP_INFO_REPLY ICMP_IREQREPLY -#else -#define ICMP_MINLEN 28 -#define inet_ntoa(x) inet_ntoa(*((struct in_addr *)&(x))) -#endif - #define DEFDATALEN (64 - 8) /* default data length */ #define MAXIPLEN 60 #define MAXICMPLEN 76 @@ -195,17 +162,19 @@ static void fill(void *bp, char *patp); static void usage(void); static void pr_pack(char *buf, int cc, struct sockaddr_in *from); static void tvsub(struct timeval *out, struct timeval *in); -static void pr_icmph(struct icmphdr *icp); +static void pr_icmph(struct icmp *icp); static void pr_retip(struct ip *ip); /* Only wrapper to call pinger (). */ -pinger_wrapper () +void * +pinger_wrapper (void *ignored) { for (;;) { pinger (); sleep (interval); } + return 0; } int @@ -231,7 +200,7 @@ main(int argc, char *argv[]) am_i_root = (getuid()==0); cthread_init (); - + /* * Pull this stuff up front so we can drop root if desired. */ @@ -363,7 +332,7 @@ main(int argc, char *argv[]) } argc -= optind; argv += optind; - + if (argc != 1) usage(); target = *argv; @@ -487,13 +456,13 @@ main(int argc, char *argv[]) /* I replace this with thread -- Kunihiro (void)signal(SIGALRM, catcher); */ - + while (preload--) /* fire off them quickies */ pinger(); if ((options & F_FLOOD) == 0) - cthread_detach (cthread_fork ((cthread_fn_t) pinger_wrapper, NULL)); + cthread_detach (cthread_fork (pinger_wrapper, NULL)); for (;;) { @@ -531,7 +500,7 @@ main(int argc, char *argv[]) * catcher -- * This routine causes another PING to be transmitted, and then * schedules another SIGALRM for 1 second from now. - * + * * bug -- * Our sense of time will slowly skew (i.e., packets will not be * launched exactly at 1-second intervals). This does not affect the @@ -561,28 +530,6 @@ catcher(int ignore) } } -/* This is quick hack to compile this file under old Linux's linux/icmp.h */ -#if defined(__GLIBC__) && (__GLIBC__ >= 2) -#define icmp_type type -#define icmp_code code -#define icmp_cksum checksum -#define icmp_id un.echo.id -#define icmp_seq un.echo.sequence -#define icmp_gwaddr un.gateway -#else -#define ip_hl ihl -#define ip_v version -#define ip_tos tos -#define ip_len tot_len -#define ip_id id -#define ip_off frag_off -#define ip_ttl ttl -#define ip_p protocol -#define ip_sum check -#define ip_src saddr -#define ip_dst daddr -#endif - /* * pinger -- * Compose and transmit an ICMP ECHO REQUEST packet. The IP packet @@ -594,11 +541,11 @@ catcher(int ignore) static void pinger(void) { - register struct icmphdr *icp; + register struct icmp *icp; register int cc; int i; - icp = (struct icmphdr *)outpack; + icp = (struct icmp *)outpack; icp->icmp_type = ICMP_ECHO; icp->icmp_code = 0; icp->icmp_cksum = 0; @@ -639,7 +586,7 @@ pinger(void) void pr_pack(char *buf, int cc, struct sockaddr_in *from) { - register struct icmphdr *icp; + register struct icmp *icp; register int i; register u_char *cp,*dp; /*#if 0*/ @@ -668,7 +615,7 @@ pr_pack(char *buf, int cc, struct sockaddr_in *from) /* Now the ICMP part */ cc -= hlen; - icp = (struct icmphdr *)(buf + hlen); + icp = (struct icmp *)(buf + hlen); if (icp->icmp_type == ICMP_ECHOREPLY) { if (icp->icmp_id != ident) return; /* 'Twas not our ECHO */ @@ -932,7 +879,7 @@ static char *ttab[] = { * Print a descriptive string about an ICMP header. */ static void -pr_icmph(struct icmphdr *icp) +pr_icmph(struct icmp *icp) { switch(icp->icmp_type) { case ICMP_ECHOREPLY: @@ -1027,7 +974,7 @@ pr_icmph(struct icmphdr *icp) (void)printf("Redirect, Bad Code: %d", icp->icmp_code); break; } - (void)printf("(New addr: %s)\n", + (void)printf("(New addr: %s)\n", inet_ntoa(icp->icmp_gwaddr)); #ifndef icmp_data pr_retip((struct ip *)(icp + 1)); @@ -1139,7 +1086,7 @@ pr_addr(u_long l) if ((options & F_NUMERIC) || !(hp = gethostbyaddr((char *)&l, 4, AF_INET))) - (void)snprintf(buf, sizeof(buf), "%s", + (void)snprintf(buf, sizeof(buf), "%s", inet_ntoa(*(struct in_addr *)&l)); else (void)snprintf(buf, sizeof(buf), "%s (%s)", hp->h_name, diff --git a/utils/portinfo.c b/utils/portinfo.c index c56027b0..dd2f0ba1 100644 --- a/utils/portinfo.c +++ b/utils/portinfo.c @@ -1,6 +1,6 @@ /* Print information about a task's ports - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.ai.mit.edu> @@ -102,7 +102,7 @@ parse_task (char *arg) return task; } -static volatile hold = 0; +static volatile int hold = 0; int main (int argc, char **argv) diff --git a/utils/psout.c b/utils/psout.c index 3c39eff0..d3bde0cf 100644 --- a/utils/psout.c +++ b/utils/psout.c @@ -1,6 +1,6 @@ /* Common output function for ps & w - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.ai.mit.edu> @@ -97,15 +97,17 @@ psout (struct proc_stat_list *procs, error (5, err, "Can't make output stream"); if (print_heading) - if (procs->num_procs > 0) - { - err = ps_fmt_write_titles (fmt, output); - if (err) - error (0, err, "Can't print titles"); - ps_stream_newline (output); - } - else - error (0, 0, "No applicable processes"); + { + if (procs->num_procs > 0) + { + err = ps_fmt_write_titles (fmt, output); + if (err) + error (0, err, "Can't print titles"); + ps_stream_newline (output); + } + else + error (0, 0, "No applicable processes"); + } if (output_width) /* Try and restrict the number of output columns. */ diff --git a/utils/settrans.c b/utils/settrans.c index 4f82c666..408849a3 100644 --- a/utils/settrans.c +++ b/utils/settrans.c @@ -151,13 +151,15 @@ main(int argc, char *argv[]) active_flags = FS_TRANS_SET | (excl ? FS_TRANS_EXCL : 0); if (passive && !active) - /* When setting just the passive, decide what to do with any active. */ - if (kill_active) - /* Make it go away. */ - active_flags = FS_TRANS_SET; - else if (! keep_active) - /* Ensure that there isn't one. */ - active_flags = FS_TRANS_SET | FS_TRANS_EXCL; + { + /* When setting just the passive, decide what to do with any active. */ + if (kill_active) + /* Make it go away. */ + active_flags = FS_TRANS_SET; + else if (! keep_active) + /* Ensure that there isn't one. */ + active_flags = FS_TRANS_SET | FS_TRANS_EXCL; + } if (active && argz_len > 0) { diff --git a/utils/showtrans.c b/utils/showtrans.c index 5ec36a0c..74da61fa 100644 --- a/utils/showtrans.c +++ b/utils/showtrans.c @@ -77,10 +77,12 @@ main (int argc, char *argv[]) argz_stringify (trans, trans_len, ' '); if (!silent) - if (print_prefix) - printf ("%s: %s\n", name, trans); - else - puts (trans); + { + if (print_prefix) + printf ("%s: %s\n", name, trans); + else + puts (trans); + } if (trans != buf) vm_deallocate (mach_task_self (), diff --git a/utils/vminfo.c b/utils/vminfo.c index 73ddb99d..4440c00b 100644 --- a/utils/vminfo.c +++ b/utils/vminfo.c @@ -1,6 +1,6 @@ /* Print task vm information - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.ai.mit.edu> @@ -143,7 +143,7 @@ main (int argc, char **argv) break; case ARGP_KEY_NO_ARGS: - argp_usage (state); + argp_usage (state); default: return ARGP_ERR_UNKNOWN; @@ -179,16 +179,22 @@ main (int argc, char **argv) } if (holes && hole_addr != addr) - if ((what & (W_ADDRS|W_SIZES)) == (W_ADDRS|W_SIZES)) - if (hex) - printf (" [%#x] (hole)\n", addr - hole_addr); - else - printf (" [%d] (hole)\n", addr - hole_addr); - else if ((what & (W_ADDRS|W_SIZES)) == W_SIZES) - if (hex) - printf ("%#10x (hole)\n", addr - hole_addr); - else - printf ("%10u (hole)\n", addr - hole_addr); + { + if ((what & (W_ADDRS|W_SIZES)) == (W_ADDRS|W_SIZES)) + { + if (hex) + printf (" [%#x] (hole)\n", addr - hole_addr); + else + printf (" [%d] (hole)\n", addr - hole_addr); + } + else if ((what & (W_ADDRS|W_SIZES)) == W_SIZES) + { + if (hex) + printf ("%#10x (hole)\n", addr - hole_addr); + else + printf ("%10u (hole)\n", addr - hole_addr); + } + } if ((what & (W_ADDRS|W_SIZES)) == (W_ADDRS|W_SIZES)) if (hex) @@ -201,10 +207,12 @@ main (int argc, char **argv) else printf ("%10u", addr); else if ((what & (W_ADDRS|W_SIZES)) == W_SIZES) - if (hex) - printf ("%#10x", size); - else - printf ("%10u", size); + { + if (hex) + printf ("%#10x", size); + else + printf ("%10u", size); + } if (what & W_DETAILS) { printf (" (prot=%s", prot_rep (prot)); @@ -217,10 +225,12 @@ main (int argc, char **argv) if (obj != MACH_PORT_NULL) printf (", mem_obj=%d", obj); if (offs != 0) - if (hex) - printf (", offs=%#x", offs); - else - printf (", offs=%d", offs); + { + if (hex) + printf (", offs=%#x", offs); + else + printf (", offs=%d", offs); + } putchar (')'); } putchar ('\n'); @@ -135,28 +135,30 @@ w_fetch (struct proc_stat *ps, ps_flags_t need, ps_flags_t have) } if (need & W_PSTAT_IDLE) - if (have & PSTAT_TTY) - { - struct stat stat; - struct ps_tty *tty = ps->tty; - - hook->idle.tv_usec = 0; - if (! tty) - { - hook->idle.tv_sec = 0; - have |= W_PSTAT_IDLE; - } - else - { - if (io_stat (tty->port, &stat) == 0) - { - hook->idle.tv_sec = now.tv_sec - stat.st_atime; - have |= W_PSTAT_IDLE; - } - } - } - else if (ps->inapp & PSTAT_TTY) - ps->inapp |= W_PSTAT_IDLE; + { + if (have & PSTAT_TTY) + { + struct stat stat; + struct ps_tty *tty = ps->tty; + + hook->idle.tv_usec = 0; + if (! tty) + { + hook->idle.tv_sec = 0; + have |= W_PSTAT_IDLE; + } + else + { + if (io_stat (tty->port, &stat) == 0) + { + hook->idle.tv_sec = now.tv_sec - stat.st_atime; + have |= W_PSTAT_IDLE; + } + } + } + else if (ps->inapp & PSTAT_TTY) + ps->inapp |= W_PSTAT_IDLE; + } if (need & W_PSTAT_USER) if (ps_user_uname_create (hook->utmp.ut_name, &hook->user) == 0) |