I ran in a problem with error message on openindiana:<br /><br />fcntl: Invalid argument<br /><br />I wrot  short test program:<br /><br />#include <sys/file.h><br />#include <stdio.h><br />#include <stdlib.h><br />#include <fcntl.h><br /><br /><br />int main() {<br />    struct flock64 l;<br />    FILE *fp;<br /><br />    l.l_whence = SEEK_SET;<br />    l.l_start = 0;<br />    l.l_len = 0;<br />    l.l_sysid = 0;<br />    l.l_pid = 0;<br /><br />    fp = fopen("flocktest.c", "r");<br />    if (fp == NULL) {<br />        perror("fopen");<br />        exit(1);<br />    }<br />    l.l_type = F_UNLCK;<br />    if (fcntl(fileno(fp), F_FLOCK, &l) != 0) {<br />        perror("fcntl");<br />        exit(1);<br />    }<br />    printf("flocktest.c locked\n");<br />    return 0;<br />}<br /><br />This compiles on Openindiana without an error, but if it runs throws the error: Invalid argument (os error 22)<br /><br />If I copy this on Openindiana compiled code to Smartos it runs correctly.<br /><br />OI illumos version:<br />SunOS oi-sr 5.11 illumos-2ee1ed1ec5 i86pc i386 i86pc<br />Which is:<br />git show 2ee1ed1ec5<br />commit 2ee1ed1ec5dfdf07d2c92db58b11f630de2a6e87<br />Author: Dan McDonald <danmcd@joyent.com><br />Date:   Tue Sep 12 17:38:28 2017 -0400<br /><br />Smartos illumos version:<br />SunOS smartos 5.11 joyent_20171026T003127Z i86pc i386 i86pc<br /><br />The libc shows on both the same versions:<br /><br />$ elfdump -v /lib/libc.so.1<br /><br />Version Definition Section:  .SUNW_version<br />     index  version                     dependency<br />       [1]  libc.so.1                                        [ BASE ]<br />       [2]  ILLUMOS_0.24                ILLUMOS_0.23         <br />       [3]  ILLUMOS_0.23                ILLUMOS_0.22         <br />..8<..<br /><br />The error message points out that the problem is in kernel.<br /><br />How can I get running the fcntl flock code on Openindiana? <br />The kernel builds seems to be nearly the same, but not exactly. The F_FLOCK stuff was added much earlier.<br />-- <br signature="separator" />Carsten<br /><br />