@Override
    public void daemonize(RehashServerOnSIGHUP callback) throws UnsupportedOperationException {
      UnsupportedOperationException err = null;
      try {
        setsid();
      } catch (LastErrorException le) {
        // errno=EPERM indicates already group leader
        if (le.getErrorCode() != EPERM) {
          err = new UnsupportedOperationException("Failed in setsid() in daemonize() due to "
              + le.getMessage() + " (errno=" + le.getErrorCode() + ')');
        }
      }
      // set umask to something consistent for servers
      @SuppressWarnings("OctalInteger")
      final int newMask = 022;
      int oldMask = umask(newMask);
      // check if old umask was more restrictive, and if so then set it back
      @SuppressWarnings("OctalInteger")
      final int OCTAL_077 = 077;
      if ((oldMask & OCTAL_077) > newMask) {
        umask(oldMask);
      }
      // catch the SIGHUP signal and invoke any callback provided
      rehashCallback = callback;
      hupHandler = signum -> {
        // invoke the rehash function if provided
        final RehashServerOnSIGHUP rehashCb = rehashCallback;
        if (signum == Signal.SIGHUP.getNumber() && rehashCb != null) {
          rehashCb.rehash();
        }
      };
      signal(Signal.SIGHUP.getNumber(), hupHandler);
      // ignore SIGCHLD and SIGINT
      signal(Signal.SIGCHLD.getNumber(), hupHandler);
      signal(Signal.SIGINT.getNumber(), hupHandler);
      if (err != null) {
        throw err;
      }
    }
holds a reference of {@link SignalHandler} installed in {@link #daemonize} for SIGHUP to
avoid it being GCed. Assumes that the NativeCalls instance itself is a singleton and never
GCed.
geode-core/src/main/java/org/apache/geode/internal/shared/NativeCallsJNAImpl.java