Skip to content

Commit

Permalink
Add some constants from limits to musl
Browse files Browse the repository at this point in the history
  • Loading branch information
xoofx committed Jul 21, 2024
1 parent 3cf3a49 commit 23eed29
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/codegen/XenoAtom.Interop.CodeGen/musl/MuslGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,23 @@ internal partial class MuslGenerator
// Discard these functions that are not supported (clone) or have more suitable equivalent (exec)
e => e.Map<CppFunction>("(clone|execl|execle|execlp)").Discard(),

// limits.h (constants)
e => e.MapMacroToConst("PATH_MAX", "int"),
e => e.MapMacroToConst("NAME_MAX", "int"),
e => e.MapMacroToConst("NGROUPS_MAX", "int"),
e => e.MapMacroToConst("ARG_MAX", "int"),
e => e.MapMacroToConst("IOV_MAX", "int"),
e => e.MapMacroToConst("SYMLOOP_MAX", "int"),
e => e.MapMacroToConst("TZNAME_MAX", "int"),
e => e.MapMacroToConst("TTY_NAME_MAX", "int"),
e => e.MapMacroToConst("HOST_NAME_MAX", "int"),
// limits.h - Implementation choices
e => e.MapMacroToConst("PTHREAD_KEYS_MAX", "int"),
e => e.MapMacroToConst("PTHREAD_STACK_MIN", "int"),
e => e.MapMacroToConst("PTHREAD_DESTRUCTOR_ITERATIONS", "int"),
e => e.MapMacroToConst("DELAYTIMER_MAX", "unsigned int", explicitCast:true),
e => e.MapMacroToConst("MQ_PRIO_MAX", "int"),
e => e.MapMacroToConst("LOGIN_NAME_MAX", "int"),
// cachectl.h
e => e.MapMacroToConst("ICACHE", "int"),
e => e.MapMacroToConst("DCACHE", "int"),
Expand Down
30 changes: 30 additions & 0 deletions src/musl/XenoAtom.Interop.musl/generated/limits.generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,38 @@ namespace XenoAtom.Interop
{
public static unsafe partial class musl
{
public const int NAME_MAX = 255;

public const int PATH_MAX = 4096;

public const int NGROUPS_MAX = 32;

public const int ARG_MAX = 131072;

public const int IOV_MAX = 1024;

public const int SYMLOOP_MAX = 40;

public const int TZNAME_MAX = 6;

public const int TTY_NAME_MAX = 32;

public const int HOST_NAME_MAX = 255;

public const int PTHREAD_KEYS_MAX = 128;

public const int PTHREAD_STACK_MIN = 2048;

public const int PTHREAD_DESTRUCTOR_ITERATIONS = 4;

public const int SEM_VALUE_MAX = 2147483647;

public const int SEM_NSEMS_MAX = 256;

public const uint DELAYTIMER_MAX = 2147483647;

public const int MQ_PRIO_MAX = 32768;

public const int LOGIN_NAME_MAX = 256;
}
}

0 comments on commit 23eed29

Please sign in to comment.