From a276dc6b198ac253911f4d7e2994422e81efea72 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Fri, 21 Aug 2009 03:41:09 -0700 Subject: [PATCH] AMD64 - AUDIT RUN - Fix format strings, size_t, and other issues --- bin/dd/args.c | 12 +-- bin/dd/misc.c | 19 ++-- bin/sh/mksyntax.c | 2 +- bin/sh/parser.c | 1 + contrib/com_err/getarg.c | 5 +- contrib/libevent/kqueue.c | 6 +- .../ncurses-5.4/ncurses/trace/lib_tracechr.c | 2 +- contrib/opie/libopie/generator.c | 1 + contrib/opie/libopie/lookup.c | 1 + contrib/opie/libopie/newseed.c | 1 + contrib/opie/libopie/passwd.c | 1 + contrib/opie/libopie/randomchallenge.c | 2 + contrib/opie/libopie/version.c | 2 + contrib/sendmail-8.14/libmilter/listener.c | 2 +- contrib/smbfs/lib/smb/file.c | 3 +- contrib/smbfs/lib/smb/kiconv.c | 3 +- contrib/smbfs/lib/smb/nb_net.c | 2 +- contrib/smbfs/lib/smb/nls.c | 9 +- contrib/smbfs/lib/smb/rap.c | 3 +- contrib/smbfs/lib/smb/rq.c | 1 + contrib/tcp_wrappers/options.c | 1 + contrib/tcp_wrappers/shell_cmd.c | 1 + gnu/lib/libdialog/rc.c | 1 + gnu/usr.bin/sort/getopt.c | 1 + lib/libc/gen/nlist.c | 5 ++ lib/libc_r/uthread/uthread_sig.c | 2 +- lib/libcompat/4.3/rexec.c | 21 +++-- lib/libncp/ncpl_conn.c | 6 +- lib/libncp/ncpl_subr.c | 5 +- lib/libsctp/sctp_sys_calls.c | 2 +- lib/libthread_xu/thread/thr_private.h | 2 +- libexec/rtld-elf/debug.c | 14 +-- sbin/camcontrol/camcontrol.c | 6 +- sbin/camcontrol/util.c | 2 +- sbin/diskinfo/diskinfo.c | 9 +- sbin/disklabel64/disklabel64.c | 68 +++++++------- sbin/dumpfs/dumpfs.c | 9 +- sbin/fdisk/fdisk.c | 4 +- sbin/fsdb/fsdb.c | 6 +- sbin/fsirand/fsirand.c | 28 +++--- sbin/growfs/growfs.c | 4 +- sbin/hammer/cmd_blockmap.c | 17 ++-- sbin/hammer/cmd_history.c | 12 +-- sbin/hammer/cmd_info.c | 20 +++-- sbin/hammer/cmd_mirror.c | 89 ++++++++++--------- sbin/hammer/cmd_pseudofs.c | 8 +- sbin/hammer/cmd_rebalance.c | 24 ++--- sbin/hammer/cmd_reblock.c | 21 ++--- sbin/hammer/cmd_show.c | 69 +++++++------- sbin/hammer/cmd_snapshot.c | 2 +- sbin/hammer/cmd_softprune.c | 25 +++--- sbin/hammer/cmd_stats.c | 31 +++---- sbin/hammer/cmd_synctid.c | 2 +- sbin/hammer/cycle.c | 2 +- sbin/hammer/hammer.c | 10 +-- sbin/jscan/dump_debug.c | 13 +-- sbin/jscan/jfile.c | 6 +- sbin/jscan/jscan.c | 12 +-- sbin/jscan/jsession.c | 4 +- sbin/jscan/jstream.c | 24 +++-- sbin/jscan/subs.c | 2 +- sbin/mountctl/mountctl.c | 4 +- sbin/quotacheck/quotacheck.c | 6 +- sbin/restore/tape.c | 11 ++- sbin/savecore/savecore.c | 6 +- sbin/sysctl/sysctl.c | 15 ++-- secure/lib/libssh/version.c | 1 + sys/netproto/smb/smb_dev.h | 2 +- usr.bin/cmp/misc.c | 4 +- usr.bin/cmp/regular.c | 9 +- usr.bin/cmp/special.c | 3 +- usr.bin/finger/lprint.c | 2 +- usr.bin/finger/util.c | 2 +- usr.bin/gprof/arcs.c | 6 +- usr.bin/gprof/printgprof.c | 4 +- usr.bin/limits/limits.c | 2 +- usr.bin/monitor/monitor.c | 2 +- usr.bin/tail/misc.c | 6 +- usr.bin/tail/reverse.c | 5 +- usr.bin/wc/wc.c | 18 ++-- 80 files changed, 439 insertions(+), 337 deletions(-) diff --git a/bin/dd/args.c b/bin/dd/args.c index 2ed99936c7..980047dacd 100644 --- a/bin/dd/args.c +++ b/bin/dd/args.c @@ -159,8 +159,10 @@ jcl(char **argv) /* * Bail out if the calculation of a file offset would overflow. */ - if (in.offset > QUAD_MAX / in.dbsz || out.offset > QUAD_MAX / out.dbsz) + if (in.offset > QUAD_MAX / (ssize_t)in.dbsz || + out.offset > QUAD_MAX / (ssize_t)out.dbsz) { errx(1, "seek offsets cannot be larger than %lld", QUAD_MAX); + } } static int @@ -178,7 +180,7 @@ f_bs(char *arg) res = get_num(arg); if (res < 1 || res > SSIZE_MAX) - errx(1, "bs must be between 1 and %d", SSIZE_MAX); + errx(1, "bs must be between 1 and %zd", SSIZE_MAX); in.dbsz = out.dbsz = (size_t)res; } @@ -189,7 +191,7 @@ f_cbs(char *arg) res = get_num(arg); if (res < 1 || res > SSIZE_MAX) - errx(1, "cbs must be between 1 and %d", SSIZE_MAX); + errx(1, "cbs must be between 1 and %zd", SSIZE_MAX); cbsz = (size_t)res; } @@ -221,7 +223,7 @@ f_ibs(char *arg) if (!(ddflags & C_BS)) { res = get_num(arg); if (res < 1 || res > SSIZE_MAX) - errx(1, "ibs must be between 1 and %d", SSIZE_MAX); + errx(1, "ibs must be between 1 and %zd", SSIZE_MAX); in.dbsz = (size_t)res; } } @@ -241,7 +243,7 @@ f_obs(char *arg) if (!(ddflags & C_BS)) { res = get_num(arg); if (res < 1 || res > SSIZE_MAX) - errx(1, "obs must be between 1 and %d", SSIZE_MAX); + errx(1, "obs must be between 1 and %zd", SSIZE_MAX); out.dbsz = (size_t)res; } } diff --git a/bin/dd/misc.c b/bin/dd/misc.c index 894e5d8b4c..8a1c36308a 100644 --- a/bin/dd/misc.c +++ b/bin/dd/misc.c @@ -60,22 +60,25 @@ summary(void) secs = 1e-6; /* Use snprintf(3) so that we don't reenter stdio(3). */ snprintf(buf, sizeof(buf), - "%llu+%llu records in\n%llu+%llu records out\n", - st.in_full, st.in_part, st.out_full, st.out_part); + "%ju+%ju records in\n%ju+%ju records out\n", + (uintmax_t)st.in_full, (uintmax_t)st.in_part, + (uintmax_t)st.out_full, (uintmax_t)st.out_part); write(STDERR_FILENO, buf, strlen(buf)); if (st.swab) { - snprintf(buf, sizeof(buf), "%llu odd length swab %s\n", - st.swab, (st.swab == 1) ? "block" : "blocks"); + snprintf(buf, sizeof(buf), "%ju odd length swab %s\n", + (uintmax_t)st.swab, + ((st.swab == 1) ? "block" : "blocks")); write(STDERR_FILENO, buf, strlen(buf)); } if (st.trunc) { - snprintf(buf, sizeof(buf), "%llu truncated %s\n", - st.trunc, (st.trunc == 1) ? "block" : "blocks"); + snprintf(buf, sizeof(buf), "%ju truncated %s\n", + (uintmax_t)st.trunc, + ((st.trunc == 1) ? "block" : "blocks")); write(STDERR_FILENO, buf, strlen(buf)); } snprintf(buf, sizeof(buf), - "%llu bytes transferred in %.6f secs (%.0f bytes/sec)\n", - st.bytes, secs, st.bytes / secs); + "%ju bytes transferred in %.6f secs (%.0f bytes/sec)\n", + (uintmax_t)st.bytes, secs, st.bytes / secs); write(STDERR_FILENO, buf, strlen(buf)); } diff --git a/bin/sh/mksyntax.c b/bin/sh/mksyntax.c index 7a4e54534f..74dab7f73f 100644 --- a/bin/sh/mksyntax.c +++ b/bin/sh/mksyntax.c @@ -385,7 +385,7 @@ digit_convert(void) for (p = digit ; *p && *p != i ; p++); if (*p == '\0') p = digit; - fprintf(cfile, " %d,\n", p - digit); + fprintf(cfile, " %td,\n", p - digit); } fputs("};\n", cfile); } diff --git a/bin/sh/parser.c b/bin/sh/parser.c index 96d9ff5c4a..10ca2c0f6f 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -38,6 +38,7 @@ * $DragonFly: src/bin/sh/parser.c,v 1.12 2007/01/18 17:03:18 corecode Exp $ */ +#include #include #include diff --git a/contrib/com_err/getarg.c b/contrib/com_err/getarg.c index 6972e6987c..6978176cd0 100644 --- a/contrib/com_err/getarg.c +++ b/contrib/com_err/getarg.c @@ -43,6 +43,8 @@ RCSID("$Id: getarg.c,v 1.25 1998/11/22 09:45:05 assar Exp $"); #include #include #include +#include +#include #include "getarg.h" #define ISFLAG(X) ((X).type == arg_flag || (X).type == arg_negative_flag) @@ -175,7 +177,8 @@ arg_printusage (struct getargs *args, static void add_string(getarg_strings *s, char *value) { - s->strings = realloc(s->strings, (s->num_strings + 1) * sizeof(*s->strings)); + s->strings = realloc(s->strings, + (s->num_strings + 1) * sizeof(*s->strings)); s->strings[s->num_strings] = value; s->num_strings++; } diff --git a/contrib/libevent/kqueue.c b/contrib/libevent/kqueue.c index 059d94a0b4..cf0503c972 100644 --- a/contrib/libevent/kqueue.c +++ b/contrib/libevent/kqueue.c @@ -51,11 +51,7 @@ /* Some platforms apparently define the udata field of struct kevent as * ntptr_t, whereas others define it as void*. There doesn't seem to be an * easy way to tell them apart via autoconf, so we need to use OS macros. */ -#if defined(HAVE_INTTYPES_H) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__darwin__) && !defined(__APPLE__) -#define PTR_TO_UDATA(x) ((intptr_t)(x)) -#else -#define PTR_TO_UDATA(x) (x) -#endif +#define PTR_TO_UDATA(x) ((void *)(x)) #include "event.h" #include "log.h" diff --git a/contrib/ncurses-5.4/ncurses/trace/lib_tracechr.c b/contrib/ncurses-5.4/ncurses/trace/lib_tracechr.c index 5ceeed2aa9..05647b8809 100644 --- a/contrib/ncurses-5.4/ncurses/trace/lib_tracechr.c +++ b/contrib/ncurses-5.4/ncurses/trace/lib_tracechr.c @@ -45,7 +45,7 @@ NCURSES_EXPORT(char *) _tracechar(int ch) { static char result[40]; - char *name; + const char *name; if (ch > KEY_MIN || ch < 0) { name = keyname(ch); diff --git a/contrib/opie/libopie/generator.c b/contrib/opie/libopie/generator.c index 0f2c95a781..1ccedce9db 100644 --- a/contrib/opie/libopie/generator.c +++ b/contrib/opie/libopie/generator.c @@ -34,6 +34,7 @@ $DragonFly: src/contrib/opie/libopie/generator.c,v 1.2 2003/06/17 04:24:05 dillo */ #include "opie_cfg.h" +#include #if HAVE_STRING_H #include #endif /* HAVE_STRING_H */ diff --git a/contrib/opie/libopie/lookup.c b/contrib/opie/libopie/lookup.c index 3003da7c73..de6d614774 100644 --- a/contrib/opie/libopie/lookup.c +++ b/contrib/opie/libopie/lookup.c @@ -13,6 +13,7 @@ you didn't get a copy, you may request one from . #include "opie_cfg.h" #include +#include #include "opie.h" int opielookup FUNCTION((opie, principal), struct opie *opie AND char *principal) diff --git a/contrib/opie/libopie/newseed.c b/contrib/opie/libopie/newseed.c index e91a3b5798..8fd171fb90 100644 --- a/contrib/opie/libopie/newseed.c +++ b/contrib/opie/libopie/newseed.c @@ -19,6 +19,7 @@ $DragonFly: src/contrib/opie/libopie/newseed.c,v 1.2 2003/06/17 04:24:05 dillon */ #include "opie_cfg.h" +#include #if HAVE_TIME_H #include #endif /* HAVE_TIME_H */ diff --git a/contrib/opie/libopie/passwd.c b/contrib/opie/libopie/passwd.c index 1c3b1ab600..0ee050334f 100644 --- a/contrib/opie/libopie/passwd.c +++ b/contrib/opie/libopie/passwd.c @@ -20,6 +20,7 @@ you didn't get a copy, you may request one from . Created by cmetz for OPIE 2.22. */ +#include #include "opie_cfg.h" #include "opie.h" diff --git a/contrib/opie/libopie/randomchallenge.c b/contrib/opie/libopie/randomchallenge.c index 7cf18bb54f..638ae2fcb2 100644 --- a/contrib/opie/libopie/randomchallenge.c +++ b/contrib/opie/libopie/randomchallenge.c @@ -26,6 +26,8 @@ License Agreement applies to this software. Created at NRL for OPIE 2.2 from opiesubr2.c */ +#include +#include #include "opie_cfg.h" #include "opie.h" diff --git a/contrib/opie/libopie/version.c b/contrib/opie/libopie/version.c index 2364e7755c..ec41f6523c 100644 --- a/contrib/opie/libopie/version.c +++ b/contrib/opie/libopie/version.c @@ -17,6 +17,8 @@ License Agreement applies to this software. Modified by cmetz for OPIE 2.2. Use FUNCTION declaration et al. Created at NRL for OPIE 2.2 from opiesubr.c. */ +#include +#include #include "opie_cfg.h" #include "opie.h" diff --git a/contrib/sendmail-8.14/libmilter/listener.c b/contrib/sendmail-8.14/libmilter/listener.c index 6e68ae55d4..32c95a038c 100644 --- a/contrib/sendmail-8.14/libmilter/listener.c +++ b/contrib/sendmail-8.14/libmilter/listener.c @@ -576,7 +576,7 @@ mi_thread_handle_wrapper(arg) ** is not used anywhere. */ - return (void *) mi_handle_session(arg); + return (void *)(intptr_t)mi_handle_session(arg); } #endif /* _FFR_WORKERS_POOL */ diff --git a/contrib/smbfs/lib/smb/file.c b/contrib/smbfs/lib/smb/file.c index 8b4cff4c58..ffd2f50fb8 100644 --- a/contrib/smbfs/lib/smb/file.c +++ b/contrib/smbfs/lib/smb/file.c @@ -32,6 +32,7 @@ * $Id: file.c,v 1.2 2001/04/16 04:33:01 bp Exp $ */ #include +#include #include #include #include @@ -71,7 +72,7 @@ smb_write(struct smb_ctx *ctx, smbfh fh, off_t offset, size_t count, struct smbioc_rw rwrq; rwrq.ioc_fh = fh; - rwrq.ioc_base = src; + rwrq.ioc_base = __DECONST(char *, src); rwrq.ioc_cnt = count; rwrq.ioc_offset = offset; if (ioctl(ctx->ct_fd, SMBIOC_WRITE, &rwrq) == -1) diff --git a/contrib/smbfs/lib/smb/kiconv.c b/contrib/smbfs/lib/smb/kiconv.c index e75f664643..10cc9cab9d 100644 --- a/contrib/smbfs/lib/smb/kiconv.c +++ b/contrib/smbfs/lib/smb/kiconv.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #ifdef APPLE @@ -48,7 +49,7 @@ kiconv_add_xlat_table(const char *to, const char *from, const u_char *table) { struct iconv_add_in din; struct iconv_add_out dout; - int olen; + size_t olen; if (strlen(from) > ICONV_CSNMAXLEN || strlen(to) > ICONV_CSNMAXLEN) return EINVAL; diff --git a/contrib/smbfs/lib/smb/nb_net.c b/contrib/smbfs/lib/smb/nb_net.c index c0a206069e..8ac346f945 100644 --- a/contrib/smbfs/lib/smb/nb_net.c +++ b/contrib/smbfs/lib/smb/nb_net.c @@ -198,4 +198,4 @@ nb_hostlookup(struct nb_name *np, const char *server, const char *hint, nb_snbfree(snb); return error; } -*/ \ No newline at end of file +*/ diff --git a/contrib/smbfs/lib/smb/nls.c b/contrib/smbfs/lib/smb/nls.c index 19c3123769..8af1de7cd1 100644 --- a/contrib/smbfs/lib/smb/nls.c +++ b/contrib/smbfs/lib/smb/nls.c @@ -41,6 +41,7 @@ #endif #include #include +#include #include #include #include @@ -125,7 +126,7 @@ char * nls_str_toloc(char *dst, const char *src) { char *p = dst; - int inlen, outlen; + size_t inlen, outlen; if (!iconv_loaded) return strcpy(dst, src); @@ -147,7 +148,7 @@ char * nls_str_toext(char *dst, const char *src) { char *p = dst; - int inlen, outlen; + size_t inlen, outlen; if (!iconv_loaded) return strcpy(dst, src); @@ -170,7 +171,7 @@ nls_mem_toloc(void *dst, const void *src, int size) { char *p = dst; const char *s = src; - int inlen, outlen; + size_t inlen, outlen; if (!iconv_loaded) return memcpy(dst, src, size); @@ -195,7 +196,7 @@ nls_mem_toext(void *dst, const void *src, int size) { char *p = dst; const char *s = src; - int inlen, outlen; + size_t inlen, outlen; if (size == 0) return NULL; diff --git a/contrib/smbfs/lib/smb/rap.c b/contrib/smbfs/lib/smb/rap.c index 952f66670b..eb4671c2e0 100644 --- a/contrib/smbfs/lib/smb/rap.c +++ b/contrib/smbfs/lib/smb/rap.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -198,7 +199,7 @@ smb_rap_create(int fn, const char *param, const char *data, rap = malloc(sizeof(*rap)); if (rap == NULL) - return NULL; + return ENOMEM; bzero(rap, sizeof(*rap)); p = rap->r_sparam = rap->r_nparam = strdup(param); rap->r_sdata = rap->r_ndata = strdup(data); diff --git a/contrib/smbfs/lib/smb/rq.c b/contrib/smbfs/lib/smb/rq.c index ae6bf8d4c1..7268e58422 100644 --- a/contrib/smbfs/lib/smb/rq.c +++ b/contrib/smbfs/lib/smb/rq.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include diff --git a/contrib/tcp_wrappers/options.c b/contrib/tcp_wrappers/options.c index 671c8ddf96..bcb26b4da5 100644 --- a/contrib/tcp_wrappers/options.c +++ b/contrib/tcp_wrappers/options.c @@ -41,6 +41,7 @@ static char sccsid[] = "@(#) options.c 1.17 96/02/11 17:01:31"; #include #include #include +#include #define SYSLOG_NAMES #include #include diff --git a/contrib/tcp_wrappers/shell_cmd.c b/contrib/tcp_wrappers/shell_cmd.c index 62d31bc524..dc46f925b0 100644 --- a/contrib/tcp_wrappers/shell_cmd.c +++ b/contrib/tcp_wrappers/shell_cmd.c @@ -18,6 +18,7 @@ static char sccsid[] = "@(#) shell_cmd.c 1.5 94/12/28 17:42:44"; #include #include #include +#include #include #include diff --git a/gnu/lib/libdialog/rc.c b/gnu/lib/libdialog/rc.c index 700b98f7a0..208a3775e0 100644 --- a/gnu/lib/libdialog/rc.c +++ b/gnu/lib/libdialog/rc.c @@ -245,6 +245,7 @@ static int str_to_attr(unsigned char *str, int *fg, int *bg, int *hl) strcpy(tempstr, str + 1); lastch(tempstr) = '\0'; + *fg = 0; /* fix compiler warning */ /* get foreground and background */ diff --git a/gnu/usr.bin/sort/getopt.c b/gnu/usr.bin/sort/getopt.c index 8bcf559457..aa01b24f46 100644 --- a/gnu/usr.bin/sort/getopt.c +++ b/gnu/usr.bin/sort/getopt.c @@ -39,6 +39,7 @@ #endif #include +#include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C diff --git a/lib/libc/gen/nlist.c b/lib/libc/gen/nlist.c index 21b98e6022..08d71bbb1c 100644 --- a/lib/libc/gen/nlist.c +++ b/lib/libc/gen/nlist.c @@ -256,11 +256,13 @@ __elf_fdnlist(int fd, struct nlist *list) /* calculate section header table size */ shdr_size = ehdr.e_shentsize * ehdr.e_shnum; +#ifndef __amd64__ /* Make sure it's not too big to mmap */ if (shdr_size > SIZE_T_MAX) { errno = EFBIG; return (-1); } +#endif /* mmap section header table */ base = mmap(NULL, (size_t)shdr_size, PROT_READ, 0, fd, @@ -285,11 +287,14 @@ __elf_fdnlist(int fd, struct nlist *list) } } +#ifndef __amd64__ /* Check for files too large to mmap. */ if (symstrsize > SIZE_T_MAX) { errno = EFBIG; goto done; } +#endif + /* * Map string table into our address space. This gives us * an easy way to randomly access all the strings, without diff --git a/lib/libc_r/uthread/uthread_sig.c b/lib/libc_r/uthread/uthread_sig.c index dd18e0d600..9596b62380 100644 --- a/lib/libc_r/uthread/uthread_sig.c +++ b/lib/libc_r/uthread/uthread_sig.c @@ -283,7 +283,7 @@ thread_sig_invoke_handler(int sig, siginfo_t *info, ucontext_t *ucp) (info == NULL)) (*(sigfunc))(sig, info, ucp); else - (*(sigfunc))(sig, (siginfo_t *)info->si_code, ucp); + (*(sigfunc))(sig, (siginfo_t *)(intptr_t)info->si_code, ucp); } /* * Only restore the signal mask if it hasn't been changed by the diff --git a/lib/libcompat/4.3/rexec.c b/lib/libcompat/4.3/rexec.c index 2ce344a9ac..890b7d964c 100644 --- a/lib/libcompat/4.3/rexec.c +++ b/lib/libcompat/4.3/rexec.c @@ -136,7 +136,7 @@ token(void) } static int -ruserpass(char *host, char **aname, char **apass, char **aacct) +ruserpass(char *host, const char **aname, const char **apass, char **aacct) { char *hdir, buf[BUFSIZ], *tmp; char myname[MAXHOSTNAMELEN], *mydomain; @@ -189,9 +189,11 @@ next: case LOGIN: if (token()) - if (*aname == 0) { - *aname = malloc((unsigned) strlen(tokval) + 1); - (void) strcpy(*aname, tokval); + if (*aname == NULL) { + char *tmp; + tmp = malloc(strlen(tokval) + 1); + strcpy(tmp, tokval); + *aname = tmp; } else { if (strcmp(*aname, tokval)) goto next; @@ -206,8 +208,10 @@ next: goto bad; } if (token() && *apass == 0) { - *apass = malloc((unsigned) strlen(tokval) + 1); - (void) strcpy(*apass, tokval); + char *tmp; + tmp = malloc(strlen(tokval) + 1); + strcpy(tmp, tokval); + *apass = tmp; } break; case ACCOUNT: @@ -312,7 +316,8 @@ rexec_af(char **ahost, int rport, const char *name, const char *pass, servbuff[sizeof(servbuff) - 1] = '\0'; memset(&hints, '\0', sizeof(hints)); - hints.ai_family = af; + if (af) + hints.ai_family = *af; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_CANONNAME; gai = getaddrinfo(*ahost, servbuff, &hints, &res0); @@ -431,7 +436,7 @@ bad: int -rexec(char **ahost, int rport, char *name, char *pass, char *cmd, int *fd2p) +rexec(char **ahost, int rport, const char *name, const char *pass, char *cmd, int *fd2p) { struct sockaddr_in sin, sin2, from; struct hostent *hp; diff --git a/lib/libncp/ncpl_conn.c b/lib/libncp/ncpl_conn.c index 10afdbdd5a..cb10563a60 100644 --- a/lib/libncp/ncpl_conn.c +++ b/lib/libncp/ncpl_conn.c @@ -274,7 +274,8 @@ ncp_li_check(struct ncp_conn_loginfo *li) { int ncp_conn_cnt(void) { - int error, cnt = 0, len = sizeof(cnt); + int error, cnt = 0; + size_t len = sizeof(cnt); error = sysctlbyname("net.ncp.conn_cnt", &cnt, &len, NULL, 0); if (error) cnt = 0; @@ -382,7 +383,8 @@ ncp_li_arg(struct ncp_conn_loginfo *li, int opt, char *arg) { void * ncp_conn_list(void) { - int error, cnt = 0, len; + int error, cnt = 0; + size_t len; void *p; cnt = ncp_conn_cnt(); diff --git a/lib/libncp/ncpl_subr.c b/lib/libncp/ncpl_subr.c index 1550edd6c5..dd34190458 100644 --- a/lib/libncp/ncpl_subr.c +++ b/lib/libncp/ncpl_subr.c @@ -213,8 +213,9 @@ NWRequest(NWCONN_HANDLE cH, nuint16 fn, int ncp_initlib(void){ int error; - int len = sizeof(sysentoffset); - int kv, kvlen = sizeof(kv); + size_t len = sizeof(sysentoffset); + int kv; + size_t kvlen = sizeof(kv); static int ncp_initialized; if (ncp_initialized) diff --git a/lib/libsctp/sctp_sys_calls.c b/lib/libsctp/sctp_sys_calls.c index 2c70cf9bfd..2b5a94bb5a 100644 --- a/lib/libsctp/sctp_sys_calls.c +++ b/lib/libsctp/sctp_sys_calls.c @@ -260,7 +260,7 @@ sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockaddr **raddrs) &asoc, &siz) != 0) { return(-1); } - siz = (unsigned int)asoc; + siz = (unsigned int)(uintptr_t)asoc; siz += sizeof(struct sctp_getaddresses); addrs = calloc((unsigned long)1, (unsigned long)siz); if (addrs == NULL) { diff --git a/lib/libthread_xu/thread/thr_private.h b/lib/libthread_xu/thread/thr_private.h index 667d3bb69e..9eb0f7d3e0 100644 --- a/lib/libthread_xu/thread/thr_private.h +++ b/lib/libthread_xu/thread/thr_private.h @@ -339,7 +339,7 @@ struct pthread { long terminated; /* Kernel thread id. */ - long tid; + lwpid_t tid; /* Internal condition variable cycle number. */ umtx_t cycle; diff --git a/libexec/rtld-elf/debug.c b/libexec/rtld-elf/debug.c index b0d102e575..dd72d807dd 100644 --- a/libexec/rtld-elf/debug.c +++ b/libexec/rtld-elf/debug.c @@ -39,7 +39,7 @@ static const char rel_header[] = " symbol name r_info r_offset st_value st_size address value\n" " ------------------------------------------------------------------------------\n"; -static const char rel_format[] = " %-25s %6x %08x %08x %7d %10p %08x\n"; +static const char rel_format[] = " %-25s %6lx %08lx %08lx %7ld %10p %08lx\n"; int debug = 0; @@ -114,9 +114,9 @@ dump_Elf_Rel (Obj_Entry *obj, const Elf_Rel *rel0, u_long relsize) sym = obj->symtab + ELF_R_SYM(rel->r_info); printf(rel_format, obj->strtab + sym->st_name, - rel->r_info, rel->r_offset, - sym->st_value, sym->st_size, - dstaddr, *dstaddr); + (long)rel->r_info, (long)rel->r_offset, + (long)sym->st_value, (long)sym->st_size, + dstaddr, (long)*dstaddr); } return; } @@ -136,9 +136,9 @@ dump_Elf_Rela (Obj_Entry *obj, const Elf_Rela *rela0, u_long relasize) sym = obj->symtab + ELF_R_SYM(rela->r_info); printf(rel_format, obj->strtab + sym->st_name, - rela->r_info, rela->r_offset, - sym->st_value, sym->st_size, - dstaddr, *dstaddr); + (long)rela->r_info, (long)rela->r_offset, + (long)sym->st_value, (long)sym->st_size, + dstaddr, (long)*dstaddr); } return; } diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c index ee59413ae5..c648abed27 100644 --- a/sbin/camcontrol/camcontrol.c +++ b/sbin/camcontrol/camcontrol.c @@ -3154,10 +3154,10 @@ doreport: percentage = 10000 * val; fprintf(stdout, - "\rFormatting: %qd.%02qd %% " + "\rFormatting: %jd.%02jd %% " "(%d/%d) done", - percentage / (0x10000 * 100), - (percentage / 0x10000) % 100, + (intmax_t)percentage / (0x10000 * 100), + (intmax_t)(percentage / 0x10000) % 100, val, 0x10000); fflush(stdout); } else if ((quiet == 0) diff --git a/sbin/camcontrol/util.c b/sbin/camcontrol/util.c index 15632afaa3..34b5063422 100644 --- a/sbin/camcontrol/util.c +++ b/sbin/camcontrol/util.c @@ -115,7 +115,7 @@ arg_put(void *hook __unused, int letter, void *arg, int count, char *name) { case 'i': case 'b': - printf("%d ", (intptr_t)arg); + printf("%jd ", (intmax_t)(intptr_t)arg); break; case 'c': diff --git a/sbin/diskinfo/diskinfo.c b/sbin/diskinfo/diskinfo.c index 7f780c6db1..c30de375af 100644 --- a/sbin/diskinfo/diskinfo.c +++ b/sbin/diskinfo/diskinfo.c @@ -98,10 +98,10 @@ void dumppart(const char *path, struct partinfo *dpart) { printf("%-16s ", path); - printf("blksize=%-4d off=%012llx size=%012llx ", + printf("blksize=%-4d off=%012jx size=%012jx ", dpart->media_blksize, - dpart->media_offset, - dpart->media_size + (intmax_t)dpart->media_offset, + (intmax_t)dpart->media_size ); if (dpart->media_size >= 100LL*1024*1024*1024) { printf("%7.2f GB", @@ -145,7 +145,8 @@ dumppart(const char *path, struct partinfo *dpart) * note: rsvdlabel is inclusive of rsvdplat. i.e. * they are not relative to each other. */ - printf(" reserved=%lld", dpart->reserved_blocks); + printf(" reserved=%jd", + (intmax_t)dpart->reserved_blocks); } } printf("\n"); diff --git a/sbin/disklabel64/disklabel64.c b/sbin/disklabel64/disklabel64.c index 68e101732d..68abee91b8 100644 --- a/sbin/disklabel64/disklabel64.c +++ b/sbin/disklabel64/disklabel64.c @@ -670,11 +670,12 @@ display(FILE *f, const struct disklabel64 *lp) fprintf(f, "# Informational fields calculated from the above\n"); fprintf(f, "# All byte equivalent offsets must be aligned\n"); fprintf(f, "#\n"); - fprintf(f, "# boot space: %10llu bytes\n", lp->d_pbase - lp->d_bbase); - fprintf(f, "# data space: %10llu blocks\t# %6.2f MB (%llu bytes)\n", - (lp->d_pstop - lp->d_pbase) / blksize, + fprintf(f, "# boot space: %10ju bytes\n", + (intmax_t)(lp->d_pbase - lp->d_bbase)); + fprintf(f, "# data space: %10ju blocks\t# %6.2f MB (%ju bytes)\n", + (intmax_t)(lp->d_pstop - lp->d_pbase) / blksize, (double)(lp->d_pstop - lp->d_pbase) / 1024.0 / 1024.0, - lp->d_pstop - lp->d_pbase); + (intmax_t)(lp->d_pstop - lp->d_pbase)); fprintf(f, "#\n"); uuid_to_string(&lp->d_stor_uuid, &str, NULL); @@ -683,12 +684,12 @@ display(FILE *f, const struct disklabel64 *lp) fprintf(f, "label: %.*s\n", (int)sizeof(lp->d_packname), lp->d_packname); - fprintf(f, "boot2 data base: 0x%012llx\n", lp->d_bbase); - fprintf(f, "partitions data base: 0x%012llx\n", lp->d_pbase); - fprintf(f, "partitions data stop: 0x%012llx\n", lp->d_pstop); - fprintf(f, "backup label: 0x%012llx\n", lp->d_abase); - fprintf(f, "total size: 0x%012llx\t# %6.2f MB\n", - lp->d_total_size, + fprintf(f, "boot2 data base: 0x%012jx\n", (intmax_t)lp->d_bbase); + fprintf(f, "partitions data base: 0x%012jx\n", (intmax_t)lp->d_pbase); + fprintf(f, "partitions data stop: 0x%012jx\n", (intmax_t)lp->d_pstop); + fprintf(f, "backup label: 0x%012jx\n", (intmax_t)lp->d_abase); + fprintf(f, "total size: 0x%012jx\t# %6.2f MB\n", + (intmax_t)lp->d_total_size, (double)lp->d_total_size / 1024.0 / 1024.0); fprintf(f, "alignment: %u\n", lp->d_align); fprintf(f, "display block size: %u\t# for partition display only\n", @@ -710,11 +711,12 @@ display(FILE *f, const struct disklabel64 *lp) if (pp->p_bsize % lp->d_align) fprintf(f, "%10s ", "ILLEGAL"); else - fprintf(f, "%10llu ", pp->p_bsize / blksize); + fprintf(f, "%10ju ", (intmax_t)pp->p_bsize / blksize); if (pp->p_boffset % lp->d_align) fprintf(f, "%10s ", "ILLEGAL"); else - fprintf(f, "%10llu ", (pp->p_boffset - lp->d_pbase) / blksize); + fprintf(f, "%10ju ", + (intmax_t)(pp->p_boffset - lp->d_pbase) / blksize); if (pp->p_fstype < FSMAXTYPES) fprintf(f, "%8.8s", fstypenames[pp->p_fstype]); else @@ -1256,7 +1258,8 @@ checklabel(struct disklabel64 *lp) return (1); } if (lp->d_pstop > lp->d_total_size) { - printf("%012llx\n%012llx\n", lp->d_pstop, lp->d_total_size); + printf("%012jx\n%012jx\n", + (intmax_t)lp->d_pstop, (intmax_t)lp->d_total_size); Warning("disklabel control info is beyond the total size"); return (1); } @@ -1336,9 +1339,9 @@ checklabel(struct disklabel64 *lp) } } } else { - fprintf(stderr, - "%lld bytes available to give to '*' and '%%' partitions\n", - free_space); + fprintf(stderr, "%jd bytes available to give to " + "'*' and '%%' partitions\n", + (intmax_t)free_space); errors++; /* fix? set all % partitions to size 0? */ } @@ -1367,9 +1370,10 @@ checklabel(struct disklabel64 *lp) seen_default_offset && pp->p_fstype != FS_VINUM) { fprintf(stderr, -"Offset 0x%012llx for partition %c overlaps previous partition which ends at 0x%012llx\n", - pp->p_boffset, i + 'a', - current_offset); +"Offset 0x%012jx for partition %c overlaps previous partition which ends at 0x%012jx\n", + (intmax_t)pp->p_boffset, + i + 'a', + (intmax_t)current_offset); fprintf(stderr, "Labels with any *'s for offset must be in ascending order by sector\n"); errors++; @@ -1380,9 +1384,9 @@ checklabel(struct disklabel64 *lp) * partitions are out-of-order */ Warning( -"Offset 0x%012llx for partition %c doesn't match expected value 0x%012llx", +"Offset 0x%012jx for partition %c doesn't match expected value 0x%012jx", pp->p_boffset, i + 'a', - current_offset); + (intmax_t)current_offset); } } current_offset = pp->p_boffset + pp->p_bsize; @@ -1393,8 +1397,8 @@ checklabel(struct disklabel64 *lp) part = 'a' + i; pp = &lp->d_partitions[i]; if (pp->p_bsize == 0 && pp->p_boffset != 0) - Warning("partition %c: size 0, but offset 0x%012llx", - part, pp->p_boffset); + Warning("partition %c: size 0, but offset 0x%012jx", + part, (intmax_t)pp->p_boffset); if (pp->p_bsize == 0) { pp->p_boffset = 0; continue; @@ -1404,20 +1408,20 @@ checklabel(struct disklabel64 *lp) if (pp->p_boffset < lp->d_pbase) { fprintf(stderr, - "partition %c: offset out of bounds (%lld)\n", - part, pp->p_boffset - lp->d_pbase); + "partition %c: offset out of bounds (%jd)\n", + part, (intmax_t)(pp->p_boffset - lp->d_pbase)); errors++; } if (pp->p_boffset > lp->d_pstop) { fprintf(stderr, - "partition %c: offset out of bounds (%lld)\n", - part, pp->p_boffset - lp->d_pbase); + "partition %c: offset out of bounds (%jd)\n", + part, (intmax_t)(pp->p_boffset - lp->d_pbase)); errors++; } if (pp->p_boffset + pp->p_bsize > lp->d_pstop) { fprintf(stderr, - "partition %c: size out of bounds (%lld)\n", - part, pp->p_boffset - lp->d_pbase); + "partition %c: size out of bounds (%jd)\n", + part, (intmax_t)(pp->p_boffset - lp->d_pbase)); errors++; } @@ -1442,8 +1446,10 @@ checklabel(struct disklabel64 *lp) part = 'a' + i; pp = &lp->d_partitions[i]; if (pp->p_bsize || pp->p_boffset) - Warning("unused partition %c: size 0x%012llx offset 0x%012llx", - 'a' + i, pp->p_bsize, pp->p_boffset); + Warning("unused partition %c: size 0x%012jx " + "offset 0x%012jx", + 'a' + i, (intmax_t)pp->p_bsize, + (intmax_t)pp->p_boffset); } return (errors); } diff --git a/sbin/dumpfs/dumpfs.c b/sbin/dumpfs/dumpfs.c index cb2d8d34dd..e8a254c35c 100644 --- a/sbin/dumpfs/dumpfs.c +++ b/sbin/dumpfs/dumpfs.c @@ -164,8 +164,9 @@ dumpfs(char *name) printf("symlinklen %d\ttrackskew %d\tinterleave %d\tcontigsumsize %d\n", afs.fs_maxsymlinklen, afs.fs_trackskew, afs.fs_interleave, afs.fs_contigsumsize); - printf("nindir\t%d\tinopb\t%d\tnspf\t%d\tmaxfilesize\t%qu\n", - afs.fs_nindir, afs.fs_inopb, afs.fs_nspf, afs.fs_maxfilesize); + printf("nindir\t%d\tinopb\t%d\tnspf\t%d\tmaxfilesize\t%ju\n", + afs.fs_nindir, afs.fs_inopb, afs.fs_nspf, + (intmax_t)afs.fs_maxfilesize); printf("sblkno\t%d\tcblkno\t%d\tiblkno\t%d\tdblkno\t%d\n", afs.fs_sblkno, afs.fs_cblkno, afs.fs_iblkno, afs.fs_dblkno); printf("sbsize\t%d\tcgsize\t%d\tcgoffset %d\tcgmask\t0x%08x\n", @@ -259,10 +260,10 @@ dumpcg(char *name, int fd, int c) warnx("%s: error reading cg", name); return (1); } - printf("magic\t%x\ttell\t%qx\ttime\t%s", + printf("magic\t%x\ttell\t%jx\ttime\t%s", afs.fs_postblformat == FS_42POSTBLFMT ? ((struct ocg *)&acg)->cg_magic : acg.cg_magic, - cur, ctime((time_t *)&acg.cg_time)); + (intmax_t)cur, ctime((time_t *)&acg.cg_time)); printf("cgx\t%d\tncyl\t%d\tniblk\t%d\tndblk\t%d\n", acg.cg_cgx, acg.cg_ncyl, acg.cg_niblk, acg.cg_ndblk); printf("nbfree\t%d\tndir\t%d\tnifree\t%d\tnffree\t%d\n", diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c index 84196e609f..93454f0aa5 100644 --- a/sbin/fdisk/fdisk.c +++ b/sbin/fdisk/fdisk.c @@ -501,10 +501,10 @@ print_part(int i) part_mb *= secsize; part_mb /= (1024 * 1024); printf("sysid %d,(%s)\n", partp->dp_typ, get_type(partp->dp_typ)); - printf(" start %lu, size %lu (%lld Meg), flag %x%s\n", + printf(" start %lu, size %lu (%jd Meg), flag %x%s\n", (u_long)partp->dp_start, (u_long)partp->dp_size, - (long long)part_mb, + (intmax_t)part_mb, partp->dp_flag, partp->dp_flag == ACTIVE ? " (active)" : ""); printf("\tbeg: cyl %d/ head %d/ sector %d;\n\tend: cyl %d/ head %d/ sector %d\n" diff --git a/sbin/fsdb/fsdb.c b/sbin/fsdb/fsdb.c index 3d19de0fb6..a10607633d 100644 --- a/sbin/fsdb/fsdb.c +++ b/sbin/fsdb/fsdb.c @@ -803,7 +803,7 @@ CMDFUNCSTART(chgroup) } int -dotime(char *name, struct timespec *rts) +dotime(char *name, int32_t *rts) { char *p, *val; struct tm t; @@ -852,8 +852,8 @@ badformat: warnx("date/time out of range"); return 1; } - rts->tv_sec = sec; - rts->tv_nsec = nsec; + rts[0] = sec; + rts[1] = nsec; return 0; } diff --git a/sbin/fsirand/fsirand.c b/sbin/fsirand/fsirand.c index 412963931c..a4987eb7dc 100644 --- a/sbin/fsirand/fsirand.c +++ b/sbin/fsirand/fsirand.c @@ -134,7 +134,8 @@ fsirand(char *device) memset(&sbuf, 0, sizeof(sbuf)); sblock = (struct fs *)&sbuf; if (lseek(devfd, SBOFF, SEEK_SET) == -1) { - warn("can't seek to superblock (%qd) on %s", SBOFF, device); + warn("can't seek to superblock (%jd) on %s", + (intmax_t)SBOFF, device); return (1); } if ((n = read(devfd, (void *)sblock, SBSIZE)) != SBSIZE) { @@ -167,7 +168,7 @@ fsirand(char *device) for (cg = 0; cg < sblock->fs_ncg; cg++) { dblk = fsbtodb(sblock, cgsblock(sblock, cg)); if (lseek(devfd, (off_t)dblk * bsize, SEEK_SET) < 0) { - warn("can't seek to %qd", (off_t)dblk * bsize); + warn("can't seek to %jd", (intmax_t)dblk * bsize); return (1); } else if ((n = write(devfd, (void *)sblock, SBSIZE)) != SBSIZE) { warn("can't read backup superblock %d on %s: %s", @@ -211,8 +212,8 @@ fsirand(char *device) sblock->fs_id[1] = random(); if (lseek(devfd, SBOFF, SEEK_SET) == -1) { - warn("can't seek to superblock (%qd) on %s", SBOFF, - device); + warn("can't seek to superblock (%jd) on %s", + (intmax_t)SBOFF, device); return (1); } if ((n = write(devfd, (void *)sblock, SBSIZE)) != SBSIZE) { @@ -228,7 +229,8 @@ fsirand(char *device) if ((sblock->fs_inodefmt >= FS_44INODEFMT) && !printonly) { dblk = fsbtodb(sblock, cgsblock(sblock, cg)); if (lseek(devfd, (off_t)dblk * bsize, SEEK_SET) < 0) { - warn("can't seek to %qd", (off_t)dblk * bsize); + warn("can't seek to %jd", + (intmax_t)dblk * bsize); return (1); } else if ((n = write(devfd, (void *)sblock, SBSIZE)) != SBSIZE) { warn("can't read backup superblock %d on %s: %s", @@ -241,7 +243,7 @@ fsirand(char *device) /* Read in inodes, then print or randomize generation nums */ dblk = fsbtodb(sblock, ino_to_fsba(sblock, inumber)); if (lseek(devfd, (off_t)dblk * bsize, SEEK_SET) < 0) { - warn("can't seek to %qd", (off_t)dblk * bsize); + warn("can't seek to %jd", (intmax_t)dblk * bsize); return (1); } else if ((n = read(devfd, inodebuf, ibufsize)) != ibufsize) { warnx("can't read inodes: %s", @@ -251,19 +253,21 @@ fsirand(char *device) for (n = 0; n < sblock->fs_ipg; n++, inumber++) { if (inumber >= ROOTINO) { - if (printonly) - printf("ino %lld gen %x\n", inumber, - inodebuf[n].di_gen); - else + if (printonly) { + printf("ino %jd gen %x\n", + (intmax_t)inumber, + inodebuf[n].di_gen); + } else { inodebuf[n].di_gen = random(); + } } } /* Write out modified inodes */ if (!printonly) { if (lseek(devfd, (off_t)dblk * bsize, SEEK_SET) < 0) { - warn("can't seek to %qd", - (off_t)dblk * bsize); + warn("can't seek to %jd", + (intmax_t)dblk * bsize); return (1); } else if ((n = write(devfd, inodebuf, ibufsize)) != ibufsize) { diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c index c7c0b3b042..8582a6b6ed 100644 --- a/sbin/growfs/growfs.c +++ b/sbin/growfs/growfs.c @@ -2075,8 +2075,8 @@ main(int argc, char **argv) sblock.fs_size = dbtofsb(&osblock, pinfo.media_blocks); if (size != 0) { if (size > pinfo.media_blocks){ - errx(1, "There is not enough space (%llu < %d)", - pinfo.media_blocks, size); + errx(1, "There is not enough space (%ju < %d)", + (intmax_t)pinfo.media_blocks, size); } sblock.fs_size = dbtofsb(&osblock, size); } diff --git a/sbin/hammer/cmd_blockmap.c b/sbin/hammer/cmd_blockmap.c index e525c3db09..e483369fdf 100644 --- a/sbin/hammer/cmd_blockmap.c +++ b/sbin/hammer/cmd_blockmap.c @@ -73,8 +73,10 @@ dump_blockmap(const char *label, int zone) rootmap = &root_volume->ondisk->vol0_blockmap[zone]; assert(rootmap->phys_offset != 0); - printf("zone %-16s next %016llx alloc %016llx\n", - label, rootmap->next_offset, rootmap->alloc_offset); + printf("zone %-16s next %016jx alloc %016jx\n", + label, + (uintmax_t)rootmap->next_offset, + (uintmax_t)rootmap->alloc_offset); for (scan1 = HAMMER_ZONE_ENCODE(zone, 0); scan1 < HAMMER_ZONE_ENCODE(zone, HAMMER_OFF_LONG_MASK); @@ -92,8 +94,11 @@ dump_blockmap(const char *label, int zone) layer1->phys_offset == HAMMER_BLOCKMAP_UNAVAIL) { continue; } - printf("%c layer1 %016llx @%016llx blocks-free %lld\n", - xerr, scan1, layer1->phys_offset, layer1->blocks_free); + printf("%c layer1 %016jx @%016jx blocks-free %jd\n", + xerr, + (uintmax_t)scan1, + (uintmax_t)layer1->phys_offset, + (intmax_t)layer1->blocks_free); if (layer1->phys_offset == HAMMER_BLOCKMAP_FREE) continue; for (scan2 = scan1; @@ -109,9 +114,9 @@ dump_blockmap(const char *label, int zone) xerr = ' '; if (layer2->entry_crc != crc32(layer2, HAMMER_LAYER2_CRCSIZE)) xerr = 'B'; - printf("%c %016llx zone=%d app=%-7d free=%-7d\n", + printf("%c %016jx zone=%d app=%-7d free=%-7d\n", xerr, - scan2, + (uintmax_t)scan2, layer2->zone, layer2->append_off, layer2->bytes_free); diff --git a/sbin/hammer/cmd_history.c b/sbin/hammer/cmd_history.c index e42ccac372..304c0b7e07 100644 --- a/sbin/hammer/cmd_history.c +++ b/sbin/hammer/cmd_history.c @@ -96,16 +96,16 @@ hammer_do_history(const char *path, off_t off, int len) } status = ((hist.head.flags & HAMMER_IOC_HISTORY_UNSYNCED) ? "dirty" : "clean"); - printf("%016llx %s {\n", hist.obj_id, status); + printf("%016jx %s {\n", (uintmax_t)hist.obj_id, status); for (;;) { for (i = 0; i < hist.count; ++i) { char *hist_path = NULL; - asprintf(&hist_path, "%s@@0x%016llx", - path, hist.hist_ary[i].tid); - printf(" %016llx %s", - hist.hist_ary[i].tid, - timestr32(hist.hist_ary[i].time32)); + asprintf(&hist_path, "%s@@0x%016jx", + path, (uintmax_t)hist.hist_ary[i].tid); + printf(" %016jx %s", + (uintmax_t)hist.hist_ary[i].tid, + timestr32(hist.hist_ary[i].time32)); if (off >= 0) { if (VerboseOpt) { printf(" '"); diff --git a/sbin/hammer/cmd_info.c b/sbin/hammer/cmd_info.c index bf55bdc085..23230ef1bd 100644 --- a/sbin/hammer/cmd_info.c +++ b/sbin/hammer/cmd_info.c @@ -99,18 +99,24 @@ void show_info(char *path) { usedbigblocks = info.bigblocks - info.freebigblocks; fprintf(stdout, "Big block information\n"); - fprintf(stdout, "\tTotal\t %lld\n", info.bigblocks); - fprintf(stdout, "\tUsed\t %lld (%.2lf%%)\n\tReserved %lld (%.2lf%%)\n\tFree\t %lld (%.2lf%%)\n", - usedbigblocks, percent(usedbigblocks, info.bigblocks), - info.rsvbigblocks, percent(info.rsvbigblocks, info.bigblocks), - (info.freebigblocks - info.rsvbigblocks), - percent(info.freebigblocks - info.rsvbigblocks, info.bigblocks)); + fprintf(stdout, "\tTotal\t %jd\n", (intmax_t)info.bigblocks); + fprintf(stdout, "\tUsed\t %jd (%.2lf%%)\n\tReserved " + "%jd (%.2lf%%)\n\tFree\t " + "%jd (%.2lf%%)\n", + (intmax_t)usedbigblocks, + percent(usedbigblocks, info.bigblocks), + (intmax_t)info.rsvbigblocks, + percent(info.rsvbigblocks, info.bigblocks), + (intmax_t)(info.freebigblocks - info.rsvbigblocks), + percent(info.freebigblocks - info.rsvbigblocks, + info.bigblocks)); fprintf(stdout, "Space information\n"); /* Space information */ bytes = (info.bigblocks << HAMMER_LARGEBLOCK_BITS); humanize_number(buf, sizeof(buf) - (bytes < 0 ? 0 : 1), bytes, "", HN_AUTOSCALE, HN_DECIMAL | HN_NOSPACE | HN_B); - fprintf(stdout, "\tTotal size %6s (%lld bytes)\n", buf, bytes); + fprintf(stdout, "\tTotal size %6s (%jd bytes)\n", + buf, (intmax_t)bytes); bytes = (usedbigblocks << HAMMER_LARGEBLOCK_BITS); humanize_number(buf, sizeof(buf) - (bytes < 0 ? 0 : 1), bytes, "", HN_AUTOSCALE, HN_DECIMAL | HN_NOSPACE | HN_B); diff --git a/sbin/hammer/cmd_mirror.c b/sbin/hammer/cmd_mirror.c index e3c7960a9e..a17fced114 100644 --- a/sbin/hammer/cmd_mirror.c +++ b/sbin/hammer/cmd_mirror.c @@ -203,12 +203,12 @@ again: if (streaming == 0 || VerboseOpt >= 2) { fprintf(stderr, - "Mirror-read: Mirror from %016llx to %016llx\n", - mirror.tid_beg, mirror.tid_end); + "Mirror-read: Mirror from %016jx to %016jx\n", + (uintmax_t)mirror.tid_beg, (uintmax_t)mirror.tid_end); } if (mirror.key_beg.obj_id != (int64_t)HAMMER_MIN_OBJID) { - fprintf(stderr, "Mirror-read: Resuming at object %016llx\n", - mirror.key_beg.obj_id); + fprintf(stderr, "Mirror-read: Resuming at object %016jx\n", + (uintmax_t)mirror.key_beg.obj_id); } /* @@ -260,11 +260,11 @@ again: total_bytes += mirror.count; if (streaming && VerboseOpt) { fprintf(stderr, - "\robj=%016llx tids=%016llx:%016llx %11lld", - (long long)mirror.key_cur.obj_id, - (long long)mirror.tid_beg, - (long long)mirror.tid_end, - total_bytes); + "\robj=%016jx tids=%016jx:%016jx %11jd", + (uintmax_t)mirror.key_cur.obj_id, + (uintmax_t)mirror.tid_beg, + (uintmax_t)mirror.tid_end, + (intmax_t)total_bytes); fflush(stderr); } mirror.key_beg = mirror.key_cur; @@ -276,9 +276,9 @@ again: (unsigned)(time(NULL) - base_t) > (unsigned)TimeoutOpt) { fprintf(stderr, "Mirror-read %s interrupted by timer at" - " %016llx\n", + " %016jx\n", filesystem, - mirror.key_cur.obj_id); + (uintmax_t)mirror.key_cur.obj_id); interrupted = 1; break; } @@ -323,8 +323,9 @@ done: if (CyclePath) { hammer_key_beg_init(&mirror.key_beg); hammer_set_cycle(&mirror.key_beg, sync_tid); - fprintf(stderr, "Cyclefile %s updated to 0x%016llx\n", - CyclePath, sync_tid); + fprintf(stderr, + "Cyclefile %s updated to 0x%016jx\n", + CyclePath, (uintmax_t)sync_tid); } } } else if (CyclePath) { @@ -424,11 +425,11 @@ generate_histogram(int fd, const char *filesystem, mirror.tid_end = tid_half; if (VerboseOpt > 1) { - fprintf(stderr, "RangeTest %016llx/%016llx - %016llx (%lld) ", - (long long)tid_beg, - (long long)tid_end, - (long long)tid_half, - (long long)(tid_half - tid_beg)); + fprintf(stderr, "RangeTest %016jx/%016jx - %016jx (%jd) ", + (uintmax_t)tid_beg, + (uintmax_t)tid_end, + (uintmax_t)tid_half, + (intmax_t)(tid_half - tid_beg)); } fflush(stderr); if (ioctl(fd, HAMMERIOC_MIRROR_READ, &mirror) < 0) { @@ -708,8 +709,8 @@ again: write_mrecord(1, HAMMER_MREC_TYPE_UPDATE, &mrec_tmp, sizeof(mrec_tmp.update)); } else { - printf("Source can update synctid to 0x%016llx\n", - mirror.tid_end); + printf("Source can update synctid to 0x%016jx\n", + (uintmax_t)mirror.tid_end); } relpfs(fd, &pfs); goto again; @@ -753,10 +754,10 @@ hammer_cmd_mirror_dump(void) switch(mrec->head.type & HAMMER_MRECF_TYPE_MASK) { case HAMMER_MREC_TYPE_REC_BADCRC: case HAMMER_MREC_TYPE_REC: - printf("Record obj=%016llx key=%016llx " + printf("Record obj=%016jx key=%016jx " "rt=%02x ot=%02x", - mrec->rec.leaf.base.obj_id, - mrec->rec.leaf.base.key, + (uintmax_t)mrec->rec.leaf.base.obj_id, + (uintmax_t)mrec->rec.leaf.base.key, mrec->rec.leaf.base.rec_type, mrec->rec.leaf.base.obj_type); if (mrec->head.type == @@ -764,31 +765,31 @@ hammer_cmd_mirror_dump(void) printf(" (BAD CRC)"); } printf("\n"); - printf(" tids %016llx:%016llx data=%d\n", - mrec->rec.leaf.base.create_tid, - mrec->rec.leaf.base.delete_tid, - mrec->rec.leaf.data_len); + printf(" tids %016jx:%016jx data=%d\n", + (uintmax_t)mrec->rec.leaf.base.create_tid, + (uintmax_t)mrec->rec.leaf.base.delete_tid, + mrec->rec.leaf.data_len); break; case HAMMER_MREC_TYPE_PASS: - printf("Pass obj=%016llx key=%016llx " + printf("Pass obj=%016jx key=%016jx " "rt=%02x ot=%02x\n", - mrec->rec.leaf.base.obj_id, - mrec->rec.leaf.base.key, + (uintmax_t)mrec->rec.leaf.base.obj_id, + (uintmax_t)mrec->rec.leaf.base.key, mrec->rec.leaf.base.rec_type, mrec->rec.leaf.base.obj_type); - printf(" tids %016llx:%016llx data=%d\n", - mrec->rec.leaf.base.create_tid, - mrec->rec.leaf.base.delete_tid, + printf(" tids %016jx:%016jx data=%d\n", + (uintmax_t)mrec->rec.leaf.base.create_tid, + (uintmax_t)mrec->rec.leaf.base.delete_tid, mrec->rec.leaf.data_len); break; case HAMMER_MREC_TYPE_SKIP: - printf("Skip obj=%016llx key=%016llx rt=%02x to\n" - " obj=%016llx key=%016llx rt=%02x\n", - mrec->skip.skip_beg.obj_id, - mrec->skip.skip_beg.key, + printf("Skip obj=%016jx key=%016jx rt=%02x to\n" + " obj=%016jx key=%016jx rt=%02x\n", + (uintmax_t)mrec->skip.skip_beg.obj_id, + (uintmax_t)mrec->skip.skip_beg.key, mrec->skip.skip_beg.rec_type, - mrec->skip.skip_end.obj_id, - mrec->skip.skip_end.key, + (uintmax_t)mrec->skip.skip_end.obj_id, + (uintmax_t)mrec->skip.skip_end.key, mrec->skip.skip_end.rec_type); default: break; @@ -1070,9 +1071,9 @@ read_mrecords(int fd, char *buf, u_int size, hammer_ioc_mrecord_head_t pickup) hammer_crc_test_leaf(&mrec->rec + 1, &mrec->rec.leaf) == 0) { fprintf(stderr, "read_mrecords: data_crc did not " - "match data! obj=%016llx key=%016llx\n", - mrec->rec.leaf.base.obj_id, - mrec->rec.leaf.base.key); + "match data! obj=%016jx key=%016jx\n", + (uintmax_t)mrec->rec.leaf.base.obj_id, + (uintmax_t)mrec->rec.leaf.base.key); fprintf(stderr, "continuing, but there are problems\n"); } @@ -1315,8 +1316,8 @@ update_pfs_snapshot(int fd, hammer_tid_t snapshot_tid, int pfs_id) if (VerboseOpt >= 2) { fprintf(stderr, "Mirror-write: Completed, updated snapshot " - "to %016llx\n", - snapshot_tid); + "to %016jx\n", + (uintmax_t)snapshot_tid); } } } diff --git a/sbin/hammer/cmd_pseudofs.c b/sbin/hammer/cmd_pseudofs.c index ea91500189..a987effc2d 100644 --- a/sbin/hammer/cmd_pseudofs.c +++ b/sbin/hammer/cmd_pseudofs.c @@ -50,7 +50,7 @@ static int timetosecs(char *str); int getpfs(struct hammer_ioc_pseudofs_rw *pfs, const char *path) { - hammer_tid_t dummy_tid; + uintmax_t dummy_tid; struct stat st; char *dirpath; char buf[64]; @@ -113,7 +113,7 @@ getpfs(struct hammer_ioc_pseudofs_rw *pfs, const char *path) fd = open(dirpath, O_RDONLY); goto done; } - if (sscanf(buf, "@@%llx:%d", &dummy_tid, &pfs->pfs_id) == 2) { + if (sscanf(buf, "@@%jx:%d", &dummy_tid, &pfs->pfs_id) == 2) { fd = open(dirpath, O_RDONLY); goto done; } @@ -473,8 +473,8 @@ dump_pfsd(hammer_pseudofs_data_t pfsd) u_int32_t status; char *str = NULL; - printf(" sync-beg-tid=0x%016llx\n", pfsd->sync_beg_tid); - printf(" sync-end-tid=0x%016llx\n", pfsd->sync_end_tid); + printf(" sync-beg-tid=0x%016jx\n", (uintmax_t)pfsd->sync_beg_tid); + printf(" sync-end-tid=0x%016jx\n", (uintmax_t)pfsd->sync_end_tid); uuid_to_string(&pfsd->shared_uuid, &str, &status); printf(" shared-uuid=%s\n", str); uuid_to_string(&pfsd->unique_uuid, &str, &status); diff --git a/sbin/hammer/cmd_rebalance.c b/sbin/hammer/cmd_rebalance.c index 857b69415c..5d0f294891 100644 --- a/sbin/hammer/cmd_rebalance.c +++ b/sbin/hammer/cmd_rebalance.c @@ -69,8 +69,8 @@ hammer_cmd_rebalance(char **av, int ac) if (perc < 50 || perc > 100) rebalance_usage(1); } - printf("rebalance start %016llx:%04x\n", - rebal.key_beg.obj_id, + printf("rebalance start %016jx:%04x\n", + (uintmax_t)rebal.key_beg.obj_id, rebal.key_beg.localization); fd = open(filesystem, O_RDONLY); @@ -81,9 +81,9 @@ hammer_cmd_rebalance(char **av, int ac) printf("Rebalance %s failed: %s\n", filesystem, strerror(errno)); } else if (rebal.head.flags & HAMMER_IOC_HEAD_INTR) { - printf("Rebalance %s interrupted by timer at %016llx:%04x\n", + printf("Rebalance %s interrupted by timer at %016jx:%04x\n", filesystem, - rebal.key_cur.obj_id, + (uintmax_t)rebal.key_cur.obj_id, rebal.key_cur.localization); if (CyclePath) { hammer_set_cycle(&rebal.key_cur, 0); @@ -96,14 +96,14 @@ hammer_cmd_rebalance(char **av, int ac) RunningIoctl = 0; close(fd); printf("Rebalance:\n" - " %lld btree nodes scanned\n" - " %lld btree nodes deleted\n" - " %lld collision retries\n" - " %lld btree nodes rebalanced\n", - rebal.stat_ncount, - rebal.stat_deletions, - rebal.stat_collisions, - rebal.stat_nrebal + " %jd btree nodes scanned\n" + " %jd btree nodes deleted\n" + " %jd collision retries\n" + " %jd btree nodes rebalanced\n", + (intmax_t)rebal.stat_ncount, + (intmax_t)rebal.stat_deletions, + (intmax_t)rebal.stat_collisions, + (intmax_t)rebal.stat_nrebal ); } diff --git a/sbin/hammer/cmd_reblock.c b/sbin/hammer/cmd_reblock.c index 75b1a3b485..21caa6cb8a 100644 --- a/sbin/hammer/cmd_reblock.c +++ b/sbin/hammer/cmd_reblock.c @@ -94,8 +94,8 @@ hammer_cmd_reblock(char **av, int ac, int flags) reblock.free_level = HAMMER_LARGEBLOCK_SIZE - reblock.free_level; if (reblock.free_level < 0) reblock.free_level = 0; - printf("reblock start %016llx:%04x free level %d\n", - reblock.key_beg.obj_id, + printf("reblock start %016jx:%04x free level %d\n", + (uintmax_t)reblock.key_beg.obj_id, reblock.key_beg.localization, reblock.free_level); @@ -106,9 +106,9 @@ hammer_cmd_reblock(char **av, int ac, int flags) if (ioctl(fd, HAMMERIOC_REBLOCK, &reblock) < 0) { printf("Reblock %s failed: %s\n", filesystem, strerror(errno)); } else if (reblock.head.flags & HAMMER_IOC_HEAD_INTR) { - printf("Reblock %s interrupted by timer at %016llx:%04x\n", + printf("Reblock %s interrupted by timer at %016jx:%04x\n", filesystem, - reblock.key_cur.obj_id, + (uintmax_t)reblock.key_cur.obj_id, reblock.key_cur.localization); if (CyclePath) { hammer_set_cycle(&reblock.key_cur, 0); @@ -121,12 +121,13 @@ hammer_cmd_reblock(char **av, int ac, int flags) RunningIoctl = 0; close(fd); printf("Reblocked:\n" - " %lld/%lld btree nodes\n" - " %lld/%lld data elements\n" - " %lld/%lld data bytes\n", - reblock.btree_moves, reblock.btree_count, - reblock.data_moves, reblock.data_count, - reblock.data_byte_moves, reblock.data_byte_count + " %jd/%jd btree nodes\n" + " %jd/%jd data elements\n" + " %jd/%jd data bytes\n", + (intmax_t)reblock.btree_moves, (intmax_t)reblock.btree_count, + (intmax_t)reblock.data_moves, (intmax_t)reblock.data_count, + (intmax_t)reblock.data_byte_moves, + (intmax_t)reblock.data_byte_count ); } diff --git a/sbin/hammer/cmd_show.c b/sbin/hammer/cmd_show.c index 1e3953e2c0..e7c4959e65 100644 --- a/sbin/hammer/cmd_show.c +++ b/sbin/hammer/cmd_show.c @@ -74,15 +74,15 @@ hammer_cmd_show(hammer_off_t node_offset, u_int32_t lo, int64_t obj_id, volume = get_volume(RootVolNo); node_offset = volume->ondisk->vol0_btree_root; if (QuietOpt < 3) { - printf("Volume header\trecords=%lld next_tid=%016llx\n", - volume->ondisk->vol0_stat_records, - volume->ondisk->vol0_next_tid); - printf("\t\tbufoffset=%016llx\n", - volume->ondisk->vol_buf_beg); + printf("Volume header\trecords=%jd next_tid=%016jx\n", + (intmax_t)volume->ondisk->vol0_stat_records, + (uintmax_t)volume->ondisk->vol0_next_tid); + printf("\t\tbufoffset=%016jx\n", + (uintmax_t)volume->ondisk->vol_buf_beg); for (zone = 0; zone < HAMMER_MAX_ZONES; ++zone) { - printf("\t\tzone %d\tnext_offset=%016llx\n", + printf("\t\tzone %d\tnext_offset=%016jx\n", zone, - volume->ondisk->vol0_blockmap[zone].next_offset + (uintmax_t)volume->ondisk->vol0_blockmap[zone].next_offset ); } } @@ -91,13 +91,13 @@ hammer_cmd_show(hammer_off_t node_offset, u_int32_t lo, int64_t obj_id, if (lo == 0 && obj_id == (int64_t)HAMMER_MIN_OBJID) { searchp = NULL; - printf("show %016llx depth %d\n", node_offset, depth); + printf("show %016jx depth %d\n", (uintmax_t)node_offset, depth); } else { search.lo = lo; search.obj_id = obj_id; searchp = &search; - printf("show %016llx lo %08x obj_id %016llx depth %d\n", - node_offset, lo, (long long)obj_id, depth); + printf("show %016jx lo %08x obj_id %016jx depth %d\n", + (uintmax_t)node_offset, lo, (uintmax_t)obj_id, depth); } print_btree_node(node_offset, searchp, depth, 0, left_bound, right_bound); @@ -127,12 +127,13 @@ print_btree_node(hammer_off_t node_offset, btree_search_t search, badc = 'B'; if (spike == 0) { - printf("%c NODE %016llx cnt=%02d p=%016llx " + printf("%c NODE %016jx cnt=%02d p=%016jx " "type=%c depth=%d", badc, - node_offset, node->count, node->parent, + (uintmax_t)node_offset, node->count, + (uintmax_t)node->parent, (node->type ? node->type : '?'), depth); - printf(" mirror %016llx", node->mirror_tid); + printf(" mirror %016jx", (uintmax_t)node->mirror_tid); if (QuietOpt < 3) { printf(" fill="); print_bigblock_fill(node_offset); @@ -239,22 +240,25 @@ print_btree_elm(hammer_btree_elm_t elm, int i, u_int8_t type, printf("%s\t%s %2d %c ", flagstr, label, i, (elm->base.btype ? elm->base.btype : '?')); - printf("obj=%016llx key=%016llx lo=%08x rt=%02x ot=%02x\n", - elm->base.obj_id, - elm->base.key, + printf("obj=%016jx key=%016jx lo=%08x rt=%02x ot=%02x\n", + (uintmax_t)elm->base.obj_id, + (uintmax_t)elm->base.key, elm->base.localization, elm->base.rec_type, elm->base.obj_type); - printf("\t %c tids %016llx:%016llx ", + printf("\t %c tids %016jx:%016jx ", (elm->base.delete_tid ? 'd' : ' '), - elm->base.create_tid, - elm->base.delete_tid); + (uintmax_t)elm->base.create_tid, + (uintmax_t)elm->base.delete_tid); switch(type) { case HAMMER_BTREE_TYPE_INTERNAL: - printf("suboff=%016llx", elm->internal.subtree_offset); - if (QuietOpt < 3) - printf(" mirror %016llx", elm->internal.mirror_tid); + printf("suboff=%016jx", + (uintmax_t)elm->internal.subtree_offset); + if (QuietOpt < 3) { + printf(" mirror %016jx", + (uintmax_t)elm->internal.mirror_tid); + } if (ext) printf(" %s", ext); break; @@ -267,8 +271,9 @@ print_btree_elm(hammer_btree_elm_t elm, int i, u_int8_t type, printf("\n%s\t ", check_data_crc(elm)); else printf("\n\t "); - printf("dataoff=%016llx/%d", - elm->leaf.data_offset, elm->leaf.data_len); + printf("dataoff=%016jx/%d", + (uintmax_t)elm->leaf.data_offset, + elm->leaf.data_len); if (QuietOpt < 3) { printf(" crc=%04x", elm->leaf.data_crc); printf("\n\t fills="); @@ -433,26 +438,28 @@ print_record(hammer_btree_elm_t elm) switch(elm->leaf.base.rec_type) { case HAMMER_RECTYPE_INODE: printf("\n%17s", ""); - printf("size=%lld nlinks=%lld", - data->inode.size, data->inode.nlinks); + printf("size=%jd nlinks=%jd", + (intmax_t)data->inode.size, + (intmax_t)data->inode.nlinks); if (QuietOpt < 1) { printf(" mode=%05o uflags=%08x\n", data->inode.mode, data->inode.uflags); printf("%17s", ""); - printf("ctime=%016llx pobjid=%016llx obj_type=%d\n", - data->inode.ctime, data->inode.parent_obj_id, + printf("ctime=%016jx pobjid=%016jx obj_type=%d\n", + (uintmax_t)data->inode.ctime, + (uintmax_t)data->inode.parent_obj_id, data->inode.obj_type); printf("%17s", ""); - printf("mtime=%016llx", data->inode.mtime); + printf("mtime=%016jx", (uintmax_t)data->inode.mtime); printf(" caps=%02x", data->inode.cap_flags); } break; case HAMMER_RECTYPE_DIRENTRY: printf("\n%17s", ""); data_len -= HAMMER_ENTRY_NAME_OFF; - printf("dir-entry ino=%016llx lo=%08x name=\"%*.*s\"", - data->entry.obj_id, + printf("dir-entry ino=%016jx lo=%08x name=\"%*.*s\"", + (uintmax_t)data->entry.obj_id, data->entry.localization, data_len, data_len, data->entry.name); break; diff --git a/sbin/hammer/cmd_snapshot.c b/sbin/hammer/cmd_snapshot.c index 1fe38cc422..f43b13af71 100644 --- a/sbin/hammer/cmd_snapshot.c +++ b/sbin/hammer/cmd_snapshot.c @@ -136,7 +136,7 @@ hammer_cmd_snapshot(char **av, int ac) err(2, "Synctid %s failed", filesystem); close(fd); - asprintf(&from, "%s/@@0x%016llx", filesystem, synctid.tid); + asprintf(&from, "%s/@@0x%016jx", filesystem, (uintmax_t)synctid.tid); if (from == NULL) err(2, "Couldn't generate string"); diff --git a/sbin/hammer/cmd_softprune.c b/sbin/hammer/cmd_softprune.c index 1ed8f8c34d..91a16f223b 100644 --- a/sbin/hammer/cmd_softprune.c +++ b/sbin/hammer/cmd_softprune.c @@ -171,12 +171,12 @@ hammer_cmd_softprune(char **av, int ac, int everything_opt) continue; } - printf("Prune %s: objspace %016llx:%04x %016llx:%04x " + printf("Prune %s: objspace %016jx:%04x %016jx:%04x " "pfs_id %d\n", scan->filesystem, - scan->prune.key_beg.obj_id, + (uintmax_t)scan->prune.key_beg.obj_id, scan->prune.key_beg.localization, - scan->prune.key_end.obj_id, + (uintmax_t)scan->prune.key_end.obj_id, scan->prune.key_end.localization, pfs.pfs_id); printf("Prune %s: prune_min is %dd/%02d:%02d:%02d\n", @@ -193,9 +193,9 @@ hammer_cmd_softprune(char **av, int ac, int everything_opt) rcode = 2; } else if (scan->prune.head.flags & HAMMER_IOC_HEAD_INTR) { printf("Prune %s interrupted by timer at " - "%016llx %04x\n", + "%016jx %04x\n", scan->filesystem, - scan->prune.key_cur.obj_id, + (uintmax_t)scan->prune.key_cur.obj_id, scan->prune.key_cur.localization); if (CyclePath) hammer_set_cycle(&scan->prune.key_cur, 0); @@ -205,12 +205,12 @@ hammer_cmd_softprune(char **av, int ac, int everything_opt) hammer_reset_cycle(); printf("Prune %s succeeded\n", scan->filesystem); } - printf("Pruned %lld/%lld records (%lld directory entries) " - "and %lld bytes\n", - scan->prune.stat_rawrecords, - scan->prune.stat_scanrecords, - scan->prune.stat_dirrecords, - scan->prune.stat_bytes + printf("Pruned %jd/%jd records (%jd directory entries) " + "and %jd bytes\n", + (uintmax_t)scan->prune.stat_rawrecords, + (uintmax_t)scan->prune.stat_scanrecords, + (uintmax_t)scan->prune.stat_dirrecords, + (uintmax_t)scan->prune.stat_bytes ); RunningIoctl = 0; close(fd); @@ -484,7 +484,8 @@ hammer_softprune_finalize(struct softprune *scan) for (i = 0; i < scan->prune.nelms; ++i) { elm = &scan->prune.elms[i]; elm->mod_tid = elm->end_tid - elm->beg_tid; - printf("TID %016llx - %016llx\n", elm->beg_tid, elm->end_tid); + printf("TID %016jx - %016jx\n", + (uintmax_t)elm->beg_tid, (uintmax_t)elm->end_tid); } } diff --git a/sbin/hammer/cmd_stats.c b/sbin/hammer/cmd_stats.c index d84f8255c8..60f71846c9 100644 --- a/sbin/hammer/cmd_stats.c +++ b/sbin/hammer/cmd_stats.c @@ -92,13 +92,13 @@ hammer_cmd_bstats(char **av, int ac) if (count) { if ((count & 15) == 1) printf(" elements iterations lookups inserts deletes splits\n"); - printf("%10lld %10lld %10lld %10lld %10lld %10lld\n", - stats[0] - copy[0], - stats[1] - copy[1], - stats[2] - copy[2], - stats[3] - copy[3], - stats[4] - copy[4], - stats[5] - copy[5]); + printf("%10jd %10jd %10jd %10jd %10jd %10jd\n", + (intmax_t)(stats[0] - copy[0]), + (intmax_t)(stats[1] - copy[1]), + (intmax_t)(stats[2] - copy[2]), + (intmax_t)(stats[3] - copy[3]), + (intmax_t)(stats[4] - copy[4]), + (intmax_t)(stats[5] - copy[5])); } nanosleep(&delay, NULL); bcopy(stats, copy, sizeof(stats)); @@ -164,14 +164,15 @@ hammer_cmd_iostats(char **av, int ac) if (count) { if ((count & 15) == 1) printf(" file-rd file-wr dev-read dev-write inode_ops ino_flush commits\n"); - printf("%9lld %9lld %9lld %9lld %9lld %8lld %8lld\n", - stats[0] - copy[0], - stats[1] - copy[1], - stats[2] - copy[2], - stats[3] - copy[3], - stats[4] + stats[5] - copy[4] - copy[5], - stats[6] - copy[6], - stats[7] - copy[7]); + printf("%9jd %9jd %9jd %9jd %9jd %8jd %8jd\n", + (intmax_t)(stats[0] - copy[0]), + (intmax_t)(stats[1] - copy[1]), + (intmax_t)(stats[2] - copy[2]), + (intmax_t)(stats[3] - copy[3]), + (intmax_t)(stats[4] + stats[5] - + copy[4] - copy[5]), + (intmax_t)(stats[6] - copy[6]), + (intmax_t)(stats[7] - copy[7])); } nanosleep(&delay, NULL); bcopy(stats, copy, sizeof(stats)); diff --git a/sbin/hammer/cmd_synctid.c b/sbin/hammer/cmd_synctid.c index 2da8aa075c..50f2d4d13f 100644 --- a/sbin/hammer/cmd_synctid.c +++ b/sbin/hammer/cmd_synctid.c @@ -66,7 +66,7 @@ hammer_cmd_synctid(char **av, int ac) if (ioctl(fd, HAMMERIOC_SYNCTID, &synctid) < 0) { fprintf(stderr, "Synctid %s failed: %s\n", filesystem, strerror(errno)); } else { - printf("0x%016llx\n", synctid.tid); + printf("0x%016jx\n", (uintmax_t)synctid.tid); } close(fd); } diff --git a/sbin/hammer/cycle.c b/sbin/hammer/cycle.c index 6e5c2f1ac0..9d176443df 100644 --- a/sbin/hammer/cycle.c +++ b/sbin/hammer/cycle.c @@ -49,7 +49,7 @@ hammer_get_cycle(hammer_base_elm_t base, hammer_tid_t *extra) close(fd); return; } - if (st.st_size < sizeof(*base)) { + if (st.st_size < (off_t)sizeof(*base)) { fprintf(stderr, "cycle-file %s: clearing old version\n", CyclePath); close(fd); diff --git a/sbin/hammer/hammer.c b/sbin/hammer/hammer.c index b3ddbb64ab..000bb99b92 100644 --- a/sbin/hammer/hammer.c +++ b/sbin/hammer/hammer.c @@ -229,7 +229,7 @@ main(int ac, char **av) } if (key == 0) key |= 0x100000000LL; - printf("0x%016llx\n", key); + printf("0x%016jx\n", (uintmax_t)key); exit(0); } if (strcmp(av[0], "namekey1") == 0) { @@ -240,7 +240,7 @@ main(int ac, char **av) key = (int64_t)(crc32(av[1], strlen(av[1])) & 0x7FFFFFFF) << 32; if (key == 0) key |= 0x100000000LL; - printf("0x%016llx\n", key); + printf("0x%016jx\n", (uintmax_t)key); exit(0); } if (strcmp(av[0], "namekey32") == 0) { @@ -378,12 +378,12 @@ main(int ac, char **av) if (strcmp(av[0], "show") == 0) { u_int32_t lo = 0; - int64_t obj_id = (int64_t)HAMMER_MIN_OBJID; + intmax_t obj_id = (int64_t)HAMMER_MIN_OBJID; hammer_parsedevs(blkdevs); if (ac > 1) - sscanf(av[1], "%08x:%llx", &lo, &obj_id); - hammer_cmd_show(-1, lo, obj_id, 0, NULL, NULL); + sscanf(av[1], "%08x:%jx", &lo, &obj_id); + hammer_cmd_show(-1, lo, (int64_t)obj_id, 0, NULL, NULL); exit(0); } if (strcmp(av[0], "blockmap") == 0) { diff --git a/sbin/jscan/dump_debug.c b/sbin/jscan/dump_debug.c index 6a2576f318..8180465cfd 100644 --- a/sbin/jscan/dump_debug.c +++ b/sbin/jscan/dump_debug.c @@ -63,8 +63,9 @@ dump_debug_stream(struct jstream *js) jsread(js, 0, &head, sizeof(head)); sid = head.streamid & JREC_STREAMID_MASK; - printf("STREAM %04x %016llx {\n", (int)(u_int16_t)head.streamid, - head.transid); + printf("STREAM %04x %016jx {\n", + (int)(u_int16_t)head.streamid, + (uintmax_t)head.transid); if (sid >= JREC_STREAMID_JMIN && sid < JREC_STREAMID_JMAX) { off_t off = sizeof(head); @@ -108,7 +109,7 @@ dump_debug_subrecord(struct jstream *js, off_t *off, off_t recsize, int level) break; } printf("%*.*s", level * 4, level * 4, ""); - printf("@%lld ", base); + printf("@%jd ", (intmax_t)base); printf("RECORD %s [%04x/%d]", type_to_name(sub.rectype), (int)(u_int16_t)sub.rectype, sub.recsize); if (sub.recsize == -1) { @@ -268,7 +269,7 @@ dump_debug_payload(int16_t rectype, struct jstream *js, off_t off, printf(" %d", (int)*(const u_int32_t *)buf); break; case 8: - printf(" %lld", (int64_t)*(const u_int64_t *)buf); + printf(" %jd", (intmax_t)*(const int64_t *)buf); break; default: printf(" ?"); @@ -287,7 +288,7 @@ dump_debug_payload(int16_t rectype, struct jstream *js, off_t off, printf(" 0x%08x", (int)*(const u_int32_t *)buf); break; case 8: - printf(" 0x%016llx", (int64_t)*(const u_int64_t *)buf); + printf(" 0x%016jx", (uintmax_t)*(const u_int64_t *)buf); break; default: printf(" ?"); @@ -306,7 +307,7 @@ dump_debug_payload(int16_t rectype, struct jstream *js, off_t off, printf(" %011o", (int)*(const u_int32_t *)buf); break; case 8: - printf(" %022llo", (int64_t)*(const u_int64_t *)buf); + printf(" %022jo", (intmax_t)*(const int64_t *)buf); break; default: printf(" ?"); diff --git a/sbin/jscan/jfile.c b/sbin/jscan/jfile.c index 57a5919487..5890b97536 100644 --- a/sbin/jscan/jfile.c +++ b/sbin/jscan/jfile.c @@ -98,7 +98,7 @@ jopen_prefix(const char *prefix, int rw) den->d_name[baselen] == '.' ) { seq = strtoul(den->d_name + baselen + 1, &ptr, 16); - if (*ptr == 0 && seq != ULONG_MAX) { + if (*ptr == 0 && seq != UINT_MAX) { if (seq_beg == (unsigned int)-1 || seq_beg > seq) seq_beg = seq; if (seq_end == (unsigned int)-1 || seq_end < seq) @@ -700,8 +700,8 @@ jseek(struct jfile *jf, int64_t transid, enum jdirection direction) jd =jread(jf, jd, JD_FORWARDS); } if (verbose_opt > 1) { - fprintf(stderr, "jseek returning seq %08x offset 0x%08llx\n", - jd->jd_seq, jd->jd_pos); + fprintf(stderr, "jseek returning seq %08x offset 0x%08jx\n", + jd->jd_seq, (uintmax_t)jd->jd_pos); } return(jd); } diff --git a/sbin/jscan/jscan.c b/sbin/jscan/jscan.c index 8fde05759c..d3cd8f6db0 100644 --- a/sbin/jscan/jscan.c +++ b/sbin/jscan/jscan.c @@ -269,16 +269,16 @@ main(int ac, char **av) transid = 0; if (verbose_opt) { if (jmodes & JMODEF_OUTPUT) { - fprintf(stderr, "Starting transid for OUTPUT: %016llx\n", - output_transid); + fprintf(stderr, "Starting transid for OUTPUT: %016jx\n", + (uintmax_t)output_transid); } if (jmodes & JMODEF_MIRROR) { - fprintf(stderr, "Starting transid for MIRROR: %016llx\n", - mirror_transid); + fprintf(stderr, "Starting transid for MIRROR: %016jx\n", + (uintmax_t)mirror_transid); } if (jmodes & JMODEF_RECORD) { - fprintf(stderr, "Starting transid for RECORD: %016llx\n", - record_transid); + fprintf(stderr, "Starting transid for RECORD: %016jx\n", + (uintmax_t)record_transid); } } diff --git a/sbin/jscan/jsession.c b/sbin/jscan/jsession.c index 6de26fd018..574c0094ae 100644 --- a/sbin/jscan/jsession.c +++ b/sbin/jscan/jsession.c @@ -69,9 +69,9 @@ jsession_update_transid(struct jsession *ss __unused, int64_t transid) exit(1); } if (ss->ss_direction == JD_FORWARDS) - snprintf(buf, sizeof(buf), "%016llx\n", transid); + snprintf(buf, sizeof(buf), "%016jx\n", (uintmax_t)transid); else - snprintf(buf, sizeof(buf), "%016llx\n", transid - 1); + snprintf(buf, sizeof(buf), "%016jx\n", (uintmax_t)(transid - 1)); lseek(ss->ss_transid_fd, 0L, 0); write(ss->ss_transid_fd, buf, strlen(buf)); if (fsync_opt > 1) diff --git a/sbin/jscan/jstream.c b/sbin/jscan/jstream.c index 844d88ed98..b1f94e5c51 100644 --- a/sbin/jscan/jstream.c +++ b/sbin/jscan/jstream.c @@ -125,26 +125,38 @@ retry: (head->streamid & JREC_STREAMCTL_BEGIN) == 0 ) { if (verbose_opt > 1) - fprintf(stderr, "mid-transaction detected transid %016llx streamid %04x\n", jd->jd_transid, head->streamid & JREC_STREAMID_MASK); + fprintf(stderr, "mid-transaction detected transid %016jx " + "streamid %04x\n", + (uintmax_t)jd->jd_transid, + head->streamid & JREC_STREAMID_MASK); if (jaddrecord_backtrack(ss, jd) == 0) { if (verbose_opt) - fprintf(stderr, "mid-transaction streamid %04x collection succeeded\n", head->streamid & JREC_STREAMID_MASK); + fprintf(stderr, "mid-transaction streamid %04x collection " + "succeeded\n", + head->streamid & JREC_STREAMID_MASK); goto retry; } - fprintf(stderr, "mid-transaction streamid %04x collection failed\n", head->streamid & JREC_STREAMID_MASK); + fprintf(stderr, "mid-transaction streamid %04x collection failed\n", + head->streamid & JREC_STREAMID_MASK); jscan_dispose(js); return(NULL); } else if (ss->ss_direction == JD_BACKWARDS && (head->streamid & JREC_STREAMCTL_END) == 0 ) { if (verbose_opt > 1) - fprintf(stderr, "mid-transaction detected transid %016llx streamid %04x\n", jd->jd_transid, head->streamid & JREC_STREAMID_MASK); + fprintf(stderr, "mid-transaction detected transid %016jx " + "streamid %04x\n", + (uintmax_t)jd->jd_transid, + head->streamid & JREC_STREAMID_MASK); if (jaddrecord_backtrack(ss, jd) == 0) { if (verbose_opt) - fprintf(stderr, "mid-transaction streamid %04x collection succeeded\n", head->streamid & JREC_STREAMID_MASK); + fprintf(stderr, "mid-transaction streamid %04x " + "collection succeeded\n", + head->streamid & JREC_STREAMID_MASK); goto retry; } - fprintf(stderr, "mid-transaction streamid %04x collection failed\n", head->streamid & JREC_STREAMID_MASK); + fprintf(stderr, "mid-transaction streamid %04x collection failed\n", + head->streamid & JREC_STREAMID_MASK); jscan_dispose(js); return(NULL); } diff --git a/sbin/jscan/subs.c b/sbin/jscan/subs.c index 014baef53a..8f2e127bf1 100644 --- a/sbin/jscan/subs.c +++ b/sbin/jscan/subs.c @@ -41,7 +41,7 @@ jf_warn(struct jfile *jf, const char *ctl, ...) { va_list va; - fprintf(stderr, "@0x%016llx ", jf->jf_pos); + fprintf(stderr, "@0x%016jx ", (uintmax_t)jf->jf_pos); va_start(va, ctl); vfprintf(stderr, ctl, va); va_end(va); diff --git a/sbin/mountctl/mountctl.c b/sbin/mountctl/mountctl.c index 7717829691..bc6b7f717e 100644 --- a/sbin/mountctl/mountctl.c +++ b/sbin/mountctl/mountctl.c @@ -466,7 +466,7 @@ mountctl_list(const char *keyword __unused, const char *mountpt, printf(" membufused=%s\n", numtostr(rstat->membufused)); printf(" membufunacked=%s\n", numtostr(rstat->membufunacked)); printf(" total_bytes=%s\n", numtostr(rstat->bytessent)); - printf(" fifo_stalls=%lld\n", rstat->fifostalls); + printf(" fifo_stalls=%jd\n", (intmax_t)rstat->fifostalls); } static void @@ -619,7 +619,7 @@ numtostr(int64_t num) static char buf[64]; if (num < 1024) - snprintf(buf, sizeof(buf), "%lld", num); + snprintf(buf, sizeof(buf), "%jd", (intmax_t)num); else if (num < 10 * 1024) snprintf(buf, sizeof(buf), "%3.2fK", num / 1024.0); else if (num < 1024 * 1024) diff --git a/sbin/quotacheck/quotacheck.c b/sbin/quotacheck/quotacheck.c index 78355579f7..fc4b555e98 100644 --- a/sbin/quotacheck/quotacheck.c +++ b/sbin/quotacheck/quotacheck.c @@ -521,8 +521,10 @@ getnextinode(ino_t inumber) daddr_t dblk; static struct ufs1_dinode *dp; - if (inumber != nextino++ || inumber > maxino) - errx(1, "bad inode number %llu to nextinode", inumber); + if (inumber != nextino++ || inumber > maxino) { + errx(1, "bad inode number %ju to nextinode", + (intmax_t)inumber); + } if (inumber >= lastinum) { readcnt++; dblk = fsbtodb(&sblock, ino_to_fsba(&sblock, lastinum)); diff --git a/sbin/restore/tape.c b/sbin/restore/tape.c index dec1e9248c..5978a34e18 100644 --- a/sbin/restore/tape.c +++ b/sbin/restore/tape.c @@ -400,8 +400,8 @@ gethdr: goto again; } if (tmpbuf.c_date != dumpdate || tmpbuf.c_ddate != dumptime) { - fprintf(stderr, "Wrong dump date\n\tgot: %s", - ctime(&tmpbuf.c_date)); + time_t c_date = tmpbuf.c_date; + fprintf(stderr, "Wrong dump date\n\tgot: %s", ctime(&c_date)); fprintf(stderr, "\twanted: %s", ctime(&dumpdate)); volno = 0; goto again; @@ -507,9 +507,12 @@ setdumpnum(void) void printdumpinfo(void) { - fprintf(stdout, "Dump date: %s", ctime(&spcl.c_date)); + time_t c_date = spcl.c_date; + time_t c_ddate = spcl.c_ddate; + + fprintf(stdout, "Dump date: %s", ctime(&c_date)); fprintf(stdout, "Dumped from: %s", - (spcl.c_ddate == 0) ? "the epoch\n" : ctime(&spcl.c_ddate)); + (spcl.c_ddate == 0) ? "the epoch\n" : ctime(&c_ddate)); if (spcl.c_host[0] == '\0') return; fprintf(stderr, "Level %ld dump of %s on %s:%s\n", diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c index 18da3d6944..8af09a9ae9 100644 --- a/sbin/savecore/savecore.c +++ b/sbin/savecore/savecore.c @@ -294,8 +294,8 @@ kmem_setup(void) } dumplo = kdumplo * DEV_BSIZE; if (verbose) - printf("dumplo = %lld (%lld * %d)\n", - (long long)dumplo, kdumplo, DEV_BSIZE); + printf("dumplo = %jd (%jd * %d)\n", + (intmax_t)dumplo, (intmax_t)kdumplo, DEV_BSIZE); Lseek(kmem, (off_t)current_nl[X_DUMPMAG].n_value, L_SET); Read(kmem, &dumpmag, sizeof(dumpmag)); dumpfd = Open(ddname, O_RDWR); @@ -431,7 +431,7 @@ err1: syslog(LOG_WARNING, "%s: %m", path); for (; dumpsize > 0; dumpsize -= nr) { printf("%6ldK\r", (long)(dumpsize / 1024)); fflush(stdout); - nr = read(dumpfd, buf, MIN(dumpsize, sizeof(buf))); + nr = read(dumpfd, buf, MIN((uintmax_t)dumpsize, sizeof(buf))); if (nr <= 0) { if (nr == 0) syslog(LOG_WARNING, diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index 30fa24b815..750f96e275 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -382,7 +382,7 @@ S_sensor(int l2, void *p) (s->value - 273150000) / 1000000.0); break; case SENSOR_FANRPM: - printf("%lld RPM", s->value); + printf("%jd RPM", (intmax_t)s->value); break; case SENSOR_VOLTS_DC: printf("%.2f VDC", s->value / 1000000.0); @@ -400,7 +400,7 @@ S_sensor(int l2, void *p) printf("%s", s->value ? "On" : "Off"); break; case SENSOR_INTEGER: - printf("%lld", s->value); + printf("%jd", (intmax_t)s->value); break; case SENSOR_PERCENT: printf("%.2f%%", s->value / 1000.0); @@ -735,10 +735,13 @@ show_var(int *oid, size_t nlen) fmt++; spacer = ""; while (len >= sizeof(quad_t)) { - if(*fmt == 'U') - printf("%s%qu", spacer, *(u_quad_t *)p); - else - printf("%s%qd", spacer, *(quad_t *)p); + if(*fmt == 'U') { + printf("%s%ju", + spacer, (uintmax_t)*(u_quad_t *)p); + } else { + printf("%s%jd", + spacer, (intmax_t)*(quad_t *)p); + } spacer = " "; len -= sizeof(int64_t); p += sizeof(int64_t); diff --git a/secure/lib/libssh/version.c b/secure/lib/libssh/version.c index d64ab1b30d..68c1c830fc 100644 --- a/secure/lib/libssh/version.c +++ b/secure/lib/libssh/version.c @@ -27,6 +27,7 @@ * $DragonFly: src/secure/lib/libssh/version.c,v 1.1 2004/07/31 20:05:00 geekgod Exp $ */ +#include #include "version.h" #include "includes.h" #include "xmalloc.h" diff --git a/sys/netproto/smb/smb_dev.h b/sys/netproto/smb/smb_dev.h index f63405442b..002a961862 100644 --- a/sys/netproto/smb/smb_dev.h +++ b/sys/netproto/smb/smb_dev.h @@ -113,7 +113,7 @@ struct smbioc_rq { struct smbioc_t2rq { u_int16_t ioc_setup[3]; int ioc_setupcnt; - char * ioc_name; + const char * ioc_name; u_short ioc_tparamcnt; void * ioc_tparam; u_short ioc_tdatacnt; diff --git a/usr.bin/cmp/misc.c b/usr.bin/cmp/misc.c index 4f0eb09625..c89d5822e2 100644 --- a/usr.bin/cmp/misc.c +++ b/usr.bin/cmp/misc.c @@ -56,7 +56,7 @@ void diffmsg(const char *file1, const char *file2, off_t byte, off_t line) { if (!sflag) - (void)printf("%s %s differ: char %qd, line %qd\n", - file1, file2, byte, line); + (void)printf("%s %s differ: char %jd, line %jd\n", + file1, file2, (intmax_t)byte, (intmax_t)line); exit(DIFF_EXIT); } diff --git a/usr.bin/cmp/regular.c b/usr.bin/cmp/regular.c index afcf35cae1..81407a13e9 100644 --- a/usr.bin/cmp/regular.c +++ b/usr.bin/cmp/regular.c @@ -102,13 +102,16 @@ c_regular(int fd1, const char *file1, off_t skip1, off_t len1, int fd2, if ((ch = *p1) != *p2) { if (xflag) { dfound = 1; - (void)printf("%08qx %02x %02x\n", byte - 1, ch, *p2); + printf("%08jx %02x %02x\n", + (intmax_t)byte - 1, ch, *p2); } else if (lflag) { dfound = 1; - (void)printf("%6qd %3o %3o\n", byte, ch, *p2); - } else + printf("%6jd %3o %3o\n", + (intmax_t)byte, ch, *p2); + } else { diffmsg(file1, file2, byte, line); /* NOTREACHED */ + } } if (ch == '\n') ++line; diff --git a/usr.bin/cmp/special.c b/usr.bin/cmp/special.c index 133bf91c6b..73e2507b39 100644 --- a/usr.bin/cmp/special.c +++ b/usr.bin/cmp/special.c @@ -75,7 +75,8 @@ c_special(int fd1, const char *file1, off_t skip1, int fd2, const char *file2, if (ch1 != ch2) { if (lflag) { dfound = 1; - (void)printf("%6qd %3o %3o\n", byte, ch1, ch2); + printf("%6jd %3o %3o\n", + (intmax_t)byte, ch1, ch2); } else { diffmsg(file1, file2, byte, line); /* NOTREACHED */ diff --git a/usr.bin/finger/lprint.c b/usr.bin/finger/lprint.c index 51b50f1a75..f56633848e 100644 --- a/usr.bin/finger/lprint.c +++ b/usr.bin/finger/lprint.c @@ -305,7 +305,7 @@ show_text(const char *directory, const char *file_name, const char *header) return(0); /* If short enough, and no newlines, show it on a single line.*/ - if (sb.st_size <= LINE_LEN - strlen(header) - 5) { + if ((uintptr_t)sb.st_size <= LINE_LEN - strlen(header) - 5) { nr = read(fd, tbuf, sizeof(tbuf)); if (nr <= 0) { (void)close(fd); diff --git a/usr.bin/finger/util.c b/usr.bin/finger/util.c index 7511954480..5279ec13f3 100644 --- a/usr.bin/finger/util.c +++ b/usr.bin/finger/util.c @@ -115,7 +115,7 @@ enter_lastlog(PERSON *pn) } if (fd == -1 || lseek(fd, (long)pn->uid * sizeof(ll), SEEK_SET) != - (long)pn->uid * sizeof(ll) || + (off_t)((long)pn->uid * sizeof(ll)) || read(fd, (char *)&ll, sizeof(ll)) != sizeof(ll)) { /* as if never logged in */ ll.ll_line[0] = ll.ll_host[0] = '\0'; diff --git a/usr.bin/gprof/arcs.c b/usr.bin/gprof/arcs.c index efb9856a2a..45014b4eb4 100644 --- a/usr.bin/gprof/arcs.c +++ b/usr.bin/gprof/arcs.c @@ -98,8 +98,12 @@ addarc(nltype *parentp, nltype *childp, long count) */ nltype **topsortnlp; -topcmp(nltype **npp1, nltype **npp2) +int +topcmp(const void *arg1, const void *arg2) { + nltype *const*npp1 = arg1; + nltype *const*npp2 = arg2; + return (*npp1) -> toporder - (*npp2) -> toporder; } diff --git a/usr.bin/gprof/printgprof.c b/usr.bin/gprof/printgprof.c index 65a9a76b97..8763c81759 100644 --- a/usr.bin/gprof/printgprof.c +++ b/usr.bin/gprof/printgprof.c @@ -661,8 +661,10 @@ printblurb(char *blurbname) } int -namecmp(nltype **npp1, nltype **npp2) +namecmp(const void *arg1, const void *arg2) { + nltype *const*npp1 = arg1; + nltype *const*npp2 = arg2; return( strcmp( (*npp1) -> name , (*npp2) -> name ) ); } diff --git a/usr.bin/limits/limits.c b/usr.bin/limits/limits.c index 0de352a656..469ec02943 100644 --- a/usr.bin/limits/limits.c +++ b/usr.bin/limits/limits.c @@ -519,7 +519,7 @@ print_limit(rlim_t limit, unsigned divisor, const char * inf, const char * pfx, if (limit == RLIM_INFINITY) strcpy(numbr, inf); else - sprintf(numbr, "%qd", (quad_t)((limit + divisor/2) / divisor)); + sprintf(numbr, "%jd", (intmax_t)((limit + divisor/2) / divisor)); printf(pfx, which, numbr); printf(sfx, which); diff --git a/usr.bin/monitor/monitor.c b/usr.bin/monitor/monitor.c index 18b5e3ab5b..e2b1f8bdca 100644 --- a/usr.bin/monitor/monitor.c +++ b/usr.bin/monitor/monitor.c @@ -166,7 +166,7 @@ monitor_events(void) printf("%-23s", elm->path); if (VerboseOpt && fstat(kev->ident, &st) == 0 && S_ISREG(st.st_mode)) { - printf(" %10lld", st.st_size); + printf(" %10jd", (intmax_t)st.st_size); } while (QuietOpt == 0 && (bno = ffs(kev->fflags)) > 0) { printf(" "); diff --git a/usr.bin/tail/misc.c b/usr.bin/tail/misc.c index 82e87823d7..7153613087 100644 --- a/usr.bin/tail/misc.c +++ b/usr.bin/tail/misc.c @@ -72,8 +72,8 @@ mapprint(struct mapinfo *mip, off_t startoff, off_t len) int n; while (len > 0) { - if (startoff < mip->mapoff || startoff >= mip->mapoff + - mip->maplen) { + if (startoff < mip->mapoff || + startoff >= (intmax_t)(mip->mapoff + mip->maplen)) { if (maparound(mip, startoff) != 0) return (1); } @@ -101,7 +101,7 @@ maparound(struct mapinfo *mip, off_t offset) mip->mapoff = offset & ~((off_t)TAILMAPLEN - 1); mip->maplen = TAILMAPLEN; - if (mip->maplen > mip->maxoff - mip->mapoff) + if (mip->maplen > (uintmax_t)(mip->maxoff - mip->mapoff)) mip->maplen = mip->maxoff - mip->mapoff; if (mip->maplen <= 0) abort(); diff --git a/usr.bin/tail/reverse.c b/usr.bin/tail/reverse.c index c668c1c222..695e8d7533 100644 --- a/usr.bin/tail/reverse.c +++ b/usr.bin/tail/reverse.c @@ -120,7 +120,8 @@ r_reg(FILE *fp, enum STYLE style, off_t off, struct stat *sbp) curoff = size - 2; lineend = size; while (curoff >= 0) { - if (curoff < map.mapoff || curoff >= map.mapoff + map.maplen) { + if (curoff < map.mapoff || + curoff >= (intmax_t)(map.mapoff + map.maplen)) { if (maparound(&map, curoff) != 0) { ierr(); return; @@ -237,7 +238,7 @@ r_buf(FILE *fp) } if (enomem) { - warnx("warning: %qd bytes discarded", enomem); + warnx("warning: %jd bytes discarded", (intmax_t)enomem); rval = 1; } diff --git a/usr.bin/wc/wc.c b/usr.bin/wc/wc.c index bf3d2cc4d1..ce527a7c54 100644 --- a/usr.bin/wc/wc.c +++ b/usr.bin/wc/wc.c @@ -49,7 +49,7 @@ #include #include -u_quad_t tlinect, twordct, tcharct; +uintmax_t tlinect, twordct, tcharct; int doline, doword, dochar, domulti; static int cnt(const char *); @@ -108,11 +108,11 @@ main(int argc, char **argv) if (total > 1) { if (doline) - printf(" %7qu", tlinect); + printf(" %7ju", tlinect); if (doword) - printf(" %7qu", twordct); + printf(" %7ju", twordct); if (dochar || domulti) - printf(" %7qu", tcharct); + printf(" %7ju", tcharct); printf(" total\n"); } exit(errors == 0 ? 0 : 1); @@ -160,10 +160,10 @@ cnt(const char *file) } } tlinect += linect; - printf(" %7qu", linect); + printf(" %7ju", linect); if (dochar) { tcharct += charct; - printf(" %7qu", charct); + printf(" %7ju", charct); } close(fd); return (0); @@ -232,15 +232,15 @@ word: gotsp = 1; } if (doline) { tlinect += linect; - printf(" %7qu", linect); + printf(" %7ju", linect); } if (doword) { twordct += wordct; - printf(" %7qu", wordct); + printf(" %7ju", wordct); } if (dochar || domulti) { tcharct += charct; - printf(" %7qu", charct); + printf(" %7ju", charct); } close(fd); return (0); -- 2.41.0