[illumos-Developer] Lint fun -- advice wanted

Albert Lee trisk at opensolaris.org
Wed Jun 22 21:36:51 PDT 2011


On Wed, Jun 22, 2011 at 11:20 PM, Jason King <jason.brian.king at gmail.com> wrote:
> So as a weekend project, I thought I'd finish up work on issue 640 --
> number_to_scaled_string is duplicated in several commands.  It seemed like
> libcmdutils was a logical place to put the consolidated function (I settled
> on using the libzfs 'nicenum' implementation since it doesn't suffer from
> some of the rounding behavior near multiples of the scale factor (usually
> 1024) that the current ones in ls, df, du, swap do).
> A preliminary webrev for reference can be seen at
> http://dev1.illumos.org/~jbk/nicenum
> However, doing so causes a fun lint issue with usr/src/cmd/swap/swap.c:
> /opt/SUNWspro/sunstudio12.1/bin/lint -I/opt/SUNWspro/prod/include/lint -axsm
> -DTE
> XT_DOMAIN=\"SUNW_OST_OSCMD\" -D_TS_ERRNO
>  -I/export/home/jason/ws/nicenum/proto/r
> oot_i386/usr/include    -D_LARGEFILE64_SOURCE  -errtags=yes -s
> -erroff=E_PTRDIFF_
> OVERFLOW -erroff=E_ASSIGN_NARROW_CONV -U__PRAGMA_REDEFINE_EXTNAME
> -Xc99=%none -er
> rsecurity=core -erroff=E_SEC_CREAT_WITHOUT_EXCL
> -erroff=E_SEC_FORBIDDEN_WARN_CREA
> T -erroff=E_ASSIGN_INT_TO_SMALL_INT -erroff=E_CAST_INT_CONST_TO_SMALL_INT
> -erroff
> =E_CAST_INT_TO_SMALL_INT -erroff=E_CAST_TO_PTR_FROM_INT
> -erroff=E_COMP_INT_WITH_L
> ARGE_INT -erroff=E_INTEGRAL_CONST_EXP_EXPECTED
> -erroff=E_PASS_INT_TO_SMALL_INT -e
> rroff=E_PTR_CONV_LOSES_BITS ../swap.c
> -L/export/home/jason/ws/nicenum/proto/root_
> i386/lib -L/export/home/jason/ws/nicenum/proto/root_i386/usr/lib   -ldiskmgt
> -lcm
> dutils
> "/ws/nicenum/proto/root_i386/usr/include/libcmdutils.h", line 89: warning:
> functi
> on argument declared inconsistently: writefile(arg 7) in
> llib-lcmdutils:libcmduti
> ls.h(89) struct stat64 * and libcmdutils.h(89) struct stat *
> (E_INCONS_ARG_DECL2)
> "/ws/nicenum/proto/root_i386/usr/include/libcmdutils.h", line 89: warning:
> functi
> on argument declared inconsistently: writefile(arg 8) in
> llib-lcmdutils:libcmduti
> ls.h(89) struct stat64 * and libcmdutils.h(89) struct stat *
> (E_INCONS_ARG_DECL2)
> "/ws/nicenum/proto/root_i386/usr/include/libcmdutils.h", line 119: warning:
> funct
> ion argument declared inconsistently: add_tnode(arg 3) in
> llib-lcmdutils:libcmdut
> ils.h(119) unsigned long long  and libcmdutils.h(119) unsigned long
>  (E_INCONS_AR
> G_DECL2)
> The problem is that libcmdutils is built with -Dswap.h=64 and
> uses some types (struct stat, ino_t), that are redefined to 64-bit
> quantities, however according to /usr/include/sys/swap.h, swapctl cannot be
> used with largefiles (specificallyswap.h set to 64).  Since swap
> does not use the functions (add_tnode, writefile) that use those types, this
> is not really a problem, however I don't know of a way I can make this lint
> clean.
> Any suggestions?

I think problem is the swapent and swapres structures' use of off_t...
just replacing them with off32_t for #if !defined(_LP64) would keep
them consistent regardless of _FILE_OFFSET_BITS.

https://www.illumos.org/issues/1140 filed for this.

-Albert



More information about the Developer mailing list