Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Mar 2002 20:07:01 +0100 (CET)
From:      BOUWSMA Beery <freebsd-user@dcf77-zeit.netscum.dyndns.dk>
To:        hackers@freebsd.org
Cc:        jonathan@buzzard.org.uk (Jonathan Buzzard)
Subject:   Re: How to correctly detect POSIX 1003.1b features on FreeBSD?
Message-ID:  <200203201907.g2KJ71R03929@beerswilling.netscum.dyndns.dk>
References:  <20020312140904.A799@bbn.com> <3C8E742C.7C2E63B8@mindspring.com> <20020312193514.A2226@bbn.com> <20020313005940.GB32410@elvis.mu.org> <20020312201314.A2345@bbn.com> <3C8EB31E.19382903@mindspring.com> <20020312214007.A2526@bbn.com>

next in thread | previous in thread | raw e-mail | index | archive | help
[replies sent directly to me may timeout and bounce, since I'm not
 online as often as I should be, but I'll check the list archives]


I've followed this with interest, because I'm playing with some
Linux k0deZ which makes calls to m(un)lockall() that are similarly
wrapped in sys/mman.h by
| #ifdef _P1003_1B_VISIBLE
| int     mlockall __P((int));
| int     munlockall __P((void));
| int     shm_open __P((const char *, int, mode_t));
| int     shm_unlink __P((const char *));
| #endif /* _P1003_1B_VISIBLE */

[...]


> > When (if) the feature is ever actuallysupported by FreeBSD,
> > the manifest constant _POSIX_REALTIME_SIGNALS will be
> > defined.

> Ahh!  OK, this is the information that I am most interested in.
> So, I am now confident to re-write the test in ACE to:
> 
> #ifdef _POSIX_REALTIME_SIGNALS
> 
> /* use sigqueue(), etc. */
> 
> #endif
> 
> This test will work for ACE users on older and newer versions of FreeBSD,
> and when POSIX RT signals are fully implemented on FreeBSD, ACE will use
> them.

Anyway, when compiling this Linux program, which has lines
|                 /* lock all memory pages */
|                 if (mlockall(MCL_CURRENT | MCL_FUTURE) !=0)
|                         syslog(LOG_INFO, "error unable to lock memory pages");

and
|                 syslog(LOG_INFO, "Exiting...");
|                 unlink(PID_FILE);
|                 munlockall();

linking fails...

radioclkd.o: In function `Catch':
radioclkd.o(.text+0xb3b): undefined reference to `munlockall'
radioclkd.o: In function `main':
radioclkd.o(.text+0xfeb): undefined reference to `mlockall'
*** Error code 1

First question:  Are mlockall() and munlockall() supported by FreeBSD
(tested with 4.5-stable above), and if so, what needs to be defined
as the magic incantation to be able to use them as above?

Of course, given that the vm_mmap.c k0deZ for mlockall() looks like
| int
| mlockall(p, uap)
|         struct proc *p;
|         struct mlockall_args *uap;
| {
|         return 0;
| }
this is probably more an exercise in proper programming for the
moment...


Secondly, if these calls aren't supported, what test, if not the
#ifdef _POSIX_REALTIME_SIGNALS  test mentioned in the earlier
thread above, needs to be wrapped around the source k0deZ so that
FreeBSD goes to some alternate code, while Linux executes the above
m(un)lockall() calls, until FreeBSD does support these calls?


thanks,
barry bouwsma


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203201907.g2KJ71R03929>