On 11/13/17 11:42 AM, Carsten Grzemba wrote:
I ran in a problem with error message on openindiana:

fcntl: Invalid argument

I wrot short test program:

#include <sys/file.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>


int main() {
  struct flock64 l;
  FILE *fp;

  l.l_whence = SEEK_SET;
  l.l_start = 0;
  l.l_len = 0;
  l.l_sysid = 0;
  l.l_pid = 0;

  fp = fopen("flocktest.c", "r");
  if (fp == NULL) {
  perror("fopen");
  exit(1);
  }
  l.l_type = F_UNLCK;
  if (fcntl(fileno(fp), F_FLOCK, &l) != 0) {
  perror("fcntl");
  exit(1);
  }
  printf("flocktest.c locked\n");
  return 0;
}

This compiles on Openindiana without an error, but if it runs throws the error: 
Invalid argument (os error 22)


Works for me.

$ ./flocktest
flocktest.c locked

Running illumos-cbe94e1756  (November, 3rd).
--
Best regards,
Alexander Pyhalov,
system administrator of Southern Federal University IT department

_______________________________________________
oi-dev mailing list
oi-dev@openindiana.org
https://openindiana.org/mailman/listinfo/oi-dev

Reply via email to