#!/usr/bin/env python2
import fcntl
import tempfile
import struct
import errno

F_OFD_SETLK = 37

try:
	with tempfile.TemporaryFile() as fd:
		flock = struct.pack('hhllhh', fcntl.F_RDLCK, 0, 0, 0, 0, 0)
		fcntl.fcntl(fd.fileno(), F_OFD_SETLK, flock)
except IOError as e:
	if e.errno == errno.EINVAL:
		print "I/O error({0}): {1}".format(e.errno, e.strerror)
		print "OFD locks are not supported."
		exit(1)

exit(0)
