开发者

When will fcntl in solaris return a value less then -1 for F_SETLKW

Fromt he Mannul of fcntl in solaris, Upon successful completion, value returned for F_SETLKW will be "Value other than -1". But Apache httpd 1.3.41 source code (http_main.c) check if the returned 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 "
              开发者_如何学Python  "your lock file on a local disk!");
    clean_child_exit(APEXIT_CHILDFATAL);
}

In very rare case, apache in one of our system will exit beacuse of this failed test. I suspect this was caused by a negative value less than -1 returned by fcntl.

So when will fcntl in solaris return a value less than -1?


  1. in your code sample, fcntl returns <0 (e.g. -1 you know) means might have errors if errno was not EINTR, and if errno == EINTR (interrupted), it is not an error, just suggest retrying again.
  2. "Fromt he Mannul of fcntl in solaris, Upon successful completion, value returned for F_SETLKW will be Value other than -1", meant returns 0 or >0 when success, ">=0" is a value other than -1, not <-1 as you guessed.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜