Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem while using fcntl

SOLVED
Go to solution
N/A

Problem while using fcntl

Hi,

I am facing some problem while using fcntl crtl call in my program.

***********************************************
Program:

void main()
{

int fd, rc;
struct flock lockdetails;
fd = open ("TEST.DAT", O_CREAT|O_RDWR, 0777);
if (fd == -1)
perror("fopen");
memset(&lockdetails, 0, sizeof(lockdetails));
lockdetails.l_type = F_WRLCK;
lockdetails.l_whence = SEEK_SET;
lockdetails.l_start = 0;
lockdetails.l_len = 0;

rc = fcntl(fd, F_SETLKW, &lockdetails);
if (rc == -1)
perror("fcntl");
close(fd);
}

***********************************************
When I run above program, I got following output:

fcntl: function not implemented

Could you help me to know, is there anything wrong in my program or locking feature is not yet implemented within fcntl.

Regards,
ajaydec
6 REPLIES
Wim Van den Wyngaert
Honored Contributor

Re: Problem while using fcntl

Versions ?

Found this

$ DIR SYS$COMMON:[SYSHLP.EXAMPLES.UCX]UCX$IOCTL_ROUTINE.C

However, ensure if you are using a system that has the non-functional
ioctl in the DEC RTL that you do (e.g. OpenVMS 7.1 without some of the
later RTL patches)

$ cc/prefix=(all,except=ioctl)

otherwise you will pick up the non-functioning routine in the RTL, not
the one in ucx$ioctl_routine.c

fwiw

Wim
Wim
N/A

Re: Problem while using fcntl

Hi Wim,

OpenVMS (TM) Alpha Operating System, Version V8.2

$ DIR SYS$COMMON:[SYSHLP.EXAMPLES.UCX]UCX$IOCTL_ROUTINE.C
%DIRECT-E-OPENIN, error opening SYS$COMMON:[SYSHLP.EXAMPLES.UCX]UCX$IOCTL_ROUTINE.C;* as input
-RMS-E-DNF, directory not found
-SYSTEM-W-NOSUCHFILE, no such file


I didn't find any UCX directory under SYS$COMMON:[SYSHLP.EXAMPLES]

Regards,
ajaydec
Steven Schweda
Honored Contributor

Re: Problem while using fcntl

> Versions ?

Exactly. It fails on my Alpha system (VMS
V7.3-2), and appears to work on my IA64
system(VMS V8.3-1H1).

alp $ cc fl
alp $ link fl
alp $ run fl
fcntl: function not implemented
alp $

it $ cc fl /obj = fl_i
it $ link fl_i
it $ r fl_i
it $

I suspect that there was something somewhere
in the release notes about this.

These help, by the way:

#include
#include
#include
#include
Steven Schweda
Honored Contributor

Re: Problem while using fcntl

> I didn't find any UCX directory [...]

Don't worry about it. That's old stuff, and
ioctl() is not fcntl().
Steven Schweda
Honored Contributor
Solution

Re: Problem while using fcntl

The easily available documentation is
helpful, too. Compare, for example:

http://h71000.www7.hp.com/doc/82final/5763/5763pro_029.html#index_x_800

http://h71000.www7.hp.com/doc/83final/5763/5763pro_033.html#index_x_888

Only one mentions "File Locking".
N/A

Re: Problem while using fcntl

Thanks Steven,

fcntl is working on OVMS 8.3 and not OVMS 8.2 might be its not implemented on 8.2

Regards,
ajaydec