Re: [dev] [PATCH][blind] alloca #include for BSDs

From: fao_ <finnoleary_AT_inventati.org>
Date: Tue, 30 Jan 2018 03:38:07 +0000

On 2018-01-29 5:34 pm, Yuri wrote:
> See sbase and blind error logs when built with -D_XOPEN_SOURCE=700
> below.
>
> Yuri
>
> ---sbase errors---
>
> flock.c:21:38: error: use of undeclared identifier 'LOCK_EX'
>         int fd, status, savederrno, flags = LOCK_EX, nonblk = 0, oflag
> = 0;
>                                             ^
> flock.c:26:12: error: use of undeclared identifier 'LOCK_NB'
>                 nonblk = LOCK_NB;
>                          ^
> flock.c:32:11: error: use of undeclared identifier 'LOCK_SH'
>                 flags = LOCK_SH;
>                         ^
> flock.c:35:11: error: use of undeclared identifier 'LOCK_UN'
>                 flags = LOCK_UN;
>                         ^
> flock.c:38:11: error: use of undeclared identifier 'LOCK_EX'
>                 flags = LOCK_EX;
>                         ^
> flock.c:50:6: warning: implicit declaration of function 'flock' is
> invalid in C99 [-Wimplicit-function-declaration]
>         if (flock(fd, flags | nonblk)) {
>            ^

Yes, `flock` is not part of POSIX[0]. However, I'm confused why exactly
FreeBSD
is having a problem with this, because as you can see from the FreeBSD
manual[1],
it's fully supported in FreeBSD with the inclusion of <sys/file.h>,
which is
indeed present. Maybe -D_BSD_SOURCE requires a specific version
provided, or
the definition order matters? Unfortunately I do not have a FreeBSD
system to
check this.

[0]:http://pubs.opengroup.org/cgi/kman4.cgi?value=flock
[1]:https://www.unix.com/man-page/FreeBSD/2/flock/

> [...]
> ---blind errors---
>
> src/stream.c:367:73: error: use of undeclared identifier
> 'MAP_ANONYMOUS'
>         image = mmap(0, 2 * lframe_size + lframe_size, PROT_READ |
> PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, -1, 0);
> ^

The same is true here, see both:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html
https://www.unix.com/man-page/FreeBSD/2/mmap/

and note the lack / inclusion of support for MAP_ANONYMOUS respectively.

I'm sorry I cannot be of much more help. Good luck with this problem.

-- 
- fao_
PGP fingerprint: 739B 6C5C 3DE1 33FA
"Too enough is always not much!"
Received on Tue Jan 30 2018 - 04:38:07 CET

This archive was generated by hypermail 2.3.0 : Tue Jan 30 2018 - 04:48:19 CET