Moin, moin!
%s wrote on %.3s, %lld Sep 1993
> > Anyway, when compiling this Linux program, which has lines
> [ ... ]
> > linking fails...
>
> Don't compile on Linux? 8-) 8-)
BINGO!!! Give that man a cigar. Once again it has been pointed out
to me that my messages are hopelessly unclear. Let me try again:
This program, originally written for Linux, needs a few small hacks
to get it to compile and/or work under FreeBSD. Once one slays the
obvious dragons, leaving the m{un}lockall() calls untouched, any
attempts to compile this program, originally written for Linux,
under FreeBSD (stable, for what it's worth) are doomed to failure
by the following:
[continue with the original ``undefined reference
to `munlockall' '' errors]
> Is your code controlling a
> nuclear reactor? No? Then it doesn't need the calls. 8-).
Well, no. But it is connected to a (wait, I need to hold the
punchline until it's appropriate)
> I don't know the proper test off the top of my head, but I
> know who would know, and I know a test that works for
> m{un}lockall(), and both of those are better anyway.
Thanks! I'm all ears.
Unfortunately.
> The person who would know would be Garrett A. Wollman; his
> email is <[EMAIL PROTECTED]>. He would know because he's
> been on the committes, and he's know because he wrote the
> shm_open(3) library code... just like it says at the bottom
And best of all, from my occasional views into the Monastery,
he's sufficiently interested in the topic that if I were to
mention that this collection of k0deZ is intended to interface
a radio, erm, I mean <blink> --> RADIO <-- </BLINK> clock
timekeeping driver (emphasis on RADIO, that is ****RADIO****), <- look!!!
then perhaps it may grab his interest. Or not. ^^^^^
> The test that works for m{un}lockall() requires that you:
[...]
> o The mlockall() function takes a flags argument that
> is an inclusive OR of one of several manifest
> constants.
>
> So basically, if you test for the manifest constants before
> making a call that uses them, then you are safe, e.g.:
>
> #ifdef MCL_CURRENT
> mlockall( MCL_CURRENT);
> #endif
[...]
> This should work everywhere, even on Linux, without having to
> break down and ask the person who wrote the code from the POSIX
Unfortunately, while I'd love to tell you that it works just all
sorts of groovy and everything, I regret to say that in the
included file <sys/mman.h> one finds the following lines:
| #ifdef _P1003_1B_VISIBLE
| /*
| * Process memory locking
| */
| #define MCL_CURRENT 0x0001 /* Lock only current memory */
| #define MCL_FUTURE 0x0002 /* Lock all future memory as well */
|
| #endif /* _P1003_1B_VISIBLE */
Comparable to the lines around m{un}lockall() themselves.
And in spite of wrapping the calls in the program in question
with a test for this...
| /* lock all memory pages */
| #ifdef MCL_CURRENT /* is the mlockall() call available? */
| if (mlockall(MCL_CURRENT | MCL_FUTURE) !=0)
| syslog(LOG_INFO, "error unable to lock memory pages");
| #else /* no, do without, but make note of it... */
| syslog(LOG_INFO, "error unsupported memory pages lock call");
| #endif
again everything falls apart with the failure:
/usr/bin/gcc -s -o radioclkd radioclkd.o
radioclkd.o: In function `Catch':
radioclkd.o(.text+0xd73): undefined reference to `munlockall'
radioclkd.o: In function `main':
radioclkd.o(.text+0x11e3): undefined reference to `mlockall'
*** Error code 1
> Alternately, you could send an email to Garrett.
This sounds like a good idea, since within the last week he has
made mention of the particular broadcast station around which this
code in question is based, but more importantly, because I wasn't
able to convert your suggestions into working code. Naturally, my
ugly brute force ``solution'' of an `#if 0' wrapper sort of messes
up things for Linux and Solaris...
But thanks for the ideas. As I said many moons ago, I know nothing.
ihr
barry bouwsma
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message