1838778 Members
3694 Online
110130 Solutions
New Discussion

fcntl issue HPUX

 
Hemant_7
Occasional Advisor

fcntl issue HPUX

Hi there
I m running this program both on solaris and HPUX. Its successful in solaris but it failed in HPUX. Both system has 64 bit OS.
Details of the machine is given below. Dont know y its happening ? I dont know whether my file system is enable for large files. ? If NO how can i check this ?

Hope to get speedy reply..

Thanks
Hemant


solaris
Uname -a
SunOS sun250 5.8 Generic_108528-16 sun4u sparc SUNW,Ultra-250
cc -c $1.c -xarch=v9 -misalign
cc -o $1 $1.o -xarch=v9 -misalign

uname -a
HPUX
HP-UX hpux110 B.11.00 U 9000/800 106901527 unlimited-user license

Compilation option used
cc -c $1.c +DD64 +M2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
cc -o $1 $1.o +DD64 +M2 -D_FILE_OFFSET_BITS=64 -D_KERNEL -D_LARGEFILE64_SOURCE

#include
#include
#include
#include
#include

main()
{

int iCommand;
struct flock64 sFlock;
int fd;

if ((fd = open64("test1.c", O_RDWR)) == -1) {
perror("open");
exit(1);
}

iCommand = F_SETLK64;
sFlock.l_type = F_UNLCK;
sFlock.l_whence = SEEK_SET;
sFlock.l_start = 0;

/*
sFlock.l_len = 4611686018427387903;
sFlock.l_len = 1073741823;
1073741823 this lenght is successful in HPUX

*/
sFlock.l_len = 4611686018427387903;
sFlock.l_pid = getpid();;
if (fcntl (fd, iCommand, &sFlock)) {
perror(" ");
return (-1);
}
else printf(" Sussess \n");
return (0);
}
5 REPLIES 5
Sanjay Kumar Suri
Honored Contributor

Re: fcntl issue HPUX

Check with

# fstyp -v /dev/my/rmylvol

The f_flag field must equal 16

sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
Bharat Katkar
Honored Contributor

Re: fcntl issue HPUX

Hemant,
As far as Largefiles Options is concerned you can always check it thr' #sam command.
1. Go to SAM menu
2. Select Disk And FileSystems
3. Select Filesystems
4. Select Your FileSystem
5. Use TAB and Arroy key's to select "Actions" menu.
6. Select Modify
7. You will see one option Below as:
[ ] Allow Larger Files
8. See if there is cross in the square brackets
9. If you want to enable it, simply go on that option and check one. Press OK.
10. That's all

Make sure during this modification nobody is using the File system becuase SAM will make the change and unmount that particular filesystem and remount it.

SAM is the simplest method to change the FileSystem related options.

You need to know a lot to actually know how little you know
Bharat Katkar
Honored Contributor

Re: fcntl issue HPUX

Your entry in fstab should like this:
/dev/vg00/mylvol /myFileSystem vxfs delaylog,nodatainlog,largefiles,rw,suid 0 2


You need to know a lot to actually know how little you know
Radhakrishnan Venkatara
Trusted Contributor

Re: fcntl issue HPUX

Hi,

If u r using vxfs filesystem .

then use fsadm -v .

It will tell filesystem is configured for largefiles ...

if required u can convert the filesytems for largefiles support


Negative thinking is a highest form of Intelligence
A. Clay Stephenson
Acclaimed Contributor

Re: fcntl issue HPUX

The first thing that I notice is that
sFlock.l_len = 4611686018427387903;
exceeds the maximum supported file size (2TB).
If it ain't broke, I can fix that.