Skip to content

Commit 23eed29

Browse files
committed
Add some constants from limits to musl
1 parent 3cf3a49 commit 23eed29

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

src/codegen/XenoAtom.Interop.CodeGen/musl/MuslGenerator.cs

+17
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,23 @@ internal partial class MuslGenerator
134134
// Discard these functions that are not supported (clone) or have more suitable equivalent (exec)
135135
e => e.Map<CppFunction>("(clone|execl|execle|execlp)").Discard(),
136136

137+
// limits.h (constants)
138+
e => e.MapMacroToConst("PATH_MAX", "int"),
139+
e => e.MapMacroToConst("NAME_MAX", "int"),
140+
e => e.MapMacroToConst("NGROUPS_MAX", "int"),
141+
e => e.MapMacroToConst("ARG_MAX", "int"),
142+
e => e.MapMacroToConst("IOV_MAX", "int"),
143+
e => e.MapMacroToConst("SYMLOOP_MAX", "int"),
144+
e => e.MapMacroToConst("TZNAME_MAX", "int"),
145+
e => e.MapMacroToConst("TTY_NAME_MAX", "int"),
146+
e => e.MapMacroToConst("HOST_NAME_MAX", "int"),
147+
// limits.h - Implementation choices
148+
e => e.MapMacroToConst("PTHREAD_KEYS_MAX", "int"),
149+
e => e.MapMacroToConst("PTHREAD_STACK_MIN", "int"),
150+
e => e.MapMacroToConst("PTHREAD_DESTRUCTOR_ITERATIONS", "int"),
151+
e => e.MapMacroToConst("DELAYTIMER_MAX", "unsigned int", explicitCast:true),
152+
e => e.MapMacroToConst("MQ_PRIO_MAX", "int"),
153+
e => e.MapMacroToConst("LOGIN_NAME_MAX", "int"),
137154
// cachectl.h
138155
e => e.MapMacroToConst("ICACHE", "int"),
139156
e => e.MapMacroToConst("DCACHE", "int"),

src/musl/XenoAtom.Interop.musl/generated/limits.generated.cs

+30
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,38 @@ namespace XenoAtom.Interop
1313
{
1414
public static unsafe partial class musl
1515
{
16+
public const int NAME_MAX = 255;
17+
18+
public const int PATH_MAX = 4096;
19+
20+
public const int NGROUPS_MAX = 32;
21+
22+
public const int ARG_MAX = 131072;
23+
24+
public const int IOV_MAX = 1024;
25+
26+
public const int SYMLOOP_MAX = 40;
27+
28+
public const int TZNAME_MAX = 6;
29+
30+
public const int TTY_NAME_MAX = 32;
31+
32+
public const int HOST_NAME_MAX = 255;
33+
34+
public const int PTHREAD_KEYS_MAX = 128;
35+
36+
public const int PTHREAD_STACK_MIN = 2048;
37+
38+
public const int PTHREAD_DESTRUCTOR_ITERATIONS = 4;
39+
1640
public const int SEM_VALUE_MAX = 2147483647;
1741

1842
public const int SEM_NSEMS_MAX = 256;
43+
44+
public const uint DELAYTIMER_MAX = 2147483647;
45+
46+
public const int MQ_PRIO_MAX = 32768;
47+
48+
public const int LOGIN_NAME_MAX = 256;
1949
}
2050
}

0 commit comments

Comments
 (0)