From 61522196c71593da09572fce9af9e0d7dad61bc3 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 23 Apr 2013 09:44:36 +0000 Subject: * Merge in cygwin-64bit-branch. --- winsup/utils/ChangeLog | 4 + winsup/utils/ChangeLog.64bit | 85 +++++++++++++++++++ winsup/utils/aclocal.m4 | 6 +- winsup/utils/configure | 191 ++++++++++++++++++++++--------------------- winsup/utils/cygcheck.cc | 65 ++++++++++----- winsup/utils/dumper.cc | 42 +++++----- winsup/utils/dumper.h | 24 +++--- winsup/utils/kill.cc | 10 +-- winsup/utils/ldd.cc | 18 ++-- winsup/utils/locale.cc | 4 +- winsup/utils/mkgroup.c | 44 +++++----- winsup/utils/mkpasswd.c | 46 ++++++----- winsup/utils/module_info.cc | 6 +- winsup/utils/mount.cc | 7 +- winsup/utils/parse_pe.cc | 8 +- winsup/utils/passwd.c | 21 ++--- winsup/utils/path.cc | 10 ++- winsup/utils/ps.cc | 5 +- winsup/utils/regtool.cc | 12 +-- winsup/utils/ssp.c | 17 +++- winsup/utils/strace.cc | 25 ++++-- winsup/utils/tzset.c | 23 +++--- 22 files changed, 419 insertions(+), 254 deletions(-) create mode 100644 winsup/utils/ChangeLog.64bit (limited to 'winsup/utils') diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index 9eaa7dc0b..b71cb49c7 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,7 @@ +2013-04-23 Corinna Vinschen + + * Merge in cygwin-64bit-branch. See ChangeLog.64bit for details. + 2013-02-20 Yaakov Selkowitz * Makefile.in (CYGWIN_LDFLAGS): Replace -static-lib* with -static. diff --git a/winsup/utils/ChangeLog.64bit b/winsup/utils/ChangeLog.64bit new file mode 100644 index 000000000..69c235672 --- /dev/null +++ b/winsup/utils/ChangeLog.64bit @@ -0,0 +1,85 @@ +2013-03-28 Peter Rosin + Corinna Vinschen + + * cygcheck.cc (dll_info): Fix crash due to sizeof(time_t) being not + equal to sizeof(int). Output timestamp RFC 3339 compatible. + +2013-03-26 Corinna Vinschen + + * tzset.c (main): Don't try to overwrite space with NUL. Explain why. + Rather, just print the string with computed precision value. + +2013-03-22 Corinna Vinschen + + * kill.cc (main): Chack pid against INT_MIN and (U)INT_MAX since pid_t + is 4 byte on all platforms. + * mkgroup.c (main): Check domlist[i].id_offset against UINT_MAX since + DWORD is 4 byte on all platforms. + * mkpasswd.c (main): Ditto. + +2013-02-19 Corinna Vinschen + + * cygcheck.cc (dll_info): Handle x86_64 binaries. Make sure to print + only architecture matching cygcheck build, otherwise suffer path + evaluation problems. + +2013-02-17 Yaakov Selkowitz + + Fix 64-bit type problems in dumper.exe + * dumper.cc: Througout, cast pid to unsigned int, change addresses + and sizes from DWORD to SIZE_T, and use %p for pointer addresses. + (dumper::add_mem_region): Change size type to SIZE_T. + (dumper::split_add_mem_region): Ditto. + * dumper.h (struct process_mem_region): Change size type to SIZE_T. + (class exclusion): Change last, size, and step types to size_t. + (exclusion::exclusion): Change argument type to size_t. + (exclusion::add): Change mem_size type to SIZE_T. + (dumper::add_mem_region): Change size type to SIZE_T. + (dumper::split_add_mem_region): Ditto. + (psapi_get_module_name): Change BaseAddress type to LPVOID. + * module_info.cc (psapi_get_module_name): Ditto. + * parse_pe.cc: Througout, change addresses and sizes from DWORD to + SIZE_T, and use %p for pointer addresses. + (exclusion::add): Change mem_size type to SIZE_T. + +2013-02-13 Corinna Vinschen + + * kill.cc (forcekill): Use unsigned int printf format specifier and + cast to avoid compiler warnings where DWORD value is used. + * regtool.cc: Ditto, throughout. + +2013-02-06 Corinna Vinschen + + * ldd.cc: Drop including inttypes.h. Use %u rather than PRIu32. + * mount.cc: Fix type problem with %* expression. + * cygcheck.cc: Ditto. + +2013-02-06 Corinna Vinschen + + Throughout, fix type problems on 32 and 64 bit. Except: + * ssp.c: Disable entire functionality on x86_64 for now. + +2012-11-22 Corinna Vinschen + + * dump_setup.cc: Drop temporary workaround to handle older Mingw header + files on Fedora 17. + * strace.cc: Ditto. + +2012-08-16 Corinna Vinschen + + * ps.cc (main): Define uid correctly as uid_t. + +2012-08-16 Corinna Vinschen + + * cygcheck.cc: Change include path to not depend on installed + cygwin/version.h. + (_NOMNTENT_MACROS): Define before including mntent.h. + * path.cc (_NOMNTENT_MACROS): Ditto. + * dump_setup.cc: Add temporary workaround to handle older Mingw header + files on Fedora 17. + * strace.cc: Ditto. + +2012-08-13 Corinna Vinschen + + * ps.cc (main): Drop unneeded cast. + diff --git a/winsup/utils/aclocal.m4 b/winsup/utils/aclocal.m4 index 5985aa9a1..b08bdfec5 100644 --- a/winsup/utils/aclocal.m4 +++ b/winsup/utils/aclocal.m4 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.11.1 -*- Autoconf -*- +# generated automatically by aclocal 1.12.1 -*- Autoconf -*- + +# Copyright (C) 1996-2012 Free Software Foundation, Inc. -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. diff --git a/winsup/utils/configure b/winsup/utils/configure index 36248c9c0..76432e743 100755 --- a/winsup/utils/configure +++ b/winsup/utils/configure @@ -1,11 +1,9 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68. +# Generated by GNU Autoconf 2.69. # # -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. +# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -134,6 +132,31 @@ export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +as_fn_exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh @@ -167,7 +190,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi -test x\$exitcode = x0 || exit 1" +test x\$exitcode = x0 || exit 1 +test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && @@ -211,21 +235,25 @@ IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 fi if test x$as_have_required = xno; then : @@ -327,6 +355,14 @@ $as_echo X"$as_dir" | } # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take @@ -448,6 +484,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -482,16 +522,16 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -503,28 +543,8 @@ else as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -1108,8 +1128,6 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1353,9 +1371,9 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure -generated by GNU Autoconf 2.68 +generated by GNU Autoconf 2.69 -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1446,7 +1464,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -1989,7 +2007,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2029,7 +2047,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2082,7 +2100,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2123,7 +2141,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -2181,7 +2199,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2225,7 +2243,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2747,8 +2765,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include -#include -#include +struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -2861,7 +2878,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2905,7 +2922,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3178,7 +3195,7 @@ case $as_dir/ in #(( # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -3253,7 +3270,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MINGW_CXX="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3736,16 +3753,16 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. + # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' + as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi else - as_ln_s='cp -p' + as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -3805,28 +3822,16 @@ else as_mkdir_p=false fi -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -3848,7 +3853,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # values after options handling. ac_log=" This file was extended by $as_me, which was -generated by GNU Autoconf 2.68. Invocation command line was +generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -3901,10 +3906,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status -configured by $0, generated by GNU Autoconf 2.68, +configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" -Copyright (C) 2010 Free Software Foundation, Inc. +Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -3982,7 +3987,7 @@ fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' diff --git a/winsup/utils/cygcheck.cc b/winsup/utils/cygcheck.cc index 2560b07f1..8c7af0e1c 100644 --- a/winsup/utils/cygcheck.cc +++ b/winsup/utils/cygcheck.cc @@ -1,7 +1,7 @@ /* cygcheck.cc Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010, 2011, 2012 Red Hat, Inc. + 2009, 2010, 2011, 2012, 2013 Red Hat, Inc. This file is part of Cygwin. @@ -24,6 +24,7 @@ #include #include "../cygwin/include/cygwin/version.h" #include "../cygwin/include/sys/cygwin.h" +#define _NOMNTENT_MACROS #include "../cygwin/include/mntent.h" #include "../cygwin/cygprops.h" #undef cygwin_internal @@ -597,6 +598,28 @@ dll_info (const char *path, HANDLE fh, int lvl, int recurse) int pe_header_offset = get_dword (fh, 0x3c); if (GetLastError () != NO_ERROR) display_error ("get_dword"); + WORD arch = get_word (fh, pe_header_offset + 4); + if (GetLastError () != NO_ERROR) + display_error ("get_word"); +#ifdef __x86_64__ + if (arch != IMAGE_FILE_MACHINE_AMD64) + { + fputc ('\n', stderr); + display_error ("Wrong architecture. Only x86_64 executables supported.", + false, false); + return; + } + int base_off = 108; +#else + if (arch != IMAGE_FILE_MACHINE_I386) + { + fputc ('\n', stderr); + display_error ("Wrong architecture. Only ix86 executables supported.", + false, false); + return; + } + int base_off = 92; +#endif int opthdr_ofs = pe_header_offset + 4 + 20; unsigned short v[6]; @@ -619,19 +642,19 @@ dll_info (const char *path, HANDLE fh, int lvl, int recurse) else printf ("\n"); - int num_entries = get_dword (fh, opthdr_ofs + 92); + int num_entries = get_dword (fh, opthdr_ofs + base_off + 0); if (GetLastError () != NO_ERROR) display_error ("get_dword"); - int export_rva = get_dword (fh, opthdr_ofs + 96); + int export_rva = get_dword (fh, opthdr_ofs + base_off + 4); if (GetLastError () != NO_ERROR) display_error ("get_dword"); - int export_size = get_dword (fh, opthdr_ofs + 100); + int export_size = get_dword (fh, opthdr_ofs + base_off + 8); if (GetLastError () != NO_ERROR) display_error ("get_dword"); - int import_rva = get_dword (fh, opthdr_ofs + 104); + int import_rva = get_dword (fh, opthdr_ofs + base_off + 12); if (GetLastError () != NO_ERROR) display_error ("get_dword"); - int import_size = get_dword (fh, opthdr_ofs + 108); + int import_size = get_dword (fh, opthdr_ofs + base_off + 16); if (GetLastError () != NO_ERROR) display_error ("get_dword"); @@ -667,17 +690,20 @@ dll_info (const char *path, HANDLE fh, int lvl, int recurse) ExpDirectory *ed = (ExpDirectory *) exp; int ofs = ed->name_rva - export_rva; - struct tm *tm = localtime ((const time_t *) &(ed->timestamp)); - if (tm->tm_year < 60) + time_t ts = ed->timestamp; /* timestamp is only 4 bytes! */ + struct tm *tm = localtime (&ts); + if (tm && tm->tm_year < 60) tm->tm_year += 2000; - if (tm->tm_year < 200) + if (tm && tm->tm_year < 200) tm->tm_year += 1900; printf ("%*c", lvl + 2, ' '); - printf ("\"%s\" v%d.%d ts=", exp + ofs, + printf ("\"%s\" v%d.%d", exp + ofs, ed->major_ver, ed->minor_ver); - printf ("%d/%d/%d %d:%02d\n", - tm->tm_year, tm->tm_mon + 1, tm->tm_mday, - tm->tm_hour, tm->tm_min); + if (tm) + printf (" ts=%04d-%02d-%02d %02d:%02d", + tm->tm_year, tm->tm_mon + 1, tm->tm_mday, + tm->tm_hour, tm->tm_min); + putchar ('\n'); } } @@ -1115,7 +1141,7 @@ pretty_id () sz = -sz; for (char **g = groups; g <= ng; g++) if ((g != ng) && (++i < n)) - printf ("%*s", sz, *g); + printf ("%*s", (int) sz, *g); else { puts (*g); @@ -1691,7 +1717,7 @@ dump_sysinfo () { for (e = s; *e && *e != sep; e++); if (e-s) - printf ("\t%.*s\n", e - s, s); + printf ("\t%.*s\n", (int) (e - s), s); else puts ("\t."); count_path_items++; @@ -2307,7 +2333,7 @@ nuke (char *ev) } extern "C" { -unsigned long (*cygwin_internal) (int, ...); +uintptr_t (*cygwin_internal) (int, ...); WCHAR cygwin_dll_path[32768]; }; @@ -2319,10 +2345,11 @@ load_cygwin (int& argc, char **&argv) if (!(h = LoadLibrary ("cygwin1.dll"))) return; GetModuleFileNameW (h, cygwin_dll_path, 32768); - if ((cygwin_internal = (DWORD (*) (int, ...)) GetProcAddress (h, "cygwin_internal"))) + if ((cygwin_internal = (uintptr_t (*) (int, ...)) + GetProcAddress (h, "cygwin_internal"))) { char **av = (char **) cygwin_internal (CW_ARGV); - if (av && ((DWORD) av != (DWORD) -1)) + if (av && ((uintptr_t) av != (uintptr_t) -1)) { /* Copy cygwin's idea of the argument list into this Window application. */ for (argc = 0; av[argc]; argc++) @@ -2334,7 +2361,7 @@ load_cygwin (int& argc, char **&argv) char **envp = (char **) cygwin_internal (CW_ENVP); - if (envp && ((DWORD) envp != (DWORD) -1)) + if (envp && ((uintptr_t) envp != (uintptr_t) -1)) { /* Store path and revert to this value, otherwise path gets overwritten by the POSIXy Cygwin variation, which breaks cygcheck. diff --git a/winsup/utils/dumper.cc b/winsup/utils/dumper.cc index 8199aa4eb..50df44569 100644 --- a/winsup/utils/dumper.cc +++ b/winsup/utils/dumper.cc @@ -1,6 +1,6 @@ /* dumper.cc - Copyright 1999, 2001, 2002, 2004, 2006, 2007, 2011 Red Hat Inc. + Copyright 1999, 2001, 2002, 2004, 2006, 2007, 2011, 2013 Red Hat Inc. Written by Egor Duda @@ -84,7 +84,8 @@ dumper::dumper (DWORD pid, DWORD tid, const char *file_name) pid); if (!hProcess) { - fprintf (stderr, "Failed to open process #%lu, error %ld\n", pid, GetLastError ()); + fprintf (stderr, "Failed to open process #%u, error %ld\n", + (unsigned int) pid, (long) GetLastError ()); return; } @@ -192,7 +193,7 @@ dumper::add_thread (DWORD tid, HANDLE hThread) } int -dumper::add_mem_region (LPBYTE base, DWORD size) +dumper::add_mem_region (LPBYTE base, SIZE_T size) { if (!sane ()) return 0; @@ -209,14 +210,14 @@ dumper::add_mem_region (LPBYTE base, DWORD size) new_entity->u.memory.base = base; new_entity->u.memory.size = size; - deb_printf ("added memory region %08x-%08x\n", (DWORD) base, (DWORD) base + size); + deb_printf ("added memory region %p-%p\n", base, base + size); return 1; } /* split_add_mem_region scans list of regions to be excluded from dumping process (excl_list) and removes all "excluded" parts from given region. */ int -dumper::split_add_mem_region (LPBYTE base, DWORD size) +dumper::split_add_mem_region (LPBYTE base, SIZE_T size) { if (!sane ()) return 0; @@ -255,7 +256,7 @@ dumper::add_module (LPVOID base_address) if (!sane ()) return 0; - char *module_name = psapi_get_module_name (hProcess, (DWORD) base_address); + char *module_name = psapi_get_module_name (hProcess, base_address); if (module_name == NULL) return 1; @@ -270,7 +271,7 @@ dumper::add_module (LPVOID base_address) parse_pe (module_name, excl_list); - deb_printf ("added module %08x %s\n", base_address, module_name); + deb_printf ("added module %p %s\n", base_address, module_name); return 1; } @@ -284,8 +285,8 @@ dumper::collect_memory_sections () LPBYTE current_page_address; LPBYTE last_base = (LPBYTE) 0xFFFFFFFF; - DWORD last_size = 0; - DWORD done; + SIZE_T last_size = (SIZE_T) 0; + SIZE_T done; char mem_buf[PAGE_BUFFER_SIZE]; @@ -329,9 +330,9 @@ dumper::collect_memory_sections () for (int i = 0; i < 10; i++) strcat (buf, pt[i]); - deb_printf ("warning: failed to read memory at %08x-%08x (protect = %s), error %ld.\n", - (DWORD) current_page_address, - (DWORD) current_page_address + mbi.RegionSize, + deb_printf ("warning: failed to read memory at %p-%p (protect = %s), error %ld.\n", + current_page_address, + current_page_address + mbi.RegionSize, buf, err); skip_region_p = 1; } @@ -369,9 +370,9 @@ dumper::dump_memory_region (asection * to, process_mem_region * memory) if (!sane ()) return 0; - DWORD size = memory->size; - DWORD todo; - DWORD done; + SIZE_T size = memory->size; + SIZE_T todo; + SIZE_T done; LPBYTE pos = memory->base; DWORD sect_pos = 0; @@ -516,12 +517,13 @@ dumper::collect_process_information () if (!DebugActiveProcess (pid)) { - fprintf (stderr, "Cannot attach to process #%lu, error %ld", pid, GetLastError ()); + fprintf (stderr, "Cannot attach to process #%u, error %ld", + (unsigned int) pid, (long) GetLastError ()); return 0; } char event_name[sizeof ("cygwin_error_start_event") + 20]; - sprintf (event_name, "cygwin_error_start_event%16lx", pid); + sprintf (event_name, "cygwin_error_start_event%16x", (unsigned int) pid); HANDLE sync_with_debugee = OpenEvent (EVENT_MODIFY_STATE, FALSE, event_name); DEBUG_EVENT current_event; @@ -660,7 +662,7 @@ dumper::prepare_core_dump () char sect_name[50]; flagword sect_flags; - DWORD sect_size; + SIZE_T sect_size; bfd_vma sect_vma; asection *new_section; @@ -812,7 +814,7 @@ dumper::write_core_dump () if (p->section == NULL) continue; - deb_printf ("writing section type=%u base=%08x size=%08x flags=%08x\n", + deb_printf ("writing section type=%u base=%p size=%p flags=%08x\n", p->type, p->section->vma, bfd_get_section_size (p->section), @@ -936,7 +938,7 @@ main (int argc, char **argv) DWORD tid = 0; if (verbose) - printf ("dumping process #%lu to %s\n", pid, core_file); + printf ("dumping process #%u to %s\n", (unsigned int) pid, core_file); dumper d (pid, tid, core_file); if (!d.sane ()) diff --git a/winsup/utils/dumper.h b/winsup/utils/dumper.h index 4b8d2bdf7..b6c70308c 100644 --- a/winsup/utils/dumper.h +++ b/winsup/utils/dumper.h @@ -1,6 +1,6 @@ /* dumper.h - Copyright 1999,2001 Red Hat Inc. + Copyright 1999, 2001, 2013 Red Hat Inc. Written by Egor Duda @@ -28,7 +28,7 @@ typedef struct { LPBYTE base; - DWORD size; + SIZE_T size; } process_mem_region; typedef struct @@ -67,16 +67,16 @@ typedef struct _process_entity class exclusion { public: - int last; - int size; - int step; + size_t last; + size_t size; + size_t step; process_mem_region* region; - exclusion ( int step ) { last = size = 0; - this->step = step; - region = NULL; } + exclusion ( size_t step ) { last = size = 0; + this->step = step; + region = NULL; } ~exclusion () { free ( region ); } - int add ( LPBYTE mem_base, DWORD mem_size ); + int add ( LPBYTE mem_base, SIZE_T mem_size ); int sort_and_check (); }; @@ -105,10 +105,10 @@ class dumper process_entity* add_process_entity_to_list ( process_entity_type type ); int add_thread ( DWORD tid, HANDLE hThread ); - int add_mem_region ( LPBYTE base, DWORD size ); + int add_mem_region ( LPBYTE base, SIZE_T size ); /* break mem_region by excl_list and add add all subregions */ - int split_add_mem_region ( LPBYTE base, DWORD size ); + int split_add_mem_region ( LPBYTE base, SIZE_T size ); int add_module ( LPVOID base_address ); @@ -133,7 +133,7 @@ public: extern int deb_printf ( const char* format, ... ); -extern char* psapi_get_module_name ( HANDLE hProcess, DWORD BaseAddress ); +extern char* psapi_get_module_name ( HANDLE hProcess, LPVOID BaseAddress ); extern int parse_pe ( const char* file_name, exclusion* excl_list ); diff --git a/winsup/utils/kill.cc b/winsup/utils/kill.cc index 486d273f9..edabff321 100644 --- a/winsup/utils/kill.cc +++ b/winsup/utils/kill.cc @@ -176,8 +176,8 @@ forcekill (int pid, int sig, int wait) if (!wait || WaitForSingleObject (h, 200) != WAIT_OBJECT_0) if (sig && !TerminateProcess (h, sig << 8) && WaitForSingleObject (h, 200) != WAIT_OBJECT_0) - fprintf (stderr, "%s: couldn't kill pid %u, %lu\n", - prog_name, (unsigned) dwpid, GetLastError ()); + fprintf (stderr, "%s: couldn't kill pid %u, %u\n", + prog_name, (unsigned) dwpid, (unsigned int) GetLastError ()); CloseHandle (h); } @@ -260,13 +260,13 @@ out: if (!pid) pid = strtoll (*argv, &p, 10); if (*p != '\0' - || (!force && (pid < LONG_MIN || pid > LONG_MAX)) - || (force && (pid <= 0 || pid > ULONG_MAX))) + || (!force && (pid < INT_MIN || pid > INT_MAX)) + || (force && (pid <= 0 || pid > UINT_MAX))) { fprintf (stderr, "%s: illegal pid: %s\n", prog_name, *argv); ret = 1; } - else if (pid <= LONG_MAX && kill ((pid_t) pid, sig) == 0) + else if (pid <= INT_MAX && kill ((pid_t) pid, sig) == 0) { if (force) forcekill ((pid_t) pid, sig, 1); diff --git a/winsup/utils/ldd.cc b/winsup/utils/ldd.cc index fa771b288..de98658bc 100644 --- a/winsup/utils/ldd.cc +++ b/winsup/utils/ldd.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2009, 2010, 2011 Chris Faylor +/* Copyright (c) 2009, 2010, 2011, 2013 Chris Faylor All rights reserved. @@ -162,7 +162,8 @@ load_dll (const wchar_t *fn) wchar_t *buf = get_module_filename (GetCurrentProcess (), NULL); if (!buf) { - printf ("ldd: GetModuleFileName returned an error %lu\n", GetLastError ()); + printf ("ldd: GetModuleFileName returned an error %u\n", + (unsigned int) GetLastError ()); exit (1); /* FIXME */ } @@ -219,8 +220,9 @@ static int set_entry_point_break () { HMODULE hm; - DWORD cb; - if (!EnumProcessModules (hProcess, &hm, sizeof (hm), &cb) || !cb) + DWORD cbe; + SIZE_T cbw; + if (!EnumProcessModules (hProcess, &hm, sizeof (hm), &cbe) || !cbe) set_errno_and_return (1); MODULEINFO mi = {}; @@ -228,7 +230,7 @@ set_entry_point_break () set_errno_and_return (1); static const unsigned char int3 = 0xcc; - if (!WriteProcessMemory (hProcess, mi.EntryPoint, &int3, 1, &cb) || cb != 1) + if (!WriteProcessMemory (hProcess, mi.EntryPoint, &int3, 1, &cbw) || cbw != 1) set_errno_and_return (1); return 0; } @@ -485,13 +487,15 @@ map_file (const wchar_t *filename) } if (!(hMapping = CreateFileMapping (hFile, 0, PAGE_READONLY | SEC_COMMIT, 0, 0, 0))) { - fprintf (stderr, "CreateFileMapping failed with windows error %lu\n", GetLastError ()); + fprintf (stderr, "CreateFileMapping failed with windows error %u\n", + (unsigned int) GetLastError ()); CloseHandle (hFile); return 0; } if (!(basepointer = MapViewOfFile (hMapping, FILE_MAP_READ, 0, 0, 0))) { - fprintf (stderr, "MapViewOfFile failed with windows error %lu\n", GetLastError ()); + fprintf (stderr, "MapViewOfFile failed with windows error %u\n", + (unsigned int) GetLastError ()); CloseHandle (hMapping); CloseHandle (hFile); return 0; diff --git a/winsup/utils/locale.cc b/winsup/utils/locale.cc index be57cf161..fadf3f3da 100644 --- a/winsup/utils/locale.cc +++ b/winsup/utils/locale.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2011 Corinna Vinschen + * Copyright (c) 2010, 2011, 2012, 2013 Corinna Vinschen * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -520,7 +520,7 @@ print_lc_sepstrings (int key, const char *name, const char *value) } else { - printf ("%.*s", c - value, value); + printf ("%.*s", (int) (c - value), value); value = c + 1; } if (key) diff --git a/winsup/utils/mkgroup.c b/winsup/utils/mkgroup.c index b15c14844..05f5910b0 100644 --- a/winsup/utils/mkgroup.c +++ b/winsup/utils/mkgroup.c @@ -1,7 +1,7 @@ /* mkgroup.c: Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010, 2011, 2012 Red Hat, Inc. + 2008, 2009, 2010, 2011, 2012, 2013 Red Hat, Inc. This file is part of Cygwin. @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -62,9 +63,11 @@ _print_win_error (DWORD code, int line) code, MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) buf, sizeof (buf), NULL)) - fprintf (stderr, "mkgroup (%d): [%lu] %s", line, code, buf); + fprintf (stderr, "mkgroup (%d): [%" PRIu32 "] %s", + line, (unsigned int) code, buf); else - fprintf (stderr, "mkgroup (%d): error %lu", line, code); + fprintf (stderr, "mkgroup (%d): error %" PRIu32 , + line, (unsigned int) code); } static PWCHAR @@ -104,7 +107,7 @@ put_sid (PSID psid) strcat (s, t); for (i = 0; i < *GetSidSubAuthorityCount (psid); ++i) { - sprintf(t, "-%lu", *GetSidSubAuthority (psid, i)); + sprintf(t, "-%" PRIu32 , (unsigned int) *GetSidSubAuthority (psid, i)); strcat (s, t); } return s; @@ -164,12 +167,12 @@ current_group (const char *sep, DWORD id_offset) } gid = *GetSidSubAuthority (curr_pgrp.psid, *GetSidSubAuthorityCount(curr_pgrp.psid) - 1); - printf ("%ls%s%ls:%s:%lu:\n", + printf ("%ls%s%ls:%s:%" PRIu32 ":\n", sep ? dom : L"", sep ?: "", grp, put_sid (curr_pgrp.psid), - id_offset + gid); + (unsigned int) (id_offset + gid)); } static void @@ -225,14 +228,14 @@ enum_unix_groups (domlist_t *dom_or_machine, const char *sep, DWORD id_offset, dom, (dlen = MAX_DOMAIN_NAME_LEN + 1, &dlen), &acc_type)) - printf ("%s%s%ls:%s:%lu:\n", + printf ("%s%s%ls:%s:%" PRIu32 ":\n", with_dom ? "Unix Group" : "", with_dom ? sep : "", p, put_sid (psid), - id_offset + + (unsigned int) (id_offset + *GetSidSubAuthority (psid, - *GetSidSubAuthorityCount(psid) - 1)); + *GetSidSubAuthorityCount(psid) - 1))); } else { @@ -262,12 +265,12 @@ enum_unix_groups (domlist_t *dom_or_machine, const char *sep, DWORD id_offset, (dlen = MAX_DOMAIN_NAME_LEN + 1, &dlen), &acc_type) && !iswdigit (grp[0])) - printf ("%s%s%ls:%s:%lu:\n", + printf ("%s%s%ls:%s:%" PRIu32 ":\n", with_dom ? "Unix Group" : "", with_dom ? sep : "", grp, put_sid (psid), - id_offset + start); + (unsigned int) (id_offset + start)); } } } @@ -288,7 +291,7 @@ enum_local_groups (BOOL domain, domlist_t *dom_or_machine, const char *sep, LOCALGROUP_INFO_0 *buffer; DWORD entriesread = 0; DWORD totalentries = 0; - DWORD resume_handle = 0; + DWORD_PTR resume_handle = 0; WCHAR gname[GNLEN + 1]; DWORD rc; @@ -411,12 +414,12 @@ enum_local_groups (BOOL domain, domlist_t *dom_or_machine, const char *sep, got_curr_pgrp = TRUE; gid = *GetSidSubAuthority (psid, *GetSidSubAuthorityCount(psid) - 1); - printf ("%ls%s%ls:%s:%ld:\n", + printf ("%ls%s%ls:%s:%" PRIu32 ":\n", with_dom && !is_builtin ? domain_name : L"", with_dom && !is_builtin ? sep : "", buffer[i].lgrpi0_name, put_sid (psid), - gid + (is_builtin ? 0 : id_offset)); + (unsigned int) (gid + (is_builtin ? 0 : id_offset))); skip_group: ; } @@ -443,7 +446,7 @@ enum_groups (BOOL domain, domlist_t *dom_or_machine, const char *sep, GROUP_INFO_2 *buffer; DWORD entriesread = 0; DWORD totalentries = 0; - DWORD resume_handle = 0; + DWORD_PTR resume_handle = 0; WCHAR gname[GNLEN + 1]; DWORD rc; @@ -543,12 +546,12 @@ enum_groups (BOOL domain, domlist_t *dom_or_machine, const char *sep, else if (EqualSid (curr_pgrp.psid, psid)) got_curr_pgrp = TRUE; - printf ("%ls%s%ls:%s:%lu:\n", + printf ("%ls%s%ls:%s:%" PRIu32 ":\n", with_dom ? domain_name : L"", with_dom ? sep : "", buffer[i].grpi2_name, put_sid (psid), - id_offset + gid); + (unsigned int) (id_offset + gid)); } NetApiBufferFree (buffer); @@ -591,7 +594,8 @@ print_special_by_sid (PSID_IDENTIFIER_AUTHORITY auth, BYTE cnt, rid = sub2; else rid = sub1; - printf ("%ls:%s:%lu:\n", grp, put_sid (psid), rid); + printf ("%ls:%s:%" PRIu32 ":\n", grp, put_sid (psid), + (unsigned int) rid); } FreeSid (psid); } @@ -797,7 +801,7 @@ main (int argc, char **argv) } if (!(domlist[print_domlist].str = opt)) print_system = 1; - domlist[print_domlist].id_offset = ULONG_MAX; + domlist[print_domlist].id_offset = UINT32_MAX; if (opt && (p = strchr (opt, ','))) { if (p == opt @@ -884,7 +888,7 @@ skip: for (i = 0; i < print_domlist; ++i) { DWORD my_off = (domlist[i].domain || domlist[i].str) - ? domlist[i].id_offset != ULONG_MAX + ? domlist[i].id_offset != UINT_MAX ? domlist[i].id_offset : off : 0; if (!enum_local_groups (domlist[i].domain, domlist + i, sep_char, my_off, disp_groupname, print_builtin, print_current)) diff --git a/winsup/utils/mkpasswd.c b/winsup/utils/mkpasswd.c index c16c86892..d080dbd70 100644 --- a/winsup/utils/mkpasswd.c +++ b/winsup/utils/mkpasswd.c @@ -1,7 +1,7 @@ /* mkpasswd.c: Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2008, 2009, - 2010, 2011, 2012 Red Hat, Inc. + 2010, 2011, 2012, 2013 Red Hat, Inc. This file is part of Cygwin. @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -62,9 +63,11 @@ _print_win_error(DWORD code, int line) code, MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) buf, sizeof (buf), NULL)) - fprintf (stderr, "mkpasswd (%d): [%lu] %s", line, code, buf); + fprintf (stderr, "mkpasswd (%d): [%" PRIu32 "] %s", + line, (unsigned int) code, buf); else - fprintf (stderr, "mkpasswd (%d): error %lu", line, code); + fprintf (stderr, "mkpasswd (%d): error %" PRIu32, + line, (unsigned int) code); } static PWCHAR @@ -104,7 +107,7 @@ put_sid (PSID sid) strcat (s, t); for (i = 0; i < *GetSidSubAuthorityCount (sid); ++i) { - sprintf(t, "-%lu", *GetSidSubAuthority (sid, i)); + sprintf(t, "-%" PRIu32, (unsigned int) *GetSidSubAuthority (sid, i)); strcat (s, t); } return s; @@ -192,12 +195,13 @@ current_user (const char *sep, const char *passed_home_path, DWORD id_offset, homedir_psx[PATH_MAX - 1] = '\0'; } - printf ("%ls%s%ls:unused:%lu:%lu:U-%ls\\%ls,%s:%s:/bin/bash\n", + printf ("%ls%s%ls:unused:%" PRIu32 ":%" PRIu32 + ":U-%ls\\%ls,%s:%s:/bin/bash\n", sep ? dom : L"", sep ?: "", user, - id_offset + uid, - id_offset + gid, + (unsigned int) (id_offset + uid), + (unsigned int) (id_offset + gid), dom, user, put_sid (curr_user.psid), @@ -257,13 +261,13 @@ enum_unix_users (domlist_t *dom_or_machine, const char *sep, DWORD id_offset, dom, (dlen = MAX_DOMAIN_NAME_LEN + 1, &dlen), &acc_type)) - printf ("%s%s%ls:unused:%lu:99999:,%s::\n", + printf ("%s%s%ls:unused:%" PRIu32 ":99999:,%s::\n", with_dom ? "Unix User" : "", with_dom ? sep : "", user + 10, - id_offset + + (unsigned int) (id_offset + *GetSidSubAuthority (psid, - *GetSidSubAuthorityCount(psid) - 1), + *GetSidSubAuthorityCount(psid) - 1)), put_sid (psid)); } else @@ -294,11 +298,11 @@ enum_unix_users (domlist_t *dom_or_machine, const char *sep, DWORD id_offset, (dlen = MAX_DOMAIN_NAME_LEN + 1, &dlen), &acc_type) && !iswdigit (user[0])) - printf ("%s%s%ls:unused:%lu:99999:,%s::\n", + printf ("%s%s%ls:unused:%" PRIu32 ":99999:,%s::\n", with_dom ? "Unix User" : "", with_dom ? sep : "", user, - id_offset + start, + (unsigned int) (id_offset + start), put_sid (psid)); } } @@ -435,12 +439,13 @@ enum_users (BOOL domain, domlist_t *dom_or_machine, const char *sep, else if (EqualSid (curr_user.psid, psid)) got_curr_user = TRUE; - printf ("%ls%s%ls:unused:%lu:%lu:%ls%sU-%ls\\%ls,%s:%s:/bin/bash\n", + printf ("%ls%s%ls:unused:%" PRIu32 ":%" PRIu32 + ":%ls%sU-%ls\\%ls,%s:%s:/bin/bash\n", with_dom ? domain_name : L"", with_dom ? sep : "", buffer[i].usri3_name, - id_offset + uid, - id_offset + gid, + (unsigned int) (id_offset + uid), + (unsigned int) (id_offset + gid), buffer[i].usri3_full_name ?: L"", buffer[i].usri3_full_name && buffer[i].usri3_full_name[0] ? "," : "", @@ -473,7 +478,7 @@ print_special_by_sid (PSID_IDENTIFIER_AUTHORITY auth, BYTE cnt, { if (LookupAccountSidW (NULL, sid, user, (len = UNLEN + 1, &len), - dom, (len2 = MAX_DOMAIN_NAME_LEN + 1, &len), + dom, (len2 = MAX_DOMAIN_NAME_LEN + 1, &len2), &acc_type)) { if (sub8) @@ -492,8 +497,9 @@ print_special_by_sid (PSID_IDENTIFIER_AUTHORITY auth, BYTE cnt, rid = sub2; else rid = sub1; - printf ("%ls:*:%lu:%lu:,%s::\n", - user, rid, rid == 18 ? 544 : rid, /* SYSTEM hack */ + printf ("%ls:*:%" PRIu32 ":%" PRIu32 ":,%s::\n", + user, (unsigned int) rid, + (unsigned int) (rid == 18 ? 544 : rid), /* SYSTEM hack */ put_sid (sid)); } FreeSid (sid); @@ -718,7 +724,7 @@ main (int argc, char **argv) goto skip; } domlist[print_domlist].str = opt; - domlist[print_domlist].id_offset = ULONG_MAX; + domlist[print_domlist].id_offset = UINT32_MAX; if (opt && (p = strchr (opt, ','))) { if (p == opt @@ -812,7 +818,7 @@ skip: for (i = 0; i < print_domlist; ++i) { DWORD my_off = (domlist[i].domain || domlist[i].str) - ? domlist[i].id_offset != ULONG_MAX + ? domlist[i].id_offset != UINT_MAX ? domlist[i].id_offset : off : 0; if (!domlist[i].domain && domlist[i].str && print_unix) enum_unix_users (domlist + i, sep_char, my_off, print_unix); diff --git a/winsup/utils/module_info.cc b/winsup/utils/module_info.cc index 8137991ca..12e74de39 100644 --- a/winsup/utils/module_info.cc +++ b/winsup/utils/module_info.cc @@ -1,6 +1,6 @@ /* module_info.cc - Copyright 1999, 2000, 2001, 2010 Red Hat, Inc. + Copyright 1999, 2000, 2001, 2010, 2013 Red Hat, Inc. Written by Egor Duda @@ -33,7 +33,7 @@ static tf_GetModuleFileNameExA *psapi_GetModuleFileNameExA = NULL; Uses psapi.dll. */ char * -psapi_get_module_name (HANDLE hProcess, DWORD BaseAddress) +psapi_get_module_name (HANDLE hProcess, LPVOID BaseAddress) { DWORD len; MODULEINFO mi; @@ -103,7 +103,7 @@ psapi_get_module_name (HANDLE hProcess, DWORD BaseAddress) goto failed; } - if ((DWORD) (mi.lpBaseOfDll) == BaseAddress) + if (mi.lpBaseOfDll == BaseAddress) { free (DllHandle); return strdup (name_buf); diff --git a/winsup/utils/mount.cc b/winsup/utils/mount.cc index 1a3add147..650266d3f 100644 --- a/winsup/utils/mount.cc +++ b/winsup/utils/mount.cc @@ -1,7 +1,7 @@ /* mount.cc Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011 Red Hat, Inc. + 2007, 2008, 2009, 2010, 2011, 2013 Red Hat, Inc. This file is part of Cygwin. @@ -22,9 +22,6 @@ details. */ #include #include "path.h" -#ifdef errno -#undef errno -#endif #include #define NT_MAX_PATH 32768 @@ -104,7 +101,7 @@ do_mount (const char *dev, const char *where, int flags) fprintf (stderr, "%s: defaulting to 'notexec' mount option for speed since native path\n" "%*creferences a remote share. Use '-f' option to override.\n", - progname, strlen(progname) + 2, ' '); + progname, (int) strlen(progname) + 2, ' '); flags |= MOUNT_NOTEXEC; } } diff --git a/winsup/utils/parse_pe.cc b/winsup/utils/parse_pe.cc index 30043f6a6..c3ae7bb11 100644 --- a/winsup/utils/parse_pe.cc +++ b/winsup/utils/parse_pe.cc @@ -1,6 +1,6 @@ /* parse_pe.cc - Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2012 Red Hat, Inc. + Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2012, 2013 Red Hat, Inc. Written by Egor Duda @@ -28,7 +28,7 @@ #include "dumper.h" int -exclusion::add (LPBYTE mem_base, DWORD mem_size) +exclusion::add (LPBYTE mem_base, SIZE_T mem_size) { while (last >= size) size += step; @@ -62,7 +62,7 @@ exclusion::sort_and_check () continue; if (p->base + size > q->base) { - fprintf (stderr, "region error @ (%8p + %d) > %8p\n", p->base, size, q->base); + fprintf (stderr, "region error @ (%p + %zd) > %p\n", p->base, size, q->base); return 0; } } @@ -77,7 +77,7 @@ select_data_section (bfd * abfd, asection * sect, PTR obj) if ((sect->flags & (SEC_CODE | SEC_DEBUGGING)) && sect->vma && bfd_get_section_size (sect)) { - excl_list->add ((LPBYTE) sect->vma, (DWORD) bfd_get_section_size (sect)); + excl_list->add ((LPBYTE) sect->vma, (SIZE_T) bfd_get_section_size (sect)); deb_printf ("excluding section: %20s %08lx\n", sect->name, bfd_get_section_size (sect)); } diff --git a/winsup/utils/passwd.c b/winsup/utils/passwd.c index 59a2d73ff..ea3e2d159 100644 --- a/winsup/utils/passwd.c +++ b/winsup/utils/passwd.c @@ -1,7 +1,7 @@ /* passwd.c: Changing passwords and managing account information - Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2008, 2009, 2011, 2012 Red - Hat, Inc. + Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2008, 2009, 2011, 2012, + 2013 Red Hat, Inc. Written by Corinna Vinschen @@ -22,6 +22,7 @@ details. */ #include #include #include +#include #include #include #include @@ -203,14 +204,14 @@ PrintPW (PUSER_INFO_3 ui, LPCWSTR server) if (ui->usri3_priv == USER_PRIV_ADMIN) mi->usrmod0_min_passwd_len = 0; printf ("\nSystem password settings:\n"); - printf ("Max. password age %ld days\n", - mi->usrmod0_max_passwd_age / ONE_DAY); - printf ("Min. password age %ld days\n", - mi->usrmod0_min_passwd_age / ONE_DAY); - printf ("Force logout after %ld days\n", - mi->usrmod0_force_logoff / ONE_DAY); - printf ("Min. password length: %ld\n", - mi->usrmod0_min_passwd_len); + printf ("Max. password age %" PRIu32 " days\n", + (unsigned int) (mi->usrmod0_max_passwd_age / ONE_DAY)); + printf ("Min. password age %" PRIu32 " days\n", + (unsigned int) (mi->usrmod0_min_passwd_age / ONE_DAY)); + printf ("Force logout after %" PRIu32 " days\n", + (unsigned int) (mi->usrmod0_force_logoff / ONE_DAY)); + printf ("Min. password length: %" PRIu32 "\n", + (unsigned int) mi->usrmod0_min_passwd_len); } } diff --git a/winsup/utils/path.cc b/winsup/utils/path.cc index 8c17dce14..a66dcdc14 100644 --- a/winsup/utils/path.cc +++ b/winsup/utils/path.cc @@ -1,7 +1,7 @@ /* path.cc - Copyright 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 - Red Hat, Inc. + Copyright 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, + 2013 Red Hat, Inc. This file is part of Cygwin. @@ -25,6 +25,7 @@ details. */ #include "path.h" #include "../cygwin/include/cygwin/version.h" #include "../cygwin/include/sys/mount.h" +#define _NOMNTENT_MACROS #include "../cygwin/include/mntent.h" #include "testsuite.h" #ifdef FSTAB_ONLY @@ -841,7 +842,7 @@ vcygpath (const char *cwd, const char *s, va_list v) if (n < max_len || !path_prefix_p (m->posix, path, n)) continue; if ((m->flags & MOUNT_CYGDRIVE) - && (strlen (path) < n + 2 + && ((int) strlen (path) < n + 2 || path[n] != '/' || !isalpha (path[n + 1]) || path[n + 2] != '/')) @@ -917,7 +918,8 @@ getmntent (FILE *) if (!mnt.mnt_opts) mnt.mnt_opts = (char *) malloc (64); - strcpy (mnt.mnt_type, (char *) (m->flags & MOUNT_SYSTEM) ? "system" : "user"); + strcpy (mnt.mnt_type, + (char *) ((m->flags & MOUNT_SYSTEM) ? "system" : "user")); if (!(m->flags & MOUNT_BINARY)) strcpy (mnt.mnt_opts, (char *) "text"); diff --git a/winsup/utils/ps.cc b/winsup/utils/ps.cc index ca874a191..952b63ee3 100644 --- a/winsup/utils/ps.cc +++ b/winsup/utils/ps.cc @@ -149,7 +149,8 @@ int main (int argc, char *argv[]) { external_pinfo *p; - int aflag, lflag, fflag, sflag, uid, proc_id; + int aflag, lflag, fflag, sflag, proc_id; + uid_t uid; bool found_proc_id = true; DWORD proc_access = PROCESS_QUERY_LIMITED_INFORMATION; cygwin_getinfo_types query = CW_GETPINFO; @@ -294,7 +295,7 @@ main (int argc, char *argv[]) /* nothing to do */; else if (p->version >= EXTERNAL_PINFO_VERSION_32_BIT) { - if (p->uid32 != (__uid32_t) uid) + if (p->uid32 != uid) continue; } else if (p->uid != uid) diff --git a/winsup/utils/regtool.cc b/winsup/utils/regtool.cc index 5a4244e3e..86f2bb61f 100644 --- a/winsup/utils/regtool.cc +++ b/winsup/utils/regtool.cc @@ -190,7 +190,7 @@ print_version () } void -Fail (DWORD rv) +Fail (unsigned int rv) { char *buf; if (!quiet) @@ -198,7 +198,7 @@ Fail (DWORD rv) FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, 0, rv, 0, (CHAR *) & buf, 0, 0); - fprintf (stderr, "Error (%ld): %s\n", rv, buf); + fprintf (stderr, "Error (%d): %s\n", rv, buf); LocalFree (buf); } exit (1); @@ -512,8 +512,8 @@ cmd_list () printf ("\n"); break; case REG_DWORD: - printf ("0x%08lx (%lu)\n", *(DWORD *) value_data, - *(DWORD *) value_data); + printf ("0x%08x (%u)\n", *(unsigned int *) value_data, + *(unsigned int *) value_data); break; case REG_DWORD_BIG_ENDIAN: v = ((value_data[0] << 24) @@ -773,14 +773,14 @@ cmd_get () fwrite (data, dsize, 1, stdout); break; case REG_DWORD: - printf (hex ? "0x%08lx\n" : "%lu\n", *(DWORD *) data); + printf (hex ? "0x%08x\n" : "%u\n", *(unsigned int *) data); break; case REG_DWORD_BIG_ENDIAN: rv = ((data[0] << 24) | (data[1] << 16) | (data[2] << 8) | (data[3])); - printf (hex ? "0x%08lx\n" : "%lu\n", rv); + printf (hex ? "0x%08x\n" : "%u\n", (unsigned int) rv); break; case REG_QWORD: printf (hex ? "0x%016llx\n" : "%llu\n", *(unsigned long long *) data); diff --git a/winsup/utils/ssp.c b/winsup/utils/ssp.c index 63aa9197e..3136a9f66 100644 --- a/winsup/utils/ssp.c +++ b/winsup/utils/ssp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, 2002, 2009, 2011 Red Hat, Inc. + * Copyright (c) 2000, 2001, 2002, 2009, 2011, 2013 Red Hat, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -13,6 +13,20 @@ * */ +#ifdef __x86_64__ + +#include + +int +main (int argc, char **argv) +{ + fprintf (stderr, "%s: This application is unsuported on x86_64 so far.\n", + argv[0]); + return 1; +} + +#else + #include #include #include @@ -939,3 +953,4 @@ main (int argc, char **argv) exit (0); } +#endif /* !__x86_64 */ diff --git a/winsup/utils/strace.cc b/winsup/utils/strace.cc index 62d408601..73096ab3b 100644 --- a/winsup/utils/strace.cc +++ b/winsup/utils/strace.cc @@ -1,7 +1,7 @@ /* strace.cc Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010, 2011 Red Hat Inc. + 2009, 2010, 2011, 2012, 2013 Red Hat Inc. Written by Chris Faylor @@ -265,7 +265,7 @@ ctrl_c (DWORD) } extern "C" { -unsigned long (*cygwin_internal) (int, ...); +uintptr_t (*cygwin_internal) (int, ...); WCHAR cygwin_dll_path[32768]; }; @@ -286,7 +286,7 @@ load_cygwin () return 0; } GetModuleFileNameW (h, cygwin_dll_path, 32768); - if (!(cygwin_internal = (DWORD (*) (int, ...)) GetProcAddress (h, "cygwin_internal"))) + if (!(cygwin_internal = (uintptr_t (*) (int, ...)) GetProcAddress (h, "cygwin_internal"))) { errno = ENOSYS; return 0; @@ -437,7 +437,7 @@ handle_output_debug_string (DWORD id, LPVOID p, unsigned mask, FILE *ofile) int len; int special; char alen[3 + 8 + 1]; - DWORD nbytes; + SIZE_T nbytes; child_list *child = get_child (id); if (!child) error (0, "no process id %d found", id); @@ -482,7 +482,11 @@ handle_output_debug_string (DWORD id, LPVOID p, unsigned mask, FILE *ofile) buf[len] = '\0'; char *s = strtok (buf, " "); +#ifdef __x86_64__ + unsigned long long n = strtoull (s, NULL, 16); +#else unsigned long n = strtoul (s, NULL, 16); +#endif s = strchr (s, '\0') + 1; @@ -619,7 +623,11 @@ handle_output_debug_string (DWORD id, LPVOID p, unsigned mask, FILE *ofile) if (include_hex) { s -= 8; - sprintf (s, "%p", (void *) n); +#ifdef __x86_64__ + sprintf (s, "%012I64x", n); +#else + sprintf (s, "%08lx", n); +#endif strchr (s, '\0')[0] = ' '; } child->last_usecs = usecs; @@ -691,8 +699,9 @@ proc_child (unsigned mask, FILE *ofile, pid_t pid) { status = DBG_EXCEPTION_NOT_HANDLED; if (ev.u.Exception.dwFirstChance) - fprintf (ofile, "--- Process %lu, exception %p at %p\n", ev.dwProcessId, - (void *) ev.u.Exception.ExceptionRecord.ExceptionCode, + fprintf (ofile, "--- Process %lu, exception %08lx at %p\n", + ev.dwProcessId, + ev.u.Exception.ExceptionRecord.ExceptionCode, ev.u.Exception.ExceptionRecord.ExceptionAddress); } break; @@ -966,7 +975,7 @@ main (int argc, char **argv) if (load_cygwin ()) { char **av = (char **) cygwin_internal (CW_ARGV); - if (av && (DWORD) av != (DWORD) -1) + if (av && (uintptr_t) av != (uintptr_t) -1) for (argc = 0, argv = av; *av; av++) argc++; } diff --git a/winsup/utils/tzset.c b/winsup/utils/tzset.c index a3abe315e..45f3f1655 100644 --- a/winsup/utils/tzset.c +++ b/winsup/utils/tzset.c @@ -1,6 +1,6 @@ /* tzset.c: Convert current Windows timezone to POSIX timezone information. - Copyright 2012 Red Hat, Inc. + Copyright 2012, 2013 Red Hat, Inc. This file is part of Cygwin. @@ -10,6 +10,7 @@ details. */ #include #include +#include #include #include #include @@ -518,8 +519,8 @@ reg_open (HKEY pkey, PCWSTR path, const char *msg) if (ret == ERROR_SUCCESS) return hkey; if (msg) - fprintf (stderr, "%s: cannot open registry %s, error code %ld\n", - program_invocation_short_name, msg, ret); + fprintf (stderr, "%s: cannot open registry %s, error code %" PRIu32 "\n", + program_invocation_short_name, msg, (unsigned int) ret); return NULL; } @@ -536,8 +537,8 @@ reg_query (HKEY hkey, PCWSTR value, PWCHAR buf, DWORD size, const char *msg) if (ret == ERROR_SUCCESS) return TRUE; if (msg) - fprintf (stderr, "%s: cannot query registry %s, error code %ld\n", - program_invocation_short_name, msg, ret); + fprintf (stderr, "%s: cannot query registry %s, error code %" PRIu32 "\n", + program_invocation_short_name, msg, (unsigned int) ret); return FALSE; } @@ -709,10 +710,12 @@ main (int argc, char **argv) } idx = gotit; } - /* Got one. Print it. */ - spc = wcschr (tzmap[idx].posix_tzid, ' '); - if (spc) - *spc = L'\0'; - printf ("%ls\n", tzmap[idx].posix_tzid); + /* Got one. Print it. + Note: The tzmap array is in the R/O data section on x86_64. Don't + try to overwrite the space, as the code did originally. */ + spc = wcschr (tzmap[idx].posix_tzid, L' '); + if (!spc) + spc = wcschr (tzmap[idx].posix_tzid, L'\0'); + printf ("%.*ls\n", (int) (spc - tzmap[idx].posix_tzid), tzmap[idx].posix_tzid); return 0; } -- cgit v1.2.3