Fix compilation under glibc.

Some feature macros behaved differently from the ones in musl.
This commit is contained in:
Érico Rolim 2020-09-24 20:48:22 -03:00
parent 01eaa937fe
commit 1fc274535e
5 changed files with 12 additions and 4 deletions

1
gemi.c
View File

@ -1,3 +1,4 @@
#define _XOPEN_SOURCE /* getopt */
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>

View File

@ -1,3 +1,4 @@
#define _DEFAULT_SOURCE /* MAP_ANONYMOUS */
#include <assert.h>
#include <errno.h>
#include <stdio.h>
@ -11,6 +12,9 @@
#include "mmap_file.h"
const int PROT_MEM = PROT_WRITE | PROT_READ;
const int MAP_MEM = MAP_ANONYMOUS | MAP_PRIVATE;
bool allocate_mmap(struct mmap_file *f)
{
f->data = mmap(NULL, f->size, f->prot, f->flags, -1, 0);

View File

@ -10,8 +10,8 @@
#define ERROR_MMAP(file) ((file).data == MAP_FAILED || (file).data == NULL)
// definitions for memory backed mappings
#define PROT_MEM (PROT_WRITE | PROT_READ)
#define MAP_MEM (MAP_ANONYMOUS | MAP_PRIVATE)
extern const int PROT_MEM;
extern const int MAP_MEM;
// 128KiB
#define OUTPUT_FILE_SIZE (128 * 1024)

6
purr.c
View File

@ -1,7 +1,9 @@
#define _XOPEN_SOURCE /* getopt */
#ifdef HAVE_PROG_INVOCATION
#define _GNU_SOURCE
#define _GNU_SOURCE /* program_invocation_short_name */
#include <errno.h>
#endif
#endif /* HAVE_PROG_INVOCATION */
#include <signal.h>
#include <stdbool.h>

1
urls.c
View File

@ -1,3 +1,4 @@
#define _POSIX_C_SOURCE 200112L /* addrinfo */
#include <string.h>
#include <unistd.h>
#include <stdlib.h>