1825693 Members
3265 Online
109686 Solutions
New Discussion

Re: flock

 
Berardi Angelo
Occasional Contributor

flock

I am using the Migration Environment v1.4 and to port software from Tru64 to HP-UX 11i v3 (11.31).
The software is written in C++ and I am having problems with whith the type flock (not the function) because the compiler dosen't recognize it. I have read that I need the library libtru64.so and that it is present in the Migration Environment v1.4 and that it's a link to:

/usr/lib/hpux64/libcext.so.

First I don't have libtru64.so in the Migration
Environment.
Second I have added:

/usr/lib/hpux32/libcext.so

in the Makefile but it didn't change nothing.

Thanks in advance.
3 REPLIES 3
Dennis Handly
Acclaimed Contributor

Re: flock

>type flock (not the function)

HP-UX doesn't have flock as either. There is a lockf(2).

You need a header to define flock and whatever functions that need it.
Have you looked at:
http://docs.hp.com/en/B3921-60631/flock.2.html
Berardi Angelo
Occasional Contributor

Re: flock

I am using the flock stucture in this piece of code.

void File::lock(bool bExclusive) throw (ios_base::failure)
{
flock tLockInfo;
int iCmd;

memset(&tLockInfo, 0, sizeof(tLockInfo));^M
if (bExclusive)
tLockInfo.l_type = F_WRLCK;
else
tLockInfo.l_type = F_RDLCK;

iCmd = F_SETLKW; // Blocking lock, wait the success of fuinction

if (::fcntl(m_hFile, iCmd, &tLockInfo) == -1)
throwIOSysException("lock-fcntl");
}

and I have included:

#include
#include
#include
#include
#include
#include
#include

and the compiler dosen't recognize the flock structure.
Thank you
Berardi Angelo
Occasional Contributor

Re: flock

I have found the solution. I have to define:

struct flock tLockInfo;

Thank you.