Operating System - Linux
1828587 Members
2465 Online
109983 Solutions
New Discussion

Large-file mkstemp() on 11.11

 
Steven Schweda
Honored Contributor

Large-file mkstemp() on 11.11

Apparently, mkstemp() on HP-UX 11.11 does not
set O_LARGEFILE when it opens a file, which
causes a (what should be) spurious EFBIG
failure when an otherwise large-file-capable
program attempts to write more than 2GB to a
file which was opened that way.

I didn't find a patch for this in an ITRC patch
database search, but, as no sane person would
expect any ITRC Web site feature to work
reliably, I thought that it might be wise to
persue my inquiry along a different path.

The same code seems to work properly on an
11.31 IA64 system, so the problem was
apparently solved somewhere along the line. If
anyone knows of a patch for 11.11, and/or has
info on when/where the problem got solved, I'd
be interested.
8 REPLIES 8
Dennis Handly
Acclaimed Contributor

Re: Large-file mkstemp() on 11.11

Unfortunately it isn't directly obvious how it was fixed. ;-)

It seems libc on 11.31 is now compiled with -D_FILE_OFFSET_BITS=64 so it magically works.
My 11.23 system doesn't have this fix.

The 11.31 fix was likely:
QXCR1000536607/JAGaf25880: >2TB Files Make Commands Misbehave/Fail
Steven Schweda
Honored Contributor

Re: Large-file mkstemp() on 11.11

> It seems libc on 11.31 is now compiled with
> -D_FILE_OFFSET_BITS=64 so it magically works.

There's more fine print. At 11.11 at least,
mkstemp() is declared in stdlib.h, while all
the large-file stuff is handled in stdio.h.
Unlike fopen() and its friends, there's no
obvious mkstemp64() (and, hence, nothing to
select it instead of the normal mkstemp() in
a large-file compilation). And unlike with
open(), there's no place in a mkstemp()
argument list to stick in an O_LARGEFILE
flag.

About all I could get Google to find were
similar complaints from Samba developers.

Apparently ("man mkstemp"), we're all
supposed to use tmpfile() instead. Sigh.
Dennis Handly
Acclaimed Contributor

Re: Large-file mkstemp() on 11.11

>while all the large-file stuff is handled in stdio.h. Unlike fopen() and its friends, there's no obvious mkstemp64(). And unlike with open(), there's no place in a mkstemp() argument list to stick in an O_LARGEFILE flag.

There is no need for any of that. The only color you should get out of mkstemp(3) is black (O_LARGEFILE). :-)

>Apparently ("man mkstemp"), we're all
supposed to use tmpfile().

Yes, I saw that. But I kept looking.
Steven Schweda
Honored Contributor

Re: Large-file mkstemp() on 11.11

A broader ITRC search (for "mkstemp") turned
up these:

http://www11.itrc.hp.com/service/james/dispDoc.do?docURL=%2Fservice%2Fcki%2FdocDisplay.do%3FdocLocale%3Den%26docId%3Ducr_na-KMN8606374038_ssb-1&aid=SEARCH_CKI&pil=10&serStr=mkstemp

http://www11.itrc.hp.com/service/james/dispDoc.do?docURL=%2Fservice%2Fcki%2FdocDisplay.do%3FdocLocale%3Den%26docId%3Demr_na-c00924637-1&aid=SEARCH_CKI&pil=11&serStr=mkstemp

Sadly, all I can get from them is "Please
check your login status. The content
identified requires a support agreement, HP
CarePack or warranty." (All of which I lack.)

Anyone with more status than mine care to
quote or summarize?
James R. Ferguson
Acclaimed Contributor

Re: Large-file mkstemp() on 11.11

Hi Steven:

The links you posted don't seem to work for me. My own search yielded:

Technical Knowledge Base ID ucr_na-KMN8606374038_ssb-1

...which basically states a request to make 'mkstemp()' support largefiles on 11.11 (it doesn't). The document notes that this will be provided in 11.31.

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: Large-file mkstemp() on 11.11

>JRF: which basically states a request to make mkstemp() support largefiles on 11.11. The document notes that this will be provided in 11.31.

Yes, that's what QXCR1000539041 says:
mkstemp() can't exceed 2GB
James R. Ferguson
Acclaimed Contributor

Re: Large-file mkstemp() on 11.11

Hi:

> Dennis: Yes, that's what QXCR1000539041 says

...and so how do mere mortals (non-HP folks) find/know these IDs, including 'JAG' values? With a support contract we can search the TKB or Patch Database, but it would seem you have access to other sources(?)

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: Large-file mkstemp() on 11.11

>JRF: so how do mere mortals (non-HP folks) find/know these IDs,

Not sure. I noticed the 8606374038 in the middle of ucr_na-KMN8606374038_ssb-1 as a SR number I could look up. If you can see it in Technical Knowledge Base, that's all you see.

>including 'JAG' values?

(That's the previous defect database.)

You'll see 8606374038 and JAG* in existing patches and now the new QXCR* form.

>With a support contract we can search the TKB or Patch Database, but it would seem you have access to other sources(?)

Yes. I have direct access to the defect database, after all, I have to fix things. :-)