Fromt he Mannul of fcntl in solaris, Upon effective completion, value came back for F_SETLKW is going to be "Value apart from -1". But Apache httpd 1.3.41 source code (http_primary.c) see if the came back value is positive like:

int ret;

while ((ret = fcntl(lock_fd, F_SETLKW, &unlock_it)) < 0 && errno == EINTR) {
    /* nop */
}

if (ret < 0) {
    ap_log_error(APLOG_MARK, APLOG_EMERG, server_conf,
                "fcntl: F_SETLKW: Error getting accept lock, exiting!  "
                "Perhaps you need to use the LockFile directive to place "
                "your lock file on a local disk!");
    clean_child_exit(APEXIT_CHILDFATAL);
}

In unusual situation, apache in our system will exit beacuse of the unsuccessful test. I suspect it was triggered by an adverse value under -1 came back by fcntl.

Then when will fcntl in solaris return something under -1?

  1. inside your code sample, fcntl returns <0 (e.g. -1 you realize) means may have errors if errno wasn't EINTR, and when errno == EINTR (interrupted), it's not a mistake, just suggest retrying again.
  2. "Fromt he Mannul of fcntl in solaris, Upon effective completion, value came back for F_SETLKW is going to be Value apart from -1", meant returns or >0 when success, ">=" is really a value apart from -1, not <-1 while you suspected.