2022-04-07 07:15:35 +00:00
|
|
|
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
|
|
|
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
|
|
|
|
╞══════════════════════════════════════════════════════════════════════════════╡
|
2022-04-13 05:11:00 +00:00
|
|
|
│ Copyright 2022 Justine Alexandra Roberts Tunney │
|
2022-04-07 07:15:35 +00:00
|
|
|
│ │
|
|
|
|
│ Permission to use, copy, modify, and/or distribute this software for │
|
|
|
|
│ any purpose with or without fee is hereby granted, provided that the │
|
|
|
|
│ above copyright notice and this permission notice appear in all copies. │
|
|
|
|
│ │
|
|
|
|
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
|
|
|
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
|
|
|
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
|
|
|
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
|
|
|
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
|
|
|
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
|
|
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
|
|
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
|
|
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
2024-12-26 03:43:43 +00:00
|
|
|
#include "libc/dce.h"
|
2022-04-13 05:11:00 +00:00
|
|
|
#include "libc/intrin/describeflags.h"
|
|
|
|
#include "libc/macros.h"
|
|
|
|
#include "libc/nt/enum/consolemodeflags.h"
|
|
|
|
#include "libc/sysv/consts/map.h"
|
2022-04-07 07:15:35 +00:00
|
|
|
#include "libc/sysv/consts/prot.h"
|
|
|
|
|
2024-12-26 03:43:43 +00:00
|
|
|
#define MAP_GROWSDOWN_LINUX 0x00000100
|
|
|
|
|
2024-08-25 01:10:22 +00:00
|
|
|
const char *_DescribeMapFlags(char buf[64], int x) {
|
2022-04-13 05:11:00 +00:00
|
|
|
const struct DescribeFlags kMapFlags[] = {
|
2024-12-26 03:43:43 +00:00
|
|
|
{MAP_PRIVATE, "PRIVATE"}, //
|
|
|
|
{MAP_ANONYMOUS, "ANONYMOUS"}, //
|
|
|
|
{MAP_SHARED, "SHARED"}, //
|
|
|
|
{MAP_FIXED, "FIXED"}, //
|
|
|
|
{MAP_FIXED_NOREPLACE, "FIXED_NOREPLACE"}, //
|
|
|
|
{MAP_HUGETLB, "HUGETLB"}, //
|
|
|
|
{MAP_CONCEAL, "CONCEAL"}, //
|
|
|
|
{MAP_LOCKED, "LOCKED"}, //
|
|
|
|
{MAP_NORESERVE, "NORESERVE"}, //
|
|
|
|
{MAP_NONBLOCK, "NONBLOCK"}, //
|
|
|
|
{MAP_POPULATE, "POPULATE"}, //
|
|
|
|
{IsLinux() ? MAP_GROWSDOWN_LINUX : 0, "GROWSDOWN"}, //
|
2022-04-13 05:11:00 +00:00
|
|
|
};
|
2024-08-25 01:10:22 +00:00
|
|
|
return _DescribeFlags(buf, 64, kMapFlags, ARRAYLEN(kMapFlags), "MAP_", x);
|
2022-04-07 07:15:35 +00:00
|
|
|
}
|