Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8021771

warning: stat64 is deprecated - when building on OSX 10.7.5

    Details

    • Subcomponent:
      svc
    • Introduced In Build:
      b43
    • Introduced In Version:
    • Resolved In Build:
      b46
    • OS:
      os_x
    • Verification:
      Not verified

      Backports

        Description

        Kris Mok reports:

        I'm building a freshly cloned repo from the tip of hotspot-comp on Mac OS X
        10.7.5, and got and error:

        llvm-g++ -D_ALLBSD_SOURCE -D_GNU_SOURCE -DAMD64 -DASSERT -I.
        -I/Users/rednaxelafx/build/hotspot-comp/hotspot/src/share/vm/prims
        -I/Users/rednaxelafx/build/hotspot-comp/hotspot/src/share/vm
        -I/Users/rednaxelafx/build/hotspot-comp/hotspot/src/share/vm/precompiled
        -I/Users/rednaxelafx/build/hotspot-comp/hotspot/src/cpu/x86/vm
        -I/Users/rednaxelafx/build/hotspot-comp/hotspot/src/os_cpu/bsd_x86/vm
        -I/Users/rednaxelafx/build/hotspot-comp/hotspot/src/os/bsd/vm
        -I/Users/rednaxelafx/build/hotspot-comp/hotspot/src/os/posix/vm
        -I../generated -DHOTSPOT_RELEASE_VERSION="\"25.0-b44-internal\""
        -DHOTSPOT_BUILD_TARGET="\"fastdebug\""
        -DHOTSPOT_BUILD_USER="\"rednaxelafx\"" -DHOTSPOT_LIB_ARCH=\"amd64\"
        -DHOTSPOT_VM_DISTRO="\"OpenJDK\"" -DTARGET_OS_FAMILY_bsd -DTARGET_ARCH_x86
        -DTARGET_ARCH_MODEL_x86_64 -DTARGET_OS_ARCH_bsd_x86
        -DTARGET_OS_ARCH_MODEL_bsd_x86_64 -DTARGET_COMPILER_gcc -DCOMPILER2
        -DCOMPILER1 -fPIC -fno-rtti -fno-exceptions -pthread -fcheck-new -m64
         -pipe -fno-strict-aliasing -DMAC_OS_X_VERSION_MAX_ALLOWED=1070
        -mmacosx-version-min=10.7.0 -Os -DVM_LITTLE_ENDIAN -D_LP64=1
        -fno-omit-frame-pointer -Werror -Wunused-function -DDTRACE_ENABLED
         -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -DALLOW_OPERATOR_NEW_USAGE -c -MMD -MP
        -MF ../generated/dependencies/attachListener_bsd.o.d -fpch-deps -o
        attachListener_bsd.o
        /Users/rednaxelafx/build/hotspot-comp/hotspot/src/os/bsd/vm/attachListener_bsd.cpp
        cc1plus: warnings being treated as errors
        /Users/rednaxelafx/build/hotspot-comp/hotspot/src/os/bsd/vm/attachListener_bsd.cpp:
        In static member function ‘static void AttachListener::vm_start()’:
        /Users/rednaxelafx/build/hotspot-comp/hotspot/src/os/bsd/vm/attachListener_bsd.cpp:455:
        warning: ‘stat64’ is deprecated (declared at /usr/include/sys/stat.h:466)
        /Users/rednaxelafx/build/hotspot-comp/hotspot/src/os/bsd/vm/attachListener_bsd.cpp:455:
        warning: ‘stat64’ is deprecated (declared at /usr/include/sys/stat.h:466)
        make[6]: *** [attachListener_bsd.o] Error 1

        The problem came from a recent commit [1]:
        7162400: Intermittent java.io.IOException: Bad file number during
        HotSpotVirtualMachine.executeCommand

        According to [2], the *-64 variants of the stat*() functions have been
        deprecated on Mac OS X and should be avoided.

        The fix is simple:
        diff -r d90d1b96b65b src/os/bsd/vm/attachListener_bsd.cpp
        --- a/src/os/bsd/vm/attachListener_bsd.cpp Fri Jul 26 12:37:39 2013 -0700
        +++ b/src/os/bsd/vm/attachListener_bsd.cpp Sun Jul 28 15:55:54 2013 +0800
        @@ -445,14 +445,14 @@

         void AttachListener::vm_start() {
           char fn[UNIX_PATH_MAX];
        - struct stat64 st;
        + struct stat st;
           int ret;

           int n = snprintf(fn, UNIX_PATH_MAX, "%s/.java_pid%d",
                    os::get_temp_directory(), os::current_process_id());
           assert(n < (int)UNIX_PATH_MAX, "java_pid file name buffer overflow");

        - RESTARTABLE(::stat64(fn, &st), ret);
        + RESTARTABLE(::stat(fn, &st), ret);
           if (ret == 0) {
             ret = ::unlink(fn);
             if (ret == -1) {

        I'm not sure if this should be done for all BSD platforms. Could anybody
        help confirm this?

        Thanks,
        Kris

        (P.S. recovering from bad health...)

        [1]: http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/2e8f19c2feef
        [2]:
        https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/stat64.2.html

          Issue Links

            Activity

            Hide
            dholmes David Holmes added a comment - - edited
            No warning is seen when building on OSX 10.7 so this seems likely to be a new warning. As we will be moving to builds on 10.8 very soon this issue will need to be addressed.
            Show
            dholmes David Holmes added a comment - - edited No warning is seen when building on OSX 10.7 so this seems likely to be a new warning. As we will be moving to builds on 10.8 very soon this issue will need to be addressed.
            Hide
            dholmes David Holmes added a comment -
            Kris adds:

            By the way, my build environment that had this problem was:
            Mac OS X 10.7.5,
            XCode 4.1
            i686-apple-darwin11-llvm-g++-4.2
            Show
            dholmes David Holmes added a comment - Kris adds: By the way, my build environment that had this problem was: Mac OS X 10.7.5, XCode 4.1 i686-apple-darwin11-llvm-g++-4.2
            Hide
            dholmes David Holmes added a comment -
            Impact High - build failure, can't continue
            Likelihood Medium - many dev engineers are now hitting this on their OSX systems
            Workaround medium - requires patching source files directly

            HMM => P2
            Show
            dholmes David Holmes added a comment - Impact High - build failure, can't continue Likelihood Medium - many dev engineers are now hitting this on their OSX systems Workaround medium - requires patching source files directly HMM => P2
            Hide
            dsamersoff Dmitry Samersoff added a comment -
            All *BSD used to live without stat64.
            Show
            dsamersoff Dmitry Samersoff added a comment - All *BSD used to live without stat64.
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/195ff07bc7f6
            User: dsamersoff
            Date: 2013-08-07 17:24:16 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/195ff07bc7f6 User: dsamersoff Date: 2013-08-07 17:24:16 +0000
            Hide
            hgupdate HG Updates added a comment -
            URL: http://hg.openjdk.java.net/hsx/hsx25/hotspot/rev/195ff07bc7f6
            User: amurillo
            Date: 2013-08-16 14:58:16 +0000
            Show
            hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/hsx/hsx25/hotspot/rev/195ff07bc7f6 User: amurillo Date: 2013-08-16 14:58:16 +0000

              People

              • Assignee:
                dsamersoff Dmitry Samersoff
                Reporter:
                dholmes David Holmes
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: