From 89cef74f626382072ae000ca3991a85f851f336a Mon Sep 17 00:00:00 2001 From: Rick Guo Date: Mon, 19 Oct 2026 13:57:14 +0800 Subject: [PATCH 1/6] feat(c/os): add native libc OS bindings --- c/os/dirent_unix64.go | 8 + c/os/libc_darwin_arm64.go | 2476 ++++++++++++++++++++++++++++++ c/os/libc_linux_amd64.go | 1785 +++++++++++++++++++++ c/os/llcppg.pub | 75 +- c/os/mach_darwin_arm64.go | 11 + c/os/sched_param_darwin_arm64.go | 12 + c/os/sched_param_linux_amd64.go | 12 + c/os/types_darwin_arm64.go | 26 + c/os/types_linux_amd64.go | 52 + 9 files changed, 4453 insertions(+), 4 deletions(-) create mode 100644 c/os/dirent_unix64.go create mode 100644 c/os/libc_darwin_arm64.go create mode 100644 c/os/libc_linux_amd64.go create mode 100644 c/os/mach_darwin_arm64.go create mode 100644 c/os/sched_param_darwin_arm64.go create mode 100644 c/os/sched_param_linux_amd64.go create mode 100644 c/os/types_darwin_arm64.go create mode 100644 c/os/types_linux_amd64.go diff --git a/c/os/dirent_unix64.go b/c/os/dirent_unix64.go new file mode 100644 index 00000000..ed366775 --- /dev/null +++ b/c/os/dirent_unix64.go @@ -0,0 +1,8 @@ +//go:build (darwin && arm64 && !ios) || (linux && amd64 && !android) + +package os + +import "github.com/goplus/lib/c/syscall" + +// Dirent shares the representation already used by Readdir. +type Dirent = syscall.Dirent diff --git a/c/os/libc_darwin_arm64.go b/c/os/libc_darwin_arm64.go new file mode 100644 index 00000000..802312f6 --- /dev/null +++ b/c/os/libc_darwin_arm64.go @@ -0,0 +1,2476 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. +// Classified from the common libc binding. + +package os + +import ( + "github.com/goplus/lib/c" + llsignal "github.com/goplus/lib/c/signal" + llsys "github.com/goplus/lib/c/sys" + lltime "github.com/goplus/lib/c/time" + "unsafe" +) + +// time() +type X__DarwinTimeT = c.Long + +// definitions for library routines operating on directories. +const DIRBLKSIZ = 1024 + +// flags for opendir2 +const ( + DTF_HIDEW = 1 + // don't return duplicate names + DTF_NODUP = 2 + // rewind after reading union stack + DTF_REWIND = 4 + // everything has been read + // assume internal buffer is populated + // there's nothing more to read in the kernel +) + +// llgo:link (*DIR).ReaddirR C.readdir_r +func (self *DIR) ReaddirR(_llcppg_param2 *Dirent, _llcppg_param3 **Dirent) c.Int { + return 0 +} + +// llgo:link (*DIR).Rewinddir C.rewinddir +func (self *DIR) Rewinddir() { +} + +// llgo:link (*DIR).Seekdir C.seekdir +func (self *DIR) Seekdir(_llcppg_param2 c.Long) { +} + +// llgo:link (*DIR).Telldir C.telldir +func (self *DIR) Telldir() c.Long { + return 0 +} + +//go:linkname Alphasort C.alphasort +func Alphasort(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int + +// llgo:link (*DIR).Dirfd C.dirfd +func (self *DIR) Dirfd() c.Int { + return 0 +} + +//go:linkname Scandir C.scandir +func Scandir(_llcppg_param1 *c.Char, _llcppg_param2 ***Dirent, _llcppg_param3 func(_llcppg_param1 *Dirent) c.Int, _llcppg_param4 func(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int) c.Int + +const ( + RTLD_LAZY = 1 + RTLD_NOW = 2 + RTLD_LOCAL = 4 + RTLD_GLOBAL = 8 +) + +const ( + RTLD_NOLOAD = 16 + RTLD_NODELETE = 128 + // Mac OS X 10.5 and later + RTLD_FIRST = 256 +) + +// Structure filled in by dladdr(). +type DlInfo struct { + DliFname *c.Char + DliFbase unsafe.Pointer + DliSname *c.Char + DliSaddr unsafe.Pointer +} + +//go:linkname Dladdr C.dladdr +func Dladdr(_llcppg_param1 unsafe.Pointer, _llcppg_param2 *DlInfo) c.Int + +//go:linkname Dlclose C.dlclose +func Dlclose(__handle unsafe.Pointer) c.Int + +//go:linkname Dlerror C.dlerror +func Dlerror() *c.Char + +//go:linkname Dlopen C.dlopen +func Dlopen(__path *c.Char, __mode c.Int) unsafe.Pointer + +//go:linkname Dlsym C.dlsym +func Dlsym(__handle unsafe.Pointer, __symbol *c.Char) unsafe.Pointer + +//go:linkname DlopenPreflight C.dlopen_preflight +func DlopenPreflight(__path *c.Char) bool + +// Believed to have been introduced in 1003.2-1992 +const ( + GLOB_APPEND = 1 + // Use gl_offs. + GLOB_DOOFFS = 2 + // Return on error. + GLOB_ERR = 4 + // Append / to matching directories. + GLOB_MARK = 8 + // Return pattern itself if nothing matches. + GLOB_NOCHECK = 16 + // Don't sort. + GLOB_NOSORT = 32 + // Disable backslash escaping. + GLOB_NOESCAPE = 8192 +) + +// Error values returned by glob(3) +const ( + GLOB_NOSPACE = -1 + // Unignored error. + GLOB_ABORTED = -2 + // No match and GLOB_NOCHECK was not set. + GLOB_NOMATCH = -3 + // Obsolete: source comptability only. + GLOB_NOSYS = -4 +) + +const ( + // Use alternately specified directory funcs. + GLOB_ALTDIRFUNC = 64 + // Expand braces ala csh. + GLOB_BRACE = 128 + // Pattern had globbing characters. + GLOB_MAGCHAR = 256 + // GLOB_NOCHECK without magic chars (csh). + GLOB_NOMAGIC = 512 + // Quote special chars with \. + GLOB_QUOTE = 1024 + // Expand tilde names from the passwd file. + GLOB_TILDE = 2048 + // limit number of returned paths + GLOB_LIMIT = 4096 +) + +// source compatibility, these are the old names +const ( + GLOB_MAXPATH = 4096 + GLOB_ABEND = -2 +) + +// llgo:type C +type GlobT struct { + GlPathc c.SizeT + GlMatchc c.Int + GlOffs c.SizeT + GlFlags c.Int + GlPathv **c.Char + GlErrfunc func(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + GlClosedir func(_llcppg_param1 unsafe.Pointer) + GlReaddir func(_llcppg_param1 unsafe.Pointer) *Dirent + GlOpendir func(_llcppg_param1 *c.Char) unsafe.Pointer + GlLstat func(_llcppg_param1 *c.Char, _llcppg_param2 *StatT) c.Int + GlStat func(_llcppg_param1 *c.Char, _llcppg_param2 *StatT) c.Int +} + +//go:linkname Glob C.glob +func Glob(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 func(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int, _llcppg_param4 *GlobT) c.Int + +// llgo:link (*GlobT).Globfree C.globfree +func (self *GlobT) Globfree() { +} + +type Group struct { + GrName *c.Char + GrPasswd *c.Char + GrGid GidT + GrMem **c.Char +} + +// [XBD] +// +//go:linkname Getgrgid C.getgrgid +func Getgrgid(_llcppg_param1 GidT) *Group + +// [TSF] +// +//go:linkname Getgrnam C.getgrnam +func Getgrnam(_llcppg_param1 *c.Char) *Group + +// [TSF] +// +//go:linkname GetgrgidR C.getgrgid_r +func GetgrgidR(_llcppg_param1 GidT, _llcppg_param2 *Group, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT, _llcppg_param5 **Group) c.Int + +// [XSI] +// +//go:linkname GetgrnamR C.getgrnam_r +func GetgrnamR(_llcppg_param1 *c.Char, _llcppg_param2 *Group, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT, _llcppg_param5 **Group) c.Int + +// [XSI] +// +//go:linkname Getgrent C.getgrent +func Getgrent() *Group + +//go:linkname Setgrent C.setgrent +func Setgrent() + +//go:linkname Endgrent C.endgrent +func Endgrent() + +//go:linkname GroupFromGid C.group_from_gid +func GroupFromGid(_llcppg_param1 GidT, _llcppg_param2 c.Int) *c.Char + +//go:linkname Getgruuid C.getgruuid +func Getgruuid(_llcppg_param1 UuidT) *Group + +//go:linkname GetgruuidR C.getgruuid_r +func GetgruuidR(_llcppg_param1 UuidT, _llcppg_param2 *Group, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT, _llcppg_param5 **Group) c.Int + +//go:linkname Setgroupent C.setgroupent +func Setgroupent(_llcppg_param1 c.Int) c.Int + +type IntegerT = c.Int + +type ExceptionBehaviorT = c.Int + +type ExceptionMaskT = c.Uint + +type CpuTypeT = IntegerT + +type CpuSubtypeT = IntegerT + +type ThreadStateFlavorT = c.Int + +//go:linkname SchedYield C.sched_yield +func SchedYield() c.Int + +//go:linkname SchedGetPriorityMin C.sched_get_priority_min +func SchedGetPriorityMin(_llcppg_param1 c.Int) c.Int + +//go:linkname SchedGetPriorityMax C.sched_get_priority_max +func SchedGetPriorityMax(_llcppg_param1 c.Int) c.Int + +type Passwd struct { + PwName *c.Char + PwPasswd *c.Char + PwUid UidT + PwGid GidT + PwChange X__DarwinTimeT + PwClass *c.Char + PwGecos *c.Char + PwDir *c.Char + PwShell *c.Char + PwExpire X__DarwinTimeT +} + +//go:linkname Getpwuid C.getpwuid +func Getpwuid(_llcppg_param1 UidT) *Passwd + +//go:linkname Getpwnam C.getpwnam +func Getpwnam(_llcppg_param1 *c.Char) *Passwd + +//go:linkname GetpwuidR C.getpwuid_r +func GetpwuidR(_llcppg_param1 UidT, _llcppg_param2 *Passwd, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT, _llcppg_param5 **Passwd) c.Int + +//go:linkname GetpwnamR C.getpwnam_r +func GetpwnamR(_llcppg_param1 *c.Char, _llcppg_param2 *Passwd, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT, _llcppg_param5 **Passwd) c.Int + +//go:linkname Getpwent C.getpwent +func Getpwent() *Passwd + +//go:linkname Setpwent C.setpwent +func Setpwent() + +//go:linkname Endpwent C.endpwent +func Endpwent() + +//go:linkname Setpassent C.setpassent +func Setpassent(_llcppg_param1 c.Int) c.Int + +//go:linkname UserFromUid C.user_from_uid +func UserFromUid(_llcppg_param1 UidT, _llcppg_param2 c.Int) *c.Char + +//go:linkname Getpwuuid C.getpwuuid +func Getpwuuid(_llcppg_param1 UuidT) *Passwd + +//go:linkname GetpwuuidR C.getpwuuid_r +func GetpwuuidR(_llcppg_param1 UuidT, _llcppg_param2 *Passwd, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT, _llcppg_param5 **Passwd) c.Int + +// flags for CPU Security Mitigation attribute +// POSIX_SPAWN_NP_CSM_ALL should be used in most cases, +// the individual flags are provided only for performance evaluation etc +const ( + POSIX_SPAWN_NP_CSM_ALL = 1 + POSIX_SPAWN_NP_CSM_NOSMT = 2 + POSIX_SPAWN_NP_CSM_TECS = 4 +) + +// Opaque types for use with posix_spawn() family functions. Internals are +// not defined, and should not be accessed directly. Types are defined as +// mandated by POSIX. +type PosixSpawnattrT uintptr + +type PosixSpawnFileActionsT uintptr + +//go:linkname PosixSpawn C.posix_spawn +func PosixSpawn(_llcppg_param1 *PidT, _llcppg_param2 *c.Char, _llcppg_param3 *PosixSpawnFileActionsT, _llcppg_param4 *PosixSpawnattrT, __argv **c.Char, __envp **c.Char) c.Int + +//go:linkname PosixSpawnp C.posix_spawnp +func PosixSpawnp(_llcppg_param1 *PidT, _llcppg_param2 *c.Char, _llcppg_param3 *PosixSpawnFileActionsT, _llcppg_param4 *PosixSpawnattrT, __argv **c.Char, __envp **c.Char) c.Int + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddclose C.posix_spawn_file_actions_addclose +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddclose(_llcppg_param2 c.Int) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAdddup2 C.posix_spawn_file_actions_adddup2 +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAdddup2(_llcppg_param2 c.Int, _llcppg_param3 c.Int) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddopen C.posix_spawn_file_actions_addopen +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddopen(_llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 c.Int, _llcppg_param5 ModeT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsDestroy C.posix_spawn_file_actions_destroy +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsDestroy() c.Int { + return 0 +} + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsInit C.posix_spawn_file_actions_init +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsInit() c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrDestroy C.posix_spawnattr_destroy +func (self *PosixSpawnattrT) PosixSpawnattrDestroy() c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigdefault C.posix_spawnattr_getsigdefault +func (self *PosixSpawnattrT) PosixSpawnattrGetsigdefault(_llcppg_param2 *llsignal.SigsetT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetflags C.posix_spawnattr_getflags +func (self *PosixSpawnattrT) PosixSpawnattrGetflags(_llcppg_param2 *int16) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetpgroup C.posix_spawnattr_getpgroup +func (self *PosixSpawnattrT) PosixSpawnattrGetpgroup(_llcppg_param2 *PidT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigmask C.posix_spawnattr_getsigmask +func (self *PosixSpawnattrT) PosixSpawnattrGetsigmask(_llcppg_param2 *llsignal.SigsetT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrInit C.posix_spawnattr_init +func (self *PosixSpawnattrT) PosixSpawnattrInit() c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigdefault C.posix_spawnattr_setsigdefault +func (self *PosixSpawnattrT) PosixSpawnattrSetsigdefault(_llcppg_param2 *llsignal.SigsetT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetflags C.posix_spawnattr_setflags +func (self *PosixSpawnattrT) PosixSpawnattrSetflags(_llcppg_param2 int16) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetpgroup C.posix_spawnattr_setpgroup +func (self *PosixSpawnattrT) PosixSpawnattrSetpgroup(_llcppg_param2 PidT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigmask C.posix_spawnattr_setsigmask +func (self *PosixSpawnattrT) PosixSpawnattrSetsigmask(_llcppg_param2 *llsignal.SigsetT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetbinprefNp C.posix_spawnattr_getbinpref_np +func (self *PosixSpawnattrT) PosixSpawnattrGetbinprefNp(_llcppg_param2 c.SizeT, _llcppg_param3 *CpuTypeT, _llcppg_param4 *c.SizeT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetarchprefNp C.posix_spawnattr_getarchpref_np +func (self *PosixSpawnattrT) PosixSpawnattrGetarchprefNp(_llcppg_param2 c.SizeT, _llcppg_param3 *CpuTypeT, _llcppg_param4 *CpuSubtypeT, _llcppg_param5 *c.SizeT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetauditsessionportNp C.posix_spawnattr_setauditsessionport_np +func (self *PosixSpawnattrT) PosixSpawnattrSetauditsessionportNp(_llcppg_param2 MachPortT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetbinprefNp C.posix_spawnattr_setbinpref_np +func (self *PosixSpawnattrT) PosixSpawnattrSetbinprefNp(_llcppg_param2 c.SizeT, _llcppg_param3 *CpuTypeT, _llcppg_param4 *c.SizeT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetarchprefNp C.posix_spawnattr_setarchpref_np +func (self *PosixSpawnattrT) PosixSpawnattrSetarchprefNp(_llcppg_param2 c.SizeT, _llcppg_param3 *CpuTypeT, _llcppg_param4 *CpuSubtypeT, _llcppg_param5 *c.SizeT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetexceptionportsNp C.posix_spawnattr_setexceptionports_np +func (self *PosixSpawnattrT) PosixSpawnattrSetexceptionportsNp(_llcppg_param2 ExceptionMaskT, _llcppg_param3 MachPortT, _llcppg_param4 ExceptionBehaviorT, _llcppg_param5 ThreadStateFlavorT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetspecialportNp C.posix_spawnattr_setspecialport_np +func (self *PosixSpawnattrT) PosixSpawnattrSetspecialportNp(_llcppg_param2 MachPortT, _llcppg_param3 c.Int) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetnosmtNp C.posix_spawnattr_setnosmt_np +func (self *PosixSpawnattrT) PosixSpawnattrSetnosmtNp() c.Int { + return 0 +} + +// Set CPU Security Mitigation on the spawned process +// This attribute affects all threads and is inherited on fork and exec +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetCsmNp C.posix_spawnattr_set_csm_np +func (self *PosixSpawnattrT) PosixSpawnattrSetCsmNp(flags c.Uint32T) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddinheritNp C.posix_spawn_file_actions_addinherit_np +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddinheritNp(_llcppg_param2 c.Int) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddchdirNp C.posix_spawn_file_actions_addchdir_np +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddchdirNp(_llcppg_param2 *c.Char) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddfchdirNp C.posix_spawn_file_actions_addfchdir_np +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddfchdirNp(_llcppg_param2 c.Int) c.Int { + return 0 +} + +type X_filesec struct { +} + +type FilesecT = *X_filesec + +type FsblkcntT = X__DarwinFsblkcntT + +type FsfilcntT = X__DarwinFsfilcntT + +// can hold pid_t, gid_t, or uid_t +type IdT = X__DarwinIdT + +type UsecondsT = X__DarwinUsecondsT + +type UuidT = X__DarwinUuidT + +// Used by statvfs and fstatvfs +type X__DarwinFsblkcntT = c.Uint + +// Used by statvfs and fstatvfs +type X__DarwinFsfilcntT = c.Uint + +// [XSI] pid_t, uid_t, or gid_t +type X__DarwinIdT = c.Uint32T + +// [???] microseconds +type X__DarwinUsecondsT = c.Uint32T + +type X__DarwinUuidT = [16]uint8 + +// File types +const MAXNAMLEN = 255 + +// File types +const ( + DT_UNKNOWN = 0 + DT_FIFO = 1 + DT_CHR = 2 + DT_DIR = 4 + DT_BLK = 6 + DT_REG = 8 + DT_LNK = 10 + DT_SOCK = 12 + DT_WHT = 14 +) + +const ( + FREAD = 1 + FWRITE = 2 +) + +const ( + // no delay + // set append mode + O_APPEND = 8 +) + +const ( + // open with shared file lock + O_SHLOCK = 16 + // open with exclusive file lock + O_EXLOCK = 32 + // signal pgrp when data ready + O_ASYNC = 64 + // source compatibility: do not use + O_FSYNC = 128 + // don't follow symlinks + O_NOFOLLOW = 256 +) + +const ( + // create if nonexistant + // truncate to zero length + // error if already exists + O_EXCL = 2048 +) + +// descriptor requested for event notifications only +const O_EVTONLY = 32768 + +// don't assign controlling terminal +const O_NOCTTY = 131072 + +const O_DIRECTORY = 1048576 + +// allow open of a symlink +const O_SYMLINK = 2097152 + +// implicitly set FD_CLOEXEC +const O_CLOEXEC = 16777216 + +// no symlinks allowed in path +const O_NOFOLLOW_ANY = 536870912 + +const ( + // open file for execute only + O_EXEC = 1073741824 + // open directory for search only + O_SEARCH = 1074790400 +) + +// Descriptor value for the current working directory +const AT_FDCWD = -2 + +// Flags for the at functions +const ( + AT_EACCESS = 16 + // Act on the symlink itself not the target + AT_SYMLINK_NOFOLLOW = 32 + // Act on target of symlink + AT_SYMLINK_FOLLOW = 64 + // Path refers to directory + AT_REMOVEDIR = 128 +) + +const ( + // Return real device inodes resides on for fstatat(2) + AT_REALDEV = 512 + // Use only the fd and Ignore the path for fstatat(2) + AT_FDONLY = 1024 + // Path should not contain any symlinks + AT_SYMLINK_NOFOLLOW_ANY = 2048 +) + +// Data Protection Flags +const ( + O_DP_GETRAWENCRYPTED = 1 + O_DP_GETRAWUNENCRYPTED = 2 + O_DP_AUTHENTICATE = 4 +) + +// Descriptor value for openat_authenticated_np() to skip authentication with another fd +const AUTH_OPEN_NOAUTHFD = -1 + +const ( + // kernel/compat + FAPPEND = 8 + // kernel/compat + FASYNC = 64 + // kernel + FFSYNC = 128 + // kernel + FFDSYNC = 4194304 + // kernel + FNONBLOCK = 4 + // compat + FNDELAY = 4 + // compat + O_NDELAY = 4 +) + +const ( + CPF_OVERWRITE = 1 + CPF_IGNORE_MODE = 2 + CPF_MASK = 3 +) + +// command values +const ( + F_DUPFD = 0 + // get file descriptor flags + F_GETFD = 1 + // set file descriptor flags + F_SETFD = 2 + // get file status flags + // set file status flags + // get SIGIO/SIGURG proc/pgrp + F_GETOWN = 5 + // set SIGIO/SIGURG proc/pgrp + F_SETOWN = 6 + // get record locking information + F_GETLK = 7 + // set record locking information + F_SETLK = 8 + // F_SETLK; wait if blocked + F_SETLKW = 9 +) + +// F_SETLK; wait if blocked, return on timeout +const F_SETLKWTIMEOUT = 10 + +const ( + F_FLUSH_DATA = 40 + // Used for regression test + F_CHKCLEAN = 41 + // Preallocate storage + F_PREALLOCATE = 42 + // Truncate a file. Equivalent to calling truncate(2) + F_SETSIZE = 43 + // Issue an advisory read async with no copy to user + F_RDADVISE = 44 + // turn read ahead off/on for this fd + F_RDAHEAD = 45 +) + +// 46,47 used to be F_READBOOTSTRAP and F_WRITEBOOTSTRAP +const ( + F_NOCACHE = 48 + // file offset to device offset + F_LOG2PHYS = 49 + // return the full path of the fd + F_GETPATH = 50 + // fsync + ask the drive to flush to the media + F_FULLFSYNC = 51 + // find which component (if any) is a package + F_PATHPKG_CHECK = 52 + // "freeze" all fs operations + F_FREEZE_FS = 53 + // "thaw" all fs operations + F_THAW_FS = 54 + // turn data caching off/on (globally) for this file + F_GLOBAL_NOCACHE = 55 +) + +// add detached signatures +const F_ADDSIGS = 59 + +// add signature from same file (used by dyld for shared libs) +const F_ADDFILESIGS = 61 + +// used in conjunction with F_NOCACHE to indicate that DIRECT, synchonous writes +const F_NODIRECT = 62 + +const ( + // Get the protection class of a file from the EA, returns int + F_GETPROTECTIONCLASS = 63 + // Set the protection class of a file for the EA, requires int + F_SETPROTECTIONCLASS = 64 +) + +// file offset to device offset, extended +const F_LOG2PHYS_EXT = 65 + +// See man fcntl(2) F_GETLK +// Similar to F_GETLK but in addition l_pid is treated as an input parameter +// which is used as a matching value when searching locks on the file +// so that only locks owned by the process with pid l_pid are returned. +// However, any flock(2) type lock will also be found with the returned value +// of l_pid set to -1 (as with F_GETLK). +const F_GETLKPID = 66 + +const ( + // Mark the file as being the backing store for another filesystem + F_SETBACKINGSTORE = 70 + // return the full path of the FD, but error in specific mtmd circumstances + F_GETPATH_MTMINFO = 71 +) + +// Returns the code directory, with associated hashes, to the caller +const F_GETCODEDIR = 72 + +const ( + // No SIGPIPE generated on EPIPE + F_SETNOSIGPIPE = 73 + // Status of SIGPIPE for this fd + F_GETNOSIGPIPE = 74 +) + +// For some cases, we need to rewrap the key for AKS/MKB +const F_TRANSCODEKEY = 75 + +// file being written to a by single writer... if throttling enabled, writes +const F_SINGLE_WRITER = 76 + +// Get the protection version number for this filesystem +const F_GETPROTECTIONLEVEL = 77 + +// Add detached code signatures (used by dyld for shared libs) +const F_FINDSIGS = 78 + +// Add signature from same file, only if it is signed by Apple (used by dyld for simulator) +const F_ADDFILESIGS_FOR_DYLD_SIM = 83 + +// fsync + issue barrier to drive +const F_BARRIERFSYNC = 85 + +const ( + // Acquire or release open file description lock + F_OFD_SETLK = 90 + // (as F_OFD_SETLK but blocking if conflicting lock) + F_OFD_SETLKW = 91 + // Examine OFD lock + F_OFD_GETLK = 92 +) + +// (as F_OFD_SETLKW but return if timeout) +const F_OFD_SETLKWTIMEOUT = 93 + +const ( + // Add signature from same file, return end offset in structure on success + F_ADDFILESIGS_RETURN = 97 + // Check if Library Validation allows this Mach-O file to be mapped into the calling process + F_CHECK_LV = 98 +) + +// Deallocate a range of the file +const F_PUNCHHOLE = 99 + +// Trim an active file +const F_TRIM_ACTIVE_FILE = 100 + +// Asynchronous advisory read fcntl for regular and compressed file +const F_SPECULATIVE_READ = 101 + +// return the full path without firmlinks of the fd +const F_GETPATH_NOFIRMLINK = 102 + +const ( + // Add signature from same file, return information + F_ADDFILESIGS_INFO = 103 + // Add supplemental signature from same file with fd reference to original + F_ADDFILESUPPL = 104 + // Look up code signature information attached to a file or slice + F_GETSIGSINFO = 105 +) + +const ( + // Acquire or release lease + F_SETLEASE = 106 + // Retrieve lease information + F_GETLEASE = 107 +) + +// Transfer allocated extents beyond leof to a different file +const F_TRANSFEREXTENTS = 110 + +// Based on flags, query/set/delete a file's attribution tag +const F_ATTRIBUTION_TAG = 111 + +// FS-specific fcntl()'s numbers begin at 0x00010000 and go up +const FCNTL_FS_SPECIFIC_BASE = 65536 + +// mark the dup with FD_CLOEXEC +const F_DUPFD_CLOEXEC = 67 + +// file descriptor flags (F_GETFD, F_SETFD) +const FD_CLOEXEC = 1 + +// record locking flags (F_GETLK, F_SETLK, F_SETLKW) +const ( + F_RDLCK = 1 + // unlock + F_UNLCK = 2 + // exclusive or write lock + F_WRLCK = 3 +) + +const ( + // allocate contigious space + F_ALLOCATECONTIG = 2 + // allocate all requested space or no space at all + F_ALLOCATEALL = 4 + // do not free space upon close(2) + F_ALLOCATEPERSIST = 8 +) + +// Make it past all of the SEEK pos modes so that +const F_PEOFPOSMODE = 3 + +// we can keep them in sync should we desire +const F_VOLPOSMODE = 4 + +// detached code signatures data type - +// information passed by user to system used by F_ADDSIGS and F_ADDFILESIGS. +// F_ADDFILESIGS is a shortcut for files that contain their own signature and +// doesn't require mapping of the file in order to load the signature. +const USER_FSIGNATURES_CDHASH_LEN = 20 + +// At this time F_GETSIGSINFO can only indicate platformness. +// +// As additional requestable information is defined, new keys will be added and the +// fgetsigsinfo_t structure will be lengthened to add space for the additional information +const GETSIGSINFO_PLATFORM_BINARY = 1 + +// lock operations for flock(2) +const ( + LOCK_SH = 1 + // exclusive file lock + LOCK_EX = 2 + // don't block when locking + LOCK_NB = 4 + // unlock file + LOCK_UN = 8 +) + +// fattributiontag_t used by F_ATTRIBUTION_TAG +const ATTRIBUTION_NAME_MAX = 255 + +// ft_flags (F_ATTRIBUTION_TAG) +const ( + F_CREATE_TAG = 1 + F_DELETE_TAG = 2 + F_QUERY_TAG = 4 +) + +const ( + // force window to popup on open + O_POPUP = 2147483648 + // small, clean popup window + O_ALERT = 536870912 +) + +type FilesecPropertyT c.Uint + +const ( + FILESEC_OWNER FilesecPropertyT = 1 + FILESEC_GROUP FilesecPropertyT = 2 + FILESEC_UUID FilesecPropertyT = 3 + FILESEC_MODE FilesecPropertyT = 4 + FILESEC_ACL FilesecPropertyT = 5 + FILESEC_GRPUUID FilesecPropertyT = 6 + // XXX these are private to the implementation + FILESEC_ACL_RAW FilesecPropertyT = 100 + FILESEC_ACL_ALLOCSIZE FilesecPropertyT = 101 +) + +// data-protected non-portable open(2) : +// +// int open_dprotected_np(user_addr_t path, int flags, int class, int dpflags, int mode) +// +//go:linkname OpenxNp C.openx_np +func OpenxNp(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 FilesecT) c.Int + +// data-protected non-portable open(2) : +// +// int open_dprotected_np(user_addr_t path, int flags, int class, int dpflags, int mode) +// +//go:linkname OpenDprotectedNp C.open_dprotected_np +func OpenDprotectedNp(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 c.Int, __llgo_va_list ...any) c.Int + +//go:linkname OpenatDprotectedNp C.openat_dprotected_np +func OpenatDprotectedNp(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.Int, _llcppg_param4 c.Int, _llcppg_param5 c.Int, __llgo_va_list ...any) c.Int + +//go:linkname OpenatAuthenticatedNp C.openat_authenticated_np +func OpenatAuthenticatedNp(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.Int, _llcppg_param4 c.Int) c.Int + +//go:linkname Flock C.flock +func Flock(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname FilesecInit C.filesec_init +func FilesecInit() FilesecT + +// llgo:link FilesecT.FilesecDup C.filesec_dup +func (self FilesecT) FilesecDup() FilesecT { + return self +} + +// llgo:link FilesecT.FilesecFree C.filesec_free +func (self FilesecT) FilesecFree() { +} + +// llgo:link FilesecT.FilesecGetProperty C.filesec_get_property +func (self FilesecT) FilesecGetProperty(_llcppg_param2 FilesecPropertyT, _llcppg_param3 unsafe.Pointer) c.Int { + return 0 +} + +// llgo:link FilesecT.FilesecQueryProperty C.filesec_query_property +func (self FilesecT) FilesecQueryProperty(_llcppg_param2 FilesecPropertyT, _llcppg_param3 *c.Int) c.Int { + return 0 +} + +// llgo:link FilesecT.FilesecSetProperty C.filesec_set_property +func (self FilesecT) FilesecSetProperty(_llcppg_param2 FilesecPropertyT, _llcppg_param3 unsafe.Pointer) c.Int { + return 0 +} + +// llgo:link FilesecT.FilesecUnsetProperty C.filesec_unset_property +func (self FilesecT) FilesecUnsetProperty(_llcppg_param2 FilesecPropertyT) c.Int { + return 0 +} + +// Protections are chosen from these bits, or-ed together +const ( + PROT_NONE = 0 + // [MC2] pages can be read + PROT_READ = 1 + // [MC2] pages can be written + PROT_WRITE = 2 + // [MC2] pages can be executed + PROT_EXEC = 4 +) + +// Flags contain sharing type and options. +// Sharing types; choose one. +const ( + MAP_SHARED = 1 + // [MF|SHM] changes are private + MAP_PRIVATE = 2 +) + +// Obsolete +const MAP_COPY = 2 + +// Other flags +const MAP_FIXED = 16 + +const ( + // Sun: rename private pages to file + MAP_RENAME = 32 + // Sun: don't reserve needed swap area + MAP_NORESERVE = 64 + // previously unimplemented MAP_INHERIT + MAP_RESERVED0080 = 128 + // for MAP_FILE, don't change file size + MAP_NOEXTEND = 256 + // region may contain semaphores + MAP_HASSEMAPHORE = 512 + // don't cache pages for this mapping + MAP_NOCACHE = 1024 + // Allocate a region that will be used for JIT purposes + MAP_JIT = 2048 +) + +// Mapping type +const ( + MAP_FILE = 0 + // allocated from memory, swap space + MAP_ANON = 4096 + MAP_ANONYMOUS = 4096 +) + +// The MAP_RESILIENT_* flags can be used when the caller wants to map some +// possibly unreliable memory and be able to access it safely, possibly +// getting the wrong contents rather than raising any exception. +// For safety reasons, such mappings have to be read-only (PROT_READ access +// only). +// +// MAP_RESILIENT_CODESIGN: +// +// accessing this mapping will not generate code-signing violations, +// even if the contents are tainted. +// +// MAP_RESILIENT_MEDIA: +// +// accessing this mapping will not generate an exception if the contents +// are not available (unreachable removable or remote media, access beyond +// end-of-file, ...). Missing contents will be replaced with zeroes. +const ( + MAP_RESILIENT_CODESIGN = 8192 + // no backing-store failures + MAP_RESILIENT_MEDIA = 16384 +) + +// Return virtual addresses <4G only +const MAP_32BIT = 32768 + +// Flags used to support translated processes. +const MAP_TRANSLATED_ALLOW_EXECUTE = 131072 + +// UNIX03 compliance +const MAP_UNIX03 = 262144 + +// Allocate a region that will be protected by TPRO +const MAP_TPRO = 524288 + +// Process memory locking +const ( + MCL_CURRENT = 1 + // [ML] Lock all future memory as well + MCL_FUTURE = 2 +) + +// msync() flags +const ( + MS_ASYNC = 1 + // [MF|SIO] invalidate all cached data + MS_INVALIDATE = 2 + // [MF|SIO] msync synchronously + MS_SYNC = 16 +) + +const ( + // invalidate pages, leave mapped + MS_KILLPAGES = 4 + // deactivate pages, leave mapped + MS_DEACTIVATE = 8 +) + +// Advice to madvise +const ( + POSIX_MADV_NORMAL = 0 + // [MC1] expect random page refs + POSIX_MADV_RANDOM = 1 + // [MC1] expect sequential page refs + POSIX_MADV_SEQUENTIAL = 2 + // [MC1] will need these pages + POSIX_MADV_WILLNEED = 3 + // [MC1] dont need these pages + POSIX_MADV_DONTNEED = 4 +) + +const ( + MADV_NORMAL = 0 + MADV_RANDOM = 1 + MADV_SEQUENTIAL = 2 + MADV_WILLNEED = 3 + MADV_DONTNEED = 4 + // pages unneeded, discard contents + MADV_FREE = 5 + // zero the wired pages that have not been unwired before the entry is deleted + MADV_ZERO_WIRED_PAGES = 6 + // pages can be reused (by anyone) + MADV_FREE_REUSABLE = 7 + // caller wants to reuse those pages + MADV_FREE_REUSE = 8 + MADV_CAN_REUSE = 9 + // page out now (internal only) + MADV_PAGEOUT = 10 +) + +// Return bits from mincore +const ( + MINCORE_INCORE = 1 + // Page has been referenced by us + MINCORE_REFERENCED = 2 + // Page has been modified by us + MINCORE_MODIFIED = 4 + // Page has been referenced + MINCORE_REFERENCED_OTHER = 8 + // Page has been modified + MINCORE_MODIFIED_OTHER = 16 + // Page has been paged out + MINCORE_PAGED_OUT = 32 + // Page has been copied + MINCORE_COPIED = 64 + // Page belongs to an anonymous object + MINCORE_ANONYMOUS = 128 +) + +// [ML] +// +//go:linkname Mlockall C.mlockall +func Mlockall(_llcppg_param1 c.Int) c.Int + +// [MR] +// +//go:linkname Munlockall C.munlockall +func Munlockall() c.Int + +// [MR] +// +//go:linkname Mlock C.mlock +func Mlock(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT) c.Int + +// [MC3] +// +//go:linkname Mmap C.mmap +func Mmap(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 c.Int, _llcppg_param4 c.Int, _llcppg_param5 c.Int, _llcppg_param6 OffT) unsafe.Pointer + +// [MPR] +// +//go:linkname Mprotect C.mprotect +func Mprotect(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 c.Int) c.Int + +// [MF|SIO] +// +//go:linkname Msync C.msync +func Msync(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 c.Int) c.Int + +// [MR] +// +//go:linkname Munlock C.munlock +func Munlock(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT) c.Int + +// [MC3] +// +//go:linkname Munmap C.munmap +func Munmap(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT) c.Int + +// [SHM] +// +//go:linkname ShmOpen C.shm_open +func ShmOpen(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, __llgo_va_list ...any) c.Int + +// [ADV] +// +//go:linkname ShmUnlink C.shm_unlink +func ShmUnlink(_llcppg_param1 *c.Char) c.Int + +// [ADV] +// +//go:linkname PosixMadvise C.posix_madvise +func PosixMadvise(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 c.Int) c.Int + +//go:linkname Madvise C.madvise +func Madvise(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 c.Int) c.Int + +//go:linkname Mincore C.mincore +func Mincore(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 *c.Char) c.Int + +//go:linkname Minherit C.minherit +func Minherit(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 c.Int) c.Int + +// Possible values of the first parameter to getpriority()/setpriority(), +// used to indicate the type of the second parameter. +const ( + PRIO_PROCESS = 0 + // Second argument is a GID + PRIO_PGRP = 1 + // Second argument is a UID + PRIO_USER = 2 +) + +const ( + // Second argument is always 0 (current thread) + PRIO_DARWIN_THREAD = 3 + // Second argument is a PID + PRIO_DARWIN_PROCESS = 4 +) + +// Range limitations for the value of the third parameter to setpriority(). +const ( + PRIO_MIN = -20 + PRIO_MAX = 20 +) + +// use PRIO_DARWIN_BG to set the current thread into "background" state +// which lowers CPU, disk IO, and networking priorites until thread terminates +// or "background" state is revoked +const PRIO_DARWIN_BG = 4096 + +// use PRIO_DARWIN_NONUI to restrict a process's ability to make calls to +// the GPU. (deprecated) +const PRIO_DARWIN_NONUI = 4097 + +// Possible values of the first parameter to getrusage(), used to indicate +// the scope of the information to be returned. +const ( + RUSAGE_SELF = 0 + // Current process' children + RUSAGE_CHILDREN = -1 +) + +// Flavors for proc_pid_rusage(). +const ( + RUSAGE_INFO_V0 = 0 + RUSAGE_INFO_V1 = 1 + RUSAGE_INFO_V2 = 2 + RUSAGE_INFO_V3 = 3 + RUSAGE_INFO_V4 = 4 + RUSAGE_INFO_V5 = 5 + RUSAGE_INFO_V6 = 6 + RUSAGE_INFO_CURRENT = 6 +) + +// Flags for RUSAGE_INFO_V5 +const RU_PROC_RUNS_RESLIDE = 1 + +// Possible values of the first parameter to getrlimit()/setrlimit(), to +// indicate for which resource the operation is being performed. +const ( + RLIMIT_CPU = 0 + // file size + RLIMIT_FSIZE = 1 + // data segment size + RLIMIT_DATA = 2 + // stack size + RLIMIT_STACK = 3 + // core file size + RLIMIT_CORE = 4 + // address space (resident set size) + RLIMIT_AS = 5 +) + +const ( + // source compatibility alias + RLIMIT_RSS = 5 + // locked-in-memory address space + RLIMIT_MEMLOCK = 6 + // number of processes + RLIMIT_NPROC = 7 +) + +// number of open files +const RLIMIT_NOFILE = 8 + +// total number of resource limits +const RLIM_NLIMITS = 9 + +// proc_rlimit_control() +// +// Resource limit flavors +const ( + RLIMIT_WAKEUPS_MONITOR = 1 + // Configure the CPU usage monitor. + RLIMIT_CPU_USAGE_MONITOR = 2 + // Configure a blocking, per-thread, CPU limits. + RLIMIT_THREAD_CPULIMITS = 3 + // Configure memory footprint interval tracking + RLIMIT_FOOTPRINT_INTERVAL = 4 +) + +// Flags for wakeups monitor control. +const ( + WAKEMON_ENABLE = 1 + WAKEMON_DISABLE = 2 + WAKEMON_GET_PARAMS = 4 + WAKEMON_SET_DEFAULTS = 8 + // Configure the task so that violations are fatal. + WAKEMON_MAKE_FATAL = 16 +) + +// Flags for CPU usage monitor control. +const CPUMON_MAKE_FATAL = 4096 + +// Flags for memory footprint interval tracking. +const FOOTPRINT_INTERVAL_RESET = 1 + +// I/O type +const ( + IOPOL_TYPE_DISK = 0 + IOPOL_TYPE_VFS_ATIME_UPDATES = 2 + IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES = 3 + IOPOL_TYPE_VFS_STATFS_NO_DATA_VOLUME = 4 + IOPOL_TYPE_VFS_TRIGGER_RESOLVE = 5 + IOPOL_TYPE_VFS_IGNORE_CONTENT_PROTECTION = 6 + IOPOL_TYPE_VFS_IGNORE_PERMISSIONS = 7 + IOPOL_TYPE_VFS_SKIP_MTIME_UPDATE = 8 + IOPOL_TYPE_VFS_ALLOW_LOW_SPACE_WRITES = 9 + IOPOL_TYPE_VFS_DISALLOW_RW_FOR_O_EVTONLY = 10 +) + +// scope +const ( + IOPOL_SCOPE_PROCESS = 0 + IOPOL_SCOPE_THREAD = 1 + IOPOL_SCOPE_DARWIN_BG = 2 +) + +// I/O Priority +const ( + IOPOL_DEFAULT = 0 + IOPOL_IMPORTANT = 1 + IOPOL_PASSIVE = 2 + IOPOL_THROTTLE = 3 + IOPOL_UTILITY = 4 + IOPOL_STANDARD = 5 +) + +// compatibility with older names +const ( + IOPOL_APPLICATION = 5 + IOPOL_NORMAL = 1 +) + +const ( + IOPOL_ATIME_UPDATES_DEFAULT = 0 + IOPOL_ATIME_UPDATES_OFF = 1 +) + +const ( + IOPOL_MATERIALIZE_DATALESS_FILES_DEFAULT = 0 + IOPOL_MATERIALIZE_DATALESS_FILES_OFF = 1 + IOPOL_MATERIALIZE_DATALESS_FILES_ON = 2 +) + +const ( + IOPOL_VFS_STATFS_NO_DATA_VOLUME_DEFAULT = 0 + IOPOL_VFS_STATFS_FORCE_NO_DATA_VOLUME = 1 +) + +const ( + IOPOL_VFS_TRIGGER_RESOLVE_DEFAULT = 0 + IOPOL_VFS_TRIGGER_RESOLVE_OFF = 1 +) + +const ( + IOPOL_VFS_CONTENT_PROTECTION_DEFAULT = 0 + IOPOL_VFS_CONTENT_PROTECTION_IGNORE = 1 +) + +const ( + IOPOL_VFS_IGNORE_PERMISSIONS_OFF = 0 + IOPOL_VFS_IGNORE_PERMISSIONS_ON = 1 +) + +const ( + IOPOL_VFS_SKIP_MTIME_UPDATE_OFF = 0 + IOPOL_VFS_SKIP_MTIME_UPDATE_ON = 1 +) + +const ( + IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_OFF = 0 + IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_ON = 1 +) + +const ( + IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_DEFAULT = 0 + IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_ON = 1 +) + +const ( + IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_DEFAULT = 0 + IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_ON = 1 +) + +// A structure representing an accounting of resource utilization. The +// address of an instance of this structure is the second parameter to +// getrusage(). +// +// Note: All values other than ru_utime and ru_stime are implementaiton +// +// defined and subject to change in a future release. Their use +// is discouraged for standards compliant programs. +type Rusage struct { + RuUtime llsys.Timeval + RuStime llsys.Timeval + RuMaxrss c.Long + RuIxrss c.Long + RuIdrss c.Long + RuIsrss c.Long + RuMinflt c.Long + RuMajflt c.Long + RuNswap c.Long + RuInblock c.Long + RuOublock c.Long + RuMsgsnd c.Long + RuMsgrcv c.Long + RuNsignals c.Long + RuNvcsw c.Long + RuNivcsw c.Long +} + +//go:linkname Getpriority C.getpriority +func Getpriority(_llcppg_param1 c.Int, _llcppg_param2 IdT) c.Int + +//go:linkname GetiopolicyNp C.getiopolicy_np +func GetiopolicyNp(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname Getrusage C.getrusage +func Getrusage(_llcppg_param1 c.Int, _llcppg_param2 *Rusage) c.Int + +//go:linkname Setpriority C.setpriority +func Setpriority(_llcppg_param1 c.Int, _llcppg_param2 IdT, _llcppg_param3 c.Int) c.Int + +//go:linkname SetiopolicyNp C.setiopolicy_np +func SetiopolicyNp(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int) c.Int + +//go:linkname Pselect C.pselect +func Pselect(_llcppg_param1 c.Int, _llcppg_param2 *llsys.FdSet, _llcppg_param3 *llsys.FdSet, _llcppg_param4 *llsys.FdSet, _llcppg_param5 *lltime.Timespec, _llcppg_param6 *llsignal.SigsetT) c.Int + +type Sigval struct { + _xgo_union [1]uint64 +} + +type X__Siginfo struct { + SiSigno c.Int + SiErrno c.Int + SiCode c.Int + SiPid PidT + SiUid UidT + SiStatus c.Int + SiAddr unsafe.Pointer + SiValue Sigval + SiBand c.Long + X__Pad [7]c.Ulong +} + +type SiginfoT = X__Siginfo + +func (p *Sigval) XGof_ref_sival_int() *c.Int { + return (*c.Int)(unsafe.Pointer(p)) +} + +func (p *Sigval) XGof_ref_sival_ptr() *unsafe.Pointer { + return (*unsafe.Pointer)(unsafe.Pointer(p)) +} + +// 0777 +const ACCESSPERMS = 511 + +// 7777 +const ALLPERMS = 4095 + +// 0666 +const DEFFILEMODE = 438 + +// block size used in the stat struct +const S_BLKSIZE = 512 + +// Definitions of flags stored in file flags word. +// +// Super-user and owner changeable flags. +const ( + UF_SETTABLE = 65535 + // do not dump file + UF_NODUMP = 1 + // file may not be changed + UF_IMMUTABLE = 2 + // writes to file may only append + UF_APPEND = 4 + // directory is opaque wrt. union + UF_OPAQUE = 8 +) + +// file is compressed (some file-systems) +const UF_COMPRESSED = 32 + +// UF_TRACKED is used for dealing with document IDs. We no longer issue +// +// notifications for deletes or renames for files which have UF_TRACKED set. +const UF_TRACKED = 64 + +// entitlement required for reading +const UF_DATAVAULT = 128 + +// Bits 0x0100 through 0x4000 are currently undefined. +const UF_HIDDEN = 32768 + +// Super-user changeable flags. +const ( + SF_SUPPORTED = 10420224 + // mask of superuser changeable flags + SF_SETTABLE = 1073676288 + // mask of system read-only synthetic flags + SF_SYNTHETIC = 3221225472 + // file is archived + SF_ARCHIVED = 65536 + // file may not be changed + SF_IMMUTABLE = 131072 + // writes to file may only append + SF_APPEND = 262144 + // entitlement required for writing + SF_RESTRICTED = 524288 + // Item may not be removed, renamed or mounted on + SF_NOUNLINK = 1048576 +) + +// file is a firmlink +const SF_FIRMLINK = 8388608 + +// Synthetic flags. +// +// These are read-only. We keep them out of SF_SUPPORTED so that +// attempts to set them will fail. +const SF_DATALESS = 1073741824 + +// Extended flags ("EF") returned by ATTR_CMNEXT_EXT_FLAGS from getattrlist/getattrlistbulk +const ( + EF_MAY_SHARE_BLOCKS = 1 + // file has no xattrs at all + EF_NO_XATTRS = 2 + // file is a sync root for iCloud + EF_IS_SYNC_ROOT = 4 + // file is purgeable + EF_IS_PURGEABLE = 8 + // file has at least one sparse region + EF_IS_SPARSE = 16 + // a synthetic directory/symlink + EF_IS_SYNTHETIC = 32 + // file shares all of its blocks with another file + EF_SHARES_ALL_BLOCKS = 64 +) + +const ( + UTIME_NOW = -1 + UTIME_OMIT = -2 +) + +//go:linkname Mkdirat C.mkdirat +func Mkdirat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 ModeT) c.Int + +//go:linkname Mkfifoat C.mkfifoat +func Mkfifoat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 ModeT) c.Int + +//go:linkname Mknodat C.mknodat +func Mknodat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 ModeT, _llcppg_param4 DevT) c.Int + +//go:linkname Futimens C.futimens +func Futimens(__fd c.Int, __times *lltime.Timespec) c.Int + +//go:linkname Utimensat C.utimensat +func Utimensat(__fd c.Int, __path *c.Char, __times *lltime.Timespec, __flag c.Int) c.Int + +//go:linkname Chflags C.chflags +func Chflags(_llcppg_param1 *c.Char, _llcppg_param2 c.Uint32T) c.Int + +//go:linkname ChmodxNp C.chmodx_np +func ChmodxNp(_llcppg_param1 *c.Char, _llcppg_param2 FilesecT) c.Int + +//go:linkname Fchflags C.fchflags +func Fchflags(_llcppg_param1 c.Int, _llcppg_param2 c.Uint32T) c.Int + +//go:linkname FchmodxNp C.fchmodx_np +func FchmodxNp(_llcppg_param1 c.Int, _llcppg_param2 FilesecT) c.Int + +//go:linkname FstatxNp C.fstatx_np +func FstatxNp(_llcppg_param1 c.Int, _llcppg_param2 *StatT, _llcppg_param3 FilesecT) c.Int + +//go:linkname Lchflags C.lchflags +func Lchflags(_llcppg_param1 *c.Char, _llcppg_param2 c.Uint32T) c.Int + +//go:linkname Lchmod C.lchmod +func Lchmod(_llcppg_param1 *c.Char, _llcppg_param2 ModeT) c.Int + +//go:linkname LstatxNp C.lstatx_np +func LstatxNp(_llcppg_param1 *c.Char, _llcppg_param2 *StatT, _llcppg_param3 FilesecT) c.Int + +//go:linkname MkdirxNp C.mkdirx_np +func MkdirxNp(_llcppg_param1 *c.Char, _llcppg_param2 FilesecT) c.Int + +//go:linkname MkfifoxNp C.mkfifox_np +func MkfifoxNp(_llcppg_param1 *c.Char, _llcppg_param2 FilesecT) c.Int + +//go:linkname StatxNp C.statx_np +func StatxNp(_llcppg_param1 *c.Char, _llcppg_param2 *StatT, _llcppg_param3 FilesecT) c.Int + +// llgo:link FilesecT.UmaskxNp C.umaskx_np +func (self FilesecT) UmaskxNp() c.Int { + return 0 +} + +// Defined bits for f_flag field value +const ( + ST_RDONLY = 1 + // Does not honor setuid/setgid + ST_NOSUID = 2 +) + +// Following structure is used as a statvfs/fstatvfs function parameter +type Statvfs struct { + FBsize c.Ulong + FFrsize c.Ulong + FBlocks FsblkcntT + FBfree FsblkcntT + FBavail FsblkcntT + FFiles FsfilcntT + FFfree FsfilcntT + FFavail FsfilcntT + FFsid c.Ulong + FFlag c.Ulong + FNamemax c.Ulong +} + +//go:linkname Fstatvfs C.fstatvfs +func Fstatvfs(_llcppg_param1 c.Int, _llcppg_param2 *Statvfs) c.Int + +// Special Control Characters +// +// Index into c_cc[] character array. +// +// Name Subscript Enabled by +const ( + VEOF = 0 + // ICANON + VEOL = 1 +) + +// ICANON together with IEXTEN +const VEOL2 = 2 + +// ICANON +const VERASE = 3 + +// ICANON together with IEXTEN +const VWERASE = 4 + +// ICANON +const VKILL = 5 + +// ICANON together with IEXTEN +const VREPRINT = 6 + +// 7 spare 1 +const ( + VINTR = 8 + // ISIG + VQUIT = 9 + // ISIG + VSUSP = 10 +) + +// ISIG together with IEXTEN +const VDSUSP = 11 + +const ( + // IXON, IXOFF + VSTART = 12 + // IXON, IXOFF + VSTOP = 13 +) + +const ( + // IEXTEN + VLNEXT = 14 + // IEXTEN + VDISCARD = 15 +) + +const ( + // !ICANON + VMIN = 16 + // !ICANON + VTIME = 17 +) + +// ICANON together with IEXTEN +const VSTATUS = 18 + +const NCCS = 20 + +// Input flags - software input processing +const ( + IGNBRK = 1 + // map BREAK to SIGINTR + BRKINT = 2 + // ignore (discard) parity errors + IGNPAR = 4 + // mark parity and framing errors + PARMRK = 8 + // enable checking of parity errors + INPCK = 16 + // strip 8th bit off chars + ISTRIP = 32 + // map NL into CR + INLCR = 64 + // ignore CR + IGNCR = 128 + // map CR to NL (ala CRMOD) + ICRNL = 256 + // enable output flow control + IXON = 512 + // enable input flow control + IXOFF = 1024 + // any char will restart after stop + IXANY = 2048 +) + +const ( + // ring bell on input queue full + IMAXBEL = 8192 + // maintain state for UTF-8 VERASE + IUTF8 = 16384 +) + +// Output flags - software output processing +const ( + OPOST = 1 + // map NL to CR-NL (ala CRMOD) + ONLCR = 2 +) + +const ( + // expand tabs to spaces + OXTABS = 4 + // discard EOT's (^D) on output) + ONOEOT = 8 +) + +// The following block of features is unimplemented. Use of these flags in +// programs will currently result in unexpected behaviour. +// +// - Begin unimplemented features +const ( + OCRNL = 16 + // no CR output at column 0 + ONOCR = 32 + // NL performs CR function + ONLRET = 64 + // use fill characters for delay + OFILL = 128 + // \n delay + NLDLY = 768 + // horizontal tab delay + TABDLY = 3076 + // \r delay + CRDLY = 12288 + // form feed delay + FFDLY = 16384 + // \b delay + BSDLY = 32768 + // vertical tab delay + VTDLY = 65536 + // fill is DEL, else NUL + OFDEL = 131072 +) + +// These manifest constants have the same names as those in the header +// , so you are not permitted to have both definitions +// in scope simultaneously in the same compilation unit. Nevertheless, +// they are required to be in scope when _POSIX_C_SOURCE is requested; +// this means that including the header before this +// one when _POSIX_C_SOURCE is in scope will result in redefintions. We +// attempt to maintain these as the same values so as to avoid this being +// an outright error in most compilers. +const ( + NL0 = 0 + NL1 = 256 +) + +const ( + NL2 = 512 + NL3 = 768 +) + +// not in sys/ioctl_compat.h, use OXTABS value +const ( + TAB0 = 0 + TAB1 = 1024 + TAB2 = 2048 +) + +// not in sys/ioctl_compat.h, use OXTABS value +const ( + TAB3 = 4 + CR0 = 0 + CR1 = 4096 + CR2 = 8192 + CR3 = 12288 + FF0 = 0 + FF1 = 16384 + BS0 = 0 + BS1 = 32768 + VT0 = 0 + VT1 = 65536 +) + +// ignore control flags +const CIGNORE = 1 + +const ( + // character size mask + CSIZE = 768 + // 5 bits (pseudo) + CS5 = 0 + // 6 bits + CS6 = 256 + // 7 bits + CS7 = 512 + // 8 bits + CS8 = 768 + // send 2 stop bits + CSTOPB = 1024 + // enable receiver + CREAD = 2048 + // parity enable + PARENB = 4096 + // odd parity, else even + PARODD = 8192 + // hang up on last close + HUPCL = 16384 + // ignore modem status lines + CLOCAL = 32768 +) + +const ( + // CTS flow control of output + CCTS_OFLOW = 65536 + // RTS flow control of input + CRTS_IFLOW = 131072 + // DTR flow control of input + CDTR_IFLOW = 262144 + // DSR flow control of output + CDSR_OFLOW = 524288 + // DCD flow control of output + CCAR_OFLOW = 1048576 + // old name for CCAR_OFLOW + MDMBUF = 1048576 +) + +// visual erase for line kill +const ECHOKE = 1 + +const ( + // visually erase chars + ECHOE = 2 + // echo NL after line kill + ECHOK = 4 + // enable echoing + ECHO = 8 + // echo NL even if ECHO is off + ECHONL = 16 +) + +const ( + // visual erase mode for hardcopy + ECHOPRT = 32 + // echo control chars as ^(Char) + ECHOCTL = 64 +) + +const ( + // enable signals INTR, QUIT, [D]SUSP + ISIG = 128 + // canonicalize input lines + ICANON = 256 +) + +// use alternate WERASE algorithm +const ALTWERASE = 512 + +// enable DISCARD and LNEXT +const IEXTEN = 1024 + +// external processing +const EXTPROC = 2048 + +// stop background jobs from output +const TOSTOP = 4194304 + +const ( + // output being flushed (state) + FLUSHO = 8388608 + // no kernel output from VSTATUS + NOKERNINFO = 33554432 + // XXX retype pending input (state) + PENDIN = 536870912 +) + +// don't flush after interrupt +const NOFLSH = 2147483648 + +// Commands passed to tcsetattr() for setting the termios structure. +const ( + TCSANOW = 0 + // drain output, then change + TCSADRAIN = 1 + // drain output, flush input + TCSAFLUSH = 2 +) + +// flag - don't alter h.w. state +const TCSASOFT = 16 + +// Standard speeds +const ( + B0 = 0 + B50 = 50 + B75 = 75 + B110 = 110 + B134 = 134 + B150 = 150 + B200 = 200 + B300 = 300 + B600 = 600 + B1200 = 1200 + B1800 = 1800 + B2400 = 2400 + B4800 = 4800 + B9600 = 9600 + B19200 = 19200 + B38400 = 38400 +) + +const ( + B7200 = 7200 + B14400 = 14400 + B28800 = 28800 + B57600 = 57600 + B76800 = 76800 + B115200 = 115200 + B230400 = 230400 + EXTA = 19200 + EXTB = 38400 +) + +const ( + TCIFLUSH = 1 + TCOFLUSH = 2 + TCIOFLUSH = 3 + TCOOFF = 1 + TCOON = 2 + TCIOFF = 3 + TCION = 4 +) + +// llgo:link (*Termios).Cfgetispeed C.cfgetispeed +func (self *Termios) Cfgetispeed() SpeedT { + return 0 +} + +// llgo:link (*Termios).Cfgetospeed C.cfgetospeed +func (self *Termios) Cfgetospeed() SpeedT { + return 0 +} + +// llgo:link (*Termios).Cfsetispeed C.cfsetispeed +func (self *Termios) Cfsetispeed(_llcppg_param2 SpeedT) c.Int { + return 0 +} + +// llgo:link (*Termios).Cfsetospeed C.cfsetospeed +func (self *Termios) Cfsetospeed(_llcppg_param2 SpeedT) c.Int { + return 0 +} + +//go:linkname Tcgetattr C.tcgetattr +func Tcgetattr(_llcppg_param1 c.Int, _llcppg_param2 *Termios) c.Int + +//go:linkname Tcsetattr C.tcsetattr +func Tcsetattr(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 *Termios) c.Int + +//go:linkname Tcdrain C.tcdrain +func Tcdrain(_llcppg_param1 c.Int) c.Int + +//go:linkname Tcflow C.tcflow +func Tcflow(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname Tcflush C.tcflush +func Tcflush(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname Tcsendbreak C.tcsendbreak +func Tcsendbreak(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +// llgo:link (*Termios).Cfmakeraw C.cfmakeraw +func (self *Termios) Cfmakeraw() { +} + +// llgo:link (*Termios).Cfsetspeed C.cfsetspeed +func (self *Termios) Cfsetspeed(_llcppg_param2 SpeedT) c.Int { + return 0 +} + +// [XSI] Structure whose address is passed as the first parameter to times() +type Tms struct { + TmsUtime lltime.ClockT + TmsStime lltime.ClockT + TmsCutime lltime.ClockT + TmsCstime lltime.ClockT +} + +// llgo:link (*Tms).Times C.times +func (self *Tms) Times() lltime.ClockT { + return 0 +} + +const NBBY = 8 + +// IO direction for uio_t. +// +// UIO_READ - data moves into iovec(s) associated with uio_t +// UIO_WRITE - data moves out of iovec(s) associated with uio_t +type UioRw c.Uint + +const ( + // IO direction for uio_t. + // UIO_READ - data moves into iovec(s) associated with uio_t + // UIO_WRITE - data moves out of iovec(s) associated with uio_t + UIO_READ UioRw = 0 + // IO direction for uio_t. + // UIO_READ - data moves into iovec(s) associated with uio_t + // UIO_WRITE - data moves out of iovec(s) associated with uio_t + UIO_WRITE UioRw = 1 +) + +//go:linkname Readv C.readv +func Readv(_llcppg_param1 c.Int, _llcppg_param2 *c.Iovec, _llcppg_param3 c.Int) c.SsizeT + +//go:linkname Writev C.writev +func Writev(_llcppg_param1 c.Int, _llcppg_param2 *c.Iovec, _llcppg_param3 c.Int) c.SsizeT + +//go:linkname Preadv C.preadv +func Preadv(_llcppg_param1 c.Int, _llcppg_param2 *c.Iovec, _llcppg_param3 c.Int, _llcppg_param4 OffT) c.SsizeT + +//go:linkname Pwritev C.pwritev +func Pwritev(_llcppg_param1 c.Int, _llcppg_param2 *c.Iovec, _llcppg_param3 c.Int, _llcppg_param4 OffT) c.SsizeT + +type AccessxDescriptor struct { + AdNameOffset c.Uint + AdFlags c.Int + AdPad [2]c.Int +} + +type Utsname struct { + Sysname [256]c.Char + Nodename [256]c.Char + Release [256]c.Char + Version [256]c.Char + Machine [256]c.Char +} + +// llgo:link (*Utsname).Uname C.uname +func (self *Utsname) Uname() c.Int { + return 0 +} + +// Option bits for the third argument of wait4. WNOHANG causes the +// wait to not hang if there are no stopped or terminated processes, rather +// returning an error indication in this case (pid==0). WUNTRACED +// indicates that the caller should receive status about untraced children +// which stop due to signals. If children are stopped and a wait without +// this option is done, it is as though they were still running... nothing +// about them is returned. +const ( + WNOHANG = 1 + // [XSI] notify on stop, untraced child + WUNTRACED = 2 +) + +const WCOREFLAG = 128 + +// WUNTRACED defined for wait4() but not for waitid() +const WEXITED = 4 + +// waitid() parameter +const WSTOPPED = 8 + +const ( + // [XSI] Any child stopped then continued + WCONTINUED = 16 + // [XSI] Leave process returned waitable + WNOWAIT = 32 +) + +// Tokens for special values of the "pid" parameter to wait4. +const ( + WAIT_ANY = -1 + // any process in my process group + WAIT_MYPGRP = 0 +) + +// [XSI] The type idtype_t shall be defined as an enumeration type whose +// possible values shall include at least P_ALL, P_PID, and P_PGID. +type IdtypeT c.Uint + +const ( + P_ALL IdtypeT = 0 + P_PID IdtypeT = 1 + P_PGID IdtypeT = 2 +) + +// llgo:link IdtypeT.Waitid C.waitid +func (self IdtypeT) Waitid(_llcppg_param2 IdT, _llcppg_param3 *SiginfoT, _llcppg_param4 c.Int) c.Int { + return 0 +} + +//go:linkname Tcgetsid C.tcgetsid +func Tcgetsid(_llcppg_param1 c.Int) PidT + +const ( + // standard input file descriptor + STDIN_FILENO = 0 + // standard output file descriptor + STDOUT_FILENO = 1 + // standard error file descriptor + STDERR_FILENO = 2 +) + +// These F_* are really XSI or Issue 6 +const ( + F_ULOCK = 0 + // lock a section for exclusive use + F_LOCK = 1 + // test and lock a section for exclusive use + F_TLOCK = 2 + // test a section for locks by other procs + F_TEST = 3 +) + +const ( + // Flush data and metadata to platter, not just to disk cache + SYNC_VOLUME_FULLSYNC = 1 + // Wait for sync to complete + SYNC_VOLUME_WAIT = 2 +) + +type Fssearchblock struct { +} + +type Searchstate struct { +} + +//go:linkname X_exit C._exit +func X_exit(_llcppg_param1 c.Int) + +//go:linkname Access C.access +func Access(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + +//go:linkname Alarm C.alarm +func Alarm(_llcppg_param1 c.Uint) c.Uint + +//go:linkname Fpathconf C.fpathconf +func Fpathconf(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Long + +//go:linkname Getgroups C.getgroups +func Getgroups(_llcppg_param1 c.Int, _llcppg_param2 *GidT) c.Int + +//go:linkname Getlogin C.getlogin +func Getlogin() *c.Char + +//go:linkname Getpgrp C.getpgrp +func Getpgrp() PidT + +//go:linkname Pathconf C.pathconf +func Pathconf(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Long + +//go:linkname Pause C.pause +func Pause() c.Int + +//go:linkname Setgid C.setgid +func Setgid(_llcppg_param1 GidT) c.Int + +//go:linkname Setpgid C.setpgid +func Setpgid(_llcppg_param1 PidT, _llcppg_param2 PidT) c.Int + +//go:linkname Setsid C.setsid +func Setsid() PidT + +//go:linkname Setuid C.setuid +func Setuid(_llcppg_param1 UidT) c.Int + +//go:linkname Sleep C.sleep +func Sleep(_llcppg_param1 c.Uint) c.Uint + +//go:linkname Sysconf C.sysconf +func Sysconf(_llcppg_param1 c.Int) c.Long + +//go:linkname Tcgetpgrp C.tcgetpgrp +func Tcgetpgrp(_llcppg_param1 c.Int) PidT + +//go:linkname Tcsetpgrp C.tcsetpgrp +func Tcsetpgrp(_llcppg_param1 c.Int, _llcppg_param2 PidT) c.Int + +//go:linkname Ttyname C.ttyname +func Ttyname(_llcppg_param1 c.Int) *c.Char + +//go:linkname TtynameR C.ttyname_r +func TtynameR(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.SizeT) c.Int + +//go:linkname Confstr C.confstr +func Confstr(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.SizeT) c.SizeT + +//go:linkname Getopt C.getopt +func Getopt(_llcppg_param1 c.Int, _llcppg_param2 **c.Char, _llcppg_param3 *c.Char) c.Int + +// getopt(3) external variables +// +//go:linkname Optarg C.optarg +var Optarg *c.Char + +//go:linkname Optind C.optind +var Optind c.Int + +//go:linkname Opterr C.opterr +var Opterr c.Int + +//go:linkname Optopt C.optopt +var Optopt c.Int + +//go:linkname Brk C.brk +func Brk(_llcppg_param1 unsafe.Pointer) unsafe.Pointer + +//go:linkname Crypt C.crypt +func Crypt(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char) *c.Char + +//go:linkname Encrypt C.encrypt +func Encrypt(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) + +//go:linkname Gethostid C.gethostid +func Gethostid() c.Long + +//go:linkname Getpgid C.getpgid +func Getpgid(_llcppg_param1 PidT) PidT + +//go:linkname Getsid C.getsid +func Getsid(_llcppg_param1 PidT) PidT + +//go:linkname Getdtablesize C.getdtablesize +func Getdtablesize() c.Int + +//go:linkname Getpagesize C.getpagesize +func Getpagesize() c.Int + +//go:linkname Getpass C.getpass +func Getpass(_llcppg_param1 *c.Char) *c.Char + +// obsoleted by getcwd() +// +//go:linkname Getwd C.getwd +func Getwd(_llcppg_param1 *c.Char) *c.Char + +//go:linkname Lockf C.lockf +func Lockf(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 OffT) c.Int + +//go:linkname Nice C.nice +func Nice(_llcppg_param1 c.Int) c.Int + +//go:linkname Pread C.pread +func Pread(__fd c.Int, __buf unsafe.Pointer, __nbyte c.SizeT, __offset OffT) c.SsizeT + +//go:linkname Pwrite C.pwrite +func Pwrite(__fd c.Int, __buf unsafe.Pointer, __nbyte c.SizeT, __offset OffT) c.SsizeT + +//go:linkname Sbrk C.sbrk +func Sbrk(_llcppg_param1 c.Int) unsafe.Pointer + +//go:linkname Setpgrp C.setpgrp +func Setpgrp() PidT + +//go:linkname Setregid C.setregid +func Setregid(_llcppg_param1 GidT, _llcppg_param2 GidT) c.Int + +//go:linkname Setreuid C.setreuid +func Setreuid(_llcppg_param1 UidT, _llcppg_param2 UidT) c.Int + +//go:linkname Sync C.sync +func Sync() + +//go:linkname Ualarm C.ualarm +func Ualarm(_llcppg_param1 UsecondsT, _llcppg_param2 UsecondsT) UsecondsT + +//go:linkname Usleep C.usleep +func Usleep(_llcppg_param1 UsecondsT) c.Int + +// End XSI +// +//go:linkname Vfork C.vfork +func Vfork() c.Int + +//go:linkname GetloginR C.getlogin_r +func GetloginR(_llcppg_param1 *c.Char, _llcppg_param2 c.SizeT) c.Int + +//go:linkname Gethostname C.gethostname +func Gethostname(_llcppg_param1 *c.Char, _llcppg_param2 c.SizeT) c.Int + +//go:linkname Setegid C.setegid +func Setegid(_llcppg_param1 GidT) c.Int + +//go:linkname Seteuid C.seteuid +func Seteuid(_llcppg_param1 UidT) c.Int + +// llgo:link (*AccessxDescriptor).AccessxNp C.accessx_np +func (self *AccessxDescriptor) AccessxNp(_llcppg_param2 c.SizeT, _llcppg_param3 *c.Int, _llcppg_param4 UidT) c.Int { + return 0 +} + +//go:linkname Acct C.acct +func Acct(_llcppg_param1 *c.Char) c.Int + +//go:linkname Endusershell C.endusershell +func Endusershell() + +//go:linkname ExecvP C.execvP +func ExecvP(__file *c.Char, __searchpath *c.Char, __argv **c.Char) c.Int + +//go:linkname Fflagstostr C.fflagstostr +func Fflagstostr(_llcppg_param1 c.Ulong) *c.Char + +//go:linkname Getdomainname C.getdomainname +func Getdomainname(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + +//go:linkname Getgrouplist C.getgrouplist +func Getgrouplist(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 *c.Int, _llcppg_param4 *c.Int) c.Int + +//go:linkname Getmode C.getmode +func Getmode(_llcppg_param1 unsafe.Pointer, _llcppg_param2 ModeT) ModeT + +//go:linkname Getpeereid C.getpeereid +func Getpeereid(_llcppg_param1 c.Int, _llcppg_param2 *UidT, _llcppg_param3 *GidT) c.Int + +//go:linkname GetsgroupsNp C.getsgroups_np +func GetsgroupsNp(_llcppg_param1 *c.Int, _llcppg_param2 UuidT) c.Int + +//go:linkname Getusershell C.getusershell +func Getusershell() *c.Char + +//go:linkname GetwgroupsNp C.getwgroups_np +func GetwgroupsNp(_llcppg_param1 *c.Int, _llcppg_param2 UuidT) c.Int + +//go:linkname Initgroups C.initgroups +func Initgroups(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + +//go:linkname Issetugid C.issetugid +func Issetugid() c.Int + +//go:linkname Mkdtemp C.mkdtemp +func Mkdtemp(_llcppg_param1 *c.Char) *c.Char + +// returns errno +// +//go:linkname MkpathNp C.mkpath_np +func MkpathNp(path *c.Char, omode ModeT) c.Int + +//go:linkname MkpathatNp C.mkpathat_np +func MkpathatNp(dfd c.Int, path *c.Char, omode ModeT) c.Int + +//go:linkname Mkstemps C.mkstemps +func Mkstemps(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + +//go:linkname Mkostemp C.mkostemp +func Mkostemp(path *c.Char, oflags c.Int) c.Int + +// Non-portable mkstemp that uses open_dprotected_np +// +//go:linkname Mkostemps C.mkostemps +func Mkostemps(path *c.Char, slen c.Int, oflags c.Int) c.Int + +// Non-portable mkstemp that uses open_dprotected_np +// +//go:linkname MkstempDprotectedNp C.mkstemp_dprotected_np +func MkstempDprotectedNp(path *c.Char, dpclass c.Int, dpflags c.Int) c.Int + +//go:linkname MkdtempatNp C.mkdtempat_np +func MkdtempatNp(dfd c.Int, path *c.Char) *c.Char + +//go:linkname MkstempsatNp C.mkstempsat_np +func MkstempsatNp(dfd c.Int, path *c.Char, slen c.Int) c.Int + +//go:linkname MkostempsatNp C.mkostempsat_np +func MkostempsatNp(dfd c.Int, path *c.Char, slen c.Int, oflags c.Int) c.Int + +//go:linkname Nfssvc C.nfssvc +func Nfssvc(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer) c.Int + +//go:linkname Reboot C.reboot +func Reboot(_llcppg_param1 c.Int) c.Int + +//go:linkname Revoke C.revoke +func Revoke(_llcppg_param1 *c.Char) c.Int + +//go:linkname Rcmd C.rcmd +func Rcmd(_llcppg_param1 **c.Char, _llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char, _llcppg_param5 *c.Char, _llcppg_param6 *c.Int) c.Int + +//go:linkname RcmdAf C.rcmd_af +func RcmdAf(_llcppg_param1 **c.Char, _llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char, _llcppg_param5 *c.Char, _llcppg_param6 *c.Int, _llcppg_param7 c.Int) c.Int + +//go:linkname Rresvport C.rresvport +func Rresvport(_llcppg_param1 *c.Int) c.Int + +//go:linkname RresvportAf C.rresvport_af +func RresvportAf(_llcppg_param1 *c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname Iruserok C.iruserok +func Iruserok(_llcppg_param1 c.Ulong, _llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char) c.Int + +//go:linkname IruserokSa C.iruserok_sa +func IruserokSa(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 *c.Char, _llcppg_param5 *c.Char) c.Int + +//go:linkname Ruserok C.ruserok +func Ruserok(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char) c.Int + +//go:linkname Setdomainname C.setdomainname +func Setdomainname(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + +//go:linkname Setgroups C.setgroups +func Setgroups(_llcppg_param1 c.Int, _llcppg_param2 *GidT) c.Int + +//go:linkname Sethostid C.sethostid +func Sethostid(_llcppg_param1 c.Long) + +//go:linkname Sethostname C.sethostname +func Sethostname(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + +//go:linkname Setlogin C.setlogin +func Setlogin(_llcppg_param1 *c.Char) c.Int + +//go:linkname Setmode C.setmode +func Setmode(_llcppg_param1 *c.Char) unsafe.Pointer + +//go:linkname Setrgid C.setrgid +func Setrgid(_llcppg_param1 GidT) c.Int + +//go:linkname Setruid C.setruid +func Setruid(_llcppg_param1 UidT) c.Int + +//go:linkname SetsgroupsNp C.setsgroups_np +func SetsgroupsNp(_llcppg_param1 c.Int, _llcppg_param2 UuidT) c.Int + +//go:linkname Setusershell C.setusershell +func Setusershell() + +//go:linkname SetwgroupsNp C.setwgroups_np +func SetwgroupsNp(_llcppg_param1 c.Int, _llcppg_param2 UuidT) c.Int + +//go:linkname Strtofflags C.strtofflags +func Strtofflags(_llcppg_param1 **c.Char, _llcppg_param2 *c.Ulong, _llcppg_param3 *c.Ulong) c.Int + +//go:linkname Swapon C.swapon +func Swapon(_llcppg_param1 *c.Char) c.Int + +//go:linkname Ttyslot C.ttyslot +func Ttyslot() c.Int + +//go:linkname Undelete C.undelete +func Undelete(_llcppg_param1 *c.Char) c.Int + +// getsubopt(3) external variable +// +//go:linkname Suboptarg C.suboptarg +var Suboptarg *c.Char + +//go:linkname Fgetattrlist C.fgetattrlist +func Fgetattrlist(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.SizeT, _llcppg_param5 c.Uint) c.Int + +//go:linkname Fsetattrlist C.fsetattrlist +func Fsetattrlist(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.SizeT, _llcppg_param5 c.Uint) c.Int + +//go:linkname Getattrlist C.getattrlist +func Getattrlist(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.SizeT, _llcppg_param5 c.Uint) c.Int + +//go:linkname Setattrlist C.setattrlist +func Setattrlist(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.SizeT, _llcppg_param5 c.Uint) c.Int + +//go:linkname Exchangedata C.exchangedata +func Exchangedata(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char, _llcppg_param3 c.Uint) c.Int + +//go:linkname Getdirentriesattr C.getdirentriesattr +func Getdirentriesattr(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.SizeT, _llcppg_param5 *c.Uint, _llcppg_param6 *c.Uint, _llcppg_param7 *c.Uint, _llcppg_param8 c.Uint) c.Int + +//go:linkname Searchfs C.searchfs +func Searchfs(_llcppg_param1 *c.Char, _llcppg_param2 *Fssearchblock, _llcppg_param3 *c.Ulong, _llcppg_param4 c.Uint, _llcppg_param5 c.Uint, _llcppg_param6 *Searchstate) c.Int + +//go:linkname Fsctl C.fsctl +func Fsctl(_llcppg_param1 *c.Char, _llcppg_param2 c.Ulong, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.Uint) c.Int + +//go:linkname Ffsctl C.ffsctl +func Ffsctl(_llcppg_param1 c.Int, _llcppg_param2 c.Ulong, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.Uint) c.Int + +//go:linkname FsyncVolumeNp C.fsync_volume_np +func FsyncVolumeNp(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname SyncVolumeNp C.sync_volume_np +func SyncVolumeNp(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + +//go:linkname Optreset C.optreset +var Optreset c.Int + +type Utimbuf struct { + Actime lltime.TimeT + Modtime lltime.TimeT +} + +//go:linkname Utime C.utime +func Utime(_llcppg_param1 *c.Char, _llcppg_param2 *Utimbuf) c.Int diff --git a/c/os/libc_linux_amd64.go b/c/os/libc_linux_amd64.go new file mode 100644 index 00000000..1f00af83 --- /dev/null +++ b/c/os/libc_linux_amd64.go @@ -0,0 +1,1785 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. +// Classified from the common libc binding. + +package os + +import ( + "github.com/goplus/lib/c" + llsignal "github.com/goplus/lib/c/signal" + llsys "github.com/goplus/lib/c/sys" + lltime "github.com/goplus/lib/c/time" + "unsafe" +) + +type Statvfs struct { + FBsize c.Ulong + FFrsize c.Ulong + FBlocks X__FsblkcntT + FBfree X__FsblkcntT + FBavail X__FsblkcntT + FFiles X__FsfilcntT + FFfree X__FsfilcntT + FFavail X__FsfilcntT + FFsid c.Ulong + FFlag c.Ulong + FNamemax c.Ulong + FType c.Uint + X__FSpare [5]c.Int +} + +// The following values are used by the `waitid' function. +type IdtypeT c.Uint + +// The purpose of all the unions is to have the kernel-compatible layout +// while keeping the API type as 'long int', and among machines where +// __syscall_slong_t is not 'long int', this only does the right thing +// for little-endian ones, like x32. +type Rusage struct { + RuUtime llsys.Timeval + RuStime llsys.Timeval + _llcppg_anon_10 + _llcppg_anon_11 + _llcppg_anon_12 + _llcppg_anon_13 + _llcppg_anon_14 + _llcppg_anon_15 + _llcppg_anon_16 + _llcppg_anon_17 + _llcppg_anon_18 + _llcppg_anon_19 + _llcppg_anon_20 + _llcppg_anon_21 + _llcppg_anon_22 + _llcppg_anon_23 +} + +type _llcppg_anon_10 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_11 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_12 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_13 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_14 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_15 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_16 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_17 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_18 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_19 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_20 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_21 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_22 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_23 struct { + _xgo_union [1]uint64 +} + +func (p *_llcppg_anon_10) XGof_ref_ru_maxrss() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_10) XGof_ref___ru_maxrss_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_11) XGof_ref_ru_ixrss() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_11) XGof_ref___ru_ixrss_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_12) XGof_ref_ru_idrss() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_12) XGof_ref___ru_idrss_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_13) XGof_ref_ru_isrss() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_13) XGof_ref___ru_isrss_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_14) XGof_ref_ru_minflt() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_14) XGof_ref___ru_minflt_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_15) XGof_ref_ru_majflt() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_15) XGof_ref___ru_majflt_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_16) XGof_ref_ru_nswap() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_16) XGof_ref___ru_nswap_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_17) XGof_ref_ru_inblock() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_17) XGof_ref___ru_inblock_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_18) XGof_ref_ru_oublock() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_18) XGof_ref___ru_oublock_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_19) XGof_ref_ru_msgsnd() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_19) XGof_ref___ru_msgsnd_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_20) XGof_ref_ru_msgrcv() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_20) XGof_ref___ru_msgrcv_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_21) XGof_ref_ru_nsignals() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_21) XGof_ref___ru_nsignals_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_22) XGof_ref_ru_nvcsw() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_22) XGof_ref___ru_nvcsw_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_23) XGof_ref_ru_nivcsw() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_23) XGof_ref___ru_nivcsw_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} + +// Type of device numbers. +type X__DevT = c.Ulong + +// Type of file attribute bitmasks. +type X__ModeT = c.Uint + +// Type of file sizes and offsets. +type X__OffT = c.Long + +// General type for IDs. +type X__IdT = c.Uint + +// Seconds since the Epoch. +type X__TimeT = c.Long + +// Count of microseconds. +type X__UsecondsT = c.Uint + +// Type to count file system blocks. +type X__FsblkcntT = c.Ulong + +// Type to count file system nodes. +type X__FsfilcntT = c.Ulong + +// Type of a byte count, or error. +type X__SsizeT = c.Long + +// Signed long type used in system calls. +type X__SyscallSlongT = c.Long + +const MAXNAMLEN = 255 + +// File types for `d_type'. +const ( + DT_UNKNOWN = 0 + DT_FIFO = 1 + DT_CHR = 2 + DT_DIR = 4 + DT_BLK = 6 + DT_REG = 8 + DT_LNK = 10 + DT_SOCK = 12 + DT_WHT = 14 +) + +// llgo:link (*DIR).ReaddirR C.readdir_r +func (self *DIR) ReaddirR(__entry *Dirent, __result **Dirent) c.Int { + return 0 +} + +// Rewind DIRP to the beginning of the directory. +// +// llgo:link (*DIR).Rewinddir C.rewinddir +func (self *DIR) Rewinddir() { +} + +// Seek to position POS on DIRP. +// +// llgo:link (*DIR).Seekdir C.seekdir +func (self *DIR) Seekdir(__pos c.Long) { +} + +// Return the current position of DIRP. +// +// llgo:link (*DIR).Telldir C.telldir +func (self *DIR) Telldir() c.Long { + return 0 +} + +// Return the file descriptor used by DIRP. +// +// llgo:link (*DIR).Dirfd C.dirfd +func (self *DIR) Dirfd() c.Int { + return 0 +} + +//go:linkname Scandir C.scandir +func Scandir(__dir *c.Char, __namelist ***Dirent, __selector func(_llcppg_param1 *Dirent) c.Int, __cmp func(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int) c.Int + +//go:linkname Alphasort C.alphasort +func Alphasort(__e1 **Dirent, __e2 **Dirent) c.Int + +//go:linkname Getdirentries C.getdirentries +func Getdirentries(__fd c.Int, __buf *c.Char, __nbytes c.SizeT, __basep *X__OffT) X__SsizeT + +// Open the shared object c.FILE and map it in; return a handle that can be +// passed to `dlsym' to get symbol values from it. +// +//go:linkname Dlopen C.dlopen +func Dlopen(__file *c.Char, __mode c.Int) unsafe.Pointer + +// Unmap and close a shared object opened by `dlopen'. +// The handle cannot be used again after calling `dlclose'. +// +//go:linkname Dlclose C.dlclose +func Dlclose(__handle unsafe.Pointer) c.Int + +// Find the run-time address in the shared object HANDLE refers to +// of the symbol called NAME. +// +//go:linkname Dlsym C.dlsym +func Dlsym(__handle unsafe.Pointer, __name *c.Char) unsafe.Pointer + +// When any of the above functions fails, call this function +// to return a string describing the error. Each call resets +// the error string so that a following call returns null. +// +//go:linkname Dlerror C.dlerror +func Dlerror() *c.Char + +const ( + S_IFMT = 61440 + S_IFDIR = 16384 + S_IFCHR = 8192 + S_IFBLK = 24576 + S_IFREG = 32768 +) + +const S_IFIFO = 4096 + +const S_IFLNK = 40960 + +const S_IFSOCK = 49152 + +const ( + // Set user ID on execution. + S_ISUID = 2048 + // Set group ID on execution. + S_ISGID = 1024 +) + +// Save swapped text after use (sticky bit). This is pretty well obsolete. +const S_ISVTX = 512 + +const ( + // Read by owner. + S_IRUSR = 256 + // Write by owner. + S_IWUSR = 128 + // Execute by owner. + S_IXUSR = 64 +) + +// Read, write, and execute by owner. +const S_IRWXU = 448 + +const ( + // Read by group. + S_IRGRP = 32 + // Write by group. + S_IWGRP = 16 + // Execute by group. + S_IXGRP = 8 +) + +// Read, write, and execute by group. +const S_IRWXG = 56 + +const ( + // Read by others. + S_IROTH = 4 + // Write by others. + S_IWOTH = 2 + // Execute by others. + S_IXOTH = 1 +) + +// Read, write, and execute by others. +const S_IRWXO = 7 + +// Values for the second argument to access. +// These may be OR'd together. +const ( + R_OK = 4 + // Test for write permission. + W_OK = 2 + // Test for execute permission. + // Test for existence. + F_OK = 0 +) + +const ( + // Seek from beginning of file. + SEEK_SET = 0 + // Seek from current position. + SEEK_CUR = 1 + // Seek from end of file. + SEEK_END = 2 +) + +// Special value used to indicate +// the *at functions should use the +// current working directory. +const AT_FDCWD = -100 + +const ( + // Do not follow symbolic links. + AT_SYMLINK_NOFOLLOW = 256 + // Remove directory instead of + // unlinking file. + AT_REMOVEDIR = 512 +) + +// Follow symbolic links. +const AT_SYMLINK_FOLLOW = 1024 + +// Test access permitted for +// effective IDs, not real IDs. +const AT_EACCESS = 512 + +const ( + // Unlock a previously locked region. + F_ULOCK = 0 + // Lock a region for exclusive use. + F_LOCK = 1 + // Test and lock a region for exclusive use. + F_TLOCK = 2 + // Test a region for other processes locks. + F_TEST = 3 +) + +// Ignore +// +//go:linkname Lockf C.lockf +func Lockf(__fd c.Int, __cmd c.Int, __len OffT) c.Int + +//go:linkname PosixFadvise C.posix_fadvise +func PosixFadvise(__fd c.Int, __offset OffT, __len OffT, __advise c.Int) c.Int + +//go:linkname PosixFallocate C.posix_fallocate +func PosixFallocate(__fd c.Int, __offset OffT, __len OffT) c.Int + +// Bits set in the FLAGS argument to `glob'. +const ( + GLOB_ERR = 1 + // Append a slash to each name. + GLOB_MARK = 2 + // Don't sort the names. + GLOB_NOSORT = 4 + // Insert PGLOB->gl_offs NULLs. + GLOB_DOOFFS = 8 + // If nothing matches, return the pattern. + GLOB_NOCHECK = 16 + // Append to results of a previous call. + GLOB_APPEND = 32 + // Backslashes don't quote metacharacters. + GLOB_NOESCAPE = 64 + // Leading `.' can be matched by metachars. + GLOB_PERIOD = 128 +) + +const ( + // Set in gl_flags if any metachars seen. + GLOB_MAGCHAR = 256 + // Use gl_opendir et al functions. + GLOB_ALTDIRFUNC = 512 + // Expand "{a,b}" to "a" "b". + GLOB_BRACE = 1024 + // If no magic chars, return the pattern. + GLOB_NOMAGIC = 2048 + // Expand ~user and ~ to home directories. + GLOB_TILDE = 4096 + // Match only directories. + GLOB_ONLYDIR = 8192 + // Like GLOB_TILDE but return an error + // if the user name is not available. + GLOB_TILDE_CHECK = 16384 +) + +// Error returns from `glob'. +const ( + GLOB_NOSPACE = 1 + // Read error. + GLOB_ABORTED = 2 + // No matches found. + GLOB_NOMATCH = 3 + // Not implemented. + GLOB_NOSYS = 4 +) + +// llgo:type C +type GlobT struct { + GlPathc X__SizeT + GlPathv **c.Char + GlOffs X__SizeT + GlFlags c.Int + GlClosedir func(_llcppg_param1 unsafe.Pointer) + GlReaddir func(_llcppg_param1 unsafe.Pointer) unsafe.Pointer + GlOpendir func(_llcppg_param1 *c.Char) unsafe.Pointer + GlLstat func(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer) c.Int + GlStat func(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer) c.Int +} + +type X__SizeT = c.Ulong + +//go:linkname Glob C.glob +func Glob(__pattern *c.Char, __flags c.Int, __errfunc func(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int, __pglob *GlobT) c.Int + +// Free storage allocated in PGLOB by a previous `glob' call. +// +// llgo:link (*GlobT).Globfree C.globfree +func (self *GlobT) Globfree() { +} + +// Reasonable value for the buffer sized used in the reentrant +// functions below. But better use `sysconf'. +const NSS_BUFLEN_GROUP = 1024 + +// The group structure. +type Group struct { + GrName *c.Char + GrPasswd *c.Char + GrGid c.Uint + GrMem **c.Char +} + +// Rewind the group-file stream. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Setgrent C.setgrent +func Setgrent() + +// Close the group-file stream. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endgrent C.endgrent +func Endgrent() + +// Read an entry from the group-file stream, opening it if necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getgrent C.getgrent +func Getgrent() *Group + +// Search for an entry with a matching group ID. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getgrgid C.getgrgid +func Getgrgid(__gid c.Uint) *Group + +// Search for an entry with a matching group name. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getgrnam C.getgrnam +func Getgrnam(__name *c.Char) *Group + +// Search for an entry with a matching group ID. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname GetgrgidR C.getgrgid_r +func GetgrgidR(__gid c.Uint, __resultbuf *Group, __buffer *c.Char, __buflen c.SizeT, __result **Group) c.Int + +// Search for an entry with a matching group name. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname GetgrnamR C.getgrnam_r +func GetgrnamR(__name *c.Char, __resultbuf *Group, __buffer *c.Char, __buflen c.SizeT, __result **Group) c.Int + +// Set the group set for the current user to GROUPS (N of them). +// +//go:linkname Setgroups C.setgroups +func Setgroups(__n c.SizeT, __groups *c.Uint) c.Int + +// Store at most *NGROUPS members of the group set for USER into +// GROUPS. Also include GROUP. The actual number of groups found is +// returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Getgrouplist C.getgrouplist +func Getgrouplist(__user *c.Char, __group c.Uint, __groups *c.Uint, __ngroups *c.Int) c.Int + +// Initialize the group set for the current user +// by reading the group database and using all groups +// of which USER is a member. Also include GROUP. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Initgroups C.initgroups +func Initgroups(__user *c.Char, __group c.Uint) c.Int + +// Reasonable value for the buffer sized used in the reentrant +// functions below. But better use `sysconf'. +const NSS_BUFLEN_PASSWD = 1024 + +// A record in the user database. +type Passwd struct { + PwName *c.Char + PwPasswd *c.Char + PwUid c.Uint + PwGid c.Uint + PwGecos *c.Char + PwDir *c.Char + PwShell *c.Char +} + +// Rewind the user database stream. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Setpwent C.setpwent +func Setpwent() + +// Close the user database stream. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endpwent C.endpwent +func Endpwent() + +// Read an entry from the user database stream, opening it if necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getpwent C.getpwent +func Getpwent() *Passwd + +// Write a given user database entry onto the given stream. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +// llgo:link (*Passwd).Putpwent C.putpwent +func (self *Passwd) Putpwent(__f *c.FILE) c.Int { + return 0 +} + +// Retrieve the user database entry for the given user ID. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getpwuid C.getpwuid +func Getpwuid(__uid c.Uint) *Passwd + +// Retrieve the user database entry for the given username. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getpwnam C.getpwnam +func Getpwnam(__name *c.Char) *Passwd + +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +// llgo:link (*Passwd).GetpwentR C.getpwent_r +func (self *Passwd) GetpwentR(__buffer *c.Char, __buflen c.SizeT, __result **Passwd) c.Int { + return 0 +} + +//go:linkname GetpwuidR C.getpwuid_r +func GetpwuidR(__uid c.Uint, __resultbuf *Passwd, __buffer *c.Char, __buflen c.SizeT, __result **Passwd) c.Int + +//go:linkname GetpwnamR C.getpwnam_r +func GetpwnamR(__name *c.Char, __resultbuf *Passwd, __buffer *c.Char, __buflen c.SizeT, __result **Passwd) c.Int + +// Set scheduling parameters for a process. +// +//go:linkname SchedSetparam C.sched_setparam +func SchedSetparam(__pid c.Int, __param *SchedParam) c.Int + +// Retrieve scheduling parameters for a particular process. +// +//go:linkname SchedGetparam C.sched_getparam +func SchedGetparam(__pid c.Int, __param *SchedParam) c.Int + +// Set scheduling algorithm and/or parameters for a process. +// +//go:linkname SchedSetscheduler C.sched_setscheduler +func SchedSetscheduler(__pid c.Int, __policy c.Int, __param *SchedParam) c.Int + +// Retrieve scheduling algorithm for a particular purpose. +// +//go:linkname SchedGetscheduler C.sched_getscheduler +func SchedGetscheduler(__pid c.Int) c.Int + +// Yield the processor. +// +//go:linkname SchedYield C.sched_yield +func SchedYield() c.Int + +// Get maximum priority value for a scheduler. +// +//go:linkname SchedGetPriorityMax C.sched_get_priority_max +func SchedGetPriorityMax(__algorithm c.Int) c.Int + +// Get minimum priority value for a scheduler. +// +//go:linkname SchedGetPriorityMin C.sched_get_priority_min +func SchedGetPriorityMin(__algorithm c.Int) c.Int + +//go:linkname SchedRrGetInterval C.sched_rr_get_interval +func SchedRrGetInterval(__pid c.Int, __t *lltime.Timespec) c.Int + +// Flags to be set in the `posix_spawnattr_t'. +const ( + POSIX_SPAWN_RESETIDS = 1 + POSIX_SPAWN_SETPGROUP = 2 + POSIX_SPAWN_SETSIGDEF = 4 + POSIX_SPAWN_SETSIGMASK = 8 + POSIX_SPAWN_SETSCHEDPARAM = 16 + POSIX_SPAWN_SETSCHEDULER = 32 +) + +// Data structure to contain attributes for thread creation. +type PosixSpawnattrT struct { + X__Flags int16 + X__Pgrp PidT + X__Sd llsignal.SigsetT + X__Ss llsignal.SigsetT + X__Sp SchedParam + X__Policy c.Int + X__Cgroup c.Int + X__Pad [15]c.Int +} + +// Data structure to contain information about the actions to be +// performed in the new process with respect to file descriptors. +type PosixSpawnFileActionsT struct { + X__Allocated c.Int + X__Used c.Int + X__Actions *X__SpawnAction + X__Pad [16]c.Int +} + +type X__SpawnAction struct { +} + +// Spawn a new process executing PATH with the attributes describes in *ATTRP. +// Before running the process perform the actions described in c.FILE-ACTIONS. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname PosixSpawn C.posix_spawn +func PosixSpawn(__pid *PidT, __path *c.Char, __file_actions *PosixSpawnFileActionsT, __attrp *PosixSpawnattrT, __argv **c.Char, __envp **c.Char) c.Int + +// Similar to `posix_spawn' but search for c.FILE in the PATH. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname PosixSpawnp C.posix_spawnp +func PosixSpawnp(__pid *PidT, __file *c.Char, __file_actions *PosixSpawnFileActionsT, __attrp *PosixSpawnattrT, __argv **c.Char, __envp **c.Char) c.Int + +// Initialize data structure with attributes for `spawn' to default values. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrInit C.posix_spawnattr_init +func (self *PosixSpawnattrT) PosixSpawnattrInit() c.Int { + return 0 +} + +// Free resources associated with ATTR. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrDestroy C.posix_spawnattr_destroy +func (self *PosixSpawnattrT) PosixSpawnattrDestroy() c.Int { + return 0 +} + +// Store signal mask for signals with default handling from ATTR in +// SIGDEFAULT. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigdefault C.posix_spawnattr_getsigdefault +func (self *PosixSpawnattrT) PosixSpawnattrGetsigdefault(__sigdefault *llsignal.SigsetT) c.Int { + return 0 +} + +// Set signal mask for signals with default handling in ATTR to SIGDEFAULT. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigdefault C.posix_spawnattr_setsigdefault +func (self *PosixSpawnattrT) PosixSpawnattrSetsigdefault(__sigdefault *llsignal.SigsetT) c.Int { + return 0 +} + +// Store signal mask for the new process from ATTR in SIGMASK. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigmask C.posix_spawnattr_getsigmask +func (self *PosixSpawnattrT) PosixSpawnattrGetsigmask(__sigmask *llsignal.SigsetT) c.Int { + return 0 +} + +// Set signal mask for the new process in ATTR to SIGMASK. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigmask C.posix_spawnattr_setsigmask +func (self *PosixSpawnattrT) PosixSpawnattrSetsigmask(__sigmask *llsignal.SigsetT) c.Int { + return 0 +} + +// Get flag word from the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetflags C.posix_spawnattr_getflags +func (self *PosixSpawnattrT) PosixSpawnattrGetflags(__flags *int16) c.Int { + return 0 +} + +// Store flags in the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetflags C.posix_spawnattr_setflags +func (self *PosixSpawnattrT) PosixSpawnattrSetflags(__flags int16) c.Int { + return 0 +} + +// Get process group ID from the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetpgroup C.posix_spawnattr_getpgroup +func (self *PosixSpawnattrT) PosixSpawnattrGetpgroup(__pgroup *PidT) c.Int { + return 0 +} + +// Store process group ID in the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetpgroup C.posix_spawnattr_setpgroup +func (self *PosixSpawnattrT) PosixSpawnattrSetpgroup(__pgroup PidT) c.Int { + return 0 +} + +// Get scheduling policy from the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetschedpolicy C.posix_spawnattr_getschedpolicy +func (self *PosixSpawnattrT) PosixSpawnattrGetschedpolicy(__schedpolicy *c.Int) c.Int { + return 0 +} + +// Store scheduling policy in the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetschedpolicy C.posix_spawnattr_setschedpolicy +func (self *PosixSpawnattrT) PosixSpawnattrSetschedpolicy(__schedpolicy c.Int) c.Int { + return 0 +} + +// Get scheduling parameters from the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetschedparam C.posix_spawnattr_getschedparam +func (self *PosixSpawnattrT) PosixSpawnattrGetschedparam(__schedparam *SchedParam) c.Int { + return 0 +} + +// Store scheduling parameters in the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetschedparam C.posix_spawnattr_setschedparam +func (self *PosixSpawnattrT) PosixSpawnattrSetschedparam(__schedparam *SchedParam) c.Int { + return 0 +} + +// Initialize data structure for file attribute for `spawn' call. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsInit C.posix_spawn_file_actions_init +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsInit() c.Int { + return 0 +} + +// Free resources associated with c.FILE-ACTIONS. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsDestroy C.posix_spawn_file_actions_destroy +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsDestroy() c.Int { + return 0 +} + +// Add an action to c.FILE-ACTIONS which tells the implementation to call +// `open' for the given file during the `spawn' call. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddopen C.posix_spawn_file_actions_addopen +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddopen(__fd c.Int, __path *c.Char, __oflag c.Int, __mode ModeT) c.Int { + return 0 +} + +// Add an action to c.FILE-ACTIONS which tells the implementation to call +// `close' for the given file descriptor during the `spawn' call. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddclose C.posix_spawn_file_actions_addclose +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddclose(__fd c.Int) c.Int { + return 0 +} + +// Add an action to c.FILE-ACTIONS which tells the implementation to call +// `dup2' for the given file descriptors during the `spawn' call. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAdddup2 C.posix_spawn_file_actions_adddup2 +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAdddup2(__fd c.Int, __newfd c.Int) c.Int { + return 0 +} + +// Add an action changing the directory to PATH during spawn. This +// affects the subsequent file actions. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddchdirNp C.posix_spawn_file_actions_addchdir_np +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddchdirNp(__path *c.Char) c.Int { + return 0 +} + +// Add an action changing the directory to FD during spawn. This +// affects the subsequent file actions. FD is not duplicated and must +// be open when the file action is executed. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddfchdirNp C.posix_spawn_file_actions_addfchdir_np +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddfchdirNp(__fd c.Int) c.Int { + return 0 +} + +// Add an action to close all file descriptor greater than or equal to FROM +// during spawn. This affects the subsequent file actions. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddclosefromNp C.posix_spawn_file_actions_addclosefrom_np +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddclosefromNp(__from c.Int) c.Int { + return 0 +} + +// Add an action to set the process group of the foreground process group +// associated with the terminal TCFD. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddtcsetpgrpNp C.posix_spawn_file_actions_addtcsetpgrp_np +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddtcsetpgrpNp(__tcfd c.Int) c.Int { + return 0 +} + +const ( + // Seek from beginning of file. + L_SET = 0 + // Seek from current position. + L_INCR = 1 + // Seek from end of file. + L_XTND = 2 +) + +// Apply or remove an advisory lock, according to OPERATION, +// on the file FD refers to. +// +//go:linkname Flock C.flock +func Flock(__fd c.Int, __operation c.Int) c.Int + +//go:linkname Mmap C.mmap +func Mmap(__addr unsafe.Pointer, __len c.SizeT, __prot c.Int, __flags c.Int, __fd c.Int, __offset X__OffT) unsafe.Pointer + +// Deallocate any mapping for the region starting at ADDR and extending LEN +// bytes. Returns 0 if successful, -1 for errors (and sets errno). +// +//go:linkname Munmap C.munmap +func Munmap(__addr unsafe.Pointer, __len c.SizeT) c.Int + +// Change the memory protection of the region starting at ADDR and +// extending LEN bytes to PROT. Returns 0 if successful, -1 for errors +// (and sets errno). +// +//go:linkname Mprotect C.mprotect +func Mprotect(__addr unsafe.Pointer, __len c.SizeT, __prot c.Int) c.Int + +// Synchronize the region starting at ADDR and extending LEN bytes with the +// file it maps. Filesystem operations on a file being mapped are +// unpredictable before this is done. Flags are from the MS_* set. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Msync C.msync +func Msync(__addr unsafe.Pointer, __len c.SizeT, __flags c.Int) c.Int + +// Advise the system about particular usage patterns the program follows +// for the region starting at ADDR and extending LEN bytes. +// +//go:linkname Madvise C.madvise +func Madvise(__addr unsafe.Pointer, __len c.SizeT, __advice c.Int) c.Int + +// This is the POSIX name for this function. +// +//go:linkname PosixMadvise C.posix_madvise +func PosixMadvise(__addr unsafe.Pointer, __len c.SizeT, __advice c.Int) c.Int + +// Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to +// be memory resident. +// +//go:linkname Mlock C.mlock +func Mlock(__addr unsafe.Pointer, __len c.SizeT) c.Int + +// Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN). +// +//go:linkname Munlock C.munlock +func Munlock(__addr unsafe.Pointer, __len c.SizeT) c.Int + +// Cause all currently mapped pages of the process to be memory resident +// until unlocked by a call to the `munlockall', until the process exits, +// or until the process calls `execve'. +// +//go:linkname Mlockall C.mlockall +func Mlockall(__flags c.Int) c.Int + +// All currently mapped pages of the process' address space become +// unlocked. +// +//go:linkname Munlockall C.munlockall +func Munlockall() c.Int + +// mincore returns the memory residency status of the pages in the +// current process's address space specified by [start, start + len). +// The status is returned in a vector of bytes. The least significant +// bit of each byte is 1 if the referenced page is in memory, otherwise +// it is zero. +// +//go:linkname Mincore C.mincore +func Mincore(__start unsafe.Pointer, __len c.SizeT, __vec *uint8) c.Int + +// Open shared memory segment. +// +//go:linkname ShmOpen C.shm_open +func ShmOpen(__name *c.Char, __oflag c.Int, __mode ModeT) c.Int + +// Remove shared memory segment. +// +//go:linkname ShmUnlink C.shm_unlink +func ShmUnlink(__name *c.Char) c.Int + +type X__RusageWhoT = c.Int + +type X__PriorityWhichT = c.Int + +// Return resource usage information on process indicated by WHO +// and put it in *USAGE. Returns 0 for success, -1 for failure. +// +//go:linkname Getrusage C.getrusage +func Getrusage(__who X__RusageWhoT, __usage *Rusage) c.Int + +// Return the highest priority of any process specified by WHICH and WHO +// (see above); if WHO is zero, the current process, process group, or user +// (as specified by WHO) is used. A lower priority number means higher +// priority. Priorities range from PRIO_MIN to PRIO_MAX (above). +// +//go:linkname Getpriority C.getpriority +func Getpriority(__which X__PriorityWhichT, __who IdT) c.Int + +// Set the priority of all processes specified by WHICH and WHO (see above) +// to PRIO. Returns 0 on success, -1 on errors. +// +//go:linkname Setpriority C.setpriority +func Setpriority(__which X__PriorityWhichT, __who IdT, __prio c.Int) c.Int + +// Maximum number of file descriptors in `fd_set'. +const FD_SETSIZE = 1024 + +//go:linkname Select C.select +func Select(__nfds c.Int, __readfds *llsys.FdSet, __writefds *llsys.FdSet, __exceptfds *llsys.FdSet, __timeout *llsys.Timeval) c.Int + +//go:linkname Pselect C.pselect +func Pselect(__nfds c.Int, __readfds *llsys.FdSet, __writefds *llsys.FdSet, __exceptfds *llsys.FdSet, __timeout *lltime.Timespec, __sigmask *llsignal.SigsetT) c.Int + +const ( + S_IREAD = 256 + S_IWRITE = 128 + S_IEXEC = 64 +) + +// Macros for common mode bit masks. +const ( + ACCESSPERMS = 511 + // 07777 + ALLPERMS = 4095 + // 0666 + DEFFILEMODE = 438 +) + +// Block size for `st_blocks'. +const S_BLKSIZE = 512 + +// Set file access permissions for c.FILE to MODE. +// If c.FILE is a symbolic link, this affects the link itself +// rather than its target. +// +//go:linkname Lchmod C.lchmod +func Lchmod(__file *c.Char, __mode X__ModeT) c.Int + +// Like mkdir, create a new directory with permission bits MODE. But +// interpret relative PATH names relative to the directory associated +// with FD. +// +//go:linkname Mkdirat C.mkdirat +func Mkdirat(__fd c.Int, __path *c.Char, __mode X__ModeT) c.Int + +// Like mknod, create a new device file with permission bits MODE and +// device number DEV. But interpret relative PATH names relative to +// the directory associated with FD. +// +//go:linkname Mknodat C.mknodat +func Mknodat(__fd c.Int, __path *c.Char, __mode X__ModeT, __dev X__DevT) c.Int + +// Like mkfifo, create a new FIFO with permission bits MODE. But +// interpret relative PATH names relative to the directory associated +// with FD. +// +//go:linkname Mkfifoat C.mkfifoat +func Mkfifoat(__fd c.Int, __path *c.Char, __mode X__ModeT) c.Int + +// Set file access and modification times relative to directory file +// descriptor. +// +//go:linkname Utimensat C.utimensat +func Utimensat(__fd c.Int, __path *c.Char, __times *lltime.Timespec, __flags c.Int) c.Int + +// Set file access and modification times of the file associated with FD. +// +//go:linkname Futimens C.futimens +func Futimens(__fd c.Int, __times *lltime.Timespec) c.Int + +//go:linkname Fstatvfs C.fstatvfs +func Fstatvfs(__fildes c.Int, __buf *Statvfs) c.Int + +// Structure describing CPU time used by a process and its children. +type Tms struct { + TmsUtime lltime.ClockT + TmsStime lltime.ClockT + TmsCutime lltime.ClockT + TmsCstime lltime.ClockT +} + +// Store the CPU time used by this process and all its +// dead children (and their dead children) in BUFFER. +// Return the elapsed real time, or (clock_t) -1 for errors. +// All times are in CLK_TCKths of a second. +// +// llgo:link (*Tms).Times C.times +func (self *Tms) Times() lltime.ClockT { + return 0 +} + +type IdT = X__IdT + +const UIO_MAXIOV = 1024 + +// Read data from file descriptor FD, and put the result in the +// buffers described by IOVEC, which is a vector of COUNT 'struct iovec's. +// The buffers are filled in the order specified. +// Operates just like 'read' (see ) except that data are +// put in IOVEC instead of a contiguous buffer. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Readv C.readv +func Readv(__fd c.Int, __iovec *c.Iovec, __count c.Int) c.SsizeT + +// Write data pointed by the buffers described by IOVEC, which +// is a vector of COUNT 'struct iovec's, to file descriptor FD. +// The data is written in the order specified. +// Operates just like 'write' (see ) except that the data +// are taken from IOVEC instead of a contiguous buffer. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Writev C.writev +func Writev(__fd c.Int, __iovec *c.Iovec, __count c.Int) c.SsizeT + +// Read data from file descriptor FD at the given position OFFSET +// without change the file pointer, and put the result in the buffers +// described by IOVEC, which is a vector of COUNT 'struct iovec's. +// The buffers are filled in the order specified. Operates just like +// 'pread' (see ) except that data are put in IOVEC instead +// of a contiguous buffer. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Preadv C.preadv +func Preadv(__fd c.Int, __iovec *c.Iovec, __count c.Int, __offset X__OffT) c.SsizeT + +// Write data pointed by the buffers described by IOVEC, which is a +// vector of COUNT 'struct iovec's, to file descriptor FD at the given +// position OFFSET without change the file pointer. The data is +// written in the order specified. Operates just like 'pwrite' (see +// ) except that the data are taken from IOVEC instead of a +// contiguous buffer. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Pwritev C.pwritev +func Pwritev(__fd c.Int, __iovec *c.Iovec, __count c.Int, __offset X__OffT) c.SsizeT + +// Note that SVID assumes all members have the same size. +const SYS_NMLN = 65 + +// Structure describing the system and machine. +type Utsname struct { + Sysname [65]c.Char + Nodename [65]c.Char + Release [65]c.Char + Version [65]c.Char + Machine [65]c.Char + X__Domainname [65]c.Char +} + +// Put information about the system in NAME. +// +// llgo:link (*Utsname).Uname C.uname +func (self *Utsname) Uname() c.Int { + return 0 +} + +const WCOREFLAG = 128 + +// Special values for the PID argument to `waitpid' and `wait4'. +const ( + WAIT_ANY = -1 + // Any process in my process group. + WAIT_MYPGRP = 0 +) + +// Wait for a childing matching IDTYPE and ID to change the status and +// place appropriate information in *INFOP. +// If IDTYPE is P_PID, match any process whose process ID is ID. +// If IDTYPE is P_PGID, match any process whose process group is ID. +// If IDTYPE is P_ALL, match any process. +// If the WNOHANG bit is set in OPTIONS, and that child +// is not already dead, clear *INFOP and return 0. If successful, store +// exit code and status in *INFOP. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +// llgo:link IdtypeT.Waitid C.waitid +func (self IdtypeT) Waitid(__id X__IdT, __infop *llsignal.SiginfoT, __options c.Int) c.Int { + return 0 +} + +// Return the output baud rate stored in *TERMIOS_P. +// +// llgo:link (*Termios).Cfgetospeed C.cfgetospeed +func (self *Termios) Cfgetospeed() SpeedT { + return 0 +} + +// Return the input baud rate stored in *TERMIOS_P. +// +// llgo:link (*Termios).Cfgetispeed C.cfgetispeed +func (self *Termios) Cfgetispeed() SpeedT { + return 0 +} + +// Set the output baud rate stored in *TERMIOS_P to SPEED. +// +// llgo:link (*Termios).Cfsetospeed C.cfsetospeed +func (self *Termios) Cfsetospeed(__speed SpeedT) c.Int { + return 0 +} + +// Set the input baud rate stored in *TERMIOS_P to SPEED. +// +// llgo:link (*Termios).Cfsetispeed C.cfsetispeed +func (self *Termios) Cfsetispeed(__speed SpeedT) c.Int { + return 0 +} + +// Set both the input and output baud rates in *TERMIOS_OP to SPEED. +// +// llgo:link (*Termios).Cfsetspeed C.cfsetspeed +func (self *Termios) Cfsetspeed(__speed SpeedT) c.Int { + return 0 +} + +// Put the state of FD into *TERMIOS_P. +// +//go:linkname Tcgetattr C.tcgetattr +func Tcgetattr(__fd c.Int, __termios_p *Termios) c.Int + +// Set the state of FD to *TERMIOS_P. +// Values for OPTIONAL_ACTIONS (TCSA*) are in . +// +//go:linkname Tcsetattr C.tcsetattr +func Tcsetattr(__fd c.Int, __optional_actions c.Int, __termios_p *Termios) c.Int + +// Set *TERMIOS_P to indicate raw mode. +// +// llgo:link (*Termios).Cfmakeraw C.cfmakeraw +func (self *Termios) Cfmakeraw() { +} + +// Send zero bits on FD. +// +//go:linkname Tcsendbreak C.tcsendbreak +func Tcsendbreak(__fd c.Int, __duration c.Int) c.Int + +// Wait for pending output to be written on FD. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Tcdrain C.tcdrain +func Tcdrain(__fd c.Int) c.Int + +// Flush pending data on FD. +// Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in . +// +//go:linkname Tcflush C.tcflush +func Tcflush(__fd c.Int, __queue_selector c.Int) c.Int + +// Suspend or restart transmission on FD. +// Values for ACTION (TC[IO]{OFF,ON}) are in . +// +//go:linkname Tcflow C.tcflow +func Tcflow(__fd c.Int, __action c.Int) c.Int + +// Get process group ID for session leader for controlling terminal FD. +// +//go:linkname Tcgetsid C.tcgetsid +func Tcgetsid(__fd c.Int) c.Int + +// Standard file descriptors. +const ( + STDIN_FILENO = 0 + // Standard output. + STDOUT_FILENO = 1 + // Standard error output. + STDERR_FILENO = 2 +) + +// Test for access to NAME using the real UID and real GID. +// +//go:linkname Access C.access +func Access(__name *c.Char, __type c.Int) c.Int + +// Close all open file descriptors greater than or equal to LOWFD. +// Negative LOWFD is clamped to 0. +// +//go:linkname Closefrom C.closefrom +func Closefrom(__lowfd c.Int) + +// Read NBYTES into BUF from FD at the given position OFFSET without +// changing the file pointer. Return the number read, -1 for errors +// or 0 for EOF. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Pread C.pread +func Pread(__fd c.Int, __buf unsafe.Pointer, __nbytes c.SizeT, __offset X__OffT) c.SsizeT + +// Write N bytes of BUF to FD at the given position OFFSET without +// changing the file pointer. Return the number written, or -1. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Pwrite C.pwrite +func Pwrite(__fd c.Int, __buf unsafe.Pointer, __n c.SizeT, __offset X__OffT) c.SsizeT + +// Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. +// If SECONDS is zero, any currently scheduled alarm will be cancelled. +// The function returns the number of seconds remaining until the last +// alarm scheduled would have signaled, or zero if there wasn't one. +// There is no return value to indicate an error, but you can set `errno' +// to 0 and check its value after calling `alarm', and this might tell you. +// The signal may come late due to processor scheduling. +// +//go:linkname Alarm C.alarm +func Alarm(__seconds c.Uint) c.Uint + +// Make the process sleep for SECONDS seconds, or until a signal arrives +// and is not ignored. The function returns the number of seconds less +// than SECONDS which it actually slept (thus zero if it slept the full time). +// If a signal handler does a `longjmp' or modifies the handling of the +// SIGALRM signal while inside `sleep' call, the handling of the SIGALRM +// signal afterwards is undefined. There is no return value to indicate +// error, but if `sleep' returns SECONDS, it probably didn't work. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Sleep C.sleep +func Sleep(__seconds c.Uint) c.Uint + +// Set an alarm to go off (generating a SIGALRM signal) in VALUE +// microseconds. If INTERVAL is nonzero, when the alarm goes off, the +// timer is reset to go off every INTERVAL microseconds thereafter. +// Returns the number of microseconds remaining before the alarm. +// +//go:linkname Ualarm C.ualarm +func Ualarm(__value X__UsecondsT, __interval X__UsecondsT) X__UsecondsT + +// Sleep USECONDS microseconds, or until a signal arrives that is not blocked +// or ignored. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Usleep C.usleep +func Usleep(__useconds X__UsecondsT) c.Int + +// Suspend the process until a signal arrives. +// This always returns -1 and sets `errno' to EINTR. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Pause C.pause +func Pause() c.Int + +// Put the absolute pathname of the current working directory in BUF. +// If successful, return BUF. If not, put an error message in +// BUF and return NULL. BUF should be at least PATH_MAX bytes long. +// +//go:linkname Getwd C.getwd +func Getwd(__buf *c.Char) *c.Char + +// Execute the file FD refers to, overlaying the running program image. +// ARGV and ENVP are passed to the new program, as for `execve'. +// +//go:linkname Fexecve C.fexecve +func Fexecve(__fd c.Int, __argv **c.Char, __envp **c.Char) c.Int + +// Add INC to priority of the current process. +// +//go:linkname Nice C.nice +func Nice(__inc c.Int) c.Int + +// Terminate program execution with the low-order 8 bits of STATUS. +// +//go:linkname X_exit C._exit +func X_exit(__status c.Int) + +// Get file-specific configuration information about PATH. +// +//go:linkname Pathconf C.pathconf +func Pathconf(__path *c.Char, __name c.Int) c.Long + +// Get file-specific configuration about descriptor FD. +// +//go:linkname Fpathconf C.fpathconf +func Fpathconf(__fd c.Int, __name c.Int) c.Long + +// Get the value of the system variable NAME. +// +//go:linkname Sysconf C.sysconf +func Sysconf(__name c.Int) c.Long + +// Get the value of the string-valued system variable NAME. +// +//go:linkname Confstr C.confstr +func Confstr(__name c.Int, __buf *c.Char, __len c.SizeT) c.SizeT + +// Get the process group ID of the calling process. +// +//go:linkname Getpgrp C.getpgrp +func Getpgrp() c.Int + +//go:linkname Getpgid C.getpgid +func Getpgid(__pid c.Int) c.Int + +// Set the process group ID of the process matching PID to PGID. +// If PID is zero, the current process's process group ID is set. +// If PGID is zero, the process ID of the process is used. +// +//go:linkname Setpgid C.setpgid +func Setpgid(__pid c.Int, __pgid c.Int) c.Int + +// Set the process group ID of the calling process to its own PID. +// This is exactly the same as `setpgid (0, 0)'. +// +//go:linkname Setpgrp C.setpgrp +func Setpgrp() c.Int + +// Create a new session with the calling process as its leader. +// The process group IDs of the session and the calling process +// are set to the process ID of the calling process, which is returned. +// +//go:linkname Setsid C.setsid +func Setsid() c.Int + +// Return the session ID of the given process. +// +//go:linkname Getsid C.getsid +func Getsid(__pid c.Int) c.Int + +// If SIZE is zero, return the number of supplementary groups +// the calling process is in. Otherwise, fill in the group IDs +// of its supplementary groups in LIST and return the number written. +// +//go:linkname Getgroups C.getgroups +func Getgroups(__size c.Int, __list *c.Uint) c.Int + +// Set the user ID of the calling process to UID. +// If the calling process is the super-user, set the real +// and effective user IDs, and the saved set-user-ID to UID; +// if not, the effective user ID is set to UID. +// +//go:linkname Setuid C.setuid +func Setuid(__uid c.Uint) c.Int + +// Set the real user ID of the calling process to RUID, +// and the effective user ID of the calling process to EUID. +// +//go:linkname Setreuid C.setreuid +func Setreuid(__ruid c.Uint, __euid c.Uint) c.Int + +// Set the effective user ID of the calling process to UID. +// +//go:linkname Seteuid C.seteuid +func Seteuid(__uid c.Uint) c.Int + +// Set the group ID of the calling process to GID. +// If the calling process is the super-user, set the real +// and effective group IDs, and the saved set-group-ID to GID; +// if not, the effective group ID is set to GID. +// +//go:linkname Setgid C.setgid +func Setgid(__gid c.Uint) c.Int + +// Set the real group ID of the calling process to RGID, +// and the effective group ID of the calling process to EGID. +// +//go:linkname Setregid C.setregid +func Setregid(__rgid c.Uint, __egid c.Uint) c.Int + +// Set the effective group ID of the calling process to GID. +// +//go:linkname Setegid C.setegid +func Setegid(__gid c.Uint) c.Int + +// Clone the calling process, but without copying the whole address space. +// The calling process is suspended until the new process exits or is +// replaced by a call to `execve'. Return -1 for errors, 0 to the new process, +// and the process ID of the new process to the old process. +// +//go:linkname Vfork C.vfork +func Vfork() c.Int + +// Return the pathname of the terminal FD is open on, or NULL on errors. +// The returned storage is good only until the next call to this function. +// +//go:linkname Ttyname C.ttyname +func Ttyname(__fd c.Int) *c.Char + +// Store at most BUFLEN characters of the pathname of the terminal FD is +// open on in BUF. Return 0 on success, otherwise an error number. +// +//go:linkname TtynameR C.ttyname_r +func TtynameR(__fd c.Int, __buf *c.Char, __buflen c.SizeT) c.Int + +// Return the index into the active-logins file (utmp) for +// the controlling terminal. +// +//go:linkname Ttyslot C.ttyslot +func Ttyslot() c.Int + +// Like link but relative paths in TO and FROM are interpreted relative +// to FROMFD and TOFD respectively. +// +//go:linkname Linkat C.linkat +func Linkat(__fromfd c.Int, __from *c.Char, __tofd c.Int, __to *c.Char, __flags c.Int) c.Int + +// Like symlink but a relative path in TO is interpreted relative to TOFD. +// +//go:linkname Symlinkat C.symlinkat +func Symlinkat(__from *c.Char, __tofd c.Int, __to *c.Char) c.Int + +// Like readlink but a relative PATH is interpreted relative to FD. +// +//go:linkname Readlinkat C.readlinkat +func Readlinkat(__fd c.Int, __path *c.Char, __buf *c.Char, __len c.SizeT) c.SsizeT + +// Return the foreground process group ID of FD. +// +//go:linkname Tcgetpgrp C.tcgetpgrp +func Tcgetpgrp(__fd c.Int) c.Int + +// Set the foreground process group ID of FD set PGRP_ID. +// +//go:linkname Tcsetpgrp C.tcsetpgrp +func Tcsetpgrp(__fd c.Int, __pgrp_id c.Int) c.Int + +// Return the login name of the user. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getlogin C.getlogin +func Getlogin() *c.Char + +// Return at most NAME_LEN characters of the login name of the user in NAME. +// If it cannot be determined or some other error occurred, return the error +// code. Otherwise return 0. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname GetloginR C.getlogin_r +func GetloginR(__name *c.Char, __name_len c.SizeT) c.Int + +// Set the login name returned by `getlogin'. +// +//go:linkname Setlogin C.setlogin +func Setlogin(__name *c.Char) c.Int + +// Put the name of the current host in no more than LEN bytes of NAME. +// The result is null-terminated if LEN is large enough for the full +// name and the terminator. +// +//go:linkname Gethostname C.gethostname +func Gethostname(__name *c.Char, __len c.SizeT) c.Int + +// Set the name of the current host to NAME, which is LEN bytes long. +// This call is restricted to the super-user. +// +//go:linkname Sethostname C.sethostname +func Sethostname(__name *c.Char, __len c.SizeT) c.Int + +// Set the current machine's Internet number to ID. +// This call is restricted to the super-user. +// +//go:linkname Sethostid C.sethostid +func Sethostid(__id c.Long) c.Int + +// Get and set the NIS (aka YP) domain name, if any. +// Called just like `gethostname' and `sethostname'. +// The NIS domain name is usually the empty string when not using NIS. +// +//go:linkname Getdomainname C.getdomainname +func Getdomainname(__name *c.Char, __len c.SizeT) c.Int + +// Ignore +// +//go:linkname Setdomainname C.setdomainname +func Setdomainname(__name *c.Char, __len c.SizeT) c.Int + +// Revoke access permissions to all processes currently communicating +// with the control terminal, and then send a SIGHUP signal to the process +// group of the control terminal. +// +//go:linkname Vhangup C.vhangup +func Vhangup() c.Int + +// Revoke the access of all descriptors currently open on c.FILE. +// +//go:linkname Revoke C.revoke +func Revoke(__file *c.Char) c.Int + +// Enable statistical profiling, writing samples of the PC into at most +// SIZE bytes of SAMPLE_BUFFER; every processor clock tick while profiling +// is enabled, the system examines the user PC and increments +// SAMPLE_BUFFER[((PC - OFFSET) / 2) * SCALE / 65536]. If SCALE is zero, +// disable profiling. Returns zero on success, -1 on error. +// +//go:linkname Profil C.profil +func Profil(__sample_buffer *uint16, __size c.SizeT, __offset c.SizeT, __scale c.Uint) c.Int + +// Turn accounting on if NAME is an existing file. The system will then write +// a record for each process as it terminates, to this file. If NAME is NULL, +// turn accounting off. This call is restricted to the super-user. +// +//go:linkname Acct C.acct +func Acct(__name *c.Char) c.Int + +// Successive calls return the shells listed in `/etc/shells'. +// +//go:linkname Getusershell C.getusershell +func Getusershell() *c.Char + +// Discard cached info. +// +//go:linkname Endusershell C.endusershell +func Endusershell() + +// Rewind and re-read the file. +// +//go:linkname Setusershell C.setusershell +func Setusershell() + +// Put the program in the background, and dissociate from the controlling +// terminal. If NOCHDIR is zero, do `chdir ("/")'. If NOCLOSE is zero, +// redirects stdin, stdout, and stderr to /dev/null. +// +//go:linkname Daemon C.daemon +func Daemon(__nochdir c.Int, __noclose c.Int) c.Int + +// Prompt with PROMPT and read a string from the terminal without echoing. +// Uses /dev/tty if possible; otherwise stderr and stdin. +// +//go:linkname Getpass C.getpass +func Getpass(__prompt *c.Char) *c.Char + +// Return identifier for the current host. +// +//go:linkname Gethostid C.gethostid +func Gethostid() c.Long + +// Make all changes done to all files actually appear on disk. +// +//go:linkname Sync C.sync +func Sync() + +// Return the number of bytes in a page. This is the system's page size, +// which is not necessarily the same as the hardware page size. +// +//go:linkname Getpagesize C.getpagesize +func Getpagesize() c.Int + +// Return the maximum number of file descriptors +// the current process could possibly have. +// +//go:linkname Getdtablesize C.getdtablesize +func Getdtablesize() c.Int + +// Set the end of accessible data space (aka "the break") to ADDR. +// Returns zero on success and -1 for errors (with errno set). +// +//go:linkname Brk C.brk +func Brk(__addr unsafe.Pointer) c.Int + +// Increase or decrease the end of accessible data space by DELTA bytes. +// If successful, returns the address the previous end of data space +// (i.e. the beginning of the new space, if DELTA > 0); +// returns (void *) -1 for errors (with errno set). +// +//go:linkname Sbrk C.sbrk +func Sbrk(__delta c.IntptrT) unsafe.Pointer + +// Synchronize at least the data part of a file with the underlying +// media. +// +//go:linkname Fdatasync C.fdatasync +func Fdatasync(__fildes c.Int) c.Int + +// Write LENGTH bytes of randomness starting at BUFFER. Return 0 on +// success or -1 on error. +// +//go:linkname Getentropy C.getentropy +func Getentropy(__buffer unsafe.Pointer, __length c.SizeT) c.Int + +// Structure describing file times. +type Utimbuf struct { + Actime X__TimeT + Modtime X__TimeT +} + +//go:linkname Utime C.utime +func Utime(__file *c.Char, __file_times *Utimbuf) c.Int diff --git a/c/os/llcppg.pub b/c/os/llcppg.pub index 53cba11f..de9cdec1 100644 --- a/c/os/llcppg.pub +++ b/c/os/llcppg.pub @@ -1,7 +1,74 @@ -T mode_t ModeT -T uid_t UidT +D github.com/goplus/lib/c +D github.com/goplus/lib/c/signal +D github.com/goplus/lib/c/sys +D github.com/goplus/lib/c/time +T DIR DIR +T Dl_info DlInfo +T __darwin_fsblkcnt_t X__DarwinFsblkcntT +T __darwin_fsfilcnt_t X__DarwinFsfilcntT +T __darwin_id_t X__DarwinIdT +T __darwin_time_t X__DarwinTimeT +T __darwin_useconds_t X__DarwinUsecondsT +T __darwin_uuid_t X__DarwinUuidT +T __dev_t X__DevT +T __fsblkcnt_t X__FsblkcntT +T __fsfilcnt_t X__FsfilcntT +T __id_t X__IdT +T __mode_t X__ModeT +T __off_t X__OffT +T __priority_which_t X__PriorityWhichT +T __rusage_who_t X__RusageWhoT +T __siginfo X__Siginfo +T __size_t X__SizeT +T __spawn_action X__SpawnAction +T __ssize_t X__SsizeT +T __syscall_slong_t X__SyscallSlongT +T __time_t X__TimeT +T __useconds_t X__UsecondsT +T _filesec X_filesec +T accessx_descriptor AccessxDescriptor +T cc_t CcT +T cpu_subtype_t CpuSubtypeT +T cpu_type_t CpuTypeT +T dev_t DevT +T dirent Dirent +T dl_info DlInfo +T exception_behavior_t ExceptionBehaviorT +T exception_mask_t ExceptionMaskT +T filesec_property_t FilesecPropertyT +T filesec_t FilesecT +T fsblkcnt_t FsblkcntT +T fsfilcnt_t FsfilcntT +T fssearchblock Fssearchblock T gid_t GidT +T glob_t GlobT +T group Group +T id_t IdT +T idtype_t IdtypeT +T integer_t IntegerT +T mach_port_t MachPortT +T mode_t ModeT T off_t OffT -T dev_t DevT -T stat StatT +T passwd Passwd T pid_t PidT +T posix_spawn_file_actions_t PosixSpawnFileActionsT +T posix_spawnattr_t PosixSpawnattrT +T rusage Rusage +T sched_param SchedParam +T searchstate Searchstate +T semaphore_t SemaphoreT +T siginfo_t SiginfoT +T sigval Sigval +T speed_t SpeedT +T stat StatT +T statvfs Statvfs +T tcflag_t TcflagT +T termios Termios +T thread_state_flavor_t ThreadStateFlavorT +T tms Tms +T uid_t UidT +T uio_rw UioRw +T useconds_t UsecondsT +T utimbuf Utimbuf +T utsname Utsname +T uuid_t UuidT diff --git a/c/os/mach_darwin_arm64.go b/c/os/mach_darwin_arm64.go new file mode 100644 index 00000000..e526531b --- /dev/null +++ b/c/os/mach_darwin_arm64.go @@ -0,0 +1,11 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +// Canonical Mach typedefs from the macOS 14.0 SDK. +type MachPortT = c.Uint +type SemaphoreT = MachPortT diff --git a/c/os/sched_param_darwin_arm64.go b/c/os/sched_param_darwin_arm64.go new file mode 100644 index 00000000..52df4233 --- /dev/null +++ b/c/os/sched_param_darwin_arm64.go @@ -0,0 +1,12 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +type SchedParam struct { + SchedPriority c.Int + X__Opaque [4]c.Char +} diff --git a/c/os/sched_param_linux_amd64.go b/c/os/sched_param_linux_amd64.go new file mode 100644 index 00000000..f0cfe961 --- /dev/null +++ b/c/os/sched_param_linux_amd64.go @@ -0,0 +1,12 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +// Data structure to describe a process' schedulability. +type SchedParam struct { + SchedPriority c.Int +} diff --git a/c/os/types_darwin_arm64.go b/c/os/types_darwin_arm64.go new file mode 100644 index 00000000..7b796b16 --- /dev/null +++ b/c/os/types_darwin_arm64.go @@ -0,0 +1,26 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the common libc binding. + +package os + +import ( + "github.com/goplus/lib/c" +) + +type Termios struct { + CIflag TcflagT + COflag TcflagT + CCflag TcflagT + CLflag TcflagT + CCc [20]CcT + CIspeed SpeedT + COspeed SpeedT +} + +type TcflagT = c.Ulong + +type CcT = uint8 + +type SpeedT = c.Ulong diff --git a/c/os/types_linux_amd64.go b/c/os/types_linux_amd64.go new file mode 100644 index 00000000..741ca8eb --- /dev/null +++ b/c/os/types_linux_amd64.go @@ -0,0 +1,52 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. +// Extracted from the common libc binding. + +package os + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +type Termios struct { + CIflag TcflagT + COflag TcflagT + CCflag TcflagT + CLflag TcflagT + CLine CcT + CCc [32]CcT + _llcppg_anon_24 + _llcppg_anon_25 +} + +type _llcppg_anon_24 struct { + _xgo_union [1]uint32 +} + +type _llcppg_anon_25 struct { + _xgo_union [1]uint32 +} + +func (p *_llcppg_anon_24) XGof_ref___ispeed() *SpeedT { + return (*SpeedT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_24) XGof_ref_c_ispeed() *SpeedT { + return (*SpeedT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_25) XGof_ref___ospeed() *SpeedT { + return (*SpeedT)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_25) XGof_ref_c_ospeed() *SpeedT { + return (*SpeedT)(unsafe.Pointer(p)) +} + +type CcT = uint8 + +type SpeedT = c.Uint + +type TcflagT = c.Uint From 5f29b085cac702279a6c4bfac126fd359f3f7395 Mon Sep 17 00:00:00 2001 From: Rick Guo Date: Mon, 19 Oct 2026 17:46:25 +0800 Subject: [PATCH 2/6] Regenerate c/os independently with native platform inputs --- c/os/arm-_types_darwin_arm64.go | 64 + c/os/bits-confname_linux_amd64.go | 320 +++ c/os/bits-confname_linux_arm64.go | 320 +++ c/os/bits-dirent_linux_amd64.go | 8 + c/os/bits-dirent_linux_arm64.go | 16 + c/os/bits-dlfcn_linux_amd64.go | 31 + c/os/bits-dlfcn_linux_arm64.go | 31 + c/os/bits-fcntl-linux_linux_amd64.go | 134 + c/os/bits-fcntl-linux_linux_arm64.go | 131 + c/os/bits-fcntl_linux_amd64.go | 24 + c/os/bits-fcntl_linux_arm64.go | 25 + c/os/bits-local_lim_linux_amd64.go | 45 + c/os/bits-local_lim_linux_arm64.go | 46 + c/os/bits-mman-linux_linux_amd64.go | 118 + c/os/bits-mman-linux_linux_arm64.go | 118 + c/os/bits-mman_linux_amd64.go | 28 + c/os/bits-mman_linux_arm64.go | 26 + c/os/bits-poll_linux_amd64.go | 38 + c/os/bits-poll_linux_arm64.go | 38 + c/os/bits-posix_opt_linux_amd64.go | 84 + c/os/bits-posix_opt_linux_arm64.go | 84 + c/os/bits-resource_linux_amd64.go | 245 ++ c/os/bits-resource_linux_arm64.go | 245 ++ c/os/bits-sched_linux_amd64.go | 51 + c/os/bits-sched_linux_arm64.go | 51 + c/os/bits-stat_linux_amd64.go | 51 + c/os/bits-stat_linux_arm64.go | 59 + c/os/bits-statvfs_linux_amd64.go | 30 + c/os/bits-statvfs_linux_arm64.go | 30 + c/os/bits-termios_linux_amd64.go | 216 ++ c/os/bits-termios_linux_arm64.go | 216 ++ c/os/bits-types_linux_amd64.go | 133 + c/os/bits-types_linux_arm64.go | 133 + c/os/dirent_darwin_arm64.go | 37 + c/os/dirent_linux_amd64.go | 68 + c/os/dirent_linux_arm64.go | 68 + c/os/dlfcn_darwin_arm64.go | 49 + c/os/dlfcn_linux_amd64.go | 37 + c/os/dlfcn_linux_arm64.go | 37 + c/os/fcntl_linux_amd64.go | 122 + c/os/fcntl_linux_arm64.go | 122 + c/os/flags_default.go | 2 +- c/os/flags_linux_amd64.go | 18 + c/os/flags_linux_arm64.go | 18 + c/os/fnmatch_darwin_arm64.go | 35 + c/os/fnmatch_linux_amd64.go | 30 + c/os/fnmatch_linux_arm64.go | 30 + c/os/glob_linux_amd64.go | 84 + c/os/glob_linux_arm64.go | 84 + c/os/grp_darwin_arm64.go | 62 + c/os/grp_linux_amd64.go | 130 + c/os/grp_linux_arm64.go | 130 + c/os/libc_darwin_arm64.go | 2476 ----------------- c/os/libc_linux_amd64.go | 1785 ------------ c/os/libgen_darwin_arm64.go | 22 + c/os/libgen_linux_amd64.go | 27 + c/os/libgen_linux_arm64.go | 24 + c/os/llcppg-flags-linux_amd64.cfg | 25 + c/os/llcppg-flags-linux_arm64.cfg | 25 + c/os/llcppg-linux_amd64.cfg | 141 + c/os/llcppg-linux_arm64.cfg | 141 + c/os/llcppg.cfg | 142 + c/os/llcppg.pub | 181 +- c/os/llcppg_darwin_arm64.go | 7 + c/os/pwd_darwin_arm64.go | 92 + c/os/pwd_linux_amd64.go | 116 + c/os/pwd_linux_arm64.go | 116 + c/os/sched_darwin_arm64.go | 24 + c/os/sched_linux_amd64.go | 53 + c/os/sched_linux_arm64.go | 53 + c/os/sched_param_linux_amd64.go | 12 - c/os/spawn_darwin_arm64.go | 145 + c/os/spawn_linux_amd64.go | 199 ++ c/os/spawn_linux_arm64.go | 199 ++ c/os/sys-_types-_blkcnt_t_darwin_arm64.go | 7 + c/os/sys-_types-_blksize_t_darwin_arm64.go | 7 + ...go => sys-_types-_caddr_t_darwin_arm64.go} | 4 +- c/os/sys-_types-_clock_t_darwin_arm64.go | 7 + c/os/sys-_types-_errno_t_darwin_arm64.go | 9 + c/os/sys-_types-_fd_def_darwin_arm64.go | 22 + c/os/sys-_types-_fd_setsize_darwin_arm64.go | 7 + c/os/sys-_types-_filesec_t_darwin_arm64.go | 9 + c/os/sys-_types-_fsblkcnt_t_darwin_arm64.go | 7 + c/os/sys-_types-_fsfilcnt_t_darwin_arm64.go | 7 + c/os/sys-_types-_fsid_t_darwin_arm64.go | 12 + c/os/sys-_types-_fsobj_id_t_darwin_arm64.go | 11 + c/os/sys-_types-_id_t_darwin_arm64.go | 8 + c/os/sys-_types-_in_addr_t_darwin_arm64.go | 8 + c/os/sys-_types-_in_port_t_darwin_arm64.go | 7 + c/os/sys-_types-_ino64_t_darwin_arm64.go | 8 + c/os/sys-_types-_ino_t_darwin_arm64.go | 8 + c/os/sys-_types-_int16_t_darwin_arm64.go | 7 + c/os/sys-_types-_int32_t_darwin_arm64.go | 9 + c/os/sys-_types-_int64_t_darwin_arm64.go | 9 + c/os/sys-_types-_int8_t_darwin_arm64.go | 7 + c/os/sys-_types-_intptr_t_darwin_arm64.go | 7 + c/os/sys-_types-_key_t_darwin_arm64.go | 8 + c/os/sys-_types-_mach_port_t_darwin_arm64.go | 7 + c/os/sys-_types-_nlink_t_darwin_arm64.go | 8 + c/os/sys-_types-_o_dsync_darwin_arm64.go | 8 + c/os/sys-_types-_o_sync_darwin_arm64.go | 8 + c/os/sys-_types-_rsize_t_darwin_arm64.go | 7 + c/os/sys-_types-_s_ifmt_darwin_arm64.go | 78 + c/os/sys-_types-_seek_set_darwin_arm64.go | 20 + c/os/sys-_types-_size_t_darwin_arm64.go | 7 + c/os/sys-_types-_ssize_t_darwin_arm64.go | 7 + c/os/sys-_types-_suseconds_t_darwin_arm64.go | 7 + c/os/sys-_types-_time_t_darwin_arm64.go | 7 + ...o => sys-_types-_timespec_darwin_arm64.go} | 6 +- c/os/sys-_types-_timeval_darwin_arm64.go | 10 + c/os/sys-_types-_u_char_darwin_arm64.go | 7 + c/os/sys-_types-_u_int16_t_darwin_arm64.go | 7 + c/os/sys-_types-_u_int32_t_darwin_arm64.go | 9 + c/os/sys-_types-_u_int64_t_darwin_arm64.go | 9 + c/os/sys-_types-_u_int8_t_darwin_arm64.go | 7 + c/os/sys-_types-_u_int_darwin_arm64.go | 9 + c/os/sys-_types-_u_short_darwin_arm64.go | 7 + c/os/sys-_types-_uintptr_t_darwin_arm64.go | 9 + c/os/sys-_types-_useconds_t_darwin_arm64.go | 7 + c/os/sys-_types-_uuid_t_darwin_arm64.go | 7 + c/os/sys-_types_darwin_arm64.go | 63 + c/os/sys-dirent_darwin_arm64.go | 24 + c/os/sys-fcntl_darwin_arm64.go | 525 ++++ c/os/sys-file_darwin_arm64.go | 12 + c/os/sys-file_linux_amd64.go | 26 + c/os/sys-file_linux_arm64.go | 26 + c/os/sys-mman_darwin_arm64.go | 229 ++ c/os/sys-mman_linux_amd64.go | 92 + c/os/sys-mman_linux_arm64.go | 92 + c/os/sys-resource_darwin_arm64.go | 468 ++++ c/os/sys-resource_linux_amd64.go | 36 + c/os/sys-resource_linux_arm64.go | 36 + c/os/sys-stat_darwin_arm64.go | 168 ++ c/os/sys-stat_linux_amd64.go | 76 + c/os/sys-stat_linux_arm64.go | 76 + c/os/sys-statvfs_darwin_arm64.go | 35 + c/os/sys-statvfs_linux_amd64.go | 15 + c/os/sys-statvfs_linux_arm64.go | 15 + c/os/sys-termios_darwin_arm64.go | 384 +++ c/os/sys-times_darwin_arm64.go | 18 + c/os/sys-times_linux_amd64.go | 27 + c/os/sys-times_linux_arm64.go | 27 + c/os/sys-types_darwin_arm64.go | 37 + c/os/sys-types_linux_amd64.go | 50 + c/os/sys-types_linux_arm64.go | 50 + c/os/sys-uio_darwin_arm64.go | 39 + c/os/sys-uio_linux_amd64.go | 62 + c/os/sys-uio_linux_arm64.go | 62 + c/os/sys-utsname_darwin_arm64.go | 22 + c/os/sys-utsname_linux_amd64.go | 26 + c/os/sys-utsname_linux_arm64.go | 26 + c/os/sys-wait_darwin_arm64.go | 163 ++ c/os/sys-wait_linux_amd64.go | 45 + c/os/sys-wait_linux_arm64.go | 45 + c/os/termios_darwin_arm64.go | 13 + c/os/termios_linux_amd64.go | 94 + c/os/termios_linux_arm64.go | 94 + c/os/types_darwin_arm64.go | 26 - c/os/types_linux_amd64.go | 52 - c/os/unistd_darwin_arm64.go | 739 +++++ c/os/unistd_linux_amd64.go | 448 +++ c/os/unistd_linux_arm64.go | 448 +++ c/os/utime_darwin_arm64.go | 18 + c/os/utime_linux_amd64.go | 24 + c/os/utime_linux_arm64.go | 24 + 165 files changed, 11518 insertions(+), 4369 deletions(-) create mode 100644 c/os/arm-_types_darwin_arm64.go create mode 100644 c/os/bits-confname_linux_amd64.go create mode 100644 c/os/bits-confname_linux_arm64.go create mode 100644 c/os/bits-dirent_linux_amd64.go create mode 100644 c/os/bits-dirent_linux_arm64.go create mode 100644 c/os/bits-dlfcn_linux_amd64.go create mode 100644 c/os/bits-dlfcn_linux_arm64.go create mode 100644 c/os/bits-fcntl-linux_linux_amd64.go create mode 100644 c/os/bits-fcntl-linux_linux_arm64.go create mode 100644 c/os/bits-fcntl_linux_amd64.go create mode 100644 c/os/bits-fcntl_linux_arm64.go create mode 100644 c/os/bits-local_lim_linux_amd64.go create mode 100644 c/os/bits-local_lim_linux_arm64.go create mode 100644 c/os/bits-mman-linux_linux_amd64.go create mode 100644 c/os/bits-mman-linux_linux_arm64.go create mode 100644 c/os/bits-mman_linux_amd64.go create mode 100644 c/os/bits-mman_linux_arm64.go create mode 100644 c/os/bits-poll_linux_amd64.go create mode 100644 c/os/bits-poll_linux_arm64.go create mode 100644 c/os/bits-posix_opt_linux_amd64.go create mode 100644 c/os/bits-posix_opt_linux_arm64.go create mode 100644 c/os/bits-resource_linux_amd64.go create mode 100644 c/os/bits-resource_linux_arm64.go create mode 100644 c/os/bits-sched_linux_amd64.go create mode 100644 c/os/bits-sched_linux_arm64.go create mode 100644 c/os/bits-stat_linux_amd64.go create mode 100644 c/os/bits-stat_linux_arm64.go create mode 100644 c/os/bits-statvfs_linux_amd64.go create mode 100644 c/os/bits-statvfs_linux_arm64.go create mode 100644 c/os/bits-termios_linux_amd64.go create mode 100644 c/os/bits-termios_linux_arm64.go create mode 100644 c/os/bits-types_linux_amd64.go create mode 100644 c/os/bits-types_linux_arm64.go create mode 100644 c/os/dirent_darwin_arm64.go create mode 100644 c/os/dirent_linux_amd64.go create mode 100644 c/os/dirent_linux_arm64.go create mode 100644 c/os/dlfcn_darwin_arm64.go create mode 100644 c/os/dlfcn_linux_amd64.go create mode 100644 c/os/dlfcn_linux_arm64.go create mode 100644 c/os/fcntl_linux_amd64.go create mode 100644 c/os/fcntl_linux_arm64.go create mode 100644 c/os/flags_linux_amd64.go create mode 100644 c/os/flags_linux_arm64.go create mode 100644 c/os/fnmatch_darwin_arm64.go create mode 100644 c/os/fnmatch_linux_amd64.go create mode 100644 c/os/fnmatch_linux_arm64.go create mode 100644 c/os/glob_linux_amd64.go create mode 100644 c/os/glob_linux_arm64.go create mode 100644 c/os/grp_darwin_arm64.go create mode 100644 c/os/grp_linux_amd64.go create mode 100644 c/os/grp_linux_arm64.go delete mode 100644 c/os/libc_darwin_arm64.go delete mode 100644 c/os/libc_linux_amd64.go create mode 100644 c/os/libgen_darwin_arm64.go create mode 100644 c/os/libgen_linux_amd64.go create mode 100644 c/os/libgen_linux_arm64.go create mode 100644 c/os/llcppg-flags-linux_amd64.cfg create mode 100644 c/os/llcppg-flags-linux_arm64.cfg create mode 100644 c/os/llcppg-linux_amd64.cfg create mode 100644 c/os/llcppg-linux_arm64.cfg create mode 100644 c/os/llcppg.cfg create mode 100644 c/os/llcppg_darwin_arm64.go create mode 100644 c/os/pwd_darwin_arm64.go create mode 100644 c/os/pwd_linux_amd64.go create mode 100644 c/os/pwd_linux_arm64.go create mode 100644 c/os/sched_darwin_arm64.go create mode 100644 c/os/sched_linux_amd64.go create mode 100644 c/os/sched_linux_arm64.go delete mode 100644 c/os/sched_param_linux_amd64.go create mode 100644 c/os/spawn_darwin_arm64.go create mode 100644 c/os/spawn_linux_amd64.go create mode 100644 c/os/spawn_linux_arm64.go create mode 100644 c/os/sys-_types-_blkcnt_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_blksize_t_darwin_arm64.go rename c/os/{mach_darwin_arm64.go => sys-_types-_caddr_t_darwin_arm64.go} (54%) create mode 100644 c/os/sys-_types-_clock_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_errno_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_fd_def_darwin_arm64.go create mode 100644 c/os/sys-_types-_fd_setsize_darwin_arm64.go create mode 100644 c/os/sys-_types-_filesec_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_fsblkcnt_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_fsfilcnt_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_fsid_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_fsobj_id_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_id_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_in_addr_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_in_port_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_ino64_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_ino_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_int16_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_int32_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_int64_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_int8_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_intptr_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_key_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_mach_port_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_nlink_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_o_dsync_darwin_arm64.go create mode 100644 c/os/sys-_types-_o_sync_darwin_arm64.go create mode 100644 c/os/sys-_types-_rsize_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_s_ifmt_darwin_arm64.go create mode 100644 c/os/sys-_types-_seek_set_darwin_arm64.go create mode 100644 c/os/sys-_types-_size_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_ssize_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_suseconds_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_time_t_darwin_arm64.go rename c/os/{sched_param_darwin_arm64.go => sys-_types-_timespec_darwin_arm64.go} (64%) create mode 100644 c/os/sys-_types-_timeval_darwin_arm64.go create mode 100644 c/os/sys-_types-_u_char_darwin_arm64.go create mode 100644 c/os/sys-_types-_u_int16_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_u_int32_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_u_int64_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_u_int8_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_u_int_darwin_arm64.go create mode 100644 c/os/sys-_types-_u_short_darwin_arm64.go create mode 100644 c/os/sys-_types-_uintptr_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_useconds_t_darwin_arm64.go create mode 100644 c/os/sys-_types-_uuid_t_darwin_arm64.go create mode 100644 c/os/sys-_types_darwin_arm64.go create mode 100644 c/os/sys-dirent_darwin_arm64.go create mode 100644 c/os/sys-fcntl_darwin_arm64.go create mode 100644 c/os/sys-file_darwin_arm64.go create mode 100644 c/os/sys-file_linux_amd64.go create mode 100644 c/os/sys-file_linux_arm64.go create mode 100644 c/os/sys-mman_darwin_arm64.go create mode 100644 c/os/sys-mman_linux_amd64.go create mode 100644 c/os/sys-mman_linux_arm64.go create mode 100644 c/os/sys-resource_darwin_arm64.go create mode 100644 c/os/sys-resource_linux_amd64.go create mode 100644 c/os/sys-resource_linux_arm64.go create mode 100644 c/os/sys-stat_darwin_arm64.go create mode 100644 c/os/sys-stat_linux_amd64.go create mode 100644 c/os/sys-stat_linux_arm64.go create mode 100644 c/os/sys-statvfs_darwin_arm64.go create mode 100644 c/os/sys-statvfs_linux_amd64.go create mode 100644 c/os/sys-statvfs_linux_arm64.go create mode 100644 c/os/sys-termios_darwin_arm64.go create mode 100644 c/os/sys-times_darwin_arm64.go create mode 100644 c/os/sys-times_linux_amd64.go create mode 100644 c/os/sys-times_linux_arm64.go create mode 100644 c/os/sys-types_darwin_arm64.go create mode 100644 c/os/sys-types_linux_amd64.go create mode 100644 c/os/sys-types_linux_arm64.go create mode 100644 c/os/sys-uio_darwin_arm64.go create mode 100644 c/os/sys-uio_linux_amd64.go create mode 100644 c/os/sys-uio_linux_arm64.go create mode 100644 c/os/sys-utsname_darwin_arm64.go create mode 100644 c/os/sys-utsname_linux_amd64.go create mode 100644 c/os/sys-utsname_linux_arm64.go create mode 100644 c/os/sys-wait_darwin_arm64.go create mode 100644 c/os/sys-wait_linux_amd64.go create mode 100644 c/os/sys-wait_linux_arm64.go create mode 100644 c/os/termios_darwin_arm64.go create mode 100644 c/os/termios_linux_amd64.go create mode 100644 c/os/termios_linux_arm64.go delete mode 100644 c/os/types_darwin_arm64.go delete mode 100644 c/os/types_linux_amd64.go create mode 100644 c/os/unistd_darwin_arm64.go create mode 100644 c/os/unistd_linux_amd64.go create mode 100644 c/os/unistd_linux_arm64.go create mode 100644 c/os/utime_darwin_arm64.go create mode 100644 c/os/utime_linux_amd64.go create mode 100644 c/os/utime_linux_arm64.go diff --git a/c/os/arm-_types_darwin_arm64.go b/c/os/arm-_types_darwin_arm64.go new file mode 100644 index 00000000..13dfc6d2 --- /dev/null +++ b/c/os/arm-_types_darwin_arm64.go @@ -0,0 +1,64 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +type X__MbstateT struct { + _xgo_union [16]uint64 +} +type X__Int8T = int8 +type X__Uint8T = uint8 +type X__Int16T = int16 +type X__Uint16T = uint16 +type X__Int32T = c.Int +type X__Uint32T = c.Uint +type X__Int64T = c.LongLong +type X__Uint64T = c.UlongLong +type X__DarwinIntptrT = c.Long +type X__DarwinNaturalT = c.Uint + +// ct_rune_t +type X__DarwinCtRuneT = c.Int + +// mbstate_t +type X__DarwinMbstateT = X__MbstateT + +// ptr1 - ptr2 +type X__DarwinPtrdiffT = c.Long + +// sizeof() +type X__DarwinSizeT = c.Ulong + +// wchar_t +type X__DarwinWcharT = c.Int + +// rune_t +type X__DarwinRuneT = X__DarwinWcharT + +// wint_t +type X__DarwinWintT = c.Int + +// clock() +type X__DarwinClockT = c.Ulong + +// socklen_t (duh) +type X__DarwinSocklenT = X__Uint32T + +// byte count or error +type X__DarwinSsizeT = c.Long + +// time() +type X__DarwinTimeT = c.Long + +func (p *X__MbstateT) XGof_ref___mbstate8() *[128]c.Char { + return (*[128]c.Char)(unsafe.Pointer(p)) +} +func (p *X__MbstateT) XGof_ref__mbstateL() *c.LongLong { + return (*c.LongLong)(unsafe.Pointer(p)) +} diff --git a/c/os/bits-confname_linux_amd64.go b/c/os/bits-confname_linux_amd64.go new file mode 100644 index 00000000..25aec9ba --- /dev/null +++ b/c/os/bits-confname_linux_amd64.go @@ -0,0 +1,320 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// Values for the NAME argument to `pathconf' and `fpathconf'. +const ( + X_PC_LINK_MAX = 0 + X_PC_MAX_CANON = 1 + X_PC_MAX_INPUT = 2 + X_PC_NAME_MAX = 3 + X_PC_PATH_MAX = 4 + X_PC_PIPE_BUF = 5 + X_PC_CHOWN_RESTRICTED = 6 + X_PC_NO_TRUNC = 7 + X_PC_VDISABLE = 8 + X_PC_SYNC_IO = 9 + X_PC_ASYNC_IO = 10 + X_PC_PRIO_IO = 11 + X_PC_SOCK_MAXBUF = 12 + X_PC_FILESIZEBITS = 13 + X_PC_REC_INCR_XFER_SIZE = 14 + X_PC_REC_MAX_XFER_SIZE = 15 + X_PC_REC_MIN_XFER_SIZE = 16 + X_PC_REC_XFER_ALIGN = 17 + X_PC_ALLOC_SIZE_MIN = 18 + X_PC_SYMLINK_MAX = 19 + X_PC_2_SYMLINKS = 20 +) + +// Values for the argument to `sysconf'. +const ( + X_SC_ARG_MAX = 0 + X_SC_CHILD_MAX = 1 + X_SC_CLK_TCK = 2 + X_SC_NGROUPS_MAX = 3 + X_SC_OPEN_MAX = 4 + X_SC_STREAM_MAX = 5 + X_SC_TZNAME_MAX = 6 + X_SC_JOB_CONTROL = 7 + X_SC_SAVED_IDS = 8 + X_SC_REALTIME_SIGNALS = 9 + X_SC_PRIORITY_SCHEDULING = 10 + X_SC_TIMERS = 11 + X_SC_ASYNCHRONOUS_IO = 12 + X_SC_PRIORITIZED_IO = 13 + X_SC_SYNCHRONIZED_IO = 14 + X_SC_FSYNC = 15 + X_SC_MAPPED_FILES = 16 + X_SC_MEMLOCK = 17 + X_SC_MEMLOCK_RANGE = 18 + X_SC_MEMORY_PROTECTION = 19 + X_SC_MESSAGE_PASSING = 20 + X_SC_SEMAPHORES = 21 + X_SC_SHARED_MEMORY_OBJECTS = 22 + X_SC_AIO_LISTIO_MAX = 23 + X_SC_AIO_MAX = 24 + X_SC_AIO_PRIO_DELTA_MAX = 25 + X_SC_DELAYTIMER_MAX = 26 + X_SC_MQ_OPEN_MAX = 27 + X_SC_MQ_PRIO_MAX = 28 + X_SC_VERSION = 29 + X_SC_PAGESIZE = 30 + X_SC_RTSIG_MAX = 31 + X_SC_SEM_NSEMS_MAX = 32 + X_SC_SEM_VALUE_MAX = 33 + X_SC_SIGQUEUE_MAX = 34 + X_SC_TIMER_MAX = 35 + // Values for the argument to `sysconf' + // corresponding to _POSIX2_* symbols. + X_SC_BC_BASE_MAX = 36 + X_SC_BC_DIM_MAX = 37 + X_SC_BC_SCALE_MAX = 38 + X_SC_BC_STRING_MAX = 39 + X_SC_COLL_WEIGHTS_MAX = 40 + X_SC_EQUIV_CLASS_MAX = 41 + X_SC_EXPR_NEST_MAX = 42 + X_SC_LINE_MAX = 43 + X_SC_RE_DUP_MAX = 44 + X_SC_CHARCLASS_NAME_MAX = 45 + X_SC_2_VERSION = 46 + X_SC_2_C_BIND = 47 + X_SC_2_C_DEV = 48 + X_SC_2_FORT_DEV = 49 + X_SC_2_FORT_RUN = 50 + X_SC_2_SW_DEV = 51 + X_SC_2_LOCALEDEF = 52 + X_SC_PII = 53 + X_SC_PII_XTI = 54 + X_SC_PII_SOCKET = 55 + X_SC_PII_INTERNET = 56 + X_SC_PII_OSI = 57 + X_SC_POLL = 58 + X_SC_SELECT = 59 + X_SC_UIO_MAXIOV = 60 + X_SC_IOV_MAX = 60 + X_SC_PII_INTERNET_STREAM = 61 + X_SC_PII_INTERNET_DGRAM = 62 + X_SC_PII_OSI_COTS = 63 + X_SC_PII_OSI_CLTS = 64 + X_SC_PII_OSI_M = 65 + X_SC_T_IOV_MAX = 66 + // Values according to POSIX 1003.1c (POSIX threads). + X_SC_THREADS = 67 + X_SC_THREAD_SAFE_FUNCTIONS = 68 + X_SC_GETGR_R_SIZE_MAX = 69 + X_SC_GETPW_R_SIZE_MAX = 70 + X_SC_LOGIN_NAME_MAX = 71 + X_SC_TTY_NAME_MAX = 72 + X_SC_THREAD_DESTRUCTOR_ITERATIONS = 73 + X_SC_THREAD_KEYS_MAX = 74 + X_SC_THREAD_STACK_MIN = 75 + X_SC_THREAD_THREADS_MAX = 76 + X_SC_THREAD_ATTR_STACKADDR = 77 + X_SC_THREAD_ATTR_STACKSIZE = 78 + X_SC_THREAD_PRIORITY_SCHEDULING = 79 + X_SC_THREAD_PRIO_INHERIT = 80 + X_SC_THREAD_PRIO_PROTECT = 81 + X_SC_THREAD_PROCESS_SHARED = 82 + X_SC_NPROCESSORS_CONF = 83 + X_SC_NPROCESSORS_ONLN = 84 + X_SC_PHYS_PAGES = 85 + X_SC_AVPHYS_PAGES = 86 + X_SC_ATEXIT_MAX = 87 + X_SC_PASS_MAX = 88 + X_SC_XOPEN_VERSION = 89 + X_SC_XOPEN_XCU_VERSION = 90 + X_SC_XOPEN_UNIX = 91 + X_SC_XOPEN_CRYPT = 92 + X_SC_XOPEN_ENH_I18N = 93 + X_SC_XOPEN_SHM = 94 + X_SC_2_CHAR_TERM = 95 + X_SC_2_C_VERSION = 96 + X_SC_2_UPE = 97 + X_SC_XOPEN_XPG2 = 98 + X_SC_XOPEN_XPG3 = 99 + X_SC_XOPEN_XPG4 = 100 + X_SC_CHAR_BIT = 101 + X_SC_CHAR_MAX = 102 + X_SC_CHAR_MIN = 103 + X_SC_INT_MAX = 104 + X_SC_INT_MIN = 105 + X_SC_LONG_BIT = 106 + X_SC_WORD_BIT = 107 + X_SC_MB_LEN_MAX = 108 + X_SC_NZERO = 109 + X_SC_SSIZE_MAX = 110 + X_SC_SCHAR_MAX = 111 + X_SC_SCHAR_MIN = 112 + X_SC_SHRT_MAX = 113 + X_SC_SHRT_MIN = 114 + X_SC_UCHAR_MAX = 115 + X_SC_UINT_MAX = 116 + X_SC_ULONG_MAX = 117 + X_SC_USHRT_MAX = 118 + X_SC_NL_ARGMAX = 119 + X_SC_NL_LANGMAX = 120 + X_SC_NL_MSGMAX = 121 + X_SC_NL_NMAX = 122 + X_SC_NL_SETMAX = 123 + X_SC_NL_TEXTMAX = 124 + X_SC_XBS5_ILP32_OFF32 = 125 + X_SC_XBS5_ILP32_OFFBIG = 126 + X_SC_XBS5_LP64_OFF64 = 127 + X_SC_XBS5_LPBIG_OFFBIG = 128 + X_SC_XOPEN_LEGACY = 129 + X_SC_XOPEN_REALTIME = 130 + X_SC_XOPEN_REALTIME_THREADS = 131 + X_SC_ADVISORY_INFO = 132 + X_SC_BARRIERS = 133 + X_SC_BASE = 134 + X_SC_C_LANG_SUPPORT = 135 + X_SC_C_LANG_SUPPORT_R = 136 + X_SC_CLOCK_SELECTION = 137 + X_SC_CPUTIME = 138 + X_SC_THREAD_CPUTIME = 139 + X_SC_DEVICE_IO = 140 + X_SC_DEVICE_SPECIFIC = 141 + X_SC_DEVICE_SPECIFIC_R = 142 + X_SC_FD_MGMT = 143 + X_SC_FIFO = 144 + X_SC_PIPE = 145 + X_SC_FILE_ATTRIBUTES = 146 + X_SC_FILE_LOCKING = 147 + X_SC_FILE_SYSTEM = 148 + X_SC_MONOTONIC_CLOCK = 149 + X_SC_MULTI_PROCESS = 150 + X_SC_SINGLE_PROCESS = 151 + X_SC_NETWORKING = 152 + X_SC_READER_WRITER_LOCKS = 153 + X_SC_SPIN_LOCKS = 154 + X_SC_REGEXP = 155 + X_SC_REGEX_VERSION = 156 + X_SC_SHELL = 157 + X_SC_SIGNALS = 158 + X_SC_SPAWN = 159 + X_SC_SPORADIC_SERVER = 160 + X_SC_THREAD_SPORADIC_SERVER = 161 + X_SC_SYSTEM_DATABASE = 162 + X_SC_SYSTEM_DATABASE_R = 163 + X_SC_TIMEOUTS = 164 + X_SC_TYPED_MEMORY_OBJECTS = 165 + X_SC_USER_GROUPS = 166 + X_SC_USER_GROUPS_R = 167 + X_SC_2_PBS = 168 + X_SC_2_PBS_ACCOUNTING = 169 + X_SC_2_PBS_LOCATE = 170 + X_SC_2_PBS_MESSAGE = 171 + X_SC_2_PBS_TRACK = 172 + X_SC_SYMLOOP_MAX = 173 + X_SC_STREAMS = 174 + X_SC_2_PBS_CHECKPOINT = 175 + X_SC_V6_ILP32_OFF32 = 176 + X_SC_V6_ILP32_OFFBIG = 177 + X_SC_V6_LP64_OFF64 = 178 + X_SC_V6_LPBIG_OFFBIG = 179 + X_SC_HOST_NAME_MAX = 180 + X_SC_TRACE = 181 + X_SC_TRACE_EVENT_FILTER = 182 + X_SC_TRACE_INHERIT = 183 + X_SC_TRACE_LOG = 184 + X_SC_LEVEL1_ICACHE_SIZE = 185 + X_SC_LEVEL1_ICACHE_ASSOC = 186 + X_SC_LEVEL1_ICACHE_LINESIZE = 187 + X_SC_LEVEL1_DCACHE_SIZE = 188 + X_SC_LEVEL1_DCACHE_ASSOC = 189 + X_SC_LEVEL1_DCACHE_LINESIZE = 190 + X_SC_LEVEL2_CACHE_SIZE = 191 + X_SC_LEVEL2_CACHE_ASSOC = 192 + X_SC_LEVEL2_CACHE_LINESIZE = 193 + X_SC_LEVEL3_CACHE_SIZE = 194 + X_SC_LEVEL3_CACHE_ASSOC = 195 + X_SC_LEVEL3_CACHE_LINESIZE = 196 + X_SC_LEVEL4_CACHE_SIZE = 197 + X_SC_LEVEL4_CACHE_ASSOC = 198 + X_SC_LEVEL4_CACHE_LINESIZE = 199 + X_SC_IPV6 = 235 + X_SC_RAW_SOCKETS = 236 + X_SC_V7_ILP32_OFF32 = 237 + X_SC_V7_ILP32_OFFBIG = 238 + X_SC_V7_LP64_OFF64 = 239 + X_SC_V7_LPBIG_OFFBIG = 240 + X_SC_SS_REPL_MAX = 241 + X_SC_TRACE_EVENT_NAME_MAX = 242 + X_SC_TRACE_NAME_MAX = 243 + X_SC_TRACE_SYS_MAX = 244 + X_SC_TRACE_USER_EVENT_MAX = 245 + X_SC_XOPEN_STREAMS = 246 + X_SC_THREAD_ROBUST_PRIO_INHERIT = 247 + X_SC_THREAD_ROBUST_PRIO_PROTECT = 248 +) + +// Values for the NAME argument to `confstr'. +const ( + X_CS_PATH = 0 + X_CS_V6_WIDTH_RESTRICTED_ENVS = 1 + X_CS_GNU_LIBC_VERSION = 2 + X_CS_GNU_LIBPTHREAD_VERSION = 3 + X_CS_V5_WIDTH_RESTRICTED_ENVS = 4 + X_CS_V7_WIDTH_RESTRICTED_ENVS = 5 + X_CS_LFS_CFLAGS = 1000 + X_CS_LFS_LDFLAGS = 1001 + X_CS_LFS_LIBS = 1002 + X_CS_LFS_LINTFLAGS = 1003 + X_CS_LFS64_CFLAGS = 1004 + X_CS_LFS64_LDFLAGS = 1005 + X_CS_LFS64_LIBS = 1006 + X_CS_LFS64_LINTFLAGS = 1007 + X_CS_XBS5_ILP32_OFF32_CFLAGS = 1100 + X_CS_XBS5_ILP32_OFF32_LDFLAGS = 1101 + X_CS_XBS5_ILP32_OFF32_LIBS = 1102 + X_CS_XBS5_ILP32_OFF32_LINTFLAGS = 1103 + X_CS_XBS5_ILP32_OFFBIG_CFLAGS = 1104 + X_CS_XBS5_ILP32_OFFBIG_LDFLAGS = 1105 + X_CS_XBS5_ILP32_OFFBIG_LIBS = 1106 + X_CS_XBS5_ILP32_OFFBIG_LINTFLAGS = 1107 + X_CS_XBS5_LP64_OFF64_CFLAGS = 1108 + X_CS_XBS5_LP64_OFF64_LDFLAGS = 1109 + X_CS_XBS5_LP64_OFF64_LIBS = 1110 + X_CS_XBS5_LP64_OFF64_LINTFLAGS = 1111 + X_CS_XBS5_LPBIG_OFFBIG_CFLAGS = 1112 + X_CS_XBS5_LPBIG_OFFBIG_LDFLAGS = 1113 + X_CS_XBS5_LPBIG_OFFBIG_LIBS = 1114 + X_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS = 1115 + X_CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116 + X_CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117 + X_CS_POSIX_V6_ILP32_OFF32_LIBS = 1118 + X_CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119 + X_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120 + X_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121 + X_CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122 + X_CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123 + X_CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124 + X_CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125 + X_CS_POSIX_V6_LP64_OFF64_LIBS = 1126 + X_CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127 + X_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128 + X_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129 + X_CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130 + X_CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131 + X_CS_POSIX_V7_ILP32_OFF32_CFLAGS = 1132 + X_CS_POSIX_V7_ILP32_OFF32_LDFLAGS = 1133 + X_CS_POSIX_V7_ILP32_OFF32_LIBS = 1134 + X_CS_POSIX_V7_ILP32_OFF32_LINTFLAGS = 1135 + X_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS = 1136 + X_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS = 1137 + X_CS_POSIX_V7_ILP32_OFFBIG_LIBS = 1138 + X_CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139 + X_CS_POSIX_V7_LP64_OFF64_CFLAGS = 1140 + X_CS_POSIX_V7_LP64_OFF64_LDFLAGS = 1141 + X_CS_POSIX_V7_LP64_OFF64_LIBS = 1142 + X_CS_POSIX_V7_LP64_OFF64_LINTFLAGS = 1143 + X_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS = 1144 + X_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS = 1145 + X_CS_POSIX_V7_LPBIG_OFFBIG_LIBS = 1146 + X_CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147 + X_CS_V6_ENV = 1148 + X_CS_V7_ENV = 1149 +) diff --git a/c/os/bits-confname_linux_arm64.go b/c/os/bits-confname_linux_arm64.go new file mode 100644 index 00000000..435c1580 --- /dev/null +++ b/c/os/bits-confname_linux_arm64.go @@ -0,0 +1,320 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// Values for the NAME argument to `pathconf' and `fpathconf'. +const ( + X_PC_LINK_MAX = 0 + X_PC_MAX_CANON = 1 + X_PC_MAX_INPUT = 2 + X_PC_NAME_MAX = 3 + X_PC_PATH_MAX = 4 + X_PC_PIPE_BUF = 5 + X_PC_CHOWN_RESTRICTED = 6 + X_PC_NO_TRUNC = 7 + X_PC_VDISABLE = 8 + X_PC_SYNC_IO = 9 + X_PC_ASYNC_IO = 10 + X_PC_PRIO_IO = 11 + X_PC_SOCK_MAXBUF = 12 + X_PC_FILESIZEBITS = 13 + X_PC_REC_INCR_XFER_SIZE = 14 + X_PC_REC_MAX_XFER_SIZE = 15 + X_PC_REC_MIN_XFER_SIZE = 16 + X_PC_REC_XFER_ALIGN = 17 + X_PC_ALLOC_SIZE_MIN = 18 + X_PC_SYMLINK_MAX = 19 + X_PC_2_SYMLINKS = 20 +) + +// Values for the argument to `sysconf'. +const ( + X_SC_ARG_MAX = 0 + X_SC_CHILD_MAX = 1 + X_SC_CLK_TCK = 2 + X_SC_NGROUPS_MAX = 3 + X_SC_OPEN_MAX = 4 + X_SC_STREAM_MAX = 5 + X_SC_TZNAME_MAX = 6 + X_SC_JOB_CONTROL = 7 + X_SC_SAVED_IDS = 8 + X_SC_REALTIME_SIGNALS = 9 + X_SC_PRIORITY_SCHEDULING = 10 + X_SC_TIMERS = 11 + X_SC_ASYNCHRONOUS_IO = 12 + X_SC_PRIORITIZED_IO = 13 + X_SC_SYNCHRONIZED_IO = 14 + X_SC_FSYNC = 15 + X_SC_MAPPED_FILES = 16 + X_SC_MEMLOCK = 17 + X_SC_MEMLOCK_RANGE = 18 + X_SC_MEMORY_PROTECTION = 19 + X_SC_MESSAGE_PASSING = 20 + X_SC_SEMAPHORES = 21 + X_SC_SHARED_MEMORY_OBJECTS = 22 + X_SC_AIO_LISTIO_MAX = 23 + X_SC_AIO_MAX = 24 + X_SC_AIO_PRIO_DELTA_MAX = 25 + X_SC_DELAYTIMER_MAX = 26 + X_SC_MQ_OPEN_MAX = 27 + X_SC_MQ_PRIO_MAX = 28 + X_SC_VERSION = 29 + X_SC_PAGESIZE = 30 + X_SC_RTSIG_MAX = 31 + X_SC_SEM_NSEMS_MAX = 32 + X_SC_SEM_VALUE_MAX = 33 + X_SC_SIGQUEUE_MAX = 34 + X_SC_TIMER_MAX = 35 + // Values for the argument to `sysconf' + // corresponding to _POSIX2_* symbols. + X_SC_BC_BASE_MAX = 36 + X_SC_BC_DIM_MAX = 37 + X_SC_BC_SCALE_MAX = 38 + X_SC_BC_STRING_MAX = 39 + X_SC_COLL_WEIGHTS_MAX = 40 + X_SC_EQUIV_CLASS_MAX = 41 + X_SC_EXPR_NEST_MAX = 42 + X_SC_LINE_MAX = 43 + X_SC_RE_DUP_MAX = 44 + X_SC_CHARCLASS_NAME_MAX = 45 + X_SC_2_VERSION = 46 + X_SC_2_C_BIND = 47 + X_SC_2_C_DEV = 48 + X_SC_2_FORT_DEV = 49 + X_SC_2_FORT_RUN = 50 + X_SC_2_SW_DEV = 51 + X_SC_2_LOCALEDEF = 52 + X_SC_PII = 53 + X_SC_PII_XTI = 54 + X_SC_PII_SOCKET = 55 + X_SC_PII_INTERNET = 56 + X_SC_PII_OSI = 57 + X_SC_POLL = 58 + X_SC_SELECT = 59 + X_SC_UIO_MAXIOV = 60 + X_SC_IOV_MAX = 60 + X_SC_PII_INTERNET_STREAM = 61 + X_SC_PII_INTERNET_DGRAM = 62 + X_SC_PII_OSI_COTS = 63 + X_SC_PII_OSI_CLTS = 64 + X_SC_PII_OSI_M = 65 + X_SC_T_IOV_MAX = 66 + // Values according to POSIX 1003.1c (POSIX threads). + X_SC_THREADS = 67 + X_SC_THREAD_SAFE_FUNCTIONS = 68 + X_SC_GETGR_R_SIZE_MAX = 69 + X_SC_GETPW_R_SIZE_MAX = 70 + X_SC_LOGIN_NAME_MAX = 71 + X_SC_TTY_NAME_MAX = 72 + X_SC_THREAD_DESTRUCTOR_ITERATIONS = 73 + X_SC_THREAD_KEYS_MAX = 74 + X_SC_THREAD_STACK_MIN = 75 + X_SC_THREAD_THREADS_MAX = 76 + X_SC_THREAD_ATTR_STACKADDR = 77 + X_SC_THREAD_ATTR_STACKSIZE = 78 + X_SC_THREAD_PRIORITY_SCHEDULING = 79 + X_SC_THREAD_PRIO_INHERIT = 80 + X_SC_THREAD_PRIO_PROTECT = 81 + X_SC_THREAD_PROCESS_SHARED = 82 + X_SC_NPROCESSORS_CONF = 83 + X_SC_NPROCESSORS_ONLN = 84 + X_SC_PHYS_PAGES = 85 + X_SC_AVPHYS_PAGES = 86 + X_SC_ATEXIT_MAX = 87 + X_SC_PASS_MAX = 88 + X_SC_XOPEN_VERSION = 89 + X_SC_XOPEN_XCU_VERSION = 90 + X_SC_XOPEN_UNIX = 91 + X_SC_XOPEN_CRYPT = 92 + X_SC_XOPEN_ENH_I18N = 93 + X_SC_XOPEN_SHM = 94 + X_SC_2_CHAR_TERM = 95 + X_SC_2_C_VERSION = 96 + X_SC_2_UPE = 97 + X_SC_XOPEN_XPG2 = 98 + X_SC_XOPEN_XPG3 = 99 + X_SC_XOPEN_XPG4 = 100 + X_SC_CHAR_BIT = 101 + X_SC_CHAR_MAX = 102 + X_SC_CHAR_MIN = 103 + X_SC_INT_MAX = 104 + X_SC_INT_MIN = 105 + X_SC_LONG_BIT = 106 + X_SC_WORD_BIT = 107 + X_SC_MB_LEN_MAX = 108 + X_SC_NZERO = 109 + X_SC_SSIZE_MAX = 110 + X_SC_SCHAR_MAX = 111 + X_SC_SCHAR_MIN = 112 + X_SC_SHRT_MAX = 113 + X_SC_SHRT_MIN = 114 + X_SC_UCHAR_MAX = 115 + X_SC_UINT_MAX = 116 + X_SC_ULONG_MAX = 117 + X_SC_USHRT_MAX = 118 + X_SC_NL_ARGMAX = 119 + X_SC_NL_LANGMAX = 120 + X_SC_NL_MSGMAX = 121 + X_SC_NL_NMAX = 122 + X_SC_NL_SETMAX = 123 + X_SC_NL_TEXTMAX = 124 + X_SC_XBS5_ILP32_OFF32 = 125 + X_SC_XBS5_ILP32_OFFBIG = 126 + X_SC_XBS5_LP64_OFF64 = 127 + X_SC_XBS5_LPBIG_OFFBIG = 128 + X_SC_XOPEN_LEGACY = 129 + X_SC_XOPEN_REALTIME = 130 + X_SC_XOPEN_REALTIME_THREADS = 131 + X_SC_ADVISORY_INFO = 132 + X_SC_BARRIERS = 133 + X_SC_BASE = 134 + X_SC_C_LANG_SUPPORT = 135 + X_SC_C_LANG_SUPPORT_R = 136 + X_SC_CLOCK_SELECTION = 137 + X_SC_CPUTIME = 138 + X_SC_THREAD_CPUTIME = 139 + X_SC_DEVICE_IO = 140 + X_SC_DEVICE_SPECIFIC = 141 + X_SC_DEVICE_SPECIFIC_R = 142 + X_SC_FD_MGMT = 143 + X_SC_FIFO = 144 + X_SC_PIPE = 145 + X_SC_FILE_ATTRIBUTES = 146 + X_SC_FILE_LOCKING = 147 + X_SC_FILE_SYSTEM = 148 + X_SC_MONOTONIC_CLOCK = 149 + X_SC_MULTI_PROCESS = 150 + X_SC_SINGLE_PROCESS = 151 + X_SC_NETWORKING = 152 + X_SC_READER_WRITER_LOCKS = 153 + X_SC_SPIN_LOCKS = 154 + X_SC_REGEXP = 155 + X_SC_REGEX_VERSION = 156 + X_SC_SHELL = 157 + X_SC_SIGNALS = 158 + X_SC_SPAWN = 159 + X_SC_SPORADIC_SERVER = 160 + X_SC_THREAD_SPORADIC_SERVER = 161 + X_SC_SYSTEM_DATABASE = 162 + X_SC_SYSTEM_DATABASE_R = 163 + X_SC_TIMEOUTS = 164 + X_SC_TYPED_MEMORY_OBJECTS = 165 + X_SC_USER_GROUPS = 166 + X_SC_USER_GROUPS_R = 167 + X_SC_2_PBS = 168 + X_SC_2_PBS_ACCOUNTING = 169 + X_SC_2_PBS_LOCATE = 170 + X_SC_2_PBS_MESSAGE = 171 + X_SC_2_PBS_TRACK = 172 + X_SC_SYMLOOP_MAX = 173 + X_SC_STREAMS = 174 + X_SC_2_PBS_CHECKPOINT = 175 + X_SC_V6_ILP32_OFF32 = 176 + X_SC_V6_ILP32_OFFBIG = 177 + X_SC_V6_LP64_OFF64 = 178 + X_SC_V6_LPBIG_OFFBIG = 179 + X_SC_HOST_NAME_MAX = 180 + X_SC_TRACE = 181 + X_SC_TRACE_EVENT_FILTER = 182 + X_SC_TRACE_INHERIT = 183 + X_SC_TRACE_LOG = 184 + X_SC_LEVEL1_ICACHE_SIZE = 185 + X_SC_LEVEL1_ICACHE_ASSOC = 186 + X_SC_LEVEL1_ICACHE_LINESIZE = 187 + X_SC_LEVEL1_DCACHE_SIZE = 188 + X_SC_LEVEL1_DCACHE_ASSOC = 189 + X_SC_LEVEL1_DCACHE_LINESIZE = 190 + X_SC_LEVEL2_CACHE_SIZE = 191 + X_SC_LEVEL2_CACHE_ASSOC = 192 + X_SC_LEVEL2_CACHE_LINESIZE = 193 + X_SC_LEVEL3_CACHE_SIZE = 194 + X_SC_LEVEL3_CACHE_ASSOC = 195 + X_SC_LEVEL3_CACHE_LINESIZE = 196 + X_SC_LEVEL4_CACHE_SIZE = 197 + X_SC_LEVEL4_CACHE_ASSOC = 198 + X_SC_LEVEL4_CACHE_LINESIZE = 199 + X_SC_IPV6 = 235 + X_SC_RAW_SOCKETS = 236 + X_SC_V7_ILP32_OFF32 = 237 + X_SC_V7_ILP32_OFFBIG = 238 + X_SC_V7_LP64_OFF64 = 239 + X_SC_V7_LPBIG_OFFBIG = 240 + X_SC_SS_REPL_MAX = 241 + X_SC_TRACE_EVENT_NAME_MAX = 242 + X_SC_TRACE_NAME_MAX = 243 + X_SC_TRACE_SYS_MAX = 244 + X_SC_TRACE_USER_EVENT_MAX = 245 + X_SC_XOPEN_STREAMS = 246 + X_SC_THREAD_ROBUST_PRIO_INHERIT = 247 + X_SC_THREAD_ROBUST_PRIO_PROTECT = 248 +) + +// Values for the NAME argument to `confstr'. +const ( + X_CS_PATH = 0 + X_CS_V6_WIDTH_RESTRICTED_ENVS = 1 + X_CS_GNU_LIBC_VERSION = 2 + X_CS_GNU_LIBPTHREAD_VERSION = 3 + X_CS_V5_WIDTH_RESTRICTED_ENVS = 4 + X_CS_V7_WIDTH_RESTRICTED_ENVS = 5 + X_CS_LFS_CFLAGS = 1000 + X_CS_LFS_LDFLAGS = 1001 + X_CS_LFS_LIBS = 1002 + X_CS_LFS_LINTFLAGS = 1003 + X_CS_LFS64_CFLAGS = 1004 + X_CS_LFS64_LDFLAGS = 1005 + X_CS_LFS64_LIBS = 1006 + X_CS_LFS64_LINTFLAGS = 1007 + X_CS_XBS5_ILP32_OFF32_CFLAGS = 1100 + X_CS_XBS5_ILP32_OFF32_LDFLAGS = 1101 + X_CS_XBS5_ILP32_OFF32_LIBS = 1102 + X_CS_XBS5_ILP32_OFF32_LINTFLAGS = 1103 + X_CS_XBS5_ILP32_OFFBIG_CFLAGS = 1104 + X_CS_XBS5_ILP32_OFFBIG_LDFLAGS = 1105 + X_CS_XBS5_ILP32_OFFBIG_LIBS = 1106 + X_CS_XBS5_ILP32_OFFBIG_LINTFLAGS = 1107 + X_CS_XBS5_LP64_OFF64_CFLAGS = 1108 + X_CS_XBS5_LP64_OFF64_LDFLAGS = 1109 + X_CS_XBS5_LP64_OFF64_LIBS = 1110 + X_CS_XBS5_LP64_OFF64_LINTFLAGS = 1111 + X_CS_XBS5_LPBIG_OFFBIG_CFLAGS = 1112 + X_CS_XBS5_LPBIG_OFFBIG_LDFLAGS = 1113 + X_CS_XBS5_LPBIG_OFFBIG_LIBS = 1114 + X_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS = 1115 + X_CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116 + X_CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117 + X_CS_POSIX_V6_ILP32_OFF32_LIBS = 1118 + X_CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119 + X_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120 + X_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121 + X_CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122 + X_CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123 + X_CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124 + X_CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125 + X_CS_POSIX_V6_LP64_OFF64_LIBS = 1126 + X_CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127 + X_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128 + X_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129 + X_CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130 + X_CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131 + X_CS_POSIX_V7_ILP32_OFF32_CFLAGS = 1132 + X_CS_POSIX_V7_ILP32_OFF32_LDFLAGS = 1133 + X_CS_POSIX_V7_ILP32_OFF32_LIBS = 1134 + X_CS_POSIX_V7_ILP32_OFF32_LINTFLAGS = 1135 + X_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS = 1136 + X_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS = 1137 + X_CS_POSIX_V7_ILP32_OFFBIG_LIBS = 1138 + X_CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139 + X_CS_POSIX_V7_LP64_OFF64_CFLAGS = 1140 + X_CS_POSIX_V7_LP64_OFF64_LDFLAGS = 1141 + X_CS_POSIX_V7_LP64_OFF64_LIBS = 1142 + X_CS_POSIX_V7_LP64_OFF64_LINTFLAGS = 1143 + X_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS = 1144 + X_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS = 1145 + X_CS_POSIX_V7_LPBIG_OFFBIG_LIBS = 1146 + X_CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147 + X_CS_V6_ENV = 1148 + X_CS_V7_ENV = 1149 +) diff --git a/c/os/bits-dirent_linux_amd64.go b/c/os/bits-dirent_linux_amd64.go new file mode 100644 index 00000000..cc8714ad --- /dev/null +++ b/c/os/bits-dirent_linux_amd64.go @@ -0,0 +1,8 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// Inform libc code that these two types are effectively identical. +const X_DIRENT_MATCHES_DIRENT64 = 1 diff --git a/c/os/bits-dirent_linux_arm64.go b/c/os/bits-dirent_linux_arm64.go new file mode 100644 index 00000000..877f9588 --- /dev/null +++ b/c/os/bits-dirent_linux_arm64.go @@ -0,0 +1,16 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// Inform libc code that these two types are effectively identical. +const X_DIRENT_MATCHES_DIRENT64 = 1 + +type Dirent struct { + DIno X__InoT + DOff X__OffT + DReclen uint16 + DType uint8 + DName [256]uint8 +} diff --git a/c/os/bits-dlfcn_linux_amd64.go b/c/os/bits-dlfcn_linux_amd64.go new file mode 100644 index 00000000..e5904a0f --- /dev/null +++ b/c/os/bits-dlfcn_linux_amd64.go @@ -0,0 +1,31 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// The MODE argument to `dlopen' contains one of the following: +const ( + RTLD_LAZY = 1 + // Immediate function call binding. + RTLD_NOW = 2 + // Mask of binding time value. + RTLD_BINDING_MASK = 3 + // Do not load the object. + RTLD_NOLOAD = 4 + // Use deep binding. + RTLD_DEEPBIND = 8 +) + +// If the following bit is set in the MODE argument to `dlopen', +// the symbols of the loaded object and its dependencies are made +// visible as if the object were linked directly into the program. +const RTLD_GLOBAL = 256 + +// Unix98 demands the following flag which is the inverse to RTLD_GLOBAL. +// The implementation does this by default and so we can define the +// value to zero. +const RTLD_LOCAL = 0 + +// Do not delete object when closed. +const RTLD_NODELETE = 4096 diff --git a/c/os/bits-dlfcn_linux_arm64.go b/c/os/bits-dlfcn_linux_arm64.go new file mode 100644 index 00000000..dfafa544 --- /dev/null +++ b/c/os/bits-dlfcn_linux_arm64.go @@ -0,0 +1,31 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// The MODE argument to `dlopen' contains one of the following: +const ( + RTLD_LAZY = 1 + // Immediate function call binding. + RTLD_NOW = 2 + // Mask of binding time value. + RTLD_BINDING_MASK = 3 + // Do not load the object. + RTLD_NOLOAD = 4 + // Use deep binding. + RTLD_DEEPBIND = 8 +) + +// If the following bit is set in the MODE argument to `dlopen', +// the symbols of the loaded object and its dependencies are made +// visible as if the object were linked directly into the program. +const RTLD_GLOBAL = 256 + +// Unix98 demands the following flag which is the inverse to RTLD_GLOBAL. +// The implementation does this by default and so we can define the +// value to zero. +const RTLD_LOCAL = 0 + +// Do not delete object when closed. +const RTLD_NODELETE = 4096 diff --git a/c/os/bits-fcntl-linux_linux_amd64.go b/c/os/bits-fcntl-linux_linux_amd64.go new file mode 100644 index 00000000..885e1671 --- /dev/null +++ b/c/os/bits-fcntl-linux_linux_amd64.go @@ -0,0 +1,134 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// Not fcntl. +const O_EXCL = 128 + +// Not fcntl. +const O_NOCTTY = 256 +const O_APPEND = 1024 +const O_SYNC = 1052672 +const O_FSYNC = 1052672 +const O_ASYNC = 8192 +const X__O_DIRECTORY = 65536 +const X__O_NOFOLLOW = 131072 +const X__O_CLOEXEC = 524288 +const X__O_DIRECT = 16384 +const X__O_NOATIME = 262144 +const X__O_PATH = 2097152 +const X__O_DSYNC = 4096 +const X__O_TMPFILE = 4259840 +const ( + // Get record locking info. + F_GETLK = 5 + // Set record locking info (non-blocking). + F_SETLK = 6 + // Set record locking info (blocking). + F_SETLKW = 7 +) +const ( + // Must be a directory. + O_DIRECTORY = 65536 + // Do not follow links. + O_NOFOLLOW = 131072 + // Set close_on_exec. + O_CLOEXEC = 524288 +) + +// Synchronize data. +const O_DSYNC = 4096 + +// Synchronize read operations. +const O_RSYNC = 1052672 + +// Values for the second argument to `fcntl'. +const ( + F_DUPFD = 0 + // Get file descriptor flags. + F_GETFD = 1 + // Set file descriptor flags. + F_SETFD = 2 +) +const ( + X__F_SETOWN = 8 + X__F_GETOWN = 9 +) +const ( + // Get owner (process receiving SIGIO). + F_SETOWN = 8 + // Set owner (process receiving SIGIO). + F_GETOWN = 9 +) +const ( + // Set number of signal to be sent. + X__F_SETSIG = 10 + // Get number of signal to be sent. + X__F_GETSIG = 11 +) +const ( + // Get owner (thread receiving SIGIO). + X__F_SETOWN_EX = 15 + // Set owner (thread receiving SIGIO). + X__F_GETOWN_EX = 16 +) + +// Duplicate file descriptor with +// close-on-exit set. +const F_DUPFD_CLOEXEC = 1030 + +// For F_[GET|SET]FD. +const FD_CLOEXEC = 1 + +// For posix fcntl() and `l_type' field of a `struct _llcppg_flock_type' for lockf(). +const ( + F_RDLCK = 0 + // Write lock. + F_WRLCK = 1 + // Remove lock. + F_UNLCK = 2 +) +const ( + // or 3 + F_EXLCK = 4 + // or 4 + F_SHLCK = 8 +) + +// Operations for BSD flock, also used by the kernel implementation. +const ( + LOCK_SH = 1 + // Exclusive lock. + LOCK_EX = 2 + // Or'd with one of the above to prevent + // blocking. + LOCK_NB = 4 +) + +// Remove lock. +const LOCK_UN = 8 +const ( + FAPPEND = 1024 + FFSYNC = 1052672 + FASYNC = 8192 +) +const ( + X__POSIX_FADV_DONTNEED = 4 + X__POSIX_FADV_NOREUSE = 5 +) +const ( + // No further special treatment. + POSIX_FADV_NORMAL = 0 + // Expect random page references. + POSIX_FADV_RANDOM = 1 + // Expect sequential page references. + POSIX_FADV_SEQUENTIAL = 2 + // Will need these pages. + POSIX_FADV_WILLNEED = 3 + // Don't need these pages. + POSIX_FADV_DONTNEED = 4 + // Data will be accessed once. + POSIX_FADV_NOREUSE = 5 +) diff --git a/c/os/bits-fcntl-linux_linux_arm64.go b/c/os/bits-fcntl-linux_linux_arm64.go new file mode 100644 index 00000000..2e2df8bc --- /dev/null +++ b/c/os/bits-fcntl-linux_linux_arm64.go @@ -0,0 +1,131 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// Not fcntl. +const O_EXCL = 128 + +// Not fcntl. +const O_NOCTTY = 256 +const O_APPEND = 1024 +const O_SYNC = 1052672 +const O_FSYNC = 1052672 +const O_ASYNC = 8192 +const X__O_CLOEXEC = 524288 +const X__O_NOATIME = 262144 +const X__O_PATH = 2097152 +const X__O_DSYNC = 4096 +const X__O_TMPFILE = 4210688 +const ( + // Get record locking info. + F_GETLK = 5 + // Set record locking info (non-blocking). + F_SETLK = 6 + // Set record locking info (blocking). + F_SETLKW = 7 +) +const ( + // Must be a directory. + O_DIRECTORY = 16384 + // Do not follow links. + O_NOFOLLOW = 32768 + // Set close_on_exec. + O_CLOEXEC = 524288 +) + +// Synchronize data. +const O_DSYNC = 4096 + +// Synchronize read operations. +const O_RSYNC = 1052672 + +// Values for the second argument to `fcntl'. +const ( + F_DUPFD = 0 + // Get file descriptor flags. + F_GETFD = 1 + // Set file descriptor flags. + F_SETFD = 2 +) +const ( + X__F_SETOWN = 8 + X__F_GETOWN = 9 +) +const ( + // Get owner (process receiving SIGIO). + F_SETOWN = 8 + // Set owner (process receiving SIGIO). + F_GETOWN = 9 +) +const ( + // Set number of signal to be sent. + X__F_SETSIG = 10 + // Get number of signal to be sent. + X__F_GETSIG = 11 +) +const ( + // Get owner (thread receiving SIGIO). + X__F_SETOWN_EX = 15 + // Set owner (thread receiving SIGIO). + X__F_GETOWN_EX = 16 +) + +// Duplicate file descriptor with +// close-on-exit set. +const F_DUPFD_CLOEXEC = 1030 + +// For F_[GET|SET]FD. +const FD_CLOEXEC = 1 + +// For posix fcntl() and `l_type' field of a `struct _llcppg_flock_type' for lockf(). +const ( + F_RDLCK = 0 + // Write lock. + F_WRLCK = 1 + // Remove lock. + F_UNLCK = 2 +) +const ( + // or 3 + F_EXLCK = 4 + // or 4 + F_SHLCK = 8 +) + +// Operations for BSD flock, also used by the kernel implementation. +const ( + LOCK_SH = 1 + // Exclusive lock. + LOCK_EX = 2 + // Or'd with one of the above to prevent + // blocking. + LOCK_NB = 4 +) + +// Remove lock. +const LOCK_UN = 8 +const ( + FAPPEND = 1024 + FFSYNC = 1052672 + FASYNC = 8192 +) +const ( + X__POSIX_FADV_DONTNEED = 4 + X__POSIX_FADV_NOREUSE = 5 +) +const ( + // No further special treatment. + POSIX_FADV_NORMAL = 0 + // Expect random page references. + POSIX_FADV_RANDOM = 1 + // Expect sequential page references. + POSIX_FADV_SEQUENTIAL = 2 + // Will need these pages. + POSIX_FADV_WILLNEED = 3 + // Don't need these pages. + POSIX_FADV_DONTNEED = 4 + // Data will be accessed once. + POSIX_FADV_NOREUSE = 5 +) diff --git a/c/os/bits-fcntl_linux_amd64.go b/c/os/bits-fcntl_linux_amd64.go new file mode 100644 index 00000000..7cd44de7 --- /dev/null +++ b/c/os/bits-fcntl_linux_amd64.go @@ -0,0 +1,24 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +const X__O_LARGEFILE = 0 + +// Not necessary, we always have 64-bit offsets. +const ( + F_GETLK64 = 5 + // Set record locking info (non-blocking). + F_SETLK64 = 6 + // Set record locking info (blocking). + F_SETLKW64 = 7 +) + +type FlockT struct { + LType int16 + LWhence int16 + LStart X__OffT + LLen X__OffT + LPid X__PidT +} diff --git a/c/os/bits-fcntl_linux_arm64.go b/c/os/bits-fcntl_linux_arm64.go new file mode 100644 index 00000000..b08a0ab9 --- /dev/null +++ b/c/os/bits-fcntl_linux_arm64.go @@ -0,0 +1,25 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +const ( + X__O_DIRECTORY = 16384 + X__O_NOFOLLOW = 32768 + X__O_DIRECT = 65536 +) +const X__O_LARGEFILE = 0 +const ( + F_GETLK64 = 5 + F_SETLK64 = 6 + F_SETLKW64 = 7 +) + +type FlockT struct { + LType int16 + LWhence int16 + LStart X__OffT + LLen X__OffT + LPid X__PidT +} diff --git a/c/os/bits-local_lim_linux_amd64.go b/c/os/bits-local_lim_linux_amd64.go new file mode 100644 index 00000000..990df2ad --- /dev/null +++ b/c/os/bits-local_lim_linux_amd64.go @@ -0,0 +1,45 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// The number of data keys per process. +const X_POSIX_THREAD_KEYS_MAX = 128 + +// This is the value this implementation supports. +const PTHREAD_KEYS_MAX = 1024 + +// Controlling the iterations of destructors for thread-specific data. +const X_POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4 + +// Number of iterations this implementation does. +const PTHREAD_DESTRUCTOR_ITERATIONS = 4 + +// The number of threads per process. +const X_POSIX_THREAD_THREADS_MAX = 64 + +// Maximum amount by which a process can descrease its asynchronous I/O +// priority level. +const AIO_PRIO_DELTA_MAX = 20 + +// Minimum size for a thread. We are free to choose a reasonable value. +const PTHREAD_STACK_MIN = 16384 + +// Maximum number of timer expiration overruns. +const DELAYTIMER_MAX = 2147483647 + +// Maximum tty name length. +const TTY_NAME_MAX = 32 + +// Maximum login name length. This is arbitrary. +const LOGIN_NAME_MAX = 256 + +// Maximum host name length. +const HOST_NAME_MAX = 64 + +// Maximum message queue priority level. +const MQ_PRIO_MAX = 32768 + +// Maximum value the semaphore can have. +const SEM_VALUE_MAX = 2147483647 diff --git a/c/os/bits-local_lim_linux_arm64.go b/c/os/bits-local_lim_linux_arm64.go new file mode 100644 index 00000000..c545f5ae --- /dev/null +++ b/c/os/bits-local_lim_linux_arm64.go @@ -0,0 +1,46 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// The number of data keys per process. +const X_POSIX_THREAD_KEYS_MAX = 128 + +// This is the value this implementation supports. +const PTHREAD_KEYS_MAX = 1024 + +// Controlling the iterations of destructors for thread-specific data. +const X_POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4 + +// Number of iterations this implementation does. +const PTHREAD_DESTRUCTOR_ITERATIONS = 4 + +// The number of threads per process. +const X_POSIX_THREAD_THREADS_MAX = 64 + +// Maximum amount by which a process can descrease its asynchronous I/O +// priority level. +const AIO_PRIO_DELTA_MAX = 20 + +// Minimum size for a thread. At least two pages for systems with 64k +// pages. +const PTHREAD_STACK_MIN = 131072 + +// Maximum number of timer expiration overruns. +const DELAYTIMER_MAX = 2147483647 + +// Maximum tty name length. +const TTY_NAME_MAX = 32 + +// Maximum login name length. This is arbitrary. +const LOGIN_NAME_MAX = 256 + +// Maximum host name length. +const HOST_NAME_MAX = 64 + +// Maximum message queue priority level. +const MQ_PRIO_MAX = 32768 + +// Maximum value the semaphore can have. +const SEM_VALUE_MAX = 2147483647 diff --git a/c/os/bits-mman-linux_linux_amd64.go b/c/os/bits-mman-linux_linux_amd64.go new file mode 100644 index 00000000..a2587451 --- /dev/null +++ b/c/os/bits-mman-linux_linux_amd64.go @@ -0,0 +1,118 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +const ( + // Page can be read. + PROT_READ = 1 + // Page can be written. + PROT_WRITE = 2 + // Page can be executed. + PROT_EXEC = 4 + // Page can not be accessed. + PROT_NONE = 0 + // Extend change to start of + // growsdown vma (mprotect only). + PROT_GROWSDOWN = 16777216 +) + +// Extend change to start of +// growsup vma (mprotect only). +const PROT_GROWSUP = 33554432 + +// Sharing types (must choose one and only one of these). +const ( + MAP_SHARED = 1 + // Changes are private. + MAP_PRIVATE = 2 +) + +// Mask for type of mapping. +const MAP_TYPE = 15 + +// Other flags. +const MAP_FIXED = 16 +const MAP_FILE = 0 + +// Don't use a file. +const MAP_ANONYMOUS = 32 + +// When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size. +const MAP_ANON = 32 + +// When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size. +const ( + MAP_HUGE_SHIFT = 26 + MAP_HUGE_MASK = 63 +) + +// Flags to `msync'. +const ( + MS_ASYNC = 1 + // Synchronous memory sync. + MS_SYNC = 4 + // Invalidate the caches. + MS_INVALIDATE = 2 +) +const ( + // No further special treatment. + MADV_NORMAL = 0 + // Expect random page references. + MADV_RANDOM = 1 + // Expect sequential page references. + MADV_SEQUENTIAL = 2 + // Will need these pages. + MADV_WILLNEED = 3 + // Don't need these pages. + MADV_DONTNEED = 4 + // Free pages only if memory pressure. + MADV_FREE = 8 + // Remove these pages and resources. + MADV_REMOVE = 9 + // Do not inherit across fork. + MADV_DONTFORK = 10 + // Do inherit across fork. + MADV_DOFORK = 11 + // KSM may merge identical pages. + MADV_MERGEABLE = 12 + // KSM may not merge identical pages. + MADV_UNMERGEABLE = 13 + // Worth backing with hugepages. + MADV_HUGEPAGE = 14 + // Not worth backing with hugepages. + MADV_NOHUGEPAGE = 15 + // Explicity exclude from the core dump, + // overrides the coredump filter bits. + MADV_DONTDUMP = 16 +) +const ( + // Clear the MADV_DONTDUMP flag. + MADV_DODUMP = 17 + // Poison a page for testing. + MADV_HWPOISON = 100 +) +const ( + // No further special treatment. + POSIX_MADV_NORMAL = 0 + // Expect random page references. + POSIX_MADV_RANDOM = 1 + // Expect sequential page references. + POSIX_MADV_SEQUENTIAL = 2 + // Will need these pages. + POSIX_MADV_WILLNEED = 3 + // Don't need these pages. + POSIX_MADV_DONTNEED = 4 +) +const ( + // Lock all currently mapped pages. + MCL_CURRENT = 1 + // Lock all additions to address + // space. + MCL_FUTURE = 2 +) + +// Lock all pages that are +// faulted in. +const MCL_ONFAULT = 4 diff --git a/c/os/bits-mman-linux_linux_arm64.go b/c/os/bits-mman-linux_linux_arm64.go new file mode 100644 index 00000000..dc02fcd0 --- /dev/null +++ b/c/os/bits-mman-linux_linux_arm64.go @@ -0,0 +1,118 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +const ( + // Page can be read. + PROT_READ = 1 + // Page can be written. + PROT_WRITE = 2 + // Page can be executed. + PROT_EXEC = 4 + // Page can not be accessed. + PROT_NONE = 0 + // Extend change to start of + // growsdown vma (mprotect only). + PROT_GROWSDOWN = 16777216 +) + +// Extend change to start of +// growsup vma (mprotect only). +const PROT_GROWSUP = 33554432 + +// Sharing types (must choose one and only one of these). +const ( + MAP_SHARED = 1 + // Changes are private. + MAP_PRIVATE = 2 +) + +// Mask for type of mapping. +const MAP_TYPE = 15 + +// Other flags. +const MAP_FIXED = 16 +const MAP_FILE = 0 + +// Don't use a file. +const MAP_ANONYMOUS = 32 + +// When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size. +const MAP_ANON = 32 + +// When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size. +const ( + MAP_HUGE_SHIFT = 26 + MAP_HUGE_MASK = 63 +) + +// Flags to `msync'. +const ( + MS_ASYNC = 1 + // Synchronous memory sync. + MS_SYNC = 4 + // Invalidate the caches. + MS_INVALIDATE = 2 +) +const ( + // No further special treatment. + MADV_NORMAL = 0 + // Expect random page references. + MADV_RANDOM = 1 + // Expect sequential page references. + MADV_SEQUENTIAL = 2 + // Will need these pages. + MADV_WILLNEED = 3 + // Don't need these pages. + MADV_DONTNEED = 4 + // Free pages only if memory pressure. + MADV_FREE = 8 + // Remove these pages and resources. + MADV_REMOVE = 9 + // Do not inherit across fork. + MADV_DONTFORK = 10 + // Do inherit across fork. + MADV_DOFORK = 11 + // KSM may merge identical pages. + MADV_MERGEABLE = 12 + // KSM may not merge identical pages. + MADV_UNMERGEABLE = 13 + // Worth backing with hugepages. + MADV_HUGEPAGE = 14 + // Not worth backing with hugepages. + MADV_NOHUGEPAGE = 15 + // Explicity exclude from the core dump, + // overrides the coredump filter bits. + MADV_DONTDUMP = 16 +) +const ( + // Clear the MADV_DONTDUMP flag. + MADV_DODUMP = 17 + // Poison a page for testing. + MADV_HWPOISON = 100 +) +const ( + // No further special treatment. + POSIX_MADV_NORMAL = 0 + // Expect random page references. + POSIX_MADV_RANDOM = 1 + // Expect sequential page references. + POSIX_MADV_SEQUENTIAL = 2 + // Will need these pages. + POSIX_MADV_WILLNEED = 3 + // Don't need these pages. + POSIX_MADV_DONTNEED = 4 +) +const ( + // Lock all currently mapped pages. + MCL_CURRENT = 1 + // Lock all additions to address + // space. + MCL_FUTURE = 2 +) + +// Lock all pages that are +// faulted in. +const MCL_ONFAULT = 4 diff --git a/c/os/bits-mman_linux_amd64.go b/c/os/bits-mman_linux_amd64.go new file mode 100644 index 00000000..b1f3b19f --- /dev/null +++ b/c/os/bits-mman_linux_amd64.go @@ -0,0 +1,28 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// Only give out 32-bit addresses. +const MAP_32BIT = 64 +const ( + // Stack-like segment. + MAP_GROWSDOWN = 256 + // ETXTBSY + MAP_DENYWRITE = 2048 + // Mark it as an executable. + MAP_EXECUTABLE = 4096 + // Lock the mapping. + MAP_LOCKED = 8192 + // Don't check for reservations. + MAP_NORESERVE = 16384 + // Populate (prefault) pagetables. + MAP_POPULATE = 32768 + // Do not block on IO. + MAP_NONBLOCK = 65536 + // Allocation is for a stack. + MAP_STACK = 131072 + // Create huge page mapping. + MAP_HUGETLB = 262144 +) diff --git a/c/os/bits-mman_linux_arm64.go b/c/os/bits-mman_linux_arm64.go new file mode 100644 index 00000000..82f6a884 --- /dev/null +++ b/c/os/bits-mman_linux_arm64.go @@ -0,0 +1,26 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +const ( + // Stack-like segment. + MAP_GROWSDOWN = 256 + // ETXTBSY + MAP_DENYWRITE = 2048 + // Mark it as an executable. + MAP_EXECUTABLE = 4096 + // Lock the mapping. + MAP_LOCKED = 8192 + // Don't check for reservations. + MAP_NORESERVE = 16384 + // Populate (prefault) pagetables. + MAP_POPULATE = 32768 + // Do not block on IO. + MAP_NONBLOCK = 65536 + // Allocation is for a stack. + MAP_STACK = 131072 + // Create huge page mapping. + MAP_HUGETLB = 262144 +) diff --git a/c/os/bits-poll_linux_amd64.go b/c/os/bits-poll_linux_amd64.go new file mode 100644 index 00000000..a34b6ef6 --- /dev/null +++ b/c/os/bits-poll_linux_amd64.go @@ -0,0 +1,38 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// Event types that can be polled for. These bits may be set in `events' +// to indicate the interesting event types; they will appear in `revents' +// to indicate the status of the file descriptor. +const ( + POLLIN = 1 + // There is urgent data to read. + POLLPRI = 2 + // Writing now will not block. + POLLOUT = 4 +) + +// These values are defined in XPG4.2. +const ( + POLLRDNORM = 64 + // Priority data may be read. + POLLRDBAND = 128 + // Writing now will not block. + POLLWRNORM = 256 + // Priority data may be written. + POLLWRBAND = 512 +) + +// Event types always implicitly polled for. These bits need not be set in +// `events', but they will appear in `revents' to indicate the status of +// the file descriptor. +const ( + POLLERR = 8 + // Hung up. + POLLHUP = 16 + // Invalid polling request. + POLLNVAL = 32 +) diff --git a/c/os/bits-poll_linux_arm64.go b/c/os/bits-poll_linux_arm64.go new file mode 100644 index 00000000..41ff312c --- /dev/null +++ b/c/os/bits-poll_linux_arm64.go @@ -0,0 +1,38 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// Event types that can be polled for. These bits may be set in `events' +// to indicate the interesting event types; they will appear in `revents' +// to indicate the status of the file descriptor. +const ( + POLLIN = 1 + // There is urgent data to read. + POLLPRI = 2 + // Writing now will not block. + POLLOUT = 4 +) + +// These values are defined in XPG4.2. +const ( + POLLRDNORM = 64 + // Priority data may be read. + POLLRDBAND = 128 + // Writing now will not block. + POLLWRNORM = 256 + // Priority data may be written. + POLLWRBAND = 512 +) + +// Event types always implicitly polled for. These bits need not be set in +// `events', but they will appear in `revents' to indicate the status of +// the file descriptor. +const ( + POLLERR = 8 + // Hung up. + POLLHUP = 16 + // Invalid polling request. + POLLNVAL = 32 +) diff --git a/c/os/bits-posix_opt_linux_amd64.go b/c/os/bits-posix_opt_linux_amd64.go new file mode 100644 index 00000000..ddf3add9 --- /dev/null +++ b/c/os/bits-posix_opt_linux_amd64.go @@ -0,0 +1,84 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +const X_BITS_POSIX_OPT_H = 1 + +// Job control is supported. +const X_POSIX_JOB_CONTROL = 1 + +// Processes have a saved set-user-ID and a saved set-group-ID. +const X_POSIX_SAVED_IDS = 1 + +// Some filesystems allow all users to change file ownership. +const X_POSIX_CHOWN_RESTRICTED = 0 + +// Filenames are not silently truncated. +const X_POSIX_NO_TRUNC = 1 + +// X/Open realtime support is available. +const X_XOPEN_REALTIME = 1 + +// X/Open thread realtime support is available. +const X_XOPEN_REALTIME_THREADS = 1 + +// XPG4.2 shared memory is supported. +const X_XOPEN_SHM = 1 + +// We have the reentrant functions described in POSIX. +const X_POSIX_REENTRANT_FUNCTIONS = 1 + +// We do not support priority protection for robust mutexes. +const X_POSIX_THREAD_ROBUST_PRIO_PROTECT = -1 + +// We support asynchronous I/O. +const +// Alternative name for Unix98. +X_POSIX_ASYNC_IO = 1 + +// Alternative name for Unix98. +const X_LFS_ASYNCHRONOUS_IO = 1 + +// The LFS support in asynchronous I/O is also available. +const X_LFS64_ASYNCHRONOUS_IO = 1 + +// The rest of the LFS is also available. +const ( + X_LFS_LARGEFILE = 1 + X_LFS64_LARGEFILE = 1 + X_LFS64_STDIO = 1 +) + +// CPU-time clocks support needs to be checked at runtime. +const X_POSIX_CPUTIME = 0 + +// Clock support in threads must be also checked at runtime. +const X_POSIX_THREAD_CPUTIME = 0 + +// GNU libc provides regular expression handling. +const X_POSIX_REGEXP = 1 + +// We have a POSIX shell. +const X_POSIX_SHELL = 1 + +// The monotonic clock might be available. +const X_POSIX_MONOTONIC_CLOCK = 0 + +// Neither process nor thread sporadic server interfaces is available. +const ( + X_POSIX_SPORADIC_SERVER = -1 + X_POSIX_THREAD_SPORADIC_SERVER = -1 +) + +// trace.h is not available. +const ( + X_POSIX_TRACE = -1 + X_POSIX_TRACE_EVENT_FILTER = -1 + X_POSIX_TRACE_INHERIT = -1 + X_POSIX_TRACE_LOG = -1 +) + +// Typed memory objects are not available. +const X_POSIX_TYPED_MEMORY_OBJECTS = -1 diff --git a/c/os/bits-posix_opt_linux_arm64.go b/c/os/bits-posix_opt_linux_arm64.go new file mode 100644 index 00000000..23d086cd --- /dev/null +++ b/c/os/bits-posix_opt_linux_arm64.go @@ -0,0 +1,84 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +const X_BITS_POSIX_OPT_H = 1 + +// Job control is supported. +const X_POSIX_JOB_CONTROL = 1 + +// Processes have a saved set-user-ID and a saved set-group-ID. +const X_POSIX_SAVED_IDS = 1 + +// Some filesystems allow all users to change file ownership. +const X_POSIX_CHOWN_RESTRICTED = 0 + +// Filenames are not silently truncated. +const X_POSIX_NO_TRUNC = 1 + +// X/Open realtime support is available. +const X_XOPEN_REALTIME = 1 + +// X/Open thread realtime support is available. +const X_XOPEN_REALTIME_THREADS = 1 + +// XPG4.2 shared memory is supported. +const X_XOPEN_SHM = 1 + +// We have the reentrant functions described in POSIX. +const X_POSIX_REENTRANT_FUNCTIONS = 1 + +// We do not support priority protection for robust mutexes. +const X_POSIX_THREAD_ROBUST_PRIO_PROTECT = -1 + +// We support asynchronous I/O. +const +// Alternative name for Unix98. +X_POSIX_ASYNC_IO = 1 + +// Alternative name for Unix98. +const X_LFS_ASYNCHRONOUS_IO = 1 + +// The LFS support in asynchronous I/O is also available. +const X_LFS64_ASYNCHRONOUS_IO = 1 + +// The rest of the LFS is also available. +const ( + X_LFS_LARGEFILE = 1 + X_LFS64_LARGEFILE = 1 + X_LFS64_STDIO = 1 +) + +// CPU-time clocks support needs to be checked at runtime. +const X_POSIX_CPUTIME = 0 + +// Clock support in threads must be also checked at runtime. +const X_POSIX_THREAD_CPUTIME = 0 + +// GNU libc provides regular expression handling. +const X_POSIX_REGEXP = 1 + +// We have a POSIX shell. +const X_POSIX_SHELL = 1 + +// The monotonic clock might be available. +const X_POSIX_MONOTONIC_CLOCK = 0 + +// Neither process nor thread sporadic server interfaces is available. +const ( + X_POSIX_SPORADIC_SERVER = -1 + X_POSIX_THREAD_SPORADIC_SERVER = -1 +) + +// trace.h is not available. +const ( + X_POSIX_TRACE = -1 + X_POSIX_TRACE_EVENT_FILTER = -1 + X_POSIX_TRACE_INHERIT = -1 + X_POSIX_TRACE_LOG = -1 +) + +// Typed memory objects are not available. +const X_POSIX_TYPED_MEMORY_OBJECTS = -1 diff --git a/c/os/bits-resource_linux_amd64.go b/c/os/bits-resource_linux_amd64.go new file mode 100644 index 00000000..1ee0f6cc --- /dev/null +++ b/c/os/bits-resource_linux_amd64.go @@ -0,0 +1,245 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "github.com/goplus/lib/c/sys" + "unsafe" +) + +// Priority limits. +const ( + PRIO_MIN = -20 + // Maximum priority a process can have. + PRIO_MAX = 20 +) + +// Kinds of resource limit. +type X__RlimitResource c.Uint + +const ( + // Per-process CPU limit, in seconds. + RLIMIT_CPU X__RlimitResource = 0 + // Largest file that can be created, in bytes. + RLIMIT_FSIZE X__RlimitResource = 1 + // Maximum size of data segment, in bytes. + RLIMIT_DATA X__RlimitResource = 2 + // Maximum size of stack segment, in bytes. + RLIMIT_STACK X__RlimitResource = 3 + // Largest core file that can be created, in bytes. + RLIMIT_CORE X__RlimitResource = 4 + // Largest resident set size, in bytes. + // This affects swapping; processes that are exceeding their + // resident set size will be more likely to have physical memory + // taken from them. + X__RLIMIT_RSS X__RlimitResource = 5 + // Number of open files. + RLIMIT_NOFILE X__RlimitResource = 7 + X__RLIMIT_OFILE X__RlimitResource = 7 + // Address space limit. + RLIMIT_AS X__RlimitResource = 9 + // Number of processes. + X__RLIMIT_NPROC X__RlimitResource = 6 + // Locked-in-memory address space. + X__RLIMIT_MEMLOCK X__RlimitResource = 8 + // Maximum number of file locks. + X__RLIMIT_LOCKS X__RlimitResource = 10 + // Maximum number of pending signals. + X__RLIMIT_SIGPENDING X__RlimitResource = 11 + // Maximum bytes in POSIX message queues. + X__RLIMIT_MSGQUEUE X__RlimitResource = 12 + // Maximum nice priority allowed to raise to. + // Nice levels 19 .. -20 correspond to 0 .. 39 + // values of this resource limit. + X__RLIMIT_NICE X__RlimitResource = 13 + // Maximum realtime priority allowed for non-priviledged + // processes. + X__RLIMIT_RTPRIO X__RlimitResource = 14 + // Maximum CPU time in µs that a process scheduled under a real-time + // scheduling policy may consume without making a blocking system + // call before being forcibly descheduled. + X__RLIMIT_RTTIME X__RlimitResource = 15 + X__RLIMIT_NLIMITS X__RlimitResource = 16 + X__RLIM_NLIMITS X__RlimitResource = 16 +) + +type Rlimit struct { + RlimCur RlimT + RlimMax RlimT +} + +// Whose usage statistics do you want? +type X__RusageWho c.Int + +const ( + // The calling process. + RUSAGE_SELF X__RusageWho = 0 + // All of its terminated child processes. + RUSAGE_CHILDREN X__RusageWho = -1 +) + +// The purpose of all the unions is to have the kernel-compatible layout +// while keeping the API type as 'long int', and among machines where +// __syscall_slong_t is not 'long int', this only does the right thing +// for little-endian ones, like x32. +type Rusage struct { + RuUtime sys.Timeval + RuStime sys.Timeval + _llcppg_anon_0 + _llcppg_anon_1 + _llcppg_anon_2 + _llcppg_anon_3 + _llcppg_anon_4 + _llcppg_anon_5 + _llcppg_anon_6 + _llcppg_anon_7 + _llcppg_anon_8 + _llcppg_anon_9 + _llcppg_anon_10 + _llcppg_anon_11 + _llcppg_anon_12 + _llcppg_anon_13 +} + +// The type of the WHICH argument to `getpriority' and `setpriority', +// indicating what flavor of entity the WHO argument specifies. +type X__PriorityWhich c.Uint + +const ( + PRIO_PROCESS X__PriorityWhich = 0 + PRIO_PGRP X__PriorityWhich = 1 + // WHO is a user ID. + PRIO_USER X__PriorityWhich = 2 +) + +type RlimT = X__RlimT +type _llcppg_anon_0 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_1 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_2 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_3 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_4 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_5 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_6 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_7 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_8 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_9 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_10 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_11 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_12 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_13 struct { + _xgo_union [1]uint64 +} + +func (p *_llcppg_anon_0) XGof_ref_ru_maxrss() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_0) XGof_ref___ru_maxrss_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_1) XGof_ref_ru_ixrss() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_1) XGof_ref___ru_ixrss_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_2) XGof_ref_ru_idrss() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_2) XGof_ref___ru_idrss_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_3) XGof_ref_ru_isrss() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_3) XGof_ref___ru_isrss_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_4) XGof_ref_ru_minflt() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_4) XGof_ref___ru_minflt_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_5) XGof_ref_ru_majflt() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_5) XGof_ref___ru_majflt_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_6) XGof_ref_ru_nswap() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_6) XGof_ref___ru_nswap_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_7) XGof_ref_ru_inblock() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_7) XGof_ref___ru_inblock_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_8) XGof_ref_ru_oublock() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_8) XGof_ref___ru_oublock_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_9) XGof_ref_ru_msgsnd() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_9) XGof_ref___ru_msgsnd_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_10) XGof_ref_ru_msgrcv() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_10) XGof_ref___ru_msgrcv_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_11) XGof_ref_ru_nsignals() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_11) XGof_ref___ru_nsignals_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_12) XGof_ref_ru_nvcsw() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_12) XGof_ref___ru_nvcsw_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_13) XGof_ref_ru_nivcsw() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_13) XGof_ref___ru_nivcsw_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} diff --git a/c/os/bits-resource_linux_arm64.go b/c/os/bits-resource_linux_arm64.go new file mode 100644 index 00000000..ab6038a1 --- /dev/null +++ b/c/os/bits-resource_linux_arm64.go @@ -0,0 +1,245 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "github.com/goplus/lib/c/sys" + "unsafe" +) + +// Priority limits. +const ( + PRIO_MIN = -20 + // Maximum priority a process can have. + PRIO_MAX = 20 +) + +// Kinds of resource limit. +type X__RlimitResource c.Uint + +const ( + // Per-process CPU limit, in seconds. + RLIMIT_CPU X__RlimitResource = 0 + // Largest file that can be created, in bytes. + RLIMIT_FSIZE X__RlimitResource = 1 + // Maximum size of data segment, in bytes. + RLIMIT_DATA X__RlimitResource = 2 + // Maximum size of stack segment, in bytes. + RLIMIT_STACK X__RlimitResource = 3 + // Largest core file that can be created, in bytes. + RLIMIT_CORE X__RlimitResource = 4 + // Largest resident set size, in bytes. + // This affects swapping; processes that are exceeding their + // resident set size will be more likely to have physical memory + // taken from them. + X__RLIMIT_RSS X__RlimitResource = 5 + // Number of open files. + RLIMIT_NOFILE X__RlimitResource = 7 + X__RLIMIT_OFILE X__RlimitResource = 7 + // Address space limit. + RLIMIT_AS X__RlimitResource = 9 + // Number of processes. + X__RLIMIT_NPROC X__RlimitResource = 6 + // Locked-in-memory address space. + X__RLIMIT_MEMLOCK X__RlimitResource = 8 + // Maximum number of file locks. + X__RLIMIT_LOCKS X__RlimitResource = 10 + // Maximum number of pending signals. + X__RLIMIT_SIGPENDING X__RlimitResource = 11 + // Maximum bytes in POSIX message queues. + X__RLIMIT_MSGQUEUE X__RlimitResource = 12 + // Maximum nice priority allowed to raise to. + // Nice levels 19 .. -20 correspond to 0 .. 39 + // values of this resource limit. + X__RLIMIT_NICE X__RlimitResource = 13 + // Maximum realtime priority allowed for non-priviledged + // processes. + X__RLIMIT_RTPRIO X__RlimitResource = 14 + // Maximum CPU time in µs that a process scheduled under a real-time + // scheduling policy may consume without making a blocking system + // call before being forcibly descheduled. + X__RLIMIT_RTTIME X__RlimitResource = 15 + X__RLIMIT_NLIMITS X__RlimitResource = 16 + X__RLIM_NLIMITS X__RlimitResource = 16 +) + +type Rlimit struct { + RlimCur RlimT + RlimMax RlimT +} + +// Whose usage statistics do you want? +type X__RusageWho c.Int + +const ( + // The calling process. + RUSAGE_SELF X__RusageWho = 0 + // All of its terminated child processes. + RUSAGE_CHILDREN X__RusageWho = -1 +) + +// The purpose of all the unions is to have the kernel-compatible layout +// while keeping the API type as 'long int', and among machines where +// __syscall_slong_t is not 'long int', this only does the right thing +// for little-endian ones, like x32. +type Rusage struct { + RuUtime sys.Timeval + RuStime sys.Timeval + _llcppg_anon_0 + _llcppg_anon_1 + _llcppg_anon_2 + _llcppg_anon_3 + _llcppg_anon_4 + _llcppg_anon_5 + _llcppg_anon_6 + _llcppg_anon_7 + _llcppg_anon_8 + _llcppg_anon_9 + _llcppg_anon_10 + _llcppg_anon_11 + _llcppg_anon_12 + _llcppg_anon_13 +} + +// The type of the WHICH argument to `getpriority' and `setpriority', +// indicating what flavor of entity the WHO argument specifies. +type X__PriorityWhich c.Uint + +const ( + PRIO_PROCESS X__PriorityWhich = 0 + PRIO_PGRP X__PriorityWhich = 1 + // WHO is a user ID. + PRIO_USER X__PriorityWhich = 2 +) + +type RlimT = X__RlimT +type _llcppg_anon_0 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_1 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_2 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_3 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_4 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_5 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_6 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_7 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_8 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_9 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_10 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_11 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_12 struct { + _xgo_union [1]uint64 +} +type _llcppg_anon_13 struct { + _xgo_union [1]uint64 +} + +func (p *_llcppg_anon_0) XGof_ref_ru_maxrss() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_0) XGof_ref___ru_maxrss_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_1) XGof_ref_ru_ixrss() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_1) XGof_ref___ru_ixrss_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_2) XGof_ref_ru_idrss() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_2) XGof_ref___ru_idrss_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_3) XGof_ref_ru_isrss() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_3) XGof_ref___ru_isrss_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_4) XGof_ref_ru_minflt() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_4) XGof_ref___ru_minflt_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_5) XGof_ref_ru_majflt() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_5) XGof_ref___ru_majflt_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_6) XGof_ref_ru_nswap() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_6) XGof_ref___ru_nswap_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_7) XGof_ref_ru_inblock() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_7) XGof_ref___ru_inblock_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_8) XGof_ref_ru_oublock() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_8) XGof_ref___ru_oublock_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_9) XGof_ref_ru_msgsnd() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_9) XGof_ref___ru_msgsnd_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_10) XGof_ref_ru_msgrcv() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_10) XGof_ref___ru_msgrcv_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_11) XGof_ref_ru_nsignals() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_11) XGof_ref___ru_nsignals_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_12) XGof_ref_ru_nvcsw() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_12) XGof_ref___ru_nvcsw_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_13) XGof_ref_ru_nivcsw() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} +func (p *_llcppg_anon_13) XGof_ref___ru_nivcsw_word() *X__SyscallSlongT { + return (*X__SyscallSlongT)(unsafe.Pointer(p)) +} diff --git a/c/os/bits-sched_linux_amd64.go b/c/os/bits-sched_linux_amd64.go new file mode 100644 index 00000000..79385eb6 --- /dev/null +++ b/c/os/bits-sched_linux_amd64.go @@ -0,0 +1,51 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +// Scheduling algorithms. +const ( + SCHED_OTHER = 0 + SCHED_FIFO = 1 + SCHED_RR = 2 +) + +// Data structure to describe a process' schedulability. +const X__DefinedSchedparam = 1 + +// Size definition for CPU sets. +const X__CPU_SETSIZE = 1024 + +// The official definition. +type SchedParam struct { + X__SchedPriority c.Int +} + +// Data structure to describe a process' schedulability. +type X__SchedParam struct { + X__SchedPriority c.Int +} + +// Data structure to describe CPU mask. +type CpuSetT struct { + X__Bits [16]X__CpuMask +} + +// Type for array elements in 'cpu_set_t'. +type X__CpuMask = c.Ulong + +//go:linkname X__SchedCpucount C.__sched_cpucount +func X__SchedCpucount(__setsize SizeT, __setp *CpuSetT) c.Int + +//go:linkname X__SchedCpualloc C.__sched_cpualloc +func X__SchedCpualloc(__count SizeT) *CpuSetT + +// llgo:link (*CpuSetT).X__SchedCpufree C.__sched_cpufree +func (self *CpuSetT) X__SchedCpufree() { +} diff --git a/c/os/bits-sched_linux_arm64.go b/c/os/bits-sched_linux_arm64.go new file mode 100644 index 00000000..163aff39 --- /dev/null +++ b/c/os/bits-sched_linux_arm64.go @@ -0,0 +1,51 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +// Scheduling algorithms. +const ( + SCHED_OTHER = 0 + SCHED_FIFO = 1 + SCHED_RR = 2 +) + +// Data structure to describe a process' schedulability. +const X__DefinedSchedparam = 1 + +// Size definition for CPU sets. +const X__CPU_SETSIZE = 1024 + +// The official definition. +type SchedParam struct { + X__SchedPriority c.Int +} + +// Data structure to describe a process' schedulability. +type X__SchedParam struct { + X__SchedPriority c.Int +} + +// Data structure to describe CPU mask. +type CpuSetT struct { + X__Bits [16]X__CpuMask +} + +// Type for array elements in 'cpu_set_t'. +type X__CpuMask = c.Ulong + +//go:linkname X__SchedCpucount C.__sched_cpucount +func X__SchedCpucount(__setsize SizeT, __setp *CpuSetT) c.Int + +//go:linkname X__SchedCpualloc C.__sched_cpualloc +func X__SchedCpualloc(__count SizeT) *CpuSetT + +// llgo:link (*CpuSetT).X__SchedCpufree C.__sched_cpufree +func (self *CpuSetT) X__SchedCpufree() { +} diff --git a/c/os/bits-stat_linux_amd64.go b/c/os/bits-stat_linux_amd64.go new file mode 100644 index 00000000..45b4ae5f --- /dev/null +++ b/c/os/bits-stat_linux_amd64.go @@ -0,0 +1,51 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import () + +const X_BITS_STAT_H = 1 +const ( + X_STAT_VER_KERNEL = 0 + X_STAT_VER_LINUX = 1 +) + +// x86-64 versions of the `xmknod' interface. +const X_MKNOD_VER_LINUX = 0 +const X_STAT_VER = 1 + +// These bits determine file type. +const X__S_IFMT = 61440 + +// File types. +const ( + X__S_IFDIR = 16384 + // Character device. + X__S_IFCHR = 8192 + // Block device. + X__S_IFBLK = 24576 + // Regular file. + X__S_IFREG = 32768 + // FIFO. + X__S_IFIFO = 4096 + // Symbolic link. + X__S_IFLNK = 40960 + // Socket. + X__S_IFSOCK = 49152 +) +const ( + // Set user ID on execution. + X__S_ISUID = 2048 + // Set group ID on execution. + X__S_ISGID = 1024 + // Save swapped text after use (sticky). + X__S_ISVTX = 512 + // Read by owner. + X__S_IREAD = 256 + // Write by owner. + X__S_IWRITE = 128 + // Execute by owner. + X__S_IEXEC = 64 +) diff --git a/c/os/bits-stat_linux_arm64.go b/c/os/bits-stat_linux_arm64.go new file mode 100644 index 00000000..aa2972bd --- /dev/null +++ b/c/os/bits-stat_linux_arm64.go @@ -0,0 +1,59 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import () + +const X_BITS_STAT_H = 1 + +// 64-bit libc uses the kernel's 'struct stat', accessed via the +// stat() syscall; 32-bit libc uses the kernel's 'struct stat64' +// and accesses it via the stat64() syscall. All the various +// APIs offered by libc use the kernel shape for their struct stat +// structure; the only difference is that 32-bit programs not +// using __USE_FILE_OFFSET64 only see the low 32 bits of some +// of the fields (specifically st_ino, st_size, and st_blocks). +const ( + X_STAT_VER_KERNEL = 0 + X_STAT_VER_LINUX = 0 + X_STAT_VER = 0 +) + +// Versions of the `xmknod' interface. +const X_MKNOD_VER_LINUX = 0 + +// These bits determine file type. +const X__S_IFMT = 61440 + +// File types. +const ( + X__S_IFDIR = 16384 + // Character device. + X__S_IFCHR = 8192 + // Block device. + X__S_IFBLK = 24576 + // Regular file. + X__S_IFREG = 32768 + // FIFO. + X__S_IFIFO = 4096 + // Symbolic link. + X__S_IFLNK = 40960 + // Socket. + X__S_IFSOCK = 49152 +) +const ( + // Set user ID on execution. + X__S_ISUID = 2048 + // Set group ID on execution. + X__S_ISGID = 1024 + // Save swapped text after use (sticky). + X__S_ISVTX = 512 + // Read by owner. + X__S_IREAD = 256 + // Write by owner. + X__S_IWRITE = 128 + // Execute by owner. + X__S_IEXEC = 64 +) diff --git a/c/os/bits-statvfs_linux_amd64.go b/c/os/bits-statvfs_linux_amd64.go new file mode 100644 index 00000000..66697a49 --- /dev/null +++ b/c/os/bits-statvfs_linux_amd64.go @@ -0,0 +1,30 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +type Statvfs struct { + FBsize c.Ulong + FFrsize c.Ulong + FBlocks X__FsblkcntT + FBfree X__FsblkcntT + FBavail X__FsblkcntT + FFiles X__FsfilcntT + FFfree X__FsfilcntT + FFavail X__FsfilcntT + FFsid c.Ulong + FFlag c.Ulong + FNamemax c.Ulong + X__FSpare [6]c.Int +} + +// Definitions for the flag in `f_flag'. These definitions should be +// kept in sync with the definitions in . +const ( + ST_RDONLY = 1 + // Ignore suid and sgid bits. + ST_NOSUID = 2 +) diff --git a/c/os/bits-statvfs_linux_arm64.go b/c/os/bits-statvfs_linux_arm64.go new file mode 100644 index 00000000..2273b007 --- /dev/null +++ b/c/os/bits-statvfs_linux_arm64.go @@ -0,0 +1,30 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +type Statvfs struct { + FBsize c.Ulong + FFrsize c.Ulong + FBlocks X__FsblkcntT + FBfree X__FsblkcntT + FBavail X__FsblkcntT + FFiles X__FsfilcntT + FFfree X__FsfilcntT + FFavail X__FsfilcntT + FFsid c.Ulong + FFlag c.Ulong + FNamemax c.Ulong + X__FSpare [6]c.Int +} + +// Definitions for the flag in `f_flag'. These definitions should be +// kept in sync with the definitions in . +const ( + ST_RDONLY = 1 + // Ignore suid and sgid bits. + ST_NOSUID = 2 +) diff --git a/c/os/bits-termios_linux_amd64.go b/c/os/bits-termios_linux_amd64.go new file mode 100644 index 00000000..0525bc2b --- /dev/null +++ b/c/os/bits-termios_linux_amd64.go @@ -0,0 +1,216 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +const NCCS = 32 +const ( + X_HAVE_STRUCT_TERMIOS_C_ISPEED = 1 + X_HAVE_STRUCT_TERMIOS_C_OSPEED = 1 +) + +// c_cc characters +const ( + VINTR = 0 + VQUIT = 1 + VERASE = 2 + VKILL = 3 + VEOF = 4 + VTIME = 5 + VMIN = 6 + VSWTC = 7 + VSTART = 8 + VSTOP = 9 + VSUSP = 10 + VEOL = 11 + VREPRINT = 12 + VDISCARD = 13 + VWERASE = 14 + VLNEXT = 15 + VEOL2 = 16 +) + +// c_iflag bits +const ( + IGNBRK = 1 + BRKINT = 2 + IGNPAR = 4 + PARMRK = 8 + INPCK = 16 + ISTRIP = 32 + INLCR = 64 + IGNCR = 128 + ICRNL = 256 + IUCLC = 512 + IXON = 1024 + IXANY = 2048 + IXOFF = 4096 + IMAXBEL = 8192 + IUTF8 = 16384 +) + +// c_oflag bits +const ( + OPOST = 1 + OLCUC = 2 + ONLCR = 4 + OCRNL = 8 + ONOCR = 16 + ONLRET = 32 + OFILL = 64 + OFDEL = 128 +) +const ( + NLDLY = 256 + NL0 = 0 + NL1 = 256 + CRDLY = 1536 + CR0 = 0 + CR1 = 512 + CR2 = 1024 + CR3 = 1536 + TABDLY = 6144 + TAB0 = 0 + TAB1 = 2048 + TAB2 = 4096 + TAB3 = 6144 + BSDLY = 8192 + BS0 = 0 + BS1 = 8192 + FFDLY = 32768 + FF0 = 0 + FF1 = 32768 +) +const ( + VTDLY = 16384 + VT0 = 0 + VT1 = 16384 +) +const XTABS = 6144 +const CBAUD = 4111 +const ( + // hang up + B0 = 0 + B50 = 1 + B75 = 2 + B110 = 3 + B134 = 4 + B150 = 5 + B200 = 6 + B300 = 7 + B600 = 8 + B1200 = 9 + B1800 = 10 + B2400 = 11 + B4800 = 12 + B9600 = 13 + B19200 = 14 + B38400 = 15 +) +const ( + EXTA = 14 + EXTB = 15 +) +const ( + CSIZE = 48 + CS5 = 0 + CS6 = 16 + CS7 = 32 + CS8 = 48 + CSTOPB = 64 + CREAD = 128 + PARENB = 256 + PARODD = 512 + HUPCL = 1024 + CLOCAL = 2048 +) +const CBAUDEX = 4096 +const ( + B57600 = 4097 + B115200 = 4098 + B230400 = 4099 + B460800 = 4100 + B500000 = 4101 + B576000 = 4102 + B921600 = 4103 + B1000000 = 4104 + B1152000 = 4105 + B1500000 = 4106 + B2000000 = 4107 + B2500000 = 4108 + B3000000 = 4109 + B3500000 = 4110 + B4000000 = 4111 + X__MAX_BAUD = 4111 +) +const ( + // input baud rate (not used) + CIBAUD = 269418496 + // mark or space (stick) parity + CMSPAR = 1073741824 + // flow control + CRTSCTS = 2147483648 +) + +// c_lflag bits +const ( + ISIG = 1 + ICANON = 2 +) +const XCASE = 4 +const ( + ECHO = 8 + ECHOE = 16 + ECHOK = 32 + ECHONL = 64 + NOFLSH = 128 + TOSTOP = 256 +) +const ( + ECHOCTL = 512 + ECHOPRT = 1024 + ECHOKE = 2048 + FLUSHO = 4096 + PENDIN = 16384 +) +const IEXTEN = 32768 +const EXTPROC = 65536 + +// tcflow() and TCXONC use these +const ( + TCOOFF = 0 + TCOON = 1 + TCIOFF = 2 + TCION = 3 +) + +// tcflush() and TCFLSH use these +const ( + TCIFLUSH = 0 + TCOFLUSH = 1 + TCIOFLUSH = 2 +) + +// tcsetattr uses these +const ( + TCSANOW = 0 + TCSADRAIN = 1 + TCSAFLUSH = 2 +) + +type Termios struct { + CIflag TcflagT + COflag TcflagT + CCflag TcflagT + CLflag TcflagT + CLine CcT + CCc [32]CcT + CIspeed SpeedT + COspeed SpeedT +} +type CcT = uint8 +type SpeedT = c.Uint +type TcflagT = c.Uint diff --git a/c/os/bits-termios_linux_arm64.go b/c/os/bits-termios_linux_arm64.go new file mode 100644 index 00000000..46ceb556 --- /dev/null +++ b/c/os/bits-termios_linux_arm64.go @@ -0,0 +1,216 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +const NCCS = 32 +const ( + X_HAVE_STRUCT_TERMIOS_C_ISPEED = 1 + X_HAVE_STRUCT_TERMIOS_C_OSPEED = 1 +) + +// c_cc characters +const ( + VINTR = 0 + VQUIT = 1 + VERASE = 2 + VKILL = 3 + VEOF = 4 + VTIME = 5 + VMIN = 6 + VSWTC = 7 + VSTART = 8 + VSTOP = 9 + VSUSP = 10 + VEOL = 11 + VREPRINT = 12 + VDISCARD = 13 + VWERASE = 14 + VLNEXT = 15 + VEOL2 = 16 +) + +// c_iflag bits +const ( + IGNBRK = 1 + BRKINT = 2 + IGNPAR = 4 + PARMRK = 8 + INPCK = 16 + ISTRIP = 32 + INLCR = 64 + IGNCR = 128 + ICRNL = 256 + IUCLC = 512 + IXON = 1024 + IXANY = 2048 + IXOFF = 4096 + IMAXBEL = 8192 + IUTF8 = 16384 +) + +// c_oflag bits +const ( + OPOST = 1 + OLCUC = 2 + ONLCR = 4 + OCRNL = 8 + ONOCR = 16 + ONLRET = 32 + OFILL = 64 + OFDEL = 128 +) +const ( + NLDLY = 256 + NL0 = 0 + NL1 = 256 + CRDLY = 1536 + CR0 = 0 + CR1 = 512 + CR2 = 1024 + CR3 = 1536 + TABDLY = 6144 + TAB0 = 0 + TAB1 = 2048 + TAB2 = 4096 + TAB3 = 6144 + BSDLY = 8192 + BS0 = 0 + BS1 = 8192 + FFDLY = 32768 + FF0 = 0 + FF1 = 32768 +) +const ( + VTDLY = 16384 + VT0 = 0 + VT1 = 16384 +) +const XTABS = 6144 +const CBAUD = 4111 +const ( + // hang up + B0 = 0 + B50 = 1 + B75 = 2 + B110 = 3 + B134 = 4 + B150 = 5 + B200 = 6 + B300 = 7 + B600 = 8 + B1200 = 9 + B1800 = 10 + B2400 = 11 + B4800 = 12 + B9600 = 13 + B19200 = 14 + B38400 = 15 +) +const ( + EXTA = 14 + EXTB = 15 +) +const ( + CSIZE = 48 + CS5 = 0 + CS6 = 16 + CS7 = 32 + CS8 = 48 + CSTOPB = 64 + CREAD = 128 + PARENB = 256 + PARODD = 512 + HUPCL = 1024 + CLOCAL = 2048 +) +const CBAUDEX = 4096 +const ( + B57600 = 4097 + B115200 = 4098 + B230400 = 4099 + B460800 = 4100 + B500000 = 4101 + B576000 = 4102 + B921600 = 4103 + B1000000 = 4104 + B1152000 = 4105 + B1500000 = 4106 + B2000000 = 4107 + B2500000 = 4108 + B3000000 = 4109 + B3500000 = 4110 + B4000000 = 4111 + X__MAX_BAUD = 4111 +) +const ( + // input baud rate (not used) + CIBAUD = 269418496 + // mark or space (stick) parity + CMSPAR = 1073741824 + // flow control + CRTSCTS = 2147483648 +) + +// c_lflag bits +const ( + ISIG = 1 + ICANON = 2 +) +const XCASE = 4 +const ( + ECHO = 8 + ECHOE = 16 + ECHOK = 32 + ECHONL = 64 + NOFLSH = 128 + TOSTOP = 256 +) +const ( + ECHOCTL = 512 + ECHOPRT = 1024 + ECHOKE = 2048 + FLUSHO = 4096 + PENDIN = 16384 +) +const IEXTEN = 32768 +const EXTPROC = 65536 + +// tcflow() and TCXONC use these +const ( + TCOOFF = 0 + TCOON = 1 + TCIOFF = 2 + TCION = 3 +) + +// tcflush() and TCFLSH use these +const ( + TCIFLUSH = 0 + TCOFLUSH = 1 + TCIOFLUSH = 2 +) + +// tcsetattr uses these +const ( + TCSANOW = 0 + TCSADRAIN = 1 + TCSAFLUSH = 2 +) + +type Termios struct { + CIflag TcflagT + COflag TcflagT + CCflag TcflagT + CLflag TcflagT + CLine CcT + CCc [32]CcT + CIspeed SpeedT + COspeed SpeedT +} +type CcT = uint8 +type SpeedT = c.Uint +type TcflagT = c.Uint diff --git a/c/os/bits-types_linux_amd64.go b/c/os/bits-types_linux_amd64.go new file mode 100644 index 00000000..9513a156 --- /dev/null +++ b/c/os/bits-types_linux_amd64.go @@ -0,0 +1,133 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +const X_BITS_TYPES_H = 1 + +type X__FsidT struct { + X__Val [2]c.Int +} + +// Convenience types. +type X__UChar = uint8 +type X__UShort = uint16 +type X__UInt = c.Uint +type X__ULong = c.Ulong + +// Fixed-size types, underlying types depend on word size and compiler. +type X__Int8T = int8 +type X__Uint8T = uint8 +type X__Int16T = int16 +type X__Uint16T = uint16 +type X__Int32T = c.Int +type X__Uint32T = c.Uint +type X__Int64T = c.Long +type X__Uint64T = c.Ulong +type X__QuadT = c.Long +type X__UQuadT = c.Ulong + +// Type of device numbers. +type X__DevT = c.Ulong + +// Type of user identifications. +type X__UidT = c.Uint + +// Type of group identifications. +type X__GidT = c.Uint + +// Type of file serial numbers. +type X__InoT = c.Ulong + +// Type of file serial numbers (LFS). +type X__Ino64T = c.Ulong + +// Type of file attribute bitmasks. +type X__ModeT = c.Uint + +// Type of file link counts. +type X__NlinkT = c.Ulong + +// Type of file sizes and offsets. +type X__OffT = c.Long + +// Type of file sizes and offsets (LFS). +type X__Off64T = c.Long + +// Type of process identifications. +type X__PidT = c.Int + +// Type of CPU usage counts. +type X__ClockT = c.Long + +// Type for resource measurement. +type X__RlimT = c.Ulong + +// Type for resource measurement (LFS). +type X__Rlim64T = c.Ulong + +// General type for IDs. +type X__IdT = c.Uint + +// Seconds since the Epoch. +type X__TimeT = c.Long + +// Count of microseconds. +type X__UsecondsT = c.Uint + +// Signed count of microseconds. +type X__SusecondsT = c.Long + +// The type of a disk address. +type X__DaddrT = c.Int + +// Type of an IPC key. +type X__KeyT = c.Int + +// Clock ID used in clock and timer functions. +type X__ClockidT = c.Int + +// Timer ID returned by `timer_create'. +type X__TimerT uintptr + +// Type to represent block size. +type X__BlksizeT = c.Long + +// Type to count number of disk blocks. +type X__BlkcntT = c.Long +type X__Blkcnt64T = c.Long + +// Type to count file system blocks. +type X__FsblkcntT = c.Ulong +type X__Fsblkcnt64T = c.Ulong + +// Type to count file system nodes. +type X__FsfilcntT = c.Ulong +type X__Fsfilcnt64T = c.Ulong + +// Type of miscellaneous file system fields. +type X__FswordT = c.Long + +// Type of a byte count, or error. +type X__SsizeT = c.Long + +// Signed long type used in system calls. +type X__SyscallSlongT = c.Long + +// Unsigned long type used in system calls. +type X__SyscallUlongT = c.Ulong + +// These few don't really vary by system, they always correspond +// to one of the other defined types. +type X__LoffT = X__Off64T +type X__QaddrT = *X__QuadT +type X__CaddrT = *c.Char + +// Duplicates info from stdint.h but this is used in unistd.h. +type X__IntptrT = c.Long + +// Duplicate info from sys/socket.h. +type X__SocklenT = c.Uint diff --git a/c/os/bits-types_linux_arm64.go b/c/os/bits-types_linux_arm64.go new file mode 100644 index 00000000..dd7be42c --- /dev/null +++ b/c/os/bits-types_linux_arm64.go @@ -0,0 +1,133 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +const X_BITS_TYPES_H = 1 + +type X__FsidT struct { + X__Val [2]c.Int +} + +// Convenience types. +type X__UChar = uint8 +type X__UShort = uint16 +type X__UInt = c.Uint +type X__ULong = c.Ulong + +// Fixed-size types, underlying types depend on word size and compiler. +type X__Int8T = int8 +type X__Uint8T = uint8 +type X__Int16T = int16 +type X__Uint16T = uint16 +type X__Int32T = c.Int +type X__Uint32T = c.Uint +type X__Int64T = c.Long +type X__Uint64T = c.Ulong +type X__QuadT = c.Long +type X__UQuadT = c.Ulong + +// Type of device numbers. +type X__DevT = c.Ulong + +// Type of user identifications. +type X__UidT = c.Uint + +// Type of group identifications. +type X__GidT = c.Uint + +// Type of file serial numbers. +type X__InoT = c.Ulong + +// Type of file serial numbers (LFS). +type X__Ino64T = c.Ulong + +// Type of file attribute bitmasks. +type X__ModeT = c.Uint + +// Type of file link counts. +type X__NlinkT = c.Uint + +// Type of file sizes and offsets. +type X__OffT = c.Long + +// Type of file sizes and offsets (LFS). +type X__Off64T = c.Long + +// Type of process identifications. +type X__PidT = c.Int + +// Type of CPU usage counts. +type X__ClockT = c.Long + +// Type for resource measurement. +type X__RlimT = c.Ulong + +// Type for resource measurement (LFS). +type X__Rlim64T = c.Ulong + +// General type for IDs. +type X__IdT = c.Uint + +// Seconds since the Epoch. +type X__TimeT = c.Long + +// Count of microseconds. +type X__UsecondsT = c.Uint + +// Signed count of microseconds. +type X__SusecondsT = c.Long + +// The type of a disk address. +type X__DaddrT = c.Int + +// Type of an IPC key. +type X__KeyT = c.Int + +// Clock ID used in clock and timer functions. +type X__ClockidT = c.Int + +// Timer ID returned by `timer_create'. +type X__TimerT uintptr + +// Type to represent block size. +type X__BlksizeT = c.Int + +// Type to count number of disk blocks. +type X__BlkcntT = c.Long +type X__Blkcnt64T = c.Long + +// Type to count file system blocks. +type X__FsblkcntT = c.Ulong +type X__Fsblkcnt64T = c.Ulong + +// Type to count file system nodes. +type X__FsfilcntT = c.Ulong +type X__Fsfilcnt64T = c.Ulong + +// Type of miscellaneous file system fields. +type X__FswordT = c.Long + +// Type of a byte count, or error. +type X__SsizeT = c.Long + +// Signed long type used in system calls. +type X__SyscallSlongT = c.Long + +// Unsigned long type used in system calls. +type X__SyscallUlongT = c.Ulong + +// These few don't really vary by system, they always correspond +// to one of the other defined types. +type X__LoffT = X__Off64T +type X__QaddrT = *X__QuadT +type X__CaddrT = *uint8 + +// Duplicates info from stdint.h but this is used in unistd.h. +type X__IntptrT = c.Long + +// Duplicate info from sys/socket.h. +type X__SocklenT = c.Uint diff --git a/c/os/dirent_darwin_arm64.go b/c/os/dirent_darwin_arm64.go new file mode 100644 index 00000000..4ecb7b5f --- /dev/null +++ b/c/os/dirent_darwin_arm64.go @@ -0,0 +1,37 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +// definitions for library routines operating on directories. +const DIRBLKSIZ = 1024 + +// flags for opendir2 +const ( + DTF_HIDEW = 1 + // don't return duplicate names + DTF_NODUP = 2 + // rewind after reading union stack + DTF_REWIND = 4 + // everything has been read + X__DTF_READALL = 8 + // assume internal buffer is populated + X__DTF_SKIPREAD = 16 + // there's nothing more to read in the kernel + X__DTF_ATEND = 32 +) + +type X_telldir struct { +} + +//go:linkname Alphasort C.alphasort +func Alphasort(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int + +//go:linkname Scandir C.scandir +func Scandir(_llcppg_param1 *c.Char, _llcppg_param2 ***Dirent, _llcppg_param3 func(_llcppg_param1 *Dirent) c.Int, _llcppg_param4 func(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int) c.Int diff --git a/c/os/dirent_linux_amd64.go b/c/os/dirent_linux_amd64.go new file mode 100644 index 00000000..e1909d17 --- /dev/null +++ b/c/os/dirent_linux_amd64.go @@ -0,0 +1,68 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_DIRENT_H = 1 + +// File types for `d_type'. +const ( + DT_UNKNOWN = 0 + DT_FIFO = 1 + DT_CHR = 2 + DT_DIR = 4 + DT_BLK = 6 + DT_REG = 8 + DT_LNK = 10 + DT_SOCK = 12 + DT_WHT = 14 +) + +type X__Dirstream struct { +} + +// This is the data type of directory stream objects. +// The actual structure is opaque to users. + +// llgo:link (*DIR).ReaddirR C.readdir_r +func (self *DIR) ReaddirR(__entry *Dirent, __result **Dirent) c.Int { + return 0 +} + +// Rewind DIRP to the beginning of the directory. +// +// llgo:link (*DIR).Rewinddir C.rewinddir +func (self *DIR) Rewinddir() { +} + +// Seek to position POS on DIRP. +// +// llgo:link (*DIR).Seekdir C.seekdir +func (self *DIR) Seekdir(__pos c.Long) { +} + +// Return the current position of DIRP. +// +// llgo:link (*DIR).Telldir C.telldir +func (self *DIR) Telldir() c.Long { + return 0 +} + +// Return the file descriptor used by DIRP. +// +// llgo:link (*DIR).Dirfd C.dirfd +func (self *DIR) Dirfd() c.Int { + return 0 +} + +//go:linkname Scandir C.scandir +func Scandir(__dir *c.Char, __namelist ***Dirent, __selector func(_llcppg_param1 *Dirent) c.Int, __cmp func(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int) c.Int + +//go:linkname Alphasort C.alphasort +func Alphasort(__e1 **Dirent, __e2 **Dirent) c.Int diff --git a/c/os/dirent_linux_arm64.go b/c/os/dirent_linux_arm64.go new file mode 100644 index 00000000..504f714b --- /dev/null +++ b/c/os/dirent_linux_arm64.go @@ -0,0 +1,68 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_DIRENT_H = 1 + +// File types for `d_type'. +const ( + DT_UNKNOWN = 0 + DT_FIFO = 1 + DT_CHR = 2 + DT_DIR = 4 + DT_BLK = 6 + DT_REG = 8 + DT_LNK = 10 + DT_SOCK = 12 + DT_WHT = 14 +) + +type X__Dirstream struct { +} + +// This is the data type of directory stream objects. +// The actual structure is opaque to users. + +// llgo:link (*DIR).ReaddirR C.readdir_r +func (self *DIR) ReaddirR(__entry *Dirent, __result **Dirent) c.Int { + return 0 +} + +// Rewind DIRP to the beginning of the directory. +// +// llgo:link (*DIR).Rewinddir C.rewinddir +func (self *DIR) Rewinddir() { +} + +// Seek to position POS on DIRP. +// +// llgo:link (*DIR).Seekdir C.seekdir +func (self *DIR) Seekdir(__pos c.Long) { +} + +// Return the current position of DIRP. +// +// llgo:link (*DIR).Telldir C.telldir +func (self *DIR) Telldir() c.Long { + return 0 +} + +// Return the file descriptor used by DIRP. +// +// llgo:link (*DIR).Dirfd C.dirfd +func (self *DIR) Dirfd() c.Int { + return 0 +} + +//go:linkname Scandir C.scandir +func Scandir(__dir *uint8, __namelist ***Dirent, __selector func(_llcppg_param1 *Dirent) c.Int, __cmp func(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int) c.Int + +//go:linkname Alphasort C.alphasort +func Alphasort(__e1 **Dirent, __e2 **Dirent) c.Int diff --git a/c/os/dlfcn_darwin_arm64.go b/c/os/dlfcn_darwin_arm64.go new file mode 100644 index 00000000..a2b3073b --- /dev/null +++ b/c/os/dlfcn_darwin_arm64.go @@ -0,0 +1,49 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const ( + RTLD_LAZY = 1 + RTLD_NOW = 2 + RTLD_LOCAL = 4 + RTLD_GLOBAL = 8 +) +const ( + RTLD_NOLOAD = 16 + RTLD_NODELETE = 128 + // Mac OS X 10.5 and later + RTLD_FIRST = 256 +) + +// Structure filled in by dladdr(). +type DlInfo struct { + DliFname *c.Char + DliFbase unsafe.Pointer + DliSname *c.Char + DliSaddr unsafe.Pointer +} + +//go:linkname Dladdr C.dladdr +func Dladdr(_llcppg_param1 unsafe.Pointer, _llcppg_param2 *DlInfo) c.Int + +//go:linkname Dlclose C.dlclose +func Dlclose(__handle unsafe.Pointer) c.Int + +//go:linkname Dlerror C.dlerror +func Dlerror() *c.Char + +//go:linkname Dlopen C.dlopen +func Dlopen(__path *c.Char, __mode c.Int) unsafe.Pointer + +//go:linkname Dlsym C.dlsym +func Dlsym(__handle unsafe.Pointer, __symbol *c.Char) unsafe.Pointer + +//go:linkname DlopenPreflight C.dlopen_preflight +func DlopenPreflight(__path *c.Char) c.Int diff --git a/c/os/dlfcn_linux_amd64.go b/c/os/dlfcn_linux_amd64.go new file mode 100644 index 00000000..d8ccfddc --- /dev/null +++ b/c/os/dlfcn_linux_amd64.go @@ -0,0 +1,37 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const X_DLFCN_H = 1 + +// Open the shared object FILE and map it in; return a handle that can be +// passed to `dlsym' to get symbol values from it. +// +//go:linkname Dlopen C.dlopen +func Dlopen(__file *c.Char, __mode c.Int) unsafe.Pointer + +// Unmap and close a shared object opened by `dlopen'. +// The handle cannot be used again after calling `dlclose'. +// +//go:linkname Dlclose C.dlclose +func Dlclose(__handle unsafe.Pointer) c.Int + +// Find the run-time address in the shared object HANDLE refers to +// of the symbol called NAME. +// +//go:linkname Dlsym C.dlsym +func Dlsym(__handle unsafe.Pointer, __name *c.Char) unsafe.Pointer + +// When any of the above functions fails, call this function +// to return a string describing the error. Each call resets +// the error string so that a following call returns null. +// +//go:linkname Dlerror C.dlerror +func Dlerror() *c.Char diff --git a/c/os/dlfcn_linux_arm64.go b/c/os/dlfcn_linux_arm64.go new file mode 100644 index 00000000..3b122c51 --- /dev/null +++ b/c/os/dlfcn_linux_arm64.go @@ -0,0 +1,37 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const X_DLFCN_H = 1 + +// Open the shared object FILE and map it in; return a handle that can be +// passed to `dlsym' to get symbol values from it. +// +//go:linkname Dlopen C.dlopen +func Dlopen(__file *uint8, __mode c.Int) unsafe.Pointer + +// Unmap and close a shared object opened by `dlopen'. +// The handle cannot be used again after calling `dlclose'. +// +//go:linkname Dlclose C.dlclose +func Dlclose(__handle unsafe.Pointer) c.Int + +// Find the run-time address in the shared object HANDLE refers to +// of the symbol called NAME. +// +//go:linkname Dlsym C.dlsym +func Dlsym(__handle unsafe.Pointer, __name *uint8) unsafe.Pointer + +// When any of the above functions fails, call this function +// to return a string describing the error. Each call resets +// the error string so that a following call returns null. +// +//go:linkname Dlerror C.dlerror +func Dlerror() *uint8 diff --git a/c/os/fcntl_linux_amd64.go b/c/os/fcntl_linux_amd64.go new file mode 100644 index 00000000..c16b500e --- /dev/null +++ b/c/os/fcntl_linux_amd64.go @@ -0,0 +1,122 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_FCNTL_H = 1 +const ( + S_IFMT = 61440 + S_IFDIR = 16384 + S_IFCHR = 8192 + S_IFBLK = 24576 + S_IFREG = 32768 +) +const S_IFIFO = 4096 +const S_IFLNK = 40960 +const S_IFSOCK = 49152 +const ( + // Set user ID on execution. + S_ISUID = 2048 + // Set group ID on execution. + S_ISGID = 1024 +) + +// Save swapped text after use (sticky bit). This is pretty well obsolete. +const S_ISVTX = 512 +const ( + // Read by owner. + S_IRUSR = 256 + // Write by owner. + S_IWUSR = 128 + // Execute by owner. + S_IXUSR = 64 +) + +// Read, write, and execute by owner. +const S_IRWXU = 448 +const ( + // Read by group. + S_IRGRP = 32 + // Write by group. + S_IWGRP = 16 + // Execute by group. + S_IXGRP = 8 +) + +// Read, write, and execute by group. +const S_IRWXG = 56 +const ( + // Read by others. + S_IROTH = 4 + // Write by others. + S_IWOTH = 2 + // Execute by others. + S_IXOTH = 1 +) + +// Read, write, and execute by others. +const S_IRWXO = 7 + +// Values for the second argument to access. +// These may be OR'd together. +const ( + R_OK = 4 + // Test for write permission. + W_OK = 2 + // Test for execute permission. + X_OK = 1 + // Test for existence. + F_OK = 0 +) +const ( + // Seek from beginning of file. + SEEK_SET = 0 + // Seek from current position. + SEEK_CUR = 1 + // Seek from end of file. + SEEK_END = 2 +) + +// Special value used to indicate +// the *at functions should use the +// current working directory. +const AT_FDCWD = -100 +const ( + // Do not follow symbolic links. + AT_SYMLINK_NOFOLLOW = 256 + // Remove directory instead of + // unlinking file. + AT_REMOVEDIR = 512 +) + +// Follow symbolic links. +const AT_SYMLINK_FOLLOW = 1024 + +// Test access permitted for +// effective IDs, not real IDs. +const AT_EACCESS = 512 +const ( + // Unlock a previously locked region. + F_ULOCK = 0 + // Lock a region for exclusive use. + F_LOCK = 1 + // Test and lock a region for exclusive use. + F_TLOCK = 2 + // Test a region for other processes locks. + F_TEST = 3 +) + +//go:linkname Lockf C.lockf +func Lockf(__fd c.Int, __cmd c.Int, __len OffT) c.Int + +//go:linkname PosixFadvise C.posix_fadvise +func PosixFadvise(__fd c.Int, __offset OffT, __len OffT, __advise c.Int) c.Int + +//go:linkname PosixFallocate C.posix_fallocate +func PosixFallocate(__fd c.Int, __offset OffT, __len OffT) c.Int diff --git a/c/os/fcntl_linux_arm64.go b/c/os/fcntl_linux_arm64.go new file mode 100644 index 00000000..a2dccc28 --- /dev/null +++ b/c/os/fcntl_linux_arm64.go @@ -0,0 +1,122 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_FCNTL_H = 1 +const ( + S_IFMT = 61440 + S_IFDIR = 16384 + S_IFCHR = 8192 + S_IFBLK = 24576 + S_IFREG = 32768 +) +const S_IFIFO = 4096 +const S_IFLNK = 40960 +const S_IFSOCK = 49152 +const ( + // Set user ID on execution. + S_ISUID = 2048 + // Set group ID on execution. + S_ISGID = 1024 +) + +// Save swapped text after use (sticky bit). This is pretty well obsolete. +const S_ISVTX = 512 +const ( + // Read by owner. + S_IRUSR = 256 + // Write by owner. + S_IWUSR = 128 + // Execute by owner. + S_IXUSR = 64 +) + +// Read, write, and execute by owner. +const S_IRWXU = 448 +const ( + // Read by group. + S_IRGRP = 32 + // Write by group. + S_IWGRP = 16 + // Execute by group. + S_IXGRP = 8 +) + +// Read, write, and execute by group. +const S_IRWXG = 56 +const ( + // Read by others. + S_IROTH = 4 + // Write by others. + S_IWOTH = 2 + // Execute by others. + S_IXOTH = 1 +) + +// Read, write, and execute by others. +const S_IRWXO = 7 + +// Values for the second argument to access. +// These may be OR'd together. +const ( + R_OK = 4 + // Test for write permission. + W_OK = 2 + // Test for execute permission. + X_OK = 1 + // Test for existence. + F_OK = 0 +) +const ( + // Seek from beginning of file. + SEEK_SET = 0 + // Seek from current position. + SEEK_CUR = 1 + // Seek from end of file. + SEEK_END = 2 +) + +// Special value used to indicate +// the *at functions should use the +// current working directory. +const AT_FDCWD = -100 +const ( + // Do not follow symbolic links. + AT_SYMLINK_NOFOLLOW = 256 + // Remove directory instead of + // unlinking file. + AT_REMOVEDIR = 512 +) + +// Follow symbolic links. +const AT_SYMLINK_FOLLOW = 1024 + +// Test access permitted for +// effective IDs, not real IDs. +const AT_EACCESS = 512 +const ( + // Unlock a previously locked region. + F_ULOCK = 0 + // Lock a region for exclusive use. + F_LOCK = 1 + // Test and lock a region for exclusive use. + F_TLOCK = 2 + // Test a region for other processes locks. + F_TEST = 3 +) + +//go:linkname Lockf C.lockf +func Lockf(__fd c.Int, __cmd c.Int, __len OffT) c.Int + +//go:linkname PosixFadvise C.posix_fadvise +func PosixFadvise(__fd c.Int, __offset OffT, __len OffT, __advise c.Int) c.Int + +//go:linkname PosixFallocate C.posix_fallocate +func PosixFallocate(__fd c.Int, __offset OffT, __len OffT) c.Int diff --git a/c/os/flags_default.go b/c/os/flags_default.go index f119efdb..0032225d 100644 --- a/c/os/flags_default.go +++ b/c/os/flags_default.go @@ -1,4 +1,4 @@ -//go:build !windows +//go:build !windows && !(linux && (amd64 || arm64) && !android) /* * Copyright (c) 2026 The XGo Authors (xgo.dev). All rights reserved. diff --git a/c/os/flags_linux_amd64.go b/c/os/flags_linux_amd64.go new file mode 100644 index 00000000..a4eb4c76 --- /dev/null +++ b/c/os/flags_linux_amd64.go @@ -0,0 +1,18 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +const ( + F_GETFL = 3 + F_SETFL = 4 + O_RDONLY = 0 + O_WRONLY = 1 + O_RDWR = 2 + O_ACCMODE = 3 + O_NONBLOCK = 2048 + O_CREAT = 64 + O_TRUNC = 512 + EAGAIN = 11 +) diff --git a/c/os/flags_linux_arm64.go b/c/os/flags_linux_arm64.go new file mode 100644 index 00000000..a115895e --- /dev/null +++ b/c/os/flags_linux_arm64.go @@ -0,0 +1,18 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +const ( + F_GETFL = 3 + F_SETFL = 4 + O_RDONLY = 0 + O_WRONLY = 1 + O_RDWR = 2 + O_ACCMODE = 3 + O_NONBLOCK = 2048 + O_CREAT = 64 + O_TRUNC = 512 + EAGAIN = 11 +) diff --git a/c/os/fnmatch_darwin_arm64.go b/c/os/fnmatch_darwin_arm64.go new file mode 100644 index 00000000..c62d61db --- /dev/null +++ b/c/os/fnmatch_darwin_arm64.go @@ -0,0 +1,35 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +// Match failed. +const FNM_NOMATCH = 1 +const ( + // Disable backslash escaping. + FNM_NOESCAPE = 1 + // Slash must be matched by slash. + FNM_PATHNAME = 2 + // Period must be matched by period. + FNM_PERIOD = 4 +) + +// Reserved. +const FNM_NOSYS = -1 +const ( + // Ignore / after Imatch. + FNM_LEADING_DIR = 8 + // Case insensitive search. + FNM_CASEFOLD = 16 + FNM_IGNORECASE = 16 + FNM_FILE_NAME = 2 +) + +//go:linkname Fnmatch C.fnmatch +func Fnmatch(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char, _llcppg_param3 c.Int) c.Int diff --git a/c/os/fnmatch_linux_amd64.go b/c/os/fnmatch_linux_amd64.go new file mode 100644 index 00000000..9a4bcd09 --- /dev/null +++ b/c/os/fnmatch_linux_amd64.go @@ -0,0 +1,30 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_FNMATCH_H = 1 + +// Bits set in the FLAGS argument to `fnmatch'. +const ( + FNM_PATHNAME = 1 + // Backslashes don't quote special chars. + FNM_NOESCAPE = 2 + // Leading `.' is matched only explicitly. + FNM_PERIOD = 4 +) + +// Value returned by `fnmatch' if STRING does not match PATTERN. +const FNM_NOMATCH = 1 + +// Match NAME against the filename pattern PATTERN, +// returning zero if it matches, FNM_NOMATCH if not. +// +//go:linkname Fnmatch C.fnmatch +func Fnmatch(__pattern *c.Char, __name *c.Char, __flags c.Int) c.Int diff --git a/c/os/fnmatch_linux_arm64.go b/c/os/fnmatch_linux_arm64.go new file mode 100644 index 00000000..04ebd0cd --- /dev/null +++ b/c/os/fnmatch_linux_arm64.go @@ -0,0 +1,30 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_FNMATCH_H = 1 + +// Bits set in the FLAGS argument to `fnmatch'. +const ( + FNM_PATHNAME = 1 + // Backslashes don't quote special chars. + FNM_NOESCAPE = 2 + // Leading `.' is matched only explicitly. + FNM_PERIOD = 4 +) + +// Value returned by `fnmatch' if STRING does not match PATTERN. +const FNM_NOMATCH = 1 + +// Match NAME against the filename pattern PATTERN, +// returning zero if it matches, FNM_NOMATCH if not. +// +//go:linkname Fnmatch C.fnmatch +func Fnmatch(__pattern *uint8, __name *uint8, __flags c.Int) c.Int diff --git a/c/os/glob_linux_amd64.go b/c/os/glob_linux_amd64.go new file mode 100644 index 00000000..7c798f32 --- /dev/null +++ b/c/os/glob_linux_amd64.go @@ -0,0 +1,84 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const X_GLOB_H = 1 + +// Bits set in the FLAGS argument to `glob'. +const ( + GLOB_ERR = 1 + // Append a slash to each name. + GLOB_MARK = 2 + // Don't sort the names. + GLOB_NOSORT = 4 + // Insert PGLOB->gl_offs NULLs. + GLOB_DOOFFS = 8 + // If nothing matches, return the pattern. + GLOB_NOCHECK = 16 + // Append to results of a previous call. + GLOB_APPEND = 32 + // Backslashes don't quote metacharacters. + GLOB_NOESCAPE = 64 + // Leading `.' can be matched by metachars. + GLOB_PERIOD = 128 +) +const ( + // Set in gl_flags if any metachars seen. + GLOB_MAGCHAR = 256 + // Use gl_opendir et al functions. + GLOB_ALTDIRFUNC = 512 + // Expand "{a,b}" to "a" "b". + GLOB_BRACE = 1024 + // If no magic chars, return the pattern. + GLOB_NOMAGIC = 2048 + // Expand ~user and ~ to home directories. + GLOB_TILDE = 4096 + // Match only directories. + GLOB_ONLYDIR = 8192 + // Like GLOB_TILDE but return an error + // if the user name is not available. + GLOB_TILDE_CHECK = 16384 +) +const X__GLOB_FLAGS = 32511 + +// Error returns from `glob'. +const ( + GLOB_NOSPACE = 1 + // Read error. + GLOB_ABORTED = 2 + // No matches found. + GLOB_NOMATCH = 3 + // Not implemented. + GLOB_NOSYS = 4 +) + +// llgo:type C +type GlobT struct { + GlPathc X__SizeT + GlPathv **c.Char + GlOffs X__SizeT + GlFlags c.Int + GlClosedir func(_llcppg_param1 unsafe.Pointer) + GlReaddir func(_llcppg_param1 unsafe.Pointer) unsafe.Pointer + GlOpendir func(_llcppg_param1 *c.Char) unsafe.Pointer + GlLstat func(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer) c.Int + GlStat func(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer) c.Int +} +type X__SizeT = c.Ulong +type SizeT = c.Ulong + +//go:linkname Glob C.glob +func Glob(__pattern *c.Char, __flags c.Int, __errfunc func(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int, __pglob *GlobT) c.Int + +// Free storage allocated in PGLOB by a previous `glob' call. +// +// llgo:link (*GlobT).Globfree C.globfree +func (self *GlobT) Globfree() { +} diff --git a/c/os/glob_linux_arm64.go b/c/os/glob_linux_arm64.go new file mode 100644 index 00000000..1c973bab --- /dev/null +++ b/c/os/glob_linux_arm64.go @@ -0,0 +1,84 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const X_GLOB_H = 1 + +// Bits set in the FLAGS argument to `glob'. +const ( + GLOB_ERR = 1 + // Append a slash to each name. + GLOB_MARK = 2 + // Don't sort the names. + GLOB_NOSORT = 4 + // Insert PGLOB->gl_offs NULLs. + GLOB_DOOFFS = 8 + // If nothing matches, return the pattern. + GLOB_NOCHECK = 16 + // Append to results of a previous call. + GLOB_APPEND = 32 + // Backslashes don't quote metacharacters. + GLOB_NOESCAPE = 64 + // Leading `.' can be matched by metachars. + GLOB_PERIOD = 128 +) +const ( + // Set in gl_flags if any metachars seen. + GLOB_MAGCHAR = 256 + // Use gl_opendir et al functions. + GLOB_ALTDIRFUNC = 512 + // Expand "{a,b}" to "a" "b". + GLOB_BRACE = 1024 + // If no magic chars, return the pattern. + GLOB_NOMAGIC = 2048 + // Expand ~user and ~ to home directories. + GLOB_TILDE = 4096 + // Match only directories. + GLOB_ONLYDIR = 8192 + // Like GLOB_TILDE but return an error + // if the user name is not available. + GLOB_TILDE_CHECK = 16384 +) +const X__GLOB_FLAGS = 32511 + +// Error returns from `glob'. +const ( + GLOB_NOSPACE = 1 + // Read error. + GLOB_ABORTED = 2 + // No matches found. + GLOB_NOMATCH = 3 + // Not implemented. + GLOB_NOSYS = 4 +) + +// llgo:type C +type GlobT struct { + GlPathc X__SizeT + GlPathv **uint8 + GlOffs X__SizeT + GlFlags c.Int + GlClosedir func(_llcppg_param1 unsafe.Pointer) + GlReaddir func(_llcppg_param1 unsafe.Pointer) unsafe.Pointer + GlOpendir func(_llcppg_param1 *uint8) unsafe.Pointer + GlLstat func(_llcppg_param1 *uint8, _llcppg_param2 unsafe.Pointer) c.Int + GlStat func(_llcppg_param1 *uint8, _llcppg_param2 unsafe.Pointer) c.Int +} +type X__SizeT = c.Ulong +type SizeT = c.Ulong + +//go:linkname Glob C.glob +func Glob(__pattern *uint8, __flags c.Int, __errfunc func(_llcppg_param1 *uint8, _llcppg_param2 c.Int) c.Int, __pglob *GlobT) c.Int + +// Free storage allocated in PGLOB by a previous `glob' call. +// +// llgo:link (*GlobT).Globfree C.globfree +func (self *GlobT) Globfree() { +} diff --git a/c/os/grp_darwin_arm64.go b/c/os/grp_darwin_arm64.go new file mode 100644 index 00000000..10189e74 --- /dev/null +++ b/c/os/grp_darwin_arm64.go @@ -0,0 +1,62 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_PATH_GROUP = "/etc/group" + +type Group struct { + GrName *c.Char + GrPasswd *c.Char + GrGid GidT + GrMem **c.Char +} + +// [XBD] +// +//go:linkname Getgrgid C.getgrgid +func Getgrgid(_llcppg_param1 GidT) *Group + +// [TSF] +// +//go:linkname Getgrnam C.getgrnam +func Getgrnam(_llcppg_param1 *c.Char) *Group + +// [TSF] +// +//go:linkname GetgrgidR C.getgrgid_r +func GetgrgidR(_llcppg_param1 GidT, _llcppg_param2 *Group, _llcppg_param3 *c.Char, _llcppg_param4 SizeT, _llcppg_param5 **Group) c.Int + +// [XSI] +// +//go:linkname GetgrnamR C.getgrnam_r +func GetgrnamR(_llcppg_param1 *c.Char, _llcppg_param2 *Group, _llcppg_param3 *c.Char, _llcppg_param4 SizeT, _llcppg_param5 **Group) c.Int + +// [XSI] +// +//go:linkname Getgrent C.getgrent +func Getgrent() *Group + +//go:linkname Setgrent C.setgrent +func Setgrent() + +//go:linkname Endgrent C.endgrent +func Endgrent() + +//go:linkname GroupFromGid C.group_from_gid +func GroupFromGid(_llcppg_param1 GidT, _llcppg_param2 c.Int) *c.Char + +//go:linkname Getgruuid C.getgruuid +func Getgruuid(_llcppg_param1 UuidT) *Group + +//go:linkname GetgruuidR C.getgruuid_r +func GetgruuidR(_llcppg_param1 UuidT, _llcppg_param2 *Group, _llcppg_param3 *c.Char, _llcppg_param4 SizeT, _llcppg_param5 **Group) c.Int + +//go:linkname Setgroupent C.setgroupent +func Setgroupent(_llcppg_param1 c.Int) c.Int diff --git a/c/os/grp_linux_amd64.go b/c/os/grp_linux_amd64.go new file mode 100644 index 00000000..809d0a8e --- /dev/null +++ b/c/os/grp_linux_amd64.go @@ -0,0 +1,130 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_GRP_H = 1 + +// Reasonable value for the buffer sized used in the reentrant +// functions below. But better use `sysconf'. +const NSS_BUFLEN_GROUP = 1024 + +// The group structure. +type Group struct { + GrName *c.Char + GrPasswd *c.Char + GrGid X__GidT + GrMem **c.Char +} + +// Rewind the group-file stream. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Setgrent C.setgrent +func Setgrent() + +// Close the group-file stream. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endgrent C.endgrent +func Endgrent() + +// Read an entry from the group-file stream, opening it if necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getgrent C.getgrent +func Getgrent() *Group + +// Read a group entry from STREAM. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Fgetgrent C.fgetgrent +func Fgetgrent(__stream *c.FILE) *Group + +// Search for an entry with a matching group ID. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getgrgid C.getgrgid +func Getgrgid(__gid X__GidT) *Group + +// Search for an entry with a matching group name. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getgrnam C.getgrnam +func Getgrnam(__name *c.Char) *Group + +// Search for an entry with a matching group ID. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname GetgrgidR C.getgrgid_r +func GetgrgidR(__gid X__GidT, __resultbuf *Group, __buffer *c.Char, __buflen SizeT, __result **Group) c.Int + +// Search for an entry with a matching group name. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname GetgrnamR C.getgrnam_r +func GetgrnamR(__name *c.Char, __resultbuf *Group, __buffer *c.Char, __buflen SizeT, __result **Group) c.Int + +// Read a group entry from STREAM. This function is not standardized +// an probably never will. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname FgetgrentR C.fgetgrent_r +func FgetgrentR(__stream *c.FILE, __resultbuf *Group, __buffer *c.Char, __buflen SizeT, __result **Group) c.Int + +// Set the group set for the current user to GROUPS (N of them). +// +//go:linkname Setgroups C.setgroups +func Setgroups(__n SizeT, __groups *X__GidT) c.Int + +// Store at most *NGROUPS members of the group set for USER into +// GROUPS. Also include GROUP. The actual number of groups found is +// returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Getgrouplist C.getgrouplist +func Getgrouplist(__user *c.Char, __group X__GidT, __groups *X__GidT, __ngroups *c.Int) c.Int + +// Initialize the group set for the current user +// by reading the group database and using all groups +// of which USER is a member. Also include GROUP. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Initgroups C.initgroups +func Initgroups(__user *c.Char, __group X__GidT) c.Int diff --git a/c/os/grp_linux_arm64.go b/c/os/grp_linux_arm64.go new file mode 100644 index 00000000..1c7d053f --- /dev/null +++ b/c/os/grp_linux_arm64.go @@ -0,0 +1,130 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_GRP_H = 1 + +// Reasonable value for the buffer sized used in the reentrant +// functions below. But better use `sysconf'. +const NSS_BUFLEN_GROUP = 1024 + +// The group structure. +type Group struct { + GrName *uint8 + GrPasswd *uint8 + GrGid X__GidT + GrMem **uint8 +} + +// Rewind the group-file stream. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Setgrent C.setgrent +func Setgrent() + +// Close the group-file stream. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endgrent C.endgrent +func Endgrent() + +// Read an entry from the group-file stream, opening it if necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getgrent C.getgrent +func Getgrent() *Group + +// Read a group entry from STREAM. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Fgetgrent C.fgetgrent +func Fgetgrent(__stream *c.FILE) *Group + +// Search for an entry with a matching group ID. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getgrgid C.getgrgid +func Getgrgid(__gid X__GidT) *Group + +// Search for an entry with a matching group name. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getgrnam C.getgrnam +func Getgrnam(__name *uint8) *Group + +// Search for an entry with a matching group ID. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname GetgrgidR C.getgrgid_r +func GetgrgidR(__gid X__GidT, __resultbuf *Group, __buffer *uint8, __buflen SizeT, __result **Group) c.Int + +// Search for an entry with a matching group name. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname GetgrnamR C.getgrnam_r +func GetgrnamR(__name *uint8, __resultbuf *Group, __buffer *uint8, __buflen SizeT, __result **Group) c.Int + +// Read a group entry from STREAM. This function is not standardized +// an probably never will. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname FgetgrentR C.fgetgrent_r +func FgetgrentR(__stream *c.FILE, __resultbuf *Group, __buffer *uint8, __buflen SizeT, __result **Group) c.Int + +// Set the group set for the current user to GROUPS (N of them). +// +//go:linkname Setgroups C.setgroups +func Setgroups(__n SizeT, __groups *X__GidT) c.Int + +// Store at most *NGROUPS members of the group set for USER into +// GROUPS. Also include GROUP. The actual number of groups found is +// returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Getgrouplist C.getgrouplist +func Getgrouplist(__user *uint8, __group X__GidT, __groups *X__GidT, __ngroups *c.Int) c.Int + +// Initialize the group set for the current user +// by reading the group database and using all groups +// of which USER is a member. Also include GROUP. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Initgroups C.initgroups +func Initgroups(__user *uint8, __group X__GidT) c.Int diff --git a/c/os/libc_darwin_arm64.go b/c/os/libc_darwin_arm64.go deleted file mode 100644 index 802312f6..00000000 --- a/c/os/libc_darwin_arm64.go +++ /dev/null @@ -1,2476 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. -// Classified from the common libc binding. - -package os - -import ( - "github.com/goplus/lib/c" - llsignal "github.com/goplus/lib/c/signal" - llsys "github.com/goplus/lib/c/sys" - lltime "github.com/goplus/lib/c/time" - "unsafe" -) - -// time() -type X__DarwinTimeT = c.Long - -// definitions for library routines operating on directories. -const DIRBLKSIZ = 1024 - -// flags for opendir2 -const ( - DTF_HIDEW = 1 - // don't return duplicate names - DTF_NODUP = 2 - // rewind after reading union stack - DTF_REWIND = 4 - // everything has been read - // assume internal buffer is populated - // there's nothing more to read in the kernel -) - -// llgo:link (*DIR).ReaddirR C.readdir_r -func (self *DIR) ReaddirR(_llcppg_param2 *Dirent, _llcppg_param3 **Dirent) c.Int { - return 0 -} - -// llgo:link (*DIR).Rewinddir C.rewinddir -func (self *DIR) Rewinddir() { -} - -// llgo:link (*DIR).Seekdir C.seekdir -func (self *DIR) Seekdir(_llcppg_param2 c.Long) { -} - -// llgo:link (*DIR).Telldir C.telldir -func (self *DIR) Telldir() c.Long { - return 0 -} - -//go:linkname Alphasort C.alphasort -func Alphasort(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int - -// llgo:link (*DIR).Dirfd C.dirfd -func (self *DIR) Dirfd() c.Int { - return 0 -} - -//go:linkname Scandir C.scandir -func Scandir(_llcppg_param1 *c.Char, _llcppg_param2 ***Dirent, _llcppg_param3 func(_llcppg_param1 *Dirent) c.Int, _llcppg_param4 func(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int) c.Int - -const ( - RTLD_LAZY = 1 - RTLD_NOW = 2 - RTLD_LOCAL = 4 - RTLD_GLOBAL = 8 -) - -const ( - RTLD_NOLOAD = 16 - RTLD_NODELETE = 128 - // Mac OS X 10.5 and later - RTLD_FIRST = 256 -) - -// Structure filled in by dladdr(). -type DlInfo struct { - DliFname *c.Char - DliFbase unsafe.Pointer - DliSname *c.Char - DliSaddr unsafe.Pointer -} - -//go:linkname Dladdr C.dladdr -func Dladdr(_llcppg_param1 unsafe.Pointer, _llcppg_param2 *DlInfo) c.Int - -//go:linkname Dlclose C.dlclose -func Dlclose(__handle unsafe.Pointer) c.Int - -//go:linkname Dlerror C.dlerror -func Dlerror() *c.Char - -//go:linkname Dlopen C.dlopen -func Dlopen(__path *c.Char, __mode c.Int) unsafe.Pointer - -//go:linkname Dlsym C.dlsym -func Dlsym(__handle unsafe.Pointer, __symbol *c.Char) unsafe.Pointer - -//go:linkname DlopenPreflight C.dlopen_preflight -func DlopenPreflight(__path *c.Char) bool - -// Believed to have been introduced in 1003.2-1992 -const ( - GLOB_APPEND = 1 - // Use gl_offs. - GLOB_DOOFFS = 2 - // Return on error. - GLOB_ERR = 4 - // Append / to matching directories. - GLOB_MARK = 8 - // Return pattern itself if nothing matches. - GLOB_NOCHECK = 16 - // Don't sort. - GLOB_NOSORT = 32 - // Disable backslash escaping. - GLOB_NOESCAPE = 8192 -) - -// Error values returned by glob(3) -const ( - GLOB_NOSPACE = -1 - // Unignored error. - GLOB_ABORTED = -2 - // No match and GLOB_NOCHECK was not set. - GLOB_NOMATCH = -3 - // Obsolete: source comptability only. - GLOB_NOSYS = -4 -) - -const ( - // Use alternately specified directory funcs. - GLOB_ALTDIRFUNC = 64 - // Expand braces ala csh. - GLOB_BRACE = 128 - // Pattern had globbing characters. - GLOB_MAGCHAR = 256 - // GLOB_NOCHECK without magic chars (csh). - GLOB_NOMAGIC = 512 - // Quote special chars with \. - GLOB_QUOTE = 1024 - // Expand tilde names from the passwd file. - GLOB_TILDE = 2048 - // limit number of returned paths - GLOB_LIMIT = 4096 -) - -// source compatibility, these are the old names -const ( - GLOB_MAXPATH = 4096 - GLOB_ABEND = -2 -) - -// llgo:type C -type GlobT struct { - GlPathc c.SizeT - GlMatchc c.Int - GlOffs c.SizeT - GlFlags c.Int - GlPathv **c.Char - GlErrfunc func(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int - GlClosedir func(_llcppg_param1 unsafe.Pointer) - GlReaddir func(_llcppg_param1 unsafe.Pointer) *Dirent - GlOpendir func(_llcppg_param1 *c.Char) unsafe.Pointer - GlLstat func(_llcppg_param1 *c.Char, _llcppg_param2 *StatT) c.Int - GlStat func(_llcppg_param1 *c.Char, _llcppg_param2 *StatT) c.Int -} - -//go:linkname Glob C.glob -func Glob(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 func(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int, _llcppg_param4 *GlobT) c.Int - -// llgo:link (*GlobT).Globfree C.globfree -func (self *GlobT) Globfree() { -} - -type Group struct { - GrName *c.Char - GrPasswd *c.Char - GrGid GidT - GrMem **c.Char -} - -// [XBD] -// -//go:linkname Getgrgid C.getgrgid -func Getgrgid(_llcppg_param1 GidT) *Group - -// [TSF] -// -//go:linkname Getgrnam C.getgrnam -func Getgrnam(_llcppg_param1 *c.Char) *Group - -// [TSF] -// -//go:linkname GetgrgidR C.getgrgid_r -func GetgrgidR(_llcppg_param1 GidT, _llcppg_param2 *Group, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT, _llcppg_param5 **Group) c.Int - -// [XSI] -// -//go:linkname GetgrnamR C.getgrnam_r -func GetgrnamR(_llcppg_param1 *c.Char, _llcppg_param2 *Group, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT, _llcppg_param5 **Group) c.Int - -// [XSI] -// -//go:linkname Getgrent C.getgrent -func Getgrent() *Group - -//go:linkname Setgrent C.setgrent -func Setgrent() - -//go:linkname Endgrent C.endgrent -func Endgrent() - -//go:linkname GroupFromGid C.group_from_gid -func GroupFromGid(_llcppg_param1 GidT, _llcppg_param2 c.Int) *c.Char - -//go:linkname Getgruuid C.getgruuid -func Getgruuid(_llcppg_param1 UuidT) *Group - -//go:linkname GetgruuidR C.getgruuid_r -func GetgruuidR(_llcppg_param1 UuidT, _llcppg_param2 *Group, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT, _llcppg_param5 **Group) c.Int - -//go:linkname Setgroupent C.setgroupent -func Setgroupent(_llcppg_param1 c.Int) c.Int - -type IntegerT = c.Int - -type ExceptionBehaviorT = c.Int - -type ExceptionMaskT = c.Uint - -type CpuTypeT = IntegerT - -type CpuSubtypeT = IntegerT - -type ThreadStateFlavorT = c.Int - -//go:linkname SchedYield C.sched_yield -func SchedYield() c.Int - -//go:linkname SchedGetPriorityMin C.sched_get_priority_min -func SchedGetPriorityMin(_llcppg_param1 c.Int) c.Int - -//go:linkname SchedGetPriorityMax C.sched_get_priority_max -func SchedGetPriorityMax(_llcppg_param1 c.Int) c.Int - -type Passwd struct { - PwName *c.Char - PwPasswd *c.Char - PwUid UidT - PwGid GidT - PwChange X__DarwinTimeT - PwClass *c.Char - PwGecos *c.Char - PwDir *c.Char - PwShell *c.Char - PwExpire X__DarwinTimeT -} - -//go:linkname Getpwuid C.getpwuid -func Getpwuid(_llcppg_param1 UidT) *Passwd - -//go:linkname Getpwnam C.getpwnam -func Getpwnam(_llcppg_param1 *c.Char) *Passwd - -//go:linkname GetpwuidR C.getpwuid_r -func GetpwuidR(_llcppg_param1 UidT, _llcppg_param2 *Passwd, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT, _llcppg_param5 **Passwd) c.Int - -//go:linkname GetpwnamR C.getpwnam_r -func GetpwnamR(_llcppg_param1 *c.Char, _llcppg_param2 *Passwd, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT, _llcppg_param5 **Passwd) c.Int - -//go:linkname Getpwent C.getpwent -func Getpwent() *Passwd - -//go:linkname Setpwent C.setpwent -func Setpwent() - -//go:linkname Endpwent C.endpwent -func Endpwent() - -//go:linkname Setpassent C.setpassent -func Setpassent(_llcppg_param1 c.Int) c.Int - -//go:linkname UserFromUid C.user_from_uid -func UserFromUid(_llcppg_param1 UidT, _llcppg_param2 c.Int) *c.Char - -//go:linkname Getpwuuid C.getpwuuid -func Getpwuuid(_llcppg_param1 UuidT) *Passwd - -//go:linkname GetpwuuidR C.getpwuuid_r -func GetpwuuidR(_llcppg_param1 UuidT, _llcppg_param2 *Passwd, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT, _llcppg_param5 **Passwd) c.Int - -// flags for CPU Security Mitigation attribute -// POSIX_SPAWN_NP_CSM_ALL should be used in most cases, -// the individual flags are provided only for performance evaluation etc -const ( - POSIX_SPAWN_NP_CSM_ALL = 1 - POSIX_SPAWN_NP_CSM_NOSMT = 2 - POSIX_SPAWN_NP_CSM_TECS = 4 -) - -// Opaque types for use with posix_spawn() family functions. Internals are -// not defined, and should not be accessed directly. Types are defined as -// mandated by POSIX. -type PosixSpawnattrT uintptr - -type PosixSpawnFileActionsT uintptr - -//go:linkname PosixSpawn C.posix_spawn -func PosixSpawn(_llcppg_param1 *PidT, _llcppg_param2 *c.Char, _llcppg_param3 *PosixSpawnFileActionsT, _llcppg_param4 *PosixSpawnattrT, __argv **c.Char, __envp **c.Char) c.Int - -//go:linkname PosixSpawnp C.posix_spawnp -func PosixSpawnp(_llcppg_param1 *PidT, _llcppg_param2 *c.Char, _llcppg_param3 *PosixSpawnFileActionsT, _llcppg_param4 *PosixSpawnattrT, __argv **c.Char, __envp **c.Char) c.Int - -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddclose C.posix_spawn_file_actions_addclose -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddclose(_llcppg_param2 c.Int) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAdddup2 C.posix_spawn_file_actions_adddup2 -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAdddup2(_llcppg_param2 c.Int, _llcppg_param3 c.Int) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddopen C.posix_spawn_file_actions_addopen -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddopen(_llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 c.Int, _llcppg_param5 ModeT) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsDestroy C.posix_spawn_file_actions_destroy -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsDestroy() c.Int { - return 0 -} - -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsInit C.posix_spawn_file_actions_init -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsInit() c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrDestroy C.posix_spawnattr_destroy -func (self *PosixSpawnattrT) PosixSpawnattrDestroy() c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigdefault C.posix_spawnattr_getsigdefault -func (self *PosixSpawnattrT) PosixSpawnattrGetsigdefault(_llcppg_param2 *llsignal.SigsetT) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetflags C.posix_spawnattr_getflags -func (self *PosixSpawnattrT) PosixSpawnattrGetflags(_llcppg_param2 *int16) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetpgroup C.posix_spawnattr_getpgroup -func (self *PosixSpawnattrT) PosixSpawnattrGetpgroup(_llcppg_param2 *PidT) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigmask C.posix_spawnattr_getsigmask -func (self *PosixSpawnattrT) PosixSpawnattrGetsigmask(_llcppg_param2 *llsignal.SigsetT) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrInit C.posix_spawnattr_init -func (self *PosixSpawnattrT) PosixSpawnattrInit() c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigdefault C.posix_spawnattr_setsigdefault -func (self *PosixSpawnattrT) PosixSpawnattrSetsigdefault(_llcppg_param2 *llsignal.SigsetT) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetflags C.posix_spawnattr_setflags -func (self *PosixSpawnattrT) PosixSpawnattrSetflags(_llcppg_param2 int16) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetpgroup C.posix_spawnattr_setpgroup -func (self *PosixSpawnattrT) PosixSpawnattrSetpgroup(_llcppg_param2 PidT) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigmask C.posix_spawnattr_setsigmask -func (self *PosixSpawnattrT) PosixSpawnattrSetsigmask(_llcppg_param2 *llsignal.SigsetT) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetbinprefNp C.posix_spawnattr_getbinpref_np -func (self *PosixSpawnattrT) PosixSpawnattrGetbinprefNp(_llcppg_param2 c.SizeT, _llcppg_param3 *CpuTypeT, _llcppg_param4 *c.SizeT) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetarchprefNp C.posix_spawnattr_getarchpref_np -func (self *PosixSpawnattrT) PosixSpawnattrGetarchprefNp(_llcppg_param2 c.SizeT, _llcppg_param3 *CpuTypeT, _llcppg_param4 *CpuSubtypeT, _llcppg_param5 *c.SizeT) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetauditsessionportNp C.posix_spawnattr_setauditsessionport_np -func (self *PosixSpawnattrT) PosixSpawnattrSetauditsessionportNp(_llcppg_param2 MachPortT) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetbinprefNp C.posix_spawnattr_setbinpref_np -func (self *PosixSpawnattrT) PosixSpawnattrSetbinprefNp(_llcppg_param2 c.SizeT, _llcppg_param3 *CpuTypeT, _llcppg_param4 *c.SizeT) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetarchprefNp C.posix_spawnattr_setarchpref_np -func (self *PosixSpawnattrT) PosixSpawnattrSetarchprefNp(_llcppg_param2 c.SizeT, _llcppg_param3 *CpuTypeT, _llcppg_param4 *CpuSubtypeT, _llcppg_param5 *c.SizeT) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetexceptionportsNp C.posix_spawnattr_setexceptionports_np -func (self *PosixSpawnattrT) PosixSpawnattrSetexceptionportsNp(_llcppg_param2 ExceptionMaskT, _llcppg_param3 MachPortT, _llcppg_param4 ExceptionBehaviorT, _llcppg_param5 ThreadStateFlavorT) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetspecialportNp C.posix_spawnattr_setspecialport_np -func (self *PosixSpawnattrT) PosixSpawnattrSetspecialportNp(_llcppg_param2 MachPortT, _llcppg_param3 c.Int) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetnosmtNp C.posix_spawnattr_setnosmt_np -func (self *PosixSpawnattrT) PosixSpawnattrSetnosmtNp() c.Int { - return 0 -} - -// Set CPU Security Mitigation on the spawned process -// This attribute affects all threads and is inherited on fork and exec -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetCsmNp C.posix_spawnattr_set_csm_np -func (self *PosixSpawnattrT) PosixSpawnattrSetCsmNp(flags c.Uint32T) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddinheritNp C.posix_spawn_file_actions_addinherit_np -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddinheritNp(_llcppg_param2 c.Int) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddchdirNp C.posix_spawn_file_actions_addchdir_np -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddchdirNp(_llcppg_param2 *c.Char) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddfchdirNp C.posix_spawn_file_actions_addfchdir_np -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddfchdirNp(_llcppg_param2 c.Int) c.Int { - return 0 -} - -type X_filesec struct { -} - -type FilesecT = *X_filesec - -type FsblkcntT = X__DarwinFsblkcntT - -type FsfilcntT = X__DarwinFsfilcntT - -// can hold pid_t, gid_t, or uid_t -type IdT = X__DarwinIdT - -type UsecondsT = X__DarwinUsecondsT - -type UuidT = X__DarwinUuidT - -// Used by statvfs and fstatvfs -type X__DarwinFsblkcntT = c.Uint - -// Used by statvfs and fstatvfs -type X__DarwinFsfilcntT = c.Uint - -// [XSI] pid_t, uid_t, or gid_t -type X__DarwinIdT = c.Uint32T - -// [???] microseconds -type X__DarwinUsecondsT = c.Uint32T - -type X__DarwinUuidT = [16]uint8 - -// File types -const MAXNAMLEN = 255 - -// File types -const ( - DT_UNKNOWN = 0 - DT_FIFO = 1 - DT_CHR = 2 - DT_DIR = 4 - DT_BLK = 6 - DT_REG = 8 - DT_LNK = 10 - DT_SOCK = 12 - DT_WHT = 14 -) - -const ( - FREAD = 1 - FWRITE = 2 -) - -const ( - // no delay - // set append mode - O_APPEND = 8 -) - -const ( - // open with shared file lock - O_SHLOCK = 16 - // open with exclusive file lock - O_EXLOCK = 32 - // signal pgrp when data ready - O_ASYNC = 64 - // source compatibility: do not use - O_FSYNC = 128 - // don't follow symlinks - O_NOFOLLOW = 256 -) - -const ( - // create if nonexistant - // truncate to zero length - // error if already exists - O_EXCL = 2048 -) - -// descriptor requested for event notifications only -const O_EVTONLY = 32768 - -// don't assign controlling terminal -const O_NOCTTY = 131072 - -const O_DIRECTORY = 1048576 - -// allow open of a symlink -const O_SYMLINK = 2097152 - -// implicitly set FD_CLOEXEC -const O_CLOEXEC = 16777216 - -// no symlinks allowed in path -const O_NOFOLLOW_ANY = 536870912 - -const ( - // open file for execute only - O_EXEC = 1073741824 - // open directory for search only - O_SEARCH = 1074790400 -) - -// Descriptor value for the current working directory -const AT_FDCWD = -2 - -// Flags for the at functions -const ( - AT_EACCESS = 16 - // Act on the symlink itself not the target - AT_SYMLINK_NOFOLLOW = 32 - // Act on target of symlink - AT_SYMLINK_FOLLOW = 64 - // Path refers to directory - AT_REMOVEDIR = 128 -) - -const ( - // Return real device inodes resides on for fstatat(2) - AT_REALDEV = 512 - // Use only the fd and Ignore the path for fstatat(2) - AT_FDONLY = 1024 - // Path should not contain any symlinks - AT_SYMLINK_NOFOLLOW_ANY = 2048 -) - -// Data Protection Flags -const ( - O_DP_GETRAWENCRYPTED = 1 - O_DP_GETRAWUNENCRYPTED = 2 - O_DP_AUTHENTICATE = 4 -) - -// Descriptor value for openat_authenticated_np() to skip authentication with another fd -const AUTH_OPEN_NOAUTHFD = -1 - -const ( - // kernel/compat - FAPPEND = 8 - // kernel/compat - FASYNC = 64 - // kernel - FFSYNC = 128 - // kernel - FFDSYNC = 4194304 - // kernel - FNONBLOCK = 4 - // compat - FNDELAY = 4 - // compat - O_NDELAY = 4 -) - -const ( - CPF_OVERWRITE = 1 - CPF_IGNORE_MODE = 2 - CPF_MASK = 3 -) - -// command values -const ( - F_DUPFD = 0 - // get file descriptor flags - F_GETFD = 1 - // set file descriptor flags - F_SETFD = 2 - // get file status flags - // set file status flags - // get SIGIO/SIGURG proc/pgrp - F_GETOWN = 5 - // set SIGIO/SIGURG proc/pgrp - F_SETOWN = 6 - // get record locking information - F_GETLK = 7 - // set record locking information - F_SETLK = 8 - // F_SETLK; wait if blocked - F_SETLKW = 9 -) - -// F_SETLK; wait if blocked, return on timeout -const F_SETLKWTIMEOUT = 10 - -const ( - F_FLUSH_DATA = 40 - // Used for regression test - F_CHKCLEAN = 41 - // Preallocate storage - F_PREALLOCATE = 42 - // Truncate a file. Equivalent to calling truncate(2) - F_SETSIZE = 43 - // Issue an advisory read async with no copy to user - F_RDADVISE = 44 - // turn read ahead off/on for this fd - F_RDAHEAD = 45 -) - -// 46,47 used to be F_READBOOTSTRAP and F_WRITEBOOTSTRAP -const ( - F_NOCACHE = 48 - // file offset to device offset - F_LOG2PHYS = 49 - // return the full path of the fd - F_GETPATH = 50 - // fsync + ask the drive to flush to the media - F_FULLFSYNC = 51 - // find which component (if any) is a package - F_PATHPKG_CHECK = 52 - // "freeze" all fs operations - F_FREEZE_FS = 53 - // "thaw" all fs operations - F_THAW_FS = 54 - // turn data caching off/on (globally) for this file - F_GLOBAL_NOCACHE = 55 -) - -// add detached signatures -const F_ADDSIGS = 59 - -// add signature from same file (used by dyld for shared libs) -const F_ADDFILESIGS = 61 - -// used in conjunction with F_NOCACHE to indicate that DIRECT, synchonous writes -const F_NODIRECT = 62 - -const ( - // Get the protection class of a file from the EA, returns int - F_GETPROTECTIONCLASS = 63 - // Set the protection class of a file for the EA, requires int - F_SETPROTECTIONCLASS = 64 -) - -// file offset to device offset, extended -const F_LOG2PHYS_EXT = 65 - -// See man fcntl(2) F_GETLK -// Similar to F_GETLK but in addition l_pid is treated as an input parameter -// which is used as a matching value when searching locks on the file -// so that only locks owned by the process with pid l_pid are returned. -// However, any flock(2) type lock will also be found with the returned value -// of l_pid set to -1 (as with F_GETLK). -const F_GETLKPID = 66 - -const ( - // Mark the file as being the backing store for another filesystem - F_SETBACKINGSTORE = 70 - // return the full path of the FD, but error in specific mtmd circumstances - F_GETPATH_MTMINFO = 71 -) - -// Returns the code directory, with associated hashes, to the caller -const F_GETCODEDIR = 72 - -const ( - // No SIGPIPE generated on EPIPE - F_SETNOSIGPIPE = 73 - // Status of SIGPIPE for this fd - F_GETNOSIGPIPE = 74 -) - -// For some cases, we need to rewrap the key for AKS/MKB -const F_TRANSCODEKEY = 75 - -// file being written to a by single writer... if throttling enabled, writes -const F_SINGLE_WRITER = 76 - -// Get the protection version number for this filesystem -const F_GETPROTECTIONLEVEL = 77 - -// Add detached code signatures (used by dyld for shared libs) -const F_FINDSIGS = 78 - -// Add signature from same file, only if it is signed by Apple (used by dyld for simulator) -const F_ADDFILESIGS_FOR_DYLD_SIM = 83 - -// fsync + issue barrier to drive -const F_BARRIERFSYNC = 85 - -const ( - // Acquire or release open file description lock - F_OFD_SETLK = 90 - // (as F_OFD_SETLK but blocking if conflicting lock) - F_OFD_SETLKW = 91 - // Examine OFD lock - F_OFD_GETLK = 92 -) - -// (as F_OFD_SETLKW but return if timeout) -const F_OFD_SETLKWTIMEOUT = 93 - -const ( - // Add signature from same file, return end offset in structure on success - F_ADDFILESIGS_RETURN = 97 - // Check if Library Validation allows this Mach-O file to be mapped into the calling process - F_CHECK_LV = 98 -) - -// Deallocate a range of the file -const F_PUNCHHOLE = 99 - -// Trim an active file -const F_TRIM_ACTIVE_FILE = 100 - -// Asynchronous advisory read fcntl for regular and compressed file -const F_SPECULATIVE_READ = 101 - -// return the full path without firmlinks of the fd -const F_GETPATH_NOFIRMLINK = 102 - -const ( - // Add signature from same file, return information - F_ADDFILESIGS_INFO = 103 - // Add supplemental signature from same file with fd reference to original - F_ADDFILESUPPL = 104 - // Look up code signature information attached to a file or slice - F_GETSIGSINFO = 105 -) - -const ( - // Acquire or release lease - F_SETLEASE = 106 - // Retrieve lease information - F_GETLEASE = 107 -) - -// Transfer allocated extents beyond leof to a different file -const F_TRANSFEREXTENTS = 110 - -// Based on flags, query/set/delete a file's attribution tag -const F_ATTRIBUTION_TAG = 111 - -// FS-specific fcntl()'s numbers begin at 0x00010000 and go up -const FCNTL_FS_SPECIFIC_BASE = 65536 - -// mark the dup with FD_CLOEXEC -const F_DUPFD_CLOEXEC = 67 - -// file descriptor flags (F_GETFD, F_SETFD) -const FD_CLOEXEC = 1 - -// record locking flags (F_GETLK, F_SETLK, F_SETLKW) -const ( - F_RDLCK = 1 - // unlock - F_UNLCK = 2 - // exclusive or write lock - F_WRLCK = 3 -) - -const ( - // allocate contigious space - F_ALLOCATECONTIG = 2 - // allocate all requested space or no space at all - F_ALLOCATEALL = 4 - // do not free space upon close(2) - F_ALLOCATEPERSIST = 8 -) - -// Make it past all of the SEEK pos modes so that -const F_PEOFPOSMODE = 3 - -// we can keep them in sync should we desire -const F_VOLPOSMODE = 4 - -// detached code signatures data type - -// information passed by user to system used by F_ADDSIGS and F_ADDFILESIGS. -// F_ADDFILESIGS is a shortcut for files that contain their own signature and -// doesn't require mapping of the file in order to load the signature. -const USER_FSIGNATURES_CDHASH_LEN = 20 - -// At this time F_GETSIGSINFO can only indicate platformness. -// -// As additional requestable information is defined, new keys will be added and the -// fgetsigsinfo_t structure will be lengthened to add space for the additional information -const GETSIGSINFO_PLATFORM_BINARY = 1 - -// lock operations for flock(2) -const ( - LOCK_SH = 1 - // exclusive file lock - LOCK_EX = 2 - // don't block when locking - LOCK_NB = 4 - // unlock file - LOCK_UN = 8 -) - -// fattributiontag_t used by F_ATTRIBUTION_TAG -const ATTRIBUTION_NAME_MAX = 255 - -// ft_flags (F_ATTRIBUTION_TAG) -const ( - F_CREATE_TAG = 1 - F_DELETE_TAG = 2 - F_QUERY_TAG = 4 -) - -const ( - // force window to popup on open - O_POPUP = 2147483648 - // small, clean popup window - O_ALERT = 536870912 -) - -type FilesecPropertyT c.Uint - -const ( - FILESEC_OWNER FilesecPropertyT = 1 - FILESEC_GROUP FilesecPropertyT = 2 - FILESEC_UUID FilesecPropertyT = 3 - FILESEC_MODE FilesecPropertyT = 4 - FILESEC_ACL FilesecPropertyT = 5 - FILESEC_GRPUUID FilesecPropertyT = 6 - // XXX these are private to the implementation - FILESEC_ACL_RAW FilesecPropertyT = 100 - FILESEC_ACL_ALLOCSIZE FilesecPropertyT = 101 -) - -// data-protected non-portable open(2) : -// -// int open_dprotected_np(user_addr_t path, int flags, int class, int dpflags, int mode) -// -//go:linkname OpenxNp C.openx_np -func OpenxNp(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 FilesecT) c.Int - -// data-protected non-portable open(2) : -// -// int open_dprotected_np(user_addr_t path, int flags, int class, int dpflags, int mode) -// -//go:linkname OpenDprotectedNp C.open_dprotected_np -func OpenDprotectedNp(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 c.Int, __llgo_va_list ...any) c.Int - -//go:linkname OpenatDprotectedNp C.openat_dprotected_np -func OpenatDprotectedNp(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.Int, _llcppg_param4 c.Int, _llcppg_param5 c.Int, __llgo_va_list ...any) c.Int - -//go:linkname OpenatAuthenticatedNp C.openat_authenticated_np -func OpenatAuthenticatedNp(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.Int, _llcppg_param4 c.Int) c.Int - -//go:linkname Flock C.flock -func Flock(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int - -//go:linkname FilesecInit C.filesec_init -func FilesecInit() FilesecT - -// llgo:link FilesecT.FilesecDup C.filesec_dup -func (self FilesecT) FilesecDup() FilesecT { - return self -} - -// llgo:link FilesecT.FilesecFree C.filesec_free -func (self FilesecT) FilesecFree() { -} - -// llgo:link FilesecT.FilesecGetProperty C.filesec_get_property -func (self FilesecT) FilesecGetProperty(_llcppg_param2 FilesecPropertyT, _llcppg_param3 unsafe.Pointer) c.Int { - return 0 -} - -// llgo:link FilesecT.FilesecQueryProperty C.filesec_query_property -func (self FilesecT) FilesecQueryProperty(_llcppg_param2 FilesecPropertyT, _llcppg_param3 *c.Int) c.Int { - return 0 -} - -// llgo:link FilesecT.FilesecSetProperty C.filesec_set_property -func (self FilesecT) FilesecSetProperty(_llcppg_param2 FilesecPropertyT, _llcppg_param3 unsafe.Pointer) c.Int { - return 0 -} - -// llgo:link FilesecT.FilesecUnsetProperty C.filesec_unset_property -func (self FilesecT) FilesecUnsetProperty(_llcppg_param2 FilesecPropertyT) c.Int { - return 0 -} - -// Protections are chosen from these bits, or-ed together -const ( - PROT_NONE = 0 - // [MC2] pages can be read - PROT_READ = 1 - // [MC2] pages can be written - PROT_WRITE = 2 - // [MC2] pages can be executed - PROT_EXEC = 4 -) - -// Flags contain sharing type and options. -// Sharing types; choose one. -const ( - MAP_SHARED = 1 - // [MF|SHM] changes are private - MAP_PRIVATE = 2 -) - -// Obsolete -const MAP_COPY = 2 - -// Other flags -const MAP_FIXED = 16 - -const ( - // Sun: rename private pages to file - MAP_RENAME = 32 - // Sun: don't reserve needed swap area - MAP_NORESERVE = 64 - // previously unimplemented MAP_INHERIT - MAP_RESERVED0080 = 128 - // for MAP_FILE, don't change file size - MAP_NOEXTEND = 256 - // region may contain semaphores - MAP_HASSEMAPHORE = 512 - // don't cache pages for this mapping - MAP_NOCACHE = 1024 - // Allocate a region that will be used for JIT purposes - MAP_JIT = 2048 -) - -// Mapping type -const ( - MAP_FILE = 0 - // allocated from memory, swap space - MAP_ANON = 4096 - MAP_ANONYMOUS = 4096 -) - -// The MAP_RESILIENT_* flags can be used when the caller wants to map some -// possibly unreliable memory and be able to access it safely, possibly -// getting the wrong contents rather than raising any exception. -// For safety reasons, such mappings have to be read-only (PROT_READ access -// only). -// -// MAP_RESILIENT_CODESIGN: -// -// accessing this mapping will not generate code-signing violations, -// even if the contents are tainted. -// -// MAP_RESILIENT_MEDIA: -// -// accessing this mapping will not generate an exception if the contents -// are not available (unreachable removable or remote media, access beyond -// end-of-file, ...). Missing contents will be replaced with zeroes. -const ( - MAP_RESILIENT_CODESIGN = 8192 - // no backing-store failures - MAP_RESILIENT_MEDIA = 16384 -) - -// Return virtual addresses <4G only -const MAP_32BIT = 32768 - -// Flags used to support translated processes. -const MAP_TRANSLATED_ALLOW_EXECUTE = 131072 - -// UNIX03 compliance -const MAP_UNIX03 = 262144 - -// Allocate a region that will be protected by TPRO -const MAP_TPRO = 524288 - -// Process memory locking -const ( - MCL_CURRENT = 1 - // [ML] Lock all future memory as well - MCL_FUTURE = 2 -) - -// msync() flags -const ( - MS_ASYNC = 1 - // [MF|SIO] invalidate all cached data - MS_INVALIDATE = 2 - // [MF|SIO] msync synchronously - MS_SYNC = 16 -) - -const ( - // invalidate pages, leave mapped - MS_KILLPAGES = 4 - // deactivate pages, leave mapped - MS_DEACTIVATE = 8 -) - -// Advice to madvise -const ( - POSIX_MADV_NORMAL = 0 - // [MC1] expect random page refs - POSIX_MADV_RANDOM = 1 - // [MC1] expect sequential page refs - POSIX_MADV_SEQUENTIAL = 2 - // [MC1] will need these pages - POSIX_MADV_WILLNEED = 3 - // [MC1] dont need these pages - POSIX_MADV_DONTNEED = 4 -) - -const ( - MADV_NORMAL = 0 - MADV_RANDOM = 1 - MADV_SEQUENTIAL = 2 - MADV_WILLNEED = 3 - MADV_DONTNEED = 4 - // pages unneeded, discard contents - MADV_FREE = 5 - // zero the wired pages that have not been unwired before the entry is deleted - MADV_ZERO_WIRED_PAGES = 6 - // pages can be reused (by anyone) - MADV_FREE_REUSABLE = 7 - // caller wants to reuse those pages - MADV_FREE_REUSE = 8 - MADV_CAN_REUSE = 9 - // page out now (internal only) - MADV_PAGEOUT = 10 -) - -// Return bits from mincore -const ( - MINCORE_INCORE = 1 - // Page has been referenced by us - MINCORE_REFERENCED = 2 - // Page has been modified by us - MINCORE_MODIFIED = 4 - // Page has been referenced - MINCORE_REFERENCED_OTHER = 8 - // Page has been modified - MINCORE_MODIFIED_OTHER = 16 - // Page has been paged out - MINCORE_PAGED_OUT = 32 - // Page has been copied - MINCORE_COPIED = 64 - // Page belongs to an anonymous object - MINCORE_ANONYMOUS = 128 -) - -// [ML] -// -//go:linkname Mlockall C.mlockall -func Mlockall(_llcppg_param1 c.Int) c.Int - -// [MR] -// -//go:linkname Munlockall C.munlockall -func Munlockall() c.Int - -// [MR] -// -//go:linkname Mlock C.mlock -func Mlock(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT) c.Int - -// [MC3] -// -//go:linkname Mmap C.mmap -func Mmap(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 c.Int, _llcppg_param4 c.Int, _llcppg_param5 c.Int, _llcppg_param6 OffT) unsafe.Pointer - -// [MPR] -// -//go:linkname Mprotect C.mprotect -func Mprotect(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 c.Int) c.Int - -// [MF|SIO] -// -//go:linkname Msync C.msync -func Msync(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 c.Int) c.Int - -// [MR] -// -//go:linkname Munlock C.munlock -func Munlock(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT) c.Int - -// [MC3] -// -//go:linkname Munmap C.munmap -func Munmap(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT) c.Int - -// [SHM] -// -//go:linkname ShmOpen C.shm_open -func ShmOpen(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, __llgo_va_list ...any) c.Int - -// [ADV] -// -//go:linkname ShmUnlink C.shm_unlink -func ShmUnlink(_llcppg_param1 *c.Char) c.Int - -// [ADV] -// -//go:linkname PosixMadvise C.posix_madvise -func PosixMadvise(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 c.Int) c.Int - -//go:linkname Madvise C.madvise -func Madvise(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 c.Int) c.Int - -//go:linkname Mincore C.mincore -func Mincore(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 *c.Char) c.Int - -//go:linkname Minherit C.minherit -func Minherit(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 c.Int) c.Int - -// Possible values of the first parameter to getpriority()/setpriority(), -// used to indicate the type of the second parameter. -const ( - PRIO_PROCESS = 0 - // Second argument is a GID - PRIO_PGRP = 1 - // Second argument is a UID - PRIO_USER = 2 -) - -const ( - // Second argument is always 0 (current thread) - PRIO_DARWIN_THREAD = 3 - // Second argument is a PID - PRIO_DARWIN_PROCESS = 4 -) - -// Range limitations for the value of the third parameter to setpriority(). -const ( - PRIO_MIN = -20 - PRIO_MAX = 20 -) - -// use PRIO_DARWIN_BG to set the current thread into "background" state -// which lowers CPU, disk IO, and networking priorites until thread terminates -// or "background" state is revoked -const PRIO_DARWIN_BG = 4096 - -// use PRIO_DARWIN_NONUI to restrict a process's ability to make calls to -// the GPU. (deprecated) -const PRIO_DARWIN_NONUI = 4097 - -// Possible values of the first parameter to getrusage(), used to indicate -// the scope of the information to be returned. -const ( - RUSAGE_SELF = 0 - // Current process' children - RUSAGE_CHILDREN = -1 -) - -// Flavors for proc_pid_rusage(). -const ( - RUSAGE_INFO_V0 = 0 - RUSAGE_INFO_V1 = 1 - RUSAGE_INFO_V2 = 2 - RUSAGE_INFO_V3 = 3 - RUSAGE_INFO_V4 = 4 - RUSAGE_INFO_V5 = 5 - RUSAGE_INFO_V6 = 6 - RUSAGE_INFO_CURRENT = 6 -) - -// Flags for RUSAGE_INFO_V5 -const RU_PROC_RUNS_RESLIDE = 1 - -// Possible values of the first parameter to getrlimit()/setrlimit(), to -// indicate for which resource the operation is being performed. -const ( - RLIMIT_CPU = 0 - // file size - RLIMIT_FSIZE = 1 - // data segment size - RLIMIT_DATA = 2 - // stack size - RLIMIT_STACK = 3 - // core file size - RLIMIT_CORE = 4 - // address space (resident set size) - RLIMIT_AS = 5 -) - -const ( - // source compatibility alias - RLIMIT_RSS = 5 - // locked-in-memory address space - RLIMIT_MEMLOCK = 6 - // number of processes - RLIMIT_NPROC = 7 -) - -// number of open files -const RLIMIT_NOFILE = 8 - -// total number of resource limits -const RLIM_NLIMITS = 9 - -// proc_rlimit_control() -// -// Resource limit flavors -const ( - RLIMIT_WAKEUPS_MONITOR = 1 - // Configure the CPU usage monitor. - RLIMIT_CPU_USAGE_MONITOR = 2 - // Configure a blocking, per-thread, CPU limits. - RLIMIT_THREAD_CPULIMITS = 3 - // Configure memory footprint interval tracking - RLIMIT_FOOTPRINT_INTERVAL = 4 -) - -// Flags for wakeups monitor control. -const ( - WAKEMON_ENABLE = 1 - WAKEMON_DISABLE = 2 - WAKEMON_GET_PARAMS = 4 - WAKEMON_SET_DEFAULTS = 8 - // Configure the task so that violations are fatal. - WAKEMON_MAKE_FATAL = 16 -) - -// Flags for CPU usage monitor control. -const CPUMON_MAKE_FATAL = 4096 - -// Flags for memory footprint interval tracking. -const FOOTPRINT_INTERVAL_RESET = 1 - -// I/O type -const ( - IOPOL_TYPE_DISK = 0 - IOPOL_TYPE_VFS_ATIME_UPDATES = 2 - IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES = 3 - IOPOL_TYPE_VFS_STATFS_NO_DATA_VOLUME = 4 - IOPOL_TYPE_VFS_TRIGGER_RESOLVE = 5 - IOPOL_TYPE_VFS_IGNORE_CONTENT_PROTECTION = 6 - IOPOL_TYPE_VFS_IGNORE_PERMISSIONS = 7 - IOPOL_TYPE_VFS_SKIP_MTIME_UPDATE = 8 - IOPOL_TYPE_VFS_ALLOW_LOW_SPACE_WRITES = 9 - IOPOL_TYPE_VFS_DISALLOW_RW_FOR_O_EVTONLY = 10 -) - -// scope -const ( - IOPOL_SCOPE_PROCESS = 0 - IOPOL_SCOPE_THREAD = 1 - IOPOL_SCOPE_DARWIN_BG = 2 -) - -// I/O Priority -const ( - IOPOL_DEFAULT = 0 - IOPOL_IMPORTANT = 1 - IOPOL_PASSIVE = 2 - IOPOL_THROTTLE = 3 - IOPOL_UTILITY = 4 - IOPOL_STANDARD = 5 -) - -// compatibility with older names -const ( - IOPOL_APPLICATION = 5 - IOPOL_NORMAL = 1 -) - -const ( - IOPOL_ATIME_UPDATES_DEFAULT = 0 - IOPOL_ATIME_UPDATES_OFF = 1 -) - -const ( - IOPOL_MATERIALIZE_DATALESS_FILES_DEFAULT = 0 - IOPOL_MATERIALIZE_DATALESS_FILES_OFF = 1 - IOPOL_MATERIALIZE_DATALESS_FILES_ON = 2 -) - -const ( - IOPOL_VFS_STATFS_NO_DATA_VOLUME_DEFAULT = 0 - IOPOL_VFS_STATFS_FORCE_NO_DATA_VOLUME = 1 -) - -const ( - IOPOL_VFS_TRIGGER_RESOLVE_DEFAULT = 0 - IOPOL_VFS_TRIGGER_RESOLVE_OFF = 1 -) - -const ( - IOPOL_VFS_CONTENT_PROTECTION_DEFAULT = 0 - IOPOL_VFS_CONTENT_PROTECTION_IGNORE = 1 -) - -const ( - IOPOL_VFS_IGNORE_PERMISSIONS_OFF = 0 - IOPOL_VFS_IGNORE_PERMISSIONS_ON = 1 -) - -const ( - IOPOL_VFS_SKIP_MTIME_UPDATE_OFF = 0 - IOPOL_VFS_SKIP_MTIME_UPDATE_ON = 1 -) - -const ( - IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_OFF = 0 - IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_ON = 1 -) - -const ( - IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_DEFAULT = 0 - IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_ON = 1 -) - -const ( - IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_DEFAULT = 0 - IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_ON = 1 -) - -// A structure representing an accounting of resource utilization. The -// address of an instance of this structure is the second parameter to -// getrusage(). -// -// Note: All values other than ru_utime and ru_stime are implementaiton -// -// defined and subject to change in a future release. Their use -// is discouraged for standards compliant programs. -type Rusage struct { - RuUtime llsys.Timeval - RuStime llsys.Timeval - RuMaxrss c.Long - RuIxrss c.Long - RuIdrss c.Long - RuIsrss c.Long - RuMinflt c.Long - RuMajflt c.Long - RuNswap c.Long - RuInblock c.Long - RuOublock c.Long - RuMsgsnd c.Long - RuMsgrcv c.Long - RuNsignals c.Long - RuNvcsw c.Long - RuNivcsw c.Long -} - -//go:linkname Getpriority C.getpriority -func Getpriority(_llcppg_param1 c.Int, _llcppg_param2 IdT) c.Int - -//go:linkname GetiopolicyNp C.getiopolicy_np -func GetiopolicyNp(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int - -//go:linkname Getrusage C.getrusage -func Getrusage(_llcppg_param1 c.Int, _llcppg_param2 *Rusage) c.Int - -//go:linkname Setpriority C.setpriority -func Setpriority(_llcppg_param1 c.Int, _llcppg_param2 IdT, _llcppg_param3 c.Int) c.Int - -//go:linkname SetiopolicyNp C.setiopolicy_np -func SetiopolicyNp(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int) c.Int - -//go:linkname Pselect C.pselect -func Pselect(_llcppg_param1 c.Int, _llcppg_param2 *llsys.FdSet, _llcppg_param3 *llsys.FdSet, _llcppg_param4 *llsys.FdSet, _llcppg_param5 *lltime.Timespec, _llcppg_param6 *llsignal.SigsetT) c.Int - -type Sigval struct { - _xgo_union [1]uint64 -} - -type X__Siginfo struct { - SiSigno c.Int - SiErrno c.Int - SiCode c.Int - SiPid PidT - SiUid UidT - SiStatus c.Int - SiAddr unsafe.Pointer - SiValue Sigval - SiBand c.Long - X__Pad [7]c.Ulong -} - -type SiginfoT = X__Siginfo - -func (p *Sigval) XGof_ref_sival_int() *c.Int { - return (*c.Int)(unsafe.Pointer(p)) -} - -func (p *Sigval) XGof_ref_sival_ptr() *unsafe.Pointer { - return (*unsafe.Pointer)(unsafe.Pointer(p)) -} - -// 0777 -const ACCESSPERMS = 511 - -// 7777 -const ALLPERMS = 4095 - -// 0666 -const DEFFILEMODE = 438 - -// block size used in the stat struct -const S_BLKSIZE = 512 - -// Definitions of flags stored in file flags word. -// -// Super-user and owner changeable flags. -const ( - UF_SETTABLE = 65535 - // do not dump file - UF_NODUMP = 1 - // file may not be changed - UF_IMMUTABLE = 2 - // writes to file may only append - UF_APPEND = 4 - // directory is opaque wrt. union - UF_OPAQUE = 8 -) - -// file is compressed (some file-systems) -const UF_COMPRESSED = 32 - -// UF_TRACKED is used for dealing with document IDs. We no longer issue -// -// notifications for deletes or renames for files which have UF_TRACKED set. -const UF_TRACKED = 64 - -// entitlement required for reading -const UF_DATAVAULT = 128 - -// Bits 0x0100 through 0x4000 are currently undefined. -const UF_HIDDEN = 32768 - -// Super-user changeable flags. -const ( - SF_SUPPORTED = 10420224 - // mask of superuser changeable flags - SF_SETTABLE = 1073676288 - // mask of system read-only synthetic flags - SF_SYNTHETIC = 3221225472 - // file is archived - SF_ARCHIVED = 65536 - // file may not be changed - SF_IMMUTABLE = 131072 - // writes to file may only append - SF_APPEND = 262144 - // entitlement required for writing - SF_RESTRICTED = 524288 - // Item may not be removed, renamed or mounted on - SF_NOUNLINK = 1048576 -) - -// file is a firmlink -const SF_FIRMLINK = 8388608 - -// Synthetic flags. -// -// These are read-only. We keep them out of SF_SUPPORTED so that -// attempts to set them will fail. -const SF_DATALESS = 1073741824 - -// Extended flags ("EF") returned by ATTR_CMNEXT_EXT_FLAGS from getattrlist/getattrlistbulk -const ( - EF_MAY_SHARE_BLOCKS = 1 - // file has no xattrs at all - EF_NO_XATTRS = 2 - // file is a sync root for iCloud - EF_IS_SYNC_ROOT = 4 - // file is purgeable - EF_IS_PURGEABLE = 8 - // file has at least one sparse region - EF_IS_SPARSE = 16 - // a synthetic directory/symlink - EF_IS_SYNTHETIC = 32 - // file shares all of its blocks with another file - EF_SHARES_ALL_BLOCKS = 64 -) - -const ( - UTIME_NOW = -1 - UTIME_OMIT = -2 -) - -//go:linkname Mkdirat C.mkdirat -func Mkdirat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 ModeT) c.Int - -//go:linkname Mkfifoat C.mkfifoat -func Mkfifoat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 ModeT) c.Int - -//go:linkname Mknodat C.mknodat -func Mknodat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 ModeT, _llcppg_param4 DevT) c.Int - -//go:linkname Futimens C.futimens -func Futimens(__fd c.Int, __times *lltime.Timespec) c.Int - -//go:linkname Utimensat C.utimensat -func Utimensat(__fd c.Int, __path *c.Char, __times *lltime.Timespec, __flag c.Int) c.Int - -//go:linkname Chflags C.chflags -func Chflags(_llcppg_param1 *c.Char, _llcppg_param2 c.Uint32T) c.Int - -//go:linkname ChmodxNp C.chmodx_np -func ChmodxNp(_llcppg_param1 *c.Char, _llcppg_param2 FilesecT) c.Int - -//go:linkname Fchflags C.fchflags -func Fchflags(_llcppg_param1 c.Int, _llcppg_param2 c.Uint32T) c.Int - -//go:linkname FchmodxNp C.fchmodx_np -func FchmodxNp(_llcppg_param1 c.Int, _llcppg_param2 FilesecT) c.Int - -//go:linkname FstatxNp C.fstatx_np -func FstatxNp(_llcppg_param1 c.Int, _llcppg_param2 *StatT, _llcppg_param3 FilesecT) c.Int - -//go:linkname Lchflags C.lchflags -func Lchflags(_llcppg_param1 *c.Char, _llcppg_param2 c.Uint32T) c.Int - -//go:linkname Lchmod C.lchmod -func Lchmod(_llcppg_param1 *c.Char, _llcppg_param2 ModeT) c.Int - -//go:linkname LstatxNp C.lstatx_np -func LstatxNp(_llcppg_param1 *c.Char, _llcppg_param2 *StatT, _llcppg_param3 FilesecT) c.Int - -//go:linkname MkdirxNp C.mkdirx_np -func MkdirxNp(_llcppg_param1 *c.Char, _llcppg_param2 FilesecT) c.Int - -//go:linkname MkfifoxNp C.mkfifox_np -func MkfifoxNp(_llcppg_param1 *c.Char, _llcppg_param2 FilesecT) c.Int - -//go:linkname StatxNp C.statx_np -func StatxNp(_llcppg_param1 *c.Char, _llcppg_param2 *StatT, _llcppg_param3 FilesecT) c.Int - -// llgo:link FilesecT.UmaskxNp C.umaskx_np -func (self FilesecT) UmaskxNp() c.Int { - return 0 -} - -// Defined bits for f_flag field value -const ( - ST_RDONLY = 1 - // Does not honor setuid/setgid - ST_NOSUID = 2 -) - -// Following structure is used as a statvfs/fstatvfs function parameter -type Statvfs struct { - FBsize c.Ulong - FFrsize c.Ulong - FBlocks FsblkcntT - FBfree FsblkcntT - FBavail FsblkcntT - FFiles FsfilcntT - FFfree FsfilcntT - FFavail FsfilcntT - FFsid c.Ulong - FFlag c.Ulong - FNamemax c.Ulong -} - -//go:linkname Fstatvfs C.fstatvfs -func Fstatvfs(_llcppg_param1 c.Int, _llcppg_param2 *Statvfs) c.Int - -// Special Control Characters -// -// Index into c_cc[] character array. -// -// Name Subscript Enabled by -const ( - VEOF = 0 - // ICANON - VEOL = 1 -) - -// ICANON together with IEXTEN -const VEOL2 = 2 - -// ICANON -const VERASE = 3 - -// ICANON together with IEXTEN -const VWERASE = 4 - -// ICANON -const VKILL = 5 - -// ICANON together with IEXTEN -const VREPRINT = 6 - -// 7 spare 1 -const ( - VINTR = 8 - // ISIG - VQUIT = 9 - // ISIG - VSUSP = 10 -) - -// ISIG together with IEXTEN -const VDSUSP = 11 - -const ( - // IXON, IXOFF - VSTART = 12 - // IXON, IXOFF - VSTOP = 13 -) - -const ( - // IEXTEN - VLNEXT = 14 - // IEXTEN - VDISCARD = 15 -) - -const ( - // !ICANON - VMIN = 16 - // !ICANON - VTIME = 17 -) - -// ICANON together with IEXTEN -const VSTATUS = 18 - -const NCCS = 20 - -// Input flags - software input processing -const ( - IGNBRK = 1 - // map BREAK to SIGINTR - BRKINT = 2 - // ignore (discard) parity errors - IGNPAR = 4 - // mark parity and framing errors - PARMRK = 8 - // enable checking of parity errors - INPCK = 16 - // strip 8th bit off chars - ISTRIP = 32 - // map NL into CR - INLCR = 64 - // ignore CR - IGNCR = 128 - // map CR to NL (ala CRMOD) - ICRNL = 256 - // enable output flow control - IXON = 512 - // enable input flow control - IXOFF = 1024 - // any char will restart after stop - IXANY = 2048 -) - -const ( - // ring bell on input queue full - IMAXBEL = 8192 - // maintain state for UTF-8 VERASE - IUTF8 = 16384 -) - -// Output flags - software output processing -const ( - OPOST = 1 - // map NL to CR-NL (ala CRMOD) - ONLCR = 2 -) - -const ( - // expand tabs to spaces - OXTABS = 4 - // discard EOT's (^D) on output) - ONOEOT = 8 -) - -// The following block of features is unimplemented. Use of these flags in -// programs will currently result in unexpected behaviour. -// -// - Begin unimplemented features -const ( - OCRNL = 16 - // no CR output at column 0 - ONOCR = 32 - // NL performs CR function - ONLRET = 64 - // use fill characters for delay - OFILL = 128 - // \n delay - NLDLY = 768 - // horizontal tab delay - TABDLY = 3076 - // \r delay - CRDLY = 12288 - // form feed delay - FFDLY = 16384 - // \b delay - BSDLY = 32768 - // vertical tab delay - VTDLY = 65536 - // fill is DEL, else NUL - OFDEL = 131072 -) - -// These manifest constants have the same names as those in the header -// , so you are not permitted to have both definitions -// in scope simultaneously in the same compilation unit. Nevertheless, -// they are required to be in scope when _POSIX_C_SOURCE is requested; -// this means that including the header before this -// one when _POSIX_C_SOURCE is in scope will result in redefintions. We -// attempt to maintain these as the same values so as to avoid this being -// an outright error in most compilers. -const ( - NL0 = 0 - NL1 = 256 -) - -const ( - NL2 = 512 - NL3 = 768 -) - -// not in sys/ioctl_compat.h, use OXTABS value -const ( - TAB0 = 0 - TAB1 = 1024 - TAB2 = 2048 -) - -// not in sys/ioctl_compat.h, use OXTABS value -const ( - TAB3 = 4 - CR0 = 0 - CR1 = 4096 - CR2 = 8192 - CR3 = 12288 - FF0 = 0 - FF1 = 16384 - BS0 = 0 - BS1 = 32768 - VT0 = 0 - VT1 = 65536 -) - -// ignore control flags -const CIGNORE = 1 - -const ( - // character size mask - CSIZE = 768 - // 5 bits (pseudo) - CS5 = 0 - // 6 bits - CS6 = 256 - // 7 bits - CS7 = 512 - // 8 bits - CS8 = 768 - // send 2 stop bits - CSTOPB = 1024 - // enable receiver - CREAD = 2048 - // parity enable - PARENB = 4096 - // odd parity, else even - PARODD = 8192 - // hang up on last close - HUPCL = 16384 - // ignore modem status lines - CLOCAL = 32768 -) - -const ( - // CTS flow control of output - CCTS_OFLOW = 65536 - // RTS flow control of input - CRTS_IFLOW = 131072 - // DTR flow control of input - CDTR_IFLOW = 262144 - // DSR flow control of output - CDSR_OFLOW = 524288 - // DCD flow control of output - CCAR_OFLOW = 1048576 - // old name for CCAR_OFLOW - MDMBUF = 1048576 -) - -// visual erase for line kill -const ECHOKE = 1 - -const ( - // visually erase chars - ECHOE = 2 - // echo NL after line kill - ECHOK = 4 - // enable echoing - ECHO = 8 - // echo NL even if ECHO is off - ECHONL = 16 -) - -const ( - // visual erase mode for hardcopy - ECHOPRT = 32 - // echo control chars as ^(Char) - ECHOCTL = 64 -) - -const ( - // enable signals INTR, QUIT, [D]SUSP - ISIG = 128 - // canonicalize input lines - ICANON = 256 -) - -// use alternate WERASE algorithm -const ALTWERASE = 512 - -// enable DISCARD and LNEXT -const IEXTEN = 1024 - -// external processing -const EXTPROC = 2048 - -// stop background jobs from output -const TOSTOP = 4194304 - -const ( - // output being flushed (state) - FLUSHO = 8388608 - // no kernel output from VSTATUS - NOKERNINFO = 33554432 - // XXX retype pending input (state) - PENDIN = 536870912 -) - -// don't flush after interrupt -const NOFLSH = 2147483648 - -// Commands passed to tcsetattr() for setting the termios structure. -const ( - TCSANOW = 0 - // drain output, then change - TCSADRAIN = 1 - // drain output, flush input - TCSAFLUSH = 2 -) - -// flag - don't alter h.w. state -const TCSASOFT = 16 - -// Standard speeds -const ( - B0 = 0 - B50 = 50 - B75 = 75 - B110 = 110 - B134 = 134 - B150 = 150 - B200 = 200 - B300 = 300 - B600 = 600 - B1200 = 1200 - B1800 = 1800 - B2400 = 2400 - B4800 = 4800 - B9600 = 9600 - B19200 = 19200 - B38400 = 38400 -) - -const ( - B7200 = 7200 - B14400 = 14400 - B28800 = 28800 - B57600 = 57600 - B76800 = 76800 - B115200 = 115200 - B230400 = 230400 - EXTA = 19200 - EXTB = 38400 -) - -const ( - TCIFLUSH = 1 - TCOFLUSH = 2 - TCIOFLUSH = 3 - TCOOFF = 1 - TCOON = 2 - TCIOFF = 3 - TCION = 4 -) - -// llgo:link (*Termios).Cfgetispeed C.cfgetispeed -func (self *Termios) Cfgetispeed() SpeedT { - return 0 -} - -// llgo:link (*Termios).Cfgetospeed C.cfgetospeed -func (self *Termios) Cfgetospeed() SpeedT { - return 0 -} - -// llgo:link (*Termios).Cfsetispeed C.cfsetispeed -func (self *Termios) Cfsetispeed(_llcppg_param2 SpeedT) c.Int { - return 0 -} - -// llgo:link (*Termios).Cfsetospeed C.cfsetospeed -func (self *Termios) Cfsetospeed(_llcppg_param2 SpeedT) c.Int { - return 0 -} - -//go:linkname Tcgetattr C.tcgetattr -func Tcgetattr(_llcppg_param1 c.Int, _llcppg_param2 *Termios) c.Int - -//go:linkname Tcsetattr C.tcsetattr -func Tcsetattr(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 *Termios) c.Int - -//go:linkname Tcdrain C.tcdrain -func Tcdrain(_llcppg_param1 c.Int) c.Int - -//go:linkname Tcflow C.tcflow -func Tcflow(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int - -//go:linkname Tcflush C.tcflush -func Tcflush(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int - -//go:linkname Tcsendbreak C.tcsendbreak -func Tcsendbreak(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int - -// llgo:link (*Termios).Cfmakeraw C.cfmakeraw -func (self *Termios) Cfmakeraw() { -} - -// llgo:link (*Termios).Cfsetspeed C.cfsetspeed -func (self *Termios) Cfsetspeed(_llcppg_param2 SpeedT) c.Int { - return 0 -} - -// [XSI] Structure whose address is passed as the first parameter to times() -type Tms struct { - TmsUtime lltime.ClockT - TmsStime lltime.ClockT - TmsCutime lltime.ClockT - TmsCstime lltime.ClockT -} - -// llgo:link (*Tms).Times C.times -func (self *Tms) Times() lltime.ClockT { - return 0 -} - -const NBBY = 8 - -// IO direction for uio_t. -// -// UIO_READ - data moves into iovec(s) associated with uio_t -// UIO_WRITE - data moves out of iovec(s) associated with uio_t -type UioRw c.Uint - -const ( - // IO direction for uio_t. - // UIO_READ - data moves into iovec(s) associated with uio_t - // UIO_WRITE - data moves out of iovec(s) associated with uio_t - UIO_READ UioRw = 0 - // IO direction for uio_t. - // UIO_READ - data moves into iovec(s) associated with uio_t - // UIO_WRITE - data moves out of iovec(s) associated with uio_t - UIO_WRITE UioRw = 1 -) - -//go:linkname Readv C.readv -func Readv(_llcppg_param1 c.Int, _llcppg_param2 *c.Iovec, _llcppg_param3 c.Int) c.SsizeT - -//go:linkname Writev C.writev -func Writev(_llcppg_param1 c.Int, _llcppg_param2 *c.Iovec, _llcppg_param3 c.Int) c.SsizeT - -//go:linkname Preadv C.preadv -func Preadv(_llcppg_param1 c.Int, _llcppg_param2 *c.Iovec, _llcppg_param3 c.Int, _llcppg_param4 OffT) c.SsizeT - -//go:linkname Pwritev C.pwritev -func Pwritev(_llcppg_param1 c.Int, _llcppg_param2 *c.Iovec, _llcppg_param3 c.Int, _llcppg_param4 OffT) c.SsizeT - -type AccessxDescriptor struct { - AdNameOffset c.Uint - AdFlags c.Int - AdPad [2]c.Int -} - -type Utsname struct { - Sysname [256]c.Char - Nodename [256]c.Char - Release [256]c.Char - Version [256]c.Char - Machine [256]c.Char -} - -// llgo:link (*Utsname).Uname C.uname -func (self *Utsname) Uname() c.Int { - return 0 -} - -// Option bits for the third argument of wait4. WNOHANG causes the -// wait to not hang if there are no stopped or terminated processes, rather -// returning an error indication in this case (pid==0). WUNTRACED -// indicates that the caller should receive status about untraced children -// which stop due to signals. If children are stopped and a wait without -// this option is done, it is as though they were still running... nothing -// about them is returned. -const ( - WNOHANG = 1 - // [XSI] notify on stop, untraced child - WUNTRACED = 2 -) - -const WCOREFLAG = 128 - -// WUNTRACED defined for wait4() but not for waitid() -const WEXITED = 4 - -// waitid() parameter -const WSTOPPED = 8 - -const ( - // [XSI] Any child stopped then continued - WCONTINUED = 16 - // [XSI] Leave process returned waitable - WNOWAIT = 32 -) - -// Tokens for special values of the "pid" parameter to wait4. -const ( - WAIT_ANY = -1 - // any process in my process group - WAIT_MYPGRP = 0 -) - -// [XSI] The type idtype_t shall be defined as an enumeration type whose -// possible values shall include at least P_ALL, P_PID, and P_PGID. -type IdtypeT c.Uint - -const ( - P_ALL IdtypeT = 0 - P_PID IdtypeT = 1 - P_PGID IdtypeT = 2 -) - -// llgo:link IdtypeT.Waitid C.waitid -func (self IdtypeT) Waitid(_llcppg_param2 IdT, _llcppg_param3 *SiginfoT, _llcppg_param4 c.Int) c.Int { - return 0 -} - -//go:linkname Tcgetsid C.tcgetsid -func Tcgetsid(_llcppg_param1 c.Int) PidT - -const ( - // standard input file descriptor - STDIN_FILENO = 0 - // standard output file descriptor - STDOUT_FILENO = 1 - // standard error file descriptor - STDERR_FILENO = 2 -) - -// These F_* are really XSI or Issue 6 -const ( - F_ULOCK = 0 - // lock a section for exclusive use - F_LOCK = 1 - // test and lock a section for exclusive use - F_TLOCK = 2 - // test a section for locks by other procs - F_TEST = 3 -) - -const ( - // Flush data and metadata to platter, not just to disk cache - SYNC_VOLUME_FULLSYNC = 1 - // Wait for sync to complete - SYNC_VOLUME_WAIT = 2 -) - -type Fssearchblock struct { -} - -type Searchstate struct { -} - -//go:linkname X_exit C._exit -func X_exit(_llcppg_param1 c.Int) - -//go:linkname Access C.access -func Access(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int - -//go:linkname Alarm C.alarm -func Alarm(_llcppg_param1 c.Uint) c.Uint - -//go:linkname Fpathconf C.fpathconf -func Fpathconf(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Long - -//go:linkname Getgroups C.getgroups -func Getgroups(_llcppg_param1 c.Int, _llcppg_param2 *GidT) c.Int - -//go:linkname Getlogin C.getlogin -func Getlogin() *c.Char - -//go:linkname Getpgrp C.getpgrp -func Getpgrp() PidT - -//go:linkname Pathconf C.pathconf -func Pathconf(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Long - -//go:linkname Pause C.pause -func Pause() c.Int - -//go:linkname Setgid C.setgid -func Setgid(_llcppg_param1 GidT) c.Int - -//go:linkname Setpgid C.setpgid -func Setpgid(_llcppg_param1 PidT, _llcppg_param2 PidT) c.Int - -//go:linkname Setsid C.setsid -func Setsid() PidT - -//go:linkname Setuid C.setuid -func Setuid(_llcppg_param1 UidT) c.Int - -//go:linkname Sleep C.sleep -func Sleep(_llcppg_param1 c.Uint) c.Uint - -//go:linkname Sysconf C.sysconf -func Sysconf(_llcppg_param1 c.Int) c.Long - -//go:linkname Tcgetpgrp C.tcgetpgrp -func Tcgetpgrp(_llcppg_param1 c.Int) PidT - -//go:linkname Tcsetpgrp C.tcsetpgrp -func Tcsetpgrp(_llcppg_param1 c.Int, _llcppg_param2 PidT) c.Int - -//go:linkname Ttyname C.ttyname -func Ttyname(_llcppg_param1 c.Int) *c.Char - -//go:linkname TtynameR C.ttyname_r -func TtynameR(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.SizeT) c.Int - -//go:linkname Confstr C.confstr -func Confstr(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.SizeT) c.SizeT - -//go:linkname Getopt C.getopt -func Getopt(_llcppg_param1 c.Int, _llcppg_param2 **c.Char, _llcppg_param3 *c.Char) c.Int - -// getopt(3) external variables -// -//go:linkname Optarg C.optarg -var Optarg *c.Char - -//go:linkname Optind C.optind -var Optind c.Int - -//go:linkname Opterr C.opterr -var Opterr c.Int - -//go:linkname Optopt C.optopt -var Optopt c.Int - -//go:linkname Brk C.brk -func Brk(_llcppg_param1 unsafe.Pointer) unsafe.Pointer - -//go:linkname Crypt C.crypt -func Crypt(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char) *c.Char - -//go:linkname Encrypt C.encrypt -func Encrypt(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) - -//go:linkname Gethostid C.gethostid -func Gethostid() c.Long - -//go:linkname Getpgid C.getpgid -func Getpgid(_llcppg_param1 PidT) PidT - -//go:linkname Getsid C.getsid -func Getsid(_llcppg_param1 PidT) PidT - -//go:linkname Getdtablesize C.getdtablesize -func Getdtablesize() c.Int - -//go:linkname Getpagesize C.getpagesize -func Getpagesize() c.Int - -//go:linkname Getpass C.getpass -func Getpass(_llcppg_param1 *c.Char) *c.Char - -// obsoleted by getcwd() -// -//go:linkname Getwd C.getwd -func Getwd(_llcppg_param1 *c.Char) *c.Char - -//go:linkname Lockf C.lockf -func Lockf(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 OffT) c.Int - -//go:linkname Nice C.nice -func Nice(_llcppg_param1 c.Int) c.Int - -//go:linkname Pread C.pread -func Pread(__fd c.Int, __buf unsafe.Pointer, __nbyte c.SizeT, __offset OffT) c.SsizeT - -//go:linkname Pwrite C.pwrite -func Pwrite(__fd c.Int, __buf unsafe.Pointer, __nbyte c.SizeT, __offset OffT) c.SsizeT - -//go:linkname Sbrk C.sbrk -func Sbrk(_llcppg_param1 c.Int) unsafe.Pointer - -//go:linkname Setpgrp C.setpgrp -func Setpgrp() PidT - -//go:linkname Setregid C.setregid -func Setregid(_llcppg_param1 GidT, _llcppg_param2 GidT) c.Int - -//go:linkname Setreuid C.setreuid -func Setreuid(_llcppg_param1 UidT, _llcppg_param2 UidT) c.Int - -//go:linkname Sync C.sync -func Sync() - -//go:linkname Ualarm C.ualarm -func Ualarm(_llcppg_param1 UsecondsT, _llcppg_param2 UsecondsT) UsecondsT - -//go:linkname Usleep C.usleep -func Usleep(_llcppg_param1 UsecondsT) c.Int - -// End XSI -// -//go:linkname Vfork C.vfork -func Vfork() c.Int - -//go:linkname GetloginR C.getlogin_r -func GetloginR(_llcppg_param1 *c.Char, _llcppg_param2 c.SizeT) c.Int - -//go:linkname Gethostname C.gethostname -func Gethostname(_llcppg_param1 *c.Char, _llcppg_param2 c.SizeT) c.Int - -//go:linkname Setegid C.setegid -func Setegid(_llcppg_param1 GidT) c.Int - -//go:linkname Seteuid C.seteuid -func Seteuid(_llcppg_param1 UidT) c.Int - -// llgo:link (*AccessxDescriptor).AccessxNp C.accessx_np -func (self *AccessxDescriptor) AccessxNp(_llcppg_param2 c.SizeT, _llcppg_param3 *c.Int, _llcppg_param4 UidT) c.Int { - return 0 -} - -//go:linkname Acct C.acct -func Acct(_llcppg_param1 *c.Char) c.Int - -//go:linkname Endusershell C.endusershell -func Endusershell() - -//go:linkname ExecvP C.execvP -func ExecvP(__file *c.Char, __searchpath *c.Char, __argv **c.Char) c.Int - -//go:linkname Fflagstostr C.fflagstostr -func Fflagstostr(_llcppg_param1 c.Ulong) *c.Char - -//go:linkname Getdomainname C.getdomainname -func Getdomainname(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int - -//go:linkname Getgrouplist C.getgrouplist -func Getgrouplist(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 *c.Int, _llcppg_param4 *c.Int) c.Int - -//go:linkname Getmode C.getmode -func Getmode(_llcppg_param1 unsafe.Pointer, _llcppg_param2 ModeT) ModeT - -//go:linkname Getpeereid C.getpeereid -func Getpeereid(_llcppg_param1 c.Int, _llcppg_param2 *UidT, _llcppg_param3 *GidT) c.Int - -//go:linkname GetsgroupsNp C.getsgroups_np -func GetsgroupsNp(_llcppg_param1 *c.Int, _llcppg_param2 UuidT) c.Int - -//go:linkname Getusershell C.getusershell -func Getusershell() *c.Char - -//go:linkname GetwgroupsNp C.getwgroups_np -func GetwgroupsNp(_llcppg_param1 *c.Int, _llcppg_param2 UuidT) c.Int - -//go:linkname Initgroups C.initgroups -func Initgroups(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int - -//go:linkname Issetugid C.issetugid -func Issetugid() c.Int - -//go:linkname Mkdtemp C.mkdtemp -func Mkdtemp(_llcppg_param1 *c.Char) *c.Char - -// returns errno -// -//go:linkname MkpathNp C.mkpath_np -func MkpathNp(path *c.Char, omode ModeT) c.Int - -//go:linkname MkpathatNp C.mkpathat_np -func MkpathatNp(dfd c.Int, path *c.Char, omode ModeT) c.Int - -//go:linkname Mkstemps C.mkstemps -func Mkstemps(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int - -//go:linkname Mkostemp C.mkostemp -func Mkostemp(path *c.Char, oflags c.Int) c.Int - -// Non-portable mkstemp that uses open_dprotected_np -// -//go:linkname Mkostemps C.mkostemps -func Mkostemps(path *c.Char, slen c.Int, oflags c.Int) c.Int - -// Non-portable mkstemp that uses open_dprotected_np -// -//go:linkname MkstempDprotectedNp C.mkstemp_dprotected_np -func MkstempDprotectedNp(path *c.Char, dpclass c.Int, dpflags c.Int) c.Int - -//go:linkname MkdtempatNp C.mkdtempat_np -func MkdtempatNp(dfd c.Int, path *c.Char) *c.Char - -//go:linkname MkstempsatNp C.mkstempsat_np -func MkstempsatNp(dfd c.Int, path *c.Char, slen c.Int) c.Int - -//go:linkname MkostempsatNp C.mkostempsat_np -func MkostempsatNp(dfd c.Int, path *c.Char, slen c.Int, oflags c.Int) c.Int - -//go:linkname Nfssvc C.nfssvc -func Nfssvc(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer) c.Int - -//go:linkname Reboot C.reboot -func Reboot(_llcppg_param1 c.Int) c.Int - -//go:linkname Revoke C.revoke -func Revoke(_llcppg_param1 *c.Char) c.Int - -//go:linkname Rcmd C.rcmd -func Rcmd(_llcppg_param1 **c.Char, _llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char, _llcppg_param5 *c.Char, _llcppg_param6 *c.Int) c.Int - -//go:linkname RcmdAf C.rcmd_af -func RcmdAf(_llcppg_param1 **c.Char, _llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char, _llcppg_param5 *c.Char, _llcppg_param6 *c.Int, _llcppg_param7 c.Int) c.Int - -//go:linkname Rresvport C.rresvport -func Rresvport(_llcppg_param1 *c.Int) c.Int - -//go:linkname RresvportAf C.rresvport_af -func RresvportAf(_llcppg_param1 *c.Int, _llcppg_param2 c.Int) c.Int - -//go:linkname Iruserok C.iruserok -func Iruserok(_llcppg_param1 c.Ulong, _llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char) c.Int - -//go:linkname IruserokSa C.iruserok_sa -func IruserokSa(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 *c.Char, _llcppg_param5 *c.Char) c.Int - -//go:linkname Ruserok C.ruserok -func Ruserok(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char) c.Int - -//go:linkname Setdomainname C.setdomainname -func Setdomainname(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int - -//go:linkname Setgroups C.setgroups -func Setgroups(_llcppg_param1 c.Int, _llcppg_param2 *GidT) c.Int - -//go:linkname Sethostid C.sethostid -func Sethostid(_llcppg_param1 c.Long) - -//go:linkname Sethostname C.sethostname -func Sethostname(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int - -//go:linkname Setlogin C.setlogin -func Setlogin(_llcppg_param1 *c.Char) c.Int - -//go:linkname Setmode C.setmode -func Setmode(_llcppg_param1 *c.Char) unsafe.Pointer - -//go:linkname Setrgid C.setrgid -func Setrgid(_llcppg_param1 GidT) c.Int - -//go:linkname Setruid C.setruid -func Setruid(_llcppg_param1 UidT) c.Int - -//go:linkname SetsgroupsNp C.setsgroups_np -func SetsgroupsNp(_llcppg_param1 c.Int, _llcppg_param2 UuidT) c.Int - -//go:linkname Setusershell C.setusershell -func Setusershell() - -//go:linkname SetwgroupsNp C.setwgroups_np -func SetwgroupsNp(_llcppg_param1 c.Int, _llcppg_param2 UuidT) c.Int - -//go:linkname Strtofflags C.strtofflags -func Strtofflags(_llcppg_param1 **c.Char, _llcppg_param2 *c.Ulong, _llcppg_param3 *c.Ulong) c.Int - -//go:linkname Swapon C.swapon -func Swapon(_llcppg_param1 *c.Char) c.Int - -//go:linkname Ttyslot C.ttyslot -func Ttyslot() c.Int - -//go:linkname Undelete C.undelete -func Undelete(_llcppg_param1 *c.Char) c.Int - -// getsubopt(3) external variable -// -//go:linkname Suboptarg C.suboptarg -var Suboptarg *c.Char - -//go:linkname Fgetattrlist C.fgetattrlist -func Fgetattrlist(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.SizeT, _llcppg_param5 c.Uint) c.Int - -//go:linkname Fsetattrlist C.fsetattrlist -func Fsetattrlist(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.SizeT, _llcppg_param5 c.Uint) c.Int - -//go:linkname Getattrlist C.getattrlist -func Getattrlist(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.SizeT, _llcppg_param5 c.Uint) c.Int - -//go:linkname Setattrlist C.setattrlist -func Setattrlist(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.SizeT, _llcppg_param5 c.Uint) c.Int - -//go:linkname Exchangedata C.exchangedata -func Exchangedata(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char, _llcppg_param3 c.Uint) c.Int - -//go:linkname Getdirentriesattr C.getdirentriesattr -func Getdirentriesattr(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.SizeT, _llcppg_param5 *c.Uint, _llcppg_param6 *c.Uint, _llcppg_param7 *c.Uint, _llcppg_param8 c.Uint) c.Int - -//go:linkname Searchfs C.searchfs -func Searchfs(_llcppg_param1 *c.Char, _llcppg_param2 *Fssearchblock, _llcppg_param3 *c.Ulong, _llcppg_param4 c.Uint, _llcppg_param5 c.Uint, _llcppg_param6 *Searchstate) c.Int - -//go:linkname Fsctl C.fsctl -func Fsctl(_llcppg_param1 *c.Char, _llcppg_param2 c.Ulong, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.Uint) c.Int - -//go:linkname Ffsctl C.ffsctl -func Ffsctl(_llcppg_param1 c.Int, _llcppg_param2 c.Ulong, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.Uint) c.Int - -//go:linkname FsyncVolumeNp C.fsync_volume_np -func FsyncVolumeNp(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int - -//go:linkname SyncVolumeNp C.sync_volume_np -func SyncVolumeNp(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int - -//go:linkname Optreset C.optreset -var Optreset c.Int - -type Utimbuf struct { - Actime lltime.TimeT - Modtime lltime.TimeT -} - -//go:linkname Utime C.utime -func Utime(_llcppg_param1 *c.Char, _llcppg_param2 *Utimbuf) c.Int diff --git a/c/os/libc_linux_amd64.go b/c/os/libc_linux_amd64.go deleted file mode 100644 index 1f00af83..00000000 --- a/c/os/libc_linux_amd64.go +++ /dev/null @@ -1,1785 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. -// Classified from the common libc binding. - -package os - -import ( - "github.com/goplus/lib/c" - llsignal "github.com/goplus/lib/c/signal" - llsys "github.com/goplus/lib/c/sys" - lltime "github.com/goplus/lib/c/time" - "unsafe" -) - -type Statvfs struct { - FBsize c.Ulong - FFrsize c.Ulong - FBlocks X__FsblkcntT - FBfree X__FsblkcntT - FBavail X__FsblkcntT - FFiles X__FsfilcntT - FFfree X__FsfilcntT - FFavail X__FsfilcntT - FFsid c.Ulong - FFlag c.Ulong - FNamemax c.Ulong - FType c.Uint - X__FSpare [5]c.Int -} - -// The following values are used by the `waitid' function. -type IdtypeT c.Uint - -// The purpose of all the unions is to have the kernel-compatible layout -// while keeping the API type as 'long int', and among machines where -// __syscall_slong_t is not 'long int', this only does the right thing -// for little-endian ones, like x32. -type Rusage struct { - RuUtime llsys.Timeval - RuStime llsys.Timeval - _llcppg_anon_10 - _llcppg_anon_11 - _llcppg_anon_12 - _llcppg_anon_13 - _llcppg_anon_14 - _llcppg_anon_15 - _llcppg_anon_16 - _llcppg_anon_17 - _llcppg_anon_18 - _llcppg_anon_19 - _llcppg_anon_20 - _llcppg_anon_21 - _llcppg_anon_22 - _llcppg_anon_23 -} - -type _llcppg_anon_10 struct { - _xgo_union [1]uint64 -} - -type _llcppg_anon_11 struct { - _xgo_union [1]uint64 -} - -type _llcppg_anon_12 struct { - _xgo_union [1]uint64 -} - -type _llcppg_anon_13 struct { - _xgo_union [1]uint64 -} - -type _llcppg_anon_14 struct { - _xgo_union [1]uint64 -} - -type _llcppg_anon_15 struct { - _xgo_union [1]uint64 -} - -type _llcppg_anon_16 struct { - _xgo_union [1]uint64 -} - -type _llcppg_anon_17 struct { - _xgo_union [1]uint64 -} - -type _llcppg_anon_18 struct { - _xgo_union [1]uint64 -} - -type _llcppg_anon_19 struct { - _xgo_union [1]uint64 -} - -type _llcppg_anon_20 struct { - _xgo_union [1]uint64 -} - -type _llcppg_anon_21 struct { - _xgo_union [1]uint64 -} - -type _llcppg_anon_22 struct { - _xgo_union [1]uint64 -} - -type _llcppg_anon_23 struct { - _xgo_union [1]uint64 -} - -func (p *_llcppg_anon_10) XGof_ref_ru_maxrss() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_10) XGof_ref___ru_maxrss_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_11) XGof_ref_ru_ixrss() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_11) XGof_ref___ru_ixrss_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_12) XGof_ref_ru_idrss() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_12) XGof_ref___ru_idrss_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_13) XGof_ref_ru_isrss() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_13) XGof_ref___ru_isrss_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_14) XGof_ref_ru_minflt() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_14) XGof_ref___ru_minflt_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_15) XGof_ref_ru_majflt() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_15) XGof_ref___ru_majflt_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_16) XGof_ref_ru_nswap() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_16) XGof_ref___ru_nswap_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_17) XGof_ref_ru_inblock() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_17) XGof_ref___ru_inblock_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_18) XGof_ref_ru_oublock() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_18) XGof_ref___ru_oublock_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_19) XGof_ref_ru_msgsnd() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_19) XGof_ref___ru_msgsnd_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_20) XGof_ref_ru_msgrcv() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_20) XGof_ref___ru_msgrcv_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_21) XGof_ref_ru_nsignals() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_21) XGof_ref___ru_nsignals_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_22) XGof_ref_ru_nvcsw() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_22) XGof_ref___ru_nvcsw_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_23) XGof_ref_ru_nivcsw() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_23) XGof_ref___ru_nivcsw_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} - -// Type of device numbers. -type X__DevT = c.Ulong - -// Type of file attribute bitmasks. -type X__ModeT = c.Uint - -// Type of file sizes and offsets. -type X__OffT = c.Long - -// General type for IDs. -type X__IdT = c.Uint - -// Seconds since the Epoch. -type X__TimeT = c.Long - -// Count of microseconds. -type X__UsecondsT = c.Uint - -// Type to count file system blocks. -type X__FsblkcntT = c.Ulong - -// Type to count file system nodes. -type X__FsfilcntT = c.Ulong - -// Type of a byte count, or error. -type X__SsizeT = c.Long - -// Signed long type used in system calls. -type X__SyscallSlongT = c.Long - -const MAXNAMLEN = 255 - -// File types for `d_type'. -const ( - DT_UNKNOWN = 0 - DT_FIFO = 1 - DT_CHR = 2 - DT_DIR = 4 - DT_BLK = 6 - DT_REG = 8 - DT_LNK = 10 - DT_SOCK = 12 - DT_WHT = 14 -) - -// llgo:link (*DIR).ReaddirR C.readdir_r -func (self *DIR) ReaddirR(__entry *Dirent, __result **Dirent) c.Int { - return 0 -} - -// Rewind DIRP to the beginning of the directory. -// -// llgo:link (*DIR).Rewinddir C.rewinddir -func (self *DIR) Rewinddir() { -} - -// Seek to position POS on DIRP. -// -// llgo:link (*DIR).Seekdir C.seekdir -func (self *DIR) Seekdir(__pos c.Long) { -} - -// Return the current position of DIRP. -// -// llgo:link (*DIR).Telldir C.telldir -func (self *DIR) Telldir() c.Long { - return 0 -} - -// Return the file descriptor used by DIRP. -// -// llgo:link (*DIR).Dirfd C.dirfd -func (self *DIR) Dirfd() c.Int { - return 0 -} - -//go:linkname Scandir C.scandir -func Scandir(__dir *c.Char, __namelist ***Dirent, __selector func(_llcppg_param1 *Dirent) c.Int, __cmp func(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int) c.Int - -//go:linkname Alphasort C.alphasort -func Alphasort(__e1 **Dirent, __e2 **Dirent) c.Int - -//go:linkname Getdirentries C.getdirentries -func Getdirentries(__fd c.Int, __buf *c.Char, __nbytes c.SizeT, __basep *X__OffT) X__SsizeT - -// Open the shared object c.FILE and map it in; return a handle that can be -// passed to `dlsym' to get symbol values from it. -// -//go:linkname Dlopen C.dlopen -func Dlopen(__file *c.Char, __mode c.Int) unsafe.Pointer - -// Unmap and close a shared object opened by `dlopen'. -// The handle cannot be used again after calling `dlclose'. -// -//go:linkname Dlclose C.dlclose -func Dlclose(__handle unsafe.Pointer) c.Int - -// Find the run-time address in the shared object HANDLE refers to -// of the symbol called NAME. -// -//go:linkname Dlsym C.dlsym -func Dlsym(__handle unsafe.Pointer, __name *c.Char) unsafe.Pointer - -// When any of the above functions fails, call this function -// to return a string describing the error. Each call resets -// the error string so that a following call returns null. -// -//go:linkname Dlerror C.dlerror -func Dlerror() *c.Char - -const ( - S_IFMT = 61440 - S_IFDIR = 16384 - S_IFCHR = 8192 - S_IFBLK = 24576 - S_IFREG = 32768 -) - -const S_IFIFO = 4096 - -const S_IFLNK = 40960 - -const S_IFSOCK = 49152 - -const ( - // Set user ID on execution. - S_ISUID = 2048 - // Set group ID on execution. - S_ISGID = 1024 -) - -// Save swapped text after use (sticky bit). This is pretty well obsolete. -const S_ISVTX = 512 - -const ( - // Read by owner. - S_IRUSR = 256 - // Write by owner. - S_IWUSR = 128 - // Execute by owner. - S_IXUSR = 64 -) - -// Read, write, and execute by owner. -const S_IRWXU = 448 - -const ( - // Read by group. - S_IRGRP = 32 - // Write by group. - S_IWGRP = 16 - // Execute by group. - S_IXGRP = 8 -) - -// Read, write, and execute by group. -const S_IRWXG = 56 - -const ( - // Read by others. - S_IROTH = 4 - // Write by others. - S_IWOTH = 2 - // Execute by others. - S_IXOTH = 1 -) - -// Read, write, and execute by others. -const S_IRWXO = 7 - -// Values for the second argument to access. -// These may be OR'd together. -const ( - R_OK = 4 - // Test for write permission. - W_OK = 2 - // Test for execute permission. - // Test for existence. - F_OK = 0 -) - -const ( - // Seek from beginning of file. - SEEK_SET = 0 - // Seek from current position. - SEEK_CUR = 1 - // Seek from end of file. - SEEK_END = 2 -) - -// Special value used to indicate -// the *at functions should use the -// current working directory. -const AT_FDCWD = -100 - -const ( - // Do not follow symbolic links. - AT_SYMLINK_NOFOLLOW = 256 - // Remove directory instead of - // unlinking file. - AT_REMOVEDIR = 512 -) - -// Follow symbolic links. -const AT_SYMLINK_FOLLOW = 1024 - -// Test access permitted for -// effective IDs, not real IDs. -const AT_EACCESS = 512 - -const ( - // Unlock a previously locked region. - F_ULOCK = 0 - // Lock a region for exclusive use. - F_LOCK = 1 - // Test and lock a region for exclusive use. - F_TLOCK = 2 - // Test a region for other processes locks. - F_TEST = 3 -) - -// Ignore -// -//go:linkname Lockf C.lockf -func Lockf(__fd c.Int, __cmd c.Int, __len OffT) c.Int - -//go:linkname PosixFadvise C.posix_fadvise -func PosixFadvise(__fd c.Int, __offset OffT, __len OffT, __advise c.Int) c.Int - -//go:linkname PosixFallocate C.posix_fallocate -func PosixFallocate(__fd c.Int, __offset OffT, __len OffT) c.Int - -// Bits set in the FLAGS argument to `glob'. -const ( - GLOB_ERR = 1 - // Append a slash to each name. - GLOB_MARK = 2 - // Don't sort the names. - GLOB_NOSORT = 4 - // Insert PGLOB->gl_offs NULLs. - GLOB_DOOFFS = 8 - // If nothing matches, return the pattern. - GLOB_NOCHECK = 16 - // Append to results of a previous call. - GLOB_APPEND = 32 - // Backslashes don't quote metacharacters. - GLOB_NOESCAPE = 64 - // Leading `.' can be matched by metachars. - GLOB_PERIOD = 128 -) - -const ( - // Set in gl_flags if any metachars seen. - GLOB_MAGCHAR = 256 - // Use gl_opendir et al functions. - GLOB_ALTDIRFUNC = 512 - // Expand "{a,b}" to "a" "b". - GLOB_BRACE = 1024 - // If no magic chars, return the pattern. - GLOB_NOMAGIC = 2048 - // Expand ~user and ~ to home directories. - GLOB_TILDE = 4096 - // Match only directories. - GLOB_ONLYDIR = 8192 - // Like GLOB_TILDE but return an error - // if the user name is not available. - GLOB_TILDE_CHECK = 16384 -) - -// Error returns from `glob'. -const ( - GLOB_NOSPACE = 1 - // Read error. - GLOB_ABORTED = 2 - // No matches found. - GLOB_NOMATCH = 3 - // Not implemented. - GLOB_NOSYS = 4 -) - -// llgo:type C -type GlobT struct { - GlPathc X__SizeT - GlPathv **c.Char - GlOffs X__SizeT - GlFlags c.Int - GlClosedir func(_llcppg_param1 unsafe.Pointer) - GlReaddir func(_llcppg_param1 unsafe.Pointer) unsafe.Pointer - GlOpendir func(_llcppg_param1 *c.Char) unsafe.Pointer - GlLstat func(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer) c.Int - GlStat func(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer) c.Int -} - -type X__SizeT = c.Ulong - -//go:linkname Glob C.glob -func Glob(__pattern *c.Char, __flags c.Int, __errfunc func(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int, __pglob *GlobT) c.Int - -// Free storage allocated in PGLOB by a previous `glob' call. -// -// llgo:link (*GlobT).Globfree C.globfree -func (self *GlobT) Globfree() { -} - -// Reasonable value for the buffer sized used in the reentrant -// functions below. But better use `sysconf'. -const NSS_BUFLEN_GROUP = 1024 - -// The group structure. -type Group struct { - GrName *c.Char - GrPasswd *c.Char - GrGid c.Uint - GrMem **c.Char -} - -// Rewind the group-file stream. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Setgrent C.setgrent -func Setgrent() - -// Close the group-file stream. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Endgrent C.endgrent -func Endgrent() - -// Read an entry from the group-file stream, opening it if necessary. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getgrent C.getgrent -func Getgrent() *Group - -// Search for an entry with a matching group ID. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getgrgid C.getgrgid -func Getgrgid(__gid c.Uint) *Group - -// Search for an entry with a matching group name. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getgrnam C.getgrnam -func Getgrnam(__name *c.Char) *Group - -// Search for an entry with a matching group ID. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname GetgrgidR C.getgrgid_r -func GetgrgidR(__gid c.Uint, __resultbuf *Group, __buffer *c.Char, __buflen c.SizeT, __result **Group) c.Int - -// Search for an entry with a matching group name. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname GetgrnamR C.getgrnam_r -func GetgrnamR(__name *c.Char, __resultbuf *Group, __buffer *c.Char, __buflen c.SizeT, __result **Group) c.Int - -// Set the group set for the current user to GROUPS (N of them). -// -//go:linkname Setgroups C.setgroups -func Setgroups(__n c.SizeT, __groups *c.Uint) c.Int - -// Store at most *NGROUPS members of the group set for USER into -// GROUPS. Also include GROUP. The actual number of groups found is -// returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Getgrouplist C.getgrouplist -func Getgrouplist(__user *c.Char, __group c.Uint, __groups *c.Uint, __ngroups *c.Int) c.Int - -// Initialize the group set for the current user -// by reading the group database and using all groups -// of which USER is a member. Also include GROUP. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Initgroups C.initgroups -func Initgroups(__user *c.Char, __group c.Uint) c.Int - -// Reasonable value for the buffer sized used in the reentrant -// functions below. But better use `sysconf'. -const NSS_BUFLEN_PASSWD = 1024 - -// A record in the user database. -type Passwd struct { - PwName *c.Char - PwPasswd *c.Char - PwUid c.Uint - PwGid c.Uint - PwGecos *c.Char - PwDir *c.Char - PwShell *c.Char -} - -// Rewind the user database stream. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Setpwent C.setpwent -func Setpwent() - -// Close the user database stream. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Endpwent C.endpwent -func Endpwent() - -// Read an entry from the user database stream, opening it if necessary. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getpwent C.getpwent -func Getpwent() *Passwd - -// Write a given user database entry onto the given stream. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -// llgo:link (*Passwd).Putpwent C.putpwent -func (self *Passwd) Putpwent(__f *c.FILE) c.Int { - return 0 -} - -// Retrieve the user database entry for the given user ID. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getpwuid C.getpwuid -func Getpwuid(__uid c.Uint) *Passwd - -// Retrieve the user database entry for the given username. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getpwnam C.getpwnam -func Getpwnam(__name *c.Char) *Passwd - -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -// llgo:link (*Passwd).GetpwentR C.getpwent_r -func (self *Passwd) GetpwentR(__buffer *c.Char, __buflen c.SizeT, __result **Passwd) c.Int { - return 0 -} - -//go:linkname GetpwuidR C.getpwuid_r -func GetpwuidR(__uid c.Uint, __resultbuf *Passwd, __buffer *c.Char, __buflen c.SizeT, __result **Passwd) c.Int - -//go:linkname GetpwnamR C.getpwnam_r -func GetpwnamR(__name *c.Char, __resultbuf *Passwd, __buffer *c.Char, __buflen c.SizeT, __result **Passwd) c.Int - -// Set scheduling parameters for a process. -// -//go:linkname SchedSetparam C.sched_setparam -func SchedSetparam(__pid c.Int, __param *SchedParam) c.Int - -// Retrieve scheduling parameters for a particular process. -// -//go:linkname SchedGetparam C.sched_getparam -func SchedGetparam(__pid c.Int, __param *SchedParam) c.Int - -// Set scheduling algorithm and/or parameters for a process. -// -//go:linkname SchedSetscheduler C.sched_setscheduler -func SchedSetscheduler(__pid c.Int, __policy c.Int, __param *SchedParam) c.Int - -// Retrieve scheduling algorithm for a particular purpose. -// -//go:linkname SchedGetscheduler C.sched_getscheduler -func SchedGetscheduler(__pid c.Int) c.Int - -// Yield the processor. -// -//go:linkname SchedYield C.sched_yield -func SchedYield() c.Int - -// Get maximum priority value for a scheduler. -// -//go:linkname SchedGetPriorityMax C.sched_get_priority_max -func SchedGetPriorityMax(__algorithm c.Int) c.Int - -// Get minimum priority value for a scheduler. -// -//go:linkname SchedGetPriorityMin C.sched_get_priority_min -func SchedGetPriorityMin(__algorithm c.Int) c.Int - -//go:linkname SchedRrGetInterval C.sched_rr_get_interval -func SchedRrGetInterval(__pid c.Int, __t *lltime.Timespec) c.Int - -// Flags to be set in the `posix_spawnattr_t'. -const ( - POSIX_SPAWN_RESETIDS = 1 - POSIX_SPAWN_SETPGROUP = 2 - POSIX_SPAWN_SETSIGDEF = 4 - POSIX_SPAWN_SETSIGMASK = 8 - POSIX_SPAWN_SETSCHEDPARAM = 16 - POSIX_SPAWN_SETSCHEDULER = 32 -) - -// Data structure to contain attributes for thread creation. -type PosixSpawnattrT struct { - X__Flags int16 - X__Pgrp PidT - X__Sd llsignal.SigsetT - X__Ss llsignal.SigsetT - X__Sp SchedParam - X__Policy c.Int - X__Cgroup c.Int - X__Pad [15]c.Int -} - -// Data structure to contain information about the actions to be -// performed in the new process with respect to file descriptors. -type PosixSpawnFileActionsT struct { - X__Allocated c.Int - X__Used c.Int - X__Actions *X__SpawnAction - X__Pad [16]c.Int -} - -type X__SpawnAction struct { -} - -// Spawn a new process executing PATH with the attributes describes in *ATTRP. -// Before running the process perform the actions described in c.FILE-ACTIONS. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname PosixSpawn C.posix_spawn -func PosixSpawn(__pid *PidT, __path *c.Char, __file_actions *PosixSpawnFileActionsT, __attrp *PosixSpawnattrT, __argv **c.Char, __envp **c.Char) c.Int - -// Similar to `posix_spawn' but search for c.FILE in the PATH. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname PosixSpawnp C.posix_spawnp -func PosixSpawnp(__pid *PidT, __file *c.Char, __file_actions *PosixSpawnFileActionsT, __attrp *PosixSpawnattrT, __argv **c.Char, __envp **c.Char) c.Int - -// Initialize data structure with attributes for `spawn' to default values. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrInit C.posix_spawnattr_init -func (self *PosixSpawnattrT) PosixSpawnattrInit() c.Int { - return 0 -} - -// Free resources associated with ATTR. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrDestroy C.posix_spawnattr_destroy -func (self *PosixSpawnattrT) PosixSpawnattrDestroy() c.Int { - return 0 -} - -// Store signal mask for signals with default handling from ATTR in -// SIGDEFAULT. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigdefault C.posix_spawnattr_getsigdefault -func (self *PosixSpawnattrT) PosixSpawnattrGetsigdefault(__sigdefault *llsignal.SigsetT) c.Int { - return 0 -} - -// Set signal mask for signals with default handling in ATTR to SIGDEFAULT. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigdefault C.posix_spawnattr_setsigdefault -func (self *PosixSpawnattrT) PosixSpawnattrSetsigdefault(__sigdefault *llsignal.SigsetT) c.Int { - return 0 -} - -// Store signal mask for the new process from ATTR in SIGMASK. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigmask C.posix_spawnattr_getsigmask -func (self *PosixSpawnattrT) PosixSpawnattrGetsigmask(__sigmask *llsignal.SigsetT) c.Int { - return 0 -} - -// Set signal mask for the new process in ATTR to SIGMASK. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigmask C.posix_spawnattr_setsigmask -func (self *PosixSpawnattrT) PosixSpawnattrSetsigmask(__sigmask *llsignal.SigsetT) c.Int { - return 0 -} - -// Get flag word from the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetflags C.posix_spawnattr_getflags -func (self *PosixSpawnattrT) PosixSpawnattrGetflags(__flags *int16) c.Int { - return 0 -} - -// Store flags in the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetflags C.posix_spawnattr_setflags -func (self *PosixSpawnattrT) PosixSpawnattrSetflags(__flags int16) c.Int { - return 0 -} - -// Get process group ID from the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetpgroup C.posix_spawnattr_getpgroup -func (self *PosixSpawnattrT) PosixSpawnattrGetpgroup(__pgroup *PidT) c.Int { - return 0 -} - -// Store process group ID in the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetpgroup C.posix_spawnattr_setpgroup -func (self *PosixSpawnattrT) PosixSpawnattrSetpgroup(__pgroup PidT) c.Int { - return 0 -} - -// Get scheduling policy from the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetschedpolicy C.posix_spawnattr_getschedpolicy -func (self *PosixSpawnattrT) PosixSpawnattrGetschedpolicy(__schedpolicy *c.Int) c.Int { - return 0 -} - -// Store scheduling policy in the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetschedpolicy C.posix_spawnattr_setschedpolicy -func (self *PosixSpawnattrT) PosixSpawnattrSetschedpolicy(__schedpolicy c.Int) c.Int { - return 0 -} - -// Get scheduling parameters from the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetschedparam C.posix_spawnattr_getschedparam -func (self *PosixSpawnattrT) PosixSpawnattrGetschedparam(__schedparam *SchedParam) c.Int { - return 0 -} - -// Store scheduling parameters in the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetschedparam C.posix_spawnattr_setschedparam -func (self *PosixSpawnattrT) PosixSpawnattrSetschedparam(__schedparam *SchedParam) c.Int { - return 0 -} - -// Initialize data structure for file attribute for `spawn' call. -// -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsInit C.posix_spawn_file_actions_init -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsInit() c.Int { - return 0 -} - -// Free resources associated with c.FILE-ACTIONS. -// -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsDestroy C.posix_spawn_file_actions_destroy -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsDestroy() c.Int { - return 0 -} - -// Add an action to c.FILE-ACTIONS which tells the implementation to call -// `open' for the given file during the `spawn' call. -// -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddopen C.posix_spawn_file_actions_addopen -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddopen(__fd c.Int, __path *c.Char, __oflag c.Int, __mode ModeT) c.Int { - return 0 -} - -// Add an action to c.FILE-ACTIONS which tells the implementation to call -// `close' for the given file descriptor during the `spawn' call. -// -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddclose C.posix_spawn_file_actions_addclose -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddclose(__fd c.Int) c.Int { - return 0 -} - -// Add an action to c.FILE-ACTIONS which tells the implementation to call -// `dup2' for the given file descriptors during the `spawn' call. -// -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAdddup2 C.posix_spawn_file_actions_adddup2 -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAdddup2(__fd c.Int, __newfd c.Int) c.Int { - return 0 -} - -// Add an action changing the directory to PATH during spawn. This -// affects the subsequent file actions. -// -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddchdirNp C.posix_spawn_file_actions_addchdir_np -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddchdirNp(__path *c.Char) c.Int { - return 0 -} - -// Add an action changing the directory to FD during spawn. This -// affects the subsequent file actions. FD is not duplicated and must -// be open when the file action is executed. -// -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddfchdirNp C.posix_spawn_file_actions_addfchdir_np -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddfchdirNp(__fd c.Int) c.Int { - return 0 -} - -// Add an action to close all file descriptor greater than or equal to FROM -// during spawn. This affects the subsequent file actions. -// -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddclosefromNp C.posix_spawn_file_actions_addclosefrom_np -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddclosefromNp(__from c.Int) c.Int { - return 0 -} - -// Add an action to set the process group of the foreground process group -// associated with the terminal TCFD. -// -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddtcsetpgrpNp C.posix_spawn_file_actions_addtcsetpgrp_np -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddtcsetpgrpNp(__tcfd c.Int) c.Int { - return 0 -} - -const ( - // Seek from beginning of file. - L_SET = 0 - // Seek from current position. - L_INCR = 1 - // Seek from end of file. - L_XTND = 2 -) - -// Apply or remove an advisory lock, according to OPERATION, -// on the file FD refers to. -// -//go:linkname Flock C.flock -func Flock(__fd c.Int, __operation c.Int) c.Int - -//go:linkname Mmap C.mmap -func Mmap(__addr unsafe.Pointer, __len c.SizeT, __prot c.Int, __flags c.Int, __fd c.Int, __offset X__OffT) unsafe.Pointer - -// Deallocate any mapping for the region starting at ADDR and extending LEN -// bytes. Returns 0 if successful, -1 for errors (and sets errno). -// -//go:linkname Munmap C.munmap -func Munmap(__addr unsafe.Pointer, __len c.SizeT) c.Int - -// Change the memory protection of the region starting at ADDR and -// extending LEN bytes to PROT. Returns 0 if successful, -1 for errors -// (and sets errno). -// -//go:linkname Mprotect C.mprotect -func Mprotect(__addr unsafe.Pointer, __len c.SizeT, __prot c.Int) c.Int - -// Synchronize the region starting at ADDR and extending LEN bytes with the -// file it maps. Filesystem operations on a file being mapped are -// unpredictable before this is done. Flags are from the MS_* set. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Msync C.msync -func Msync(__addr unsafe.Pointer, __len c.SizeT, __flags c.Int) c.Int - -// Advise the system about particular usage patterns the program follows -// for the region starting at ADDR and extending LEN bytes. -// -//go:linkname Madvise C.madvise -func Madvise(__addr unsafe.Pointer, __len c.SizeT, __advice c.Int) c.Int - -// This is the POSIX name for this function. -// -//go:linkname PosixMadvise C.posix_madvise -func PosixMadvise(__addr unsafe.Pointer, __len c.SizeT, __advice c.Int) c.Int - -// Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to -// be memory resident. -// -//go:linkname Mlock C.mlock -func Mlock(__addr unsafe.Pointer, __len c.SizeT) c.Int - -// Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN). -// -//go:linkname Munlock C.munlock -func Munlock(__addr unsafe.Pointer, __len c.SizeT) c.Int - -// Cause all currently mapped pages of the process to be memory resident -// until unlocked by a call to the `munlockall', until the process exits, -// or until the process calls `execve'. -// -//go:linkname Mlockall C.mlockall -func Mlockall(__flags c.Int) c.Int - -// All currently mapped pages of the process' address space become -// unlocked. -// -//go:linkname Munlockall C.munlockall -func Munlockall() c.Int - -// mincore returns the memory residency status of the pages in the -// current process's address space specified by [start, start + len). -// The status is returned in a vector of bytes. The least significant -// bit of each byte is 1 if the referenced page is in memory, otherwise -// it is zero. -// -//go:linkname Mincore C.mincore -func Mincore(__start unsafe.Pointer, __len c.SizeT, __vec *uint8) c.Int - -// Open shared memory segment. -// -//go:linkname ShmOpen C.shm_open -func ShmOpen(__name *c.Char, __oflag c.Int, __mode ModeT) c.Int - -// Remove shared memory segment. -// -//go:linkname ShmUnlink C.shm_unlink -func ShmUnlink(__name *c.Char) c.Int - -type X__RusageWhoT = c.Int - -type X__PriorityWhichT = c.Int - -// Return resource usage information on process indicated by WHO -// and put it in *USAGE. Returns 0 for success, -1 for failure. -// -//go:linkname Getrusage C.getrusage -func Getrusage(__who X__RusageWhoT, __usage *Rusage) c.Int - -// Return the highest priority of any process specified by WHICH and WHO -// (see above); if WHO is zero, the current process, process group, or user -// (as specified by WHO) is used. A lower priority number means higher -// priority. Priorities range from PRIO_MIN to PRIO_MAX (above). -// -//go:linkname Getpriority C.getpriority -func Getpriority(__which X__PriorityWhichT, __who IdT) c.Int - -// Set the priority of all processes specified by WHICH and WHO (see above) -// to PRIO. Returns 0 on success, -1 on errors. -// -//go:linkname Setpriority C.setpriority -func Setpriority(__which X__PriorityWhichT, __who IdT, __prio c.Int) c.Int - -// Maximum number of file descriptors in `fd_set'. -const FD_SETSIZE = 1024 - -//go:linkname Select C.select -func Select(__nfds c.Int, __readfds *llsys.FdSet, __writefds *llsys.FdSet, __exceptfds *llsys.FdSet, __timeout *llsys.Timeval) c.Int - -//go:linkname Pselect C.pselect -func Pselect(__nfds c.Int, __readfds *llsys.FdSet, __writefds *llsys.FdSet, __exceptfds *llsys.FdSet, __timeout *lltime.Timespec, __sigmask *llsignal.SigsetT) c.Int - -const ( - S_IREAD = 256 - S_IWRITE = 128 - S_IEXEC = 64 -) - -// Macros for common mode bit masks. -const ( - ACCESSPERMS = 511 - // 07777 - ALLPERMS = 4095 - // 0666 - DEFFILEMODE = 438 -) - -// Block size for `st_blocks'. -const S_BLKSIZE = 512 - -// Set file access permissions for c.FILE to MODE. -// If c.FILE is a symbolic link, this affects the link itself -// rather than its target. -// -//go:linkname Lchmod C.lchmod -func Lchmod(__file *c.Char, __mode X__ModeT) c.Int - -// Like mkdir, create a new directory with permission bits MODE. But -// interpret relative PATH names relative to the directory associated -// with FD. -// -//go:linkname Mkdirat C.mkdirat -func Mkdirat(__fd c.Int, __path *c.Char, __mode X__ModeT) c.Int - -// Like mknod, create a new device file with permission bits MODE and -// device number DEV. But interpret relative PATH names relative to -// the directory associated with FD. -// -//go:linkname Mknodat C.mknodat -func Mknodat(__fd c.Int, __path *c.Char, __mode X__ModeT, __dev X__DevT) c.Int - -// Like mkfifo, create a new FIFO with permission bits MODE. But -// interpret relative PATH names relative to the directory associated -// with FD. -// -//go:linkname Mkfifoat C.mkfifoat -func Mkfifoat(__fd c.Int, __path *c.Char, __mode X__ModeT) c.Int - -// Set file access and modification times relative to directory file -// descriptor. -// -//go:linkname Utimensat C.utimensat -func Utimensat(__fd c.Int, __path *c.Char, __times *lltime.Timespec, __flags c.Int) c.Int - -// Set file access and modification times of the file associated with FD. -// -//go:linkname Futimens C.futimens -func Futimens(__fd c.Int, __times *lltime.Timespec) c.Int - -//go:linkname Fstatvfs C.fstatvfs -func Fstatvfs(__fildes c.Int, __buf *Statvfs) c.Int - -// Structure describing CPU time used by a process and its children. -type Tms struct { - TmsUtime lltime.ClockT - TmsStime lltime.ClockT - TmsCutime lltime.ClockT - TmsCstime lltime.ClockT -} - -// Store the CPU time used by this process and all its -// dead children (and their dead children) in BUFFER. -// Return the elapsed real time, or (clock_t) -1 for errors. -// All times are in CLK_TCKths of a second. -// -// llgo:link (*Tms).Times C.times -func (self *Tms) Times() lltime.ClockT { - return 0 -} - -type IdT = X__IdT - -const UIO_MAXIOV = 1024 - -// Read data from file descriptor FD, and put the result in the -// buffers described by IOVEC, which is a vector of COUNT 'struct iovec's. -// The buffers are filled in the order specified. -// Operates just like 'read' (see ) except that data are -// put in IOVEC instead of a contiguous buffer. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Readv C.readv -func Readv(__fd c.Int, __iovec *c.Iovec, __count c.Int) c.SsizeT - -// Write data pointed by the buffers described by IOVEC, which -// is a vector of COUNT 'struct iovec's, to file descriptor FD. -// The data is written in the order specified. -// Operates just like 'write' (see ) except that the data -// are taken from IOVEC instead of a contiguous buffer. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Writev C.writev -func Writev(__fd c.Int, __iovec *c.Iovec, __count c.Int) c.SsizeT - -// Read data from file descriptor FD at the given position OFFSET -// without change the file pointer, and put the result in the buffers -// described by IOVEC, which is a vector of COUNT 'struct iovec's. -// The buffers are filled in the order specified. Operates just like -// 'pread' (see ) except that data are put in IOVEC instead -// of a contiguous buffer. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Preadv C.preadv -func Preadv(__fd c.Int, __iovec *c.Iovec, __count c.Int, __offset X__OffT) c.SsizeT - -// Write data pointed by the buffers described by IOVEC, which is a -// vector of COUNT 'struct iovec's, to file descriptor FD at the given -// position OFFSET without change the file pointer. The data is -// written in the order specified. Operates just like 'pwrite' (see -// ) except that the data are taken from IOVEC instead of a -// contiguous buffer. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Pwritev C.pwritev -func Pwritev(__fd c.Int, __iovec *c.Iovec, __count c.Int, __offset X__OffT) c.SsizeT - -// Note that SVID assumes all members have the same size. -const SYS_NMLN = 65 - -// Structure describing the system and machine. -type Utsname struct { - Sysname [65]c.Char - Nodename [65]c.Char - Release [65]c.Char - Version [65]c.Char - Machine [65]c.Char - X__Domainname [65]c.Char -} - -// Put information about the system in NAME. -// -// llgo:link (*Utsname).Uname C.uname -func (self *Utsname) Uname() c.Int { - return 0 -} - -const WCOREFLAG = 128 - -// Special values for the PID argument to `waitpid' and `wait4'. -const ( - WAIT_ANY = -1 - // Any process in my process group. - WAIT_MYPGRP = 0 -) - -// Wait for a childing matching IDTYPE and ID to change the status and -// place appropriate information in *INFOP. -// If IDTYPE is P_PID, match any process whose process ID is ID. -// If IDTYPE is P_PGID, match any process whose process group is ID. -// If IDTYPE is P_ALL, match any process. -// If the WNOHANG bit is set in OPTIONS, and that child -// is not already dead, clear *INFOP and return 0. If successful, store -// exit code and status in *INFOP. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -// llgo:link IdtypeT.Waitid C.waitid -func (self IdtypeT) Waitid(__id X__IdT, __infop *llsignal.SiginfoT, __options c.Int) c.Int { - return 0 -} - -// Return the output baud rate stored in *TERMIOS_P. -// -// llgo:link (*Termios).Cfgetospeed C.cfgetospeed -func (self *Termios) Cfgetospeed() SpeedT { - return 0 -} - -// Return the input baud rate stored in *TERMIOS_P. -// -// llgo:link (*Termios).Cfgetispeed C.cfgetispeed -func (self *Termios) Cfgetispeed() SpeedT { - return 0 -} - -// Set the output baud rate stored in *TERMIOS_P to SPEED. -// -// llgo:link (*Termios).Cfsetospeed C.cfsetospeed -func (self *Termios) Cfsetospeed(__speed SpeedT) c.Int { - return 0 -} - -// Set the input baud rate stored in *TERMIOS_P to SPEED. -// -// llgo:link (*Termios).Cfsetispeed C.cfsetispeed -func (self *Termios) Cfsetispeed(__speed SpeedT) c.Int { - return 0 -} - -// Set both the input and output baud rates in *TERMIOS_OP to SPEED. -// -// llgo:link (*Termios).Cfsetspeed C.cfsetspeed -func (self *Termios) Cfsetspeed(__speed SpeedT) c.Int { - return 0 -} - -// Put the state of FD into *TERMIOS_P. -// -//go:linkname Tcgetattr C.tcgetattr -func Tcgetattr(__fd c.Int, __termios_p *Termios) c.Int - -// Set the state of FD to *TERMIOS_P. -// Values for OPTIONAL_ACTIONS (TCSA*) are in . -// -//go:linkname Tcsetattr C.tcsetattr -func Tcsetattr(__fd c.Int, __optional_actions c.Int, __termios_p *Termios) c.Int - -// Set *TERMIOS_P to indicate raw mode. -// -// llgo:link (*Termios).Cfmakeraw C.cfmakeraw -func (self *Termios) Cfmakeraw() { -} - -// Send zero bits on FD. -// -//go:linkname Tcsendbreak C.tcsendbreak -func Tcsendbreak(__fd c.Int, __duration c.Int) c.Int - -// Wait for pending output to be written on FD. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Tcdrain C.tcdrain -func Tcdrain(__fd c.Int) c.Int - -// Flush pending data on FD. -// Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in . -// -//go:linkname Tcflush C.tcflush -func Tcflush(__fd c.Int, __queue_selector c.Int) c.Int - -// Suspend or restart transmission on FD. -// Values for ACTION (TC[IO]{OFF,ON}) are in . -// -//go:linkname Tcflow C.tcflow -func Tcflow(__fd c.Int, __action c.Int) c.Int - -// Get process group ID for session leader for controlling terminal FD. -// -//go:linkname Tcgetsid C.tcgetsid -func Tcgetsid(__fd c.Int) c.Int - -// Standard file descriptors. -const ( - STDIN_FILENO = 0 - // Standard output. - STDOUT_FILENO = 1 - // Standard error output. - STDERR_FILENO = 2 -) - -// Test for access to NAME using the real UID and real GID. -// -//go:linkname Access C.access -func Access(__name *c.Char, __type c.Int) c.Int - -// Close all open file descriptors greater than or equal to LOWFD. -// Negative LOWFD is clamped to 0. -// -//go:linkname Closefrom C.closefrom -func Closefrom(__lowfd c.Int) - -// Read NBYTES into BUF from FD at the given position OFFSET without -// changing the file pointer. Return the number read, -1 for errors -// or 0 for EOF. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Pread C.pread -func Pread(__fd c.Int, __buf unsafe.Pointer, __nbytes c.SizeT, __offset X__OffT) c.SsizeT - -// Write N bytes of BUF to FD at the given position OFFSET without -// changing the file pointer. Return the number written, or -1. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Pwrite C.pwrite -func Pwrite(__fd c.Int, __buf unsafe.Pointer, __n c.SizeT, __offset X__OffT) c.SsizeT - -// Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. -// If SECONDS is zero, any currently scheduled alarm will be cancelled. -// The function returns the number of seconds remaining until the last -// alarm scheduled would have signaled, or zero if there wasn't one. -// There is no return value to indicate an error, but you can set `errno' -// to 0 and check its value after calling `alarm', and this might tell you. -// The signal may come late due to processor scheduling. -// -//go:linkname Alarm C.alarm -func Alarm(__seconds c.Uint) c.Uint - -// Make the process sleep for SECONDS seconds, or until a signal arrives -// and is not ignored. The function returns the number of seconds less -// than SECONDS which it actually slept (thus zero if it slept the full time). -// If a signal handler does a `longjmp' or modifies the handling of the -// SIGALRM signal while inside `sleep' call, the handling of the SIGALRM -// signal afterwards is undefined. There is no return value to indicate -// error, but if `sleep' returns SECONDS, it probably didn't work. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Sleep C.sleep -func Sleep(__seconds c.Uint) c.Uint - -// Set an alarm to go off (generating a SIGALRM signal) in VALUE -// microseconds. If INTERVAL is nonzero, when the alarm goes off, the -// timer is reset to go off every INTERVAL microseconds thereafter. -// Returns the number of microseconds remaining before the alarm. -// -//go:linkname Ualarm C.ualarm -func Ualarm(__value X__UsecondsT, __interval X__UsecondsT) X__UsecondsT - -// Sleep USECONDS microseconds, or until a signal arrives that is not blocked -// or ignored. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Usleep C.usleep -func Usleep(__useconds X__UsecondsT) c.Int - -// Suspend the process until a signal arrives. -// This always returns -1 and sets `errno' to EINTR. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Pause C.pause -func Pause() c.Int - -// Put the absolute pathname of the current working directory in BUF. -// If successful, return BUF. If not, put an error message in -// BUF and return NULL. BUF should be at least PATH_MAX bytes long. -// -//go:linkname Getwd C.getwd -func Getwd(__buf *c.Char) *c.Char - -// Execute the file FD refers to, overlaying the running program image. -// ARGV and ENVP are passed to the new program, as for `execve'. -// -//go:linkname Fexecve C.fexecve -func Fexecve(__fd c.Int, __argv **c.Char, __envp **c.Char) c.Int - -// Add INC to priority of the current process. -// -//go:linkname Nice C.nice -func Nice(__inc c.Int) c.Int - -// Terminate program execution with the low-order 8 bits of STATUS. -// -//go:linkname X_exit C._exit -func X_exit(__status c.Int) - -// Get file-specific configuration information about PATH. -// -//go:linkname Pathconf C.pathconf -func Pathconf(__path *c.Char, __name c.Int) c.Long - -// Get file-specific configuration about descriptor FD. -// -//go:linkname Fpathconf C.fpathconf -func Fpathconf(__fd c.Int, __name c.Int) c.Long - -// Get the value of the system variable NAME. -// -//go:linkname Sysconf C.sysconf -func Sysconf(__name c.Int) c.Long - -// Get the value of the string-valued system variable NAME. -// -//go:linkname Confstr C.confstr -func Confstr(__name c.Int, __buf *c.Char, __len c.SizeT) c.SizeT - -// Get the process group ID of the calling process. -// -//go:linkname Getpgrp C.getpgrp -func Getpgrp() c.Int - -//go:linkname Getpgid C.getpgid -func Getpgid(__pid c.Int) c.Int - -// Set the process group ID of the process matching PID to PGID. -// If PID is zero, the current process's process group ID is set. -// If PGID is zero, the process ID of the process is used. -// -//go:linkname Setpgid C.setpgid -func Setpgid(__pid c.Int, __pgid c.Int) c.Int - -// Set the process group ID of the calling process to its own PID. -// This is exactly the same as `setpgid (0, 0)'. -// -//go:linkname Setpgrp C.setpgrp -func Setpgrp() c.Int - -// Create a new session with the calling process as its leader. -// The process group IDs of the session and the calling process -// are set to the process ID of the calling process, which is returned. -// -//go:linkname Setsid C.setsid -func Setsid() c.Int - -// Return the session ID of the given process. -// -//go:linkname Getsid C.getsid -func Getsid(__pid c.Int) c.Int - -// If SIZE is zero, return the number of supplementary groups -// the calling process is in. Otherwise, fill in the group IDs -// of its supplementary groups in LIST and return the number written. -// -//go:linkname Getgroups C.getgroups -func Getgroups(__size c.Int, __list *c.Uint) c.Int - -// Set the user ID of the calling process to UID. -// If the calling process is the super-user, set the real -// and effective user IDs, and the saved set-user-ID to UID; -// if not, the effective user ID is set to UID. -// -//go:linkname Setuid C.setuid -func Setuid(__uid c.Uint) c.Int - -// Set the real user ID of the calling process to RUID, -// and the effective user ID of the calling process to EUID. -// -//go:linkname Setreuid C.setreuid -func Setreuid(__ruid c.Uint, __euid c.Uint) c.Int - -// Set the effective user ID of the calling process to UID. -// -//go:linkname Seteuid C.seteuid -func Seteuid(__uid c.Uint) c.Int - -// Set the group ID of the calling process to GID. -// If the calling process is the super-user, set the real -// and effective group IDs, and the saved set-group-ID to GID; -// if not, the effective group ID is set to GID. -// -//go:linkname Setgid C.setgid -func Setgid(__gid c.Uint) c.Int - -// Set the real group ID of the calling process to RGID, -// and the effective group ID of the calling process to EGID. -// -//go:linkname Setregid C.setregid -func Setregid(__rgid c.Uint, __egid c.Uint) c.Int - -// Set the effective group ID of the calling process to GID. -// -//go:linkname Setegid C.setegid -func Setegid(__gid c.Uint) c.Int - -// Clone the calling process, but without copying the whole address space. -// The calling process is suspended until the new process exits or is -// replaced by a call to `execve'. Return -1 for errors, 0 to the new process, -// and the process ID of the new process to the old process. -// -//go:linkname Vfork C.vfork -func Vfork() c.Int - -// Return the pathname of the terminal FD is open on, or NULL on errors. -// The returned storage is good only until the next call to this function. -// -//go:linkname Ttyname C.ttyname -func Ttyname(__fd c.Int) *c.Char - -// Store at most BUFLEN characters of the pathname of the terminal FD is -// open on in BUF. Return 0 on success, otherwise an error number. -// -//go:linkname TtynameR C.ttyname_r -func TtynameR(__fd c.Int, __buf *c.Char, __buflen c.SizeT) c.Int - -// Return the index into the active-logins file (utmp) for -// the controlling terminal. -// -//go:linkname Ttyslot C.ttyslot -func Ttyslot() c.Int - -// Like link but relative paths in TO and FROM are interpreted relative -// to FROMFD and TOFD respectively. -// -//go:linkname Linkat C.linkat -func Linkat(__fromfd c.Int, __from *c.Char, __tofd c.Int, __to *c.Char, __flags c.Int) c.Int - -// Like symlink but a relative path in TO is interpreted relative to TOFD. -// -//go:linkname Symlinkat C.symlinkat -func Symlinkat(__from *c.Char, __tofd c.Int, __to *c.Char) c.Int - -// Like readlink but a relative PATH is interpreted relative to FD. -// -//go:linkname Readlinkat C.readlinkat -func Readlinkat(__fd c.Int, __path *c.Char, __buf *c.Char, __len c.SizeT) c.SsizeT - -// Return the foreground process group ID of FD. -// -//go:linkname Tcgetpgrp C.tcgetpgrp -func Tcgetpgrp(__fd c.Int) c.Int - -// Set the foreground process group ID of FD set PGRP_ID. -// -//go:linkname Tcsetpgrp C.tcsetpgrp -func Tcsetpgrp(__fd c.Int, __pgrp_id c.Int) c.Int - -// Return the login name of the user. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getlogin C.getlogin -func Getlogin() *c.Char - -// Return at most NAME_LEN characters of the login name of the user in NAME. -// If it cannot be determined or some other error occurred, return the error -// code. Otherwise return 0. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname GetloginR C.getlogin_r -func GetloginR(__name *c.Char, __name_len c.SizeT) c.Int - -// Set the login name returned by `getlogin'. -// -//go:linkname Setlogin C.setlogin -func Setlogin(__name *c.Char) c.Int - -// Put the name of the current host in no more than LEN bytes of NAME. -// The result is null-terminated if LEN is large enough for the full -// name and the terminator. -// -//go:linkname Gethostname C.gethostname -func Gethostname(__name *c.Char, __len c.SizeT) c.Int - -// Set the name of the current host to NAME, which is LEN bytes long. -// This call is restricted to the super-user. -// -//go:linkname Sethostname C.sethostname -func Sethostname(__name *c.Char, __len c.SizeT) c.Int - -// Set the current machine's Internet number to ID. -// This call is restricted to the super-user. -// -//go:linkname Sethostid C.sethostid -func Sethostid(__id c.Long) c.Int - -// Get and set the NIS (aka YP) domain name, if any. -// Called just like `gethostname' and `sethostname'. -// The NIS domain name is usually the empty string when not using NIS. -// -//go:linkname Getdomainname C.getdomainname -func Getdomainname(__name *c.Char, __len c.SizeT) c.Int - -// Ignore -// -//go:linkname Setdomainname C.setdomainname -func Setdomainname(__name *c.Char, __len c.SizeT) c.Int - -// Revoke access permissions to all processes currently communicating -// with the control terminal, and then send a SIGHUP signal to the process -// group of the control terminal. -// -//go:linkname Vhangup C.vhangup -func Vhangup() c.Int - -// Revoke the access of all descriptors currently open on c.FILE. -// -//go:linkname Revoke C.revoke -func Revoke(__file *c.Char) c.Int - -// Enable statistical profiling, writing samples of the PC into at most -// SIZE bytes of SAMPLE_BUFFER; every processor clock tick while profiling -// is enabled, the system examines the user PC and increments -// SAMPLE_BUFFER[((PC - OFFSET) / 2) * SCALE / 65536]. If SCALE is zero, -// disable profiling. Returns zero on success, -1 on error. -// -//go:linkname Profil C.profil -func Profil(__sample_buffer *uint16, __size c.SizeT, __offset c.SizeT, __scale c.Uint) c.Int - -// Turn accounting on if NAME is an existing file. The system will then write -// a record for each process as it terminates, to this file. If NAME is NULL, -// turn accounting off. This call is restricted to the super-user. -// -//go:linkname Acct C.acct -func Acct(__name *c.Char) c.Int - -// Successive calls return the shells listed in `/etc/shells'. -// -//go:linkname Getusershell C.getusershell -func Getusershell() *c.Char - -// Discard cached info. -// -//go:linkname Endusershell C.endusershell -func Endusershell() - -// Rewind and re-read the file. -// -//go:linkname Setusershell C.setusershell -func Setusershell() - -// Put the program in the background, and dissociate from the controlling -// terminal. If NOCHDIR is zero, do `chdir ("/")'. If NOCLOSE is zero, -// redirects stdin, stdout, and stderr to /dev/null. -// -//go:linkname Daemon C.daemon -func Daemon(__nochdir c.Int, __noclose c.Int) c.Int - -// Prompt with PROMPT and read a string from the terminal without echoing. -// Uses /dev/tty if possible; otherwise stderr and stdin. -// -//go:linkname Getpass C.getpass -func Getpass(__prompt *c.Char) *c.Char - -// Return identifier for the current host. -// -//go:linkname Gethostid C.gethostid -func Gethostid() c.Long - -// Make all changes done to all files actually appear on disk. -// -//go:linkname Sync C.sync -func Sync() - -// Return the number of bytes in a page. This is the system's page size, -// which is not necessarily the same as the hardware page size. -// -//go:linkname Getpagesize C.getpagesize -func Getpagesize() c.Int - -// Return the maximum number of file descriptors -// the current process could possibly have. -// -//go:linkname Getdtablesize C.getdtablesize -func Getdtablesize() c.Int - -// Set the end of accessible data space (aka "the break") to ADDR. -// Returns zero on success and -1 for errors (with errno set). -// -//go:linkname Brk C.brk -func Brk(__addr unsafe.Pointer) c.Int - -// Increase or decrease the end of accessible data space by DELTA bytes. -// If successful, returns the address the previous end of data space -// (i.e. the beginning of the new space, if DELTA > 0); -// returns (void *) -1 for errors (with errno set). -// -//go:linkname Sbrk C.sbrk -func Sbrk(__delta c.IntptrT) unsafe.Pointer - -// Synchronize at least the data part of a file with the underlying -// media. -// -//go:linkname Fdatasync C.fdatasync -func Fdatasync(__fildes c.Int) c.Int - -// Write LENGTH bytes of randomness starting at BUFFER. Return 0 on -// success or -1 on error. -// -//go:linkname Getentropy C.getentropy -func Getentropy(__buffer unsafe.Pointer, __length c.SizeT) c.Int - -// Structure describing file times. -type Utimbuf struct { - Actime X__TimeT - Modtime X__TimeT -} - -//go:linkname Utime C.utime -func Utime(__file *c.Char, __file_times *Utimbuf) c.Int diff --git a/c/os/libgen_darwin_arm64.go b/c/os/libgen_darwin_arm64.go new file mode 100644 index 00000000..b48b26ca --- /dev/null +++ b/c/os/libgen_darwin_arm64.go @@ -0,0 +1,22 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +//go:linkname Basename C.basename +func Basename(_llcppg_param1 *c.Char) *c.Char + +//go:linkname Dirname C.dirname +func Dirname(_llcppg_param1 *c.Char) *c.Char + +//go:linkname BasenameR C.basename_r +func BasenameR(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char) *c.Char + +//go:linkname DirnameR C.dirname_r +func DirnameR(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char) *c.Char diff --git a/c/os/libgen_linux_amd64.go b/c/os/libgen_linux_amd64.go new file mode 100644 index 00000000..49dee03a --- /dev/null +++ b/c/os/libgen_linux_amd64.go @@ -0,0 +1,27 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_LIBGEN_H = 1 + +// Return directory part of PATH or "." if none is available. +// +//go:linkname Dirname C.dirname +func Dirname(__path *c.Char) *c.Char + +// Return final component of PATH. +// +// This is the weird XPG version of this function. It sometimes will +// modify its argument. Therefore we normally use the GNU version (in +// ) and only if this header is included make the XPG +// version available under the real name. +// +//go:linkname X__XpgBasename C.__xpg_basename +func X__XpgBasename(__path *c.Char) *c.Char diff --git a/c/os/libgen_linux_arm64.go b/c/os/libgen_linux_arm64.go new file mode 100644 index 00000000..0430ede0 --- /dev/null +++ b/c/os/libgen_linux_arm64.go @@ -0,0 +1,24 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import _ "unsafe" + +const X_LIBGEN_H = 1 + +// Return directory part of PATH or "." if none is available. +// +//go:linkname Dirname C.dirname +func Dirname(__path *uint8) *uint8 + +// Return final component of PATH. +// +// This is the weird XPG version of this function. It sometimes will +// modify its argument. Therefore we normally use the GNU version (in +// ) and only if this header is included make the XPG +// version available under the real name. +// +//go:linkname X__XpgBasename C.__xpg_basename +func X__XpgBasename(__path *uint8) *uint8 diff --git a/c/os/llcppg-flags-linux_amd64.cfg b/c/os/llcppg-flags-linux_amd64.cfg new file mode 100644 index 00000000..53155e3b --- /dev/null +++ b/c/os/llcppg-flags-linux_amd64.cfg @@ -0,0 +1,25 @@ +{ + "Name": "os", + "Language": "c", + "Dir": ".sysroot/flags", + "Stdlib": ".sysroot/stdlib", + "Files": [ + "flags.h" + ], + "Deps": [ + ".." + ], + "Rename": { + "_llcppg_flag_F_GETFL": "F_GETFL", + "_llcppg_flag_F_SETFL": "F_SETFL", + "_llcppg_flag_O_RDONLY": "O_RDONLY", + "_llcppg_flag_O_WRONLY": "O_WRONLY", + "_llcppg_flag_O_RDWR": "O_RDWR", + "_llcppg_flag_O_ACCMODE": "O_ACCMODE", + "_llcppg_flag_O_NONBLOCK": "O_NONBLOCK", + "_llcppg_flag_O_CREAT": "O_CREAT", + "_llcppg_flag_O_TRUNC": "O_TRUNC", + "_llcppg_flag_EAGAIN": "EAGAIN" + }, + "FailFast": 0 +} diff --git a/c/os/llcppg-flags-linux_arm64.cfg b/c/os/llcppg-flags-linux_arm64.cfg new file mode 100644 index 00000000..53155e3b --- /dev/null +++ b/c/os/llcppg-flags-linux_arm64.cfg @@ -0,0 +1,25 @@ +{ + "Name": "os", + "Language": "c", + "Dir": ".sysroot/flags", + "Stdlib": ".sysroot/stdlib", + "Files": [ + "flags.h" + ], + "Deps": [ + ".." + ], + "Rename": { + "_llcppg_flag_F_GETFL": "F_GETFL", + "_llcppg_flag_F_SETFL": "F_SETFL", + "_llcppg_flag_O_RDONLY": "O_RDONLY", + "_llcppg_flag_O_WRONLY": "O_WRONLY", + "_llcppg_flag_O_RDWR": "O_RDWR", + "_llcppg_flag_O_ACCMODE": "O_ACCMODE", + "_llcppg_flag_O_NONBLOCK": "O_NONBLOCK", + "_llcppg_flag_O_CREAT": "O_CREAT", + "_llcppg_flag_O_TRUNC": "O_TRUNC", + "_llcppg_flag_EAGAIN": "EAGAIN" + }, + "FailFast": 0 +} diff --git a/c/os/llcppg-linux_amd64.cfg b/c/os/llcppg-linux_amd64.cfg new file mode 100644 index 00000000..d3e9ac2e --- /dev/null +++ b/c/os/llcppg-linux_amd64.cfg @@ -0,0 +1,141 @@ +{ + "Name": "os", + "Language": "c", + "Dir": ".sysroot/include", + "Stdlib": ".sysroot/stdlib", + "Files": [ + "llcppg.h" + ], + "Deps": [ + "..", + "../signal", + "../sys", + "../time" + ], + "FailFast": 0, + "FuncIgnore": [ + "__fxstat", + "__fxstat64", + "__fxstatat", + "__fxstatat64", + "__lxstat", + "__lxstat64", + "__xstat", + "__xstat64", + "add_profil", + "alloca", + "chdir", + "chmod", + "chown", + "chroot", + "close", + "closedir", + "creat", + "dup", + "dup2", + "dup3", + "execl", + "execle", + "execlp", + "execv", + "execve", + "execvp", + "exit", + "faccessat", + "fchdir", + "fchmod", + "fchmodat", + "fchown", + "fchownat", + "fcntl", + "fdopendir", + "fork", + "fstat", + "fstatat", + "fstatx_np", + "fsync", + "ftruncate", + "getcwd", + "getdirentries", + "getegid", + "getenv", + "geteuid", + "getgid", + "getpid", + "getppid", + "getrlimit", + "getuid", + "if_nameindex", + "isatty", + "kill", + "lchown", + "link", + "llgoClearenv", + "llgoErrno", + "longjmperror", + "lseek", + "lstat", + "lstatx_np", + "mkdir", + "mkfifo", + "mknod", + "open", + "openat", + "opendir", + "pfctlinput", + "pipe", + "profil", + "putenv", + "read", + "readdir", + "readlink", + "remove", + "rename", + "rmdir", + "setenv", + "setgrfile", + "setrlimit", + "sigaction", + "sigvec", + "stat", + "statvfs", + "statx_np", + "symlink", + "syscall", + "sysctl", + "sysctlbyname", + "sysctlnametomib", + "truncate", + "umask", + "unlink", + "unlinkat", + "unsetenv", + "unwhiteout", + "wait", + "wait3", + "wait4", + "waitpid", + "write" + ], + "TypeIgnore": [ + "va_list", + "stat" + ], + "Rename": { + "_llcppg_flock_type": "FlockT", + "_llcppg_wait_type": "WaitStatus" + }, + "MacroIgnore": [ + "EAGAIN", + "F_GETFL", + "F_SETFL", + "O_ACCMODE", + "O_CREAT", + "O_NONBLOCK", + "O_RDONLY", + "O_RDWR", + "O_TRUNC", + "O_WRONLY", + "PATH_MAX" + ] +} diff --git a/c/os/llcppg-linux_arm64.cfg b/c/os/llcppg-linux_arm64.cfg new file mode 100644 index 00000000..d3e9ac2e --- /dev/null +++ b/c/os/llcppg-linux_arm64.cfg @@ -0,0 +1,141 @@ +{ + "Name": "os", + "Language": "c", + "Dir": ".sysroot/include", + "Stdlib": ".sysroot/stdlib", + "Files": [ + "llcppg.h" + ], + "Deps": [ + "..", + "../signal", + "../sys", + "../time" + ], + "FailFast": 0, + "FuncIgnore": [ + "__fxstat", + "__fxstat64", + "__fxstatat", + "__fxstatat64", + "__lxstat", + "__lxstat64", + "__xstat", + "__xstat64", + "add_profil", + "alloca", + "chdir", + "chmod", + "chown", + "chroot", + "close", + "closedir", + "creat", + "dup", + "dup2", + "dup3", + "execl", + "execle", + "execlp", + "execv", + "execve", + "execvp", + "exit", + "faccessat", + "fchdir", + "fchmod", + "fchmodat", + "fchown", + "fchownat", + "fcntl", + "fdopendir", + "fork", + "fstat", + "fstatat", + "fstatx_np", + "fsync", + "ftruncate", + "getcwd", + "getdirentries", + "getegid", + "getenv", + "geteuid", + "getgid", + "getpid", + "getppid", + "getrlimit", + "getuid", + "if_nameindex", + "isatty", + "kill", + "lchown", + "link", + "llgoClearenv", + "llgoErrno", + "longjmperror", + "lseek", + "lstat", + "lstatx_np", + "mkdir", + "mkfifo", + "mknod", + "open", + "openat", + "opendir", + "pfctlinput", + "pipe", + "profil", + "putenv", + "read", + "readdir", + "readlink", + "remove", + "rename", + "rmdir", + "setenv", + "setgrfile", + "setrlimit", + "sigaction", + "sigvec", + "stat", + "statvfs", + "statx_np", + "symlink", + "syscall", + "sysctl", + "sysctlbyname", + "sysctlnametomib", + "truncate", + "umask", + "unlink", + "unlinkat", + "unsetenv", + "unwhiteout", + "wait", + "wait3", + "wait4", + "waitpid", + "write" + ], + "TypeIgnore": [ + "va_list", + "stat" + ], + "Rename": { + "_llcppg_flock_type": "FlockT", + "_llcppg_wait_type": "WaitStatus" + }, + "MacroIgnore": [ + "EAGAIN", + "F_GETFL", + "F_SETFL", + "O_ACCMODE", + "O_CREAT", + "O_NONBLOCK", + "O_RDONLY", + "O_RDWR", + "O_TRUNC", + "O_WRONLY", + "PATH_MAX" + ] +} diff --git a/c/os/llcppg.cfg b/c/os/llcppg.cfg new file mode 100644 index 00000000..8a3f6a7f --- /dev/null +++ b/c/os/llcppg.cfg @@ -0,0 +1,142 @@ +{ + "Name": "os", + "Language": "c", + "Dir": ".sysroot/include", + "Stdlib": ".sysroot/stdlib", + "Files": [ + "llcppg.h" + ], + "Deps": [ + "..", + "../signal", + "../sys", + "../time" + ], + "FailFast": 0, + "FuncIgnore": [ + "__fxstat", + "__fxstat64", + "__fxstatat", + "__fxstatat64", + "__lxstat", + "__lxstat64", + "__xstat", + "__xstat64", + "add_profil", + "alloca", + "chdir", + "chmod", + "chown", + "chroot", + "close", + "closedir", + "creat", + "dup", + "dup2", + "dup3", + "execl", + "execle", + "execlp", + "execv", + "execve", + "execvp", + "exit", + "faccessat", + "fchdir", + "fchmod", + "fchmodat", + "fchown", + "fchownat", + "fcntl", + "fdopendir", + "fork", + "fstat", + "fstatat", + "fstatx_np", + "fsync", + "ftruncate", + "getcwd", + "getdirentries", + "getegid", + "getenv", + "geteuid", + "getgid", + "getpid", + "getppid", + "getrlimit", + "getuid", + "if_nameindex", + "isatty", + "kill", + "lchown", + "link", + "llgoClearenv", + "llgoErrno", + "longjmperror", + "lseek", + "lstat", + "lstatx_np", + "mkdir", + "mkfifo", + "mknod", + "open", + "openat", + "opendir", + "pfctlinput", + "pipe", + "profil", + "putenv", + "read", + "readdir", + "readlink", + "remove", + "rename", + "rmdir", + "setenv", + "setgrfile", + "setrlimit", + "sigaction", + "sigvec", + "stat", + "statvfs", + "statx_np", + "symlink", + "syscall", + "sysctl", + "sysctlbyname", + "sysctlnametomib", + "truncate", + "umask", + "unlink", + "unlinkat", + "unsetenv", + "unwhiteout", + "wait", + "wait3", + "wait4", + "waitpid", + "write" + ], + "TypeIgnore": [ + "va_list", + "stat", + "glob_t" + ], + "Rename": { + "_llcppg_flock_type": "FlockT", + "_llcppg_wait_type": "WaitStatus" + }, + "MacroIgnore": [ + "EAGAIN", + "F_GETFL", + "F_SETFL", + "O_ACCMODE", + "O_CREAT", + "O_NONBLOCK", + "O_RDONLY", + "O_RDWR", + "O_TRUNC", + "O_WRONLY", + "PATH_MAX" + ] +} diff --git a/c/os/llcppg.pub b/c/os/llcppg.pub index de9cdec1..fd78191c 100644 --- a/c/os/llcppg.pub +++ b/c/os/llcppg.pub @@ -1,74 +1,233 @@ -D github.com/goplus/lib/c D github.com/goplus/lib/c/signal D github.com/goplus/lib/c/sys D github.com/goplus/lib/c/time T DIR DIR T Dl_info DlInfo +T __blkcnt64_t X__Blkcnt64T +T __blkcnt_t X__BlkcntT +T __blksize_t X__BlksizeT +T __caddr_t X__CaddrT +T __clock_t X__ClockT +T __clockid_t X__ClockidT +T __cpu_mask X__CpuMask +T __daddr_t X__DaddrT +T __darwin_blkcnt_t X__DarwinBlkcntT +T __darwin_blksize_t X__DarwinBlksizeT +T __darwin_clock_t X__DarwinClockT +T __darwin_ct_rune_t X__DarwinCtRuneT +T __darwin_dev_t X__DarwinDevT T __darwin_fsblkcnt_t X__DarwinFsblkcntT T __darwin_fsfilcnt_t X__DarwinFsfilcntT +T __darwin_gid_t X__DarwinGidT T __darwin_id_t X__DarwinIdT +T __darwin_ino64_t X__DarwinIno64T +T __darwin_ino_t X__DarwinInoT +T __darwin_intptr_t X__DarwinIntptrT +T __darwin_mach_port_name_t X__DarwinMachPortNameT +T __darwin_mach_port_t X__DarwinMachPortT +T __darwin_mbstate_t X__DarwinMbstateT +T __darwin_mode_t X__DarwinModeT +T __darwin_natural_t X__DarwinNaturalT +T __darwin_off_t X__DarwinOffT +T __darwin_pid_t X__DarwinPidT +T __darwin_ptrdiff_t X__DarwinPtrdiffT +T __darwin_rune_t X__DarwinRuneT +T __darwin_sigset_t X__DarwinSigsetT +T __darwin_size_t X__DarwinSizeT +T __darwin_socklen_t X__DarwinSocklenT +T __darwin_ssize_t X__DarwinSsizeT +T __darwin_suseconds_t X__DarwinSusecondsT T __darwin_time_t X__DarwinTimeT +T __darwin_uid_t X__DarwinUidT T __darwin_useconds_t X__DarwinUsecondsT +T __darwin_uuid_string_t X__DarwinUuidStringT T __darwin_uuid_t X__DarwinUuidT +T __darwin_wchar_t X__DarwinWcharT +T __darwin_wint_t X__DarwinWintT T __dev_t X__DevT +T __dirstream X__Dirstream +T __fsblkcnt64_t X__Fsblkcnt64T T __fsblkcnt_t X__FsblkcntT +T __fsfilcnt64_t X__Fsfilcnt64T T __fsfilcnt_t X__FsfilcntT +T __fsid_t X__FsidT +T __fsword_t X__FswordT +T __gid_t X__GidT T __id_t X__IdT +T __ino64_t X__Ino64T +T __ino_t X__InoT +T __int16_t X__Int16T +T __int32_t X__Int32T +T __int64_t X__Int64T +T __int8_t X__Int8T +T __intptr_t X__IntptrT +T __key_t X__KeyT +T __loff_t X__LoffT +T __mbstate_t X__MbstateT T __mode_t X__ModeT +T __nlink_t X__NlinkT +T __off64_t X__Off64T T __off_t X__OffT +T __pid_t X__PidT +T __priority_which X__PriorityWhich T __priority_which_t X__PriorityWhichT +T __qaddr_t X__QaddrT +T __quad_t X__QuadT +T __rlim64_t X__Rlim64T +T __rlim_t X__RlimT +T __rlimit_resource X__RlimitResource +T __rlimit_resource_t X__RlimitResourceT +T __rusage_who X__RusageWho T __rusage_who_t X__RusageWhoT -T __siginfo X__Siginfo +T __sched_param X__SchedParam T __size_t X__SizeT +T __socklen_t X__SocklenT T __spawn_action X__SpawnAction T __ssize_t X__SsizeT +T __suseconds_t X__SusecondsT T __syscall_slong_t X__SyscallSlongT +T __syscall_ulong_t X__SyscallUlongT T __time_t X__TimeT +T __timer_t X__TimerT +T __u_char X__UChar +T __u_int X__UInt +T __u_long X__ULong +T __u_quad_t X__UQuadT +T __u_short X__UShort +T __uid_t X__UidT +T __uint16_t X__Uint16T +T __uint32_t X__Uint32T +T __uint64_t X__Uint64T +T __uint8_t X__Uint8T T __useconds_t X__UsecondsT T _filesec X_filesec -T accessx_descriptor AccessxDescriptor +T _telldir X_telldir +T blkcnt_t BlkcntT +T blksize_t BlksizeT +T caddr_t CaddrT T cc_t CcT -T cpu_subtype_t CpuSubtypeT -T cpu_type_t CpuTypeT +T clock_t ClockT +T cpu_set_t CpuSetT +T daddr_t DaddrT T dev_t DevT T dirent Dirent T dl_info DlInfo -T exception_behavior_t ExceptionBehaviorT -T exception_mask_t ExceptionMaskT +T errno_t ErrnoT +T fattributiontag Fattributiontag +T fattributiontag_t FattributiontagT +T fchecklv Fchecklv +T fchecklv_t FchecklvT +T fd_mask FdMask +T fd_set FdSet +T fgetsigsinfo Fgetsigsinfo +T fgetsigsinfo_t FgetsigsinfoT T filesec_property_t FilesecPropertyT T filesec_t FilesecT +T fixpt_t FixptT +T flock FlockT +T flocktimeout Flocktimeout +T fpunchhole Fpunchhole +T fpunchhole_t FpunchholeT T fsblkcnt_t FsblkcntT T fsfilcnt_t FsfilcntT +T fsid Fsid +T fsid_t FsidT +T fsignatures Fsignatures +T fsignatures_t FsignaturesT +T fsobj_id FsobjId +T fsobj_id_t FsobjIdT +T fspecread Fspecread +T fspecread_t FspecreadT T fssearchblock Fssearchblock +T fstore Fstore +T fstore_t FstoreT +T fsupplement Fsupplement +T fsupplement_t FsupplementT +T ftrimactivefile Ftrimactivefile +T ftrimactivefile_t FtrimactivefileT T gid_t GidT T glob_t GlobT T group Group T id_t IdT T idtype_t IdtypeT -T integer_t IntegerT +T in_addr_t InAddrT +T in_port_t InPortT +T ino64_t Ino64T +T ino_t InoT +T int16_t Int16T +T int32_t Int32T +T int64_t Int64T +T int8_t Int8T +T intptr_t IntptrT +T kauth_cred_t KauthCredT +T key_t KeyT +T loff_t LoffT +T log2phys Log2phys T mach_port_t MachPortT T mode_t ModeT +T nlink_t NlinkT T off_t OffT +T ostat Ostat T passwd Passwd T pid_t PidT +T posix_cred PosixCred +T posix_cred_t PosixCredT T posix_spawn_file_actions_t PosixSpawnFileActionsT T posix_spawnattr_t PosixSpawnattrT +T proc_rlimit_control_wakeupmon ProcRlimitControlWakeupmon +T qaddr_t QaddrT +T quad_t QuadT +T radvisory Radvisory +T register_t RegisterT +T rlim_t RlimT +T rlimit Rlimit +T rsize_t RsizeT T rusage Rusage +T rusage_info_current RusageInfoCurrent +T rusage_info_t RusageInfoT +T rusage_info_v0 RusageInfoV0 +T rusage_info_v1 RusageInfoV1 +T rusage_info_v2 RusageInfoV2 +T rusage_info_v3 RusageInfoV3 +T rusage_info_v4 RusageInfoV4 +T rusage_info_v5 RusageInfoV5 +T rusage_info_v6 RusageInfoV6 T sched_param SchedParam T searchstate Searchstate +T segsz_t SegszT T semaphore_t SemaphoreT -T siginfo_t SiginfoT -T sigval Sigval +T size_t SizeT +T socklen_t SocklenT T speed_t SpeedT +T ssize_t SsizeT T stat StatT T statvfs Statvfs +T suseconds_t SusecondsT +T swblk_t SwblkT T tcflag_t TcflagT T termios Termios -T thread_state_flavor_t ThreadStateFlavorT +T time_t TimeT +T timespec Timespec +T timeval Timeval T tms Tms +T u_char UChar +T u_int UInt +T u_int16_t UInt16T +T u_int32_t UInt32T +T u_int64_t UInt64T +T u_int8_t UInt8T +T u_long ULong +T u_quad_t UQuadT +T u_short UShort +T ucred Ucred T uid_t UidT +T uint Uint +T uintptr_t UintptrT T uio_rw UioRw +T ulong Ulong T useconds_t UsecondsT +T ushort Ushort T utimbuf Utimbuf T utsname Utsname T uuid_t UuidT +T wait WaitStatus diff --git a/c/os/llcppg_darwin_arm64.go b/c/os/llcppg_darwin_arm64.go new file mode 100644 index 00000000..e1b975fd --- /dev/null +++ b/c/os/llcppg_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type SemaphoreT = MachPortT diff --git a/c/os/pwd_darwin_arm64.go b/c/os/pwd_darwin_arm64.go new file mode 100644 index 00000000..374d0483 --- /dev/null +++ b/c/os/pwd_darwin_arm64.go @@ -0,0 +1,92 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const ( + X_PATH_PWD = "/etc" + X_PATH_PASSWD = "/etc/passwd" + X_PASSWD = "passwd" + X_PATH_MASTERPASSWD = "/etc/master.passwd" + X_PATH_MASTERPASSWD_LOCK = "/etc/ptmp" + X_MASTERPASSWD = "master.passwd" +) +const ( + X_PATH_MP_DB = "/etc/pwd.db" + X_MP_DB = "pwd.db" + X_PATH_SMP_DB = "/etc/spwd.db" + X_SMP_DB = "spwd.db" +) +const X_PATH_PWD_MKDB = "/usr/sbin/pwd_mkdb" + +// max length, not counting NULL +const X_PASSWORD_LEN = 128 +const ( + // flag for no specified uid. + X_PASSWORD_NOUID = 1 + // flag for no specified gid. + X_PASSWORD_NOGID = 2 + // flag for no specified change. + X_PASSWORD_NOCHG = 4 + // flag for no specified expire. + X_PASSWORD_NOEXP = 8 +) +const ( + // days to warn about expiry + X_PASSWORD_WARNDAYS = 14 + // special day to force password + // change at next login + X_PASSWORD_CHGNOW = -1 +) + +type Passwd struct { + PwName *c.Char + PwPasswd *c.Char + PwUid UidT + PwGid GidT + PwChange X__DarwinTimeT + PwClass *c.Char + PwGecos *c.Char + PwDir *c.Char + PwShell *c.Char + PwExpire X__DarwinTimeT +} + +//go:linkname Getpwuid C.getpwuid +func Getpwuid(_llcppg_param1 UidT) *Passwd + +//go:linkname Getpwnam C.getpwnam +func Getpwnam(_llcppg_param1 *c.Char) *Passwd + +//go:linkname GetpwuidR C.getpwuid_r +func GetpwuidR(_llcppg_param1 UidT, _llcppg_param2 *Passwd, _llcppg_param3 *c.Char, _llcppg_param4 SizeT, _llcppg_param5 **Passwd) c.Int + +//go:linkname GetpwnamR C.getpwnam_r +func GetpwnamR(_llcppg_param1 *c.Char, _llcppg_param2 *Passwd, _llcppg_param3 *c.Char, _llcppg_param4 SizeT, _llcppg_param5 **Passwd) c.Int + +//go:linkname Getpwent C.getpwent +func Getpwent() *Passwd + +//go:linkname Setpwent C.setpwent +func Setpwent() + +//go:linkname Endpwent C.endpwent +func Endpwent() + +//go:linkname Setpassent C.setpassent +func Setpassent(_llcppg_param1 c.Int) c.Int + +//go:linkname UserFromUid C.user_from_uid +func UserFromUid(_llcppg_param1 UidT, _llcppg_param2 c.Int) *c.Char + +//go:linkname Getpwuuid C.getpwuuid +func Getpwuuid(_llcppg_param1 UuidT) *Passwd + +//go:linkname GetpwuuidR C.getpwuuid_r +func GetpwuuidR(_llcppg_param1 UuidT, _llcppg_param2 *Passwd, _llcppg_param3 *c.Char, _llcppg_param4 SizeT, _llcppg_param5 **Passwd) c.Int diff --git a/c/os/pwd_linux_amd64.go b/c/os/pwd_linux_amd64.go new file mode 100644 index 00000000..a58e9b2f --- /dev/null +++ b/c/os/pwd_linux_amd64.go @@ -0,0 +1,116 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_PWD_H = 1 + +// Reasonable value for the buffer sized used in the reentrant +// functions below. But better use `sysconf'. +const NSS_BUFLEN_PASSWD = 1024 + +// The passwd structure. +type Passwd struct { + PwName *c.Char + PwPasswd *c.Char + PwUid X__UidT + PwGid X__GidT + PwGecos *c.Char + PwDir *c.Char + PwShell *c.Char +} + +// Rewind the password-file stream. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Setpwent C.setpwent +func Setpwent() + +// Close the password-file stream. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endpwent C.endpwent +func Endpwent() + +// Read an entry from the password-file stream, opening it if necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getpwent C.getpwent +func Getpwent() *Passwd + +// Read an entry from STREAM. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Fgetpwent C.fgetpwent +func Fgetpwent(__stream *c.FILE) *Passwd + +// Write the given entry onto the given stream. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +// llgo:link (*Passwd).Putpwent C.putpwent +func (self *Passwd) Putpwent(__f *c.FILE) c.Int { + return 0 +} + +// Search for an entry with a matching user ID. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getpwuid C.getpwuid +func Getpwuid(__uid X__UidT) *Passwd + +// Search for an entry with a matching username. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getpwnam C.getpwnam +func Getpwnam(__name *c.Char) *Passwd + +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +// llgo:link (*Passwd).GetpwentR C.getpwent_r +func (self *Passwd) GetpwentR(__buffer *c.Char, __buflen SizeT, __result **Passwd) c.Int { + return 0 +} + +//go:linkname GetpwuidR C.getpwuid_r +func GetpwuidR(__uid X__UidT, __resultbuf *Passwd, __buffer *c.Char, __buflen SizeT, __result **Passwd) c.Int + +//go:linkname GetpwnamR C.getpwnam_r +func GetpwnamR(__name *c.Char, __resultbuf *Passwd, __buffer *c.Char, __buflen SizeT, __result **Passwd) c.Int + +// Read an entry from STREAM. This function is not standardized and +// probably never will. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname FgetpwentR C.fgetpwent_r +func FgetpwentR(__stream *c.FILE, __resultbuf *Passwd, __buffer *c.Char, __buflen SizeT, __result **Passwd) c.Int diff --git a/c/os/pwd_linux_arm64.go b/c/os/pwd_linux_arm64.go new file mode 100644 index 00000000..1093f2e8 --- /dev/null +++ b/c/os/pwd_linux_arm64.go @@ -0,0 +1,116 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_PWD_H = 1 + +// Reasonable value for the buffer sized used in the reentrant +// functions below. But better use `sysconf'. +const NSS_BUFLEN_PASSWD = 1024 + +// The passwd structure. +type Passwd struct { + PwName *uint8 + PwPasswd *uint8 + PwUid X__UidT + PwGid X__GidT + PwGecos *uint8 + PwDir *uint8 + PwShell *uint8 +} + +// Rewind the password-file stream. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Setpwent C.setpwent +func Setpwent() + +// Close the password-file stream. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endpwent C.endpwent +func Endpwent() + +// Read an entry from the password-file stream, opening it if necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getpwent C.getpwent +func Getpwent() *Passwd + +// Read an entry from STREAM. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Fgetpwent C.fgetpwent +func Fgetpwent(__stream *c.FILE) *Passwd + +// Write the given entry onto the given stream. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +// llgo:link (*Passwd).Putpwent C.putpwent +func (self *Passwd) Putpwent(__f *c.FILE) c.Int { + return 0 +} + +// Search for an entry with a matching user ID. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getpwuid C.getpwuid +func Getpwuid(__uid X__UidT) *Passwd + +// Search for an entry with a matching username. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getpwnam C.getpwnam +func Getpwnam(__name *uint8) *Passwd + +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +// llgo:link (*Passwd).GetpwentR C.getpwent_r +func (self *Passwd) GetpwentR(__buffer *uint8, __buflen SizeT, __result **Passwd) c.Int { + return 0 +} + +//go:linkname GetpwuidR C.getpwuid_r +func GetpwuidR(__uid X__UidT, __resultbuf *Passwd, __buffer *uint8, __buflen SizeT, __result **Passwd) c.Int + +//go:linkname GetpwnamR C.getpwnam_r +func GetpwnamR(__name *uint8, __resultbuf *Passwd, __buffer *uint8, __buflen SizeT, __result **Passwd) c.Int + +// Read an entry from STREAM. This function is not standardized and +// probably never will. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname FgetpwentR C.fgetpwent_r +func FgetpwentR(__stream *c.FILE, __resultbuf *Passwd, __buffer *uint8, __buflen SizeT, __result **Passwd) c.Int diff --git a/c/os/sched_darwin_arm64.go b/c/os/sched_darwin_arm64.go new file mode 100644 index 00000000..3a271ee2 --- /dev/null +++ b/c/os/sched_darwin_arm64.go @@ -0,0 +1,24 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +type SchedParam struct { + SchedPriority c.Int + X__Opaque [4]c.Char +} + +//go:linkname SchedYield C.sched_yield +func SchedYield() c.Int + +//go:linkname SchedGetPriorityMin C.sched_get_priority_min +func SchedGetPriorityMin(_llcppg_param1 c.Int) c.Int + +//go:linkname SchedGetPriorityMax C.sched_get_priority_max +func SchedGetPriorityMax(_llcppg_param1 c.Int) c.Int diff --git a/c/os/sched_linux_amd64.go b/c/os/sched_linux_amd64.go new file mode 100644 index 00000000..614116ea --- /dev/null +++ b/c/os/sched_linux_amd64.go @@ -0,0 +1,53 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "github.com/goplus/lib/c/time" + _ "unsafe" +) + +const X_SCHED_H = 1 + +// Set scheduling parameters for a process. +// +//go:linkname SchedSetparam C.sched_setparam +func SchedSetparam(__pid X__PidT, __param *SchedParam) c.Int + +// Retrieve scheduling parameters for a particular process. +// +//go:linkname SchedGetparam C.sched_getparam +func SchedGetparam(__pid X__PidT, __param *SchedParam) c.Int + +// Set scheduling algorithm and/or parameters for a process. +// +//go:linkname SchedSetscheduler C.sched_setscheduler +func SchedSetscheduler(__pid X__PidT, __policy c.Int, __param *SchedParam) c.Int + +// Retrieve scheduling algorithm for a particular purpose. +// +//go:linkname SchedGetscheduler C.sched_getscheduler +func SchedGetscheduler(__pid X__PidT) c.Int + +// Yield the processor. +// +//go:linkname SchedYield C.sched_yield +func SchedYield() c.Int + +// Get maximum priority value for a scheduler. +// +//go:linkname SchedGetPriorityMax C.sched_get_priority_max +func SchedGetPriorityMax(__algorithm c.Int) c.Int + +// Get minimum priority value for a scheduler. +// +//go:linkname SchedGetPriorityMin C.sched_get_priority_min +func SchedGetPriorityMin(__algorithm c.Int) c.Int + +// Get the SCHED_RR interval for the named process. +// +//go:linkname SchedRrGetInterval C.sched_rr_get_interval +func SchedRrGetInterval(__pid X__PidT, __t *time.Timespec) c.Int diff --git a/c/os/sched_linux_arm64.go b/c/os/sched_linux_arm64.go new file mode 100644 index 00000000..be21490f --- /dev/null +++ b/c/os/sched_linux_arm64.go @@ -0,0 +1,53 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "github.com/goplus/lib/c/time" + _ "unsafe" +) + +const X_SCHED_H = 1 + +// Set scheduling parameters for a process. +// +//go:linkname SchedSetparam C.sched_setparam +func SchedSetparam(__pid X__PidT, __param *SchedParam) c.Int + +// Retrieve scheduling parameters for a particular process. +// +//go:linkname SchedGetparam C.sched_getparam +func SchedGetparam(__pid X__PidT, __param *SchedParam) c.Int + +// Set scheduling algorithm and/or parameters for a process. +// +//go:linkname SchedSetscheduler C.sched_setscheduler +func SchedSetscheduler(__pid X__PidT, __policy c.Int, __param *SchedParam) c.Int + +// Retrieve scheduling algorithm for a particular purpose. +// +//go:linkname SchedGetscheduler C.sched_getscheduler +func SchedGetscheduler(__pid X__PidT) c.Int + +// Yield the processor. +// +//go:linkname SchedYield C.sched_yield +func SchedYield() c.Int + +// Get maximum priority value for a scheduler. +// +//go:linkname SchedGetPriorityMax C.sched_get_priority_max +func SchedGetPriorityMax(__algorithm c.Int) c.Int + +// Get minimum priority value for a scheduler. +// +//go:linkname SchedGetPriorityMin C.sched_get_priority_min +func SchedGetPriorityMin(__algorithm c.Int) c.Int + +// Get the SCHED_RR interval for the named process. +// +//go:linkname SchedRrGetInterval C.sched_rr_get_interval +func SchedRrGetInterval(__pid X__PidT, __t *time.Timespec) c.Int diff --git a/c/os/sched_param_linux_amd64.go b/c/os/sched_param_linux_amd64.go deleted file mode 100644 index f0cfe961..00000000 --- a/c/os/sched_param_linux_amd64.go +++ /dev/null @@ -1,12 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -// Data structure to describe a process' schedulability. -type SchedParam struct { - SchedPriority c.Int -} diff --git a/c/os/spawn_darwin_arm64.go b/c/os/spawn_darwin_arm64.go new file mode 100644 index 00000000..1fd440c3 --- /dev/null +++ b/c/os/spawn_darwin_arm64.go @@ -0,0 +1,145 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "github.com/goplus/lib/c/signal" + _ "unsafe" +) + +// flags for CPU Security Mitigation attribute +// POSIX_SPAWN_NP_CSM_ALL should be used in most cases, +// the individual flags are provided only for performance evaluation etc +const ( + POSIX_SPAWN_NP_CSM_ALL = 1 + POSIX_SPAWN_NP_CSM_NOSMT = 2 + POSIX_SPAWN_NP_CSM_TECS = 4 +) + +// Opaque types for use with posix_spawn() family functions. Internals are +// not defined, and should not be accessed directly. Types are defined as +// mandated by POSIX. +type PosixSpawnattrT uintptr +type PosixSpawnFileActionsT uintptr + +//go:linkname PosixSpawn C.posix_spawn +func PosixSpawn(_llcppg_param1 *PidT, _llcppg_param2 *c.Char, _llcppg_param3 *PosixSpawnFileActionsT, _llcppg_param4 *PosixSpawnattrT, __argv **c.Char, __envp **c.Char) c.Int + +//go:linkname PosixSpawnp C.posix_spawnp +func PosixSpawnp(_llcppg_param1 *PidT, _llcppg_param2 *c.Char, _llcppg_param3 *PosixSpawnFileActionsT, _llcppg_param4 *PosixSpawnattrT, __argv **c.Char, __envp **c.Char) c.Int + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddclose C.posix_spawn_file_actions_addclose +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddclose(_llcppg_param2 c.Int) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAdddup2 C.posix_spawn_file_actions_adddup2 +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAdddup2(_llcppg_param2 c.Int, _llcppg_param3 c.Int) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddopen C.posix_spawn_file_actions_addopen +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddopen(_llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 c.Int, _llcppg_param5 ModeT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsDestroy C.posix_spawn_file_actions_destroy +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsDestroy() c.Int { + return 0 +} + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsInit C.posix_spawn_file_actions_init +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsInit() c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrDestroy C.posix_spawnattr_destroy +func (self *PosixSpawnattrT) PosixSpawnattrDestroy() c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigdefault C.posix_spawnattr_getsigdefault +func (self *PosixSpawnattrT) PosixSpawnattrGetsigdefault(_llcppg_param2 *signal.SigsetT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetflags C.posix_spawnattr_getflags +func (self *PosixSpawnattrT) PosixSpawnattrGetflags(_llcppg_param2 *int16) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetpgroup C.posix_spawnattr_getpgroup +func (self *PosixSpawnattrT) PosixSpawnattrGetpgroup(_llcppg_param2 *PidT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigmask C.posix_spawnattr_getsigmask +func (self *PosixSpawnattrT) PosixSpawnattrGetsigmask(_llcppg_param2 *signal.SigsetT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrInit C.posix_spawnattr_init +func (self *PosixSpawnattrT) PosixSpawnattrInit() c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigdefault C.posix_spawnattr_setsigdefault +func (self *PosixSpawnattrT) PosixSpawnattrSetsigdefault(_llcppg_param2 *signal.SigsetT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetflags C.posix_spawnattr_setflags +func (self *PosixSpawnattrT) PosixSpawnattrSetflags(_llcppg_param2 int16) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetpgroup C.posix_spawnattr_setpgroup +func (self *PosixSpawnattrT) PosixSpawnattrSetpgroup(_llcppg_param2 PidT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigmask C.posix_spawnattr_setsigmask +func (self *PosixSpawnattrT) PosixSpawnattrSetsigmask(_llcppg_param2 *signal.SigsetT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetauditsessionportNp C.posix_spawnattr_setauditsessionport_np +func (self *PosixSpawnattrT) PosixSpawnattrSetauditsessionportNp(_llcppg_param2 MachPortT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetspecialportNp C.posix_spawnattr_setspecialport_np +func (self *PosixSpawnattrT) PosixSpawnattrSetspecialportNp(_llcppg_param2 MachPortT, _llcppg_param3 c.Int) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetnosmtNp C.posix_spawnattr_setnosmt_np +func (self *PosixSpawnattrT) PosixSpawnattrSetnosmtNp() c.Int { + return 0 +} + +// Set CPU Security Mitigation on the spawned process +// This attribute affects all threads and is inherited on fork and exec +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetCsmNp C.posix_spawnattr_set_csm_np +func (self *PosixSpawnattrT) PosixSpawnattrSetCsmNp(flags c.Uint32T) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddinheritNp C.posix_spawn_file_actions_addinherit_np +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddinheritNp(_llcppg_param2 c.Int) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddchdirNp C.posix_spawn_file_actions_addchdir_np +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddchdirNp(_llcppg_param2 *c.Char) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddfchdirNp C.posix_spawn_file_actions_addfchdir_np +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddfchdirNp(_llcppg_param2 c.Int) c.Int { + return 0 +} diff --git a/c/os/spawn_linux_amd64.go b/c/os/spawn_linux_amd64.go new file mode 100644 index 00000000..87386ab1 --- /dev/null +++ b/c/os/spawn_linux_amd64.go @@ -0,0 +1,199 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "github.com/goplus/lib/c/signal" + _ "unsafe" +) + +const X_SPAWN_H = 1 + +// Flags to be set in the `posix_spawnattr_t'. +const ( + POSIX_SPAWN_RESETIDS = 1 + POSIX_SPAWN_SETPGROUP = 2 + POSIX_SPAWN_SETSIGDEF = 4 + POSIX_SPAWN_SETSIGMASK = 8 + POSIX_SPAWN_SETSCHEDPARAM = 16 + POSIX_SPAWN_SETSCHEDULER = 32 +) + +// Data structure to contain attributes for thread creation. +type PosixSpawnattrT struct { + X__Flags int16 + X__Pgrp signal.PidT + X__Sd signal.SigsetT + X__Ss signal.SigsetT + X__Sp SchedParam + X__Policy c.Int + X__Pad [16]c.Int +} + +// Data structure to contain information about the actions to be +// performed in the new process with respect to file descriptors. +type PosixSpawnFileActionsT struct { + X__Allocated c.Int + X__Used c.Int + X__Actions *X__SpawnAction + X__Pad [16]c.Int +} +type X__SpawnAction struct { +} + +// Spawn a new process executing PATH with the attributes describes in *ATTRP. +// Before running the process perform the actions described in FILE-ACTIONS. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname PosixSpawn C.posix_spawn +func PosixSpawn(__pid *signal.PidT, __path *c.Char, __file_actions *PosixSpawnFileActionsT, __attrp *PosixSpawnattrT, __argv **c.Char, __envp **c.Char) c.Int + +// Similar to `posix_spawn' but search for FILE in the PATH. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname PosixSpawnp C.posix_spawnp +func PosixSpawnp(__pid *signal.PidT, __file *c.Char, __file_actions *PosixSpawnFileActionsT, __attrp *PosixSpawnattrT, __argv **c.Char, __envp **c.Char) c.Int + +// Initialize data structure with attributes for `spawn' to default values. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrInit C.posix_spawnattr_init +func (self *PosixSpawnattrT) PosixSpawnattrInit() c.Int { + return 0 +} + +// Free resources associated with ATTR. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrDestroy C.posix_spawnattr_destroy +func (self *PosixSpawnattrT) PosixSpawnattrDestroy() c.Int { + return 0 +} + +// Store signal mask for signals with default handling from ATTR in +// SIGDEFAULT. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigdefault C.posix_spawnattr_getsigdefault +func (self *PosixSpawnattrT) PosixSpawnattrGetsigdefault(__sigdefault *signal.SigsetT) c.Int { + return 0 +} + +// Set signal mask for signals with default handling in ATTR to SIGDEFAULT. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigdefault C.posix_spawnattr_setsigdefault +func (self *PosixSpawnattrT) PosixSpawnattrSetsigdefault(__sigdefault *signal.SigsetT) c.Int { + return 0 +} + +// Store signal mask for the new process from ATTR in SIGMASK. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigmask C.posix_spawnattr_getsigmask +func (self *PosixSpawnattrT) PosixSpawnattrGetsigmask(__sigmask *signal.SigsetT) c.Int { + return 0 +} + +// Set signal mask for the new process in ATTR to SIGMASK. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigmask C.posix_spawnattr_setsigmask +func (self *PosixSpawnattrT) PosixSpawnattrSetsigmask(__sigmask *signal.SigsetT) c.Int { + return 0 +} + +// Get flag word from the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetflags C.posix_spawnattr_getflags +func (self *PosixSpawnattrT) PosixSpawnattrGetflags(__flags *int16) c.Int { + return 0 +} + +// Store flags in the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetflags C.posix_spawnattr_setflags +func (self *PosixSpawnattrT) PosixSpawnattrSetflags(__flags int16) c.Int { + return 0 +} + +// Get process group ID from the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetpgroup C.posix_spawnattr_getpgroup +func (self *PosixSpawnattrT) PosixSpawnattrGetpgroup(__pgroup *signal.PidT) c.Int { + return 0 +} + +// Store process group ID in the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetpgroup C.posix_spawnattr_setpgroup +func (self *PosixSpawnattrT) PosixSpawnattrSetpgroup(__pgroup signal.PidT) c.Int { + return 0 +} + +// Get scheduling policy from the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetschedpolicy C.posix_spawnattr_getschedpolicy +func (self *PosixSpawnattrT) PosixSpawnattrGetschedpolicy(__schedpolicy *c.Int) c.Int { + return 0 +} + +// Store scheduling policy in the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetschedpolicy C.posix_spawnattr_setschedpolicy +func (self *PosixSpawnattrT) PosixSpawnattrSetschedpolicy(__schedpolicy c.Int) c.Int { + return 0 +} + +// Get scheduling parameters from the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetschedparam C.posix_spawnattr_getschedparam +func (self *PosixSpawnattrT) PosixSpawnattrGetschedparam(__schedparam *SchedParam) c.Int { + return 0 +} + +// Store scheduling parameters in the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetschedparam C.posix_spawnattr_setschedparam +func (self *PosixSpawnattrT) PosixSpawnattrSetschedparam(__schedparam *SchedParam) c.Int { + return 0 +} + +// Initialize data structure for file attribute for `spawn' call. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsInit C.posix_spawn_file_actions_init +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsInit() c.Int { + return 0 +} + +// Free resources associated with FILE-ACTIONS. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsDestroy C.posix_spawn_file_actions_destroy +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsDestroy() c.Int { + return 0 +} + +// Add an action to FILE-ACTIONS which tells the implementation to call +// `open' for the given file during the `spawn' call. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddopen C.posix_spawn_file_actions_addopen +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddopen(__fd c.Int, __path *c.Char, __oflag c.Int, __mode ModeT) c.Int { + return 0 +} + +// Add an action to FILE-ACTIONS which tells the implementation to call +// `close' for the given file descriptor during the `spawn' call. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddclose C.posix_spawn_file_actions_addclose +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddclose(__fd c.Int) c.Int { + return 0 +} + +// Add an action to FILE-ACTIONS which tells the implementation to call +// `dup2' for the given file descriptors during the `spawn' call. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAdddup2 C.posix_spawn_file_actions_adddup2 +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAdddup2(__fd c.Int, __newfd c.Int) c.Int { + return 0 +} diff --git a/c/os/spawn_linux_arm64.go b/c/os/spawn_linux_arm64.go new file mode 100644 index 00000000..0bec7603 --- /dev/null +++ b/c/os/spawn_linux_arm64.go @@ -0,0 +1,199 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "github.com/goplus/lib/c/signal" + _ "unsafe" +) + +const X_SPAWN_H = 1 + +// Flags to be set in the `posix_spawnattr_t'. +const ( + POSIX_SPAWN_RESETIDS = 1 + POSIX_SPAWN_SETPGROUP = 2 + POSIX_SPAWN_SETSIGDEF = 4 + POSIX_SPAWN_SETSIGMASK = 8 + POSIX_SPAWN_SETSCHEDPARAM = 16 + POSIX_SPAWN_SETSCHEDULER = 32 +) + +// Data structure to contain attributes for thread creation. +type PosixSpawnattrT struct { + X__Flags int16 + X__Pgrp signal.PidT + X__Sd signal.SigsetT + X__Ss signal.SigsetT + X__Sp SchedParam + X__Policy c.Int + X__Pad [16]c.Int +} + +// Data structure to contain information about the actions to be +// performed in the new process with respect to file descriptors. +type PosixSpawnFileActionsT struct { + X__Allocated c.Int + X__Used c.Int + X__Actions *X__SpawnAction + X__Pad [16]c.Int +} +type X__SpawnAction struct { +} + +// Spawn a new process executing PATH with the attributes describes in *ATTRP. +// Before running the process perform the actions described in FILE-ACTIONS. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname PosixSpawn C.posix_spawn +func PosixSpawn(__pid *signal.PidT, __path *uint8, __file_actions *PosixSpawnFileActionsT, __attrp *PosixSpawnattrT, __argv **uint8, __envp **uint8) c.Int + +// Similar to `posix_spawn' but search for FILE in the PATH. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname PosixSpawnp C.posix_spawnp +func PosixSpawnp(__pid *signal.PidT, __file *uint8, __file_actions *PosixSpawnFileActionsT, __attrp *PosixSpawnattrT, __argv **uint8, __envp **uint8) c.Int + +// Initialize data structure with attributes for `spawn' to default values. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrInit C.posix_spawnattr_init +func (self *PosixSpawnattrT) PosixSpawnattrInit() c.Int { + return 0 +} + +// Free resources associated with ATTR. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrDestroy C.posix_spawnattr_destroy +func (self *PosixSpawnattrT) PosixSpawnattrDestroy() c.Int { + return 0 +} + +// Store signal mask for signals with default handling from ATTR in +// SIGDEFAULT. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigdefault C.posix_spawnattr_getsigdefault +func (self *PosixSpawnattrT) PosixSpawnattrGetsigdefault(__sigdefault *signal.SigsetT) c.Int { + return 0 +} + +// Set signal mask for signals with default handling in ATTR to SIGDEFAULT. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigdefault C.posix_spawnattr_setsigdefault +func (self *PosixSpawnattrT) PosixSpawnattrSetsigdefault(__sigdefault *signal.SigsetT) c.Int { + return 0 +} + +// Store signal mask for the new process from ATTR in SIGMASK. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigmask C.posix_spawnattr_getsigmask +func (self *PosixSpawnattrT) PosixSpawnattrGetsigmask(__sigmask *signal.SigsetT) c.Int { + return 0 +} + +// Set signal mask for the new process in ATTR to SIGMASK. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigmask C.posix_spawnattr_setsigmask +func (self *PosixSpawnattrT) PosixSpawnattrSetsigmask(__sigmask *signal.SigsetT) c.Int { + return 0 +} + +// Get flag word from the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetflags C.posix_spawnattr_getflags +func (self *PosixSpawnattrT) PosixSpawnattrGetflags(__flags *int16) c.Int { + return 0 +} + +// Store flags in the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetflags C.posix_spawnattr_setflags +func (self *PosixSpawnattrT) PosixSpawnattrSetflags(__flags int16) c.Int { + return 0 +} + +// Get process group ID from the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetpgroup C.posix_spawnattr_getpgroup +func (self *PosixSpawnattrT) PosixSpawnattrGetpgroup(__pgroup *signal.PidT) c.Int { + return 0 +} + +// Store process group ID in the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetpgroup C.posix_spawnattr_setpgroup +func (self *PosixSpawnattrT) PosixSpawnattrSetpgroup(__pgroup signal.PidT) c.Int { + return 0 +} + +// Get scheduling policy from the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetschedpolicy C.posix_spawnattr_getschedpolicy +func (self *PosixSpawnattrT) PosixSpawnattrGetschedpolicy(__schedpolicy *c.Int) c.Int { + return 0 +} + +// Store scheduling policy in the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetschedpolicy C.posix_spawnattr_setschedpolicy +func (self *PosixSpawnattrT) PosixSpawnattrSetschedpolicy(__schedpolicy c.Int) c.Int { + return 0 +} + +// Get scheduling parameters from the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetschedparam C.posix_spawnattr_getschedparam +func (self *PosixSpawnattrT) PosixSpawnattrGetschedparam(__schedparam *SchedParam) c.Int { + return 0 +} + +// Store scheduling parameters in the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetschedparam C.posix_spawnattr_setschedparam +func (self *PosixSpawnattrT) PosixSpawnattrSetschedparam(__schedparam *SchedParam) c.Int { + return 0 +} + +// Initialize data structure for file attribute for `spawn' call. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsInit C.posix_spawn_file_actions_init +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsInit() c.Int { + return 0 +} + +// Free resources associated with FILE-ACTIONS. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsDestroy C.posix_spawn_file_actions_destroy +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsDestroy() c.Int { + return 0 +} + +// Add an action to FILE-ACTIONS which tells the implementation to call +// `open' for the given file during the `spawn' call. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddopen C.posix_spawn_file_actions_addopen +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddopen(__fd c.Int, __path *uint8, __oflag c.Int, __mode ModeT) c.Int { + return 0 +} + +// Add an action to FILE-ACTIONS which tells the implementation to call +// `close' for the given file descriptor during the `spawn' call. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddclose C.posix_spawn_file_actions_addclose +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddclose(__fd c.Int) c.Int { + return 0 +} + +// Add an action to FILE-ACTIONS which tells the implementation to call +// `dup2' for the given file descriptors during the `spawn' call. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAdddup2 C.posix_spawn_file_actions_adddup2 +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAdddup2(__fd c.Int, __newfd c.Int) c.Int { + return 0 +} diff --git a/c/os/sys-_types-_blkcnt_t_darwin_arm64.go b/c/os/sys-_types-_blkcnt_t_darwin_arm64.go new file mode 100644 index 00000000..d4d3036a --- /dev/null +++ b/c/os/sys-_types-_blkcnt_t_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type BlkcntT = X__DarwinBlkcntT diff --git a/c/os/sys-_types-_blksize_t_darwin_arm64.go b/c/os/sys-_types-_blksize_t_darwin_arm64.go new file mode 100644 index 00000000..f91c23da --- /dev/null +++ b/c/os/sys-_types-_blksize_t_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type BlksizeT = X__DarwinBlksizeT diff --git a/c/os/mach_darwin_arm64.go b/c/os/sys-_types-_caddr_t_darwin_arm64.go similarity index 54% rename from c/os/mach_darwin_arm64.go rename to c/os/sys-_types-_caddr_t_darwin_arm64.go index e526531b..f05841de 100644 --- a/c/os/mach_darwin_arm64.go +++ b/c/os/sys-_types-_caddr_t_darwin_arm64.go @@ -6,6 +6,4 @@ package os import "github.com/goplus/lib/c" -// Canonical Mach typedefs from the macOS 14.0 SDK. -type MachPortT = c.Uint -type SemaphoreT = MachPortT +type CaddrT = *c.Char diff --git a/c/os/sys-_types-_clock_t_darwin_arm64.go b/c/os/sys-_types-_clock_t_darwin_arm64.go new file mode 100644 index 00000000..82193a07 --- /dev/null +++ b/c/os/sys-_types-_clock_t_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type ClockT = X__DarwinClockT diff --git a/c/os/sys-_types-_errno_t_darwin_arm64.go b/c/os/sys-_types-_errno_t_darwin_arm64.go new file mode 100644 index 00000000..bacc4f10 --- /dev/null +++ b/c/os/sys-_types-_errno_t_darwin_arm64.go @@ -0,0 +1,9 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +type ErrnoT = c.Int diff --git a/c/os/sys-_types-_fd_def_darwin_arm64.go b/c/os/sys-_types-_fd_def_darwin_arm64.go new file mode 100644 index 00000000..d74e003a --- /dev/null +++ b/c/os/sys-_types-_fd_def_darwin_arm64.go @@ -0,0 +1,22 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const X__DARWIN_FD_SETSIZE = 1024 +const +// bits in a byte +X__DARWIN_NBBY = 8 + +type FdSet struct { + FdsBits [32]X__Int32T +} + +//go:linkname X__DarwinCheckFdSetOverflow C.__darwin_check_fd_set_overflow +func X__DarwinCheckFdSetOverflow(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 c.Int) c.Int diff --git a/c/os/sys-_types-_fd_setsize_darwin_arm64.go b/c/os/sys-_types-_fd_setsize_darwin_arm64.go new file mode 100644 index 00000000..148b9571 --- /dev/null +++ b/c/os/sys-_types-_fd_setsize_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +const FD_SETSIZE = 1024 diff --git a/c/os/sys-_types-_filesec_t_darwin_arm64.go b/c/os/sys-_types-_filesec_t_darwin_arm64.go new file mode 100644 index 00000000..3d44ce31 --- /dev/null +++ b/c/os/sys-_types-_filesec_t_darwin_arm64.go @@ -0,0 +1,9 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type X_filesec struct { +} +type FilesecT = *X_filesec diff --git a/c/os/sys-_types-_fsblkcnt_t_darwin_arm64.go b/c/os/sys-_types-_fsblkcnt_t_darwin_arm64.go new file mode 100644 index 00000000..1ea1baae --- /dev/null +++ b/c/os/sys-_types-_fsblkcnt_t_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type FsblkcntT = X__DarwinFsblkcntT diff --git a/c/os/sys-_types-_fsfilcnt_t_darwin_arm64.go b/c/os/sys-_types-_fsfilcnt_t_darwin_arm64.go new file mode 100644 index 00000000..bc35e786 --- /dev/null +++ b/c/os/sys-_types-_fsfilcnt_t_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type FsfilcntT = X__DarwinFsfilcntT diff --git a/c/os/sys-_types-_fsid_t_darwin_arm64.go b/c/os/sys-_types-_fsid_t_darwin_arm64.go new file mode 100644 index 00000000..6fcbce7f --- /dev/null +++ b/c/os/sys-_types-_fsid_t_darwin_arm64.go @@ -0,0 +1,12 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type Fsid struct { + Val [2]Int32T +} + +// file system id type +type FsidT = Fsid diff --git a/c/os/sys-_types-_fsobj_id_t_darwin_arm64.go b/c/os/sys-_types-_fsobj_id_t_darwin_arm64.go new file mode 100644 index 00000000..55a04690 --- /dev/null +++ b/c/os/sys-_types-_fsobj_id_t_darwin_arm64.go @@ -0,0 +1,11 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type FsobjId struct { + FidObjno UInt32T + FidGeneration UInt32T +} +type FsobjIdT = FsobjId diff --git a/c/os/sys-_types-_id_t_darwin_arm64.go b/c/os/sys-_types-_id_t_darwin_arm64.go new file mode 100644 index 00000000..c75c63a0 --- /dev/null +++ b/c/os/sys-_types-_id_t_darwin_arm64.go @@ -0,0 +1,8 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// can hold pid_t, gid_t, or uid_t +type IdT = X__DarwinIdT diff --git a/c/os/sys-_types-_in_addr_t_darwin_arm64.go b/c/os/sys-_types-_in_addr_t_darwin_arm64.go new file mode 100644 index 00000000..29b579ee --- /dev/null +++ b/c/os/sys-_types-_in_addr_t_darwin_arm64.go @@ -0,0 +1,8 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// base type for internet address +type InAddrT = X__Uint32T diff --git a/c/os/sys-_types-_in_port_t_darwin_arm64.go b/c/os/sys-_types-_in_port_t_darwin_arm64.go new file mode 100644 index 00000000..1e878c01 --- /dev/null +++ b/c/os/sys-_types-_in_port_t_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type InPortT = X__Uint16T diff --git a/c/os/sys-_types-_ino64_t_darwin_arm64.go b/c/os/sys-_types-_ino64_t_darwin_arm64.go new file mode 100644 index 00000000..cd251e43 --- /dev/null +++ b/c/os/sys-_types-_ino64_t_darwin_arm64.go @@ -0,0 +1,8 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// 64bit inode number +type Ino64T = X__DarwinIno64T diff --git a/c/os/sys-_types-_ino_t_darwin_arm64.go b/c/os/sys-_types-_ino_t_darwin_arm64.go new file mode 100644 index 00000000..e9c23b07 --- /dev/null +++ b/c/os/sys-_types-_ino_t_darwin_arm64.go @@ -0,0 +1,8 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// inode number +type InoT = X__DarwinInoT diff --git a/c/os/sys-_types-_int16_t_darwin_arm64.go b/c/os/sys-_types-_int16_t_darwin_arm64.go new file mode 100644 index 00000000..c25179b3 --- /dev/null +++ b/c/os/sys-_types-_int16_t_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type Int16T = int16 diff --git a/c/os/sys-_types-_int32_t_darwin_arm64.go b/c/os/sys-_types-_int32_t_darwin_arm64.go new file mode 100644 index 00000000..1f3d8db1 --- /dev/null +++ b/c/os/sys-_types-_int32_t_darwin_arm64.go @@ -0,0 +1,9 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +type Int32T = c.Int diff --git a/c/os/sys-_types-_int64_t_darwin_arm64.go b/c/os/sys-_types-_int64_t_darwin_arm64.go new file mode 100644 index 00000000..fc9ee351 --- /dev/null +++ b/c/os/sys-_types-_int64_t_darwin_arm64.go @@ -0,0 +1,9 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +type Int64T = c.LongLong diff --git a/c/os/sys-_types-_int8_t_darwin_arm64.go b/c/os/sys-_types-_int8_t_darwin_arm64.go new file mode 100644 index 00000000..2eac1d8d --- /dev/null +++ b/c/os/sys-_types-_int8_t_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type Int8T = int8 diff --git a/c/os/sys-_types-_intptr_t_darwin_arm64.go b/c/os/sys-_types-_intptr_t_darwin_arm64.go new file mode 100644 index 00000000..bc5a7fa8 --- /dev/null +++ b/c/os/sys-_types-_intptr_t_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type IntptrT = X__DarwinIntptrT diff --git a/c/os/sys-_types-_key_t_darwin_arm64.go b/c/os/sys-_types-_key_t_darwin_arm64.go new file mode 100644 index 00000000..dc57f13b --- /dev/null +++ b/c/os/sys-_types-_key_t_darwin_arm64.go @@ -0,0 +1,8 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// IPC key (for Sys V IPC) +type KeyT = X__Int32T diff --git a/c/os/sys-_types-_mach_port_t_darwin_arm64.go b/c/os/sys-_types-_mach_port_t_darwin_arm64.go new file mode 100644 index 00000000..8dbab09c --- /dev/null +++ b/c/os/sys-_types-_mach_port_t_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type MachPortT = X__DarwinMachPortT diff --git a/c/os/sys-_types-_nlink_t_darwin_arm64.go b/c/os/sys-_types-_nlink_t_darwin_arm64.go new file mode 100644 index 00000000..7cf0f3c3 --- /dev/null +++ b/c/os/sys-_types-_nlink_t_darwin_arm64.go @@ -0,0 +1,8 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// link count +type NlinkT = X__Uint16T diff --git a/c/os/sys-_types-_o_dsync_darwin_arm64.go b/c/os/sys-_types-_o_dsync_darwin_arm64.go new file mode 100644 index 00000000..f6c9067b --- /dev/null +++ b/c/os/sys-_types-_o_dsync_darwin_arm64.go @@ -0,0 +1,8 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// synch I/O data integrity +const O_DSYNC = 4194304 diff --git a/c/os/sys-_types-_o_sync_darwin_arm64.go b/c/os/sys-_types-_o_sync_darwin_arm64.go new file mode 100644 index 00000000..07c9ec09 --- /dev/null +++ b/c/os/sys-_types-_o_sync_darwin_arm64.go @@ -0,0 +1,8 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// synch I/O file integrity +const O_SYNC = 128 diff --git a/c/os/sys-_types-_rsize_t_darwin_arm64.go b/c/os/sys-_types-_rsize_t_darwin_arm64.go new file mode 100644 index 00000000..dfe00aad --- /dev/null +++ b/c/os/sys-_types-_rsize_t_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type RsizeT = X__DarwinSizeT diff --git a/c/os/sys-_types-_s_ifmt_darwin_arm64.go b/c/os/sys-_types-_s_ifmt_darwin_arm64.go new file mode 100644 index 00000000..4be6fee9 --- /dev/null +++ b/c/os/sys-_types-_s_ifmt_darwin_arm64.go @@ -0,0 +1,78 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// File type +const ( + S_IFMT = 61440 + // [XSI] named pipe (fifo) + S_IFIFO = 4096 + // [XSI] character special + S_IFCHR = 8192 + // [XSI] directory + S_IFDIR = 16384 + // [XSI] block special + S_IFBLK = 24576 + // [XSI] regular + S_IFREG = 32768 + // [XSI] symbolic link + S_IFLNK = 40960 + // [XSI] socket + S_IFSOCK = 49152 +) + +// OBSOLETE: whiteout +const S_IFWHT = 57344 + +// Read, write, execute/search by owner +const ( + S_IRWXU = 448 + // [XSI] R for owner + S_IRUSR = 256 + // [XSI] W for owner + S_IWUSR = 128 + // [XSI] X for owner + S_IXUSR = 64 +) + +// Read, write, execute/search by group +const ( + S_IRWXG = 56 + // [XSI] R for group + S_IRGRP = 32 + // [XSI] W for group + S_IWGRP = 16 + // [XSI] X for group + S_IXGRP = 8 +) + +// Read, write, execute/search by others +const ( + S_IRWXO = 7 + // [XSI] R for other + S_IROTH = 4 + // [XSI] W for other + S_IWOTH = 2 + // [XSI] X for other + S_IXOTH = 1 +) +const ( + // [XSI] set user id on execution + S_ISUID = 2048 + // [XSI] set group id on execution + S_ISGID = 1024 + // [XSI] directory restrcted delete + S_ISVTX = 512 +) +const ( + // sticky bit: not supported + S_ISTXT = 512 + // backward compatability + S_IREAD = 256 + // backward compatability + S_IWRITE = 128 + // backward compatability + S_IEXEC = 64 +) diff --git a/c/os/sys-_types-_seek_set_darwin_arm64.go b/c/os/sys-_types-_seek_set_darwin_arm64.go new file mode 100644 index 00000000..196ff97e --- /dev/null +++ b/c/os/sys-_types-_seek_set_darwin_arm64.go @@ -0,0 +1,20 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +const ( + // set file offset to offset + SEEK_SET = 0 + // set file offset to current plus offset + SEEK_CUR = 1 + // set file offset to EOF plus offset + SEEK_END = 2 +) + +// set file offset to the start of the next hole greater than or equal to the supplied offset +const SEEK_HOLE = 3 + +// set file offset to the start of the next non-hole file region greater than or equal to the supplied offset +const SEEK_DATA = 4 diff --git a/c/os/sys-_types-_size_t_darwin_arm64.go b/c/os/sys-_types-_size_t_darwin_arm64.go new file mode 100644 index 00000000..375ecd83 --- /dev/null +++ b/c/os/sys-_types-_size_t_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type SizeT = X__DarwinSizeT diff --git a/c/os/sys-_types-_ssize_t_darwin_arm64.go b/c/os/sys-_types-_ssize_t_darwin_arm64.go new file mode 100644 index 00000000..0b21d8f3 --- /dev/null +++ b/c/os/sys-_types-_ssize_t_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type SsizeT = X__DarwinSsizeT diff --git a/c/os/sys-_types-_suseconds_t_darwin_arm64.go b/c/os/sys-_types-_suseconds_t_darwin_arm64.go new file mode 100644 index 00000000..9010ad97 --- /dev/null +++ b/c/os/sys-_types-_suseconds_t_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type SusecondsT = X__DarwinSusecondsT diff --git a/c/os/sys-_types-_time_t_darwin_arm64.go b/c/os/sys-_types-_time_t_darwin_arm64.go new file mode 100644 index 00000000..667da2e7 --- /dev/null +++ b/c/os/sys-_types-_time_t_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type TimeT = X__DarwinTimeT diff --git a/c/os/sched_param_darwin_arm64.go b/c/os/sys-_types-_timespec_darwin_arm64.go similarity index 64% rename from c/os/sched_param_darwin_arm64.go rename to c/os/sys-_types-_timespec_darwin_arm64.go index 52df4233..83dd28e7 100644 --- a/c/os/sched_param_darwin_arm64.go +++ b/c/os/sys-_types-_timespec_darwin_arm64.go @@ -6,7 +6,7 @@ package os import "github.com/goplus/lib/c" -type SchedParam struct { - SchedPriority c.Int - X__Opaque [4]c.Char +type Timespec struct { + TvSec X__DarwinTimeT + TvNsec c.Long } diff --git a/c/os/sys-_types-_timeval_darwin_arm64.go b/c/os/sys-_types-_timeval_darwin_arm64.go new file mode 100644 index 00000000..56fc9819 --- /dev/null +++ b/c/os/sys-_types-_timeval_darwin_arm64.go @@ -0,0 +1,10 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type Timeval struct { + TvSec X__DarwinTimeT + TvUsec X__DarwinSusecondsT +} diff --git a/c/os/sys-_types-_u_char_darwin_arm64.go b/c/os/sys-_types-_u_char_darwin_arm64.go new file mode 100644 index 00000000..f0133dda --- /dev/null +++ b/c/os/sys-_types-_u_char_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type UChar = uint8 diff --git a/c/os/sys-_types-_u_int16_t_darwin_arm64.go b/c/os/sys-_types-_u_int16_t_darwin_arm64.go new file mode 100644 index 00000000..7e005a82 --- /dev/null +++ b/c/os/sys-_types-_u_int16_t_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type UInt16T = uint16 diff --git a/c/os/sys-_types-_u_int32_t_darwin_arm64.go b/c/os/sys-_types-_u_int32_t_darwin_arm64.go new file mode 100644 index 00000000..d19dedc1 --- /dev/null +++ b/c/os/sys-_types-_u_int32_t_darwin_arm64.go @@ -0,0 +1,9 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +type UInt32T = c.Uint diff --git a/c/os/sys-_types-_u_int64_t_darwin_arm64.go b/c/os/sys-_types-_u_int64_t_darwin_arm64.go new file mode 100644 index 00000000..ddecef84 --- /dev/null +++ b/c/os/sys-_types-_u_int64_t_darwin_arm64.go @@ -0,0 +1,9 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +type UInt64T = c.UlongLong diff --git a/c/os/sys-_types-_u_int8_t_darwin_arm64.go b/c/os/sys-_types-_u_int8_t_darwin_arm64.go new file mode 100644 index 00000000..4a316e12 --- /dev/null +++ b/c/os/sys-_types-_u_int8_t_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type UInt8T = uint8 diff --git a/c/os/sys-_types-_u_int_darwin_arm64.go b/c/os/sys-_types-_u_int_darwin_arm64.go new file mode 100644 index 00000000..5bc999a7 --- /dev/null +++ b/c/os/sys-_types-_u_int_darwin_arm64.go @@ -0,0 +1,9 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +type UInt = c.Uint diff --git a/c/os/sys-_types-_u_short_darwin_arm64.go b/c/os/sys-_types-_u_short_darwin_arm64.go new file mode 100644 index 00000000..2a2698cd --- /dev/null +++ b/c/os/sys-_types-_u_short_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type UShort = uint16 diff --git a/c/os/sys-_types-_uintptr_t_darwin_arm64.go b/c/os/sys-_types-_uintptr_t_darwin_arm64.go new file mode 100644 index 00000000..bfa58112 --- /dev/null +++ b/c/os/sys-_types-_uintptr_t_darwin_arm64.go @@ -0,0 +1,9 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +type UintptrT = c.Ulong diff --git a/c/os/sys-_types-_useconds_t_darwin_arm64.go b/c/os/sys-_types-_useconds_t_darwin_arm64.go new file mode 100644 index 00000000..982d78d6 --- /dev/null +++ b/c/os/sys-_types-_useconds_t_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type UsecondsT = X__DarwinUsecondsT diff --git a/c/os/sys-_types-_uuid_t_darwin_arm64.go b/c/os/sys-_types-_uuid_t_darwin_arm64.go new file mode 100644 index 00000000..8dcdae86 --- /dev/null +++ b/c/os/sys-_types-_uuid_t_darwin_arm64.go @@ -0,0 +1,7 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type UuidT = X__DarwinUuidT diff --git a/c/os/sys-_types_darwin_arm64.go b/c/os/sys-_types_darwin_arm64.go new file mode 100644 index 00000000..1dcc04b1 --- /dev/null +++ b/c/os/sys-_types_darwin_arm64.go @@ -0,0 +1,63 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +// total blocks +type X__DarwinBlkcntT = X__Int64T + +// preferred block size +type X__DarwinBlksizeT = X__Int32T + +// dev_t +type X__DarwinDevT = X__Int32T + +// Used by statvfs and fstatvfs +type X__DarwinFsblkcntT = c.Uint + +// Used by statvfs and fstatvfs +type X__DarwinFsfilcntT = c.Uint + +// [???] process and group IDs +type X__DarwinGidT = X__Uint32T + +// [XSI] pid_t, uid_t, or gid_t +type X__DarwinIdT = X__Uint32T + +// [???] Used for 64 bit inodes +type X__DarwinIno64T = X__Uint64T + +// [???] Used for inodes +type X__DarwinInoT = X__DarwinIno64T + +// Used by mach +type X__DarwinMachPortNameT = X__DarwinNaturalT + +// Used by mach +type X__DarwinMachPortT = X__DarwinMachPortNameT + +// [???] Some file attributes +type X__DarwinModeT = X__Uint16T + +// [???] Used for file sizes +type X__DarwinOffT = X__Int64T + +// [???] process and group IDs +type X__DarwinPidT = X__Int32T + +// [???] signal set +type X__DarwinSigsetT = X__Uint32T + +// [???] microseconds +type X__DarwinSusecondsT = X__Int32T + +// [???] user IDs +type X__DarwinUidT = X__Uint32T + +// [???] microseconds +type X__DarwinUsecondsT = X__Uint32T +type X__DarwinUuidT = [16]uint8 +type X__DarwinUuidStringT = [37]c.Char diff --git a/c/os/sys-dirent_darwin_arm64.go b/c/os/sys-dirent_darwin_arm64.go new file mode 100644 index 00000000..2709c9cf --- /dev/null +++ b/c/os/sys-dirent_darwin_arm64.go @@ -0,0 +1,24 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +const X__DARWIN_MAXNAMLEN = 255 +const X__DARWIN_MAXPATHLEN = 1024 + +// File types +const MAXNAMLEN = 255 + +// File types +const ( + DT_UNKNOWN = 0 + DT_FIFO = 1 + DT_CHR = 2 + DT_DIR = 4 + DT_BLK = 6 + DT_REG = 8 + DT_LNK = 10 + DT_SOCK = 12 + DT_WHT = 14 +) diff --git a/c/os/sys-fcntl_darwin_arm64.go b/c/os/sys-fcntl_darwin_arm64.go new file mode 100644 index 00000000..9ecb976f --- /dev/null +++ b/c/os/sys-fcntl_darwin_arm64.go @@ -0,0 +1,525 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const ( + FREAD = 1 + FWRITE = 2 +) +const +// set append mode +O_APPEND = 8 +const ( + // open with shared file lock + O_SHLOCK = 16 + // open with exclusive file lock + O_EXLOCK = 32 + // signal pgrp when data ready + O_ASYNC = 64 + // source compatibility: do not use + O_FSYNC = 128 + // don't follow symlinks + O_NOFOLLOW = 256 +) +const +// error if already exists +O_EXCL = 2048 + +// descriptor requested for event notifications only +const O_EVTONLY = 32768 + +// don't assign controlling terminal +const O_NOCTTY = 131072 +const O_DIRECTORY = 1048576 + +// allow open of a symlink +const O_SYMLINK = 2097152 + +// implicitly set FD_CLOEXEC +const O_CLOEXEC = 16777216 + +// no symlinks allowed in path +const O_NOFOLLOW_ANY = 536870912 +const ( + // open file for execute only + O_EXEC = 1073741824 + // open directory for search only + O_SEARCH = 1074790400 +) + +// Descriptor value for the current working directory +const AT_FDCWD = -2 + +// Flags for the at functions +const ( + AT_EACCESS = 16 + // Act on the symlink itself not the target + AT_SYMLINK_NOFOLLOW = 32 + // Act on target of symlink + AT_SYMLINK_FOLLOW = 64 + // Path refers to directory + AT_REMOVEDIR = 128 +) +const ( + // Return real device inodes resides on for fstatat(2) + AT_REALDEV = 512 + // Use only the fd and Ignore the path for fstatat(2) + AT_FDONLY = 1024 + // Path should not contain any symlinks + AT_SYMLINK_NOFOLLOW_ANY = 2048 +) + +// Data Protection Flags +const ( + O_DP_GETRAWENCRYPTED = 1 + O_DP_GETRAWUNENCRYPTED = 2 + O_DP_AUTHENTICATE = 4 +) + +// Descriptor value for openat_authenticated_np() to skip authentication with another fd +const AUTH_OPEN_NOAUTHFD = -1 +const ( + // kernel/compat + FAPPEND = 8 + // kernel/compat + FASYNC = 64 + // kernel + FFSYNC = 128 + // kernel + FFDSYNC = 4194304 +) +const ( + CPF_OVERWRITE = 1 + CPF_IGNORE_MODE = 2 + CPF_MASK = 3 +) + +// command values +const ( + F_DUPFD = 0 + // get file descriptor flags + F_GETFD = 1 + // set file descriptor flags + F_SETFD = 2 + // get SIGIO/SIGURG proc/pgrp + F_GETOWN = 5 + // set SIGIO/SIGURG proc/pgrp + F_SETOWN = 6 + // get record locking information + F_GETLK = 7 + // set record locking information + F_SETLK = 8 + // F_SETLK; wait if blocked + F_SETLKW = 9 +) + +// F_SETLK; wait if blocked, return on timeout +const F_SETLKWTIMEOUT = 10 +const ( + F_FLUSH_DATA = 40 + // Used for regression test + F_CHKCLEAN = 41 + // Preallocate storage + F_PREALLOCATE = 42 + // Truncate a file. Equivalent to calling truncate(2) + F_SETSIZE = 43 + // Issue an advisory read async with no copy to user + F_RDADVISE = 44 + // turn read ahead off/on for this fd + F_RDAHEAD = 45 +) + +// 46,47 used to be F_READBOOTSTRAP and F_WRITEBOOTSTRAP +const ( + F_NOCACHE = 48 + // file offset to device offset + F_LOG2PHYS = 49 + // return the full path of the fd + F_GETPATH = 50 + // fsync + ask the drive to flush to the media + F_FULLFSYNC = 51 + // find which component (if any) is a package + F_PATHPKG_CHECK = 52 + // "freeze" all fs operations + F_FREEZE_FS = 53 + // "thaw" all fs operations + F_THAW_FS = 54 + // turn data caching off/on (globally) for this file + F_GLOBAL_NOCACHE = 55 +) + +// add detached signatures +const F_ADDSIGS = 59 + +// add signature from same file (used by dyld for shared libs) +const F_ADDFILESIGS = 61 + +// used in conjunction with F_NOCACHE to indicate that DIRECT, synchonous writes +const F_NODIRECT = 62 +const ( + // Get the protection class of a file from the EA, returns int + F_GETPROTECTIONCLASS = 63 + // Set the protection class of a file for the EA, requires int + F_SETPROTECTIONCLASS = 64 +) + +// file offset to device offset, extended +const F_LOG2PHYS_EXT = 65 + +// See man fcntl(2) F_GETLK +// Similar to F_GETLK but in addition l_pid is treated as an input parameter +// which is used as a matching value when searching locks on the file +// so that only locks owned by the process with pid l_pid are returned. +// However, any flock(2) type lock will also be found with the returned value +// of l_pid set to -1 (as with F_GETLK). +const F_GETLKPID = 66 +const ( + // Mark the file as being the backing store for another filesystem + F_SETBACKINGSTORE = 70 + // return the full path of the FD, but error in specific mtmd circumstances + F_GETPATH_MTMINFO = 71 +) + +// Returns the code directory, with associated hashes, to the caller +const F_GETCODEDIR = 72 +const ( + // No SIGPIPE generated on EPIPE + F_SETNOSIGPIPE = 73 + // Status of SIGPIPE for this fd + F_GETNOSIGPIPE = 74 +) + +// For some cases, we need to rewrap the key for AKS/MKB +const F_TRANSCODEKEY = 75 + +// file being written to a by single writer... if throttling enabled, writes +const F_SINGLE_WRITER = 76 + +// Get the protection version number for this filesystem +const F_GETPROTECTIONLEVEL = 77 + +// Add detached code signatures (used by dyld for shared libs) +const F_FINDSIGS = 78 + +// Add signature from same file, only if it is signed by Apple (used by dyld for simulator) +const F_ADDFILESIGS_FOR_DYLD_SIM = 83 + +// fsync + issue barrier to drive +const F_BARRIERFSYNC = 85 +const ( + // Acquire or release open file description lock + F_OFD_SETLK = 90 + // (as F_OFD_SETLK but blocking if conflicting lock) + F_OFD_SETLKW = 91 + // Examine OFD lock + F_OFD_GETLK = 92 +) + +// (as F_OFD_SETLKW but return if timeout) +const F_OFD_SETLKWTIMEOUT = 93 +const ( + // Add signature from same file, return end offset in structure on success + F_ADDFILESIGS_RETURN = 97 + // Check if Library Validation allows this Mach-O file to be mapped into the calling process + F_CHECK_LV = 98 +) + +// Deallocate a range of the file +const F_PUNCHHOLE = 99 + +// Trim an active file +const F_TRIM_ACTIVE_FILE = 100 + +// Asynchronous advisory read fcntl for regular and compressed file +const F_SPECULATIVE_READ = 101 + +// return the full path without firmlinks of the fd +const F_GETPATH_NOFIRMLINK = 102 +const ( + // Add signature from same file, return information + F_ADDFILESIGS_INFO = 103 + // Add supplemental signature from same file with fd reference to original + F_ADDFILESUPPL = 104 + // Look up code signature information attached to a file or slice + F_GETSIGSINFO = 105 +) +const ( + // Acquire or release lease + F_SETLEASE = 106 + // Retrieve lease information + F_GETLEASE = 107 +) + +// Transfer allocated extents beyond leof to a different file +const F_TRANSFEREXTENTS = 110 + +// Based on flags, query/set/delete a file's attribution tag +const F_ATTRIBUTION_TAG = 111 + +// FS-specific fcntl()'s numbers begin at 0x00010000 and go up +const FCNTL_FS_SPECIFIC_BASE = 65536 + +// mark the dup with FD_CLOEXEC +const F_DUPFD_CLOEXEC = 67 + +// file descriptor flags (F_GETFD, F_SETFD) +const FD_CLOEXEC = 1 + +// record locking flags (F_GETLK, F_SETLK, F_SETLKW) +const ( + F_RDLCK = 1 + // unlock + F_UNLCK = 2 + // exclusive or write lock + F_WRLCK = 3 +) +const ( + // allocate contigious space + F_ALLOCATECONTIG = 2 + // allocate all requested space or no space at all + F_ALLOCATEALL = 4 + // do not free space upon close(2) + F_ALLOCATEPERSIST = 8 +) + +// Make it past all of the SEEK pos modes so that +const F_PEOFPOSMODE = 3 + +// we can keep them in sync should we desire +const F_VOLPOSMODE = 4 + +// detached code signatures data type - +// information passed by user to system used by F_ADDSIGS and F_ADDFILESIGS. +// F_ADDFILESIGS is a shortcut for files that contain their own signature and +// doesn't require mapping of the file in order to load the signature. +const USER_FSIGNATURES_CDHASH_LEN = 20 + +// At this time F_GETSIGSINFO can only indicate platformness. +// +// As additional requestable information is defined, new keys will be added and the +// fgetsigsinfo_t structure will be lengthened to add space for the additional information +const GETSIGSINFO_PLATFORM_BINARY = 1 + +// lock operations for flock(2) +const ( + LOCK_SH = 1 + // exclusive file lock + LOCK_EX = 2 + // don't block when locking + LOCK_NB = 4 + // unlock file + LOCK_UN = 8 +) + +// fattributiontag_t used by F_ATTRIBUTION_TAG +const ATTRIBUTION_NAME_MAX = 255 + +// ft_flags (F_ATTRIBUTION_TAG) +const ( + F_CREATE_TAG = 1 + F_DELETE_TAG = 2 + F_QUERY_TAG = 4 +) +const ( + // force window to popup on open + O_POPUP = 2147483648 + // small, clean popup window + O_ALERT = 536870912 +) + +// Advisory file segment locking data type - +// information passed to system by user +type FlockT struct { + LStart OffT + LLen OffT + LPid PidT + LType int16 + LWhence int16 +} + +// Advisory file segment locking with time out - +// Information passed to system by user for F_SETLKWTIMEOUT +type Flocktimeout struct { + Fl FlockT + Timeout Timespec +} +type Radvisory struct { + RaOffset OffT + RaCount c.Int +} +type Fsignatures struct { + FsFileStart OffT + FsBlobStart unsafe.Pointer + FsBlobSize SizeT + FsFsignaturesSize SizeT + FsCdhash [20]c.Char + FsHashType c.Int +} +type Fsupplement struct { + FsFileStart OffT + FsBlobStart OffT + FsBlobSize SizeT + FsOrigFd c.Int +} + +// DYLD needs to check if the object is allowed to be combined +// into the main binary. This is done between the code signature +// is loaded and dyld is doing all the work to process the LOAD commands. +// +// While this could be done in F_ADDFILESIGS.* family the hook into +// the MAC module doesn't say no when LV isn't enabled and then that +// is cached on the vnode, and the MAC module never gets change once +// a process that library validation enabled. +type Fchecklv struct { + LvFileStart OffT + LvErrorMessageSize SizeT + LvErrorMessage unsafe.Pointer +} + +// fgetsigsinfo_t used by F_GETSIGSINFO command +type Fgetsigsinfo struct { + FgFileStart OffT + FgInfoRequest c.Int + FgSigIsPlatform c.Int +} +type Fstore struct { + FstFlags c.Uint + FstPosmode c.Int + FstOffset OffT + FstLength OffT + FstBytesalloc OffT +} + +// fpunchhole_t used by F_PUNCHHOLE +type Fpunchhole struct { + FpFlags c.Uint + Reserved c.Uint + FpOffset OffT + FpLength OffT +} + +// factive_file_trim_t used by F_TRIM_ACTIVE_FILE +type Ftrimactivefile struct { + FtaOffset OffT + FtaLength OffT +} + +// fspecread_t used by F_SPECULATIVE_READ +type Fspecread struct { + FsrFlags c.Uint + Reserved c.Uint + FsrOffset OffT + FsrLength OffT +} +type Fattributiontag struct { + FtFlags c.Uint + FtHash c.UlongLong + FtAttributionName [255]c.Char +} +type Log2phys struct { + L2pFlags c.Uint + L2pContigbytes OffT + L2pDevoffset OffT +} +type FilesecPropertyT c.Uint + +const ( + FILESEC_OWNER FilesecPropertyT = 1 + FILESEC_GROUP FilesecPropertyT = 2 + FILESEC_UUID FilesecPropertyT = 3 + FILESEC_MODE FilesecPropertyT = 4 + FILESEC_ACL FilesecPropertyT = 5 + FILESEC_GRPUUID FilesecPropertyT = 6 + // XXX these are private to the implementation + FILESEC_ACL_RAW FilesecPropertyT = 100 + FILESEC_ACL_ALLOCSIZE FilesecPropertyT = 101 +) + +type FsignaturesT = Fsignatures +type FsupplementT = Fsupplement + +// DYLD needs to check if the object is allowed to be combined +// into the main binary. This is done between the code signature +// is loaded and dyld is doing all the work to process the LOAD commands. +// +// While this could be done in F_ADDFILESIGS.* family the hook into +// the MAC module doesn't say no when LV isn't enabled and then that +// is cached on the vnode, and the MAC module never gets change once +// a process that library validation enabled. +type FchecklvT = Fchecklv + +// fgetsigsinfo_t used by F_GETSIGSINFO command +type FgetsigsinfoT = Fgetsigsinfo +type FstoreT = Fstore + +// fpunchhole_t used by F_PUNCHHOLE +type FpunchholeT = Fpunchhole + +// factive_file_trim_t used by F_TRIM_ACTIVE_FILE +type FtrimactivefileT = Ftrimactivefile + +// fspecread_t used by F_SPECULATIVE_READ +type FspecreadT = Fspecread +type FattributiontagT = Fattributiontag + +// data-protected non-portable open(2) : +// +// int open_dprotected_np(user_addr_t path, int flags, int class, int dpflags, int mode) +// +//go:linkname OpenxNp C.openx_np +func OpenxNp(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 FilesecT) c.Int + +// data-protected non-portable open(2) : +// +// int open_dprotected_np(user_addr_t path, int flags, int class, int dpflags, int mode) +// +//go:linkname OpenDprotectedNp C.open_dprotected_np +func OpenDprotectedNp(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 c.Int, __llgo_va_list ...any) c.Int + +//go:linkname OpenatDprotectedNp C.openat_dprotected_np +func OpenatDprotectedNp(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.Int, _llcppg_param4 c.Int, _llcppg_param5 c.Int, __llgo_va_list ...any) c.Int + +//go:linkname OpenatAuthenticatedNp C.openat_authenticated_np +func OpenatAuthenticatedNp(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.Int, _llcppg_param4 c.Int) c.Int + +//go:linkname Flock C.flock +func Flock(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname FilesecInit C.filesec_init +func FilesecInit() FilesecT + +// llgo:link FilesecT.FilesecDup C.filesec_dup +func (self FilesecT) FilesecDup() FilesecT { + return self +} + +// llgo:link FilesecT.FilesecFree C.filesec_free +func (self FilesecT) FilesecFree() { +} + +// llgo:link FilesecT.FilesecGetProperty C.filesec_get_property +func (self FilesecT) FilesecGetProperty(_llcppg_param2 FilesecPropertyT, _llcppg_param3 unsafe.Pointer) c.Int { + return 0 +} + +// llgo:link FilesecT.FilesecQueryProperty C.filesec_query_property +func (self FilesecT) FilesecQueryProperty(_llcppg_param2 FilesecPropertyT, _llcppg_param3 *c.Int) c.Int { + return 0 +} + +// llgo:link FilesecT.FilesecSetProperty C.filesec_set_property +func (self FilesecT) FilesecSetProperty(_llcppg_param2 FilesecPropertyT, _llcppg_param3 unsafe.Pointer) c.Int { + return 0 +} + +// llgo:link FilesecT.FilesecUnsetProperty C.filesec_unset_property +func (self FilesecT) FilesecUnsetProperty(_llcppg_param2 FilesecPropertyT) c.Int { + return 0 +} diff --git a/c/os/sys-file_darwin_arm64.go b/c/os/sys-file_darwin_arm64.go new file mode 100644 index 00000000..a8b01016 --- /dev/null +++ b/c/os/sys-file_darwin_arm64.go @@ -0,0 +1,12 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +type PosixCred struct { +} +type Ucred struct { +} +type KauthCredT = *Ucred +type PosixCredT = *PosixCred diff --git a/c/os/sys-file_linux_amd64.go b/c/os/sys-file_linux_amd64.go new file mode 100644 index 00000000..ff591373 --- /dev/null +++ b/c/os/sys-file_linux_amd64.go @@ -0,0 +1,26 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_SYS_FILE_H = 1 +const ( + // Seek from beginning of file. + L_SET = 0 + // Seek from current position. + L_INCR = 1 + // Seek from end of file. + L_XTND = 2 +) + +// Apply or remove an advisory lock, according to OPERATION, +// on the file FD refers to. +// +//go:linkname Flock C.flock +func Flock(__fd c.Int, __operation c.Int) c.Int diff --git a/c/os/sys-file_linux_arm64.go b/c/os/sys-file_linux_arm64.go new file mode 100644 index 00000000..602b4761 --- /dev/null +++ b/c/os/sys-file_linux_arm64.go @@ -0,0 +1,26 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_SYS_FILE_H = 1 +const ( + // Seek from beginning of file. + L_SET = 0 + // Seek from current position. + L_INCR = 1 + // Seek from end of file. + L_XTND = 2 +) + +// Apply or remove an advisory lock, according to OPERATION, +// on the file FD refers to. +// +//go:linkname Flock C.flock +func Flock(__fd c.Int, __operation c.Int) c.Int diff --git a/c/os/sys-mman_darwin_arm64.go b/c/os/sys-mman_darwin_arm64.go new file mode 100644 index 00000000..aa860388 --- /dev/null +++ b/c/os/sys-mman_darwin_arm64.go @@ -0,0 +1,229 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +// Protections are chosen from these bits, or-ed together +const ( + PROT_NONE = 0 + // [MC2] pages can be read + PROT_READ = 1 + // [MC2] pages can be written + PROT_WRITE = 2 + // [MC2] pages can be executed + PROT_EXEC = 4 +) + +// Flags contain sharing type and options. +// Sharing types; choose one. +const ( + MAP_SHARED = 1 + // [MF|SHM] changes are private + MAP_PRIVATE = 2 +) + +// Obsolete +const MAP_COPY = 2 + +// Other flags +const MAP_FIXED = 16 +const ( + // Sun: rename private pages to file + MAP_RENAME = 32 + // Sun: don't reserve needed swap area + MAP_NORESERVE = 64 + // previously unimplemented MAP_INHERIT + MAP_RESERVED0080 = 128 + // for MAP_FILE, don't change file size + MAP_NOEXTEND = 256 + // region may contain semaphores + MAP_HASSEMAPHORE = 512 + // don't cache pages for this mapping + MAP_NOCACHE = 1024 + // Allocate a region that will be used for JIT purposes + MAP_JIT = 2048 +) + +// Mapping type +const ( + MAP_FILE = 0 + // allocated from memory, swap space + MAP_ANON = 4096 + MAP_ANONYMOUS = 4096 +) + +// The MAP_RESILIENT_* flags can be used when the caller wants to map some +// possibly unreliable memory and be able to access it safely, possibly +// getting the wrong contents rather than raising any exception. +// For safety reasons, such mappings have to be read-only (PROT_READ access +// only). +// +// MAP_RESILIENT_CODESIGN: +// +// accessing this mapping will not generate code-signing violations, +// even if the contents are tainted. +// +// MAP_RESILIENT_MEDIA: +// +// accessing this mapping will not generate an exception if the contents +// are not available (unreachable removable or remote media, access beyond +// end-of-file, ...). Missing contents will be replaced with zeroes. +const ( + MAP_RESILIENT_CODESIGN = 8192 + // no backing-store failures + MAP_RESILIENT_MEDIA = 16384 +) + +// Return virtual addresses <4G only +const MAP_32BIT = 32768 + +// Flags used to support translated processes. +const MAP_TRANSLATED_ALLOW_EXECUTE = 131072 + +// UNIX03 compliance +const MAP_UNIX03 = 262144 + +// Allocate a region that will be protected by TPRO +const MAP_TPRO = 524288 + +// Process memory locking +const ( + MCL_CURRENT = 1 + // [ML] Lock all future memory as well + MCL_FUTURE = 2 +) + +// msync() flags +const ( + MS_ASYNC = 1 + // [MF|SIO] invalidate all cached data + MS_INVALIDATE = 2 + // [MF|SIO] msync synchronously + MS_SYNC = 16 +) +const ( + // invalidate pages, leave mapped + MS_KILLPAGES = 4 + // deactivate pages, leave mapped + MS_DEACTIVATE = 8 +) + +// Advice to madvise +const ( + POSIX_MADV_NORMAL = 0 + // [MC1] expect random page refs + POSIX_MADV_RANDOM = 1 + // [MC1] expect sequential page refs + POSIX_MADV_SEQUENTIAL = 2 + // [MC1] will need these pages + POSIX_MADV_WILLNEED = 3 + // [MC1] dont need these pages + POSIX_MADV_DONTNEED = 4 +) +const ( + MADV_NORMAL = 0 + MADV_RANDOM = 1 + MADV_SEQUENTIAL = 2 + MADV_WILLNEED = 3 + MADV_DONTNEED = 4 + // pages unneeded, discard contents + MADV_FREE = 5 + // zero the wired pages that have not been unwired before the entry is deleted + MADV_ZERO_WIRED_PAGES = 6 + // pages can be reused (by anyone) + MADV_FREE_REUSABLE = 7 + // caller wants to reuse those pages + MADV_FREE_REUSE = 8 + MADV_CAN_REUSE = 9 + // page out now (internal only) + MADV_PAGEOUT = 10 +) + +// Return bits from mincore +const ( + MINCORE_INCORE = 1 + // Page has been referenced by us + MINCORE_REFERENCED = 2 + // Page has been modified by us + MINCORE_MODIFIED = 4 + // Page has been referenced + MINCORE_REFERENCED_OTHER = 8 + // Page has been modified + MINCORE_MODIFIED_OTHER = 16 + // Page has been paged out + MINCORE_PAGED_OUT = 32 + // Page has been copied + MINCORE_COPIED = 64 + // Page belongs to an anonymous object + MINCORE_ANONYMOUS = 128 +) + +// [ML] +// +//go:linkname Mlockall C.mlockall +func Mlockall(_llcppg_param1 c.Int) c.Int + +// [MR] +// +//go:linkname Munlockall C.munlockall +func Munlockall() c.Int + +// [MR] +// +//go:linkname Mlock C.mlock +func Mlock(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT) c.Int + +// [MC3] +// +//go:linkname Mmap C.mmap +func Mmap(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT, _llcppg_param3 c.Int, _llcppg_param4 c.Int, _llcppg_param5 c.Int, _llcppg_param6 OffT) unsafe.Pointer + +// [MPR] +// +//go:linkname Mprotect C.mprotect +func Mprotect(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT, _llcppg_param3 c.Int) c.Int + +// [MF|SIO] +// +//go:linkname Msync C.msync +func Msync(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT, _llcppg_param3 c.Int) c.Int + +// [MR] +// +//go:linkname Munlock C.munlock +func Munlock(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT) c.Int + +// [MC3] +// +//go:linkname Munmap C.munmap +func Munmap(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT) c.Int + +// [SHM] +// +//go:linkname ShmOpen C.shm_open +func ShmOpen(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, __llgo_va_list ...any) c.Int + +// [ADV] +// +//go:linkname ShmUnlink C.shm_unlink +func ShmUnlink(_llcppg_param1 *c.Char) c.Int + +// [ADV] +// +//go:linkname PosixMadvise C.posix_madvise +func PosixMadvise(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT, _llcppg_param3 c.Int) c.Int + +//go:linkname Madvise C.madvise +func Madvise(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT, _llcppg_param3 c.Int) c.Int + +//go:linkname Mincore C.mincore +func Mincore(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT, _llcppg_param3 *c.Char) c.Int + +//go:linkname Minherit C.minherit +func Minherit(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT, _llcppg_param3 c.Int) c.Int diff --git a/c/os/sys-mman_linux_amd64.go b/c/os/sys-mman_linux_amd64.go new file mode 100644 index 00000000..4ef71645 --- /dev/null +++ b/c/os/sys-mman_linux_amd64.go @@ -0,0 +1,92 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const X_SYS_MMAN_H = 1 + +//go:linkname Mmap C.mmap +func Mmap(__addr unsafe.Pointer, __len SizeT, __prot c.Int, __flags c.Int, __fd c.Int, __offset X__OffT) unsafe.Pointer + +// Deallocate any mapping for the region starting at ADDR and extending LEN +// bytes. Returns 0 if successful, -1 for errors (and sets errno). +// +//go:linkname Munmap C.munmap +func Munmap(__addr unsafe.Pointer, __len SizeT) c.Int + +// Change the memory protection of the region starting at ADDR and +// extending LEN bytes to PROT. Returns 0 if successful, -1 for errors +// (and sets errno). +// +//go:linkname Mprotect C.mprotect +func Mprotect(__addr unsafe.Pointer, __len SizeT, __prot c.Int) c.Int + +// Synchronize the region starting at ADDR and extending LEN bytes with the +// file it maps. Filesystem operations on a file being mapped are +// unpredictable before this is done. Flags are from the MS_* set. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Msync C.msync +func Msync(__addr unsafe.Pointer, __len SizeT, __flags c.Int) c.Int + +// Advise the system about particular usage patterns the program follows +// for the region starting at ADDR and extending LEN bytes. +// +//go:linkname Madvise C.madvise +func Madvise(__addr unsafe.Pointer, __len SizeT, __advice c.Int) c.Int + +// This is the POSIX name for this function. +// +//go:linkname PosixMadvise C.posix_madvise +func PosixMadvise(__addr unsafe.Pointer, __len SizeT, __advice c.Int) c.Int + +// Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to +// be memory resident. +// +//go:linkname Mlock C.mlock +func Mlock(__addr unsafe.Pointer, __len SizeT) c.Int + +// Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN). +// +//go:linkname Munlock C.munlock +func Munlock(__addr unsafe.Pointer, __len SizeT) c.Int + +// Cause all currently mapped pages of the process to be memory resident +// until unlocked by a call to the `munlockall', until the process exits, +// or until the process calls `execve'. +// +//go:linkname Mlockall C.mlockall +func Mlockall(__flags c.Int) c.Int + +// All currently mapped pages of the process' address space become +// unlocked. +// +//go:linkname Munlockall C.munlockall +func Munlockall() c.Int + +// mincore returns the memory residency status of the pages in the +// current process's address space specified by [start, start + len). +// The status is returned in a vector of bytes. The least significant +// bit of each byte is 1 if the referenced page is in memory, otherwise +// it is zero. +// +//go:linkname Mincore C.mincore +func Mincore(__start unsafe.Pointer, __len SizeT, __vec *uint8) c.Int + +// Open shared memory segment. +// +//go:linkname ShmOpen C.shm_open +func ShmOpen(__name *c.Char, __oflag c.Int, __mode ModeT) c.Int + +// Remove shared memory segment. +// +//go:linkname ShmUnlink C.shm_unlink +func ShmUnlink(__name *c.Char) c.Int diff --git a/c/os/sys-mman_linux_arm64.go b/c/os/sys-mman_linux_arm64.go new file mode 100644 index 00000000..60d4be73 --- /dev/null +++ b/c/os/sys-mman_linux_arm64.go @@ -0,0 +1,92 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const X_SYS_MMAN_H = 1 + +//go:linkname Mmap C.mmap +func Mmap(__addr unsafe.Pointer, __len SizeT, __prot c.Int, __flags c.Int, __fd c.Int, __offset X__OffT) unsafe.Pointer + +// Deallocate any mapping for the region starting at ADDR and extending LEN +// bytes. Returns 0 if successful, -1 for errors (and sets errno). +// +//go:linkname Munmap C.munmap +func Munmap(__addr unsafe.Pointer, __len SizeT) c.Int + +// Change the memory protection of the region starting at ADDR and +// extending LEN bytes to PROT. Returns 0 if successful, -1 for errors +// (and sets errno). +// +//go:linkname Mprotect C.mprotect +func Mprotect(__addr unsafe.Pointer, __len SizeT, __prot c.Int) c.Int + +// Synchronize the region starting at ADDR and extending LEN bytes with the +// file it maps. Filesystem operations on a file being mapped are +// unpredictable before this is done. Flags are from the MS_* set. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Msync C.msync +func Msync(__addr unsafe.Pointer, __len SizeT, __flags c.Int) c.Int + +// Advise the system about particular usage patterns the program follows +// for the region starting at ADDR and extending LEN bytes. +// +//go:linkname Madvise C.madvise +func Madvise(__addr unsafe.Pointer, __len SizeT, __advice c.Int) c.Int + +// This is the POSIX name for this function. +// +//go:linkname PosixMadvise C.posix_madvise +func PosixMadvise(__addr unsafe.Pointer, __len SizeT, __advice c.Int) c.Int + +// Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to +// be memory resident. +// +//go:linkname Mlock C.mlock +func Mlock(__addr unsafe.Pointer, __len SizeT) c.Int + +// Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN). +// +//go:linkname Munlock C.munlock +func Munlock(__addr unsafe.Pointer, __len SizeT) c.Int + +// Cause all currently mapped pages of the process to be memory resident +// until unlocked by a call to the `munlockall', until the process exits, +// or until the process calls `execve'. +// +//go:linkname Mlockall C.mlockall +func Mlockall(__flags c.Int) c.Int + +// All currently mapped pages of the process' address space become +// unlocked. +// +//go:linkname Munlockall C.munlockall +func Munlockall() c.Int + +// mincore returns the memory residency status of the pages in the +// current process's address space specified by [start, start + len). +// The status is returned in a vector of bytes. The least significant +// bit of each byte is 1 if the referenced page is in memory, otherwise +// it is zero. +// +//go:linkname Mincore C.mincore +func Mincore(__start unsafe.Pointer, __len SizeT, __vec *uint8) c.Int + +// Open shared memory segment. +// +//go:linkname ShmOpen C.shm_open +func ShmOpen(__name *uint8, __oflag c.Int, __mode ModeT) c.Int + +// Remove shared memory segment. +// +//go:linkname ShmUnlink C.shm_unlink +func ShmUnlink(__name *uint8) c.Int diff --git a/c/os/sys-resource_darwin_arm64.go b/c/os/sys-resource_darwin_arm64.go new file mode 100644 index 00000000..2a654d4f --- /dev/null +++ b/c/os/sys-resource_darwin_arm64.go @@ -0,0 +1,468 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +// Possible values of the first parameter to getpriority()/setpriority(), +// used to indicate the type of the second parameter. +const ( + PRIO_PROCESS = 0 + // Second argument is a GID + PRIO_PGRP = 1 + // Second argument is a UID + PRIO_USER = 2 +) +const ( + // Second argument is always 0 (current thread) + PRIO_DARWIN_THREAD = 3 + // Second argument is a PID + PRIO_DARWIN_PROCESS = 4 +) + +// Range limitations for the value of the third parameter to setpriority(). +const ( + PRIO_MIN = -20 + PRIO_MAX = 20 +) + +// use PRIO_DARWIN_BG to set the current thread into "background" state +// which lowers CPU, disk IO, and networking priorites until thread terminates +// or "background" state is revoked +const PRIO_DARWIN_BG = 4096 + +// use PRIO_DARWIN_NONUI to restrict a process's ability to make calls to +// the GPU. (deprecated) +const PRIO_DARWIN_NONUI = 4097 + +// Possible values of the first parameter to getrusage(), used to indicate +// the scope of the information to be returned. +const ( + RUSAGE_SELF = 0 + // Current process' children + RUSAGE_CHILDREN = -1 +) + +// Flavors for proc_pid_rusage(). +const ( + RUSAGE_INFO_V0 = 0 + RUSAGE_INFO_V1 = 1 + RUSAGE_INFO_V2 = 2 + RUSAGE_INFO_V3 = 3 + RUSAGE_INFO_V4 = 4 + RUSAGE_INFO_V5 = 5 + RUSAGE_INFO_V6 = 6 + RUSAGE_INFO_CURRENT = 6 +) + +// Flags for RUSAGE_INFO_V5 +const RU_PROC_RUNS_RESLIDE = 1 + +// Possible values of the first parameter to getrlimit()/setrlimit(), to +// indicate for which resource the operation is being performed. +const ( + RLIMIT_CPU = 0 + // file size + RLIMIT_FSIZE = 1 + // data segment size + RLIMIT_DATA = 2 + // stack size + RLIMIT_STACK = 3 + // core file size + RLIMIT_CORE = 4 + // address space (resident set size) + RLIMIT_AS = 5 +) +const ( + // source compatibility alias + RLIMIT_RSS = 5 + // locked-in-memory address space + RLIMIT_MEMLOCK = 6 + // number of processes + RLIMIT_NPROC = 7 +) + +// number of open files +const RLIMIT_NOFILE = 8 + +// total number of resource limits +const RLIM_NLIMITS = 9 + +// Set bit for strict POSIX +const X_RLIMIT_POSIX_FLAG = 4096 + +// proc_rlimit_control() +// +// Resource limit flavors +const ( + RLIMIT_WAKEUPS_MONITOR = 1 + // Configure the CPU usage monitor. + RLIMIT_CPU_USAGE_MONITOR = 2 + // Configure a blocking, per-thread, CPU limits. + RLIMIT_THREAD_CPULIMITS = 3 + // Configure memory footprint interval tracking + RLIMIT_FOOTPRINT_INTERVAL = 4 +) + +// Flags for wakeups monitor control. +const ( + WAKEMON_ENABLE = 1 + WAKEMON_DISABLE = 2 + WAKEMON_GET_PARAMS = 4 + WAKEMON_SET_DEFAULTS = 8 + // Configure the task so that violations are fatal. + WAKEMON_MAKE_FATAL = 16 +) + +// Flags for CPU usage monitor control. +const CPUMON_MAKE_FATAL = 4096 + +// Flags for memory footprint interval tracking. +const FOOTPRINT_INTERVAL_RESET = 1 + +// I/O type +const ( + IOPOL_TYPE_DISK = 0 + IOPOL_TYPE_VFS_ATIME_UPDATES = 2 + IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES = 3 + IOPOL_TYPE_VFS_STATFS_NO_DATA_VOLUME = 4 + IOPOL_TYPE_VFS_TRIGGER_RESOLVE = 5 + IOPOL_TYPE_VFS_IGNORE_CONTENT_PROTECTION = 6 + IOPOL_TYPE_VFS_IGNORE_PERMISSIONS = 7 + IOPOL_TYPE_VFS_SKIP_MTIME_UPDATE = 8 + IOPOL_TYPE_VFS_ALLOW_LOW_SPACE_WRITES = 9 + IOPOL_TYPE_VFS_DISALLOW_RW_FOR_O_EVTONLY = 10 +) + +// scope +const ( + IOPOL_SCOPE_PROCESS = 0 + IOPOL_SCOPE_THREAD = 1 + IOPOL_SCOPE_DARWIN_BG = 2 +) + +// I/O Priority +const ( + IOPOL_DEFAULT = 0 + IOPOL_IMPORTANT = 1 + IOPOL_PASSIVE = 2 + IOPOL_THROTTLE = 3 + IOPOL_UTILITY = 4 + IOPOL_STANDARD = 5 +) + +// compatibility with older names +const ( + IOPOL_APPLICATION = 5 + IOPOL_NORMAL = 1 +) +const ( + IOPOL_ATIME_UPDATES_DEFAULT = 0 + IOPOL_ATIME_UPDATES_OFF = 1 +) +const ( + IOPOL_MATERIALIZE_DATALESS_FILES_DEFAULT = 0 + IOPOL_MATERIALIZE_DATALESS_FILES_OFF = 1 + IOPOL_MATERIALIZE_DATALESS_FILES_ON = 2 +) +const ( + IOPOL_VFS_STATFS_NO_DATA_VOLUME_DEFAULT = 0 + IOPOL_VFS_STATFS_FORCE_NO_DATA_VOLUME = 1 +) +const ( + IOPOL_VFS_TRIGGER_RESOLVE_DEFAULT = 0 + IOPOL_VFS_TRIGGER_RESOLVE_OFF = 1 +) +const ( + IOPOL_VFS_CONTENT_PROTECTION_DEFAULT = 0 + IOPOL_VFS_CONTENT_PROTECTION_IGNORE = 1 +) +const ( + IOPOL_VFS_IGNORE_PERMISSIONS_OFF = 0 + IOPOL_VFS_IGNORE_PERMISSIONS_ON = 1 +) +const ( + IOPOL_VFS_SKIP_MTIME_UPDATE_OFF = 0 + IOPOL_VFS_SKIP_MTIME_UPDATE_ON = 1 +) +const ( + IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_OFF = 0 + IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_ON = 1 +) +const ( + IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_DEFAULT = 0 + IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_ON = 1 +) +const ( + IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_DEFAULT = 0 + IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_ON = 1 +) + +// A structure representing an accounting of resource utilization. The +// address of an instance of this structure is the second parameter to +// getrusage(). +// +// Note: All values other than ru_utime and ru_stime are implementaiton +// +// defined and subject to change in a future release. Their use +// is discouraged for standards compliant programs. +type Rusage struct { + RuUtime Timeval + RuStime Timeval + RuMaxrss c.Long + RuIxrss c.Long + RuIdrss c.Long + RuIsrss c.Long + RuMinflt c.Long + RuMajflt c.Long + RuNswap c.Long + RuInblock c.Long + RuOublock c.Long + RuMsgsnd c.Long + RuMsgrcv c.Long + RuNsignals c.Long + RuNvcsw c.Long + RuNivcsw c.Long +} +type RusageInfoV0 struct { + RiUuid [16]c.Uint8T + RiUserTime c.Uint64T + RiSystemTime c.Uint64T + RiPkgIdleWkups c.Uint64T + RiInterruptWkups c.Uint64T + RiPageins c.Uint64T + RiWiredSize c.Uint64T + RiResidentSize c.Uint64T + RiPhysFootprint c.Uint64T + RiProcStartAbstime c.Uint64T + RiProcExitAbstime c.Uint64T +} +type RusageInfoV1 struct { + RiUuid [16]c.Uint8T + RiUserTime c.Uint64T + RiSystemTime c.Uint64T + RiPkgIdleWkups c.Uint64T + RiInterruptWkups c.Uint64T + RiPageins c.Uint64T + RiWiredSize c.Uint64T + RiResidentSize c.Uint64T + RiPhysFootprint c.Uint64T + RiProcStartAbstime c.Uint64T + RiProcExitAbstime c.Uint64T + RiChildUserTime c.Uint64T + RiChildSystemTime c.Uint64T + RiChildPkgIdleWkups c.Uint64T + RiChildInterruptWkups c.Uint64T + RiChildPageins c.Uint64T + RiChildElapsedAbstime c.Uint64T +} +type RusageInfoV2 struct { + RiUuid [16]c.Uint8T + RiUserTime c.Uint64T + RiSystemTime c.Uint64T + RiPkgIdleWkups c.Uint64T + RiInterruptWkups c.Uint64T + RiPageins c.Uint64T + RiWiredSize c.Uint64T + RiResidentSize c.Uint64T + RiPhysFootprint c.Uint64T + RiProcStartAbstime c.Uint64T + RiProcExitAbstime c.Uint64T + RiChildUserTime c.Uint64T + RiChildSystemTime c.Uint64T + RiChildPkgIdleWkups c.Uint64T + RiChildInterruptWkups c.Uint64T + RiChildPageins c.Uint64T + RiChildElapsedAbstime c.Uint64T + RiDiskioBytesread c.Uint64T + RiDiskioByteswritten c.Uint64T +} +type RusageInfoV3 struct { + RiUuid [16]c.Uint8T + RiUserTime c.Uint64T + RiSystemTime c.Uint64T + RiPkgIdleWkups c.Uint64T + RiInterruptWkups c.Uint64T + RiPageins c.Uint64T + RiWiredSize c.Uint64T + RiResidentSize c.Uint64T + RiPhysFootprint c.Uint64T + RiProcStartAbstime c.Uint64T + RiProcExitAbstime c.Uint64T + RiChildUserTime c.Uint64T + RiChildSystemTime c.Uint64T + RiChildPkgIdleWkups c.Uint64T + RiChildInterruptWkups c.Uint64T + RiChildPageins c.Uint64T + RiChildElapsedAbstime c.Uint64T + RiDiskioBytesread c.Uint64T + RiDiskioByteswritten c.Uint64T + RiCpuTimeQosDefault c.Uint64T + RiCpuTimeQosMaintenance c.Uint64T + RiCpuTimeQosBackground c.Uint64T + RiCpuTimeQosUtility c.Uint64T + RiCpuTimeQosLegacy c.Uint64T + RiCpuTimeQosUserInitiated c.Uint64T + RiCpuTimeQosUserInteractive c.Uint64T + RiBilledSystemTime c.Uint64T + RiServicedSystemTime c.Uint64T +} +type RusageInfoV4 struct { + RiUuid [16]c.Uint8T + RiUserTime c.Uint64T + RiSystemTime c.Uint64T + RiPkgIdleWkups c.Uint64T + RiInterruptWkups c.Uint64T + RiPageins c.Uint64T + RiWiredSize c.Uint64T + RiResidentSize c.Uint64T + RiPhysFootprint c.Uint64T + RiProcStartAbstime c.Uint64T + RiProcExitAbstime c.Uint64T + RiChildUserTime c.Uint64T + RiChildSystemTime c.Uint64T + RiChildPkgIdleWkups c.Uint64T + RiChildInterruptWkups c.Uint64T + RiChildPageins c.Uint64T + RiChildElapsedAbstime c.Uint64T + RiDiskioBytesread c.Uint64T + RiDiskioByteswritten c.Uint64T + RiCpuTimeQosDefault c.Uint64T + RiCpuTimeQosMaintenance c.Uint64T + RiCpuTimeQosBackground c.Uint64T + RiCpuTimeQosUtility c.Uint64T + RiCpuTimeQosLegacy c.Uint64T + RiCpuTimeQosUserInitiated c.Uint64T + RiCpuTimeQosUserInteractive c.Uint64T + RiBilledSystemTime c.Uint64T + RiServicedSystemTime c.Uint64T + RiLogicalWrites c.Uint64T + RiLifetimeMaxPhysFootprint c.Uint64T + RiInstructions c.Uint64T + RiCycles c.Uint64T + RiBilledEnergy c.Uint64T + RiServicedEnergy c.Uint64T + RiIntervalMaxPhysFootprint c.Uint64T + RiRunnableTime c.Uint64T +} +type RusageInfoV5 struct { + RiUuid [16]c.Uint8T + RiUserTime c.Uint64T + RiSystemTime c.Uint64T + RiPkgIdleWkups c.Uint64T + RiInterruptWkups c.Uint64T + RiPageins c.Uint64T + RiWiredSize c.Uint64T + RiResidentSize c.Uint64T + RiPhysFootprint c.Uint64T + RiProcStartAbstime c.Uint64T + RiProcExitAbstime c.Uint64T + RiChildUserTime c.Uint64T + RiChildSystemTime c.Uint64T + RiChildPkgIdleWkups c.Uint64T + RiChildInterruptWkups c.Uint64T + RiChildPageins c.Uint64T + RiChildElapsedAbstime c.Uint64T + RiDiskioBytesread c.Uint64T + RiDiskioByteswritten c.Uint64T + RiCpuTimeQosDefault c.Uint64T + RiCpuTimeQosMaintenance c.Uint64T + RiCpuTimeQosBackground c.Uint64T + RiCpuTimeQosUtility c.Uint64T + RiCpuTimeQosLegacy c.Uint64T + RiCpuTimeQosUserInitiated c.Uint64T + RiCpuTimeQosUserInteractive c.Uint64T + RiBilledSystemTime c.Uint64T + RiServicedSystemTime c.Uint64T + RiLogicalWrites c.Uint64T + RiLifetimeMaxPhysFootprint c.Uint64T + RiInstructions c.Uint64T + RiCycles c.Uint64T + RiBilledEnergy c.Uint64T + RiServicedEnergy c.Uint64T + RiIntervalMaxPhysFootprint c.Uint64T + RiRunnableTime c.Uint64T + RiFlags c.Uint64T +} +type RusageInfoV6 struct { + RiUuid [16]c.Uint8T + RiUserTime c.Uint64T + RiSystemTime c.Uint64T + RiPkgIdleWkups c.Uint64T + RiInterruptWkups c.Uint64T + RiPageins c.Uint64T + RiWiredSize c.Uint64T + RiResidentSize c.Uint64T + RiPhysFootprint c.Uint64T + RiProcStartAbstime c.Uint64T + RiProcExitAbstime c.Uint64T + RiChildUserTime c.Uint64T + RiChildSystemTime c.Uint64T + RiChildPkgIdleWkups c.Uint64T + RiChildInterruptWkups c.Uint64T + RiChildPageins c.Uint64T + RiChildElapsedAbstime c.Uint64T + RiDiskioBytesread c.Uint64T + RiDiskioByteswritten c.Uint64T + RiCpuTimeQosDefault c.Uint64T + RiCpuTimeQosMaintenance c.Uint64T + RiCpuTimeQosBackground c.Uint64T + RiCpuTimeQosUtility c.Uint64T + RiCpuTimeQosLegacy c.Uint64T + RiCpuTimeQosUserInitiated c.Uint64T + RiCpuTimeQosUserInteractive c.Uint64T + RiBilledSystemTime c.Uint64T + RiServicedSystemTime c.Uint64T + RiLogicalWrites c.Uint64T + RiLifetimeMaxPhysFootprint c.Uint64T + RiInstructions c.Uint64T + RiCycles c.Uint64T + RiBilledEnergy c.Uint64T + RiServicedEnergy c.Uint64T + RiIntervalMaxPhysFootprint c.Uint64T + RiRunnableTime c.Uint64T + RiFlags c.Uint64T + RiUserPtime c.Uint64T + RiSystemPtime c.Uint64T + RiPinstructions c.Uint64T + RiPcycles c.Uint64T + RiEnergyNj c.Uint64T + RiPenergyNj c.Uint64T + RiReserved [14]c.Uint64T +} + +// A structure representing a resource limit. The address of an instance +// of this structure is the second parameter to getrlimit()/setrlimit(). +type Rlimit struct { + RlimCur RlimT + RlimMax RlimT +} +type ProcRlimitControlWakeupmon struct { + WmFlags c.Uint32T + WmRate Int32T +} + +// Resource limit type (low 63 bits, excluding the sign bit) +type RlimT = X__Uint64T +type RusageInfoT uintptr +type RusageInfoCurrent = RusageInfoV6 + +//go:linkname Getpriority C.getpriority +func Getpriority(_llcppg_param1 c.Int, _llcppg_param2 IdT) c.Int + +//go:linkname GetiopolicyNp C.getiopolicy_np +func GetiopolicyNp(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname Getrusage C.getrusage +func Getrusage(_llcppg_param1 c.Int, _llcppg_param2 *Rusage) c.Int + +//go:linkname Setpriority C.setpriority +func Setpriority(_llcppg_param1 c.Int, _llcppg_param2 IdT, _llcppg_param3 c.Int) c.Int + +//go:linkname SetiopolicyNp C.setiopolicy_np +func SetiopolicyNp(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int) c.Int diff --git a/c/os/sys-resource_linux_amd64.go b/c/os/sys-resource_linux_amd64.go new file mode 100644 index 00000000..d4f6245e --- /dev/null +++ b/c/os/sys-resource_linux_amd64.go @@ -0,0 +1,36 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_SYS_RESOURCE_H = 1 + +type X__RlimitResourceT = c.Int +type X__RusageWhoT = c.Int +type X__PriorityWhichT = c.Int + +// Return resource usage information on process indicated by WHO +// and put it in *USAGE. Returns 0 for success, -1 for failure. +// +//go:linkname Getrusage C.getrusage +func Getrusage(__who X__RusageWhoT, __usage *Rusage) c.Int + +// Return the highest priority of any process specified by WHICH and WHO +// (see above); if WHO is zero, the current process, process group, or user +// (as specified by WHO) is used. A lower priority number means higher +// priority. Priorities range from PRIO_MIN to PRIO_MAX (above). +// +//go:linkname Getpriority C.getpriority +func Getpriority(__which X__PriorityWhichT, __who IdT) c.Int + +// Set the priority of all processes specified by WHICH and WHO (see above) +// to PRIO. Returns 0 on success, -1 on errors. +// +//go:linkname Setpriority C.setpriority +func Setpriority(__which X__PriorityWhichT, __who IdT, __prio c.Int) c.Int diff --git a/c/os/sys-resource_linux_arm64.go b/c/os/sys-resource_linux_arm64.go new file mode 100644 index 00000000..0f42b879 --- /dev/null +++ b/c/os/sys-resource_linux_arm64.go @@ -0,0 +1,36 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_SYS_RESOURCE_H = 1 + +type X__RlimitResourceT = c.Int +type X__RusageWhoT = c.Int +type X__PriorityWhichT = c.Int + +// Return resource usage information on process indicated by WHO +// and put it in *USAGE. Returns 0 for success, -1 for failure. +// +//go:linkname Getrusage C.getrusage +func Getrusage(__who X__RusageWhoT, __usage *Rusage) c.Int + +// Return the highest priority of any process specified by WHICH and WHO +// (see above); if WHO is zero, the current process, process group, or user +// (as specified by WHO) is used. A lower priority number means higher +// priority. Priorities range from PRIO_MIN to PRIO_MAX (above). +// +//go:linkname Getpriority C.getpriority +func Getpriority(__which X__PriorityWhichT, __who IdT) c.Int + +// Set the priority of all processes specified by WHICH and WHO (see above) +// to PRIO. Returns 0 on success, -1 on errors. +// +//go:linkname Setpriority C.setpriority +func Setpriority(__which X__PriorityWhichT, __who IdT, __prio c.Int) c.Int diff --git a/c/os/sys-stat_darwin_arm64.go b/c/os/sys-stat_darwin_arm64.go new file mode 100644 index 00000000..f39ee979 --- /dev/null +++ b/c/os/sys-stat_darwin_arm64.go @@ -0,0 +1,168 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +// 0777 +const ACCESSPERMS = 511 + +// 7777 +const ALLPERMS = 4095 + +// 0666 +const DEFFILEMODE = 438 + +// block size used in the stat struct +const S_BLKSIZE = 512 + +// Definitions of flags stored in file flags word. +// +// Super-user and owner changeable flags. +const ( + UF_SETTABLE = 65535 + // do not dump file + UF_NODUMP = 1 + // file may not be changed + UF_IMMUTABLE = 2 + // writes to file may only append + UF_APPEND = 4 + // directory is opaque wrt. union + UF_OPAQUE = 8 +) + +// file is compressed (some file-systems) +const UF_COMPRESSED = 32 + +// UF_TRACKED is used for dealing with document IDs. We no longer issue +// +// notifications for deletes or renames for files which have UF_TRACKED set. +const UF_TRACKED = 64 + +// entitlement required for reading +const UF_DATAVAULT = 128 + +// Bits 0x0100 through 0x4000 are currently undefined. +const UF_HIDDEN = 32768 + +// Super-user changeable flags. +const ( + SF_SUPPORTED = 10420224 + // mask of superuser changeable flags + SF_SETTABLE = 1073676288 + // mask of system read-only synthetic flags + SF_SYNTHETIC = 3221225472 + // file is archived + SF_ARCHIVED = 65536 + // file may not be changed + SF_IMMUTABLE = 131072 + // writes to file may only append + SF_APPEND = 262144 + // entitlement required for writing + SF_RESTRICTED = 524288 + // Item may not be removed, renamed or mounted on + SF_NOUNLINK = 1048576 +) + +// file is a firmlink +const SF_FIRMLINK = 8388608 + +// Synthetic flags. +// +// These are read-only. We keep them out of SF_SUPPORTED so that +// attempts to set them will fail. +const SF_DATALESS = 1073741824 + +// Extended flags ("EF") returned by ATTR_CMNEXT_EXT_FLAGS from getattrlist/getattrlistbulk +const ( + EF_MAY_SHARE_BLOCKS = 1 + // file has no xattrs at all + EF_NO_XATTRS = 2 + // file is a sync root for iCloud + EF_IS_SYNC_ROOT = 4 + // file is purgeable + EF_IS_PURGEABLE = 8 + // file has at least one sparse region + EF_IS_SPARSE = 16 + // a synthetic directory/symlink + EF_IS_SYNTHETIC = 32 + // file shares all of its blocks with another file + EF_SHARES_ALL_BLOCKS = 64 +) +const ( + UTIME_NOW = -1 + UTIME_OMIT = -2 +) + +// XXX So deprecated, it would make your head spin +// +// The old stat structure. In fact, this is not used by the kernel at all, +// and should not be used by user space, and should be removed from this +// header file entirely (along with the unused cvtstat() prototype in +// vnode_internal.h). +type Ostat struct { + StDev X__Uint16T + StIno InoT + StMode ModeT + StNlink NlinkT + StUid X__Uint16T + StGid X__Uint16T + StRdev X__Uint16T + StSize X__Int32T + StAtimespec Timespec + StMtimespec Timespec + StCtimespec Timespec + StBlksize X__Int32T + StBlocks X__Int32T + StFlags X__Uint32T + StGen X__Uint32T +} + +//go:linkname Mkdirat C.mkdirat +func Mkdirat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 ModeT) c.Int + +//go:linkname Mkfifoat C.mkfifoat +func Mkfifoat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 ModeT) c.Int + +//go:linkname Mknodat C.mknodat +func Mknodat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 ModeT, _llcppg_param4 DevT) c.Int + +//go:linkname Futimens C.futimens +func Futimens(__fd c.Int, __times *Timespec) c.Int + +//go:linkname Utimensat C.utimensat +func Utimensat(__fd c.Int, __path *c.Char, __times *Timespec, __flag c.Int) c.Int + +//go:linkname Chflags C.chflags +func Chflags(_llcppg_param1 *c.Char, _llcppg_param2 X__Uint32T) c.Int + +//go:linkname ChmodxNp C.chmodx_np +func ChmodxNp(_llcppg_param1 *c.Char, _llcppg_param2 FilesecT) c.Int + +//go:linkname Fchflags C.fchflags +func Fchflags(_llcppg_param1 c.Int, _llcppg_param2 X__Uint32T) c.Int + +//go:linkname FchmodxNp C.fchmodx_np +func FchmodxNp(_llcppg_param1 c.Int, _llcppg_param2 FilesecT) c.Int + +//go:linkname Lchflags C.lchflags +func Lchflags(_llcppg_param1 *c.Char, _llcppg_param2 X__Uint32T) c.Int + +//go:linkname Lchmod C.lchmod +func Lchmod(_llcppg_param1 *c.Char, _llcppg_param2 ModeT) c.Int + +//go:linkname MkdirxNp C.mkdirx_np +func MkdirxNp(_llcppg_param1 *c.Char, _llcppg_param2 FilesecT) c.Int + +//go:linkname MkfifoxNp C.mkfifox_np +func MkfifoxNp(_llcppg_param1 *c.Char, _llcppg_param2 FilesecT) c.Int + +// llgo:link FilesecT.UmaskxNp C.umaskx_np +func (self FilesecT) UmaskxNp() c.Int { + return 0 +} diff --git a/c/os/sys-stat_linux_amd64.go b/c/os/sys-stat_linux_amd64.go new file mode 100644 index 00000000..379f2072 --- /dev/null +++ b/c/os/sys-stat_linux_amd64.go @@ -0,0 +1,76 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "github.com/goplus/lib/c/time" + _ "unsafe" +) + +const X_SYS_STAT_H = 1 +const ( + S_IREAD = 256 + S_IWRITE = 128 + S_IEXEC = 64 +) + +// Macros for common mode bit masks. +const ( + ACCESSPERMS = 511 + // 07777 + ALLPERMS = 4095 + // 0666 + DEFFILEMODE = 438 +) + +// Block size for `st_blocks'. +const S_BLKSIZE = 512 +const X_MKNOD_VER = 0 + +// Set file access permissions for FILE to MODE. +// If FILE is a symbolic link, this affects the link itself +// rather than its target. +// +//go:linkname Lchmod C.lchmod +func Lchmod(__file *c.Char, __mode X__ModeT) c.Int + +// Like mkdir, create a new directory with permission bits MODE. But +// interpret relative PATH names relative to the directory associated +// with FD. +// +//go:linkname Mkdirat C.mkdirat +func Mkdirat(__fd c.Int, __path *c.Char, __mode X__ModeT) c.Int + +// Like mknod, create a new device file with permission bits MODE and +// device number DEV. But interpret relative PATH names relative to +// the directory associated with FD. +// +//go:linkname Mknodat C.mknodat +func Mknodat(__fd c.Int, __path *c.Char, __mode X__ModeT, __dev X__DevT) c.Int + +// Like mkfifo, create a new FIFO with permission bits MODE. But +// interpret relative PATH names relative to the directory associated +// with FD. +// +//go:linkname Mkfifoat C.mkfifoat +func Mkfifoat(__fd c.Int, __path *c.Char, __mode X__ModeT) c.Int + +// Set file access and modification times relative to directory file +// descriptor. +// +//go:linkname Utimensat C.utimensat +func Utimensat(__fd c.Int, __path *c.Char, __times *time.Timespec, __flags c.Int) c.Int + +// Set file access and modification times of the file associated with FD. +// +//go:linkname Futimens C.futimens +func Futimens(__fd c.Int, __times *time.Timespec) c.Int + +//go:linkname X__Xmknod C.__xmknod +func X__Xmknod(__ver c.Int, __path *c.Char, __mode X__ModeT, __dev *X__DevT) c.Int + +//go:linkname X__Xmknodat C.__xmknodat +func X__Xmknodat(__ver c.Int, __fd c.Int, __path *c.Char, __mode X__ModeT, __dev *X__DevT) c.Int diff --git a/c/os/sys-stat_linux_arm64.go b/c/os/sys-stat_linux_arm64.go new file mode 100644 index 00000000..8f6c9e74 --- /dev/null +++ b/c/os/sys-stat_linux_arm64.go @@ -0,0 +1,76 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "github.com/goplus/lib/c/time" + _ "unsafe" +) + +const X_SYS_STAT_H = 1 +const ( + S_IREAD = 256 + S_IWRITE = 128 + S_IEXEC = 64 +) + +// Macros for common mode bit masks. +const ( + ACCESSPERMS = 511 + // 07777 + ALLPERMS = 4095 + // 0666 + DEFFILEMODE = 438 +) + +// Block size for `st_blocks'. +const S_BLKSIZE = 512 +const X_MKNOD_VER = 0 + +// Set file access permissions for FILE to MODE. +// If FILE is a symbolic link, this affects the link itself +// rather than its target. +// +//go:linkname Lchmod C.lchmod +func Lchmod(__file *uint8, __mode X__ModeT) c.Int + +// Like mkdir, create a new directory with permission bits MODE. But +// interpret relative PATH names relative to the directory associated +// with FD. +// +//go:linkname Mkdirat C.mkdirat +func Mkdirat(__fd c.Int, __path *uint8, __mode X__ModeT) c.Int + +// Like mknod, create a new device file with permission bits MODE and +// device number DEV. But interpret relative PATH names relative to +// the directory associated with FD. +// +//go:linkname Mknodat C.mknodat +func Mknodat(__fd c.Int, __path *uint8, __mode X__ModeT, __dev X__DevT) c.Int + +// Like mkfifo, create a new FIFO with permission bits MODE. But +// interpret relative PATH names relative to the directory associated +// with FD. +// +//go:linkname Mkfifoat C.mkfifoat +func Mkfifoat(__fd c.Int, __path *uint8, __mode X__ModeT) c.Int + +// Set file access and modification times relative to directory file +// descriptor. +// +//go:linkname Utimensat C.utimensat +func Utimensat(__fd c.Int, __path *uint8, __times *time.Timespec, __flags c.Int) c.Int + +// Set file access and modification times of the file associated with FD. +// +//go:linkname Futimens C.futimens +func Futimens(__fd c.Int, __times *time.Timespec) c.Int + +//go:linkname X__Xmknod C.__xmknod +func X__Xmknod(__ver c.Int, __path *uint8, __mode X__ModeT, __dev *X__DevT) c.Int + +//go:linkname X__Xmknodat C.__xmknodat +func X__Xmknodat(__ver c.Int, __fd c.Int, __path *uint8, __mode X__ModeT, __dev *X__DevT) c.Int diff --git a/c/os/sys-statvfs_darwin_arm64.go b/c/os/sys-statvfs_darwin_arm64.go new file mode 100644 index 00000000..090bd8c7 --- /dev/null +++ b/c/os/sys-statvfs_darwin_arm64.go @@ -0,0 +1,35 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +// Defined bits for f_flag field value +const ( + ST_RDONLY = 1 + // Does not honor setuid/setgid + ST_NOSUID = 2 +) + +// Following structure is used as a statvfs/fstatvfs function parameter +type Statvfs struct { + FBsize c.Ulong + FFrsize c.Ulong + FBlocks FsblkcntT + FBfree FsblkcntT + FBavail FsblkcntT + FFiles FsfilcntT + FFfree FsfilcntT + FFavail FsfilcntT + FFsid c.Ulong + FFlag c.Ulong + FNamemax c.Ulong +} + +//go:linkname Fstatvfs C.fstatvfs +func Fstatvfs(_llcppg_param1 c.Int, _llcppg_param2 *Statvfs) c.Int diff --git a/c/os/sys-statvfs_linux_amd64.go b/c/os/sys-statvfs_linux_amd64.go new file mode 100644 index 00000000..4958770f --- /dev/null +++ b/c/os/sys-statvfs_linux_amd64.go @@ -0,0 +1,15 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_SYS_STATVFS_H = 1 + +//go:linkname Fstatvfs C.fstatvfs +func Fstatvfs(__fildes c.Int, __buf *Statvfs) c.Int diff --git a/c/os/sys-statvfs_linux_arm64.go b/c/os/sys-statvfs_linux_arm64.go new file mode 100644 index 00000000..bfe88cbe --- /dev/null +++ b/c/os/sys-statvfs_linux_arm64.go @@ -0,0 +1,15 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_SYS_STATVFS_H = 1 + +//go:linkname Fstatvfs C.fstatvfs +func Fstatvfs(__fildes c.Int, __buf *Statvfs) c.Int diff --git a/c/os/sys-termios_darwin_arm64.go b/c/os/sys-termios_darwin_arm64.go new file mode 100644 index 00000000..0830efff --- /dev/null +++ b/c/os/sys-termios_darwin_arm64.go @@ -0,0 +1,384 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +// Special Control Characters +// +// Index into c_cc[] character array. +// +// Name Subscript Enabled by +const ( + VEOF = 0 + // ICANON + VEOL = 1 +) + +// ICANON together with IEXTEN +const VEOL2 = 2 + +// ICANON +const VERASE = 3 + +// ICANON together with IEXTEN +const VWERASE = 4 + +// ICANON +const VKILL = 5 + +// ICANON together with IEXTEN +const VREPRINT = 6 + +// 7 spare 1 +const ( + VINTR = 8 + // ISIG + VQUIT = 9 + // ISIG + VSUSP = 10 +) + +// ISIG together with IEXTEN +const VDSUSP = 11 +const ( + // IXON, IXOFF + VSTART = 12 + // IXON, IXOFF + VSTOP = 13 +) +const ( + // IEXTEN + VLNEXT = 14 + // IEXTEN + VDISCARD = 15 +) +const ( + // !ICANON + VMIN = 16 + // !ICANON + VTIME = 17 +) + +// ICANON together with IEXTEN +const VSTATUS = 18 +const NCCS = 20 + +// Input flags - software input processing +const ( + IGNBRK = 1 + // map BREAK to SIGINTR + BRKINT = 2 + // ignore (discard) parity errors + IGNPAR = 4 + // mark parity and framing errors + PARMRK = 8 + // enable checking of parity errors + INPCK = 16 + // strip 8th bit off chars + ISTRIP = 32 + // map NL into CR + INLCR = 64 + // ignore CR + IGNCR = 128 + // map CR to NL (ala CRMOD) + ICRNL = 256 + // enable output flow control + IXON = 512 + // enable input flow control + IXOFF = 1024 + // any char will restart after stop + IXANY = 2048 +) +const ( + // ring bell on input queue full + IMAXBEL = 8192 + // maintain state for UTF-8 VERASE + IUTF8 = 16384 +) + +// Output flags - software output processing +const ( + OPOST = 1 + // map NL to CR-NL (ala CRMOD) + ONLCR = 2 +) +const ( + // expand tabs to spaces + OXTABS = 4 + // discard EOT's (^D) on output) + ONOEOT = 8 +) + +// The following block of features is unimplemented. Use of these flags in +// programs will currently result in unexpected behaviour. +// +// - Begin unimplemented features +const ( + OCRNL = 16 + // no CR output at column 0 + ONOCR = 32 + // NL performs CR function + ONLRET = 64 + // use fill characters for delay + OFILL = 128 + // \n delay + NLDLY = 768 + // horizontal tab delay + TABDLY = 3076 + // \r delay + CRDLY = 12288 + // form feed delay + FFDLY = 16384 + // \b delay + BSDLY = 32768 + // vertical tab delay + VTDLY = 65536 + // fill is DEL, else NUL + OFDEL = 131072 +) + +// These manifest constants have the same names as those in the header +// , so you are not permitted to have both definitions +// in scope simultaneously in the same compilation unit. Nevertheless, +// they are required to be in scope when _POSIX_C_SOURCE is requested; +// this means that including the header before this +// one when _POSIX_C_SOURCE is in scope will result in redefintions. We +// attempt to maintain these as the same values so as to avoid this being +// an outright error in most compilers. +const ( + NL0 = 0 + NL1 = 256 +) +const ( + NL2 = 512 + NL3 = 768 +) + +// not in sys/ioctl_compat.h, use OXTABS value +const ( + TAB0 = 0 + TAB1 = 1024 + TAB2 = 2048 +) + +// not in sys/ioctl_compat.h, use OXTABS value +const ( + TAB3 = 4 + CR0 = 0 + CR1 = 4096 + CR2 = 8192 + CR3 = 12288 + FF0 = 0 + FF1 = 16384 + BS0 = 0 + BS1 = 32768 + VT0 = 0 + VT1 = 65536 +) + +// ignore control flags +const CIGNORE = 1 +const ( + // character size mask + CSIZE = 768 + // 5 bits (pseudo) + CS5 = 0 + // 6 bits + CS6 = 256 + // 7 bits + CS7 = 512 + // 8 bits + CS8 = 768 + // send 2 stop bits + CSTOPB = 1024 + // enable receiver + CREAD = 2048 + // parity enable + PARENB = 4096 + // odd parity, else even + PARODD = 8192 + // hang up on last close + HUPCL = 16384 + // ignore modem status lines + CLOCAL = 32768 +) +const ( + // CTS flow control of output + CCTS_OFLOW = 65536 + // RTS flow control of input + CRTS_IFLOW = 131072 + // DTR flow control of input + CDTR_IFLOW = 262144 + // DSR flow control of output + CDSR_OFLOW = 524288 + // DCD flow control of output + CCAR_OFLOW = 1048576 + // old name for CCAR_OFLOW + MDMBUF = 1048576 +) + +// visual erase for line kill +const ECHOKE = 1 +const ( + // visually erase chars + ECHOE = 2 + // echo NL after line kill + ECHOK = 4 + // enable echoing + ECHO = 8 + // echo NL even if ECHO is off + ECHONL = 16 +) +const ( + // visual erase mode for hardcopy + ECHOPRT = 32 + // echo control chars as ^(Char) + ECHOCTL = 64 +) +const ( + // enable signals INTR, QUIT, [D]SUSP + ISIG = 128 + // canonicalize input lines + ICANON = 256 +) + +// use alternate WERASE algorithm +const ALTWERASE = 512 + +// enable DISCARD and LNEXT +const IEXTEN = 1024 + +// external processing +const EXTPROC = 2048 + +// stop background jobs from output +const TOSTOP = 4194304 +const ( + // output being flushed (state) + FLUSHO = 8388608 + // no kernel output from VSTATUS + NOKERNINFO = 33554432 + // XXX retype pending input (state) + PENDIN = 536870912 +) + +// don't flush after interrupt +const NOFLSH = 2147483648 + +// Commands passed to tcsetattr() for setting the termios structure. +const ( + TCSANOW = 0 + // drain output, then change + TCSADRAIN = 1 + // drain output, flush input + TCSAFLUSH = 2 +) + +// flag - don't alter h.w. state +const TCSASOFT = 16 + +// Standard speeds +const ( + B0 = 0 + B50 = 50 + B75 = 75 + B110 = 110 + B134 = 134 + B150 = 150 + B200 = 200 + B300 = 300 + B600 = 600 + B1200 = 1200 + B1800 = 1800 + B2400 = 2400 + B4800 = 4800 + B9600 = 9600 + B19200 = 19200 + B38400 = 38400 +) +const ( + B7200 = 7200 + B14400 = 14400 + B28800 = 28800 + B57600 = 57600 + B76800 = 76800 + B115200 = 115200 + B230400 = 230400 + EXTA = 19200 + EXTB = 38400 +) +const ( + TCIFLUSH = 1 + TCOFLUSH = 2 + TCIOFLUSH = 3 + TCOOFF = 1 + TCOON = 2 + TCIOFF = 3 + TCION = 4 +) + +type Termios struct { + CIflag TcflagT + COflag TcflagT + CCflag TcflagT + CLflag TcflagT + CCc [20]CcT + CIspeed SpeedT + COspeed SpeedT +} +type TcflagT = c.Ulong +type CcT = uint8 +type SpeedT = c.Ulong + +// llgo:link (*Termios).Cfgetispeed C.cfgetispeed +func (self *Termios) Cfgetispeed() SpeedT { + return 0 +} + +// llgo:link (*Termios).Cfgetospeed C.cfgetospeed +func (self *Termios) Cfgetospeed() SpeedT { + return 0 +} + +// llgo:link (*Termios).Cfsetispeed C.cfsetispeed +func (self *Termios) Cfsetispeed(_llcppg_param2 SpeedT) c.Int { + return 0 +} + +// llgo:link (*Termios).Cfsetospeed C.cfsetospeed +func (self *Termios) Cfsetospeed(_llcppg_param2 SpeedT) c.Int { + return 0 +} + +//go:linkname Tcgetattr C.tcgetattr +func Tcgetattr(_llcppg_param1 c.Int, _llcppg_param2 *Termios) c.Int + +//go:linkname Tcsetattr C.tcsetattr +func Tcsetattr(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 *Termios) c.Int + +//go:linkname Tcdrain C.tcdrain +func Tcdrain(_llcppg_param1 c.Int) c.Int + +//go:linkname Tcflow C.tcflow +func Tcflow(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname Tcflush C.tcflush +func Tcflush(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname Tcsendbreak C.tcsendbreak +func Tcsendbreak(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +// llgo:link (*Termios).Cfmakeraw C.cfmakeraw +func (self *Termios) Cfmakeraw() { +} + +// llgo:link (*Termios).Cfsetspeed C.cfsetspeed +func (self *Termios) Cfsetspeed(_llcppg_param2 SpeedT) c.Int { + return 0 +} diff --git a/c/os/sys-times_darwin_arm64.go b/c/os/sys-times_darwin_arm64.go new file mode 100644 index 00000000..62b8333e --- /dev/null +++ b/c/os/sys-times_darwin_arm64.go @@ -0,0 +1,18 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +// [XSI] Structure whose address is passed as the first parameter to times() +type Tms struct { + TmsUtime ClockT + TmsStime ClockT + TmsCutime ClockT + TmsCstime ClockT +} + +// llgo:link (*Tms).Times C.times +func (self *Tms) Times() ClockT { + return 0 +} diff --git a/c/os/sys-times_linux_amd64.go b/c/os/sys-times_linux_amd64.go new file mode 100644 index 00000000..f3eb7a4c --- /dev/null +++ b/c/os/sys-times_linux_amd64.go @@ -0,0 +1,27 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c/time" + +const X_SYS_TIMES_H = 1 + +// Structure describing CPU time used by a process and its children. +type Tms struct { + TmsUtime time.ClockT + TmsStime time.ClockT + TmsCutime time.ClockT + TmsCstime time.ClockT +} + +// Store the CPU time used by this process and all its +// dead children (and their dead children) in BUFFER. +// Return the elapsed real time, or (clock_t) -1 for errors. +// All times are in CLK_TCKths of a second. +// +// llgo:link (*Tms).Times C.times +func (self *Tms) Times() time.ClockT { + return 0 +} diff --git a/c/os/sys-times_linux_arm64.go b/c/os/sys-times_linux_arm64.go new file mode 100644 index 00000000..37f8dd7a --- /dev/null +++ b/c/os/sys-times_linux_arm64.go @@ -0,0 +1,27 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c/time" + +const X_SYS_TIMES_H = 1 + +// Structure describing CPU time used by a process and its children. +type Tms struct { + TmsUtime time.ClockT + TmsStime time.ClockT + TmsCutime time.ClockT + TmsCstime time.ClockT +} + +// Store the CPU time used by this process and all its +// dead children (and their dead children) in BUFFER. +// Return the elapsed real time, or (clock_t) -1 for errors. +// All times are in CLK_TCKths of a second. +// +// llgo:link (*Tms).Times C.times +func (self *Tms) Times() time.ClockT { + return 0 +} diff --git a/c/os/sys-types_darwin_arm64.go b/c/os/sys-types_darwin_arm64.go new file mode 100644 index 00000000..be36fd5b --- /dev/null +++ b/c/os/sys-types_darwin_arm64.go @@ -0,0 +1,37 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +const +// bits in a byte +NBBY = 8 + +type ULong = c.Ulong + +// Sys V compatibility +type Ushort = uint16 + +// Sys V compatibility +type Uint = c.Uint + +// quads +type UQuadT = UInt64T +type QuadT = Int64T +type QaddrT = *QuadT + +// disk address +type DaddrT = Int32T + +// fixed point number +type FixptT = UInt32T + +// segment size +type SegszT = Int32T + +// swap offset +type SwblkT = Int32T +type FdMask = X__Int32T diff --git a/c/os/sys-types_linux_amd64.go b/c/os/sys-types_linux_amd64.go new file mode 100644 index 00000000..934c10ec --- /dev/null +++ b/c/os/sys-types_linux_amd64.go @@ -0,0 +1,50 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +const X_SYS_TYPES_H = 1 +const X__BIT_TYPES_DEFINED__ = 1 + +type UChar = X__UChar +type UShort = X__UShort +type UInt = X__UInt +type ULong = X__ULong +type QuadT = X__QuadT +type UQuadT = X__UQuadT +type FsidT = X__FsidT +type LoffT = X__LoffT +type InoT = X__InoT +type NlinkT = X__NlinkT +type IdT = X__IdT +type SsizeT = X__SsizeT +type DaddrT = X__DaddrT +type CaddrT = X__CaddrT +type KeyT = X__KeyT + +// Old compatibility names for C types. +type Ulong = c.Ulong +type Ushort = uint16 +type Uint = c.Uint +type Int8T = int8 +type Int16T = int16 +type Int32T = c.Int +type Int64T = c.Long +type UInt8T = uint8 +type UInt16T = uint16 +type UInt32T = c.Uint +type UInt64T = c.Ulong +type RegisterT = c.Long +type BlksizeT = X__BlksizeT + +// Type to count number of disk blocks. +type BlkcntT = X__BlkcntT + +// Type to count file system blocks. +type FsblkcntT = X__FsblkcntT + +// Type to count file system inodes. +type FsfilcntT = X__FsfilcntT diff --git a/c/os/sys-types_linux_arm64.go b/c/os/sys-types_linux_arm64.go new file mode 100644 index 00000000..6596b29e --- /dev/null +++ b/c/os/sys-types_linux_arm64.go @@ -0,0 +1,50 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +const X_SYS_TYPES_H = 1 +const X__BIT_TYPES_DEFINED__ = 1 + +type UChar = X__UChar +type UShort = X__UShort +type UInt = X__UInt +type ULong = X__ULong +type QuadT = X__QuadT +type UQuadT = X__UQuadT +type FsidT = X__FsidT +type LoffT = X__LoffT +type InoT = X__InoT +type NlinkT = X__NlinkT +type IdT = X__IdT +type SsizeT = X__SsizeT +type DaddrT = X__DaddrT +type CaddrT = X__CaddrT +type KeyT = X__KeyT + +// Old compatibility names for C types. +type Ulong = c.Ulong +type Ushort = uint16 +type Uint = c.Uint +type Int8T = int8 +type Int16T = int16 +type Int32T = c.Int +type Int64T = c.Long +type UInt8T = uint8 +type UInt16T = uint16 +type UInt32T = c.Uint +type UInt64T = c.Ulong +type RegisterT = c.Long +type BlksizeT = X__BlksizeT + +// Type to count number of disk blocks. +type BlkcntT = X__BlkcntT + +// Type to count file system blocks. +type FsblkcntT = X__FsblkcntT + +// Type to count file system inodes. +type FsfilcntT = X__FsfilcntT diff --git a/c/os/sys-uio_darwin_arm64.go b/c/os/sys-uio_darwin_arm64.go new file mode 100644 index 00000000..653c0934 --- /dev/null +++ b/c/os/sys-uio_darwin_arm64.go @@ -0,0 +1,39 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +// IO direction for uio_t. +// +// UIO_READ - data moves into iovec(s) associated with uio_t +// UIO_WRITE - data moves out of iovec(s) associated with uio_t +type UioRw c.Uint + +const ( + // IO direction for uio_t. + // UIO_READ - data moves into iovec(s) associated with uio_t + // UIO_WRITE - data moves out of iovec(s) associated with uio_t + UIO_READ UioRw = 0 + // IO direction for uio_t. + // UIO_READ - data moves into iovec(s) associated with uio_t + // UIO_WRITE - data moves out of iovec(s) associated with uio_t + UIO_WRITE UioRw = 1 +) + +//go:linkname Readv C.readv +func Readv(_llcppg_param1 c.Int, _llcppg_param2 *c.Iovec, _llcppg_param3 c.Int) SsizeT + +//go:linkname Writev C.writev +func Writev(_llcppg_param1 c.Int, _llcppg_param2 *c.Iovec, _llcppg_param3 c.Int) SsizeT + +//go:linkname Preadv C.preadv +func Preadv(_llcppg_param1 c.Int, _llcppg_param2 *c.Iovec, _llcppg_param3 c.Int, _llcppg_param4 OffT) SsizeT + +//go:linkname Pwritev C.pwritev +func Pwritev(_llcppg_param1 c.Int, _llcppg_param2 *c.Iovec, _llcppg_param3 c.Int, _llcppg_param4 OffT) SsizeT diff --git a/c/os/sys-uio_linux_amd64.go b/c/os/sys-uio_linux_amd64.go new file mode 100644 index 00000000..c6e6fd02 --- /dev/null +++ b/c/os/sys-uio_linux_amd64.go @@ -0,0 +1,62 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_SYS_UIO_H = 1 + +// Read data from file descriptor FD, and put the result in the +// buffers described by IOVEC, which is a vector of COUNT 'struct iovec's. +// The buffers are filled in the order specified. +// Operates just like 'read' (see ) except that data are +// put in IOVEC instead of a contiguous buffer. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Readv C.readv +func Readv(__fd c.Int, __iovec *c.Iovec, __count c.Int) SsizeT + +// Write data pointed by the buffers described by IOVEC, which +// is a vector of COUNT 'struct iovec's, to file descriptor FD. +// The data is written in the order specified. +// Operates just like 'write' (see ) except that the data +// are taken from IOVEC instead of a contiguous buffer. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Writev C.writev +func Writev(__fd c.Int, __iovec *c.Iovec, __count c.Int) SsizeT + +// Read data from file descriptor FD at the given position OFFSET +// without change the file pointer, and put the result in the buffers +// described by IOVEC, which is a vector of COUNT 'struct iovec's. +// The buffers are filled in the order specified. Operates just like +// 'pread' (see ) except that data are put in IOVEC instead +// of a contiguous buffer. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Preadv C.preadv +func Preadv(__fd c.Int, __iovec *c.Iovec, __count c.Int, __offset X__OffT) SsizeT + +// Write data pointed by the buffers described by IOVEC, which is a +// vector of COUNT 'struct iovec's, to file descriptor FD at the given +// position OFFSET without change the file pointer. The data is +// written in the order specified. Operates just like 'pwrite' (see +// ) except that the data are taken from IOVEC instead of a +// contiguous buffer. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Pwritev C.pwritev +func Pwritev(__fd c.Int, __iovec *c.Iovec, __count c.Int, __offset X__OffT) SsizeT diff --git a/c/os/sys-uio_linux_arm64.go b/c/os/sys-uio_linux_arm64.go new file mode 100644 index 00000000..86177c27 --- /dev/null +++ b/c/os/sys-uio_linux_arm64.go @@ -0,0 +1,62 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_SYS_UIO_H = 1 + +// Read data from file descriptor FD, and put the result in the +// buffers described by IOVEC, which is a vector of COUNT 'struct iovec's. +// The buffers are filled in the order specified. +// Operates just like 'read' (see ) except that data are +// put in IOVEC instead of a contiguous buffer. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Readv C.readv +func Readv(__fd c.Int, __iovec *c.Iovec, __count c.Int) SsizeT + +// Write data pointed by the buffers described by IOVEC, which +// is a vector of COUNT 'struct iovec's, to file descriptor FD. +// The data is written in the order specified. +// Operates just like 'write' (see ) except that the data +// are taken from IOVEC instead of a contiguous buffer. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Writev C.writev +func Writev(__fd c.Int, __iovec *c.Iovec, __count c.Int) SsizeT + +// Read data from file descriptor FD at the given position OFFSET +// without change the file pointer, and put the result in the buffers +// described by IOVEC, which is a vector of COUNT 'struct iovec's. +// The buffers are filled in the order specified. Operates just like +// 'pread' (see ) except that data are put in IOVEC instead +// of a contiguous buffer. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Preadv C.preadv +func Preadv(__fd c.Int, __iovec *c.Iovec, __count c.Int, __offset X__OffT) SsizeT + +// Write data pointed by the buffers described by IOVEC, which is a +// vector of COUNT 'struct iovec's, to file descriptor FD at the given +// position OFFSET without change the file pointer. The data is +// written in the order specified. Operates just like 'pwrite' (see +// ) except that the data are taken from IOVEC instead of a +// contiguous buffer. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Pwritev C.pwritev +func Pwritev(__fd c.Int, __iovec *c.Iovec, __count c.Int, __offset X__OffT) SsizeT diff --git a/c/os/sys-utsname_darwin_arm64.go b/c/os/sys-utsname_darwin_arm64.go new file mode 100644 index 00000000..22368d9e --- /dev/null +++ b/c/os/sys-utsname_darwin_arm64.go @@ -0,0 +1,22 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +const X_SYS_NAMELEN = 256 + +type Utsname struct { + Sysname [256]c.Char + Nodename [256]c.Char + Release [256]c.Char + Version [256]c.Char + Machine [256]c.Char +} + +// llgo:link (*Utsname).Uname C.uname +func (self *Utsname) Uname() c.Int { + return 0 +} diff --git a/c/os/sys-utsname_linux_amd64.go b/c/os/sys-utsname_linux_amd64.go new file mode 100644 index 00000000..55fa2faf --- /dev/null +++ b/c/os/sys-utsname_linux_amd64.go @@ -0,0 +1,26 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +const X_SYS_UTSNAME_H = 1 + +// Structure describing the system and machine. +type Utsname struct { + Sysname [65]c.Char + Nodename [65]c.Char + Release [65]c.Char + Version [65]c.Char + Machine [65]c.Char + X__Domainname [65]c.Char +} + +// Put information about the system in NAME. +// +// llgo:link (*Utsname).Uname C.uname +func (self *Utsname) Uname() c.Int { + return 0 +} diff --git a/c/os/sys-utsname_linux_arm64.go b/c/os/sys-utsname_linux_arm64.go new file mode 100644 index 00000000..3ad84c7a --- /dev/null +++ b/c/os/sys-utsname_linux_arm64.go @@ -0,0 +1,26 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import "github.com/goplus/lib/c" + +const X_SYS_UTSNAME_H = 1 + +// Structure describing the system and machine. +type Utsname struct { + Sysname [65]uint8 + Nodename [65]uint8 + Release [65]uint8 + Version [65]uint8 + Machine [65]uint8 + X__Domainname [65]uint8 +} + +// Put information about the system in NAME. +// +// llgo:link (*Utsname).Uname C.uname +func (self *Utsname) Uname() c.Int { + return 0 +} diff --git a/c/os/sys-wait_darwin_arm64.go b/c/os/sys-wait_darwin_arm64.go new file mode 100644 index 00000000..8a09277c --- /dev/null +++ b/c/os/sys-wait_darwin_arm64.go @@ -0,0 +1,163 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "github.com/goplus/lib/c/bitfield" + "github.com/goplus/lib/c/signal" + "unsafe" +) + +// Option bits for the third argument of wait4. WNOHANG causes the +// wait to not hang if there are no stopped or terminated processes, rather +// returning an error indication in this case (pid==0). WUNTRACED +// indicates that the caller should receive status about untraced children +// which stop due to signals. If children are stopped and a wait without +// this option is done, it is as though they were still running... nothing +// about them is returned. +const ( + WNOHANG = 1 + // [XSI] notify on stop, untraced child + WUNTRACED = 2 +) +const WCOREFLAG = 128 + +// _WSTATUS if process is stopped +const X_WSTOPPED = 127 + +// WUNTRACED defined for wait4() but not for waitid() +const WEXITED = 4 + +// waitid() parameter +const WSTOPPED = 8 +const ( + // [XSI] Any child stopped then continued + WCONTINUED = 16 + // [XSI] Leave process returned waitable + WNOWAIT = 32 +) + +// Tokens for special values of the "pid" parameter to wait4. +const ( + WAIT_ANY = -1 + // any process in my process group + WAIT_MYPGRP = 0 +) + +// [XSI] The type idtype_t shall be defined as an enumeration type whose +// possible values shall include at least P_ALL, P_PID, and P_PGID. +type IdtypeT c.Uint + +const ( + P_ALL IdtypeT = 0 + P_PID IdtypeT = 1 + P_PGID IdtypeT = 2 +) + +type WaitStatus struct { + _xgo_union [1]uint32 +} + +func (p *WaitStatus) XGof_ref_w_status() *c.Int { + return (*c.Int)(unsafe.Pointer(p)) +} + +// Terminated process status. +type _llcppg_anon_0 struct { + _xgo_align [0]uint32 + _xgo_bits_0 [4]uint8 +} + +func (p *WaitStatus) XGof_ref_w_T() *_llcppg_anon_0 { + return (*_llcppg_anon_0)(unsafe.Pointer(p)) +} + +// Stopped process status. Returned +// only for traced children unless requested +// with the WUNTRACED option bit. +type _llcppg_anon_1 struct { + _xgo_align [0]uint32 + _xgo_bits_0 [4]uint8 +} + +func (p *WaitStatus) XGof_ref_w_S() *_llcppg_anon_1 { + return (*_llcppg_anon_1)(unsafe.Pointer(p)) +} + +// llgo:link IdtypeT.Waitid C.waitid +func (self IdtypeT) Waitid(_llcppg_param2 IdT, _llcppg_param3 *signal.SiginfoT, _llcppg_param4 c.Int) c.Int { + return 0 +} + +// unsigned int w_Termsig : 7 +func (p *_llcppg_anon_0) XGof_get_w_Termsig() c.Uint { + return c.Uint(bitfield.Unsigned(unsafe.Pointer(p), 0, 7)) +} + +// unsigned int w_Termsig : 7 +func (p *_llcppg_anon_0) XGof_set_w_Termsig(v c.Uint) { + bitfield.Set(unsafe.Pointer(p), 0, 7, uint64(v)) +} + +// unsigned int w_Coredump : 1 +func (p *_llcppg_anon_0) XGof_get_w_Coredump() c.Uint { + return c.Uint(bitfield.Unsigned(unsafe.Pointer(p), 7, 1)) +} + +// unsigned int w_Coredump : 1 +func (p *_llcppg_anon_0) XGof_set_w_Coredump(v c.Uint) { + bitfield.Set(unsafe.Pointer(p), 7, 1, uint64(v)) +} + +// unsigned int w_Retcode : 8 +func (p *_llcppg_anon_0) XGof_get_w_Retcode() c.Uint { + return c.Uint(bitfield.Unsigned(unsafe.Pointer(p), 8, 8)) +} + +// unsigned int w_Retcode : 8 +func (p *_llcppg_anon_0) XGof_set_w_Retcode(v c.Uint) { + bitfield.Set(unsafe.Pointer(p), 8, 8, uint64(v)) +} + +// unsigned int w_Filler : 16 +func (p *_llcppg_anon_0) XGof_get_w_Filler() c.Uint { + return c.Uint(bitfield.Unsigned(unsafe.Pointer(p), 16, 16)) +} + +// unsigned int w_Filler : 16 +func (p *_llcppg_anon_0) XGof_set_w_Filler(v c.Uint) { + bitfield.Set(unsafe.Pointer(p), 16, 16, uint64(v)) +} + +// unsigned int w_Stopval : 8 +func (p *_llcppg_anon_1) XGof_get_w_Stopval() c.Uint { + return c.Uint(bitfield.Unsigned(unsafe.Pointer(p), 0, 8)) +} + +// unsigned int w_Stopval : 8 +func (p *_llcppg_anon_1) XGof_set_w_Stopval(v c.Uint) { + bitfield.Set(unsafe.Pointer(p), 0, 8, uint64(v)) +} + +// unsigned int w_Stopsig : 8 +func (p *_llcppg_anon_1) XGof_get_w_Stopsig() c.Uint { + return c.Uint(bitfield.Unsigned(unsafe.Pointer(p), 8, 8)) +} + +// unsigned int w_Stopsig : 8 +func (p *_llcppg_anon_1) XGof_set_w_Stopsig(v c.Uint) { + bitfield.Set(unsafe.Pointer(p), 8, 8, uint64(v)) +} + +// unsigned int w_Filler : 16 +func (p *_llcppg_anon_1) XGof_get_w_Filler() c.Uint { + return c.Uint(bitfield.Unsigned(unsafe.Pointer(p), 16, 16)) +} + +// unsigned int w_Filler : 16 +func (p *_llcppg_anon_1) XGof_set_w_Filler(v c.Uint) { + bitfield.Set(unsafe.Pointer(p), 16, 16, uint64(v)) +} diff --git a/c/os/sys-wait_linux_amd64.go b/c/os/sys-wait_linux_amd64.go new file mode 100644 index 00000000..e022ac09 --- /dev/null +++ b/c/os/sys-wait_linux_amd64.go @@ -0,0 +1,45 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "github.com/goplus/lib/c/signal" +) + +const X_SYS_WAIT_H = 1 + +// Special values for the PID argument to `waitpid' and `wait4'. +const ( + WAIT_ANY = -1 + // Any process in my process group. + WAIT_MYPGRP = 0 +) + +type IdtypeT c.Uint + +const ( + P_ALL IdtypeT = 0 + P_PID IdtypeT = 1 + // Wait for members of process group. + P_PGID IdtypeT = 2 +) + +// Wait for a childing matching IDTYPE and ID to change the status and +// place appropriate information in *INFOP. +// If IDTYPE is P_PID, match any process whose process ID is ID. +// If IDTYPE is P_PGID, match any process whose process group is ID. +// If IDTYPE is P_ALL, match any process. +// If the WNOHANG bit is set in OPTIONS, and that child +// is not already dead, clear *INFOP and return 0. If successful, store +// exit code and status in *INFOP. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +// llgo:link IdtypeT.Waitid C.waitid +func (self IdtypeT) Waitid(__id X__IdT, __infop *signal.SiginfoT, __options c.Int) c.Int { + return 0 +} diff --git a/c/os/sys-wait_linux_arm64.go b/c/os/sys-wait_linux_arm64.go new file mode 100644 index 00000000..86599aad --- /dev/null +++ b/c/os/sys-wait_linux_arm64.go @@ -0,0 +1,45 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "github.com/goplus/lib/c/signal" +) + +const X_SYS_WAIT_H = 1 + +// Special values for the PID argument to `waitpid' and `wait4'. +const ( + WAIT_ANY = -1 + // Any process in my process group. + WAIT_MYPGRP = 0 +) + +type IdtypeT c.Uint + +const ( + P_ALL IdtypeT = 0 + P_PID IdtypeT = 1 + // Wait for members of process group. + P_PGID IdtypeT = 2 +) + +// Wait for a childing matching IDTYPE and ID to change the status and +// place appropriate information in *INFOP. +// If IDTYPE is P_PID, match any process whose process ID is ID. +// If IDTYPE is P_PGID, match any process whose process group is ID. +// If IDTYPE is P_ALL, match any process. +// If the WNOHANG bit is set in OPTIONS, and that child +// is not already dead, clear *INFOP and return 0. If successful, store +// exit code and status in *INFOP. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +// llgo:link IdtypeT.Waitid C.waitid +func (self IdtypeT) Waitid(__id X__IdT, __infop *signal.SiginfoT, __options c.Int) c.Int { + return 0 +} diff --git a/c/os/termios_darwin_arm64.go b/c/os/termios_darwin_arm64.go new file mode 100644 index 00000000..41cb579a --- /dev/null +++ b/c/os/termios_darwin_arm64.go @@ -0,0 +1,13 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +//go:linkname Tcgetsid C.tcgetsid +func Tcgetsid(_llcppg_param1 c.Int) PidT diff --git a/c/os/termios_linux_amd64.go b/c/os/termios_linux_amd64.go new file mode 100644 index 00000000..ad7eb887 --- /dev/null +++ b/c/os/termios_linux_amd64.go @@ -0,0 +1,94 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_TERMIOS_H = 1 + +// Return the output baud rate stored in *TERMIOS_P. +// +// llgo:link (*Termios).Cfgetospeed C.cfgetospeed +func (self *Termios) Cfgetospeed() SpeedT { + return 0 +} + +// Return the input baud rate stored in *TERMIOS_P. +// +// llgo:link (*Termios).Cfgetispeed C.cfgetispeed +func (self *Termios) Cfgetispeed() SpeedT { + return 0 +} + +// Set the output baud rate stored in *TERMIOS_P to SPEED. +// +// llgo:link (*Termios).Cfsetospeed C.cfsetospeed +func (self *Termios) Cfsetospeed(__speed SpeedT) c.Int { + return 0 +} + +// Set the input baud rate stored in *TERMIOS_P to SPEED. +// +// llgo:link (*Termios).Cfsetispeed C.cfsetispeed +func (self *Termios) Cfsetispeed(__speed SpeedT) c.Int { + return 0 +} + +// Set both the input and output baud rates in *TERMIOS_OP to SPEED. +// +// llgo:link (*Termios).Cfsetspeed C.cfsetspeed +func (self *Termios) Cfsetspeed(__speed SpeedT) c.Int { + return 0 +} + +// Put the state of FD into *TERMIOS_P. +// +//go:linkname Tcgetattr C.tcgetattr +func Tcgetattr(__fd c.Int, __termios_p *Termios) c.Int + +// Set the state of FD to *TERMIOS_P. +// Values for OPTIONAL_ACTIONS (TCSA*) are in . +// +//go:linkname Tcsetattr C.tcsetattr +func Tcsetattr(__fd c.Int, __optional_actions c.Int, __termios_p *Termios) c.Int + +// Set *TERMIOS_P to indicate raw mode. +// +// llgo:link (*Termios).Cfmakeraw C.cfmakeraw +func (self *Termios) Cfmakeraw() { +} + +// Send zero bits on FD. +// +//go:linkname Tcsendbreak C.tcsendbreak +func Tcsendbreak(__fd c.Int, __duration c.Int) c.Int + +// Wait for pending output to be written on FD. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Tcdrain C.tcdrain +func Tcdrain(__fd c.Int) c.Int + +// Flush pending data on FD. +// Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in . +// +//go:linkname Tcflush C.tcflush +func Tcflush(__fd c.Int, __queue_selector c.Int) c.Int + +// Suspend or restart transmission on FD. +// Values for ACTION (TC[IO]{OFF,ON}) are in . +// +//go:linkname Tcflow C.tcflow +func Tcflow(__fd c.Int, __action c.Int) c.Int + +// Get process group ID for session leader for controlling terminal FD. +// +//go:linkname Tcgetsid C.tcgetsid +func Tcgetsid(__fd c.Int) X__PidT diff --git a/c/os/termios_linux_arm64.go b/c/os/termios_linux_arm64.go new file mode 100644 index 00000000..34b78d31 --- /dev/null +++ b/c/os/termios_linux_arm64.go @@ -0,0 +1,94 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_TERMIOS_H = 1 + +// Return the output baud rate stored in *TERMIOS_P. +// +// llgo:link (*Termios).Cfgetospeed C.cfgetospeed +func (self *Termios) Cfgetospeed() SpeedT { + return 0 +} + +// Return the input baud rate stored in *TERMIOS_P. +// +// llgo:link (*Termios).Cfgetispeed C.cfgetispeed +func (self *Termios) Cfgetispeed() SpeedT { + return 0 +} + +// Set the output baud rate stored in *TERMIOS_P to SPEED. +// +// llgo:link (*Termios).Cfsetospeed C.cfsetospeed +func (self *Termios) Cfsetospeed(__speed SpeedT) c.Int { + return 0 +} + +// Set the input baud rate stored in *TERMIOS_P to SPEED. +// +// llgo:link (*Termios).Cfsetispeed C.cfsetispeed +func (self *Termios) Cfsetispeed(__speed SpeedT) c.Int { + return 0 +} + +// Set both the input and output baud rates in *TERMIOS_OP to SPEED. +// +// llgo:link (*Termios).Cfsetspeed C.cfsetspeed +func (self *Termios) Cfsetspeed(__speed SpeedT) c.Int { + return 0 +} + +// Put the state of FD into *TERMIOS_P. +// +//go:linkname Tcgetattr C.tcgetattr +func Tcgetattr(__fd c.Int, __termios_p *Termios) c.Int + +// Set the state of FD to *TERMIOS_P. +// Values for OPTIONAL_ACTIONS (TCSA*) are in . +// +//go:linkname Tcsetattr C.tcsetattr +func Tcsetattr(__fd c.Int, __optional_actions c.Int, __termios_p *Termios) c.Int + +// Set *TERMIOS_P to indicate raw mode. +// +// llgo:link (*Termios).Cfmakeraw C.cfmakeraw +func (self *Termios) Cfmakeraw() { +} + +// Send zero bits on FD. +// +//go:linkname Tcsendbreak C.tcsendbreak +func Tcsendbreak(__fd c.Int, __duration c.Int) c.Int + +// Wait for pending output to be written on FD. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Tcdrain C.tcdrain +func Tcdrain(__fd c.Int) c.Int + +// Flush pending data on FD. +// Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in . +// +//go:linkname Tcflush C.tcflush +func Tcflush(__fd c.Int, __queue_selector c.Int) c.Int + +// Suspend or restart transmission on FD. +// Values for ACTION (TC[IO]{OFF,ON}) are in . +// +//go:linkname Tcflow C.tcflow +func Tcflow(__fd c.Int, __action c.Int) c.Int + +// Get process group ID for session leader for controlling terminal FD. +// +//go:linkname Tcgetsid C.tcgetsid +func Tcgetsid(__fd c.Int) X__PidT diff --git a/c/os/types_darwin_arm64.go b/c/os/types_darwin_arm64.go deleted file mode 100644 index 7b796b16..00000000 --- a/c/os/types_darwin_arm64.go +++ /dev/null @@ -1,26 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. -// Extracted from the common libc binding. - -package os - -import ( - "github.com/goplus/lib/c" -) - -type Termios struct { - CIflag TcflagT - COflag TcflagT - CCflag TcflagT - CLflag TcflagT - CCc [20]CcT - CIspeed SpeedT - COspeed SpeedT -} - -type TcflagT = c.Ulong - -type CcT = uint8 - -type SpeedT = c.Ulong diff --git a/c/os/types_linux_amd64.go b/c/os/types_linux_amd64.go deleted file mode 100644 index 741ca8eb..00000000 --- a/c/os/types_linux_amd64.go +++ /dev/null @@ -1,52 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. -// Extracted from the common libc binding. - -package os - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -type Termios struct { - CIflag TcflagT - COflag TcflagT - CCflag TcflagT - CLflag TcflagT - CLine CcT - CCc [32]CcT - _llcppg_anon_24 - _llcppg_anon_25 -} - -type _llcppg_anon_24 struct { - _xgo_union [1]uint32 -} - -type _llcppg_anon_25 struct { - _xgo_union [1]uint32 -} - -func (p *_llcppg_anon_24) XGof_ref___ispeed() *SpeedT { - return (*SpeedT)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_24) XGof_ref_c_ispeed() *SpeedT { - return (*SpeedT)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_25) XGof_ref___ospeed() *SpeedT { - return (*SpeedT)(unsafe.Pointer(p)) -} - -func (p *_llcppg_anon_25) XGof_ref_c_ospeed() *SpeedT { - return (*SpeedT)(unsafe.Pointer(p)) -} - -type CcT = uint8 - -type SpeedT = c.Uint - -type TcflagT = c.Uint diff --git a/c/os/unistd_darwin_arm64.go b/c/os/unistd_darwin_arm64.go new file mode 100644 index 00000000..95aa95f8 --- /dev/null +++ b/c/os/unistd_darwin_arm64.go @@ -0,0 +1,739 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const ( + // standard input file descriptor + STDIN_FILENO = 0 + // standard output file descriptor + STDOUT_FILENO = 1 + // standard error file descriptor + STDERR_FILENO = 2 +) + +// _POSIX_VERSION and _POSIX2_VERSION from sys/unistd.h +const ( + X_XOPEN_VERSION = 600 + // Older standard + X_XOPEN_XCU_VERSION = 4 +) + +// Please keep this list in the same order as the applicable standard +const ( + X_POSIX_ADVISORY_INFO = -1 + // [AIO] + X_POSIX_ASYNCHRONOUS_IO = -1 + // [BAR] + X_POSIX_BARRIERS = -1 + // [CS] + X_POSIX_CLOCK_SELECTION = -1 + // [CPT] + X_POSIX_CPUTIME = -1 + // [ML] + X_POSIX_MEMLOCK = -1 + // [MR] + X_POSIX_MEMLOCK_RANGE = -1 + // [MSG] + X_POSIX_MESSAGE_PASSING = -1 + // [MON] + X_POSIX_MONOTONIC_CLOCK = -1 + // [PIO] + X_POSIX_PRIORITIZED_IO = -1 + // [PS] + X_POSIX_PRIORITY_SCHEDULING = -1 + // [RS] + X_POSIX_RAW_SOCKETS = -1 + // [RTS] + X_POSIX_REALTIME_SIGNALS = -1 + // [SEM] + X_POSIX_SEMAPHORES = -1 + // [SHM] + X_POSIX_SHARED_MEMORY_OBJECTS = -1 + // [SPI] + X_POSIX_SPIN_LOCKS = -1 + // [SS] + X_POSIX_SPORADIC_SERVER = -1 + // [SIO] + X_POSIX_SYNCHRONIZED_IO = -1 + // [TCT] + X_POSIX_THREAD_CPUTIME = -1 + // [TPI] + X_POSIX_THREAD_PRIO_INHERIT = -1 + // [TPP] + X_POSIX_THREAD_PRIO_PROTECT = -1 + // [TPS] + X_POSIX_THREAD_PRIORITY_SCHEDULING = -1 + // [TSP] + X_POSIX_THREAD_SPORADIC_SERVER = -1 + // [TMO] + X_POSIX_TIMEOUTS = -1 + // [TMR] + X_POSIX_TIMERS = -1 + // [TRC] + X_POSIX_TRACE = -1 + // [TEF] + X_POSIX_TRACE_EVENT_FILTER = -1 + // [TRI] + X_POSIX_TRACE_INHERIT = -1 + // [TRL] + X_POSIX_TRACE_LOG = -1 + // [TYM] + X_POSIX_TYPED_MEMORY_OBJECTS = -1 +) +const ( + // fort77 command + X_POSIX2_FORT_DEV = -1 + X_POSIX2_PBS = -1 + X_POSIX2_PBS_ACCOUNTING = -1 + X_POSIX2_PBS_CHECKPOINT = -1 + X_POSIX2_PBS_LOCATE = -1 + X_POSIX2_PBS_MESSAGE = -1 + X_POSIX2_PBS_TRACK = -1 +) +const ( + X__ILP32_OFF32 = -1 + X__ILP32_OFFBIG = -1 +) +const ( + X__LP64_OFF64 = 1 + X__LPBIG_OFFBIG = 1 +) +const ( + X_POSIX_V6_ILP32_OFF32 = -1 + X_POSIX_V6_ILP32_OFFBIG = -1 + X_POSIX_V6_LP64_OFF64 = 1 + X_POSIX_V6_LPBIG_OFFBIG = 1 +) +const ( + X_POSIX_V7_ILP32_OFF32 = -1 + X_POSIX_V7_ILP32_OFFBIG = -1 + X_POSIX_V7_LP64_OFF64 = 1 + X_POSIX_V7_LPBIG_OFFBIG = 1 +) +const ( + X_V6_ILP32_OFF32 = -1 + X_V6_ILP32_OFFBIG = -1 + X_V6_LP64_OFF64 = 1 + X_V6_LPBIG_OFFBIG = 1 +) + +// Removed in Issue 7 +const ( + X_XBS5_ILP32_OFF32 = -1 + X_XBS5_ILP32_OFFBIG = -1 + X_XBS5_LP64_OFF64 = 1 + X_XBS5_LPBIG_OFFBIG = 1 +) +const ( + X_XOPEN_CRYPT = 1 + // XXX required + X_XOPEN_ENH_I18N = 1 + // no ftime gcvt, wcswcs + X_XOPEN_LEGACY = -1 + // no q'ed signals, mq_* + X_XOPEN_REALTIME = -1 + // no posix_spawn, et. al. + X_XOPEN_REALTIME_THREADS = -1 + X_XOPEN_SHM = 1 + // Issue 6 + X_XOPEN_STREAMS = -1 + X_XOPEN_UNIX = 1 +) + +// configurable system variables +const ( + X_SC_ARG_MAX = 1 + X_SC_CHILD_MAX = 2 + X_SC_CLK_TCK = 3 + X_SC_NGROUPS_MAX = 4 + X_SC_OPEN_MAX = 5 + X_SC_JOB_CONTROL = 6 + X_SC_SAVED_IDS = 7 + X_SC_VERSION = 8 + X_SC_BC_BASE_MAX = 9 + X_SC_BC_DIM_MAX = 10 + X_SC_BC_SCALE_MAX = 11 + X_SC_BC_STRING_MAX = 12 + X_SC_COLL_WEIGHTS_MAX = 13 + X_SC_EXPR_NEST_MAX = 14 + X_SC_LINE_MAX = 15 + X_SC_RE_DUP_MAX = 16 + X_SC_2_VERSION = 17 + X_SC_2_C_BIND = 18 + X_SC_2_C_DEV = 19 + X_SC_2_CHAR_TERM = 20 + X_SC_2_FORT_DEV = 21 + X_SC_2_FORT_RUN = 22 + X_SC_2_LOCALEDEF = 23 + X_SC_2_SW_DEV = 24 + X_SC_2_UPE = 25 + X_SC_STREAM_MAX = 26 + X_SC_TZNAME_MAX = 27 +) +const ( + X_SC_ASYNCHRONOUS_IO = 28 + X_SC_PAGESIZE = 29 + X_SC_MEMLOCK = 30 + X_SC_MEMLOCK_RANGE = 31 + X_SC_MEMORY_PROTECTION = 32 + X_SC_MESSAGE_PASSING = 33 + X_SC_PRIORITIZED_IO = 34 + X_SC_PRIORITY_SCHEDULING = 35 + X_SC_REALTIME_SIGNALS = 36 + X_SC_SEMAPHORES = 37 + X_SC_FSYNC = 38 + X_SC_SHARED_MEMORY_OBJECTS = 39 + X_SC_SYNCHRONIZED_IO = 40 + X_SC_TIMERS = 41 + X_SC_AIO_LISTIO_MAX = 42 + X_SC_AIO_MAX = 43 + X_SC_AIO_PRIO_DELTA_MAX = 44 + X_SC_DELAYTIMER_MAX = 45 + X_SC_MQ_OPEN_MAX = 46 + // swap _SC_PAGESIZE vs. BSD + X_SC_MAPPED_FILES = 47 + X_SC_RTSIG_MAX = 48 + X_SC_SEM_NSEMS_MAX = 49 + X_SC_SEM_VALUE_MAX = 50 + X_SC_SIGQUEUE_MAX = 51 + X_SC_TIMER_MAX = 52 +) +const ( + X_SC_NPROCESSORS_CONF = 57 + X_SC_NPROCESSORS_ONLN = 58 +) +const ( + X_SC_2_PBS = 59 + X_SC_2_PBS_ACCOUNTING = 60 + X_SC_2_PBS_CHECKPOINT = 61 + X_SC_2_PBS_LOCATE = 62 + X_SC_2_PBS_MESSAGE = 63 + X_SC_2_PBS_TRACK = 64 + X_SC_ADVISORY_INFO = 65 + X_SC_BARRIERS = 66 + X_SC_CLOCK_SELECTION = 67 + X_SC_CPUTIME = 68 + X_SC_FILE_LOCKING = 69 + X_SC_GETGR_R_SIZE_MAX = 70 + X_SC_GETPW_R_SIZE_MAX = 71 + X_SC_HOST_NAME_MAX = 72 + X_SC_LOGIN_NAME_MAX = 73 + X_SC_MONOTONIC_CLOCK = 74 + X_SC_MQ_PRIO_MAX = 75 + X_SC_READER_WRITER_LOCKS = 76 + X_SC_REGEXP = 77 + X_SC_SHELL = 78 + X_SC_SPAWN = 79 + X_SC_SPIN_LOCKS = 80 + X_SC_SPORADIC_SERVER = 81 + X_SC_THREAD_ATTR_STACKADDR = 82 + X_SC_THREAD_ATTR_STACKSIZE = 83 + X_SC_THREAD_CPUTIME = 84 + X_SC_THREAD_DESTRUCTOR_ITERATIONS = 85 + X_SC_THREAD_KEYS_MAX = 86 + X_SC_THREAD_PRIO_INHERIT = 87 + X_SC_THREAD_PRIO_PROTECT = 88 + X_SC_THREAD_PRIORITY_SCHEDULING = 89 + X_SC_THREAD_PROCESS_SHARED = 90 + X_SC_THREAD_SAFE_FUNCTIONS = 91 + X_SC_THREAD_SPORADIC_SERVER = 92 + X_SC_THREAD_STACK_MIN = 93 + X_SC_THREAD_THREADS_MAX = 94 + X_SC_TIMEOUTS = 95 + X_SC_THREADS = 96 + X_SC_TRACE = 97 + X_SC_TRACE_EVENT_FILTER = 98 + X_SC_TRACE_INHERIT = 99 + X_SC_TRACE_LOG = 100 + X_SC_TTY_NAME_MAX = 101 + X_SC_TYPED_MEMORY_OBJECTS = 102 + X_SC_V6_ILP32_OFF32 = 103 + X_SC_V6_ILP32_OFFBIG = 104 + X_SC_V6_LP64_OFF64 = 105 + X_SC_V6_LPBIG_OFFBIG = 106 + X_SC_IPV6 = 118 + X_SC_RAW_SOCKETS = 119 + X_SC_SYMLOOP_MAX = 120 +) +const ( + X_SC_ATEXIT_MAX = 107 + X_SC_IOV_MAX = 56 + X_SC_PAGE_SIZE = 29 + X_SC_XOPEN_CRYPT = 108 + X_SC_XOPEN_ENH_I18N = 109 + // Issue 6 + X_SC_XOPEN_LEGACY = 110 + // Issue 6 + X_SC_XOPEN_REALTIME = 111 + // Issue 6 + X_SC_XOPEN_REALTIME_THREADS = 112 + X_SC_XOPEN_SHM = 113 + // Issue 6 + X_SC_XOPEN_STREAMS = 114 + X_SC_XOPEN_UNIX = 115 + X_SC_XOPEN_VERSION = 116 + X_SC_XOPEN_XCU_VERSION = 121 +) + +// Removed in Issue 7 +const ( + X_SC_XBS5_ILP32_OFF32 = 122 + X_SC_XBS5_ILP32_OFFBIG = 123 + X_SC_XBS5_LP64_OFF64 = 124 + X_SC_XBS5_LPBIG_OFFBIG = 125 +) +const ( + X_SC_SS_REPL_MAX = 126 + X_SC_TRACE_EVENT_NAME_MAX = 127 + X_SC_TRACE_NAME_MAX = 128 + X_SC_TRACE_SYS_MAX = 129 + X_SC_TRACE_USER_EVENT_MAX = 130 +) + +// Removed in Issue 6 +const X_SC_PASS_MAX = 131 +const X_SC_PHYS_PAGES = 200 +const ( + X_CS_POSIX_V6_ILP32_OFF32_CFLAGS = 2 + X_CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 3 + X_CS_POSIX_V6_ILP32_OFF32_LIBS = 4 + X_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 5 + X_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 6 + X_CS_POSIX_V6_ILP32_OFFBIG_LIBS = 7 + X_CS_POSIX_V6_LP64_OFF64_CFLAGS = 8 + X_CS_POSIX_V6_LP64_OFF64_LDFLAGS = 9 + X_CS_POSIX_V6_LP64_OFF64_LIBS = 10 + X_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 11 + X_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 12 + X_CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 13 + X_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 14 +) + +// Removed in Issue 7 +const ( + X_CS_XBS5_ILP32_OFF32_CFLAGS = 20 + X_CS_XBS5_ILP32_OFF32_LDFLAGS = 21 + X_CS_XBS5_ILP32_OFF32_LIBS = 22 + X_CS_XBS5_ILP32_OFF32_LINTFLAGS = 23 + X_CS_XBS5_ILP32_OFFBIG_CFLAGS = 24 + X_CS_XBS5_ILP32_OFFBIG_LDFLAGS = 25 + X_CS_XBS5_ILP32_OFFBIG_LIBS = 26 + X_CS_XBS5_ILP32_OFFBIG_LINTFLAGS = 27 + X_CS_XBS5_LP64_OFF64_CFLAGS = 28 + X_CS_XBS5_LP64_OFF64_LDFLAGS = 29 + X_CS_XBS5_LP64_OFF64_LIBS = 30 + X_CS_XBS5_LP64_OFF64_LINTFLAGS = 31 + X_CS_XBS5_LPBIG_OFFBIG_CFLAGS = 32 + X_CS_XBS5_LPBIG_OFFBIG_LDFLAGS = 33 + X_CS_XBS5_LPBIG_OFFBIG_LIBS = 34 + X_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS = 35 +) +const ( + X_CS_DARWIN_USER_DIR = 65536 + X_CS_DARWIN_USER_TEMP_DIR = 65537 + X_CS_DARWIN_USER_CACHE_DIR = 65538 +) + +// These F_* are really XSI or Issue 6 +const ( + F_ULOCK = 0 + // lock a section for exclusive use + F_LOCK = 1 + // test and lock a section for exclusive use + F_TLOCK = 2 + // test a section for locks by other procs + F_TEST = 3 +) +const ( + // Flush data and metadata to platter, not just to disk cache + SYNC_VOLUME_FULLSYNC = 1 + // Wait for sync to complete + SYNC_VOLUME_WAIT = 2 +) + +type Fssearchblock struct { +} +type Searchstate struct { +} + +//go:linkname X_exit C._exit +func X_exit(_llcppg_param1 c.Int) + +//go:linkname Access C.access +func Access(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + +//go:linkname Alarm C.alarm +func Alarm(_llcppg_param1 c.Uint) c.Uint + +//go:linkname Fpathconf C.fpathconf +func Fpathconf(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Long + +//go:linkname Getgroups C.getgroups +func Getgroups(_llcppg_param1 c.Int, _llcppg_param2 *GidT) c.Int + +//go:linkname Getlogin C.getlogin +func Getlogin() *c.Char + +//go:linkname Getpgrp C.getpgrp +func Getpgrp() PidT + +//go:linkname Pathconf C.pathconf +func Pathconf(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Long + +//go:linkname Pause C.pause +func Pause() c.Int + +//go:linkname Setgid C.setgid +func Setgid(_llcppg_param1 GidT) c.Int + +//go:linkname Setpgid C.setpgid +func Setpgid(_llcppg_param1 PidT, _llcppg_param2 PidT) c.Int + +//go:linkname Setsid C.setsid +func Setsid() PidT + +//go:linkname Setuid C.setuid +func Setuid(_llcppg_param1 UidT) c.Int + +//go:linkname Sleep C.sleep +func Sleep(_llcppg_param1 c.Uint) c.Uint + +//go:linkname Sysconf C.sysconf +func Sysconf(_llcppg_param1 c.Int) c.Long + +//go:linkname Tcgetpgrp C.tcgetpgrp +func Tcgetpgrp(_llcppg_param1 c.Int) PidT + +//go:linkname Tcsetpgrp C.tcsetpgrp +func Tcsetpgrp(_llcppg_param1 c.Int, _llcppg_param2 PidT) c.Int + +//go:linkname Ttyname C.ttyname +func Ttyname(_llcppg_param1 c.Int) *c.Char + +//go:linkname TtynameR C.ttyname_r +func TtynameR(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 SizeT) c.Int + +//go:linkname Confstr C.confstr +func Confstr(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 SizeT) SizeT + +//go:linkname Getopt C.getopt +func Getopt(_llcppg_param1 c.Int, _llcppg_param2 **c.Char, _llcppg_param3 *c.Char) c.Int + +// getopt(3) external variables +// +//go:linkname Optarg C.optarg +var Optarg *c.Char + +//go:linkname Optind C.optind +var Optind c.Int + +//go:linkname Opterr C.opterr +var Opterr c.Int + +//go:linkname Optopt C.optopt +var Optopt c.Int + +//go:linkname Brk C.brk +func Brk(_llcppg_param1 unsafe.Pointer) unsafe.Pointer + +//go:linkname Crypt C.crypt +func Crypt(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char) *c.Char + +//go:linkname Encrypt C.encrypt +func Encrypt(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) + +//go:linkname Gethostid C.gethostid +func Gethostid() c.Long + +//go:linkname Getpgid C.getpgid +func Getpgid(_llcppg_param1 PidT) PidT + +//go:linkname Getsid C.getsid +func Getsid(_llcppg_param1 PidT) PidT + +//go:linkname Getdtablesize C.getdtablesize +func Getdtablesize() c.Int + +//go:linkname Getpagesize C.getpagesize +func Getpagesize() c.Int + +//go:linkname Getpass C.getpass +func Getpass(_llcppg_param1 *c.Char) *c.Char + +//go:linkname Getwd C.getwd +func Getwd(_llcppg_param1 *c.Char) *c.Char + +//go:linkname Lockf C.lockf +func Lockf(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 OffT) c.Int + +//go:linkname Nice C.nice +func Nice(_llcppg_param1 c.Int) c.Int + +//go:linkname Pread C.pread +func Pread(__fd c.Int, __buf unsafe.Pointer, __nbyte SizeT, __offset OffT) SsizeT + +//go:linkname Pwrite C.pwrite +func Pwrite(__fd c.Int, __buf unsafe.Pointer, __nbyte SizeT, __offset OffT) SsizeT + +//go:linkname Sbrk C.sbrk +func Sbrk(_llcppg_param1 c.Int) unsafe.Pointer + +//go:linkname Setpgrp C.setpgrp +func Setpgrp() PidT + +//go:linkname Setregid C.setregid +func Setregid(_llcppg_param1 GidT, _llcppg_param2 GidT) c.Int + +//go:linkname Setreuid C.setreuid +func Setreuid(_llcppg_param1 UidT, _llcppg_param2 UidT) c.Int + +//go:linkname Swab C.swab +func Swab(_llcppg_param1 unsafe.Pointer, _llcppg_param2 unsafe.Pointer, _llcppg_param3 SsizeT) + +//go:linkname Sync C.sync +func Sync() + +//go:linkname Ualarm C.ualarm +func Ualarm(_llcppg_param1 UsecondsT, _llcppg_param2 UsecondsT) UsecondsT + +//go:linkname Usleep C.usleep +func Usleep(_llcppg_param1 UsecondsT) c.Int + +// End XSI +// +//go:linkname Vfork C.vfork +func Vfork() c.Int + +//go:linkname GetloginR C.getlogin_r +func GetloginR(_llcppg_param1 *c.Char, _llcppg_param2 SizeT) c.Int + +//go:linkname Gethostname C.gethostname +func Gethostname(_llcppg_param1 *c.Char, _llcppg_param2 SizeT) c.Int + +//go:linkname Setegid C.setegid +func Setegid(_llcppg_param1 GidT) c.Int + +//go:linkname Seteuid C.seteuid +func Seteuid(_llcppg_param1 UidT) c.Int + +//go:linkname X_Exit C._Exit +func X_Exit(_llcppg_param1 c.Int) + +//go:linkname Acct C.acct +func Acct(_llcppg_param1 *c.Char) c.Int + +//go:linkname Endusershell C.endusershell +func Endusershell() + +//go:linkname ExecvP C.execvP +func ExecvP(__file *c.Char, __searchpath *c.Char, __argv **c.Char) c.Int + +//go:linkname Fflagstostr C.fflagstostr +func Fflagstostr(_llcppg_param1 c.Ulong) *c.Char + +//go:linkname Getdomainname C.getdomainname +func Getdomainname(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + +//go:linkname Getgrouplist C.getgrouplist +func Getgrouplist(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 *c.Int, _llcppg_param4 *c.Int) c.Int + +//go:linkname Getmode C.getmode +func Getmode(_llcppg_param1 unsafe.Pointer, _llcppg_param2 ModeT) ModeT + +//go:linkname Getpeereid C.getpeereid +func Getpeereid(_llcppg_param1 c.Int, _llcppg_param2 *UidT, _llcppg_param3 *GidT) c.Int + +//go:linkname GetsgroupsNp C.getsgroups_np +func GetsgroupsNp(_llcppg_param1 *c.Int, _llcppg_param2 UuidT) c.Int + +//go:linkname Getusershell C.getusershell +func Getusershell() *c.Char + +//go:linkname GetwgroupsNp C.getwgroups_np +func GetwgroupsNp(_llcppg_param1 *c.Int, _llcppg_param2 UuidT) c.Int + +//go:linkname Initgroups C.initgroups +func Initgroups(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + +//go:linkname Issetugid C.issetugid +func Issetugid() c.Int + +//go:linkname Mkdtemp C.mkdtemp +func Mkdtemp(_llcppg_param1 *c.Char) *c.Char + +// returns errno +// +//go:linkname MkpathNp C.mkpath_np +func MkpathNp(path *c.Char, omode ModeT) c.Int + +//go:linkname MkpathatNp C.mkpathat_np +func MkpathatNp(dfd c.Int, path *c.Char, omode ModeT) c.Int + +//go:linkname Mkstemp C.mkstemp +func Mkstemp(_llcppg_param1 *c.Char) c.Int + +//go:linkname Mkstemps C.mkstemps +func Mkstemps(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + +//go:linkname Mktemp C.mktemp +func Mktemp(_llcppg_param1 *c.Char) *c.Char + +//go:linkname Mkostemp C.mkostemp +func Mkostemp(path *c.Char, oflags c.Int) c.Int + +// Non-portable mkstemp that uses open_dprotected_np +// +//go:linkname Mkostemps C.mkostemps +func Mkostemps(path *c.Char, slen c.Int, oflags c.Int) c.Int + +// Non-portable mkstemp that uses open_dprotected_np +// +//go:linkname MkstempDprotectedNp C.mkstemp_dprotected_np +func MkstempDprotectedNp(path *c.Char, dpclass c.Int, dpflags c.Int) c.Int + +//go:linkname MkdtempatNp C.mkdtempat_np +func MkdtempatNp(dfd c.Int, path *c.Char) *c.Char + +//go:linkname MkstempsatNp C.mkstempsat_np +func MkstempsatNp(dfd c.Int, path *c.Char, slen c.Int) c.Int + +//go:linkname MkostempsatNp C.mkostempsat_np +func MkostempsatNp(dfd c.Int, path *c.Char, slen c.Int, oflags c.Int) c.Int + +//go:linkname Nfssvc C.nfssvc +func Nfssvc(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer) c.Int + +//go:linkname PthreadSetugidNp C.pthread_setugid_np +func PthreadSetugidNp(_llcppg_param1 UidT, _llcppg_param2 GidT) c.Int + +//go:linkname PthreadGetugidNp C.pthread_getugid_np +func PthreadGetugidNp(_llcppg_param1 *UidT, _llcppg_param2 *GidT) c.Int + +//go:linkname Reboot C.reboot +func Reboot(_llcppg_param1 c.Int) c.Int + +//go:linkname Revoke C.revoke +func Revoke(_llcppg_param1 *c.Char) c.Int + +//go:linkname Rcmd C.rcmd +func Rcmd(_llcppg_param1 **c.Char, _llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char, _llcppg_param5 *c.Char, _llcppg_param6 *c.Int) c.Int + +//go:linkname RcmdAf C.rcmd_af +func RcmdAf(_llcppg_param1 **c.Char, _llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char, _llcppg_param5 *c.Char, _llcppg_param6 *c.Int, _llcppg_param7 c.Int) c.Int + +//go:linkname Rresvport C.rresvport +func Rresvport(_llcppg_param1 *c.Int) c.Int + +//go:linkname RresvportAf C.rresvport_af +func RresvportAf(_llcppg_param1 *c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname Iruserok C.iruserok +func Iruserok(_llcppg_param1 c.Ulong, _llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char) c.Int + +//go:linkname IruserokSa C.iruserok_sa +func IruserokSa(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 *c.Char, _llcppg_param5 *c.Char) c.Int + +//go:linkname Ruserok C.ruserok +func Ruserok(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char) c.Int + +//go:linkname Setdomainname C.setdomainname +func Setdomainname(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + +//go:linkname Setgroups C.setgroups +func Setgroups(_llcppg_param1 c.Int, _llcppg_param2 *GidT) c.Int + +//go:linkname Sethostid C.sethostid +func Sethostid(_llcppg_param1 c.Long) + +//go:linkname Sethostname C.sethostname +func Sethostname(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + +//go:linkname Setkey C.setkey +func Setkey(_llcppg_param1 *c.Char) + +//go:linkname Setlogin C.setlogin +func Setlogin(_llcppg_param1 *c.Char) c.Int + +//go:linkname Setmode C.setmode +func Setmode(_llcppg_param1 *c.Char) unsafe.Pointer + +//go:linkname Setrgid C.setrgid +func Setrgid(_llcppg_param1 GidT) c.Int + +//go:linkname Setruid C.setruid +func Setruid(_llcppg_param1 UidT) c.Int + +//go:linkname SetsgroupsNp C.setsgroups_np +func SetsgroupsNp(_llcppg_param1 c.Int, _llcppg_param2 UuidT) c.Int + +//go:linkname Setusershell C.setusershell +func Setusershell() + +//go:linkname SetwgroupsNp C.setwgroups_np +func SetwgroupsNp(_llcppg_param1 c.Int, _llcppg_param2 UuidT) c.Int + +//go:linkname Strtofflags C.strtofflags +func Strtofflags(_llcppg_param1 **c.Char, _llcppg_param2 *c.Ulong, _llcppg_param3 *c.Ulong) c.Int + +//go:linkname Swapon C.swapon +func Swapon(_llcppg_param1 *c.Char) c.Int + +//go:linkname Ttyslot C.ttyslot +func Ttyslot() c.Int + +//go:linkname Undelete C.undelete +func Undelete(_llcppg_param1 *c.Char) c.Int + +//go:linkname Valloc C.valloc +func Valloc(_llcppg_param1 SizeT) unsafe.Pointer + +// getsubopt(3) external variable +// +//go:linkname Suboptarg C.suboptarg +var Suboptarg *c.Char + +//go:linkname Getsubopt C.getsubopt +func Getsubopt(_llcppg_param1 **c.Char, _llcppg_param2 **c.Char, _llcppg_param3 **c.Char) c.Int + +//go:linkname Fgetattrlist C.fgetattrlist +func Fgetattrlist(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 SizeT, _llcppg_param5 c.Uint) c.Int + +//go:linkname Fsetattrlist C.fsetattrlist +func Fsetattrlist(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 SizeT, _llcppg_param5 c.Uint) c.Int + +//go:linkname Getattrlist C.getattrlist +func Getattrlist(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 SizeT, _llcppg_param5 c.Uint) c.Int + +//go:linkname Setattrlist C.setattrlist +func Setattrlist(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 SizeT, _llcppg_param5 c.Uint) c.Int + +//go:linkname Exchangedata C.exchangedata +func Exchangedata(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char, _llcppg_param3 c.Uint) c.Int + +//go:linkname Getdirentriesattr C.getdirentriesattr +func Getdirentriesattr(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 SizeT, _llcppg_param5 *c.Uint, _llcppg_param6 *c.Uint, _llcppg_param7 *c.Uint, _llcppg_param8 c.Uint) c.Int + +//go:linkname Searchfs C.searchfs +func Searchfs(_llcppg_param1 *c.Char, _llcppg_param2 *Fssearchblock, _llcppg_param3 *c.Ulong, _llcppg_param4 c.Uint, _llcppg_param5 c.Uint, _llcppg_param6 *Searchstate) c.Int + +//go:linkname Fsctl C.fsctl +func Fsctl(_llcppg_param1 *c.Char, _llcppg_param2 c.Ulong, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.Uint) c.Int + +//go:linkname Ffsctl C.ffsctl +func Ffsctl(_llcppg_param1 c.Int, _llcppg_param2 c.Ulong, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.Uint) c.Int + +//go:linkname FsyncVolumeNp C.fsync_volume_np +func FsyncVolumeNp(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname SyncVolumeNp C.sync_volume_np +func SyncVolumeNp(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + +//go:linkname Optreset C.optreset +var Optreset c.Int diff --git a/c/os/unistd_linux_amd64.go b/c/os/unistd_linux_amd64.go new file mode 100644 index 00000000..a0611693 --- /dev/null +++ b/c/os/unistd_linux_amd64.go @@ -0,0 +1,448 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const X_UNISTD_H = 1 +const X_XOPEN_VERSION = 700 + +// Commands and utilities from XPG4 are available. +const X_XOPEN_XCU_VERSION = 4 + +// We are compatible with the old published standards as well. +const ( + X_XOPEN_XPG2 = 1 + X_XOPEN_XPG3 = 1 + X_XOPEN_XPG4 = 1 +) + +// The X/Open Unix extensions are available. +const X_XOPEN_UNIX = 1 + +// Encryption is present. +const X_XOPEN_CRYPT = 1 + +// The enhanced internationalization capabilities according to XPG4.2 +// are present. +const X_XOPEN_ENH_I18N = 1 + +// The legacy interfaces are also available. +const X_XOPEN_LEGACY = 1 + +// Standard file descriptors. +const ( + STDIN_FILENO = 0 + // Standard output. + STDOUT_FILENO = 1 + // Standard error output. + STDERR_FILENO = 2 +) + +type UsecondsT = X__UsecondsT +type IntptrT = X__IntptrT +type SocklenT = X__SocklenT + +// Test for access to NAME using the real UID and real GID. +// +//go:linkname Access C.access +func Access(__name *c.Char, __type c.Int) c.Int + +// Read NBYTES into BUF from FD at the given position OFFSET without +// changing the file pointer. Return the number read, -1 for errors +// or 0 for EOF. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Pread C.pread +func Pread(__fd c.Int, __buf unsafe.Pointer, __nbytes SizeT, __offset X__OffT) SsizeT + +// Write N bytes of BUF to FD at the given position OFFSET without +// changing the file pointer. Return the number written, or -1. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Pwrite C.pwrite +func Pwrite(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __offset X__OffT) SsizeT + +// Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. +// If SECONDS is zero, any currently scheduled alarm will be cancelled. +// The function returns the number of seconds remaining until the last +// alarm scheduled would have signaled, or zero if there wasn't one. +// There is no return value to indicate an error, but you can set `errno' +// to 0 and check its value after calling `alarm', and this might tell you. +// The signal may come late due to processor scheduling. +// +//go:linkname Alarm C.alarm +func Alarm(__seconds c.Uint) c.Uint + +// Make the process sleep for SECONDS seconds, or until a signal arrives +// and is not ignored. The function returns the number of seconds less +// than SECONDS which it actually slept (thus zero if it slept the full time). +// If a signal handler does a `longjmp' or modifies the handling of the +// SIGALRM signal while inside `sleep' call, the handling of the SIGALRM +// signal afterwards is undefined. There is no return value to indicate +// error, but if `sleep' returns SECONDS, it probably didn't work. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Sleep C.sleep +func Sleep(__seconds c.Uint) c.Uint + +// Set an alarm to go off (generating a SIGALRM signal) in VALUE +// microseconds. If INTERVAL is nonzero, when the alarm goes off, the +// timer is reset to go off every INTERVAL microseconds thereafter. +// Returns the number of microseconds remaining before the alarm. +// +//go:linkname Ualarm C.ualarm +func Ualarm(__value X__UsecondsT, __interval X__UsecondsT) X__UsecondsT + +// Sleep USECONDS microseconds, or until a signal arrives that is not blocked +// or ignored. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Usleep C.usleep +func Usleep(__useconds X__UsecondsT) c.Int + +// Suspend the process until a signal arrives. +// This always returns -1 and sets `errno' to EINTR. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Pause C.pause +func Pause() c.Int + +// Put the absolute pathname of the current working directory in BUF. +// If successful, return BUF. If not, put an error message in +// BUF and return NULL. BUF should be at least PATH_MAX bytes long. +// +//go:linkname Getwd C.getwd +func Getwd(__buf *c.Char) *c.Char + +// NULL-terminated array of "NAME=VALUE" environment variables. +// +//go:linkname X__Environ C.__environ +var X__Environ **c.Char + +// Execute the file FD refers to, overlaying the running program image. +// ARGV and ENVP are passed to the new program, as for `execve'. +// +//go:linkname Fexecve C.fexecve +func Fexecve(__fd c.Int, __argv **c.Char, __envp **c.Char) c.Int + +// Add INC to priority of the current process. +// +//go:linkname Nice C.nice +func Nice(__inc c.Int) c.Int + +// Terminate program execution with the low-order 8 bits of STATUS. +// +//go:linkname X_exit C._exit +func X_exit(__status c.Int) + +// Get file-specific configuration information about PATH. +// +//go:linkname Pathconf C.pathconf +func Pathconf(__path *c.Char, __name c.Int) c.Long + +// Get file-specific configuration about descriptor FD. +// +//go:linkname Fpathconf C.fpathconf +func Fpathconf(__fd c.Int, __name c.Int) c.Long + +// Get the value of the system variable NAME. +// +//go:linkname Sysconf C.sysconf +func Sysconf(__name c.Int) c.Long + +// Get the value of the string-valued system variable NAME. +// +//go:linkname Confstr C.confstr +func Confstr(__name c.Int, __buf *c.Char, __len SizeT) SizeT + +// Get the process group ID of the calling process. +// +//go:linkname Getpgrp C.getpgrp +func Getpgrp() X__PidT + +// Get the process group ID of process PID. +// +//go:linkname X__Getpgid C.__getpgid +func X__Getpgid(__pid X__PidT) X__PidT + +//go:linkname Getpgid C.getpgid +func Getpgid(__pid X__PidT) X__PidT + +// Set the process group ID of the process matching PID to PGID. +// If PID is zero, the current process's process group ID is set. +// If PGID is zero, the process ID of the process is used. +// +//go:linkname Setpgid C.setpgid +func Setpgid(__pid X__PidT, __pgid X__PidT) c.Int + +// Set the process group ID of the calling process to its own PID. +// This is exactly the same as `setpgid (0, 0)'. +// +//go:linkname Setpgrp C.setpgrp +func Setpgrp() c.Int + +// Create a new session with the calling process as its leader. +// The process group IDs of the session and the calling process +// are set to the process ID of the calling process, which is returned. +// +//go:linkname Setsid C.setsid +func Setsid() X__PidT + +// Return the session ID of the given process. +// +//go:linkname Getsid C.getsid +func Getsid(__pid X__PidT) X__PidT + +// If SIZE is zero, return the number of supplementary groups +// the calling process is in. Otherwise, fill in the group IDs +// of its supplementary groups in LIST and return the number written. +// +//go:linkname Getgroups C.getgroups +func Getgroups(__size c.Int, __list *X__GidT) c.Int + +// Set the user ID of the calling process to UID. +// If the calling process is the super-user, set the real +// and effective user IDs, and the saved set-user-ID to UID; +// if not, the effective user ID is set to UID. +// +//go:linkname Setuid C.setuid +func Setuid(__uid X__UidT) c.Int + +// Set the real user ID of the calling process to RUID, +// and the effective user ID of the calling process to EUID. +// +//go:linkname Setreuid C.setreuid +func Setreuid(__ruid X__UidT, __euid X__UidT) c.Int + +// Set the effective user ID of the calling process to UID. +// +//go:linkname Seteuid C.seteuid +func Seteuid(__uid X__UidT) c.Int + +// Set the group ID of the calling process to GID. +// If the calling process is the super-user, set the real +// and effective group IDs, and the saved set-group-ID to GID; +// if not, the effective group ID is set to GID. +// +//go:linkname Setgid C.setgid +func Setgid(__gid X__GidT) c.Int + +// Set the real group ID of the calling process to RGID, +// and the effective group ID of the calling process to EGID. +// +//go:linkname Setregid C.setregid +func Setregid(__rgid X__GidT, __egid X__GidT) c.Int + +// Set the effective group ID of the calling process to GID. +// +//go:linkname Setegid C.setegid +func Setegid(__gid X__GidT) c.Int + +// Clone the calling process, but without copying the whole address space. +// The calling process is suspended until the new process exits or is +// replaced by a call to `execve'. Return -1 for errors, 0 to the new process, +// and the process ID of the new process to the old process. +// +//go:linkname Vfork C.vfork +func Vfork() c.Int + +// Return the pathname of the terminal FD is open on, or NULL on errors. +// The returned storage is good only until the next call to this function. +// +//go:linkname Ttyname C.ttyname +func Ttyname(__fd c.Int) *c.Char + +// Store at most BUFLEN characters of the pathname of the terminal FD is +// open on in BUF. Return 0 on success, otherwise an error number. +// +//go:linkname TtynameR C.ttyname_r +func TtynameR(__fd c.Int, __buf *c.Char, __buflen SizeT) c.Int + +// Return the index into the active-logins file (utmp) for +// the controlling terminal. +// +//go:linkname Ttyslot C.ttyslot +func Ttyslot() c.Int + +// Like link but relative paths in TO and FROM are interpreted relative +// to FROMFD and TOFD respectively. +// +//go:linkname Linkat C.linkat +func Linkat(__fromfd c.Int, __from *c.Char, __tofd c.Int, __to *c.Char, __flags c.Int) c.Int + +// Like symlink but a relative path in TO is interpreted relative to TOFD. +// +//go:linkname Symlinkat C.symlinkat +func Symlinkat(__from *c.Char, __tofd c.Int, __to *c.Char) c.Int + +// Like readlink but a relative PATH is interpreted relative to FD. +// +//go:linkname Readlinkat C.readlinkat +func Readlinkat(__fd c.Int, __path *c.Char, __buf *c.Char, __len SizeT) SsizeT + +// Return the foreground process group ID of FD. +// +//go:linkname Tcgetpgrp C.tcgetpgrp +func Tcgetpgrp(__fd c.Int) X__PidT + +// Set the foreground process group ID of FD set PGRP_ID. +// +//go:linkname Tcsetpgrp C.tcsetpgrp +func Tcsetpgrp(__fd c.Int, __pgrp_id X__PidT) c.Int + +// Return the login name of the user. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getlogin C.getlogin +func Getlogin() *c.Char + +// Return at most NAME_LEN characters of the login name of the user in NAME. +// If it cannot be determined or some other error occurred, return the error +// code. Otherwise return 0. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname GetloginR C.getlogin_r +func GetloginR(__name *c.Char, __name_len SizeT) c.Int + +// Set the login name returned by `getlogin'. +// +//go:linkname Setlogin C.setlogin +func Setlogin(__name *c.Char) c.Int + +// Put the name of the current host in no more than LEN bytes of NAME. +// The result is null-terminated if LEN is large enough for the full +// name and the terminator. +// +//go:linkname Gethostname C.gethostname +func Gethostname(__name *c.Char, __len SizeT) c.Int + +// Set the name of the current host to NAME, which is LEN bytes long. +// This call is restricted to the super-user. +// +//go:linkname Sethostname C.sethostname +func Sethostname(__name *c.Char, __len SizeT) c.Int + +// Set the current machine's Internet number to ID. +// This call is restricted to the super-user. +// +//go:linkname Sethostid C.sethostid +func Sethostid(__id c.Long) c.Int + +// Get and set the NIS (aka YP) domain name, if any. +// Called just like `gethostname' and `sethostname'. +// The NIS domain name is usually the empty string when not using NIS. +// +//go:linkname Getdomainname C.getdomainname +func Getdomainname(__name *c.Char, __len SizeT) c.Int + +//go:linkname Setdomainname C.setdomainname +func Setdomainname(__name *c.Char, __len SizeT) c.Int + +// Revoke access permissions to all processes currently communicating +// with the control terminal, and then send a SIGHUP signal to the process +// group of the control terminal. +// +//go:linkname Vhangup C.vhangup +func Vhangup() c.Int + +// Revoke the access of all descriptors currently open on FILE. +// +//go:linkname Revoke C.revoke +func Revoke(__file *c.Char) c.Int + +// Turn accounting on if NAME is an existing file. The system will then write +// a record for each process as it terminates, to this file. If NAME is NULL, +// turn accounting off. This call is restricted to the super-user. +// +//go:linkname Acct C.acct +func Acct(__name *c.Char) c.Int + +// Successive calls return the shells listed in `/etc/shells'. +// +//go:linkname Getusershell C.getusershell +func Getusershell() *c.Char + +// Discard cached info. +// +//go:linkname Endusershell C.endusershell +func Endusershell() + +// Rewind and re-read the file. +// +//go:linkname Setusershell C.setusershell +func Setusershell() + +// Put the program in the background, and dissociate from the controlling +// terminal. If NOCHDIR is zero, do `chdir ("/")'. If NOCLOSE is zero, +// redirects stdin, stdout, and stderr to /dev/null. +// +//go:linkname Daemon C.daemon +func Daemon(__nochdir c.Int, __noclose c.Int) c.Int + +// Prompt with PROMPT and read a string from the terminal without echoing. +// Uses /dev/tty if possible; otherwise stderr and stdin. +// +//go:linkname Getpass C.getpass +func Getpass(__prompt *c.Char) *c.Char + +// Return identifier for the current host. +// +//go:linkname Gethostid C.gethostid +func Gethostid() c.Long + +// Make all changes done to all files actually appear on disk. +// +//go:linkname Sync C.sync +func Sync() + +// Return the number of bytes in a page. This is the system's page size, +// which is not necessarily the same as the hardware page size. +// +//go:linkname Getpagesize C.getpagesize +func Getpagesize() c.Int + +// Return the maximum number of file descriptors +// the current process could possibly have. +// +//go:linkname Getdtablesize C.getdtablesize +func Getdtablesize() c.Int + +// Set the end of accessible data space (aka "the break") to ADDR. +// Returns zero on success and -1 for errors (with errno set). +// +//go:linkname Brk C.brk +func Brk(__addr unsafe.Pointer) c.Int + +// Increase or decrease the end of accessible data space by DELTA bytes. +// If successful, returns the address the previous end of data space +// (i.e. the beginning of the new space, if DELTA > 0); +// returns (void *) -1 for errors (with errno set). +// +//go:linkname Sbrk C.sbrk +func Sbrk(__delta IntptrT) unsafe.Pointer + +// Synchronize at least the data part of a file with the underlying +// media. +// +//go:linkname Fdatasync C.fdatasync +func Fdatasync(__fildes c.Int) c.Int diff --git a/c/os/unistd_linux_arm64.go b/c/os/unistd_linux_arm64.go new file mode 100644 index 00000000..3ec50c91 --- /dev/null +++ b/c/os/unistd_linux_arm64.go @@ -0,0 +1,448 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + "unsafe" +) + +const X_UNISTD_H = 1 +const X_XOPEN_VERSION = 700 + +// Commands and utilities from XPG4 are available. +const X_XOPEN_XCU_VERSION = 4 + +// We are compatible with the old published standards as well. +const ( + X_XOPEN_XPG2 = 1 + X_XOPEN_XPG3 = 1 + X_XOPEN_XPG4 = 1 +) + +// The X/Open Unix extensions are available. +const X_XOPEN_UNIX = 1 + +// Encryption is present. +const X_XOPEN_CRYPT = 1 + +// The enhanced internationalization capabilities according to XPG4.2 +// are present. +const X_XOPEN_ENH_I18N = 1 + +// The legacy interfaces are also available. +const X_XOPEN_LEGACY = 1 + +// Standard file descriptors. +const ( + STDIN_FILENO = 0 + // Standard output. + STDOUT_FILENO = 1 + // Standard error output. + STDERR_FILENO = 2 +) + +type UsecondsT = X__UsecondsT +type IntptrT = X__IntptrT +type SocklenT = X__SocklenT + +// Test for access to NAME using the real UID and real GID. +// +//go:linkname Access C.access +func Access(__name *uint8, __type c.Int) c.Int + +// Read NBYTES into BUF from FD at the given position OFFSET without +// changing the file pointer. Return the number read, -1 for errors +// or 0 for EOF. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Pread C.pread +func Pread(__fd c.Int, __buf unsafe.Pointer, __nbytes SizeT, __offset X__OffT) SsizeT + +// Write N bytes of BUF to FD at the given position OFFSET without +// changing the file pointer. Return the number written, or -1. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Pwrite C.pwrite +func Pwrite(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __offset X__OffT) SsizeT + +// Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. +// If SECONDS is zero, any currently scheduled alarm will be cancelled. +// The function returns the number of seconds remaining until the last +// alarm scheduled would have signaled, or zero if there wasn't one. +// There is no return value to indicate an error, but you can set `errno' +// to 0 and check its value after calling `alarm', and this might tell you. +// The signal may come late due to processor scheduling. +// +//go:linkname Alarm C.alarm +func Alarm(__seconds c.Uint) c.Uint + +// Make the process sleep for SECONDS seconds, or until a signal arrives +// and is not ignored. The function returns the number of seconds less +// than SECONDS which it actually slept (thus zero if it slept the full time). +// If a signal handler does a `longjmp' or modifies the handling of the +// SIGALRM signal while inside `sleep' call, the handling of the SIGALRM +// signal afterwards is undefined. There is no return value to indicate +// error, but if `sleep' returns SECONDS, it probably didn't work. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Sleep C.sleep +func Sleep(__seconds c.Uint) c.Uint + +// Set an alarm to go off (generating a SIGALRM signal) in VALUE +// microseconds. If INTERVAL is nonzero, when the alarm goes off, the +// timer is reset to go off every INTERVAL microseconds thereafter. +// Returns the number of microseconds remaining before the alarm. +// +//go:linkname Ualarm C.ualarm +func Ualarm(__value X__UsecondsT, __interval X__UsecondsT) X__UsecondsT + +// Sleep USECONDS microseconds, or until a signal arrives that is not blocked +// or ignored. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Usleep C.usleep +func Usleep(__useconds X__UsecondsT) c.Int + +// Suspend the process until a signal arrives. +// This always returns -1 and sets `errno' to EINTR. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Pause C.pause +func Pause() c.Int + +// Put the absolute pathname of the current working directory in BUF. +// If successful, return BUF. If not, put an error message in +// BUF and return NULL. BUF should be at least PATH_MAX bytes long. +// +//go:linkname Getwd C.getwd +func Getwd(__buf *uint8) *uint8 + +// NULL-terminated array of "NAME=VALUE" environment variables. +// +//go:linkname X__Environ C.__environ +var X__Environ **uint8 + +// Execute the file FD refers to, overlaying the running program image. +// ARGV and ENVP are passed to the new program, as for `execve'. +// +//go:linkname Fexecve C.fexecve +func Fexecve(__fd c.Int, __argv **uint8, __envp **uint8) c.Int + +// Add INC to priority of the current process. +// +//go:linkname Nice C.nice +func Nice(__inc c.Int) c.Int + +// Terminate program execution with the low-order 8 bits of STATUS. +// +//go:linkname X_exit C._exit +func X_exit(__status c.Int) + +// Get file-specific configuration information about PATH. +// +//go:linkname Pathconf C.pathconf +func Pathconf(__path *uint8, __name c.Int) c.Long + +// Get file-specific configuration about descriptor FD. +// +//go:linkname Fpathconf C.fpathconf +func Fpathconf(__fd c.Int, __name c.Int) c.Long + +// Get the value of the system variable NAME. +// +//go:linkname Sysconf C.sysconf +func Sysconf(__name c.Int) c.Long + +// Get the value of the string-valued system variable NAME. +// +//go:linkname Confstr C.confstr +func Confstr(__name c.Int, __buf *uint8, __len SizeT) SizeT + +// Get the process group ID of the calling process. +// +//go:linkname Getpgrp C.getpgrp +func Getpgrp() X__PidT + +// Get the process group ID of process PID. +// +//go:linkname X__Getpgid C.__getpgid +func X__Getpgid(__pid X__PidT) X__PidT + +//go:linkname Getpgid C.getpgid +func Getpgid(__pid X__PidT) X__PidT + +// Set the process group ID of the process matching PID to PGID. +// If PID is zero, the current process's process group ID is set. +// If PGID is zero, the process ID of the process is used. +// +//go:linkname Setpgid C.setpgid +func Setpgid(__pid X__PidT, __pgid X__PidT) c.Int + +// Set the process group ID of the calling process to its own PID. +// This is exactly the same as `setpgid (0, 0)'. +// +//go:linkname Setpgrp C.setpgrp +func Setpgrp() c.Int + +// Create a new session with the calling process as its leader. +// The process group IDs of the session and the calling process +// are set to the process ID of the calling process, which is returned. +// +//go:linkname Setsid C.setsid +func Setsid() X__PidT + +// Return the session ID of the given process. +// +//go:linkname Getsid C.getsid +func Getsid(__pid X__PidT) X__PidT + +// If SIZE is zero, return the number of supplementary groups +// the calling process is in. Otherwise, fill in the group IDs +// of its supplementary groups in LIST and return the number written. +// +//go:linkname Getgroups C.getgroups +func Getgroups(__size c.Int, __list *X__GidT) c.Int + +// Set the user ID of the calling process to UID. +// If the calling process is the super-user, set the real +// and effective user IDs, and the saved set-user-ID to UID; +// if not, the effective user ID is set to UID. +// +//go:linkname Setuid C.setuid +func Setuid(__uid X__UidT) c.Int + +// Set the real user ID of the calling process to RUID, +// and the effective user ID of the calling process to EUID. +// +//go:linkname Setreuid C.setreuid +func Setreuid(__ruid X__UidT, __euid X__UidT) c.Int + +// Set the effective user ID of the calling process to UID. +// +//go:linkname Seteuid C.seteuid +func Seteuid(__uid X__UidT) c.Int + +// Set the group ID of the calling process to GID. +// If the calling process is the super-user, set the real +// and effective group IDs, and the saved set-group-ID to GID; +// if not, the effective group ID is set to GID. +// +//go:linkname Setgid C.setgid +func Setgid(__gid X__GidT) c.Int + +// Set the real group ID of the calling process to RGID, +// and the effective group ID of the calling process to EGID. +// +//go:linkname Setregid C.setregid +func Setregid(__rgid X__GidT, __egid X__GidT) c.Int + +// Set the effective group ID of the calling process to GID. +// +//go:linkname Setegid C.setegid +func Setegid(__gid X__GidT) c.Int + +// Clone the calling process, but without copying the whole address space. +// The calling process is suspended until the new process exits or is +// replaced by a call to `execve'. Return -1 for errors, 0 to the new process, +// and the process ID of the new process to the old process. +// +//go:linkname Vfork C.vfork +func Vfork() c.Int + +// Return the pathname of the terminal FD is open on, or NULL on errors. +// The returned storage is good only until the next call to this function. +// +//go:linkname Ttyname C.ttyname +func Ttyname(__fd c.Int) *uint8 + +// Store at most BUFLEN characters of the pathname of the terminal FD is +// open on in BUF. Return 0 on success, otherwise an error number. +// +//go:linkname TtynameR C.ttyname_r +func TtynameR(__fd c.Int, __buf *uint8, __buflen SizeT) c.Int + +// Return the index into the active-logins file (utmp) for +// the controlling terminal. +// +//go:linkname Ttyslot C.ttyslot +func Ttyslot() c.Int + +// Like link but relative paths in TO and FROM are interpreted relative +// to FROMFD and TOFD respectively. +// +//go:linkname Linkat C.linkat +func Linkat(__fromfd c.Int, __from *uint8, __tofd c.Int, __to *uint8, __flags c.Int) c.Int + +// Like symlink but a relative path in TO is interpreted relative to TOFD. +// +//go:linkname Symlinkat C.symlinkat +func Symlinkat(__from *uint8, __tofd c.Int, __to *uint8) c.Int + +// Like readlink but a relative PATH is interpreted relative to FD. +// +//go:linkname Readlinkat C.readlinkat +func Readlinkat(__fd c.Int, __path *uint8, __buf *uint8, __len SizeT) SsizeT + +// Return the foreground process group ID of FD. +// +//go:linkname Tcgetpgrp C.tcgetpgrp +func Tcgetpgrp(__fd c.Int) X__PidT + +// Set the foreground process group ID of FD set PGRP_ID. +// +//go:linkname Tcsetpgrp C.tcsetpgrp +func Tcsetpgrp(__fd c.Int, __pgrp_id X__PidT) c.Int + +// Return the login name of the user. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getlogin C.getlogin +func Getlogin() *uint8 + +// Return at most NAME_LEN characters of the login name of the user in NAME. +// If it cannot be determined or some other error occurred, return the error +// code. Otherwise return 0. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname GetloginR C.getlogin_r +func GetloginR(__name *uint8, __name_len SizeT) c.Int + +// Set the login name returned by `getlogin'. +// +//go:linkname Setlogin C.setlogin +func Setlogin(__name *uint8) c.Int + +// Put the name of the current host in no more than LEN bytes of NAME. +// The result is null-terminated if LEN is large enough for the full +// name and the terminator. +// +//go:linkname Gethostname C.gethostname +func Gethostname(__name *uint8, __len SizeT) c.Int + +// Set the name of the current host to NAME, which is LEN bytes long. +// This call is restricted to the super-user. +// +//go:linkname Sethostname C.sethostname +func Sethostname(__name *uint8, __len SizeT) c.Int + +// Set the current machine's Internet number to ID. +// This call is restricted to the super-user. +// +//go:linkname Sethostid C.sethostid +func Sethostid(__id c.Long) c.Int + +// Get and set the NIS (aka YP) domain name, if any. +// Called just like `gethostname' and `sethostname'. +// The NIS domain name is usually the empty string when not using NIS. +// +//go:linkname Getdomainname C.getdomainname +func Getdomainname(__name *uint8, __len SizeT) c.Int + +//go:linkname Setdomainname C.setdomainname +func Setdomainname(__name *uint8, __len SizeT) c.Int + +// Revoke access permissions to all processes currently communicating +// with the control terminal, and then send a SIGHUP signal to the process +// group of the control terminal. +// +//go:linkname Vhangup C.vhangup +func Vhangup() c.Int + +// Revoke the access of all descriptors currently open on FILE. +// +//go:linkname Revoke C.revoke +func Revoke(__file *uint8) c.Int + +// Turn accounting on if NAME is an existing file. The system will then write +// a record for each process as it terminates, to this file. If NAME is NULL, +// turn accounting off. This call is restricted to the super-user. +// +//go:linkname Acct C.acct +func Acct(__name *uint8) c.Int + +// Successive calls return the shells listed in `/etc/shells'. +// +//go:linkname Getusershell C.getusershell +func Getusershell() *uint8 + +// Discard cached info. +// +//go:linkname Endusershell C.endusershell +func Endusershell() + +// Rewind and re-read the file. +// +//go:linkname Setusershell C.setusershell +func Setusershell() + +// Put the program in the background, and dissociate from the controlling +// terminal. If NOCHDIR is zero, do `chdir ("/")'. If NOCLOSE is zero, +// redirects stdin, stdout, and stderr to /dev/null. +// +//go:linkname Daemon C.daemon +func Daemon(__nochdir c.Int, __noclose c.Int) c.Int + +// Prompt with PROMPT and read a string from the terminal without echoing. +// Uses /dev/tty if possible; otherwise stderr and stdin. +// +//go:linkname Getpass C.getpass +func Getpass(__prompt *uint8) *uint8 + +// Return identifier for the current host. +// +//go:linkname Gethostid C.gethostid +func Gethostid() c.Long + +// Make all changes done to all files actually appear on disk. +// +//go:linkname Sync C.sync +func Sync() + +// Return the number of bytes in a page. This is the system's page size, +// which is not necessarily the same as the hardware page size. +// +//go:linkname Getpagesize C.getpagesize +func Getpagesize() c.Int + +// Return the maximum number of file descriptors +// the current process could possibly have. +// +//go:linkname Getdtablesize C.getdtablesize +func Getdtablesize() c.Int + +// Set the end of accessible data space (aka "the break") to ADDR. +// Returns zero on success and -1 for errors (with errno set). +// +//go:linkname Brk C.brk +func Brk(__addr unsafe.Pointer) c.Int + +// Increase or decrease the end of accessible data space by DELTA bytes. +// If successful, returns the address the previous end of data space +// (i.e. the beginning of the new space, if DELTA > 0); +// returns (void *) -1 for errors (with errno set). +// +//go:linkname Sbrk C.sbrk +func Sbrk(__delta IntptrT) unsafe.Pointer + +// Synchronize at least the data part of a file with the underlying +// media. +// +//go:linkname Fdatasync C.fdatasync +func Fdatasync(__fildes c.Int) c.Int diff --git a/c/os/utime_darwin_arm64.go b/c/os/utime_darwin_arm64.go new file mode 100644 index 00000000..eaa83a0a --- /dev/null +++ b/c/os/utime_darwin_arm64.go @@ -0,0 +1,18 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +type Utimbuf struct { + Actime TimeT + Modtime TimeT +} + +//go:linkname Utime C.utime +func Utime(_llcppg_param1 *c.Char, _llcppg_param2 *Utimbuf) c.Int diff --git a/c/os/utime_linux_amd64.go b/c/os/utime_linux_amd64.go new file mode 100644 index 00000000..484b09ae --- /dev/null +++ b/c/os/utime_linux_amd64.go @@ -0,0 +1,24 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_UTIME_H = 1 + +// Structure describing file times. +type Utimbuf struct { + Actime X__TimeT + Modtime X__TimeT +} + +// Set the access and modification times of FILE to those given in +// FILE_TIMES. If FILE_TIMES is NULL, set them to the current time. +// +//go:linkname Utime C.utime +func Utime(__file *c.Char, __file_times *Utimbuf) c.Int diff --git a/c/os/utime_linux_arm64.go b/c/os/utime_linux_arm64.go new file mode 100644 index 00000000..8c0e4056 --- /dev/null +++ b/c/os/utime_linux_arm64.go @@ -0,0 +1,24 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +const X_UTIME_H = 1 + +// Structure describing file times. +type Utimbuf struct { + Actime X__TimeT + Modtime X__TimeT +} + +// Set the access and modification times of FILE to those given in +// FILE_TIMES. If FILE_TIMES is NULL, set them to the current time. +// +//go:linkname Utime C.utime +func Utime(__file *uint8, __file_times *Utimbuf) c.Int From 856b76befa3e63659860bfbb0a5f9cf7572ec568 Mon Sep 17 00:00:00 2001 From: Rick Guo Date: Mon, 19 Oct 2026 19:56:46 +0800 Subject: [PATCH 3/6] Classify unified libc output and skip unsupported layouts --- c/os/arm-_types_darwin_arm64.go | 64 - c/os/bits-confname_linux_amd64.go | 320 --- c/os/bits-confname_linux_arm64.go | 320 --- c/os/bits-dirent_linux_amd64.go | 8 - c/os/bits-dirent_linux_arm64.go | 16 - c/os/bits-dlfcn_linux_amd64.go | 31 - c/os/bits-dlfcn_linux_arm64.go | 31 - c/os/bits-fcntl-linux_linux_amd64.go | 134 - c/os/bits-fcntl-linux_linux_arm64.go | 131 - c/os/bits-fcntl_linux_amd64.go | 24 - c/os/bits-fcntl_linux_arm64.go | 25 - c/os/bits-local_lim_linux_amd64.go | 45 - c/os/bits-local_lim_linux_arm64.go | 46 - c/os/bits-mman-linux_linux_amd64.go | 118 - c/os/bits-mman-linux_linux_arm64.go | 118 - c/os/bits-mman_linux_amd64.go | 28 - c/os/bits-mman_linux_arm64.go | 26 - c/os/bits-poll_linux_amd64.go | 38 - c/os/bits-poll_linux_arm64.go | 38 - c/os/bits-posix_opt_linux_amd64.go | 84 - c/os/bits-posix_opt_linux_arm64.go | 84 - c/os/bits-resource_linux_amd64.go | 245 -- c/os/bits-resource_linux_arm64.go | 245 -- c/os/bits-sched_linux_amd64.go | 51 - c/os/bits-sched_linux_arm64.go | 51 - c/os/bits-stat_linux_amd64.go | 51 - c/os/bits-stat_linux_arm64.go | 59 - c/os/bits-statvfs_linux_amd64.go | 30 - c/os/bits-statvfs_linux_arm64.go | 30 - c/os/bits-termios_linux_amd64.go | 216 -- c/os/bits-termios_linux_arm64.go | 216 -- c/os/bits-types_linux_amd64.go | 133 - c/os/bits-types_linux_arm64.go | 133 - c/os/dirent_darwin_arm64.go | 37 - c/os/dirent_linux_amd64.go | 68 - c/os/dirent_linux_arm64.go | 68 - c/os/dlfcn_darwin_arm64.go | 49 - c/os/dlfcn_linux_amd64.go | 37 - c/os/dlfcn_linux_arm64.go | 37 - c/os/fcntl_linux_amd64.go | 122 - c/os/fcntl_linux_arm64.go | 122 - c/os/flags_linux_amd64.go | 18 - c/os/flags_linux_arm64.go | 18 - c/os/fnmatch_darwin_arm64.go | 35 - c/os/fnmatch_linux_amd64.go | 30 - c/os/fnmatch_linux_arm64.go | 30 - c/os/glob_linux_amd64.go | 84 - c/os/glob_linux_arm64.go | 84 - c/os/grp_darwin_arm64.go | 62 - c/os/grp_linux_amd64.go | 130 - c/os/grp_linux_arm64.go | 130 - c/os/libc_darwin_arm64.go | 2703 ++++++++++++++++++ c/os/libc_linux_amd64.go | 1656 +++++++++++ c/os/libc_linux_arm64.go | 1664 +++++++++++ c/os/libgen_darwin_arm64.go | 22 - c/os/libgen_linux_amd64.go | 27 - c/os/libgen_linux_arm64.go | 24 - c/os/llcppg.pub | 164 +- c/os/llcppg_darwin_arm64.go | 7 - c/os/pwd_darwin_arm64.go | 92 - c/os/pwd_linux_amd64.go | 116 - c/os/pwd_linux_arm64.go | 116 - c/os/sched_darwin_arm64.go | 24 - c/os/sched_linux_amd64.go | 53 - c/os/sched_linux_arm64.go | 53 - c/os/spawn_darwin_arm64.go | 145 - c/os/spawn_linux_amd64.go | 199 -- c/os/spawn_linux_arm64.go | 199 -- c/os/sys-_types-_blkcnt_t_darwin_arm64.go | 7 - c/os/sys-_types-_blksize_t_darwin_arm64.go | 7 - c/os/sys-_types-_caddr_t_darwin_arm64.go | 9 - c/os/sys-_types-_clock_t_darwin_arm64.go | 7 - c/os/sys-_types-_errno_t_darwin_arm64.go | 9 - c/os/sys-_types-_fd_def_darwin_arm64.go | 22 - c/os/sys-_types-_fd_setsize_darwin_arm64.go | 7 - c/os/sys-_types-_filesec_t_darwin_arm64.go | 9 - c/os/sys-_types-_fsblkcnt_t_darwin_arm64.go | 7 - c/os/sys-_types-_fsfilcnt_t_darwin_arm64.go | 7 - c/os/sys-_types-_fsid_t_darwin_arm64.go | 12 - c/os/sys-_types-_fsobj_id_t_darwin_arm64.go | 11 - c/os/sys-_types-_id_t_darwin_arm64.go | 8 - c/os/sys-_types-_in_addr_t_darwin_arm64.go | 8 - c/os/sys-_types-_in_port_t_darwin_arm64.go | 7 - c/os/sys-_types-_ino64_t_darwin_arm64.go | 8 - c/os/sys-_types-_ino_t_darwin_arm64.go | 8 - c/os/sys-_types-_int16_t_darwin_arm64.go | 7 - c/os/sys-_types-_int32_t_darwin_arm64.go | 9 - c/os/sys-_types-_int64_t_darwin_arm64.go | 9 - c/os/sys-_types-_int8_t_darwin_arm64.go | 7 - c/os/sys-_types-_intptr_t_darwin_arm64.go | 7 - c/os/sys-_types-_key_t_darwin_arm64.go | 8 - c/os/sys-_types-_mach_port_t_darwin_arm64.go | 7 - c/os/sys-_types-_nlink_t_darwin_arm64.go | 8 - c/os/sys-_types-_o_dsync_darwin_arm64.go | 8 - c/os/sys-_types-_o_sync_darwin_arm64.go | 8 - c/os/sys-_types-_rsize_t_darwin_arm64.go | 7 - c/os/sys-_types-_s_ifmt_darwin_arm64.go | 78 - c/os/sys-_types-_seek_set_darwin_arm64.go | 20 - c/os/sys-_types-_size_t_darwin_arm64.go | 7 - c/os/sys-_types-_ssize_t_darwin_arm64.go | 7 - c/os/sys-_types-_suseconds_t_darwin_arm64.go | 7 - c/os/sys-_types-_time_t_darwin_arm64.go | 7 - c/os/sys-_types-_timespec_darwin_arm64.go | 12 - c/os/sys-_types-_timeval_darwin_arm64.go | 10 - c/os/sys-_types-_u_char_darwin_arm64.go | 7 - c/os/sys-_types-_u_int16_t_darwin_arm64.go | 7 - c/os/sys-_types-_u_int32_t_darwin_arm64.go | 9 - c/os/sys-_types-_u_int64_t_darwin_arm64.go | 9 - c/os/sys-_types-_u_int8_t_darwin_arm64.go | 7 - c/os/sys-_types-_u_int_darwin_arm64.go | 9 - c/os/sys-_types-_u_short_darwin_arm64.go | 7 - c/os/sys-_types-_uintptr_t_darwin_arm64.go | 9 - c/os/sys-_types-_useconds_t_darwin_arm64.go | 7 - c/os/sys-_types-_uuid_t_darwin_arm64.go | 7 - c/os/sys-_types_darwin_arm64.go | 63 - c/os/sys-dirent_darwin_arm64.go | 24 - c/os/sys-fcntl_darwin_arm64.go | 525 ---- c/os/sys-file_darwin_arm64.go | 12 - c/os/sys-file_linux_amd64.go | 26 - c/os/sys-file_linux_arm64.go | 26 - c/os/sys-mman_darwin_arm64.go | 229 -- c/os/sys-mman_linux_amd64.go | 92 - c/os/sys-mman_linux_arm64.go | 92 - c/os/sys-resource_darwin_arm64.go | 468 --- c/os/sys-resource_linux_amd64.go | 36 - c/os/sys-resource_linux_arm64.go | 36 - c/os/sys-stat_darwin_arm64.go | 168 -- c/os/sys-stat_linux_amd64.go | 76 - c/os/sys-stat_linux_arm64.go | 76 - c/os/sys-statvfs_darwin_arm64.go | 35 - c/os/sys-statvfs_linux_amd64.go | 15 - c/os/sys-statvfs_linux_arm64.go | 15 - c/os/sys-termios_darwin_arm64.go | 384 --- c/os/sys-times_darwin_arm64.go | 18 - c/os/sys-times_linux_amd64.go | 27 - c/os/sys-times_linux_arm64.go | 27 - c/os/sys-types_darwin_arm64.go | 37 - c/os/sys-types_linux_amd64.go | 50 - c/os/sys-types_linux_arm64.go | 50 - c/os/sys-uio_darwin_arm64.go | 39 - c/os/sys-uio_linux_amd64.go | 62 - c/os/sys-uio_linux_arm64.go | 62 - c/os/sys-utsname_darwin_arm64.go | 22 - c/os/sys-utsname_linux_amd64.go | 26 - c/os/sys-utsname_linux_arm64.go | 26 - c/os/sys-wait_darwin_arm64.go | 163 -- c/os/sys-wait_linux_amd64.go | 45 - c/os/sys-wait_linux_arm64.go | 45 - c/os/termios_darwin_arm64.go | 13 - c/os/termios_linux_amd64.go | 94 - c/os/termios_linux_arm64.go | 94 - c/os/unistd_darwin_arm64.go | 739 ----- c/os/unistd_linux_amd64.go | 448 --- c/os/unistd_linux_arm64.go | 448 --- c/os/utime_darwin_arm64.go | 18 - c/os/utime_linux_amd64.go | 24 - c/os/utime_linux_arm64.go | 24 - 157 files changed, 6024 insertions(+), 11053 deletions(-) delete mode 100644 c/os/arm-_types_darwin_arm64.go delete mode 100644 c/os/bits-confname_linux_amd64.go delete mode 100644 c/os/bits-confname_linux_arm64.go delete mode 100644 c/os/bits-dirent_linux_amd64.go delete mode 100644 c/os/bits-dirent_linux_arm64.go delete mode 100644 c/os/bits-dlfcn_linux_amd64.go delete mode 100644 c/os/bits-dlfcn_linux_arm64.go delete mode 100644 c/os/bits-fcntl-linux_linux_amd64.go delete mode 100644 c/os/bits-fcntl-linux_linux_arm64.go delete mode 100644 c/os/bits-fcntl_linux_amd64.go delete mode 100644 c/os/bits-fcntl_linux_arm64.go delete mode 100644 c/os/bits-local_lim_linux_amd64.go delete mode 100644 c/os/bits-local_lim_linux_arm64.go delete mode 100644 c/os/bits-mman-linux_linux_amd64.go delete mode 100644 c/os/bits-mman-linux_linux_arm64.go delete mode 100644 c/os/bits-mman_linux_amd64.go delete mode 100644 c/os/bits-mman_linux_arm64.go delete mode 100644 c/os/bits-poll_linux_amd64.go delete mode 100644 c/os/bits-poll_linux_arm64.go delete mode 100644 c/os/bits-posix_opt_linux_amd64.go delete mode 100644 c/os/bits-posix_opt_linux_arm64.go delete mode 100644 c/os/bits-resource_linux_amd64.go delete mode 100644 c/os/bits-resource_linux_arm64.go delete mode 100644 c/os/bits-sched_linux_amd64.go delete mode 100644 c/os/bits-sched_linux_arm64.go delete mode 100644 c/os/bits-stat_linux_amd64.go delete mode 100644 c/os/bits-stat_linux_arm64.go delete mode 100644 c/os/bits-statvfs_linux_amd64.go delete mode 100644 c/os/bits-statvfs_linux_arm64.go delete mode 100644 c/os/bits-termios_linux_amd64.go delete mode 100644 c/os/bits-termios_linux_arm64.go delete mode 100644 c/os/bits-types_linux_amd64.go delete mode 100644 c/os/bits-types_linux_arm64.go delete mode 100644 c/os/dirent_darwin_arm64.go delete mode 100644 c/os/dirent_linux_amd64.go delete mode 100644 c/os/dirent_linux_arm64.go delete mode 100644 c/os/dlfcn_darwin_arm64.go delete mode 100644 c/os/dlfcn_linux_amd64.go delete mode 100644 c/os/dlfcn_linux_arm64.go delete mode 100644 c/os/fcntl_linux_amd64.go delete mode 100644 c/os/fcntl_linux_arm64.go delete mode 100644 c/os/flags_linux_amd64.go delete mode 100644 c/os/flags_linux_arm64.go delete mode 100644 c/os/fnmatch_darwin_arm64.go delete mode 100644 c/os/fnmatch_linux_amd64.go delete mode 100644 c/os/fnmatch_linux_arm64.go delete mode 100644 c/os/glob_linux_amd64.go delete mode 100644 c/os/glob_linux_arm64.go delete mode 100644 c/os/grp_darwin_arm64.go delete mode 100644 c/os/grp_linux_amd64.go delete mode 100644 c/os/grp_linux_arm64.go create mode 100644 c/os/libc_darwin_arm64.go create mode 100644 c/os/libc_linux_amd64.go create mode 100644 c/os/libc_linux_arm64.go delete mode 100644 c/os/libgen_darwin_arm64.go delete mode 100644 c/os/libgen_linux_amd64.go delete mode 100644 c/os/libgen_linux_arm64.go delete mode 100644 c/os/llcppg_darwin_arm64.go delete mode 100644 c/os/pwd_darwin_arm64.go delete mode 100644 c/os/pwd_linux_amd64.go delete mode 100644 c/os/pwd_linux_arm64.go delete mode 100644 c/os/sched_darwin_arm64.go delete mode 100644 c/os/sched_linux_amd64.go delete mode 100644 c/os/sched_linux_arm64.go delete mode 100644 c/os/spawn_darwin_arm64.go delete mode 100644 c/os/spawn_linux_amd64.go delete mode 100644 c/os/spawn_linux_arm64.go delete mode 100644 c/os/sys-_types-_blkcnt_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_blksize_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_caddr_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_clock_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_errno_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_fd_def_darwin_arm64.go delete mode 100644 c/os/sys-_types-_fd_setsize_darwin_arm64.go delete mode 100644 c/os/sys-_types-_filesec_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_fsblkcnt_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_fsfilcnt_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_fsid_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_fsobj_id_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_id_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_in_addr_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_in_port_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_ino64_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_ino_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_int16_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_int32_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_int64_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_int8_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_intptr_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_key_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_mach_port_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_nlink_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_o_dsync_darwin_arm64.go delete mode 100644 c/os/sys-_types-_o_sync_darwin_arm64.go delete mode 100644 c/os/sys-_types-_rsize_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_s_ifmt_darwin_arm64.go delete mode 100644 c/os/sys-_types-_seek_set_darwin_arm64.go delete mode 100644 c/os/sys-_types-_size_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_ssize_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_suseconds_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_time_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_timespec_darwin_arm64.go delete mode 100644 c/os/sys-_types-_timeval_darwin_arm64.go delete mode 100644 c/os/sys-_types-_u_char_darwin_arm64.go delete mode 100644 c/os/sys-_types-_u_int16_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_u_int32_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_u_int64_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_u_int8_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_u_int_darwin_arm64.go delete mode 100644 c/os/sys-_types-_u_short_darwin_arm64.go delete mode 100644 c/os/sys-_types-_uintptr_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_useconds_t_darwin_arm64.go delete mode 100644 c/os/sys-_types-_uuid_t_darwin_arm64.go delete mode 100644 c/os/sys-_types_darwin_arm64.go delete mode 100644 c/os/sys-dirent_darwin_arm64.go delete mode 100644 c/os/sys-fcntl_darwin_arm64.go delete mode 100644 c/os/sys-file_darwin_arm64.go delete mode 100644 c/os/sys-file_linux_amd64.go delete mode 100644 c/os/sys-file_linux_arm64.go delete mode 100644 c/os/sys-mman_darwin_arm64.go delete mode 100644 c/os/sys-mman_linux_amd64.go delete mode 100644 c/os/sys-mman_linux_arm64.go delete mode 100644 c/os/sys-resource_darwin_arm64.go delete mode 100644 c/os/sys-resource_linux_amd64.go delete mode 100644 c/os/sys-resource_linux_arm64.go delete mode 100644 c/os/sys-stat_darwin_arm64.go delete mode 100644 c/os/sys-stat_linux_amd64.go delete mode 100644 c/os/sys-stat_linux_arm64.go delete mode 100644 c/os/sys-statvfs_darwin_arm64.go delete mode 100644 c/os/sys-statvfs_linux_amd64.go delete mode 100644 c/os/sys-statvfs_linux_arm64.go delete mode 100644 c/os/sys-termios_darwin_arm64.go delete mode 100644 c/os/sys-times_darwin_arm64.go delete mode 100644 c/os/sys-times_linux_amd64.go delete mode 100644 c/os/sys-times_linux_arm64.go delete mode 100644 c/os/sys-types_darwin_arm64.go delete mode 100644 c/os/sys-types_linux_amd64.go delete mode 100644 c/os/sys-types_linux_arm64.go delete mode 100644 c/os/sys-uio_darwin_arm64.go delete mode 100644 c/os/sys-uio_linux_amd64.go delete mode 100644 c/os/sys-uio_linux_arm64.go delete mode 100644 c/os/sys-utsname_darwin_arm64.go delete mode 100644 c/os/sys-utsname_linux_amd64.go delete mode 100644 c/os/sys-utsname_linux_arm64.go delete mode 100644 c/os/sys-wait_darwin_arm64.go delete mode 100644 c/os/sys-wait_linux_amd64.go delete mode 100644 c/os/sys-wait_linux_arm64.go delete mode 100644 c/os/termios_darwin_arm64.go delete mode 100644 c/os/termios_linux_amd64.go delete mode 100644 c/os/termios_linux_arm64.go delete mode 100644 c/os/unistd_darwin_arm64.go delete mode 100644 c/os/unistd_linux_amd64.go delete mode 100644 c/os/unistd_linux_arm64.go delete mode 100644 c/os/utime_darwin_arm64.go delete mode 100644 c/os/utime_linux_amd64.go delete mode 100644 c/os/utime_linux_arm64.go diff --git a/c/os/arm-_types_darwin_arm64.go b/c/os/arm-_types_darwin_arm64.go deleted file mode 100644 index 13dfc6d2..00000000 --- a/c/os/arm-_types_darwin_arm64.go +++ /dev/null @@ -1,64 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -type X__MbstateT struct { - _xgo_union [16]uint64 -} -type X__Int8T = int8 -type X__Uint8T = uint8 -type X__Int16T = int16 -type X__Uint16T = uint16 -type X__Int32T = c.Int -type X__Uint32T = c.Uint -type X__Int64T = c.LongLong -type X__Uint64T = c.UlongLong -type X__DarwinIntptrT = c.Long -type X__DarwinNaturalT = c.Uint - -// ct_rune_t -type X__DarwinCtRuneT = c.Int - -// mbstate_t -type X__DarwinMbstateT = X__MbstateT - -// ptr1 - ptr2 -type X__DarwinPtrdiffT = c.Long - -// sizeof() -type X__DarwinSizeT = c.Ulong - -// wchar_t -type X__DarwinWcharT = c.Int - -// rune_t -type X__DarwinRuneT = X__DarwinWcharT - -// wint_t -type X__DarwinWintT = c.Int - -// clock() -type X__DarwinClockT = c.Ulong - -// socklen_t (duh) -type X__DarwinSocklenT = X__Uint32T - -// byte count or error -type X__DarwinSsizeT = c.Long - -// time() -type X__DarwinTimeT = c.Long - -func (p *X__MbstateT) XGof_ref___mbstate8() *[128]c.Char { - return (*[128]c.Char)(unsafe.Pointer(p)) -} -func (p *X__MbstateT) XGof_ref__mbstateL() *c.LongLong { - return (*c.LongLong)(unsafe.Pointer(p)) -} diff --git a/c/os/bits-confname_linux_amd64.go b/c/os/bits-confname_linux_amd64.go deleted file mode 100644 index 25aec9ba..00000000 --- a/c/os/bits-confname_linux_amd64.go +++ /dev/null @@ -1,320 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// Values for the NAME argument to `pathconf' and `fpathconf'. -const ( - X_PC_LINK_MAX = 0 - X_PC_MAX_CANON = 1 - X_PC_MAX_INPUT = 2 - X_PC_NAME_MAX = 3 - X_PC_PATH_MAX = 4 - X_PC_PIPE_BUF = 5 - X_PC_CHOWN_RESTRICTED = 6 - X_PC_NO_TRUNC = 7 - X_PC_VDISABLE = 8 - X_PC_SYNC_IO = 9 - X_PC_ASYNC_IO = 10 - X_PC_PRIO_IO = 11 - X_PC_SOCK_MAXBUF = 12 - X_PC_FILESIZEBITS = 13 - X_PC_REC_INCR_XFER_SIZE = 14 - X_PC_REC_MAX_XFER_SIZE = 15 - X_PC_REC_MIN_XFER_SIZE = 16 - X_PC_REC_XFER_ALIGN = 17 - X_PC_ALLOC_SIZE_MIN = 18 - X_PC_SYMLINK_MAX = 19 - X_PC_2_SYMLINKS = 20 -) - -// Values for the argument to `sysconf'. -const ( - X_SC_ARG_MAX = 0 - X_SC_CHILD_MAX = 1 - X_SC_CLK_TCK = 2 - X_SC_NGROUPS_MAX = 3 - X_SC_OPEN_MAX = 4 - X_SC_STREAM_MAX = 5 - X_SC_TZNAME_MAX = 6 - X_SC_JOB_CONTROL = 7 - X_SC_SAVED_IDS = 8 - X_SC_REALTIME_SIGNALS = 9 - X_SC_PRIORITY_SCHEDULING = 10 - X_SC_TIMERS = 11 - X_SC_ASYNCHRONOUS_IO = 12 - X_SC_PRIORITIZED_IO = 13 - X_SC_SYNCHRONIZED_IO = 14 - X_SC_FSYNC = 15 - X_SC_MAPPED_FILES = 16 - X_SC_MEMLOCK = 17 - X_SC_MEMLOCK_RANGE = 18 - X_SC_MEMORY_PROTECTION = 19 - X_SC_MESSAGE_PASSING = 20 - X_SC_SEMAPHORES = 21 - X_SC_SHARED_MEMORY_OBJECTS = 22 - X_SC_AIO_LISTIO_MAX = 23 - X_SC_AIO_MAX = 24 - X_SC_AIO_PRIO_DELTA_MAX = 25 - X_SC_DELAYTIMER_MAX = 26 - X_SC_MQ_OPEN_MAX = 27 - X_SC_MQ_PRIO_MAX = 28 - X_SC_VERSION = 29 - X_SC_PAGESIZE = 30 - X_SC_RTSIG_MAX = 31 - X_SC_SEM_NSEMS_MAX = 32 - X_SC_SEM_VALUE_MAX = 33 - X_SC_SIGQUEUE_MAX = 34 - X_SC_TIMER_MAX = 35 - // Values for the argument to `sysconf' - // corresponding to _POSIX2_* symbols. - X_SC_BC_BASE_MAX = 36 - X_SC_BC_DIM_MAX = 37 - X_SC_BC_SCALE_MAX = 38 - X_SC_BC_STRING_MAX = 39 - X_SC_COLL_WEIGHTS_MAX = 40 - X_SC_EQUIV_CLASS_MAX = 41 - X_SC_EXPR_NEST_MAX = 42 - X_SC_LINE_MAX = 43 - X_SC_RE_DUP_MAX = 44 - X_SC_CHARCLASS_NAME_MAX = 45 - X_SC_2_VERSION = 46 - X_SC_2_C_BIND = 47 - X_SC_2_C_DEV = 48 - X_SC_2_FORT_DEV = 49 - X_SC_2_FORT_RUN = 50 - X_SC_2_SW_DEV = 51 - X_SC_2_LOCALEDEF = 52 - X_SC_PII = 53 - X_SC_PII_XTI = 54 - X_SC_PII_SOCKET = 55 - X_SC_PII_INTERNET = 56 - X_SC_PII_OSI = 57 - X_SC_POLL = 58 - X_SC_SELECT = 59 - X_SC_UIO_MAXIOV = 60 - X_SC_IOV_MAX = 60 - X_SC_PII_INTERNET_STREAM = 61 - X_SC_PII_INTERNET_DGRAM = 62 - X_SC_PII_OSI_COTS = 63 - X_SC_PII_OSI_CLTS = 64 - X_SC_PII_OSI_M = 65 - X_SC_T_IOV_MAX = 66 - // Values according to POSIX 1003.1c (POSIX threads). - X_SC_THREADS = 67 - X_SC_THREAD_SAFE_FUNCTIONS = 68 - X_SC_GETGR_R_SIZE_MAX = 69 - X_SC_GETPW_R_SIZE_MAX = 70 - X_SC_LOGIN_NAME_MAX = 71 - X_SC_TTY_NAME_MAX = 72 - X_SC_THREAD_DESTRUCTOR_ITERATIONS = 73 - X_SC_THREAD_KEYS_MAX = 74 - X_SC_THREAD_STACK_MIN = 75 - X_SC_THREAD_THREADS_MAX = 76 - X_SC_THREAD_ATTR_STACKADDR = 77 - X_SC_THREAD_ATTR_STACKSIZE = 78 - X_SC_THREAD_PRIORITY_SCHEDULING = 79 - X_SC_THREAD_PRIO_INHERIT = 80 - X_SC_THREAD_PRIO_PROTECT = 81 - X_SC_THREAD_PROCESS_SHARED = 82 - X_SC_NPROCESSORS_CONF = 83 - X_SC_NPROCESSORS_ONLN = 84 - X_SC_PHYS_PAGES = 85 - X_SC_AVPHYS_PAGES = 86 - X_SC_ATEXIT_MAX = 87 - X_SC_PASS_MAX = 88 - X_SC_XOPEN_VERSION = 89 - X_SC_XOPEN_XCU_VERSION = 90 - X_SC_XOPEN_UNIX = 91 - X_SC_XOPEN_CRYPT = 92 - X_SC_XOPEN_ENH_I18N = 93 - X_SC_XOPEN_SHM = 94 - X_SC_2_CHAR_TERM = 95 - X_SC_2_C_VERSION = 96 - X_SC_2_UPE = 97 - X_SC_XOPEN_XPG2 = 98 - X_SC_XOPEN_XPG3 = 99 - X_SC_XOPEN_XPG4 = 100 - X_SC_CHAR_BIT = 101 - X_SC_CHAR_MAX = 102 - X_SC_CHAR_MIN = 103 - X_SC_INT_MAX = 104 - X_SC_INT_MIN = 105 - X_SC_LONG_BIT = 106 - X_SC_WORD_BIT = 107 - X_SC_MB_LEN_MAX = 108 - X_SC_NZERO = 109 - X_SC_SSIZE_MAX = 110 - X_SC_SCHAR_MAX = 111 - X_SC_SCHAR_MIN = 112 - X_SC_SHRT_MAX = 113 - X_SC_SHRT_MIN = 114 - X_SC_UCHAR_MAX = 115 - X_SC_UINT_MAX = 116 - X_SC_ULONG_MAX = 117 - X_SC_USHRT_MAX = 118 - X_SC_NL_ARGMAX = 119 - X_SC_NL_LANGMAX = 120 - X_SC_NL_MSGMAX = 121 - X_SC_NL_NMAX = 122 - X_SC_NL_SETMAX = 123 - X_SC_NL_TEXTMAX = 124 - X_SC_XBS5_ILP32_OFF32 = 125 - X_SC_XBS5_ILP32_OFFBIG = 126 - X_SC_XBS5_LP64_OFF64 = 127 - X_SC_XBS5_LPBIG_OFFBIG = 128 - X_SC_XOPEN_LEGACY = 129 - X_SC_XOPEN_REALTIME = 130 - X_SC_XOPEN_REALTIME_THREADS = 131 - X_SC_ADVISORY_INFO = 132 - X_SC_BARRIERS = 133 - X_SC_BASE = 134 - X_SC_C_LANG_SUPPORT = 135 - X_SC_C_LANG_SUPPORT_R = 136 - X_SC_CLOCK_SELECTION = 137 - X_SC_CPUTIME = 138 - X_SC_THREAD_CPUTIME = 139 - X_SC_DEVICE_IO = 140 - X_SC_DEVICE_SPECIFIC = 141 - X_SC_DEVICE_SPECIFIC_R = 142 - X_SC_FD_MGMT = 143 - X_SC_FIFO = 144 - X_SC_PIPE = 145 - X_SC_FILE_ATTRIBUTES = 146 - X_SC_FILE_LOCKING = 147 - X_SC_FILE_SYSTEM = 148 - X_SC_MONOTONIC_CLOCK = 149 - X_SC_MULTI_PROCESS = 150 - X_SC_SINGLE_PROCESS = 151 - X_SC_NETWORKING = 152 - X_SC_READER_WRITER_LOCKS = 153 - X_SC_SPIN_LOCKS = 154 - X_SC_REGEXP = 155 - X_SC_REGEX_VERSION = 156 - X_SC_SHELL = 157 - X_SC_SIGNALS = 158 - X_SC_SPAWN = 159 - X_SC_SPORADIC_SERVER = 160 - X_SC_THREAD_SPORADIC_SERVER = 161 - X_SC_SYSTEM_DATABASE = 162 - X_SC_SYSTEM_DATABASE_R = 163 - X_SC_TIMEOUTS = 164 - X_SC_TYPED_MEMORY_OBJECTS = 165 - X_SC_USER_GROUPS = 166 - X_SC_USER_GROUPS_R = 167 - X_SC_2_PBS = 168 - X_SC_2_PBS_ACCOUNTING = 169 - X_SC_2_PBS_LOCATE = 170 - X_SC_2_PBS_MESSAGE = 171 - X_SC_2_PBS_TRACK = 172 - X_SC_SYMLOOP_MAX = 173 - X_SC_STREAMS = 174 - X_SC_2_PBS_CHECKPOINT = 175 - X_SC_V6_ILP32_OFF32 = 176 - X_SC_V6_ILP32_OFFBIG = 177 - X_SC_V6_LP64_OFF64 = 178 - X_SC_V6_LPBIG_OFFBIG = 179 - X_SC_HOST_NAME_MAX = 180 - X_SC_TRACE = 181 - X_SC_TRACE_EVENT_FILTER = 182 - X_SC_TRACE_INHERIT = 183 - X_SC_TRACE_LOG = 184 - X_SC_LEVEL1_ICACHE_SIZE = 185 - X_SC_LEVEL1_ICACHE_ASSOC = 186 - X_SC_LEVEL1_ICACHE_LINESIZE = 187 - X_SC_LEVEL1_DCACHE_SIZE = 188 - X_SC_LEVEL1_DCACHE_ASSOC = 189 - X_SC_LEVEL1_DCACHE_LINESIZE = 190 - X_SC_LEVEL2_CACHE_SIZE = 191 - X_SC_LEVEL2_CACHE_ASSOC = 192 - X_SC_LEVEL2_CACHE_LINESIZE = 193 - X_SC_LEVEL3_CACHE_SIZE = 194 - X_SC_LEVEL3_CACHE_ASSOC = 195 - X_SC_LEVEL3_CACHE_LINESIZE = 196 - X_SC_LEVEL4_CACHE_SIZE = 197 - X_SC_LEVEL4_CACHE_ASSOC = 198 - X_SC_LEVEL4_CACHE_LINESIZE = 199 - X_SC_IPV6 = 235 - X_SC_RAW_SOCKETS = 236 - X_SC_V7_ILP32_OFF32 = 237 - X_SC_V7_ILP32_OFFBIG = 238 - X_SC_V7_LP64_OFF64 = 239 - X_SC_V7_LPBIG_OFFBIG = 240 - X_SC_SS_REPL_MAX = 241 - X_SC_TRACE_EVENT_NAME_MAX = 242 - X_SC_TRACE_NAME_MAX = 243 - X_SC_TRACE_SYS_MAX = 244 - X_SC_TRACE_USER_EVENT_MAX = 245 - X_SC_XOPEN_STREAMS = 246 - X_SC_THREAD_ROBUST_PRIO_INHERIT = 247 - X_SC_THREAD_ROBUST_PRIO_PROTECT = 248 -) - -// Values for the NAME argument to `confstr'. -const ( - X_CS_PATH = 0 - X_CS_V6_WIDTH_RESTRICTED_ENVS = 1 - X_CS_GNU_LIBC_VERSION = 2 - X_CS_GNU_LIBPTHREAD_VERSION = 3 - X_CS_V5_WIDTH_RESTRICTED_ENVS = 4 - X_CS_V7_WIDTH_RESTRICTED_ENVS = 5 - X_CS_LFS_CFLAGS = 1000 - X_CS_LFS_LDFLAGS = 1001 - X_CS_LFS_LIBS = 1002 - X_CS_LFS_LINTFLAGS = 1003 - X_CS_LFS64_CFLAGS = 1004 - X_CS_LFS64_LDFLAGS = 1005 - X_CS_LFS64_LIBS = 1006 - X_CS_LFS64_LINTFLAGS = 1007 - X_CS_XBS5_ILP32_OFF32_CFLAGS = 1100 - X_CS_XBS5_ILP32_OFF32_LDFLAGS = 1101 - X_CS_XBS5_ILP32_OFF32_LIBS = 1102 - X_CS_XBS5_ILP32_OFF32_LINTFLAGS = 1103 - X_CS_XBS5_ILP32_OFFBIG_CFLAGS = 1104 - X_CS_XBS5_ILP32_OFFBIG_LDFLAGS = 1105 - X_CS_XBS5_ILP32_OFFBIG_LIBS = 1106 - X_CS_XBS5_ILP32_OFFBIG_LINTFLAGS = 1107 - X_CS_XBS5_LP64_OFF64_CFLAGS = 1108 - X_CS_XBS5_LP64_OFF64_LDFLAGS = 1109 - X_CS_XBS5_LP64_OFF64_LIBS = 1110 - X_CS_XBS5_LP64_OFF64_LINTFLAGS = 1111 - X_CS_XBS5_LPBIG_OFFBIG_CFLAGS = 1112 - X_CS_XBS5_LPBIG_OFFBIG_LDFLAGS = 1113 - X_CS_XBS5_LPBIG_OFFBIG_LIBS = 1114 - X_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS = 1115 - X_CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116 - X_CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117 - X_CS_POSIX_V6_ILP32_OFF32_LIBS = 1118 - X_CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119 - X_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120 - X_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121 - X_CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122 - X_CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123 - X_CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124 - X_CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125 - X_CS_POSIX_V6_LP64_OFF64_LIBS = 1126 - X_CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127 - X_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128 - X_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129 - X_CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130 - X_CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131 - X_CS_POSIX_V7_ILP32_OFF32_CFLAGS = 1132 - X_CS_POSIX_V7_ILP32_OFF32_LDFLAGS = 1133 - X_CS_POSIX_V7_ILP32_OFF32_LIBS = 1134 - X_CS_POSIX_V7_ILP32_OFF32_LINTFLAGS = 1135 - X_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS = 1136 - X_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS = 1137 - X_CS_POSIX_V7_ILP32_OFFBIG_LIBS = 1138 - X_CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139 - X_CS_POSIX_V7_LP64_OFF64_CFLAGS = 1140 - X_CS_POSIX_V7_LP64_OFF64_LDFLAGS = 1141 - X_CS_POSIX_V7_LP64_OFF64_LIBS = 1142 - X_CS_POSIX_V7_LP64_OFF64_LINTFLAGS = 1143 - X_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS = 1144 - X_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS = 1145 - X_CS_POSIX_V7_LPBIG_OFFBIG_LIBS = 1146 - X_CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147 - X_CS_V6_ENV = 1148 - X_CS_V7_ENV = 1149 -) diff --git a/c/os/bits-confname_linux_arm64.go b/c/os/bits-confname_linux_arm64.go deleted file mode 100644 index 435c1580..00000000 --- a/c/os/bits-confname_linux_arm64.go +++ /dev/null @@ -1,320 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// Values for the NAME argument to `pathconf' and `fpathconf'. -const ( - X_PC_LINK_MAX = 0 - X_PC_MAX_CANON = 1 - X_PC_MAX_INPUT = 2 - X_PC_NAME_MAX = 3 - X_PC_PATH_MAX = 4 - X_PC_PIPE_BUF = 5 - X_PC_CHOWN_RESTRICTED = 6 - X_PC_NO_TRUNC = 7 - X_PC_VDISABLE = 8 - X_PC_SYNC_IO = 9 - X_PC_ASYNC_IO = 10 - X_PC_PRIO_IO = 11 - X_PC_SOCK_MAXBUF = 12 - X_PC_FILESIZEBITS = 13 - X_PC_REC_INCR_XFER_SIZE = 14 - X_PC_REC_MAX_XFER_SIZE = 15 - X_PC_REC_MIN_XFER_SIZE = 16 - X_PC_REC_XFER_ALIGN = 17 - X_PC_ALLOC_SIZE_MIN = 18 - X_PC_SYMLINK_MAX = 19 - X_PC_2_SYMLINKS = 20 -) - -// Values for the argument to `sysconf'. -const ( - X_SC_ARG_MAX = 0 - X_SC_CHILD_MAX = 1 - X_SC_CLK_TCK = 2 - X_SC_NGROUPS_MAX = 3 - X_SC_OPEN_MAX = 4 - X_SC_STREAM_MAX = 5 - X_SC_TZNAME_MAX = 6 - X_SC_JOB_CONTROL = 7 - X_SC_SAVED_IDS = 8 - X_SC_REALTIME_SIGNALS = 9 - X_SC_PRIORITY_SCHEDULING = 10 - X_SC_TIMERS = 11 - X_SC_ASYNCHRONOUS_IO = 12 - X_SC_PRIORITIZED_IO = 13 - X_SC_SYNCHRONIZED_IO = 14 - X_SC_FSYNC = 15 - X_SC_MAPPED_FILES = 16 - X_SC_MEMLOCK = 17 - X_SC_MEMLOCK_RANGE = 18 - X_SC_MEMORY_PROTECTION = 19 - X_SC_MESSAGE_PASSING = 20 - X_SC_SEMAPHORES = 21 - X_SC_SHARED_MEMORY_OBJECTS = 22 - X_SC_AIO_LISTIO_MAX = 23 - X_SC_AIO_MAX = 24 - X_SC_AIO_PRIO_DELTA_MAX = 25 - X_SC_DELAYTIMER_MAX = 26 - X_SC_MQ_OPEN_MAX = 27 - X_SC_MQ_PRIO_MAX = 28 - X_SC_VERSION = 29 - X_SC_PAGESIZE = 30 - X_SC_RTSIG_MAX = 31 - X_SC_SEM_NSEMS_MAX = 32 - X_SC_SEM_VALUE_MAX = 33 - X_SC_SIGQUEUE_MAX = 34 - X_SC_TIMER_MAX = 35 - // Values for the argument to `sysconf' - // corresponding to _POSIX2_* symbols. - X_SC_BC_BASE_MAX = 36 - X_SC_BC_DIM_MAX = 37 - X_SC_BC_SCALE_MAX = 38 - X_SC_BC_STRING_MAX = 39 - X_SC_COLL_WEIGHTS_MAX = 40 - X_SC_EQUIV_CLASS_MAX = 41 - X_SC_EXPR_NEST_MAX = 42 - X_SC_LINE_MAX = 43 - X_SC_RE_DUP_MAX = 44 - X_SC_CHARCLASS_NAME_MAX = 45 - X_SC_2_VERSION = 46 - X_SC_2_C_BIND = 47 - X_SC_2_C_DEV = 48 - X_SC_2_FORT_DEV = 49 - X_SC_2_FORT_RUN = 50 - X_SC_2_SW_DEV = 51 - X_SC_2_LOCALEDEF = 52 - X_SC_PII = 53 - X_SC_PII_XTI = 54 - X_SC_PII_SOCKET = 55 - X_SC_PII_INTERNET = 56 - X_SC_PII_OSI = 57 - X_SC_POLL = 58 - X_SC_SELECT = 59 - X_SC_UIO_MAXIOV = 60 - X_SC_IOV_MAX = 60 - X_SC_PII_INTERNET_STREAM = 61 - X_SC_PII_INTERNET_DGRAM = 62 - X_SC_PII_OSI_COTS = 63 - X_SC_PII_OSI_CLTS = 64 - X_SC_PII_OSI_M = 65 - X_SC_T_IOV_MAX = 66 - // Values according to POSIX 1003.1c (POSIX threads). - X_SC_THREADS = 67 - X_SC_THREAD_SAFE_FUNCTIONS = 68 - X_SC_GETGR_R_SIZE_MAX = 69 - X_SC_GETPW_R_SIZE_MAX = 70 - X_SC_LOGIN_NAME_MAX = 71 - X_SC_TTY_NAME_MAX = 72 - X_SC_THREAD_DESTRUCTOR_ITERATIONS = 73 - X_SC_THREAD_KEYS_MAX = 74 - X_SC_THREAD_STACK_MIN = 75 - X_SC_THREAD_THREADS_MAX = 76 - X_SC_THREAD_ATTR_STACKADDR = 77 - X_SC_THREAD_ATTR_STACKSIZE = 78 - X_SC_THREAD_PRIORITY_SCHEDULING = 79 - X_SC_THREAD_PRIO_INHERIT = 80 - X_SC_THREAD_PRIO_PROTECT = 81 - X_SC_THREAD_PROCESS_SHARED = 82 - X_SC_NPROCESSORS_CONF = 83 - X_SC_NPROCESSORS_ONLN = 84 - X_SC_PHYS_PAGES = 85 - X_SC_AVPHYS_PAGES = 86 - X_SC_ATEXIT_MAX = 87 - X_SC_PASS_MAX = 88 - X_SC_XOPEN_VERSION = 89 - X_SC_XOPEN_XCU_VERSION = 90 - X_SC_XOPEN_UNIX = 91 - X_SC_XOPEN_CRYPT = 92 - X_SC_XOPEN_ENH_I18N = 93 - X_SC_XOPEN_SHM = 94 - X_SC_2_CHAR_TERM = 95 - X_SC_2_C_VERSION = 96 - X_SC_2_UPE = 97 - X_SC_XOPEN_XPG2 = 98 - X_SC_XOPEN_XPG3 = 99 - X_SC_XOPEN_XPG4 = 100 - X_SC_CHAR_BIT = 101 - X_SC_CHAR_MAX = 102 - X_SC_CHAR_MIN = 103 - X_SC_INT_MAX = 104 - X_SC_INT_MIN = 105 - X_SC_LONG_BIT = 106 - X_SC_WORD_BIT = 107 - X_SC_MB_LEN_MAX = 108 - X_SC_NZERO = 109 - X_SC_SSIZE_MAX = 110 - X_SC_SCHAR_MAX = 111 - X_SC_SCHAR_MIN = 112 - X_SC_SHRT_MAX = 113 - X_SC_SHRT_MIN = 114 - X_SC_UCHAR_MAX = 115 - X_SC_UINT_MAX = 116 - X_SC_ULONG_MAX = 117 - X_SC_USHRT_MAX = 118 - X_SC_NL_ARGMAX = 119 - X_SC_NL_LANGMAX = 120 - X_SC_NL_MSGMAX = 121 - X_SC_NL_NMAX = 122 - X_SC_NL_SETMAX = 123 - X_SC_NL_TEXTMAX = 124 - X_SC_XBS5_ILP32_OFF32 = 125 - X_SC_XBS5_ILP32_OFFBIG = 126 - X_SC_XBS5_LP64_OFF64 = 127 - X_SC_XBS5_LPBIG_OFFBIG = 128 - X_SC_XOPEN_LEGACY = 129 - X_SC_XOPEN_REALTIME = 130 - X_SC_XOPEN_REALTIME_THREADS = 131 - X_SC_ADVISORY_INFO = 132 - X_SC_BARRIERS = 133 - X_SC_BASE = 134 - X_SC_C_LANG_SUPPORT = 135 - X_SC_C_LANG_SUPPORT_R = 136 - X_SC_CLOCK_SELECTION = 137 - X_SC_CPUTIME = 138 - X_SC_THREAD_CPUTIME = 139 - X_SC_DEVICE_IO = 140 - X_SC_DEVICE_SPECIFIC = 141 - X_SC_DEVICE_SPECIFIC_R = 142 - X_SC_FD_MGMT = 143 - X_SC_FIFO = 144 - X_SC_PIPE = 145 - X_SC_FILE_ATTRIBUTES = 146 - X_SC_FILE_LOCKING = 147 - X_SC_FILE_SYSTEM = 148 - X_SC_MONOTONIC_CLOCK = 149 - X_SC_MULTI_PROCESS = 150 - X_SC_SINGLE_PROCESS = 151 - X_SC_NETWORKING = 152 - X_SC_READER_WRITER_LOCKS = 153 - X_SC_SPIN_LOCKS = 154 - X_SC_REGEXP = 155 - X_SC_REGEX_VERSION = 156 - X_SC_SHELL = 157 - X_SC_SIGNALS = 158 - X_SC_SPAWN = 159 - X_SC_SPORADIC_SERVER = 160 - X_SC_THREAD_SPORADIC_SERVER = 161 - X_SC_SYSTEM_DATABASE = 162 - X_SC_SYSTEM_DATABASE_R = 163 - X_SC_TIMEOUTS = 164 - X_SC_TYPED_MEMORY_OBJECTS = 165 - X_SC_USER_GROUPS = 166 - X_SC_USER_GROUPS_R = 167 - X_SC_2_PBS = 168 - X_SC_2_PBS_ACCOUNTING = 169 - X_SC_2_PBS_LOCATE = 170 - X_SC_2_PBS_MESSAGE = 171 - X_SC_2_PBS_TRACK = 172 - X_SC_SYMLOOP_MAX = 173 - X_SC_STREAMS = 174 - X_SC_2_PBS_CHECKPOINT = 175 - X_SC_V6_ILP32_OFF32 = 176 - X_SC_V6_ILP32_OFFBIG = 177 - X_SC_V6_LP64_OFF64 = 178 - X_SC_V6_LPBIG_OFFBIG = 179 - X_SC_HOST_NAME_MAX = 180 - X_SC_TRACE = 181 - X_SC_TRACE_EVENT_FILTER = 182 - X_SC_TRACE_INHERIT = 183 - X_SC_TRACE_LOG = 184 - X_SC_LEVEL1_ICACHE_SIZE = 185 - X_SC_LEVEL1_ICACHE_ASSOC = 186 - X_SC_LEVEL1_ICACHE_LINESIZE = 187 - X_SC_LEVEL1_DCACHE_SIZE = 188 - X_SC_LEVEL1_DCACHE_ASSOC = 189 - X_SC_LEVEL1_DCACHE_LINESIZE = 190 - X_SC_LEVEL2_CACHE_SIZE = 191 - X_SC_LEVEL2_CACHE_ASSOC = 192 - X_SC_LEVEL2_CACHE_LINESIZE = 193 - X_SC_LEVEL3_CACHE_SIZE = 194 - X_SC_LEVEL3_CACHE_ASSOC = 195 - X_SC_LEVEL3_CACHE_LINESIZE = 196 - X_SC_LEVEL4_CACHE_SIZE = 197 - X_SC_LEVEL4_CACHE_ASSOC = 198 - X_SC_LEVEL4_CACHE_LINESIZE = 199 - X_SC_IPV6 = 235 - X_SC_RAW_SOCKETS = 236 - X_SC_V7_ILP32_OFF32 = 237 - X_SC_V7_ILP32_OFFBIG = 238 - X_SC_V7_LP64_OFF64 = 239 - X_SC_V7_LPBIG_OFFBIG = 240 - X_SC_SS_REPL_MAX = 241 - X_SC_TRACE_EVENT_NAME_MAX = 242 - X_SC_TRACE_NAME_MAX = 243 - X_SC_TRACE_SYS_MAX = 244 - X_SC_TRACE_USER_EVENT_MAX = 245 - X_SC_XOPEN_STREAMS = 246 - X_SC_THREAD_ROBUST_PRIO_INHERIT = 247 - X_SC_THREAD_ROBUST_PRIO_PROTECT = 248 -) - -// Values for the NAME argument to `confstr'. -const ( - X_CS_PATH = 0 - X_CS_V6_WIDTH_RESTRICTED_ENVS = 1 - X_CS_GNU_LIBC_VERSION = 2 - X_CS_GNU_LIBPTHREAD_VERSION = 3 - X_CS_V5_WIDTH_RESTRICTED_ENVS = 4 - X_CS_V7_WIDTH_RESTRICTED_ENVS = 5 - X_CS_LFS_CFLAGS = 1000 - X_CS_LFS_LDFLAGS = 1001 - X_CS_LFS_LIBS = 1002 - X_CS_LFS_LINTFLAGS = 1003 - X_CS_LFS64_CFLAGS = 1004 - X_CS_LFS64_LDFLAGS = 1005 - X_CS_LFS64_LIBS = 1006 - X_CS_LFS64_LINTFLAGS = 1007 - X_CS_XBS5_ILP32_OFF32_CFLAGS = 1100 - X_CS_XBS5_ILP32_OFF32_LDFLAGS = 1101 - X_CS_XBS5_ILP32_OFF32_LIBS = 1102 - X_CS_XBS5_ILP32_OFF32_LINTFLAGS = 1103 - X_CS_XBS5_ILP32_OFFBIG_CFLAGS = 1104 - X_CS_XBS5_ILP32_OFFBIG_LDFLAGS = 1105 - X_CS_XBS5_ILP32_OFFBIG_LIBS = 1106 - X_CS_XBS5_ILP32_OFFBIG_LINTFLAGS = 1107 - X_CS_XBS5_LP64_OFF64_CFLAGS = 1108 - X_CS_XBS5_LP64_OFF64_LDFLAGS = 1109 - X_CS_XBS5_LP64_OFF64_LIBS = 1110 - X_CS_XBS5_LP64_OFF64_LINTFLAGS = 1111 - X_CS_XBS5_LPBIG_OFFBIG_CFLAGS = 1112 - X_CS_XBS5_LPBIG_OFFBIG_LDFLAGS = 1113 - X_CS_XBS5_LPBIG_OFFBIG_LIBS = 1114 - X_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS = 1115 - X_CS_POSIX_V6_ILP32_OFF32_CFLAGS = 1116 - X_CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 1117 - X_CS_POSIX_V6_ILP32_OFF32_LIBS = 1118 - X_CS_POSIX_V6_ILP32_OFF32_LINTFLAGS = 1119 - X_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 1120 - X_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 1121 - X_CS_POSIX_V6_ILP32_OFFBIG_LIBS = 1122 - X_CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS = 1123 - X_CS_POSIX_V6_LP64_OFF64_CFLAGS = 1124 - X_CS_POSIX_V6_LP64_OFF64_LDFLAGS = 1125 - X_CS_POSIX_V6_LP64_OFF64_LIBS = 1126 - X_CS_POSIX_V6_LP64_OFF64_LINTFLAGS = 1127 - X_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 1128 - X_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 1129 - X_CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 1130 - X_CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS = 1131 - X_CS_POSIX_V7_ILP32_OFF32_CFLAGS = 1132 - X_CS_POSIX_V7_ILP32_OFF32_LDFLAGS = 1133 - X_CS_POSIX_V7_ILP32_OFF32_LIBS = 1134 - X_CS_POSIX_V7_ILP32_OFF32_LINTFLAGS = 1135 - X_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS = 1136 - X_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS = 1137 - X_CS_POSIX_V7_ILP32_OFFBIG_LIBS = 1138 - X_CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS = 1139 - X_CS_POSIX_V7_LP64_OFF64_CFLAGS = 1140 - X_CS_POSIX_V7_LP64_OFF64_LDFLAGS = 1141 - X_CS_POSIX_V7_LP64_OFF64_LIBS = 1142 - X_CS_POSIX_V7_LP64_OFF64_LINTFLAGS = 1143 - X_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS = 1144 - X_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS = 1145 - X_CS_POSIX_V7_LPBIG_OFFBIG_LIBS = 1146 - X_CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS = 1147 - X_CS_V6_ENV = 1148 - X_CS_V7_ENV = 1149 -) diff --git a/c/os/bits-dirent_linux_amd64.go b/c/os/bits-dirent_linux_amd64.go deleted file mode 100644 index cc8714ad..00000000 --- a/c/os/bits-dirent_linux_amd64.go +++ /dev/null @@ -1,8 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// Inform libc code that these two types are effectively identical. -const X_DIRENT_MATCHES_DIRENT64 = 1 diff --git a/c/os/bits-dirent_linux_arm64.go b/c/os/bits-dirent_linux_arm64.go deleted file mode 100644 index 877f9588..00000000 --- a/c/os/bits-dirent_linux_arm64.go +++ /dev/null @@ -1,16 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// Inform libc code that these two types are effectively identical. -const X_DIRENT_MATCHES_DIRENT64 = 1 - -type Dirent struct { - DIno X__InoT - DOff X__OffT - DReclen uint16 - DType uint8 - DName [256]uint8 -} diff --git a/c/os/bits-dlfcn_linux_amd64.go b/c/os/bits-dlfcn_linux_amd64.go deleted file mode 100644 index e5904a0f..00000000 --- a/c/os/bits-dlfcn_linux_amd64.go +++ /dev/null @@ -1,31 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// The MODE argument to `dlopen' contains one of the following: -const ( - RTLD_LAZY = 1 - // Immediate function call binding. - RTLD_NOW = 2 - // Mask of binding time value. - RTLD_BINDING_MASK = 3 - // Do not load the object. - RTLD_NOLOAD = 4 - // Use deep binding. - RTLD_DEEPBIND = 8 -) - -// If the following bit is set in the MODE argument to `dlopen', -// the symbols of the loaded object and its dependencies are made -// visible as if the object were linked directly into the program. -const RTLD_GLOBAL = 256 - -// Unix98 demands the following flag which is the inverse to RTLD_GLOBAL. -// The implementation does this by default and so we can define the -// value to zero. -const RTLD_LOCAL = 0 - -// Do not delete object when closed. -const RTLD_NODELETE = 4096 diff --git a/c/os/bits-dlfcn_linux_arm64.go b/c/os/bits-dlfcn_linux_arm64.go deleted file mode 100644 index dfafa544..00000000 --- a/c/os/bits-dlfcn_linux_arm64.go +++ /dev/null @@ -1,31 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// The MODE argument to `dlopen' contains one of the following: -const ( - RTLD_LAZY = 1 - // Immediate function call binding. - RTLD_NOW = 2 - // Mask of binding time value. - RTLD_BINDING_MASK = 3 - // Do not load the object. - RTLD_NOLOAD = 4 - // Use deep binding. - RTLD_DEEPBIND = 8 -) - -// If the following bit is set in the MODE argument to `dlopen', -// the symbols of the loaded object and its dependencies are made -// visible as if the object were linked directly into the program. -const RTLD_GLOBAL = 256 - -// Unix98 demands the following flag which is the inverse to RTLD_GLOBAL. -// The implementation does this by default and so we can define the -// value to zero. -const RTLD_LOCAL = 0 - -// Do not delete object when closed. -const RTLD_NODELETE = 4096 diff --git a/c/os/bits-fcntl-linux_linux_amd64.go b/c/os/bits-fcntl-linux_linux_amd64.go deleted file mode 100644 index 885e1671..00000000 --- a/c/os/bits-fcntl-linux_linux_amd64.go +++ /dev/null @@ -1,134 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// Not fcntl. -const O_EXCL = 128 - -// Not fcntl. -const O_NOCTTY = 256 -const O_APPEND = 1024 -const O_SYNC = 1052672 -const O_FSYNC = 1052672 -const O_ASYNC = 8192 -const X__O_DIRECTORY = 65536 -const X__O_NOFOLLOW = 131072 -const X__O_CLOEXEC = 524288 -const X__O_DIRECT = 16384 -const X__O_NOATIME = 262144 -const X__O_PATH = 2097152 -const X__O_DSYNC = 4096 -const X__O_TMPFILE = 4259840 -const ( - // Get record locking info. - F_GETLK = 5 - // Set record locking info (non-blocking). - F_SETLK = 6 - // Set record locking info (blocking). - F_SETLKW = 7 -) -const ( - // Must be a directory. - O_DIRECTORY = 65536 - // Do not follow links. - O_NOFOLLOW = 131072 - // Set close_on_exec. - O_CLOEXEC = 524288 -) - -// Synchronize data. -const O_DSYNC = 4096 - -// Synchronize read operations. -const O_RSYNC = 1052672 - -// Values for the second argument to `fcntl'. -const ( - F_DUPFD = 0 - // Get file descriptor flags. - F_GETFD = 1 - // Set file descriptor flags. - F_SETFD = 2 -) -const ( - X__F_SETOWN = 8 - X__F_GETOWN = 9 -) -const ( - // Get owner (process receiving SIGIO). - F_SETOWN = 8 - // Set owner (process receiving SIGIO). - F_GETOWN = 9 -) -const ( - // Set number of signal to be sent. - X__F_SETSIG = 10 - // Get number of signal to be sent. - X__F_GETSIG = 11 -) -const ( - // Get owner (thread receiving SIGIO). - X__F_SETOWN_EX = 15 - // Set owner (thread receiving SIGIO). - X__F_GETOWN_EX = 16 -) - -// Duplicate file descriptor with -// close-on-exit set. -const F_DUPFD_CLOEXEC = 1030 - -// For F_[GET|SET]FD. -const FD_CLOEXEC = 1 - -// For posix fcntl() and `l_type' field of a `struct _llcppg_flock_type' for lockf(). -const ( - F_RDLCK = 0 - // Write lock. - F_WRLCK = 1 - // Remove lock. - F_UNLCK = 2 -) -const ( - // or 3 - F_EXLCK = 4 - // or 4 - F_SHLCK = 8 -) - -// Operations for BSD flock, also used by the kernel implementation. -const ( - LOCK_SH = 1 - // Exclusive lock. - LOCK_EX = 2 - // Or'd with one of the above to prevent - // blocking. - LOCK_NB = 4 -) - -// Remove lock. -const LOCK_UN = 8 -const ( - FAPPEND = 1024 - FFSYNC = 1052672 - FASYNC = 8192 -) -const ( - X__POSIX_FADV_DONTNEED = 4 - X__POSIX_FADV_NOREUSE = 5 -) -const ( - // No further special treatment. - POSIX_FADV_NORMAL = 0 - // Expect random page references. - POSIX_FADV_RANDOM = 1 - // Expect sequential page references. - POSIX_FADV_SEQUENTIAL = 2 - // Will need these pages. - POSIX_FADV_WILLNEED = 3 - // Don't need these pages. - POSIX_FADV_DONTNEED = 4 - // Data will be accessed once. - POSIX_FADV_NOREUSE = 5 -) diff --git a/c/os/bits-fcntl-linux_linux_arm64.go b/c/os/bits-fcntl-linux_linux_arm64.go deleted file mode 100644 index 2e2df8bc..00000000 --- a/c/os/bits-fcntl-linux_linux_arm64.go +++ /dev/null @@ -1,131 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// Not fcntl. -const O_EXCL = 128 - -// Not fcntl. -const O_NOCTTY = 256 -const O_APPEND = 1024 -const O_SYNC = 1052672 -const O_FSYNC = 1052672 -const O_ASYNC = 8192 -const X__O_CLOEXEC = 524288 -const X__O_NOATIME = 262144 -const X__O_PATH = 2097152 -const X__O_DSYNC = 4096 -const X__O_TMPFILE = 4210688 -const ( - // Get record locking info. - F_GETLK = 5 - // Set record locking info (non-blocking). - F_SETLK = 6 - // Set record locking info (blocking). - F_SETLKW = 7 -) -const ( - // Must be a directory. - O_DIRECTORY = 16384 - // Do not follow links. - O_NOFOLLOW = 32768 - // Set close_on_exec. - O_CLOEXEC = 524288 -) - -// Synchronize data. -const O_DSYNC = 4096 - -// Synchronize read operations. -const O_RSYNC = 1052672 - -// Values for the second argument to `fcntl'. -const ( - F_DUPFD = 0 - // Get file descriptor flags. - F_GETFD = 1 - // Set file descriptor flags. - F_SETFD = 2 -) -const ( - X__F_SETOWN = 8 - X__F_GETOWN = 9 -) -const ( - // Get owner (process receiving SIGIO). - F_SETOWN = 8 - // Set owner (process receiving SIGIO). - F_GETOWN = 9 -) -const ( - // Set number of signal to be sent. - X__F_SETSIG = 10 - // Get number of signal to be sent. - X__F_GETSIG = 11 -) -const ( - // Get owner (thread receiving SIGIO). - X__F_SETOWN_EX = 15 - // Set owner (thread receiving SIGIO). - X__F_GETOWN_EX = 16 -) - -// Duplicate file descriptor with -// close-on-exit set. -const F_DUPFD_CLOEXEC = 1030 - -// For F_[GET|SET]FD. -const FD_CLOEXEC = 1 - -// For posix fcntl() and `l_type' field of a `struct _llcppg_flock_type' for lockf(). -const ( - F_RDLCK = 0 - // Write lock. - F_WRLCK = 1 - // Remove lock. - F_UNLCK = 2 -) -const ( - // or 3 - F_EXLCK = 4 - // or 4 - F_SHLCK = 8 -) - -// Operations for BSD flock, also used by the kernel implementation. -const ( - LOCK_SH = 1 - // Exclusive lock. - LOCK_EX = 2 - // Or'd with one of the above to prevent - // blocking. - LOCK_NB = 4 -) - -// Remove lock. -const LOCK_UN = 8 -const ( - FAPPEND = 1024 - FFSYNC = 1052672 - FASYNC = 8192 -) -const ( - X__POSIX_FADV_DONTNEED = 4 - X__POSIX_FADV_NOREUSE = 5 -) -const ( - // No further special treatment. - POSIX_FADV_NORMAL = 0 - // Expect random page references. - POSIX_FADV_RANDOM = 1 - // Expect sequential page references. - POSIX_FADV_SEQUENTIAL = 2 - // Will need these pages. - POSIX_FADV_WILLNEED = 3 - // Don't need these pages. - POSIX_FADV_DONTNEED = 4 - // Data will be accessed once. - POSIX_FADV_NOREUSE = 5 -) diff --git a/c/os/bits-fcntl_linux_amd64.go b/c/os/bits-fcntl_linux_amd64.go deleted file mode 100644 index 7cd44de7..00000000 --- a/c/os/bits-fcntl_linux_amd64.go +++ /dev/null @@ -1,24 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -const X__O_LARGEFILE = 0 - -// Not necessary, we always have 64-bit offsets. -const ( - F_GETLK64 = 5 - // Set record locking info (non-blocking). - F_SETLK64 = 6 - // Set record locking info (blocking). - F_SETLKW64 = 7 -) - -type FlockT struct { - LType int16 - LWhence int16 - LStart X__OffT - LLen X__OffT - LPid X__PidT -} diff --git a/c/os/bits-fcntl_linux_arm64.go b/c/os/bits-fcntl_linux_arm64.go deleted file mode 100644 index b08a0ab9..00000000 --- a/c/os/bits-fcntl_linux_arm64.go +++ /dev/null @@ -1,25 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -const ( - X__O_DIRECTORY = 16384 - X__O_NOFOLLOW = 32768 - X__O_DIRECT = 65536 -) -const X__O_LARGEFILE = 0 -const ( - F_GETLK64 = 5 - F_SETLK64 = 6 - F_SETLKW64 = 7 -) - -type FlockT struct { - LType int16 - LWhence int16 - LStart X__OffT - LLen X__OffT - LPid X__PidT -} diff --git a/c/os/bits-local_lim_linux_amd64.go b/c/os/bits-local_lim_linux_amd64.go deleted file mode 100644 index 990df2ad..00000000 --- a/c/os/bits-local_lim_linux_amd64.go +++ /dev/null @@ -1,45 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// The number of data keys per process. -const X_POSIX_THREAD_KEYS_MAX = 128 - -// This is the value this implementation supports. -const PTHREAD_KEYS_MAX = 1024 - -// Controlling the iterations of destructors for thread-specific data. -const X_POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4 - -// Number of iterations this implementation does. -const PTHREAD_DESTRUCTOR_ITERATIONS = 4 - -// The number of threads per process. -const X_POSIX_THREAD_THREADS_MAX = 64 - -// Maximum amount by which a process can descrease its asynchronous I/O -// priority level. -const AIO_PRIO_DELTA_MAX = 20 - -// Minimum size for a thread. We are free to choose a reasonable value. -const PTHREAD_STACK_MIN = 16384 - -// Maximum number of timer expiration overruns. -const DELAYTIMER_MAX = 2147483647 - -// Maximum tty name length. -const TTY_NAME_MAX = 32 - -// Maximum login name length. This is arbitrary. -const LOGIN_NAME_MAX = 256 - -// Maximum host name length. -const HOST_NAME_MAX = 64 - -// Maximum message queue priority level. -const MQ_PRIO_MAX = 32768 - -// Maximum value the semaphore can have. -const SEM_VALUE_MAX = 2147483647 diff --git a/c/os/bits-local_lim_linux_arm64.go b/c/os/bits-local_lim_linux_arm64.go deleted file mode 100644 index c545f5ae..00000000 --- a/c/os/bits-local_lim_linux_arm64.go +++ /dev/null @@ -1,46 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// The number of data keys per process. -const X_POSIX_THREAD_KEYS_MAX = 128 - -// This is the value this implementation supports. -const PTHREAD_KEYS_MAX = 1024 - -// Controlling the iterations of destructors for thread-specific data. -const X_POSIX_THREAD_DESTRUCTOR_ITERATIONS = 4 - -// Number of iterations this implementation does. -const PTHREAD_DESTRUCTOR_ITERATIONS = 4 - -// The number of threads per process. -const X_POSIX_THREAD_THREADS_MAX = 64 - -// Maximum amount by which a process can descrease its asynchronous I/O -// priority level. -const AIO_PRIO_DELTA_MAX = 20 - -// Minimum size for a thread. At least two pages for systems with 64k -// pages. -const PTHREAD_STACK_MIN = 131072 - -// Maximum number of timer expiration overruns. -const DELAYTIMER_MAX = 2147483647 - -// Maximum tty name length. -const TTY_NAME_MAX = 32 - -// Maximum login name length. This is arbitrary. -const LOGIN_NAME_MAX = 256 - -// Maximum host name length. -const HOST_NAME_MAX = 64 - -// Maximum message queue priority level. -const MQ_PRIO_MAX = 32768 - -// Maximum value the semaphore can have. -const SEM_VALUE_MAX = 2147483647 diff --git a/c/os/bits-mman-linux_linux_amd64.go b/c/os/bits-mman-linux_linux_amd64.go deleted file mode 100644 index a2587451..00000000 --- a/c/os/bits-mman-linux_linux_amd64.go +++ /dev/null @@ -1,118 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -const ( - // Page can be read. - PROT_READ = 1 - // Page can be written. - PROT_WRITE = 2 - // Page can be executed. - PROT_EXEC = 4 - // Page can not be accessed. - PROT_NONE = 0 - // Extend change to start of - // growsdown vma (mprotect only). - PROT_GROWSDOWN = 16777216 -) - -// Extend change to start of -// growsup vma (mprotect only). -const PROT_GROWSUP = 33554432 - -// Sharing types (must choose one and only one of these). -const ( - MAP_SHARED = 1 - // Changes are private. - MAP_PRIVATE = 2 -) - -// Mask for type of mapping. -const MAP_TYPE = 15 - -// Other flags. -const MAP_FIXED = 16 -const MAP_FILE = 0 - -// Don't use a file. -const MAP_ANONYMOUS = 32 - -// When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size. -const MAP_ANON = 32 - -// When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size. -const ( - MAP_HUGE_SHIFT = 26 - MAP_HUGE_MASK = 63 -) - -// Flags to `msync'. -const ( - MS_ASYNC = 1 - // Synchronous memory sync. - MS_SYNC = 4 - // Invalidate the caches. - MS_INVALIDATE = 2 -) -const ( - // No further special treatment. - MADV_NORMAL = 0 - // Expect random page references. - MADV_RANDOM = 1 - // Expect sequential page references. - MADV_SEQUENTIAL = 2 - // Will need these pages. - MADV_WILLNEED = 3 - // Don't need these pages. - MADV_DONTNEED = 4 - // Free pages only if memory pressure. - MADV_FREE = 8 - // Remove these pages and resources. - MADV_REMOVE = 9 - // Do not inherit across fork. - MADV_DONTFORK = 10 - // Do inherit across fork. - MADV_DOFORK = 11 - // KSM may merge identical pages. - MADV_MERGEABLE = 12 - // KSM may not merge identical pages. - MADV_UNMERGEABLE = 13 - // Worth backing with hugepages. - MADV_HUGEPAGE = 14 - // Not worth backing with hugepages. - MADV_NOHUGEPAGE = 15 - // Explicity exclude from the core dump, - // overrides the coredump filter bits. - MADV_DONTDUMP = 16 -) -const ( - // Clear the MADV_DONTDUMP flag. - MADV_DODUMP = 17 - // Poison a page for testing. - MADV_HWPOISON = 100 -) -const ( - // No further special treatment. - POSIX_MADV_NORMAL = 0 - // Expect random page references. - POSIX_MADV_RANDOM = 1 - // Expect sequential page references. - POSIX_MADV_SEQUENTIAL = 2 - // Will need these pages. - POSIX_MADV_WILLNEED = 3 - // Don't need these pages. - POSIX_MADV_DONTNEED = 4 -) -const ( - // Lock all currently mapped pages. - MCL_CURRENT = 1 - // Lock all additions to address - // space. - MCL_FUTURE = 2 -) - -// Lock all pages that are -// faulted in. -const MCL_ONFAULT = 4 diff --git a/c/os/bits-mman-linux_linux_arm64.go b/c/os/bits-mman-linux_linux_arm64.go deleted file mode 100644 index dc02fcd0..00000000 --- a/c/os/bits-mman-linux_linux_arm64.go +++ /dev/null @@ -1,118 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -const ( - // Page can be read. - PROT_READ = 1 - // Page can be written. - PROT_WRITE = 2 - // Page can be executed. - PROT_EXEC = 4 - // Page can not be accessed. - PROT_NONE = 0 - // Extend change to start of - // growsdown vma (mprotect only). - PROT_GROWSDOWN = 16777216 -) - -// Extend change to start of -// growsup vma (mprotect only). -const PROT_GROWSUP = 33554432 - -// Sharing types (must choose one and only one of these). -const ( - MAP_SHARED = 1 - // Changes are private. - MAP_PRIVATE = 2 -) - -// Mask for type of mapping. -const MAP_TYPE = 15 - -// Other flags. -const MAP_FIXED = 16 -const MAP_FILE = 0 - -// Don't use a file. -const MAP_ANONYMOUS = 32 - -// When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size. -const MAP_ANON = 32 - -// When MAP_HUGETLB is set bits [26:31] encode the log2 of the huge page size. -const ( - MAP_HUGE_SHIFT = 26 - MAP_HUGE_MASK = 63 -) - -// Flags to `msync'. -const ( - MS_ASYNC = 1 - // Synchronous memory sync. - MS_SYNC = 4 - // Invalidate the caches. - MS_INVALIDATE = 2 -) -const ( - // No further special treatment. - MADV_NORMAL = 0 - // Expect random page references. - MADV_RANDOM = 1 - // Expect sequential page references. - MADV_SEQUENTIAL = 2 - // Will need these pages. - MADV_WILLNEED = 3 - // Don't need these pages. - MADV_DONTNEED = 4 - // Free pages only if memory pressure. - MADV_FREE = 8 - // Remove these pages and resources. - MADV_REMOVE = 9 - // Do not inherit across fork. - MADV_DONTFORK = 10 - // Do inherit across fork. - MADV_DOFORK = 11 - // KSM may merge identical pages. - MADV_MERGEABLE = 12 - // KSM may not merge identical pages. - MADV_UNMERGEABLE = 13 - // Worth backing with hugepages. - MADV_HUGEPAGE = 14 - // Not worth backing with hugepages. - MADV_NOHUGEPAGE = 15 - // Explicity exclude from the core dump, - // overrides the coredump filter bits. - MADV_DONTDUMP = 16 -) -const ( - // Clear the MADV_DONTDUMP flag. - MADV_DODUMP = 17 - // Poison a page for testing. - MADV_HWPOISON = 100 -) -const ( - // No further special treatment. - POSIX_MADV_NORMAL = 0 - // Expect random page references. - POSIX_MADV_RANDOM = 1 - // Expect sequential page references. - POSIX_MADV_SEQUENTIAL = 2 - // Will need these pages. - POSIX_MADV_WILLNEED = 3 - // Don't need these pages. - POSIX_MADV_DONTNEED = 4 -) -const ( - // Lock all currently mapped pages. - MCL_CURRENT = 1 - // Lock all additions to address - // space. - MCL_FUTURE = 2 -) - -// Lock all pages that are -// faulted in. -const MCL_ONFAULT = 4 diff --git a/c/os/bits-mman_linux_amd64.go b/c/os/bits-mman_linux_amd64.go deleted file mode 100644 index b1f3b19f..00000000 --- a/c/os/bits-mman_linux_amd64.go +++ /dev/null @@ -1,28 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// Only give out 32-bit addresses. -const MAP_32BIT = 64 -const ( - // Stack-like segment. - MAP_GROWSDOWN = 256 - // ETXTBSY - MAP_DENYWRITE = 2048 - // Mark it as an executable. - MAP_EXECUTABLE = 4096 - // Lock the mapping. - MAP_LOCKED = 8192 - // Don't check for reservations. - MAP_NORESERVE = 16384 - // Populate (prefault) pagetables. - MAP_POPULATE = 32768 - // Do not block on IO. - MAP_NONBLOCK = 65536 - // Allocation is for a stack. - MAP_STACK = 131072 - // Create huge page mapping. - MAP_HUGETLB = 262144 -) diff --git a/c/os/bits-mman_linux_arm64.go b/c/os/bits-mman_linux_arm64.go deleted file mode 100644 index 82f6a884..00000000 --- a/c/os/bits-mman_linux_arm64.go +++ /dev/null @@ -1,26 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -const ( - // Stack-like segment. - MAP_GROWSDOWN = 256 - // ETXTBSY - MAP_DENYWRITE = 2048 - // Mark it as an executable. - MAP_EXECUTABLE = 4096 - // Lock the mapping. - MAP_LOCKED = 8192 - // Don't check for reservations. - MAP_NORESERVE = 16384 - // Populate (prefault) pagetables. - MAP_POPULATE = 32768 - // Do not block on IO. - MAP_NONBLOCK = 65536 - // Allocation is for a stack. - MAP_STACK = 131072 - // Create huge page mapping. - MAP_HUGETLB = 262144 -) diff --git a/c/os/bits-poll_linux_amd64.go b/c/os/bits-poll_linux_amd64.go deleted file mode 100644 index a34b6ef6..00000000 --- a/c/os/bits-poll_linux_amd64.go +++ /dev/null @@ -1,38 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// Event types that can be polled for. These bits may be set in `events' -// to indicate the interesting event types; they will appear in `revents' -// to indicate the status of the file descriptor. -const ( - POLLIN = 1 - // There is urgent data to read. - POLLPRI = 2 - // Writing now will not block. - POLLOUT = 4 -) - -// These values are defined in XPG4.2. -const ( - POLLRDNORM = 64 - // Priority data may be read. - POLLRDBAND = 128 - // Writing now will not block. - POLLWRNORM = 256 - // Priority data may be written. - POLLWRBAND = 512 -) - -// Event types always implicitly polled for. These bits need not be set in -// `events', but they will appear in `revents' to indicate the status of -// the file descriptor. -const ( - POLLERR = 8 - // Hung up. - POLLHUP = 16 - // Invalid polling request. - POLLNVAL = 32 -) diff --git a/c/os/bits-poll_linux_arm64.go b/c/os/bits-poll_linux_arm64.go deleted file mode 100644 index 41ff312c..00000000 --- a/c/os/bits-poll_linux_arm64.go +++ /dev/null @@ -1,38 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// Event types that can be polled for. These bits may be set in `events' -// to indicate the interesting event types; they will appear in `revents' -// to indicate the status of the file descriptor. -const ( - POLLIN = 1 - // There is urgent data to read. - POLLPRI = 2 - // Writing now will not block. - POLLOUT = 4 -) - -// These values are defined in XPG4.2. -const ( - POLLRDNORM = 64 - // Priority data may be read. - POLLRDBAND = 128 - // Writing now will not block. - POLLWRNORM = 256 - // Priority data may be written. - POLLWRBAND = 512 -) - -// Event types always implicitly polled for. These bits need not be set in -// `events', but they will appear in `revents' to indicate the status of -// the file descriptor. -const ( - POLLERR = 8 - // Hung up. - POLLHUP = 16 - // Invalid polling request. - POLLNVAL = 32 -) diff --git a/c/os/bits-posix_opt_linux_amd64.go b/c/os/bits-posix_opt_linux_amd64.go deleted file mode 100644 index ddf3add9..00000000 --- a/c/os/bits-posix_opt_linux_amd64.go +++ /dev/null @@ -1,84 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -const X_BITS_POSIX_OPT_H = 1 - -// Job control is supported. -const X_POSIX_JOB_CONTROL = 1 - -// Processes have a saved set-user-ID and a saved set-group-ID. -const X_POSIX_SAVED_IDS = 1 - -// Some filesystems allow all users to change file ownership. -const X_POSIX_CHOWN_RESTRICTED = 0 - -// Filenames are not silently truncated. -const X_POSIX_NO_TRUNC = 1 - -// X/Open realtime support is available. -const X_XOPEN_REALTIME = 1 - -// X/Open thread realtime support is available. -const X_XOPEN_REALTIME_THREADS = 1 - -// XPG4.2 shared memory is supported. -const X_XOPEN_SHM = 1 - -// We have the reentrant functions described in POSIX. -const X_POSIX_REENTRANT_FUNCTIONS = 1 - -// We do not support priority protection for robust mutexes. -const X_POSIX_THREAD_ROBUST_PRIO_PROTECT = -1 - -// We support asynchronous I/O. -const -// Alternative name for Unix98. -X_POSIX_ASYNC_IO = 1 - -// Alternative name for Unix98. -const X_LFS_ASYNCHRONOUS_IO = 1 - -// The LFS support in asynchronous I/O is also available. -const X_LFS64_ASYNCHRONOUS_IO = 1 - -// The rest of the LFS is also available. -const ( - X_LFS_LARGEFILE = 1 - X_LFS64_LARGEFILE = 1 - X_LFS64_STDIO = 1 -) - -// CPU-time clocks support needs to be checked at runtime. -const X_POSIX_CPUTIME = 0 - -// Clock support in threads must be also checked at runtime. -const X_POSIX_THREAD_CPUTIME = 0 - -// GNU libc provides regular expression handling. -const X_POSIX_REGEXP = 1 - -// We have a POSIX shell. -const X_POSIX_SHELL = 1 - -// The monotonic clock might be available. -const X_POSIX_MONOTONIC_CLOCK = 0 - -// Neither process nor thread sporadic server interfaces is available. -const ( - X_POSIX_SPORADIC_SERVER = -1 - X_POSIX_THREAD_SPORADIC_SERVER = -1 -) - -// trace.h is not available. -const ( - X_POSIX_TRACE = -1 - X_POSIX_TRACE_EVENT_FILTER = -1 - X_POSIX_TRACE_INHERIT = -1 - X_POSIX_TRACE_LOG = -1 -) - -// Typed memory objects are not available. -const X_POSIX_TYPED_MEMORY_OBJECTS = -1 diff --git a/c/os/bits-posix_opt_linux_arm64.go b/c/os/bits-posix_opt_linux_arm64.go deleted file mode 100644 index 23d086cd..00000000 --- a/c/os/bits-posix_opt_linux_arm64.go +++ /dev/null @@ -1,84 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -const X_BITS_POSIX_OPT_H = 1 - -// Job control is supported. -const X_POSIX_JOB_CONTROL = 1 - -// Processes have a saved set-user-ID and a saved set-group-ID. -const X_POSIX_SAVED_IDS = 1 - -// Some filesystems allow all users to change file ownership. -const X_POSIX_CHOWN_RESTRICTED = 0 - -// Filenames are not silently truncated. -const X_POSIX_NO_TRUNC = 1 - -// X/Open realtime support is available. -const X_XOPEN_REALTIME = 1 - -// X/Open thread realtime support is available. -const X_XOPEN_REALTIME_THREADS = 1 - -// XPG4.2 shared memory is supported. -const X_XOPEN_SHM = 1 - -// We have the reentrant functions described in POSIX. -const X_POSIX_REENTRANT_FUNCTIONS = 1 - -// We do not support priority protection for robust mutexes. -const X_POSIX_THREAD_ROBUST_PRIO_PROTECT = -1 - -// We support asynchronous I/O. -const -// Alternative name for Unix98. -X_POSIX_ASYNC_IO = 1 - -// Alternative name for Unix98. -const X_LFS_ASYNCHRONOUS_IO = 1 - -// The LFS support in asynchronous I/O is also available. -const X_LFS64_ASYNCHRONOUS_IO = 1 - -// The rest of the LFS is also available. -const ( - X_LFS_LARGEFILE = 1 - X_LFS64_LARGEFILE = 1 - X_LFS64_STDIO = 1 -) - -// CPU-time clocks support needs to be checked at runtime. -const X_POSIX_CPUTIME = 0 - -// Clock support in threads must be also checked at runtime. -const X_POSIX_THREAD_CPUTIME = 0 - -// GNU libc provides regular expression handling. -const X_POSIX_REGEXP = 1 - -// We have a POSIX shell. -const X_POSIX_SHELL = 1 - -// The monotonic clock might be available. -const X_POSIX_MONOTONIC_CLOCK = 0 - -// Neither process nor thread sporadic server interfaces is available. -const ( - X_POSIX_SPORADIC_SERVER = -1 - X_POSIX_THREAD_SPORADIC_SERVER = -1 -) - -// trace.h is not available. -const ( - X_POSIX_TRACE = -1 - X_POSIX_TRACE_EVENT_FILTER = -1 - X_POSIX_TRACE_INHERIT = -1 - X_POSIX_TRACE_LOG = -1 -) - -// Typed memory objects are not available. -const X_POSIX_TYPED_MEMORY_OBJECTS = -1 diff --git a/c/os/bits-resource_linux_amd64.go b/c/os/bits-resource_linux_amd64.go deleted file mode 100644 index 1ee0f6cc..00000000 --- a/c/os/bits-resource_linux_amd64.go +++ /dev/null @@ -1,245 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/lib/c/sys" - "unsafe" -) - -// Priority limits. -const ( - PRIO_MIN = -20 - // Maximum priority a process can have. - PRIO_MAX = 20 -) - -// Kinds of resource limit. -type X__RlimitResource c.Uint - -const ( - // Per-process CPU limit, in seconds. - RLIMIT_CPU X__RlimitResource = 0 - // Largest file that can be created, in bytes. - RLIMIT_FSIZE X__RlimitResource = 1 - // Maximum size of data segment, in bytes. - RLIMIT_DATA X__RlimitResource = 2 - // Maximum size of stack segment, in bytes. - RLIMIT_STACK X__RlimitResource = 3 - // Largest core file that can be created, in bytes. - RLIMIT_CORE X__RlimitResource = 4 - // Largest resident set size, in bytes. - // This affects swapping; processes that are exceeding their - // resident set size will be more likely to have physical memory - // taken from them. - X__RLIMIT_RSS X__RlimitResource = 5 - // Number of open files. - RLIMIT_NOFILE X__RlimitResource = 7 - X__RLIMIT_OFILE X__RlimitResource = 7 - // Address space limit. - RLIMIT_AS X__RlimitResource = 9 - // Number of processes. - X__RLIMIT_NPROC X__RlimitResource = 6 - // Locked-in-memory address space. - X__RLIMIT_MEMLOCK X__RlimitResource = 8 - // Maximum number of file locks. - X__RLIMIT_LOCKS X__RlimitResource = 10 - // Maximum number of pending signals. - X__RLIMIT_SIGPENDING X__RlimitResource = 11 - // Maximum bytes in POSIX message queues. - X__RLIMIT_MSGQUEUE X__RlimitResource = 12 - // Maximum nice priority allowed to raise to. - // Nice levels 19 .. -20 correspond to 0 .. 39 - // values of this resource limit. - X__RLIMIT_NICE X__RlimitResource = 13 - // Maximum realtime priority allowed for non-priviledged - // processes. - X__RLIMIT_RTPRIO X__RlimitResource = 14 - // Maximum CPU time in µs that a process scheduled under a real-time - // scheduling policy may consume without making a blocking system - // call before being forcibly descheduled. - X__RLIMIT_RTTIME X__RlimitResource = 15 - X__RLIMIT_NLIMITS X__RlimitResource = 16 - X__RLIM_NLIMITS X__RlimitResource = 16 -) - -type Rlimit struct { - RlimCur RlimT - RlimMax RlimT -} - -// Whose usage statistics do you want? -type X__RusageWho c.Int - -const ( - // The calling process. - RUSAGE_SELF X__RusageWho = 0 - // All of its terminated child processes. - RUSAGE_CHILDREN X__RusageWho = -1 -) - -// The purpose of all the unions is to have the kernel-compatible layout -// while keeping the API type as 'long int', and among machines where -// __syscall_slong_t is not 'long int', this only does the right thing -// for little-endian ones, like x32. -type Rusage struct { - RuUtime sys.Timeval - RuStime sys.Timeval - _llcppg_anon_0 - _llcppg_anon_1 - _llcppg_anon_2 - _llcppg_anon_3 - _llcppg_anon_4 - _llcppg_anon_5 - _llcppg_anon_6 - _llcppg_anon_7 - _llcppg_anon_8 - _llcppg_anon_9 - _llcppg_anon_10 - _llcppg_anon_11 - _llcppg_anon_12 - _llcppg_anon_13 -} - -// The type of the WHICH argument to `getpriority' and `setpriority', -// indicating what flavor of entity the WHO argument specifies. -type X__PriorityWhich c.Uint - -const ( - PRIO_PROCESS X__PriorityWhich = 0 - PRIO_PGRP X__PriorityWhich = 1 - // WHO is a user ID. - PRIO_USER X__PriorityWhich = 2 -) - -type RlimT = X__RlimT -type _llcppg_anon_0 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_1 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_2 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_3 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_4 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_5 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_6 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_7 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_8 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_9 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_10 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_11 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_12 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_13 struct { - _xgo_union [1]uint64 -} - -func (p *_llcppg_anon_0) XGof_ref_ru_maxrss() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_0) XGof_ref___ru_maxrss_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_1) XGof_ref_ru_ixrss() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_1) XGof_ref___ru_ixrss_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_2) XGof_ref_ru_idrss() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_2) XGof_ref___ru_idrss_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ru_isrss() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref___ru_isrss_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_4) XGof_ref_ru_minflt() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_4) XGof_ref___ru_minflt_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_5) XGof_ref_ru_majflt() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_5) XGof_ref___ru_majflt_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_6) XGof_ref_ru_nswap() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_6) XGof_ref___ru_nswap_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_7) XGof_ref_ru_inblock() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_7) XGof_ref___ru_inblock_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_8) XGof_ref_ru_oublock() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_8) XGof_ref___ru_oublock_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_9) XGof_ref_ru_msgsnd() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_9) XGof_ref___ru_msgsnd_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_10) XGof_ref_ru_msgrcv() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_10) XGof_ref___ru_msgrcv_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_11) XGof_ref_ru_nsignals() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_11) XGof_ref___ru_nsignals_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_12) XGof_ref_ru_nvcsw() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_12) XGof_ref___ru_nvcsw_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_13) XGof_ref_ru_nivcsw() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_13) XGof_ref___ru_nivcsw_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} diff --git a/c/os/bits-resource_linux_arm64.go b/c/os/bits-resource_linux_arm64.go deleted file mode 100644 index ab6038a1..00000000 --- a/c/os/bits-resource_linux_arm64.go +++ /dev/null @@ -1,245 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/lib/c/sys" - "unsafe" -) - -// Priority limits. -const ( - PRIO_MIN = -20 - // Maximum priority a process can have. - PRIO_MAX = 20 -) - -// Kinds of resource limit. -type X__RlimitResource c.Uint - -const ( - // Per-process CPU limit, in seconds. - RLIMIT_CPU X__RlimitResource = 0 - // Largest file that can be created, in bytes. - RLIMIT_FSIZE X__RlimitResource = 1 - // Maximum size of data segment, in bytes. - RLIMIT_DATA X__RlimitResource = 2 - // Maximum size of stack segment, in bytes. - RLIMIT_STACK X__RlimitResource = 3 - // Largest core file that can be created, in bytes. - RLIMIT_CORE X__RlimitResource = 4 - // Largest resident set size, in bytes. - // This affects swapping; processes that are exceeding their - // resident set size will be more likely to have physical memory - // taken from them. - X__RLIMIT_RSS X__RlimitResource = 5 - // Number of open files. - RLIMIT_NOFILE X__RlimitResource = 7 - X__RLIMIT_OFILE X__RlimitResource = 7 - // Address space limit. - RLIMIT_AS X__RlimitResource = 9 - // Number of processes. - X__RLIMIT_NPROC X__RlimitResource = 6 - // Locked-in-memory address space. - X__RLIMIT_MEMLOCK X__RlimitResource = 8 - // Maximum number of file locks. - X__RLIMIT_LOCKS X__RlimitResource = 10 - // Maximum number of pending signals. - X__RLIMIT_SIGPENDING X__RlimitResource = 11 - // Maximum bytes in POSIX message queues. - X__RLIMIT_MSGQUEUE X__RlimitResource = 12 - // Maximum nice priority allowed to raise to. - // Nice levels 19 .. -20 correspond to 0 .. 39 - // values of this resource limit. - X__RLIMIT_NICE X__RlimitResource = 13 - // Maximum realtime priority allowed for non-priviledged - // processes. - X__RLIMIT_RTPRIO X__RlimitResource = 14 - // Maximum CPU time in µs that a process scheduled under a real-time - // scheduling policy may consume without making a blocking system - // call before being forcibly descheduled. - X__RLIMIT_RTTIME X__RlimitResource = 15 - X__RLIMIT_NLIMITS X__RlimitResource = 16 - X__RLIM_NLIMITS X__RlimitResource = 16 -) - -type Rlimit struct { - RlimCur RlimT - RlimMax RlimT -} - -// Whose usage statistics do you want? -type X__RusageWho c.Int - -const ( - // The calling process. - RUSAGE_SELF X__RusageWho = 0 - // All of its terminated child processes. - RUSAGE_CHILDREN X__RusageWho = -1 -) - -// The purpose of all the unions is to have the kernel-compatible layout -// while keeping the API type as 'long int', and among machines where -// __syscall_slong_t is not 'long int', this only does the right thing -// for little-endian ones, like x32. -type Rusage struct { - RuUtime sys.Timeval - RuStime sys.Timeval - _llcppg_anon_0 - _llcppg_anon_1 - _llcppg_anon_2 - _llcppg_anon_3 - _llcppg_anon_4 - _llcppg_anon_5 - _llcppg_anon_6 - _llcppg_anon_7 - _llcppg_anon_8 - _llcppg_anon_9 - _llcppg_anon_10 - _llcppg_anon_11 - _llcppg_anon_12 - _llcppg_anon_13 -} - -// The type of the WHICH argument to `getpriority' and `setpriority', -// indicating what flavor of entity the WHO argument specifies. -type X__PriorityWhich c.Uint - -const ( - PRIO_PROCESS X__PriorityWhich = 0 - PRIO_PGRP X__PriorityWhich = 1 - // WHO is a user ID. - PRIO_USER X__PriorityWhich = 2 -) - -type RlimT = X__RlimT -type _llcppg_anon_0 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_1 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_2 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_3 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_4 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_5 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_6 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_7 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_8 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_9 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_10 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_11 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_12 struct { - _xgo_union [1]uint64 -} -type _llcppg_anon_13 struct { - _xgo_union [1]uint64 -} - -func (p *_llcppg_anon_0) XGof_ref_ru_maxrss() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_0) XGof_ref___ru_maxrss_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_1) XGof_ref_ru_ixrss() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_1) XGof_ref___ru_ixrss_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_2) XGof_ref_ru_idrss() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_2) XGof_ref___ru_idrss_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref_ru_isrss() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_3) XGof_ref___ru_isrss_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_4) XGof_ref_ru_minflt() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_4) XGof_ref___ru_minflt_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_5) XGof_ref_ru_majflt() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_5) XGof_ref___ru_majflt_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_6) XGof_ref_ru_nswap() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_6) XGof_ref___ru_nswap_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_7) XGof_ref_ru_inblock() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_7) XGof_ref___ru_inblock_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_8) XGof_ref_ru_oublock() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_8) XGof_ref___ru_oublock_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_9) XGof_ref_ru_msgsnd() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_9) XGof_ref___ru_msgsnd_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_10) XGof_ref_ru_msgrcv() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_10) XGof_ref___ru_msgrcv_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_11) XGof_ref_ru_nsignals() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_11) XGof_ref___ru_nsignals_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_12) XGof_ref_ru_nvcsw() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_12) XGof_ref___ru_nvcsw_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_13) XGof_ref_ru_nivcsw() *c.Long { - return (*c.Long)(unsafe.Pointer(p)) -} -func (p *_llcppg_anon_13) XGof_ref___ru_nivcsw_word() *X__SyscallSlongT { - return (*X__SyscallSlongT)(unsafe.Pointer(p)) -} diff --git a/c/os/bits-sched_linux_amd64.go b/c/os/bits-sched_linux_amd64.go deleted file mode 100644 index 79385eb6..00000000 --- a/c/os/bits-sched_linux_amd64.go +++ /dev/null @@ -1,51 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -// Scheduling algorithms. -const ( - SCHED_OTHER = 0 - SCHED_FIFO = 1 - SCHED_RR = 2 -) - -// Data structure to describe a process' schedulability. -const X__DefinedSchedparam = 1 - -// Size definition for CPU sets. -const X__CPU_SETSIZE = 1024 - -// The official definition. -type SchedParam struct { - X__SchedPriority c.Int -} - -// Data structure to describe a process' schedulability. -type X__SchedParam struct { - X__SchedPriority c.Int -} - -// Data structure to describe CPU mask. -type CpuSetT struct { - X__Bits [16]X__CpuMask -} - -// Type for array elements in 'cpu_set_t'. -type X__CpuMask = c.Ulong - -//go:linkname X__SchedCpucount C.__sched_cpucount -func X__SchedCpucount(__setsize SizeT, __setp *CpuSetT) c.Int - -//go:linkname X__SchedCpualloc C.__sched_cpualloc -func X__SchedCpualloc(__count SizeT) *CpuSetT - -// llgo:link (*CpuSetT).X__SchedCpufree C.__sched_cpufree -func (self *CpuSetT) X__SchedCpufree() { -} diff --git a/c/os/bits-sched_linux_arm64.go b/c/os/bits-sched_linux_arm64.go deleted file mode 100644 index 163aff39..00000000 --- a/c/os/bits-sched_linux_arm64.go +++ /dev/null @@ -1,51 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -// Scheduling algorithms. -const ( - SCHED_OTHER = 0 - SCHED_FIFO = 1 - SCHED_RR = 2 -) - -// Data structure to describe a process' schedulability. -const X__DefinedSchedparam = 1 - -// Size definition for CPU sets. -const X__CPU_SETSIZE = 1024 - -// The official definition. -type SchedParam struct { - X__SchedPriority c.Int -} - -// Data structure to describe a process' schedulability. -type X__SchedParam struct { - X__SchedPriority c.Int -} - -// Data structure to describe CPU mask. -type CpuSetT struct { - X__Bits [16]X__CpuMask -} - -// Type for array elements in 'cpu_set_t'. -type X__CpuMask = c.Ulong - -//go:linkname X__SchedCpucount C.__sched_cpucount -func X__SchedCpucount(__setsize SizeT, __setp *CpuSetT) c.Int - -//go:linkname X__SchedCpualloc C.__sched_cpualloc -func X__SchedCpualloc(__count SizeT) *CpuSetT - -// llgo:link (*CpuSetT).X__SchedCpufree C.__sched_cpufree -func (self *CpuSetT) X__SchedCpufree() { -} diff --git a/c/os/bits-stat_linux_amd64.go b/c/os/bits-stat_linux_amd64.go deleted file mode 100644 index 45b4ae5f..00000000 --- a/c/os/bits-stat_linux_amd64.go +++ /dev/null @@ -1,51 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import () - -const X_BITS_STAT_H = 1 -const ( - X_STAT_VER_KERNEL = 0 - X_STAT_VER_LINUX = 1 -) - -// x86-64 versions of the `xmknod' interface. -const X_MKNOD_VER_LINUX = 0 -const X_STAT_VER = 1 - -// These bits determine file type. -const X__S_IFMT = 61440 - -// File types. -const ( - X__S_IFDIR = 16384 - // Character device. - X__S_IFCHR = 8192 - // Block device. - X__S_IFBLK = 24576 - // Regular file. - X__S_IFREG = 32768 - // FIFO. - X__S_IFIFO = 4096 - // Symbolic link. - X__S_IFLNK = 40960 - // Socket. - X__S_IFSOCK = 49152 -) -const ( - // Set user ID on execution. - X__S_ISUID = 2048 - // Set group ID on execution. - X__S_ISGID = 1024 - // Save swapped text after use (sticky). - X__S_ISVTX = 512 - // Read by owner. - X__S_IREAD = 256 - // Write by owner. - X__S_IWRITE = 128 - // Execute by owner. - X__S_IEXEC = 64 -) diff --git a/c/os/bits-stat_linux_arm64.go b/c/os/bits-stat_linux_arm64.go deleted file mode 100644 index aa2972bd..00000000 --- a/c/os/bits-stat_linux_arm64.go +++ /dev/null @@ -1,59 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import () - -const X_BITS_STAT_H = 1 - -// 64-bit libc uses the kernel's 'struct stat', accessed via the -// stat() syscall; 32-bit libc uses the kernel's 'struct stat64' -// and accesses it via the stat64() syscall. All the various -// APIs offered by libc use the kernel shape for their struct stat -// structure; the only difference is that 32-bit programs not -// using __USE_FILE_OFFSET64 only see the low 32 bits of some -// of the fields (specifically st_ino, st_size, and st_blocks). -const ( - X_STAT_VER_KERNEL = 0 - X_STAT_VER_LINUX = 0 - X_STAT_VER = 0 -) - -// Versions of the `xmknod' interface. -const X_MKNOD_VER_LINUX = 0 - -// These bits determine file type. -const X__S_IFMT = 61440 - -// File types. -const ( - X__S_IFDIR = 16384 - // Character device. - X__S_IFCHR = 8192 - // Block device. - X__S_IFBLK = 24576 - // Regular file. - X__S_IFREG = 32768 - // FIFO. - X__S_IFIFO = 4096 - // Symbolic link. - X__S_IFLNK = 40960 - // Socket. - X__S_IFSOCK = 49152 -) -const ( - // Set user ID on execution. - X__S_ISUID = 2048 - // Set group ID on execution. - X__S_ISGID = 1024 - // Save swapped text after use (sticky). - X__S_ISVTX = 512 - // Read by owner. - X__S_IREAD = 256 - // Write by owner. - X__S_IWRITE = 128 - // Execute by owner. - X__S_IEXEC = 64 -) diff --git a/c/os/bits-statvfs_linux_amd64.go b/c/os/bits-statvfs_linux_amd64.go deleted file mode 100644 index 66697a49..00000000 --- a/c/os/bits-statvfs_linux_amd64.go +++ /dev/null @@ -1,30 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -type Statvfs struct { - FBsize c.Ulong - FFrsize c.Ulong - FBlocks X__FsblkcntT - FBfree X__FsblkcntT - FBavail X__FsblkcntT - FFiles X__FsfilcntT - FFfree X__FsfilcntT - FFavail X__FsfilcntT - FFsid c.Ulong - FFlag c.Ulong - FNamemax c.Ulong - X__FSpare [6]c.Int -} - -// Definitions for the flag in `f_flag'. These definitions should be -// kept in sync with the definitions in . -const ( - ST_RDONLY = 1 - // Ignore suid and sgid bits. - ST_NOSUID = 2 -) diff --git a/c/os/bits-statvfs_linux_arm64.go b/c/os/bits-statvfs_linux_arm64.go deleted file mode 100644 index 2273b007..00000000 --- a/c/os/bits-statvfs_linux_arm64.go +++ /dev/null @@ -1,30 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -type Statvfs struct { - FBsize c.Ulong - FFrsize c.Ulong - FBlocks X__FsblkcntT - FBfree X__FsblkcntT - FBavail X__FsblkcntT - FFiles X__FsfilcntT - FFfree X__FsfilcntT - FFavail X__FsfilcntT - FFsid c.Ulong - FFlag c.Ulong - FNamemax c.Ulong - X__FSpare [6]c.Int -} - -// Definitions for the flag in `f_flag'. These definitions should be -// kept in sync with the definitions in . -const ( - ST_RDONLY = 1 - // Ignore suid and sgid bits. - ST_NOSUID = 2 -) diff --git a/c/os/bits-termios_linux_amd64.go b/c/os/bits-termios_linux_amd64.go deleted file mode 100644 index 0525bc2b..00000000 --- a/c/os/bits-termios_linux_amd64.go +++ /dev/null @@ -1,216 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -const NCCS = 32 -const ( - X_HAVE_STRUCT_TERMIOS_C_ISPEED = 1 - X_HAVE_STRUCT_TERMIOS_C_OSPEED = 1 -) - -// c_cc characters -const ( - VINTR = 0 - VQUIT = 1 - VERASE = 2 - VKILL = 3 - VEOF = 4 - VTIME = 5 - VMIN = 6 - VSWTC = 7 - VSTART = 8 - VSTOP = 9 - VSUSP = 10 - VEOL = 11 - VREPRINT = 12 - VDISCARD = 13 - VWERASE = 14 - VLNEXT = 15 - VEOL2 = 16 -) - -// c_iflag bits -const ( - IGNBRK = 1 - BRKINT = 2 - IGNPAR = 4 - PARMRK = 8 - INPCK = 16 - ISTRIP = 32 - INLCR = 64 - IGNCR = 128 - ICRNL = 256 - IUCLC = 512 - IXON = 1024 - IXANY = 2048 - IXOFF = 4096 - IMAXBEL = 8192 - IUTF8 = 16384 -) - -// c_oflag bits -const ( - OPOST = 1 - OLCUC = 2 - ONLCR = 4 - OCRNL = 8 - ONOCR = 16 - ONLRET = 32 - OFILL = 64 - OFDEL = 128 -) -const ( - NLDLY = 256 - NL0 = 0 - NL1 = 256 - CRDLY = 1536 - CR0 = 0 - CR1 = 512 - CR2 = 1024 - CR3 = 1536 - TABDLY = 6144 - TAB0 = 0 - TAB1 = 2048 - TAB2 = 4096 - TAB3 = 6144 - BSDLY = 8192 - BS0 = 0 - BS1 = 8192 - FFDLY = 32768 - FF0 = 0 - FF1 = 32768 -) -const ( - VTDLY = 16384 - VT0 = 0 - VT1 = 16384 -) -const XTABS = 6144 -const CBAUD = 4111 -const ( - // hang up - B0 = 0 - B50 = 1 - B75 = 2 - B110 = 3 - B134 = 4 - B150 = 5 - B200 = 6 - B300 = 7 - B600 = 8 - B1200 = 9 - B1800 = 10 - B2400 = 11 - B4800 = 12 - B9600 = 13 - B19200 = 14 - B38400 = 15 -) -const ( - EXTA = 14 - EXTB = 15 -) -const ( - CSIZE = 48 - CS5 = 0 - CS6 = 16 - CS7 = 32 - CS8 = 48 - CSTOPB = 64 - CREAD = 128 - PARENB = 256 - PARODD = 512 - HUPCL = 1024 - CLOCAL = 2048 -) -const CBAUDEX = 4096 -const ( - B57600 = 4097 - B115200 = 4098 - B230400 = 4099 - B460800 = 4100 - B500000 = 4101 - B576000 = 4102 - B921600 = 4103 - B1000000 = 4104 - B1152000 = 4105 - B1500000 = 4106 - B2000000 = 4107 - B2500000 = 4108 - B3000000 = 4109 - B3500000 = 4110 - B4000000 = 4111 - X__MAX_BAUD = 4111 -) -const ( - // input baud rate (not used) - CIBAUD = 269418496 - // mark or space (stick) parity - CMSPAR = 1073741824 - // flow control - CRTSCTS = 2147483648 -) - -// c_lflag bits -const ( - ISIG = 1 - ICANON = 2 -) -const XCASE = 4 -const ( - ECHO = 8 - ECHOE = 16 - ECHOK = 32 - ECHONL = 64 - NOFLSH = 128 - TOSTOP = 256 -) -const ( - ECHOCTL = 512 - ECHOPRT = 1024 - ECHOKE = 2048 - FLUSHO = 4096 - PENDIN = 16384 -) -const IEXTEN = 32768 -const EXTPROC = 65536 - -// tcflow() and TCXONC use these -const ( - TCOOFF = 0 - TCOON = 1 - TCIOFF = 2 - TCION = 3 -) - -// tcflush() and TCFLSH use these -const ( - TCIFLUSH = 0 - TCOFLUSH = 1 - TCIOFLUSH = 2 -) - -// tcsetattr uses these -const ( - TCSANOW = 0 - TCSADRAIN = 1 - TCSAFLUSH = 2 -) - -type Termios struct { - CIflag TcflagT - COflag TcflagT - CCflag TcflagT - CLflag TcflagT - CLine CcT - CCc [32]CcT - CIspeed SpeedT - COspeed SpeedT -} -type CcT = uint8 -type SpeedT = c.Uint -type TcflagT = c.Uint diff --git a/c/os/bits-termios_linux_arm64.go b/c/os/bits-termios_linux_arm64.go deleted file mode 100644 index 46ceb556..00000000 --- a/c/os/bits-termios_linux_arm64.go +++ /dev/null @@ -1,216 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -const NCCS = 32 -const ( - X_HAVE_STRUCT_TERMIOS_C_ISPEED = 1 - X_HAVE_STRUCT_TERMIOS_C_OSPEED = 1 -) - -// c_cc characters -const ( - VINTR = 0 - VQUIT = 1 - VERASE = 2 - VKILL = 3 - VEOF = 4 - VTIME = 5 - VMIN = 6 - VSWTC = 7 - VSTART = 8 - VSTOP = 9 - VSUSP = 10 - VEOL = 11 - VREPRINT = 12 - VDISCARD = 13 - VWERASE = 14 - VLNEXT = 15 - VEOL2 = 16 -) - -// c_iflag bits -const ( - IGNBRK = 1 - BRKINT = 2 - IGNPAR = 4 - PARMRK = 8 - INPCK = 16 - ISTRIP = 32 - INLCR = 64 - IGNCR = 128 - ICRNL = 256 - IUCLC = 512 - IXON = 1024 - IXANY = 2048 - IXOFF = 4096 - IMAXBEL = 8192 - IUTF8 = 16384 -) - -// c_oflag bits -const ( - OPOST = 1 - OLCUC = 2 - ONLCR = 4 - OCRNL = 8 - ONOCR = 16 - ONLRET = 32 - OFILL = 64 - OFDEL = 128 -) -const ( - NLDLY = 256 - NL0 = 0 - NL1 = 256 - CRDLY = 1536 - CR0 = 0 - CR1 = 512 - CR2 = 1024 - CR3 = 1536 - TABDLY = 6144 - TAB0 = 0 - TAB1 = 2048 - TAB2 = 4096 - TAB3 = 6144 - BSDLY = 8192 - BS0 = 0 - BS1 = 8192 - FFDLY = 32768 - FF0 = 0 - FF1 = 32768 -) -const ( - VTDLY = 16384 - VT0 = 0 - VT1 = 16384 -) -const XTABS = 6144 -const CBAUD = 4111 -const ( - // hang up - B0 = 0 - B50 = 1 - B75 = 2 - B110 = 3 - B134 = 4 - B150 = 5 - B200 = 6 - B300 = 7 - B600 = 8 - B1200 = 9 - B1800 = 10 - B2400 = 11 - B4800 = 12 - B9600 = 13 - B19200 = 14 - B38400 = 15 -) -const ( - EXTA = 14 - EXTB = 15 -) -const ( - CSIZE = 48 - CS5 = 0 - CS6 = 16 - CS7 = 32 - CS8 = 48 - CSTOPB = 64 - CREAD = 128 - PARENB = 256 - PARODD = 512 - HUPCL = 1024 - CLOCAL = 2048 -) -const CBAUDEX = 4096 -const ( - B57600 = 4097 - B115200 = 4098 - B230400 = 4099 - B460800 = 4100 - B500000 = 4101 - B576000 = 4102 - B921600 = 4103 - B1000000 = 4104 - B1152000 = 4105 - B1500000 = 4106 - B2000000 = 4107 - B2500000 = 4108 - B3000000 = 4109 - B3500000 = 4110 - B4000000 = 4111 - X__MAX_BAUD = 4111 -) -const ( - // input baud rate (not used) - CIBAUD = 269418496 - // mark or space (stick) parity - CMSPAR = 1073741824 - // flow control - CRTSCTS = 2147483648 -) - -// c_lflag bits -const ( - ISIG = 1 - ICANON = 2 -) -const XCASE = 4 -const ( - ECHO = 8 - ECHOE = 16 - ECHOK = 32 - ECHONL = 64 - NOFLSH = 128 - TOSTOP = 256 -) -const ( - ECHOCTL = 512 - ECHOPRT = 1024 - ECHOKE = 2048 - FLUSHO = 4096 - PENDIN = 16384 -) -const IEXTEN = 32768 -const EXTPROC = 65536 - -// tcflow() and TCXONC use these -const ( - TCOOFF = 0 - TCOON = 1 - TCIOFF = 2 - TCION = 3 -) - -// tcflush() and TCFLSH use these -const ( - TCIFLUSH = 0 - TCOFLUSH = 1 - TCIOFLUSH = 2 -) - -// tcsetattr uses these -const ( - TCSANOW = 0 - TCSADRAIN = 1 - TCSAFLUSH = 2 -) - -type Termios struct { - CIflag TcflagT - COflag TcflagT - CCflag TcflagT - CLflag TcflagT - CLine CcT - CCc [32]CcT - CIspeed SpeedT - COspeed SpeedT -} -type CcT = uint8 -type SpeedT = c.Uint -type TcflagT = c.Uint diff --git a/c/os/bits-types_linux_amd64.go b/c/os/bits-types_linux_amd64.go deleted file mode 100644 index 9513a156..00000000 --- a/c/os/bits-types_linux_amd64.go +++ /dev/null @@ -1,133 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -const X_BITS_TYPES_H = 1 - -type X__FsidT struct { - X__Val [2]c.Int -} - -// Convenience types. -type X__UChar = uint8 -type X__UShort = uint16 -type X__UInt = c.Uint -type X__ULong = c.Ulong - -// Fixed-size types, underlying types depend on word size and compiler. -type X__Int8T = int8 -type X__Uint8T = uint8 -type X__Int16T = int16 -type X__Uint16T = uint16 -type X__Int32T = c.Int -type X__Uint32T = c.Uint -type X__Int64T = c.Long -type X__Uint64T = c.Ulong -type X__QuadT = c.Long -type X__UQuadT = c.Ulong - -// Type of device numbers. -type X__DevT = c.Ulong - -// Type of user identifications. -type X__UidT = c.Uint - -// Type of group identifications. -type X__GidT = c.Uint - -// Type of file serial numbers. -type X__InoT = c.Ulong - -// Type of file serial numbers (LFS). -type X__Ino64T = c.Ulong - -// Type of file attribute bitmasks. -type X__ModeT = c.Uint - -// Type of file link counts. -type X__NlinkT = c.Ulong - -// Type of file sizes and offsets. -type X__OffT = c.Long - -// Type of file sizes and offsets (LFS). -type X__Off64T = c.Long - -// Type of process identifications. -type X__PidT = c.Int - -// Type of CPU usage counts. -type X__ClockT = c.Long - -// Type for resource measurement. -type X__RlimT = c.Ulong - -// Type for resource measurement (LFS). -type X__Rlim64T = c.Ulong - -// General type for IDs. -type X__IdT = c.Uint - -// Seconds since the Epoch. -type X__TimeT = c.Long - -// Count of microseconds. -type X__UsecondsT = c.Uint - -// Signed count of microseconds. -type X__SusecondsT = c.Long - -// The type of a disk address. -type X__DaddrT = c.Int - -// Type of an IPC key. -type X__KeyT = c.Int - -// Clock ID used in clock and timer functions. -type X__ClockidT = c.Int - -// Timer ID returned by `timer_create'. -type X__TimerT uintptr - -// Type to represent block size. -type X__BlksizeT = c.Long - -// Type to count number of disk blocks. -type X__BlkcntT = c.Long -type X__Blkcnt64T = c.Long - -// Type to count file system blocks. -type X__FsblkcntT = c.Ulong -type X__Fsblkcnt64T = c.Ulong - -// Type to count file system nodes. -type X__FsfilcntT = c.Ulong -type X__Fsfilcnt64T = c.Ulong - -// Type of miscellaneous file system fields. -type X__FswordT = c.Long - -// Type of a byte count, or error. -type X__SsizeT = c.Long - -// Signed long type used in system calls. -type X__SyscallSlongT = c.Long - -// Unsigned long type used in system calls. -type X__SyscallUlongT = c.Ulong - -// These few don't really vary by system, they always correspond -// to one of the other defined types. -type X__LoffT = X__Off64T -type X__QaddrT = *X__QuadT -type X__CaddrT = *c.Char - -// Duplicates info from stdint.h but this is used in unistd.h. -type X__IntptrT = c.Long - -// Duplicate info from sys/socket.h. -type X__SocklenT = c.Uint diff --git a/c/os/bits-types_linux_arm64.go b/c/os/bits-types_linux_arm64.go deleted file mode 100644 index dd7be42c..00000000 --- a/c/os/bits-types_linux_arm64.go +++ /dev/null @@ -1,133 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -const X_BITS_TYPES_H = 1 - -type X__FsidT struct { - X__Val [2]c.Int -} - -// Convenience types. -type X__UChar = uint8 -type X__UShort = uint16 -type X__UInt = c.Uint -type X__ULong = c.Ulong - -// Fixed-size types, underlying types depend on word size and compiler. -type X__Int8T = int8 -type X__Uint8T = uint8 -type X__Int16T = int16 -type X__Uint16T = uint16 -type X__Int32T = c.Int -type X__Uint32T = c.Uint -type X__Int64T = c.Long -type X__Uint64T = c.Ulong -type X__QuadT = c.Long -type X__UQuadT = c.Ulong - -// Type of device numbers. -type X__DevT = c.Ulong - -// Type of user identifications. -type X__UidT = c.Uint - -// Type of group identifications. -type X__GidT = c.Uint - -// Type of file serial numbers. -type X__InoT = c.Ulong - -// Type of file serial numbers (LFS). -type X__Ino64T = c.Ulong - -// Type of file attribute bitmasks. -type X__ModeT = c.Uint - -// Type of file link counts. -type X__NlinkT = c.Uint - -// Type of file sizes and offsets. -type X__OffT = c.Long - -// Type of file sizes and offsets (LFS). -type X__Off64T = c.Long - -// Type of process identifications. -type X__PidT = c.Int - -// Type of CPU usage counts. -type X__ClockT = c.Long - -// Type for resource measurement. -type X__RlimT = c.Ulong - -// Type for resource measurement (LFS). -type X__Rlim64T = c.Ulong - -// General type for IDs. -type X__IdT = c.Uint - -// Seconds since the Epoch. -type X__TimeT = c.Long - -// Count of microseconds. -type X__UsecondsT = c.Uint - -// Signed count of microseconds. -type X__SusecondsT = c.Long - -// The type of a disk address. -type X__DaddrT = c.Int - -// Type of an IPC key. -type X__KeyT = c.Int - -// Clock ID used in clock and timer functions. -type X__ClockidT = c.Int - -// Timer ID returned by `timer_create'. -type X__TimerT uintptr - -// Type to represent block size. -type X__BlksizeT = c.Int - -// Type to count number of disk blocks. -type X__BlkcntT = c.Long -type X__Blkcnt64T = c.Long - -// Type to count file system blocks. -type X__FsblkcntT = c.Ulong -type X__Fsblkcnt64T = c.Ulong - -// Type to count file system nodes. -type X__FsfilcntT = c.Ulong -type X__Fsfilcnt64T = c.Ulong - -// Type of miscellaneous file system fields. -type X__FswordT = c.Long - -// Type of a byte count, or error. -type X__SsizeT = c.Long - -// Signed long type used in system calls. -type X__SyscallSlongT = c.Long - -// Unsigned long type used in system calls. -type X__SyscallUlongT = c.Ulong - -// These few don't really vary by system, they always correspond -// to one of the other defined types. -type X__LoffT = X__Off64T -type X__QaddrT = *X__QuadT -type X__CaddrT = *uint8 - -// Duplicates info from stdint.h but this is used in unistd.h. -type X__IntptrT = c.Long - -// Duplicate info from sys/socket.h. -type X__SocklenT = c.Uint diff --git a/c/os/dirent_darwin_arm64.go b/c/os/dirent_darwin_arm64.go deleted file mode 100644 index 4ecb7b5f..00000000 --- a/c/os/dirent_darwin_arm64.go +++ /dev/null @@ -1,37 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -// definitions for library routines operating on directories. -const DIRBLKSIZ = 1024 - -// flags for opendir2 -const ( - DTF_HIDEW = 1 - // don't return duplicate names - DTF_NODUP = 2 - // rewind after reading union stack - DTF_REWIND = 4 - // everything has been read - X__DTF_READALL = 8 - // assume internal buffer is populated - X__DTF_SKIPREAD = 16 - // there's nothing more to read in the kernel - X__DTF_ATEND = 32 -) - -type X_telldir struct { -} - -//go:linkname Alphasort C.alphasort -func Alphasort(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int - -//go:linkname Scandir C.scandir -func Scandir(_llcppg_param1 *c.Char, _llcppg_param2 ***Dirent, _llcppg_param3 func(_llcppg_param1 *Dirent) c.Int, _llcppg_param4 func(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int) c.Int diff --git a/c/os/dirent_linux_amd64.go b/c/os/dirent_linux_amd64.go deleted file mode 100644 index e1909d17..00000000 --- a/c/os/dirent_linux_amd64.go +++ /dev/null @@ -1,68 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_DIRENT_H = 1 - -// File types for `d_type'. -const ( - DT_UNKNOWN = 0 - DT_FIFO = 1 - DT_CHR = 2 - DT_DIR = 4 - DT_BLK = 6 - DT_REG = 8 - DT_LNK = 10 - DT_SOCK = 12 - DT_WHT = 14 -) - -type X__Dirstream struct { -} - -// This is the data type of directory stream objects. -// The actual structure is opaque to users. - -// llgo:link (*DIR).ReaddirR C.readdir_r -func (self *DIR) ReaddirR(__entry *Dirent, __result **Dirent) c.Int { - return 0 -} - -// Rewind DIRP to the beginning of the directory. -// -// llgo:link (*DIR).Rewinddir C.rewinddir -func (self *DIR) Rewinddir() { -} - -// Seek to position POS on DIRP. -// -// llgo:link (*DIR).Seekdir C.seekdir -func (self *DIR) Seekdir(__pos c.Long) { -} - -// Return the current position of DIRP. -// -// llgo:link (*DIR).Telldir C.telldir -func (self *DIR) Telldir() c.Long { - return 0 -} - -// Return the file descriptor used by DIRP. -// -// llgo:link (*DIR).Dirfd C.dirfd -func (self *DIR) Dirfd() c.Int { - return 0 -} - -//go:linkname Scandir C.scandir -func Scandir(__dir *c.Char, __namelist ***Dirent, __selector func(_llcppg_param1 *Dirent) c.Int, __cmp func(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int) c.Int - -//go:linkname Alphasort C.alphasort -func Alphasort(__e1 **Dirent, __e2 **Dirent) c.Int diff --git a/c/os/dirent_linux_arm64.go b/c/os/dirent_linux_arm64.go deleted file mode 100644 index 504f714b..00000000 --- a/c/os/dirent_linux_arm64.go +++ /dev/null @@ -1,68 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_DIRENT_H = 1 - -// File types for `d_type'. -const ( - DT_UNKNOWN = 0 - DT_FIFO = 1 - DT_CHR = 2 - DT_DIR = 4 - DT_BLK = 6 - DT_REG = 8 - DT_LNK = 10 - DT_SOCK = 12 - DT_WHT = 14 -) - -type X__Dirstream struct { -} - -// This is the data type of directory stream objects. -// The actual structure is opaque to users. - -// llgo:link (*DIR).ReaddirR C.readdir_r -func (self *DIR) ReaddirR(__entry *Dirent, __result **Dirent) c.Int { - return 0 -} - -// Rewind DIRP to the beginning of the directory. -// -// llgo:link (*DIR).Rewinddir C.rewinddir -func (self *DIR) Rewinddir() { -} - -// Seek to position POS on DIRP. -// -// llgo:link (*DIR).Seekdir C.seekdir -func (self *DIR) Seekdir(__pos c.Long) { -} - -// Return the current position of DIRP. -// -// llgo:link (*DIR).Telldir C.telldir -func (self *DIR) Telldir() c.Long { - return 0 -} - -// Return the file descriptor used by DIRP. -// -// llgo:link (*DIR).Dirfd C.dirfd -func (self *DIR) Dirfd() c.Int { - return 0 -} - -//go:linkname Scandir C.scandir -func Scandir(__dir *uint8, __namelist ***Dirent, __selector func(_llcppg_param1 *Dirent) c.Int, __cmp func(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int) c.Int - -//go:linkname Alphasort C.alphasort -func Alphasort(__e1 **Dirent, __e2 **Dirent) c.Int diff --git a/c/os/dlfcn_darwin_arm64.go b/c/os/dlfcn_darwin_arm64.go deleted file mode 100644 index a2b3073b..00000000 --- a/c/os/dlfcn_darwin_arm64.go +++ /dev/null @@ -1,49 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const ( - RTLD_LAZY = 1 - RTLD_NOW = 2 - RTLD_LOCAL = 4 - RTLD_GLOBAL = 8 -) -const ( - RTLD_NOLOAD = 16 - RTLD_NODELETE = 128 - // Mac OS X 10.5 and later - RTLD_FIRST = 256 -) - -// Structure filled in by dladdr(). -type DlInfo struct { - DliFname *c.Char - DliFbase unsafe.Pointer - DliSname *c.Char - DliSaddr unsafe.Pointer -} - -//go:linkname Dladdr C.dladdr -func Dladdr(_llcppg_param1 unsafe.Pointer, _llcppg_param2 *DlInfo) c.Int - -//go:linkname Dlclose C.dlclose -func Dlclose(__handle unsafe.Pointer) c.Int - -//go:linkname Dlerror C.dlerror -func Dlerror() *c.Char - -//go:linkname Dlopen C.dlopen -func Dlopen(__path *c.Char, __mode c.Int) unsafe.Pointer - -//go:linkname Dlsym C.dlsym -func Dlsym(__handle unsafe.Pointer, __symbol *c.Char) unsafe.Pointer - -//go:linkname DlopenPreflight C.dlopen_preflight -func DlopenPreflight(__path *c.Char) c.Int diff --git a/c/os/dlfcn_linux_amd64.go b/c/os/dlfcn_linux_amd64.go deleted file mode 100644 index d8ccfddc..00000000 --- a/c/os/dlfcn_linux_amd64.go +++ /dev/null @@ -1,37 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const X_DLFCN_H = 1 - -// Open the shared object FILE and map it in; return a handle that can be -// passed to `dlsym' to get symbol values from it. -// -//go:linkname Dlopen C.dlopen -func Dlopen(__file *c.Char, __mode c.Int) unsafe.Pointer - -// Unmap and close a shared object opened by `dlopen'. -// The handle cannot be used again after calling `dlclose'. -// -//go:linkname Dlclose C.dlclose -func Dlclose(__handle unsafe.Pointer) c.Int - -// Find the run-time address in the shared object HANDLE refers to -// of the symbol called NAME. -// -//go:linkname Dlsym C.dlsym -func Dlsym(__handle unsafe.Pointer, __name *c.Char) unsafe.Pointer - -// When any of the above functions fails, call this function -// to return a string describing the error. Each call resets -// the error string so that a following call returns null. -// -//go:linkname Dlerror C.dlerror -func Dlerror() *c.Char diff --git a/c/os/dlfcn_linux_arm64.go b/c/os/dlfcn_linux_arm64.go deleted file mode 100644 index 3b122c51..00000000 --- a/c/os/dlfcn_linux_arm64.go +++ /dev/null @@ -1,37 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const X_DLFCN_H = 1 - -// Open the shared object FILE and map it in; return a handle that can be -// passed to `dlsym' to get symbol values from it. -// -//go:linkname Dlopen C.dlopen -func Dlopen(__file *uint8, __mode c.Int) unsafe.Pointer - -// Unmap and close a shared object opened by `dlopen'. -// The handle cannot be used again after calling `dlclose'. -// -//go:linkname Dlclose C.dlclose -func Dlclose(__handle unsafe.Pointer) c.Int - -// Find the run-time address in the shared object HANDLE refers to -// of the symbol called NAME. -// -//go:linkname Dlsym C.dlsym -func Dlsym(__handle unsafe.Pointer, __name *uint8) unsafe.Pointer - -// When any of the above functions fails, call this function -// to return a string describing the error. Each call resets -// the error string so that a following call returns null. -// -//go:linkname Dlerror C.dlerror -func Dlerror() *uint8 diff --git a/c/os/fcntl_linux_amd64.go b/c/os/fcntl_linux_amd64.go deleted file mode 100644 index c16b500e..00000000 --- a/c/os/fcntl_linux_amd64.go +++ /dev/null @@ -1,122 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_FCNTL_H = 1 -const ( - S_IFMT = 61440 - S_IFDIR = 16384 - S_IFCHR = 8192 - S_IFBLK = 24576 - S_IFREG = 32768 -) -const S_IFIFO = 4096 -const S_IFLNK = 40960 -const S_IFSOCK = 49152 -const ( - // Set user ID on execution. - S_ISUID = 2048 - // Set group ID on execution. - S_ISGID = 1024 -) - -// Save swapped text after use (sticky bit). This is pretty well obsolete. -const S_ISVTX = 512 -const ( - // Read by owner. - S_IRUSR = 256 - // Write by owner. - S_IWUSR = 128 - // Execute by owner. - S_IXUSR = 64 -) - -// Read, write, and execute by owner. -const S_IRWXU = 448 -const ( - // Read by group. - S_IRGRP = 32 - // Write by group. - S_IWGRP = 16 - // Execute by group. - S_IXGRP = 8 -) - -// Read, write, and execute by group. -const S_IRWXG = 56 -const ( - // Read by others. - S_IROTH = 4 - // Write by others. - S_IWOTH = 2 - // Execute by others. - S_IXOTH = 1 -) - -// Read, write, and execute by others. -const S_IRWXO = 7 - -// Values for the second argument to access. -// These may be OR'd together. -const ( - R_OK = 4 - // Test for write permission. - W_OK = 2 - // Test for execute permission. - X_OK = 1 - // Test for existence. - F_OK = 0 -) -const ( - // Seek from beginning of file. - SEEK_SET = 0 - // Seek from current position. - SEEK_CUR = 1 - // Seek from end of file. - SEEK_END = 2 -) - -// Special value used to indicate -// the *at functions should use the -// current working directory. -const AT_FDCWD = -100 -const ( - // Do not follow symbolic links. - AT_SYMLINK_NOFOLLOW = 256 - // Remove directory instead of - // unlinking file. - AT_REMOVEDIR = 512 -) - -// Follow symbolic links. -const AT_SYMLINK_FOLLOW = 1024 - -// Test access permitted for -// effective IDs, not real IDs. -const AT_EACCESS = 512 -const ( - // Unlock a previously locked region. - F_ULOCK = 0 - // Lock a region for exclusive use. - F_LOCK = 1 - // Test and lock a region for exclusive use. - F_TLOCK = 2 - // Test a region for other processes locks. - F_TEST = 3 -) - -//go:linkname Lockf C.lockf -func Lockf(__fd c.Int, __cmd c.Int, __len OffT) c.Int - -//go:linkname PosixFadvise C.posix_fadvise -func PosixFadvise(__fd c.Int, __offset OffT, __len OffT, __advise c.Int) c.Int - -//go:linkname PosixFallocate C.posix_fallocate -func PosixFallocate(__fd c.Int, __offset OffT, __len OffT) c.Int diff --git a/c/os/fcntl_linux_arm64.go b/c/os/fcntl_linux_arm64.go deleted file mode 100644 index a2dccc28..00000000 --- a/c/os/fcntl_linux_arm64.go +++ /dev/null @@ -1,122 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_FCNTL_H = 1 -const ( - S_IFMT = 61440 - S_IFDIR = 16384 - S_IFCHR = 8192 - S_IFBLK = 24576 - S_IFREG = 32768 -) -const S_IFIFO = 4096 -const S_IFLNK = 40960 -const S_IFSOCK = 49152 -const ( - // Set user ID on execution. - S_ISUID = 2048 - // Set group ID on execution. - S_ISGID = 1024 -) - -// Save swapped text after use (sticky bit). This is pretty well obsolete. -const S_ISVTX = 512 -const ( - // Read by owner. - S_IRUSR = 256 - // Write by owner. - S_IWUSR = 128 - // Execute by owner. - S_IXUSR = 64 -) - -// Read, write, and execute by owner. -const S_IRWXU = 448 -const ( - // Read by group. - S_IRGRP = 32 - // Write by group. - S_IWGRP = 16 - // Execute by group. - S_IXGRP = 8 -) - -// Read, write, and execute by group. -const S_IRWXG = 56 -const ( - // Read by others. - S_IROTH = 4 - // Write by others. - S_IWOTH = 2 - // Execute by others. - S_IXOTH = 1 -) - -// Read, write, and execute by others. -const S_IRWXO = 7 - -// Values for the second argument to access. -// These may be OR'd together. -const ( - R_OK = 4 - // Test for write permission. - W_OK = 2 - // Test for execute permission. - X_OK = 1 - // Test for existence. - F_OK = 0 -) -const ( - // Seek from beginning of file. - SEEK_SET = 0 - // Seek from current position. - SEEK_CUR = 1 - // Seek from end of file. - SEEK_END = 2 -) - -// Special value used to indicate -// the *at functions should use the -// current working directory. -const AT_FDCWD = -100 -const ( - // Do not follow symbolic links. - AT_SYMLINK_NOFOLLOW = 256 - // Remove directory instead of - // unlinking file. - AT_REMOVEDIR = 512 -) - -// Follow symbolic links. -const AT_SYMLINK_FOLLOW = 1024 - -// Test access permitted for -// effective IDs, not real IDs. -const AT_EACCESS = 512 -const ( - // Unlock a previously locked region. - F_ULOCK = 0 - // Lock a region for exclusive use. - F_LOCK = 1 - // Test and lock a region for exclusive use. - F_TLOCK = 2 - // Test a region for other processes locks. - F_TEST = 3 -) - -//go:linkname Lockf C.lockf -func Lockf(__fd c.Int, __cmd c.Int, __len OffT) c.Int - -//go:linkname PosixFadvise C.posix_fadvise -func PosixFadvise(__fd c.Int, __offset OffT, __len OffT, __advise c.Int) c.Int - -//go:linkname PosixFallocate C.posix_fallocate -func PosixFallocate(__fd c.Int, __offset OffT, __len OffT) c.Int diff --git a/c/os/flags_linux_amd64.go b/c/os/flags_linux_amd64.go deleted file mode 100644 index a4eb4c76..00000000 --- a/c/os/flags_linux_amd64.go +++ /dev/null @@ -1,18 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -const ( - F_GETFL = 3 - F_SETFL = 4 - O_RDONLY = 0 - O_WRONLY = 1 - O_RDWR = 2 - O_ACCMODE = 3 - O_NONBLOCK = 2048 - O_CREAT = 64 - O_TRUNC = 512 - EAGAIN = 11 -) diff --git a/c/os/flags_linux_arm64.go b/c/os/flags_linux_arm64.go deleted file mode 100644 index a115895e..00000000 --- a/c/os/flags_linux_arm64.go +++ /dev/null @@ -1,18 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -const ( - F_GETFL = 3 - F_SETFL = 4 - O_RDONLY = 0 - O_WRONLY = 1 - O_RDWR = 2 - O_ACCMODE = 3 - O_NONBLOCK = 2048 - O_CREAT = 64 - O_TRUNC = 512 - EAGAIN = 11 -) diff --git a/c/os/fnmatch_darwin_arm64.go b/c/os/fnmatch_darwin_arm64.go deleted file mode 100644 index c62d61db..00000000 --- a/c/os/fnmatch_darwin_arm64.go +++ /dev/null @@ -1,35 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -// Match failed. -const FNM_NOMATCH = 1 -const ( - // Disable backslash escaping. - FNM_NOESCAPE = 1 - // Slash must be matched by slash. - FNM_PATHNAME = 2 - // Period must be matched by period. - FNM_PERIOD = 4 -) - -// Reserved. -const FNM_NOSYS = -1 -const ( - // Ignore / after Imatch. - FNM_LEADING_DIR = 8 - // Case insensitive search. - FNM_CASEFOLD = 16 - FNM_IGNORECASE = 16 - FNM_FILE_NAME = 2 -) - -//go:linkname Fnmatch C.fnmatch -func Fnmatch(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char, _llcppg_param3 c.Int) c.Int diff --git a/c/os/fnmatch_linux_amd64.go b/c/os/fnmatch_linux_amd64.go deleted file mode 100644 index 9a4bcd09..00000000 --- a/c/os/fnmatch_linux_amd64.go +++ /dev/null @@ -1,30 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_FNMATCH_H = 1 - -// Bits set in the FLAGS argument to `fnmatch'. -const ( - FNM_PATHNAME = 1 - // Backslashes don't quote special chars. - FNM_NOESCAPE = 2 - // Leading `.' is matched only explicitly. - FNM_PERIOD = 4 -) - -// Value returned by `fnmatch' if STRING does not match PATTERN. -const FNM_NOMATCH = 1 - -// Match NAME against the filename pattern PATTERN, -// returning zero if it matches, FNM_NOMATCH if not. -// -//go:linkname Fnmatch C.fnmatch -func Fnmatch(__pattern *c.Char, __name *c.Char, __flags c.Int) c.Int diff --git a/c/os/fnmatch_linux_arm64.go b/c/os/fnmatch_linux_arm64.go deleted file mode 100644 index 04ebd0cd..00000000 --- a/c/os/fnmatch_linux_arm64.go +++ /dev/null @@ -1,30 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_FNMATCH_H = 1 - -// Bits set in the FLAGS argument to `fnmatch'. -const ( - FNM_PATHNAME = 1 - // Backslashes don't quote special chars. - FNM_NOESCAPE = 2 - // Leading `.' is matched only explicitly. - FNM_PERIOD = 4 -) - -// Value returned by `fnmatch' if STRING does not match PATTERN. -const FNM_NOMATCH = 1 - -// Match NAME against the filename pattern PATTERN, -// returning zero if it matches, FNM_NOMATCH if not. -// -//go:linkname Fnmatch C.fnmatch -func Fnmatch(__pattern *uint8, __name *uint8, __flags c.Int) c.Int diff --git a/c/os/glob_linux_amd64.go b/c/os/glob_linux_amd64.go deleted file mode 100644 index 7c798f32..00000000 --- a/c/os/glob_linux_amd64.go +++ /dev/null @@ -1,84 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const X_GLOB_H = 1 - -// Bits set in the FLAGS argument to `glob'. -const ( - GLOB_ERR = 1 - // Append a slash to each name. - GLOB_MARK = 2 - // Don't sort the names. - GLOB_NOSORT = 4 - // Insert PGLOB->gl_offs NULLs. - GLOB_DOOFFS = 8 - // If nothing matches, return the pattern. - GLOB_NOCHECK = 16 - // Append to results of a previous call. - GLOB_APPEND = 32 - // Backslashes don't quote metacharacters. - GLOB_NOESCAPE = 64 - // Leading `.' can be matched by metachars. - GLOB_PERIOD = 128 -) -const ( - // Set in gl_flags if any metachars seen. - GLOB_MAGCHAR = 256 - // Use gl_opendir et al functions. - GLOB_ALTDIRFUNC = 512 - // Expand "{a,b}" to "a" "b". - GLOB_BRACE = 1024 - // If no magic chars, return the pattern. - GLOB_NOMAGIC = 2048 - // Expand ~user and ~ to home directories. - GLOB_TILDE = 4096 - // Match only directories. - GLOB_ONLYDIR = 8192 - // Like GLOB_TILDE but return an error - // if the user name is not available. - GLOB_TILDE_CHECK = 16384 -) -const X__GLOB_FLAGS = 32511 - -// Error returns from `glob'. -const ( - GLOB_NOSPACE = 1 - // Read error. - GLOB_ABORTED = 2 - // No matches found. - GLOB_NOMATCH = 3 - // Not implemented. - GLOB_NOSYS = 4 -) - -// llgo:type C -type GlobT struct { - GlPathc X__SizeT - GlPathv **c.Char - GlOffs X__SizeT - GlFlags c.Int - GlClosedir func(_llcppg_param1 unsafe.Pointer) - GlReaddir func(_llcppg_param1 unsafe.Pointer) unsafe.Pointer - GlOpendir func(_llcppg_param1 *c.Char) unsafe.Pointer - GlLstat func(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer) c.Int - GlStat func(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer) c.Int -} -type X__SizeT = c.Ulong -type SizeT = c.Ulong - -//go:linkname Glob C.glob -func Glob(__pattern *c.Char, __flags c.Int, __errfunc func(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int, __pglob *GlobT) c.Int - -// Free storage allocated in PGLOB by a previous `glob' call. -// -// llgo:link (*GlobT).Globfree C.globfree -func (self *GlobT) Globfree() { -} diff --git a/c/os/glob_linux_arm64.go b/c/os/glob_linux_arm64.go deleted file mode 100644 index 1c973bab..00000000 --- a/c/os/glob_linux_arm64.go +++ /dev/null @@ -1,84 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const X_GLOB_H = 1 - -// Bits set in the FLAGS argument to `glob'. -const ( - GLOB_ERR = 1 - // Append a slash to each name. - GLOB_MARK = 2 - // Don't sort the names. - GLOB_NOSORT = 4 - // Insert PGLOB->gl_offs NULLs. - GLOB_DOOFFS = 8 - // If nothing matches, return the pattern. - GLOB_NOCHECK = 16 - // Append to results of a previous call. - GLOB_APPEND = 32 - // Backslashes don't quote metacharacters. - GLOB_NOESCAPE = 64 - // Leading `.' can be matched by metachars. - GLOB_PERIOD = 128 -) -const ( - // Set in gl_flags if any metachars seen. - GLOB_MAGCHAR = 256 - // Use gl_opendir et al functions. - GLOB_ALTDIRFUNC = 512 - // Expand "{a,b}" to "a" "b". - GLOB_BRACE = 1024 - // If no magic chars, return the pattern. - GLOB_NOMAGIC = 2048 - // Expand ~user and ~ to home directories. - GLOB_TILDE = 4096 - // Match only directories. - GLOB_ONLYDIR = 8192 - // Like GLOB_TILDE but return an error - // if the user name is not available. - GLOB_TILDE_CHECK = 16384 -) -const X__GLOB_FLAGS = 32511 - -// Error returns from `glob'. -const ( - GLOB_NOSPACE = 1 - // Read error. - GLOB_ABORTED = 2 - // No matches found. - GLOB_NOMATCH = 3 - // Not implemented. - GLOB_NOSYS = 4 -) - -// llgo:type C -type GlobT struct { - GlPathc X__SizeT - GlPathv **uint8 - GlOffs X__SizeT - GlFlags c.Int - GlClosedir func(_llcppg_param1 unsafe.Pointer) - GlReaddir func(_llcppg_param1 unsafe.Pointer) unsafe.Pointer - GlOpendir func(_llcppg_param1 *uint8) unsafe.Pointer - GlLstat func(_llcppg_param1 *uint8, _llcppg_param2 unsafe.Pointer) c.Int - GlStat func(_llcppg_param1 *uint8, _llcppg_param2 unsafe.Pointer) c.Int -} -type X__SizeT = c.Ulong -type SizeT = c.Ulong - -//go:linkname Glob C.glob -func Glob(__pattern *uint8, __flags c.Int, __errfunc func(_llcppg_param1 *uint8, _llcppg_param2 c.Int) c.Int, __pglob *GlobT) c.Int - -// Free storage allocated in PGLOB by a previous `glob' call. -// -// llgo:link (*GlobT).Globfree C.globfree -func (self *GlobT) Globfree() { -} diff --git a/c/os/grp_darwin_arm64.go b/c/os/grp_darwin_arm64.go deleted file mode 100644 index 10189e74..00000000 --- a/c/os/grp_darwin_arm64.go +++ /dev/null @@ -1,62 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_PATH_GROUP = "/etc/group" - -type Group struct { - GrName *c.Char - GrPasswd *c.Char - GrGid GidT - GrMem **c.Char -} - -// [XBD] -// -//go:linkname Getgrgid C.getgrgid -func Getgrgid(_llcppg_param1 GidT) *Group - -// [TSF] -// -//go:linkname Getgrnam C.getgrnam -func Getgrnam(_llcppg_param1 *c.Char) *Group - -// [TSF] -// -//go:linkname GetgrgidR C.getgrgid_r -func GetgrgidR(_llcppg_param1 GidT, _llcppg_param2 *Group, _llcppg_param3 *c.Char, _llcppg_param4 SizeT, _llcppg_param5 **Group) c.Int - -// [XSI] -// -//go:linkname GetgrnamR C.getgrnam_r -func GetgrnamR(_llcppg_param1 *c.Char, _llcppg_param2 *Group, _llcppg_param3 *c.Char, _llcppg_param4 SizeT, _llcppg_param5 **Group) c.Int - -// [XSI] -// -//go:linkname Getgrent C.getgrent -func Getgrent() *Group - -//go:linkname Setgrent C.setgrent -func Setgrent() - -//go:linkname Endgrent C.endgrent -func Endgrent() - -//go:linkname GroupFromGid C.group_from_gid -func GroupFromGid(_llcppg_param1 GidT, _llcppg_param2 c.Int) *c.Char - -//go:linkname Getgruuid C.getgruuid -func Getgruuid(_llcppg_param1 UuidT) *Group - -//go:linkname GetgruuidR C.getgruuid_r -func GetgruuidR(_llcppg_param1 UuidT, _llcppg_param2 *Group, _llcppg_param3 *c.Char, _llcppg_param4 SizeT, _llcppg_param5 **Group) c.Int - -//go:linkname Setgroupent C.setgroupent -func Setgroupent(_llcppg_param1 c.Int) c.Int diff --git a/c/os/grp_linux_amd64.go b/c/os/grp_linux_amd64.go deleted file mode 100644 index 809d0a8e..00000000 --- a/c/os/grp_linux_amd64.go +++ /dev/null @@ -1,130 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_GRP_H = 1 - -// Reasonable value for the buffer sized used in the reentrant -// functions below. But better use `sysconf'. -const NSS_BUFLEN_GROUP = 1024 - -// The group structure. -type Group struct { - GrName *c.Char - GrPasswd *c.Char - GrGid X__GidT - GrMem **c.Char -} - -// Rewind the group-file stream. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Setgrent C.setgrent -func Setgrent() - -// Close the group-file stream. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Endgrent C.endgrent -func Endgrent() - -// Read an entry from the group-file stream, opening it if necessary. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getgrent C.getgrent -func Getgrent() *Group - -// Read a group entry from STREAM. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Fgetgrent C.fgetgrent -func Fgetgrent(__stream *c.FILE) *Group - -// Search for an entry with a matching group ID. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getgrgid C.getgrgid -func Getgrgid(__gid X__GidT) *Group - -// Search for an entry with a matching group name. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getgrnam C.getgrnam -func Getgrnam(__name *c.Char) *Group - -// Search for an entry with a matching group ID. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname GetgrgidR C.getgrgid_r -func GetgrgidR(__gid X__GidT, __resultbuf *Group, __buffer *c.Char, __buflen SizeT, __result **Group) c.Int - -// Search for an entry with a matching group name. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname GetgrnamR C.getgrnam_r -func GetgrnamR(__name *c.Char, __resultbuf *Group, __buffer *c.Char, __buflen SizeT, __result **Group) c.Int - -// Read a group entry from STREAM. This function is not standardized -// an probably never will. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname FgetgrentR C.fgetgrent_r -func FgetgrentR(__stream *c.FILE, __resultbuf *Group, __buffer *c.Char, __buflen SizeT, __result **Group) c.Int - -// Set the group set for the current user to GROUPS (N of them). -// -//go:linkname Setgroups C.setgroups -func Setgroups(__n SizeT, __groups *X__GidT) c.Int - -// Store at most *NGROUPS members of the group set for USER into -// GROUPS. Also include GROUP. The actual number of groups found is -// returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Getgrouplist C.getgrouplist -func Getgrouplist(__user *c.Char, __group X__GidT, __groups *X__GidT, __ngroups *c.Int) c.Int - -// Initialize the group set for the current user -// by reading the group database and using all groups -// of which USER is a member. Also include GROUP. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Initgroups C.initgroups -func Initgroups(__user *c.Char, __group X__GidT) c.Int diff --git a/c/os/grp_linux_arm64.go b/c/os/grp_linux_arm64.go deleted file mode 100644 index 1c7d053f..00000000 --- a/c/os/grp_linux_arm64.go +++ /dev/null @@ -1,130 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_GRP_H = 1 - -// Reasonable value for the buffer sized used in the reentrant -// functions below. But better use `sysconf'. -const NSS_BUFLEN_GROUP = 1024 - -// The group structure. -type Group struct { - GrName *uint8 - GrPasswd *uint8 - GrGid X__GidT - GrMem **uint8 -} - -// Rewind the group-file stream. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Setgrent C.setgrent -func Setgrent() - -// Close the group-file stream. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Endgrent C.endgrent -func Endgrent() - -// Read an entry from the group-file stream, opening it if necessary. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getgrent C.getgrent -func Getgrent() *Group - -// Read a group entry from STREAM. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Fgetgrent C.fgetgrent -func Fgetgrent(__stream *c.FILE) *Group - -// Search for an entry with a matching group ID. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getgrgid C.getgrgid -func Getgrgid(__gid X__GidT) *Group - -// Search for an entry with a matching group name. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getgrnam C.getgrnam -func Getgrnam(__name *uint8) *Group - -// Search for an entry with a matching group ID. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname GetgrgidR C.getgrgid_r -func GetgrgidR(__gid X__GidT, __resultbuf *Group, __buffer *uint8, __buflen SizeT, __result **Group) c.Int - -// Search for an entry with a matching group name. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname GetgrnamR C.getgrnam_r -func GetgrnamR(__name *uint8, __resultbuf *Group, __buffer *uint8, __buflen SizeT, __result **Group) c.Int - -// Read a group entry from STREAM. This function is not standardized -// an probably never will. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname FgetgrentR C.fgetgrent_r -func FgetgrentR(__stream *c.FILE, __resultbuf *Group, __buffer *uint8, __buflen SizeT, __result **Group) c.Int - -// Set the group set for the current user to GROUPS (N of them). -// -//go:linkname Setgroups C.setgroups -func Setgroups(__n SizeT, __groups *X__GidT) c.Int - -// Store at most *NGROUPS members of the group set for USER into -// GROUPS. Also include GROUP. The actual number of groups found is -// returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Getgrouplist C.getgrouplist -func Getgrouplist(__user *uint8, __group X__GidT, __groups *X__GidT, __ngroups *c.Int) c.Int - -// Initialize the group set for the current user -// by reading the group database and using all groups -// of which USER is a member. Also include GROUP. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Initgroups C.initgroups -func Initgroups(__user *uint8, __group X__GidT) c.Int diff --git a/c/os/libc_darwin_arm64.go b/c/os/libc_darwin_arm64.go new file mode 100644 index 00000000..61823e16 --- /dev/null +++ b/c/os/libc_darwin_arm64.go @@ -0,0 +1,2703 @@ +//go:build darwin && arm64 && !ios + +// Code generated by llcppg; DO NOT EDIT. +// Classified from the common libc binding. + +package os + +import ( + "github.com/goplus/lib/c" + llsignal "github.com/goplus/lib/c/signal" + llsys "github.com/goplus/lib/c/sys" + lltime "github.com/goplus/lib/c/time" + "unsafe" +) + +// definitions for library routines operating on directories. +const DIRBLKSIZ = 1024 + +// flags for opendir2 +const ( + DTF_HIDEW = 1 + // don't return duplicate names + DTF_NODUP = 2 + // rewind after reading union stack + DTF_REWIND = 4 + // everything has been read + // assume internal buffer is populated + // there's nothing more to read in the kernel +) + +// llgo:link (*DIR).ReaddirR C.readdir_r +func (self *DIR) ReaddirR(_llcppg_param2 *Dirent, _llcppg_param3 **Dirent) c.Int { + return 0 +} + +// llgo:link (*DIR).Rewinddir C.rewinddir +func (self *DIR) Rewinddir() { +} + +// llgo:link (*DIR).Seekdir C.seekdir +func (self *DIR) Seekdir(_llcppg_param2 c.Long) { +} + +// llgo:link (*DIR).Telldir C.telldir +func (self *DIR) Telldir() c.Long { + return 0 +} + +//go:linkname Alphasort C.alphasort +func Alphasort(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int + +// llgo:link (*DIR).Dirfd C.dirfd +func (self *DIR) Dirfd() c.Int { + return 0 +} + +//go:linkname Scandir C.scandir +func Scandir(_llcppg_param1 *c.Char, _llcppg_param2 ***Dirent, _llcppg_param3 func(_llcppg_param1 *Dirent) c.Int, _llcppg_param4 func(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int) c.Int + +const ( + RTLD_LAZY = 1 + RTLD_NOW = 2 + RTLD_LOCAL = 4 + RTLD_GLOBAL = 8 +) + +const ( + RTLD_NOLOAD = 16 + RTLD_NODELETE = 128 + // Mac OS X 10.5 and later + RTLD_FIRST = 256 +) + +// Structure filled in by dladdr(). +type DlInfo struct { + DliFname *c.Char + DliFbase unsafe.Pointer + DliSname *c.Char + DliSaddr unsafe.Pointer +} + +//go:linkname Dladdr C.dladdr +func Dladdr(_llcppg_param1 unsafe.Pointer, _llcppg_param2 *DlInfo) c.Int + +//go:linkname Dlclose C.dlclose +func Dlclose(__handle unsafe.Pointer) c.Int + +//go:linkname Dlerror C.dlerror +func Dlerror() *c.Char + +//go:linkname Dlopen C.dlopen +func Dlopen(__path *c.Char, __mode c.Int) unsafe.Pointer + +//go:linkname Dlsym C.dlsym +func Dlsym(__handle unsafe.Pointer, __symbol *c.Char) unsafe.Pointer + +//go:linkname DlopenPreflight C.dlopen_preflight +func DlopenPreflight(__path *c.Char) bool + +// Believed to have been introduced in 1003.2-1992 +const ( + GLOB_APPEND = 1 + // Use gl_offs. + GLOB_DOOFFS = 2 + // Return on error. + GLOB_ERR = 4 + // Append / to matching directories. + GLOB_MARK = 8 + // Return pattern itself if nothing matches. + GLOB_NOCHECK = 16 + // Don't sort. + GLOB_NOSORT = 32 + // Disable backslash escaping. + GLOB_NOESCAPE = 8192 +) + +// Error values returned by glob(3) +const ( + GLOB_NOSPACE = -1 + // Unignored error. + GLOB_ABORTED = -2 + // No match and GLOB_NOCHECK was not set. + GLOB_NOMATCH = -3 + // Obsolete: source comptability only. + GLOB_NOSYS = -4 +) + +const ( + // Use alternately specified directory funcs. + GLOB_ALTDIRFUNC = 64 + // Expand braces ala csh. + GLOB_BRACE = 128 + // Pattern had globbing characters. + GLOB_MAGCHAR = 256 + // GLOB_NOCHECK without magic chars (csh). + GLOB_NOMAGIC = 512 + // Quote special chars with \. + GLOB_QUOTE = 1024 + // Expand tilde names from the passwd file. + GLOB_TILDE = 2048 + // limit number of returned paths + GLOB_LIMIT = 4096 +) + +// source compatibility, these are the old names +const ( + GLOB_MAXPATH = 4096 + GLOB_ABEND = -2 +) + +type Group struct { + GrName *c.Char + GrPasswd *c.Char + GrGid c.Uint + GrMem **c.Char +} + +// [XBD] +// +//go:linkname Getgrgid C.getgrgid +func Getgrgid(_llcppg_param1 c.Uint) *Group + +// [TSF] +// +//go:linkname Getgrnam C.getgrnam +func Getgrnam(_llcppg_param1 *c.Char) *Group + +// [TSF] +// +//go:linkname GetgrgidR C.getgrgid_r +func GetgrgidR(_llcppg_param1 c.Uint, _llcppg_param2 *Group, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT, _llcppg_param5 **Group) c.Int + +// [XSI] +// +//go:linkname GetgrnamR C.getgrnam_r +func GetgrnamR(_llcppg_param1 *c.Char, _llcppg_param2 *Group, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT, _llcppg_param5 **Group) c.Int + +// [XSI] +// +//go:linkname Getgrent C.getgrent +func Getgrent() *Group + +//go:linkname Setgrent C.setgrent +func Setgrent() + +//go:linkname Endgrent C.endgrent +func Endgrent() + +//go:linkname GroupFromGid C.group_from_gid +func GroupFromGid(_llcppg_param1 c.Uint, _llcppg_param2 c.Int) *c.Char + +//go:linkname Getgruuid C.getgruuid +func Getgruuid(_llcppg_param1 UuidT) *Group + +//go:linkname GetgruuidR C.getgruuid_r +func GetgruuidR(_llcppg_param1 UuidT, _llcppg_param2 *Group, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT, _llcppg_param5 **Group) c.Int + +//go:linkname Setgroupent C.setgroupent +func Setgroupent(_llcppg_param1 c.Int) c.Int + +type SemaphoreT = MachPortT + +type SchedParam struct { + SchedPriority c.Int + X__Opaque [4]c.Char +} + +//go:linkname SchedYield C.sched_yield +func SchedYield() c.Int + +//go:linkname SchedGetPriorityMin C.sched_get_priority_min +func SchedGetPriorityMin(_llcppg_param1 c.Int) c.Int + +//go:linkname SchedGetPriorityMax C.sched_get_priority_max +func SchedGetPriorityMax(_llcppg_param1 c.Int) c.Int + +type Passwd struct { + PwName *c.Char + PwPasswd *c.Char + PwUid c.Uint + PwGid c.Uint + PwChange c.Long + PwClass *c.Char + PwGecos *c.Char + PwDir *c.Char + PwShell *c.Char + PwExpire c.Long +} + +//go:linkname Getpwuid C.getpwuid +func Getpwuid(_llcppg_param1 c.Uint) *Passwd + +//go:linkname Getpwnam C.getpwnam +func Getpwnam(_llcppg_param1 *c.Char) *Passwd + +//go:linkname GetpwuidR C.getpwuid_r +func GetpwuidR(_llcppg_param1 c.Uint, _llcppg_param2 *Passwd, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT, _llcppg_param5 **Passwd) c.Int + +//go:linkname GetpwnamR C.getpwnam_r +func GetpwnamR(_llcppg_param1 *c.Char, _llcppg_param2 *Passwd, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT, _llcppg_param5 **Passwd) c.Int + +//go:linkname Getpwent C.getpwent +func Getpwent() *Passwd + +//go:linkname Setpwent C.setpwent +func Setpwent() + +//go:linkname Endpwent C.endpwent +func Endpwent() + +//go:linkname Setpassent C.setpassent +func Setpassent(_llcppg_param1 c.Int) c.Int + +//go:linkname UserFromUid C.user_from_uid +func UserFromUid(_llcppg_param1 c.Uint, _llcppg_param2 c.Int) *c.Char + +//go:linkname Getpwuuid C.getpwuuid +func Getpwuuid(_llcppg_param1 UuidT) *Passwd + +//go:linkname GetpwuuidR C.getpwuuid_r +func GetpwuuidR(_llcppg_param1 UuidT, _llcppg_param2 *Passwd, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT, _llcppg_param5 **Passwd) c.Int + +// flags for CPU Security Mitigation attribute +// POSIX_SPAWN_NP_CSM_ALL should be used in most cases, +// the individual flags are provided only for performance evaluation etc +const ( + POSIX_SPAWN_NP_CSM_ALL = 1 + POSIX_SPAWN_NP_CSM_NOSMT = 2 + POSIX_SPAWN_NP_CSM_TECS = 4 +) + +// Opaque types for use with posix_spawn() family functions. Internals are +// not defined, and should not be accessed directly. Types are defined as +// mandated by POSIX. +type PosixSpawnattrT uintptr + +type PosixSpawnFileActionsT uintptr + +//go:linkname PosixSpawn C.posix_spawn +func PosixSpawn(_llcppg_param1 *c.Int, _llcppg_param2 *c.Char, _llcppg_param3 *PosixSpawnFileActionsT, _llcppg_param4 *PosixSpawnattrT, __argv **c.Char, __envp **c.Char) c.Int + +//go:linkname PosixSpawnp C.posix_spawnp +func PosixSpawnp(_llcppg_param1 *c.Int, _llcppg_param2 *c.Char, _llcppg_param3 *PosixSpawnFileActionsT, _llcppg_param4 *PosixSpawnattrT, __argv **c.Char, __envp **c.Char) c.Int + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddclose C.posix_spawn_file_actions_addclose +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddclose(_llcppg_param2 c.Int) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAdddup2 C.posix_spawn_file_actions_adddup2 +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAdddup2(_llcppg_param2 c.Int, _llcppg_param3 c.Int) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddopen C.posix_spawn_file_actions_addopen +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddopen(_llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 c.Int, _llcppg_param5 c.Uint16T) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsDestroy C.posix_spawn_file_actions_destroy +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsDestroy() c.Int { + return 0 +} + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsInit C.posix_spawn_file_actions_init +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsInit() c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrDestroy C.posix_spawnattr_destroy +func (self *PosixSpawnattrT) PosixSpawnattrDestroy() c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigdefault C.posix_spawnattr_getsigdefault +func (self *PosixSpawnattrT) PosixSpawnattrGetsigdefault(_llcppg_param2 *c.Uint) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetflags C.posix_spawnattr_getflags +func (self *PosixSpawnattrT) PosixSpawnattrGetflags(_llcppg_param2 *int16) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetpgroup C.posix_spawnattr_getpgroup +func (self *PosixSpawnattrT) PosixSpawnattrGetpgroup(_llcppg_param2 *c.Int) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigmask C.posix_spawnattr_getsigmask +func (self *PosixSpawnattrT) PosixSpawnattrGetsigmask(_llcppg_param2 *c.Uint) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrInit C.posix_spawnattr_init +func (self *PosixSpawnattrT) PosixSpawnattrInit() c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigdefault C.posix_spawnattr_setsigdefault +func (self *PosixSpawnattrT) PosixSpawnattrSetsigdefault(_llcppg_param2 *c.Uint) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetflags C.posix_spawnattr_setflags +func (self *PosixSpawnattrT) PosixSpawnattrSetflags(_llcppg_param2 int16) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetpgroup C.posix_spawnattr_setpgroup +func (self *PosixSpawnattrT) PosixSpawnattrSetpgroup(_llcppg_param2 c.Int) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigmask C.posix_spawnattr_setsigmask +func (self *PosixSpawnattrT) PosixSpawnattrSetsigmask(_llcppg_param2 *c.Uint) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetbinprefNp C.posix_spawnattr_getbinpref_np +func (self *PosixSpawnattrT) PosixSpawnattrGetbinprefNp(_llcppg_param2 c.SizeT, _llcppg_param3 *c.Int, _llcppg_param4 *c.SizeT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetarchprefNp C.posix_spawnattr_getarchpref_np +func (self *PosixSpawnattrT) PosixSpawnattrGetarchprefNp(_llcppg_param2 c.SizeT, _llcppg_param3 *c.Int, _llcppg_param4 *c.Int, _llcppg_param5 *c.SizeT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetauditsessionportNp C.posix_spawnattr_setauditsessionport_np +func (self *PosixSpawnattrT) PosixSpawnattrSetauditsessionportNp(_llcppg_param2 MachPortT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetbinprefNp C.posix_spawnattr_setbinpref_np +func (self *PosixSpawnattrT) PosixSpawnattrSetbinprefNp(_llcppg_param2 c.SizeT, _llcppg_param3 *c.Int, _llcppg_param4 *c.SizeT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetarchprefNp C.posix_spawnattr_setarchpref_np +func (self *PosixSpawnattrT) PosixSpawnattrSetarchprefNp(_llcppg_param2 c.SizeT, _llcppg_param3 *c.Int, _llcppg_param4 *c.Int, _llcppg_param5 *c.SizeT) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetexceptionportsNp C.posix_spawnattr_setexceptionports_np +func (self *PosixSpawnattrT) PosixSpawnattrSetexceptionportsNp(_llcppg_param2 c.Uint, _llcppg_param3 MachPortT, _llcppg_param4 c.Int, _llcppg_param5 c.Int) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetspecialportNp C.posix_spawnattr_setspecialport_np +func (self *PosixSpawnattrT) PosixSpawnattrSetspecialportNp(_llcppg_param2 MachPortT, _llcppg_param3 c.Int) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetnosmtNp C.posix_spawnattr_setnosmt_np +func (self *PosixSpawnattrT) PosixSpawnattrSetnosmtNp() c.Int { + return 0 +} + +// Set CPU Security Mitigation on the spawned process +// This attribute affects all threads and is inherited on fork and exec +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetCsmNp C.posix_spawnattr_set_csm_np +func (self *PosixSpawnattrT) PosixSpawnattrSetCsmNp(flags c.Uint) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddinheritNp C.posix_spawn_file_actions_addinherit_np +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddinheritNp(_llcppg_param2 c.Int) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddchdirNp C.posix_spawn_file_actions_addchdir_np +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddchdirNp(_llcppg_param2 *c.Char) c.Int { + return 0 +} + +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddfchdirNp C.posix_spawn_file_actions_addfchdir_np +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddfchdirNp(_llcppg_param2 c.Int) c.Int { + return 0 +} + +type MachPortT = c.Uint + +type UuidT = X__DarwinUuidT + +type X__DarwinUuidT = [16]uint8 + +// File types +const MAXNAMLEN = 255 + +// File types +const ( + DT_UNKNOWN = 0 + DT_FIFO = 1 + DT_CHR = 2 + DT_DIR = 4 + DT_BLK = 6 + DT_REG = 8 + DT_LNK = 10 + DT_SOCK = 12 + DT_WHT = 14 +) + +const ( + FREAD = 1 + FWRITE = 2 +) + +const ( + // no delay + // set append mode + O_APPEND = 8 +) + +const ( + // open with shared file lock + O_SHLOCK = 16 + // open with exclusive file lock + O_EXLOCK = 32 + // signal pgrp when data ready + O_ASYNC = 64 + // source compatibility: do not use + O_FSYNC = 128 + // don't follow symlinks + O_NOFOLLOW = 256 +) + +const ( + // create if nonexistant + // truncate to zero length + // error if already exists + O_EXCL = 2048 +) + +// descriptor requested for event notifications only +const O_EVTONLY = 32768 + +// don't assign controlling terminal +const O_NOCTTY = 131072 + +const O_DIRECTORY = 1048576 + +// allow open of a symlink +const O_SYMLINK = 2097152 + +// implicitly set FD_CLOEXEC +const O_CLOEXEC = 16777216 + +// no symlinks allowed in path +const O_NOFOLLOW_ANY = 536870912 + +const ( + // open file for execute only + O_EXEC = 1073741824 + // open directory for search only + O_SEARCH = 1074790400 +) + +// Descriptor value for the current working directory +const AT_FDCWD = -2 + +// Flags for the at functions +const ( + AT_EACCESS = 16 + // Act on the symlink itself not the target + AT_SYMLINK_NOFOLLOW = 32 + // Act on target of symlink + AT_SYMLINK_FOLLOW = 64 + // Path refers to directory + AT_REMOVEDIR = 128 +) + +const ( + // Return real device inodes resides on for fstatat(2) + AT_REALDEV = 512 + // Use only the fd and Ignore the path for fstatat(2) + AT_FDONLY = 1024 + // Path should not contain any symlinks + AT_SYMLINK_NOFOLLOW_ANY = 2048 +) + +// Data Protection Flags +const ( + O_DP_GETRAWENCRYPTED = 1 + O_DP_GETRAWUNENCRYPTED = 2 + O_DP_AUTHENTICATE = 4 +) + +// Descriptor value for openat_authenticated_np() to skip authentication with another fd +const AUTH_OPEN_NOAUTHFD = -1 + +const ( + // kernel/compat + FAPPEND = 8 + // kernel/compat + FASYNC = 64 + // kernel + FFSYNC = 128 + // kernel + FFDSYNC = 4194304 + // kernel + FNONBLOCK = 4 + // compat + FNDELAY = 4 + // compat + O_NDELAY = 4 +) + +const ( + CPF_OVERWRITE = 1 + CPF_IGNORE_MODE = 2 + CPF_MASK = 3 +) + +// command values +const ( + F_DUPFD = 0 + // get file descriptor flags + F_GETFD = 1 + // set file descriptor flags + F_SETFD = 2 + // get file status flags + // set file status flags + // get SIGIO/SIGURG proc/pgrp + F_GETOWN = 5 + // set SIGIO/SIGURG proc/pgrp + F_SETOWN = 6 + // get record locking information + F_GETLK = 7 + // set record locking information + F_SETLK = 8 + // F_SETLK; wait if blocked + F_SETLKW = 9 +) + +// F_SETLK; wait if blocked, return on timeout +const F_SETLKWTIMEOUT = 10 + +const ( + F_FLUSH_DATA = 40 + // Used for regression test + F_CHKCLEAN = 41 + // Preallocate storage + F_PREALLOCATE = 42 + // Truncate a file. Equivalent to calling truncate(2) + F_SETSIZE = 43 + // Issue an advisory read async with no copy to user + F_RDADVISE = 44 + // turn read ahead off/on for this fd + F_RDAHEAD = 45 +) + +// 46,47 used to be F_READBOOTSTRAP and F_WRITEBOOTSTRAP +const ( + F_NOCACHE = 48 + // file offset to device offset + F_LOG2PHYS = 49 + // return the full path of the fd + F_GETPATH = 50 + // fsync + ask the drive to flush to the media + F_FULLFSYNC = 51 + // find which component (if any) is a package + F_PATHPKG_CHECK = 52 + // "freeze" all fs operations + F_FREEZE_FS = 53 + // "thaw" all fs operations + F_THAW_FS = 54 + // turn data caching off/on (globally) for this file + F_GLOBAL_NOCACHE = 55 +) + +// add detached signatures +const F_ADDSIGS = 59 + +// add signature from same file (used by dyld for shared libs) +const F_ADDFILESIGS = 61 + +// used in conjunction with F_NOCACHE to indicate that DIRECT, synchonous writes +const F_NODIRECT = 62 + +const ( + // Get the protection class of a file from the EA, returns int + F_GETPROTECTIONCLASS = 63 + // Set the protection class of a file for the EA, requires int + F_SETPROTECTIONCLASS = 64 +) + +// file offset to device offset, extended +const F_LOG2PHYS_EXT = 65 + +// See man fcntl(2) F_GETLK +// Similar to F_GETLK but in addition l_pid is treated as an input parameter +// which is used as a matching value when searching locks on the file +// so that only locks owned by the process with pid l_pid are returned. +// However, any flock(2) type lock will also be found with the returned value +// of l_pid set to -1 (as with F_GETLK). +const F_GETLKPID = 66 + +const ( + // Mark the file as being the backing store for another filesystem + F_SETBACKINGSTORE = 70 + // return the full path of the FD, but error in specific mtmd circumstances + F_GETPATH_MTMINFO = 71 +) + +// Returns the code directory, with associated hashes, to the caller +const F_GETCODEDIR = 72 + +const ( + // No SIGPIPE generated on EPIPE + F_SETNOSIGPIPE = 73 + // Status of SIGPIPE for this fd + F_GETNOSIGPIPE = 74 +) + +// For some cases, we need to rewrap the key for AKS/MKB +const F_TRANSCODEKEY = 75 + +// file being written to a by single writer... if throttling enabled, writes +const F_SINGLE_WRITER = 76 + +// Get the protection version number for this filesystem +const F_GETPROTECTIONLEVEL = 77 + +// Add detached code signatures (used by dyld for shared libs) +const F_FINDSIGS = 78 + +// Add signature from same file, only if it is signed by Apple (used by dyld for simulator) +const F_ADDFILESIGS_FOR_DYLD_SIM = 83 + +// fsync + issue barrier to drive +const F_BARRIERFSYNC = 85 + +const ( + // Acquire or release open file description lock + F_OFD_SETLK = 90 + // (as F_OFD_SETLK but blocking if conflicting lock) + F_OFD_SETLKW = 91 + // Examine OFD lock + F_OFD_GETLK = 92 +) + +// (as F_OFD_SETLKW but return if timeout) +const F_OFD_SETLKWTIMEOUT = 93 + +const ( + // Add signature from same file, return end offset in structure on success + F_ADDFILESIGS_RETURN = 97 + // Check if Library Validation allows this Mach-O file to be mapped into the calling process + F_CHECK_LV = 98 +) + +// Deallocate a range of the file +const F_PUNCHHOLE = 99 + +// Trim an active file +const F_TRIM_ACTIVE_FILE = 100 + +// Asynchronous advisory read fcntl for regular and compressed file +const F_SPECULATIVE_READ = 101 + +// return the full path without firmlinks of the fd +const F_GETPATH_NOFIRMLINK = 102 + +const ( + // Add signature from same file, return information + F_ADDFILESIGS_INFO = 103 + // Add supplemental signature from same file with fd reference to original + F_ADDFILESUPPL = 104 + // Look up code signature information attached to a file or slice + F_GETSIGSINFO = 105 +) + +const ( + // Acquire or release lease + F_SETLEASE = 106 + // Retrieve lease information + F_GETLEASE = 107 +) + +// Transfer allocated extents beyond leof to a different file +const F_TRANSFEREXTENTS = 110 + +// Based on flags, query/set/delete a file's attribution tag +const F_ATTRIBUTION_TAG = 111 + +// FS-specific fcntl()'s numbers begin at 0x00010000 and go up +const FCNTL_FS_SPECIFIC_BASE = 65536 + +// mark the dup with FD_CLOEXEC +const F_DUPFD_CLOEXEC = 67 + +// file descriptor flags (F_GETFD, F_SETFD) +const FD_CLOEXEC = 1 + +// record locking flags (F_GETLK, F_SETLK, F_SETLKW) +const ( + F_RDLCK = 1 + // unlock + F_UNLCK = 2 + // exclusive or write lock + F_WRLCK = 3 +) + +const ( + // allocate contigious space + F_ALLOCATECONTIG = 2 + // allocate all requested space or no space at all + F_ALLOCATEALL = 4 + // do not free space upon close(2) + F_ALLOCATEPERSIST = 8 +) + +// Make it past all of the SEEK pos modes so that +const F_PEOFPOSMODE = 3 + +// we can keep them in sync should we desire +const F_VOLPOSMODE = 4 + +// detached code signatures data type - +// information passed by user to system used by F_ADDSIGS and F_ADDFILESIGS. +// F_ADDFILESIGS is a shortcut for files that contain their own signature and +// doesn't require mapping of the file in order to load the signature. +const USER_FSIGNATURES_CDHASH_LEN = 20 + +// At this time F_GETSIGSINFO can only indicate platformness. +// +// As additional requestable information is defined, new keys will be added and the +// fgetsigsinfo_t structure will be lengthened to add space for the additional information +const GETSIGSINFO_PLATFORM_BINARY = 1 + +// lock operations for flock(2) +const ( + LOCK_SH = 1 + // exclusive file lock + LOCK_EX = 2 + // don't block when locking + LOCK_NB = 4 + // unlock file + LOCK_UN = 8 +) + +// fattributiontag_t used by F_ATTRIBUTION_TAG +const ATTRIBUTION_NAME_MAX = 255 + +// ft_flags (F_ATTRIBUTION_TAG) +const ( + F_CREATE_TAG = 1 + F_DELETE_TAG = 2 + F_QUERY_TAG = 4 +) + +const ( + // force window to popup on open + O_POPUP = 2147483648 + // small, clean popup window + O_ALERT = 536870912 +) + +// Advisory file segment locking data type - +// information passed to system by user +type FlockT struct { + LStart c.LongLong + LLen c.LongLong + LPid c.Int + LType int16 + LWhence int16 +} + +// Advisory file segment locking with time out - +// Information passed to system by user for F_SETLKWTIMEOUT +type Flocktimeout struct { + Fl FlockT + Timeout lltime.Timespec +} + +type Radvisory struct { + RaOffset c.LongLong + RaCount c.Int +} + +type Fsignatures struct { + FsFileStart c.LongLong + FsBlobStart unsafe.Pointer + FsBlobSize c.SizeT + FsFsignaturesSize c.SizeT + FsCdhash [20]c.Char + FsHashType c.Int +} + +type Fsupplement struct { + FsFileStart c.LongLong + FsBlobStart c.LongLong + FsBlobSize c.SizeT + FsOrigFd c.Int +} + +// DYLD needs to check if the object is allowed to be combined +// into the main binary. This is done between the code signature +// is loaded and dyld is doing all the work to process the LOAD commands. +// +// While this could be done in F_ADDFILESIGS.* family the hook into +// the MAC module doesn't say no when LV isn't enabled and then that +// is cached on the vnode, and the MAC module never gets change once +// a process that library validation enabled. +type Fchecklv struct { + LvFileStart c.LongLong + LvErrorMessageSize c.SizeT + LvErrorMessage unsafe.Pointer +} + +// fgetsigsinfo_t used by F_GETSIGSINFO command +type Fgetsigsinfo struct { + FgFileStart c.LongLong + FgInfoRequest c.Int + FgSigIsPlatform c.Int +} + +type Fstore struct { + FstFlags c.Uint + FstPosmode c.Int + FstOffset c.LongLong + FstLength c.LongLong + FstBytesalloc c.LongLong +} + +// fpunchhole_t used by F_PUNCHHOLE +type Fpunchhole struct { + FpFlags c.Uint + Reserved c.Uint + FpOffset c.LongLong + FpLength c.LongLong +} + +// factive_file_trim_t used by F_TRIM_ACTIVE_FILE +type Ftrimactivefile struct { + FtaOffset c.LongLong + FtaLength c.LongLong +} + +// fspecread_t used by F_SPECULATIVE_READ +type Fspecread struct { + FsrFlags c.Uint + Reserved c.Uint + FsrOffset c.LongLong + FsrLength c.LongLong +} + +type Fattributiontag struct { + FtFlags c.Uint + FtHash c.UlongLong + FtAttributionName [255]c.Char +} + +type FilesecPropertyT c.Uint + +const ( + FILESEC_OWNER FilesecPropertyT = 1 + FILESEC_GROUP FilesecPropertyT = 2 + FILESEC_UUID FilesecPropertyT = 3 + FILESEC_MODE FilesecPropertyT = 4 + FILESEC_ACL FilesecPropertyT = 5 + FILESEC_GRPUUID FilesecPropertyT = 6 + // XXX these are private to the implementation + FILESEC_ACL_RAW FilesecPropertyT = 100 + FILESEC_ACL_ALLOCSIZE FilesecPropertyT = 101 +) + +type FsignaturesT = Fsignatures + +type FsupplementT = Fsupplement + +// DYLD needs to check if the object is allowed to be combined +// into the main binary. This is done between the code signature +// is loaded and dyld is doing all the work to process the LOAD commands. +// +// While this could be done in F_ADDFILESIGS.* family the hook into +// the MAC module doesn't say no when LV isn't enabled and then that +// is cached on the vnode, and the MAC module never gets change once +// a process that library validation enabled. +type FchecklvT = Fchecklv + +// fgetsigsinfo_t used by F_GETSIGSINFO command +type FgetsigsinfoT = Fgetsigsinfo + +type FstoreT = Fstore + +// fpunchhole_t used by F_PUNCHHOLE +type FpunchholeT = Fpunchhole + +// factive_file_trim_t used by F_TRIM_ACTIVE_FILE +type FtrimactivefileT = Ftrimactivefile + +// fspecread_t used by F_SPECULATIVE_READ +type FspecreadT = Fspecread + +type FattributiontagT = Fattributiontag + +// data-protected non-portable open(2) : +// +// int open_dprotected_np(user_addr_t path, int flags, int class, int dpflags, int mode) +// +//go:linkname OpenDprotectedNp C.open_dprotected_np +func OpenDprotectedNp(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 c.Int, __llgo_va_list ...any) c.Int + +//go:linkname OpenatDprotectedNp C.openat_dprotected_np +func OpenatDprotectedNp(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.Int, _llcppg_param4 c.Int, _llcppg_param5 c.Int, __llgo_va_list ...any) c.Int + +//go:linkname OpenatAuthenticatedNp C.openat_authenticated_np +func OpenatAuthenticatedNp(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.Int, _llcppg_param4 c.Int) c.Int + +//go:linkname Flock C.flock +func Flock(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +// Protections are chosen from these bits, or-ed together +const ( + PROT_NONE = 0 + // [MC2] pages can be read + PROT_READ = 1 + // [MC2] pages can be written + PROT_WRITE = 2 + // [MC2] pages can be executed + PROT_EXEC = 4 +) + +// Flags contain sharing type and options. +// Sharing types; choose one. +const ( + MAP_SHARED = 1 + // [MF|SHM] changes are private + MAP_PRIVATE = 2 +) + +// Obsolete +const MAP_COPY = 2 + +// Other flags +const MAP_FIXED = 16 + +const ( + // Sun: rename private pages to file + MAP_RENAME = 32 + // Sun: don't reserve needed swap area + MAP_NORESERVE = 64 + // previously unimplemented MAP_INHERIT + MAP_RESERVED0080 = 128 + // for MAP_FILE, don't change file size + MAP_NOEXTEND = 256 + // region may contain semaphores + MAP_HASSEMAPHORE = 512 + // don't cache pages for this mapping + MAP_NOCACHE = 1024 + // Allocate a region that will be used for JIT purposes + MAP_JIT = 2048 +) + +// Mapping type +const ( + MAP_FILE = 0 + // allocated from memory, swap space + MAP_ANON = 4096 + MAP_ANONYMOUS = 4096 +) + +// The MAP_RESILIENT_* flags can be used when the caller wants to map some +// possibly unreliable memory and be able to access it safely, possibly +// getting the wrong contents rather than raising any exception. +// For safety reasons, such mappings have to be read-only (PROT_READ access +// only). +// +// MAP_RESILIENT_CODESIGN: +// +// accessing this mapping will not generate code-signing violations, +// even if the contents are tainted. +// +// MAP_RESILIENT_MEDIA: +// +// accessing this mapping will not generate an exception if the contents +// are not available (unreachable removable or remote media, access beyond +// end-of-file, ...). Missing contents will be replaced with zeroes. +const ( + MAP_RESILIENT_CODESIGN = 8192 + // no backing-store failures + MAP_RESILIENT_MEDIA = 16384 +) + +// Return virtual addresses <4G only +const MAP_32BIT = 32768 + +// Flags used to support translated processes. +const MAP_TRANSLATED_ALLOW_EXECUTE = 131072 + +// UNIX03 compliance +const MAP_UNIX03 = 262144 + +// Allocate a region that will be protected by TPRO +const MAP_TPRO = 524288 + +// Process memory locking +const ( + MCL_CURRENT = 1 + // [ML] Lock all future memory as well + MCL_FUTURE = 2 +) + +// msync() flags +const ( + MS_ASYNC = 1 + // [MF|SIO] invalidate all cached data + MS_INVALIDATE = 2 + // [MF|SIO] msync synchronously + MS_SYNC = 16 +) + +const ( + // invalidate pages, leave mapped + MS_KILLPAGES = 4 + // deactivate pages, leave mapped + MS_DEACTIVATE = 8 +) + +// Advice to madvise +const ( + POSIX_MADV_NORMAL = 0 + // [MC1] expect random page refs + POSIX_MADV_RANDOM = 1 + // [MC1] expect sequential page refs + POSIX_MADV_SEQUENTIAL = 2 + // [MC1] will need these pages + POSIX_MADV_WILLNEED = 3 + // [MC1] dont need these pages + POSIX_MADV_DONTNEED = 4 +) + +const ( + MADV_NORMAL = 0 + MADV_RANDOM = 1 + MADV_SEQUENTIAL = 2 + MADV_WILLNEED = 3 + MADV_DONTNEED = 4 + // pages unneeded, discard contents + MADV_FREE = 5 + // zero the wired pages that have not been unwired before the entry is deleted + MADV_ZERO_WIRED_PAGES = 6 + // pages can be reused (by anyone) + MADV_FREE_REUSABLE = 7 + // caller wants to reuse those pages + MADV_FREE_REUSE = 8 + MADV_CAN_REUSE = 9 + // page out now (internal only) + MADV_PAGEOUT = 10 +) + +// Return bits from mincore +const ( + MINCORE_INCORE = 1 + // Page has been referenced by us + MINCORE_REFERENCED = 2 + // Page has been modified by us + MINCORE_MODIFIED = 4 + // Page has been referenced + MINCORE_REFERENCED_OTHER = 8 + // Page has been modified + MINCORE_MODIFIED_OTHER = 16 + // Page has been paged out + MINCORE_PAGED_OUT = 32 + // Page has been copied + MINCORE_COPIED = 64 + // Page belongs to an anonymous object + MINCORE_ANONYMOUS = 128 +) + +// [ML] +// +//go:linkname Mlockall C.mlockall +func Mlockall(_llcppg_param1 c.Int) c.Int + +// [MR] +// +//go:linkname Munlockall C.munlockall +func Munlockall() c.Int + +// [MR] +// +//go:linkname Mlock C.mlock +func Mlock(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT) c.Int + +// [MC3] +// +//go:linkname Mmap C.mmap +func Mmap(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 c.Int, _llcppg_param4 c.Int, _llcppg_param5 c.Int, _llcppg_param6 c.LongLong) unsafe.Pointer + +// [MPR] +// +//go:linkname Mprotect C.mprotect +func Mprotect(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 c.Int) c.Int + +// [MF|SIO] +// +//go:linkname Msync C.msync +func Msync(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 c.Int) c.Int + +// [MR] +// +//go:linkname Munlock C.munlock +func Munlock(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT) c.Int + +// [MC3] +// +//go:linkname Munmap C.munmap +func Munmap(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT) c.Int + +// [SHM] +// +//go:linkname ShmOpen C.shm_open +func ShmOpen(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, __llgo_va_list ...any) c.Int + +// [ADV] +// +//go:linkname ShmUnlink C.shm_unlink +func ShmUnlink(_llcppg_param1 *c.Char) c.Int + +// [ADV] +// +//go:linkname PosixMadvise C.posix_madvise +func PosixMadvise(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 c.Int) c.Int + +//go:linkname Madvise C.madvise +func Madvise(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 c.Int) c.Int + +//go:linkname Mincore C.mincore +func Mincore(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 *c.Char) c.Int + +//go:linkname Minherit C.minherit +func Minherit(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 c.Int) c.Int + +// Possible values of the first parameter to getpriority()/setpriority(), +// used to indicate the type of the second parameter. +const ( + PRIO_PROCESS = 0 + // Second argument is a GID + PRIO_PGRP = 1 + // Second argument is a UID + PRIO_USER = 2 +) + +const ( + // Second argument is always 0 (current thread) + PRIO_DARWIN_THREAD = 3 + // Second argument is a PID + PRIO_DARWIN_PROCESS = 4 +) + +// Range limitations for the value of the third parameter to setpriority(). +const ( + PRIO_MIN = -20 + PRIO_MAX = 20 +) + +// use PRIO_DARWIN_BG to set the current thread into "background" state +// which lowers CPU, disk IO, and networking priorites until thread terminates +// or "background" state is revoked +const PRIO_DARWIN_BG = 4096 + +// use PRIO_DARWIN_NONUI to restrict a process's ability to make calls to +// the GPU. (deprecated) +const PRIO_DARWIN_NONUI = 4097 + +// Possible values of the first parameter to getrusage(), used to indicate +// the scope of the information to be returned. +const ( + RUSAGE_SELF = 0 + // Current process' children + RUSAGE_CHILDREN = -1 +) + +// Flavors for proc_pid_rusage(). +const ( + RUSAGE_INFO_V0 = 0 + RUSAGE_INFO_V1 = 1 + RUSAGE_INFO_V2 = 2 + RUSAGE_INFO_V3 = 3 + RUSAGE_INFO_V4 = 4 + RUSAGE_INFO_V5 = 5 + RUSAGE_INFO_V6 = 6 + RUSAGE_INFO_CURRENT = 6 +) + +// Flags for RUSAGE_INFO_V5 +const RU_PROC_RUNS_RESLIDE = 1 + +// Possible values of the first parameter to getrlimit()/setrlimit(), to +// indicate for which resource the operation is being performed. +const ( + RLIMIT_CPU = 0 + // file size + RLIMIT_FSIZE = 1 + // data segment size + RLIMIT_DATA = 2 + // stack size + RLIMIT_STACK = 3 + // core file size + RLIMIT_CORE = 4 + // address space (resident set size) + RLIMIT_AS = 5 +) + +const ( + // source compatibility alias + RLIMIT_RSS = 5 + // locked-in-memory address space + RLIMIT_MEMLOCK = 6 + // number of processes + RLIMIT_NPROC = 7 +) + +// number of open files +const RLIMIT_NOFILE = 8 + +// total number of resource limits +const RLIM_NLIMITS = 9 + +// proc_rlimit_control() +// +// Resource limit flavors +const ( + RLIMIT_WAKEUPS_MONITOR = 1 + // Configure the CPU usage monitor. + RLIMIT_CPU_USAGE_MONITOR = 2 + // Configure a blocking, per-thread, CPU limits. + RLIMIT_THREAD_CPULIMITS = 3 + // Configure memory footprint interval tracking + RLIMIT_FOOTPRINT_INTERVAL = 4 +) + +// Flags for wakeups monitor control. +const ( + WAKEMON_ENABLE = 1 + WAKEMON_DISABLE = 2 + WAKEMON_GET_PARAMS = 4 + WAKEMON_SET_DEFAULTS = 8 + // Configure the task so that violations are fatal. + WAKEMON_MAKE_FATAL = 16 +) + +// Flags for CPU usage monitor control. +const CPUMON_MAKE_FATAL = 4096 + +// Flags for memory footprint interval tracking. +const FOOTPRINT_INTERVAL_RESET = 1 + +// I/O type +const ( + IOPOL_TYPE_DISK = 0 + IOPOL_TYPE_VFS_ATIME_UPDATES = 2 + IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES = 3 + IOPOL_TYPE_VFS_STATFS_NO_DATA_VOLUME = 4 + IOPOL_TYPE_VFS_TRIGGER_RESOLVE = 5 + IOPOL_TYPE_VFS_IGNORE_CONTENT_PROTECTION = 6 + IOPOL_TYPE_VFS_IGNORE_PERMISSIONS = 7 + IOPOL_TYPE_VFS_SKIP_MTIME_UPDATE = 8 + IOPOL_TYPE_VFS_ALLOW_LOW_SPACE_WRITES = 9 + IOPOL_TYPE_VFS_DISALLOW_RW_FOR_O_EVTONLY = 10 +) + +// scope +const ( + IOPOL_SCOPE_PROCESS = 0 + IOPOL_SCOPE_THREAD = 1 + IOPOL_SCOPE_DARWIN_BG = 2 +) + +// I/O Priority +const ( + IOPOL_DEFAULT = 0 + IOPOL_IMPORTANT = 1 + IOPOL_PASSIVE = 2 + IOPOL_THROTTLE = 3 + IOPOL_UTILITY = 4 + IOPOL_STANDARD = 5 +) + +// compatibility with older names +const ( + IOPOL_APPLICATION = 5 + IOPOL_NORMAL = 1 +) + +const ( + IOPOL_ATIME_UPDATES_DEFAULT = 0 + IOPOL_ATIME_UPDATES_OFF = 1 +) + +const ( + IOPOL_MATERIALIZE_DATALESS_FILES_DEFAULT = 0 + IOPOL_MATERIALIZE_DATALESS_FILES_OFF = 1 + IOPOL_MATERIALIZE_DATALESS_FILES_ON = 2 +) + +const ( + IOPOL_VFS_STATFS_NO_DATA_VOLUME_DEFAULT = 0 + IOPOL_VFS_STATFS_FORCE_NO_DATA_VOLUME = 1 +) + +const ( + IOPOL_VFS_TRIGGER_RESOLVE_DEFAULT = 0 + IOPOL_VFS_TRIGGER_RESOLVE_OFF = 1 +) + +const ( + IOPOL_VFS_CONTENT_PROTECTION_DEFAULT = 0 + IOPOL_VFS_CONTENT_PROTECTION_IGNORE = 1 +) + +const ( + IOPOL_VFS_IGNORE_PERMISSIONS_OFF = 0 + IOPOL_VFS_IGNORE_PERMISSIONS_ON = 1 +) + +const ( + IOPOL_VFS_SKIP_MTIME_UPDATE_OFF = 0 + IOPOL_VFS_SKIP_MTIME_UPDATE_ON = 1 +) + +const ( + IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_OFF = 0 + IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_ON = 1 +) + +const ( + IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_DEFAULT = 0 + IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_ON = 1 +) + +const ( + IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_DEFAULT = 0 + IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_ON = 1 +) + +// A structure representing an accounting of resource utilization. The +// address of an instance of this structure is the second parameter to +// getrusage(). +// +// Note: All values other than ru_utime and ru_stime are implementaiton +// +// defined and subject to change in a future release. Their use +// is discouraged for standards compliant programs. +type Rusage struct { + RuUtime llsys.Timeval + RuStime llsys.Timeval + RuMaxrss c.Long + RuIxrss c.Long + RuIdrss c.Long + RuIsrss c.Long + RuMinflt c.Long + RuMajflt c.Long + RuNswap c.Long + RuInblock c.Long + RuOublock c.Long + RuMsgsnd c.Long + RuMsgrcv c.Long + RuNsignals c.Long + RuNvcsw c.Long + RuNivcsw c.Long +} + +type RusageInfoV0 struct { + RiUuid [16]c.Uint8T + RiUserTime c.UlongLong + RiSystemTime c.UlongLong + RiPkgIdleWkups c.UlongLong + RiInterruptWkups c.UlongLong + RiPageins c.UlongLong + RiWiredSize c.UlongLong + RiResidentSize c.UlongLong + RiPhysFootprint c.UlongLong + RiProcStartAbstime c.UlongLong + RiProcExitAbstime c.UlongLong +} + +type RusageInfoV1 struct { + RiUuid [16]c.Uint8T + RiUserTime c.UlongLong + RiSystemTime c.UlongLong + RiPkgIdleWkups c.UlongLong + RiInterruptWkups c.UlongLong + RiPageins c.UlongLong + RiWiredSize c.UlongLong + RiResidentSize c.UlongLong + RiPhysFootprint c.UlongLong + RiProcStartAbstime c.UlongLong + RiProcExitAbstime c.UlongLong + RiChildUserTime c.UlongLong + RiChildSystemTime c.UlongLong + RiChildPkgIdleWkups c.UlongLong + RiChildInterruptWkups c.UlongLong + RiChildPageins c.UlongLong + RiChildElapsedAbstime c.UlongLong +} + +type RusageInfoV2 struct { + RiUuid [16]c.Uint8T + RiUserTime c.UlongLong + RiSystemTime c.UlongLong + RiPkgIdleWkups c.UlongLong + RiInterruptWkups c.UlongLong + RiPageins c.UlongLong + RiWiredSize c.UlongLong + RiResidentSize c.UlongLong + RiPhysFootprint c.UlongLong + RiProcStartAbstime c.UlongLong + RiProcExitAbstime c.UlongLong + RiChildUserTime c.UlongLong + RiChildSystemTime c.UlongLong + RiChildPkgIdleWkups c.UlongLong + RiChildInterruptWkups c.UlongLong + RiChildPageins c.UlongLong + RiChildElapsedAbstime c.UlongLong + RiDiskioBytesread c.UlongLong + RiDiskioByteswritten c.UlongLong +} + +type RusageInfoV3 struct { + RiUuid [16]c.Uint8T + RiUserTime c.UlongLong + RiSystemTime c.UlongLong + RiPkgIdleWkups c.UlongLong + RiInterruptWkups c.UlongLong + RiPageins c.UlongLong + RiWiredSize c.UlongLong + RiResidentSize c.UlongLong + RiPhysFootprint c.UlongLong + RiProcStartAbstime c.UlongLong + RiProcExitAbstime c.UlongLong + RiChildUserTime c.UlongLong + RiChildSystemTime c.UlongLong + RiChildPkgIdleWkups c.UlongLong + RiChildInterruptWkups c.UlongLong + RiChildPageins c.UlongLong + RiChildElapsedAbstime c.UlongLong + RiDiskioBytesread c.UlongLong + RiDiskioByteswritten c.UlongLong + RiCpuTimeQosDefault c.UlongLong + RiCpuTimeQosMaintenance c.UlongLong + RiCpuTimeQosBackground c.UlongLong + RiCpuTimeQosUtility c.UlongLong + RiCpuTimeQosLegacy c.UlongLong + RiCpuTimeQosUserInitiated c.UlongLong + RiCpuTimeQosUserInteractive c.UlongLong + RiBilledSystemTime c.UlongLong + RiServicedSystemTime c.UlongLong +} + +type RusageInfoV4 struct { + RiUuid [16]c.Uint8T + RiUserTime c.UlongLong + RiSystemTime c.UlongLong + RiPkgIdleWkups c.UlongLong + RiInterruptWkups c.UlongLong + RiPageins c.UlongLong + RiWiredSize c.UlongLong + RiResidentSize c.UlongLong + RiPhysFootprint c.UlongLong + RiProcStartAbstime c.UlongLong + RiProcExitAbstime c.UlongLong + RiChildUserTime c.UlongLong + RiChildSystemTime c.UlongLong + RiChildPkgIdleWkups c.UlongLong + RiChildInterruptWkups c.UlongLong + RiChildPageins c.UlongLong + RiChildElapsedAbstime c.UlongLong + RiDiskioBytesread c.UlongLong + RiDiskioByteswritten c.UlongLong + RiCpuTimeQosDefault c.UlongLong + RiCpuTimeQosMaintenance c.UlongLong + RiCpuTimeQosBackground c.UlongLong + RiCpuTimeQosUtility c.UlongLong + RiCpuTimeQosLegacy c.UlongLong + RiCpuTimeQosUserInitiated c.UlongLong + RiCpuTimeQosUserInteractive c.UlongLong + RiBilledSystemTime c.UlongLong + RiServicedSystemTime c.UlongLong + RiLogicalWrites c.UlongLong + RiLifetimeMaxPhysFootprint c.UlongLong + RiInstructions c.UlongLong + RiCycles c.UlongLong + RiBilledEnergy c.UlongLong + RiServicedEnergy c.UlongLong + RiIntervalMaxPhysFootprint c.UlongLong + RiRunnableTime c.UlongLong +} + +type RusageInfoV5 struct { + RiUuid [16]c.Uint8T + RiUserTime c.UlongLong + RiSystemTime c.UlongLong + RiPkgIdleWkups c.UlongLong + RiInterruptWkups c.UlongLong + RiPageins c.UlongLong + RiWiredSize c.UlongLong + RiResidentSize c.UlongLong + RiPhysFootprint c.UlongLong + RiProcStartAbstime c.UlongLong + RiProcExitAbstime c.UlongLong + RiChildUserTime c.UlongLong + RiChildSystemTime c.UlongLong + RiChildPkgIdleWkups c.UlongLong + RiChildInterruptWkups c.UlongLong + RiChildPageins c.UlongLong + RiChildElapsedAbstime c.UlongLong + RiDiskioBytesread c.UlongLong + RiDiskioByteswritten c.UlongLong + RiCpuTimeQosDefault c.UlongLong + RiCpuTimeQosMaintenance c.UlongLong + RiCpuTimeQosBackground c.UlongLong + RiCpuTimeQosUtility c.UlongLong + RiCpuTimeQosLegacy c.UlongLong + RiCpuTimeQosUserInitiated c.UlongLong + RiCpuTimeQosUserInteractive c.UlongLong + RiBilledSystemTime c.UlongLong + RiServicedSystemTime c.UlongLong + RiLogicalWrites c.UlongLong + RiLifetimeMaxPhysFootprint c.UlongLong + RiInstructions c.UlongLong + RiCycles c.UlongLong + RiBilledEnergy c.UlongLong + RiServicedEnergy c.UlongLong + RiIntervalMaxPhysFootprint c.UlongLong + RiRunnableTime c.UlongLong + RiFlags c.UlongLong +} + +type RusageInfoV6 struct { + RiUuid [16]c.Uint8T + RiUserTime c.UlongLong + RiSystemTime c.UlongLong + RiPkgIdleWkups c.UlongLong + RiInterruptWkups c.UlongLong + RiPageins c.UlongLong + RiWiredSize c.UlongLong + RiResidentSize c.UlongLong + RiPhysFootprint c.UlongLong + RiProcStartAbstime c.UlongLong + RiProcExitAbstime c.UlongLong + RiChildUserTime c.UlongLong + RiChildSystemTime c.UlongLong + RiChildPkgIdleWkups c.UlongLong + RiChildInterruptWkups c.UlongLong + RiChildPageins c.UlongLong + RiChildElapsedAbstime c.UlongLong + RiDiskioBytesread c.UlongLong + RiDiskioByteswritten c.UlongLong + RiCpuTimeQosDefault c.UlongLong + RiCpuTimeQosMaintenance c.UlongLong + RiCpuTimeQosBackground c.UlongLong + RiCpuTimeQosUtility c.UlongLong + RiCpuTimeQosLegacy c.UlongLong + RiCpuTimeQosUserInitiated c.UlongLong + RiCpuTimeQosUserInteractive c.UlongLong + RiBilledSystemTime c.UlongLong + RiServicedSystemTime c.UlongLong + RiLogicalWrites c.UlongLong + RiLifetimeMaxPhysFootprint c.UlongLong + RiInstructions c.UlongLong + RiCycles c.UlongLong + RiBilledEnergy c.UlongLong + RiServicedEnergy c.UlongLong + RiIntervalMaxPhysFootprint c.UlongLong + RiRunnableTime c.UlongLong + RiFlags c.UlongLong + RiUserPtime c.UlongLong + RiSystemPtime c.UlongLong + RiPinstructions c.UlongLong + RiPcycles c.UlongLong + RiEnergyNj c.UlongLong + RiPenergyNj c.UlongLong + RiReserved [14]c.UlongLong +} + +// A structure representing a resource limit. The address of an instance +// of this structure is the second parameter to getrlimit()/setrlimit(). +type Rlimit struct { + RlimCur c.UlongLong + RlimMax c.UlongLong +} + +type ProcRlimitControlWakeupmon struct { + WmFlags c.Uint + WmRate c.Int +} + +type RusageInfoT uintptr + +type RusageInfoCurrent = RusageInfoV6 + +//go:linkname Getpriority C.getpriority +func Getpriority(_llcppg_param1 c.Int, _llcppg_param2 c.Uint) c.Int + +//go:linkname GetiopolicyNp C.getiopolicy_np +func GetiopolicyNp(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname Getrusage C.getrusage +func Getrusage(_llcppg_param1 c.Int, _llcppg_param2 *Rusage) c.Int + +//go:linkname Setpriority C.setpriority +func Setpriority(_llcppg_param1 c.Int, _llcppg_param2 c.Uint, _llcppg_param3 c.Int) c.Int + +//go:linkname SetiopolicyNp C.setiopolicy_np +func SetiopolicyNp(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int) c.Int + +// 0777 +const ACCESSPERMS = 511 + +// 7777 +const ALLPERMS = 4095 + +// 0666 +const DEFFILEMODE = 438 + +// block size used in the stat struct +const S_BLKSIZE = 512 + +// Definitions of flags stored in file flags word. +// +// Super-user and owner changeable flags. +const ( + UF_SETTABLE = 65535 + // do not dump file + UF_NODUMP = 1 + // file may not be changed + UF_IMMUTABLE = 2 + // writes to file may only append + UF_APPEND = 4 + // directory is opaque wrt. union + UF_OPAQUE = 8 +) + +// file is compressed (some file-systems) +const UF_COMPRESSED = 32 + +// UF_TRACKED is used for dealing with document IDs. We no longer issue +// +// notifications for deletes or renames for files which have UF_TRACKED set. +const UF_TRACKED = 64 + +// entitlement required for reading +const UF_DATAVAULT = 128 + +// Bits 0x0100 through 0x4000 are currently undefined. +const UF_HIDDEN = 32768 + +// Super-user changeable flags. +const ( + SF_SUPPORTED = 10420224 + // mask of superuser changeable flags + SF_SETTABLE = 1073676288 + // mask of system read-only synthetic flags + SF_SYNTHETIC = 3221225472 + // file is archived + SF_ARCHIVED = 65536 + // file may not be changed + SF_IMMUTABLE = 131072 + // writes to file may only append + SF_APPEND = 262144 + // entitlement required for writing + SF_RESTRICTED = 524288 + // Item may not be removed, renamed or mounted on + SF_NOUNLINK = 1048576 +) + +// file is a firmlink +const SF_FIRMLINK = 8388608 + +// Synthetic flags. +// +// These are read-only. We keep them out of SF_SUPPORTED so that +// attempts to set them will fail. +const SF_DATALESS = 1073741824 + +// Extended flags ("EF") returned by ATTR_CMNEXT_EXT_FLAGS from getattrlist/getattrlistbulk +const ( + EF_MAY_SHARE_BLOCKS = 1 + // file has no xattrs at all + EF_NO_XATTRS = 2 + // file is a sync root for iCloud + EF_IS_SYNC_ROOT = 4 + // file is purgeable + EF_IS_PURGEABLE = 8 + // file has at least one sparse region + EF_IS_SPARSE = 16 + // a synthetic directory/symlink + EF_IS_SYNTHETIC = 32 + // file shares all of its blocks with another file + EF_SHARES_ALL_BLOCKS = 64 +) + +const ( + UTIME_NOW = -1 + UTIME_OMIT = -2 +) + +// XXX So deprecated, it would make your head spin +// +// The old stat structure. In fact, this is not used by the kernel at all, +// and should not be used by user space, and should be removed from this +// header file entirely (along with the unused cvtstat() prototype in +// vnode_internal.h). +type Ostat struct { + StDev c.Uint16T + StIno c.UlongLong + StMode c.Uint16T + StNlink c.Uint16T + StUid c.Uint16T + StGid c.Uint16T + StRdev c.Uint16T + StSize c.Int + StAtimespec lltime.Timespec + StMtimespec lltime.Timespec + StCtimespec lltime.Timespec + StBlksize c.Int + StBlocks c.Int + StFlags c.Uint + StGen c.Uint +} + +//go:linkname Mkdirat C.mkdirat +func Mkdirat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.Uint16T) c.Int + +//go:linkname Mkfifoat C.mkfifoat +func Mkfifoat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.Uint16T) c.Int + +//go:linkname Mknodat C.mknodat +func Mknodat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.Uint16T, _llcppg_param4 c.Int) c.Int + +//go:linkname Futimens C.futimens +func Futimens(__fd c.Int, __times *lltime.Timespec) c.Int + +//go:linkname Utimensat C.utimensat +func Utimensat(__fd c.Int, __path *c.Char, __times *lltime.Timespec, __flag c.Int) c.Int + +//go:linkname Chflags C.chflags +func Chflags(_llcppg_param1 *c.Char, _llcppg_param2 c.Uint) c.Int + +//go:linkname Fchflags C.fchflags +func Fchflags(_llcppg_param1 c.Int, _llcppg_param2 c.Uint) c.Int + +//go:linkname Lchflags C.lchflags +func Lchflags(_llcppg_param1 *c.Char, _llcppg_param2 c.Uint) c.Int + +//go:linkname Lchmod C.lchmod +func Lchmod(_llcppg_param1 *c.Char, _llcppg_param2 c.Uint16T) c.Int + +// Defined bits for f_flag field value +const ( + ST_RDONLY = 1 + // Does not honor setuid/setgid + ST_NOSUID = 2 +) + +// Following structure is used as a statvfs/fstatvfs function parameter +type Statvfs struct { + FBsize c.Ulong + FFrsize c.Ulong + FBlocks c.Uint + FBfree c.Uint + FBavail c.Uint + FFiles c.Uint + FFfree c.Uint + FFavail c.Uint + FFsid c.Ulong + FFlag c.Ulong + FNamemax c.Ulong +} + +//go:linkname Fstatvfs C.fstatvfs +func Fstatvfs(_llcppg_param1 c.Int, _llcppg_param2 *Statvfs) c.Int + +// Special Control Characters +// +// Index into c_cc[] character array. +// +// Name Subscript Enabled by +const ( + VEOF = 0 + // ICANON + VEOL = 1 +) + +// ICANON together with IEXTEN +const VEOL2 = 2 + +// ICANON +const VERASE = 3 + +// ICANON together with IEXTEN +const VWERASE = 4 + +// ICANON +const VKILL = 5 + +// ICANON together with IEXTEN +const VREPRINT = 6 + +// 7 spare 1 +const ( + VINTR = 8 + // ISIG + VQUIT = 9 + // ISIG + VSUSP = 10 +) + +// ISIG together with IEXTEN +const VDSUSP = 11 + +const ( + // IXON, IXOFF + VSTART = 12 + // IXON, IXOFF + VSTOP = 13 +) + +const ( + // IEXTEN + VLNEXT = 14 + // IEXTEN + VDISCARD = 15 +) + +const ( + // !ICANON + VMIN = 16 + // !ICANON + VTIME = 17 +) + +// ICANON together with IEXTEN +const VSTATUS = 18 + +const NCCS = 20 + +// Input flags - software input processing +const ( + IGNBRK = 1 + // map BREAK to SIGINTR + BRKINT = 2 + // ignore (discard) parity errors + IGNPAR = 4 + // mark parity and framing errors + PARMRK = 8 + // enable checking of parity errors + INPCK = 16 + // strip 8th bit off chars + ISTRIP = 32 + // map NL into CR + INLCR = 64 + // ignore CR + IGNCR = 128 + // map CR to NL (ala CRMOD) + ICRNL = 256 + // enable output flow control + IXON = 512 + // enable input flow control + IXOFF = 1024 + // any char will restart after stop + IXANY = 2048 +) + +const ( + // ring bell on input queue full + IMAXBEL = 8192 + // maintain state for UTF-8 VERASE + IUTF8 = 16384 +) + +// Output flags - software output processing +const ( + OPOST = 1 + // map NL to CR-NL (ala CRMOD) + ONLCR = 2 +) + +const ( + // expand tabs to spaces + OXTABS = 4 + // discard EOT's (^D) on output) + ONOEOT = 8 +) + +// The following block of features is unimplemented. Use of these flags in +// programs will currently result in unexpected behaviour. +// +// - Begin unimplemented features +const ( + OCRNL = 16 + // no CR output at column 0 + ONOCR = 32 + // NL performs CR function + ONLRET = 64 + // use fill characters for delay + OFILL = 128 + // \n delay + NLDLY = 768 + // horizontal tab delay + TABDLY = 3076 + // \r delay + CRDLY = 12288 + // form feed delay + FFDLY = 16384 + // \b delay + BSDLY = 32768 + // vertical tab delay + VTDLY = 65536 + // fill is DEL, else NUL + OFDEL = 131072 +) + +// These manifest constants have the same names as those in the header +// , so you are not permitted to have both definitions +// in scope simultaneously in the same compilation unit. Nevertheless, +// they are required to be in scope when _POSIX_C_SOURCE is requested; +// this means that including the header before this +// one when _POSIX_C_SOURCE is in scope will result in redefintions. We +// attempt to maintain these as the same values so as to avoid this being +// an outright error in most compilers. +const ( + NL0 = 0 + NL1 = 256 +) + +const ( + NL2 = 512 + NL3 = 768 +) + +// not in sys/ioctl_compat.h, use OXTABS value +const ( + TAB0 = 0 + TAB1 = 1024 + TAB2 = 2048 +) + +// not in sys/ioctl_compat.h, use OXTABS value +const ( + TAB3 = 4 + CR0 = 0 + CR1 = 4096 + CR2 = 8192 + CR3 = 12288 + FF0 = 0 + FF1 = 16384 + BS0 = 0 + BS1 = 32768 + VT0 = 0 + VT1 = 65536 +) + +// ignore control flags +const CIGNORE = 1 + +const ( + // character size mask + CSIZE = 768 + // 5 bits (pseudo) + CS5 = 0 + // 6 bits + CS6 = 256 + // 7 bits + CS7 = 512 + // 8 bits + CS8 = 768 + // send 2 stop bits + CSTOPB = 1024 + // enable receiver + CREAD = 2048 + // parity enable + PARENB = 4096 + // odd parity, else even + PARODD = 8192 + // hang up on last close + HUPCL = 16384 + // ignore modem status lines + CLOCAL = 32768 +) + +const ( + // CTS flow control of output + CCTS_OFLOW = 65536 + // RTS flow control of input + CRTS_IFLOW = 131072 + // DTR flow control of input + CDTR_IFLOW = 262144 + // DSR flow control of output + CDSR_OFLOW = 524288 + // DCD flow control of output + CCAR_OFLOW = 1048576 + // old name for CCAR_OFLOW + MDMBUF = 1048576 +) + +// visual erase for line kill +const ECHOKE = 1 + +const ( + // visually erase chars + ECHOE = 2 + // echo NL after line kill + ECHOK = 4 + // enable echoing + ECHO = 8 + // echo NL even if ECHO is off + ECHONL = 16 +) + +const ( + // visual erase mode for hardcopy + ECHOPRT = 32 + // echo control chars as ^(Char) + ECHOCTL = 64 +) + +const ( + // enable signals INTR, QUIT, [D]SUSP + ISIG = 128 + // canonicalize input lines + ICANON = 256 +) + +// use alternate WERASE algorithm +const ALTWERASE = 512 + +// enable DISCARD and LNEXT +const IEXTEN = 1024 + +// external processing +const EXTPROC = 2048 + +// stop background jobs from output +const TOSTOP = 4194304 + +const ( + // output being flushed (state) + FLUSHO = 8388608 + // no kernel output from VSTATUS + NOKERNINFO = 33554432 + // XXX retype pending input (state) + PENDIN = 536870912 +) + +// don't flush after interrupt +const NOFLSH = 2147483648 + +// Commands passed to tcsetattr() for setting the termios structure. +const ( + TCSANOW = 0 + // drain output, then change + TCSADRAIN = 1 + // drain output, flush input + TCSAFLUSH = 2 +) + +// flag - don't alter h.w. state +const TCSASOFT = 16 + +// Standard speeds +const ( + B0 = 0 + B50 = 50 + B75 = 75 + B110 = 110 + B134 = 134 + B150 = 150 + B200 = 200 + B300 = 300 + B600 = 600 + B1200 = 1200 + B1800 = 1800 + B2400 = 2400 + B4800 = 4800 + B9600 = 9600 + B19200 = 19200 + B38400 = 38400 +) + +const ( + B7200 = 7200 + B14400 = 14400 + B28800 = 28800 + B57600 = 57600 + B76800 = 76800 + B115200 = 115200 + B230400 = 230400 + EXTA = 19200 + EXTB = 38400 +) + +const ( + TCIFLUSH = 1 + TCOFLUSH = 2 + TCIOFLUSH = 3 + TCOOFF = 1 + TCOON = 2 + TCIOFF = 3 + TCION = 4 +) + +type Termios struct { + CIflag c.Ulong + COflag c.Ulong + CCflag c.Ulong + CLflag c.Ulong + CCc [20]c.Uint8T + CIspeed c.Ulong + COspeed c.Ulong +} + +// llgo:link (*Termios).Cfgetispeed C.cfgetispeed +func (self *Termios) Cfgetispeed() c.Ulong { + return 0 +} + +// llgo:link (*Termios).Cfgetospeed C.cfgetospeed +func (self *Termios) Cfgetospeed() c.Ulong { + return 0 +} + +// llgo:link (*Termios).Cfsetispeed C.cfsetispeed +func (self *Termios) Cfsetispeed(_llcppg_param2 c.Ulong) c.Int { + return 0 +} + +// llgo:link (*Termios).Cfsetospeed C.cfsetospeed +func (self *Termios) Cfsetospeed(_llcppg_param2 c.Ulong) c.Int { + return 0 +} + +//go:linkname Tcgetattr C.tcgetattr +func Tcgetattr(_llcppg_param1 c.Int, _llcppg_param2 *Termios) c.Int + +//go:linkname Tcsetattr C.tcsetattr +func Tcsetattr(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 *Termios) c.Int + +//go:linkname Tcdrain C.tcdrain +func Tcdrain(_llcppg_param1 c.Int) c.Int + +//go:linkname Tcflow C.tcflow +func Tcflow(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname Tcflush C.tcflush +func Tcflush(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname Tcsendbreak C.tcsendbreak +func Tcsendbreak(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +// llgo:link (*Termios).Cfmakeraw C.cfmakeraw +func (self *Termios) Cfmakeraw() { +} + +// llgo:link (*Termios).Cfsetspeed C.cfsetspeed +func (self *Termios) Cfsetspeed(_llcppg_param2 c.Ulong) c.Int { + return 0 +} + +// [XSI] Structure whose address is passed as the first parameter to times() +type Tms struct { + TmsUtime c.Ulong + TmsStime c.Ulong + TmsCutime c.Ulong + TmsCstime c.Ulong +} + +// llgo:link (*Tms).Times C.times +func (self *Tms) Times() c.Ulong { + return 0 +} + +const NBBY = 8 + +type QaddrT = *c.LongLong + +// IO direction for uio_t. +// +// UIO_READ - data moves into iovec(s) associated with uio_t +// UIO_WRITE - data moves out of iovec(s) associated with uio_t +type UioRw c.Uint + +const ( + // IO direction for uio_t. + // UIO_READ - data moves into iovec(s) associated with uio_t + // UIO_WRITE - data moves out of iovec(s) associated with uio_t + UIO_READ UioRw = 0 + // IO direction for uio_t. + // UIO_READ - data moves into iovec(s) associated with uio_t + // UIO_WRITE - data moves out of iovec(s) associated with uio_t + UIO_WRITE UioRw = 1 +) + +//go:linkname Readv C.readv +func Readv(_llcppg_param1 c.Int, _llcppg_param2 *c.Iovec, _llcppg_param3 c.Int) c.SsizeT + +//go:linkname Writev C.writev +func Writev(_llcppg_param1 c.Int, _llcppg_param2 *c.Iovec, _llcppg_param3 c.Int) c.SsizeT + +//go:linkname Preadv C.preadv +func Preadv(_llcppg_param1 c.Int, _llcppg_param2 *c.Iovec, _llcppg_param3 c.Int, _llcppg_param4 c.LongLong) c.SsizeT + +//go:linkname Pwritev C.pwritev +func Pwritev(_llcppg_param1 c.Int, _llcppg_param2 *c.Iovec, _llcppg_param3 c.Int, _llcppg_param4 c.LongLong) c.SsizeT + +type AccessxDescriptor struct { + AdNameOffset c.Uint + AdFlags c.Int + AdPad [2]c.Int +} + +type Utsname struct { + Sysname [256]c.Char + Nodename [256]c.Char + Release [256]c.Char + Version [256]c.Char + Machine [256]c.Char +} + +// llgo:link (*Utsname).Uname C.uname +func (self *Utsname) Uname() c.Int { + return 0 +} + +// Option bits for the third argument of wait4. WNOHANG causes the +// wait to not hang if there are no stopped or terminated processes, rather +// returning an error indication in this case (pid==0). WUNTRACED +// indicates that the caller should receive status about untraced children +// which stop due to signals. If children are stopped and a wait without +// this option is done, it is as though they were still running... nothing +// about them is returned. +const ( + WNOHANG = 1 + // [XSI] notify on stop, untraced child + WUNTRACED = 2 +) + +const WCOREFLAG = 128 + +// WUNTRACED defined for wait4() but not for waitid() +const WEXITED = 4 + +// waitid() parameter +const WSTOPPED = 8 + +const ( + // [XSI] Any child stopped then continued + WCONTINUED = 16 + // [XSI] Leave process returned waitable + WNOWAIT = 32 +) + +// Tokens for special values of the "pid" parameter to wait4. +const ( + WAIT_ANY = -1 + // any process in my process group + WAIT_MYPGRP = 0 +) + +// [XSI] The type idtype_t shall be defined as an enumeration type whose +// possible values shall include at least P_ALL, P_PID, and P_PGID. +type IdtypeT c.Uint + +const ( + P_ALL IdtypeT = 0 + P_PID IdtypeT = 1 + P_PGID IdtypeT = 2 +) + +// llgo:link IdtypeT.Waitid C.waitid +func (self IdtypeT) Waitid(_llcppg_param2 c.Uint, _llcppg_param3 *llsignal.SiginfoT, _llcppg_param4 c.Int) c.Int { + return 0 +} + +//go:linkname Tcgetsid C.tcgetsid +func Tcgetsid(_llcppg_param1 c.Int) c.Int + +const ( + // standard input file descriptor + STDIN_FILENO = 0 + // standard output file descriptor + STDOUT_FILENO = 1 + // standard error file descriptor + STDERR_FILENO = 2 +) + +// These F_* are really XSI or Issue 6 +const ( + F_ULOCK = 0 + // lock a section for exclusive use + F_LOCK = 1 + // test and lock a section for exclusive use + F_TLOCK = 2 + // test a section for locks by other procs + F_TEST = 3 +) + +const ( + // Flush data and metadata to platter, not just to disk cache + SYNC_VOLUME_FULLSYNC = 1 + // Wait for sync to complete + SYNC_VOLUME_WAIT = 2 +) + +//go:linkname X_exit C._exit +func X_exit(_llcppg_param1 c.Int) + +//go:linkname Access C.access +func Access(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + +//go:linkname Alarm C.alarm +func Alarm(_llcppg_param1 c.Uint) c.Uint + +//go:linkname Fpathconf C.fpathconf +func Fpathconf(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Long + +//go:linkname Getgroups C.getgroups +func Getgroups(_llcppg_param1 c.Int, _llcppg_param2 *c.Uint) c.Int + +//go:linkname Getlogin C.getlogin +func Getlogin() *c.Char + +//go:linkname Getpgrp C.getpgrp +func Getpgrp() c.Int + +//go:linkname Pathconf C.pathconf +func Pathconf(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Long + +//go:linkname Pause C.pause +func Pause() c.Int + +//go:linkname Setgid C.setgid +func Setgid(_llcppg_param1 c.Uint) c.Int + +//go:linkname Setpgid C.setpgid +func Setpgid(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname Setsid C.setsid +func Setsid() c.Int + +//go:linkname Setuid C.setuid +func Setuid(_llcppg_param1 c.Uint) c.Int + +//go:linkname Sleep C.sleep +func Sleep(_llcppg_param1 c.Uint) c.Uint + +//go:linkname Sysconf C.sysconf +func Sysconf(_llcppg_param1 c.Int) c.Long + +//go:linkname Tcgetpgrp C.tcgetpgrp +func Tcgetpgrp(_llcppg_param1 c.Int) c.Int + +//go:linkname Tcsetpgrp C.tcsetpgrp +func Tcsetpgrp(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname Ttyname C.ttyname +func Ttyname(_llcppg_param1 c.Int) *c.Char + +//go:linkname TtynameR C.ttyname_r +func TtynameR(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.SizeT) c.Int + +//go:linkname Confstr C.confstr +func Confstr(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.SizeT) c.SizeT + +//go:linkname Getopt C.getopt +func Getopt(_llcppg_param1 c.Int, _llcppg_param2 **c.Char, _llcppg_param3 *c.Char) c.Int + +// getopt(3) external variables +// +//go:linkname Optarg C.optarg +var Optarg *c.Char + +//go:linkname Optind C.optind +var Optind c.Int + +//go:linkname Opterr C.opterr +var Opterr c.Int + +//go:linkname Optopt C.optopt +var Optopt c.Int + +//go:linkname Brk C.brk +func Brk(_llcppg_param1 unsafe.Pointer) unsafe.Pointer + +//go:linkname Crypt C.crypt +func Crypt(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char) *c.Char + +//go:linkname Encrypt C.encrypt +func Encrypt(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) + +//go:linkname Gethostid C.gethostid +func Gethostid() c.Long + +//go:linkname Getpgid C.getpgid +func Getpgid(_llcppg_param1 c.Int) c.Int + +//go:linkname Getsid C.getsid +func Getsid(_llcppg_param1 c.Int) c.Int + +//go:linkname Getdtablesize C.getdtablesize +func Getdtablesize() c.Int + +//go:linkname Getpagesize C.getpagesize +func Getpagesize() c.Int + +//go:linkname Getpass C.getpass +func Getpass(_llcppg_param1 *c.Char) *c.Char + +// obsoleted by getcwd() +// +//go:linkname Getwd C.getwd +func Getwd(_llcppg_param1 *c.Char) *c.Char + +//go:linkname Lockf C.lockf +func Lockf(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.LongLong) c.Int + +//go:linkname Nice C.nice +func Nice(_llcppg_param1 c.Int) c.Int + +//go:linkname Pread C.pread +func Pread(__fd c.Int, __buf unsafe.Pointer, __nbyte c.SizeT, __offset c.LongLong) c.SsizeT + +//go:linkname Pwrite C.pwrite +func Pwrite(__fd c.Int, __buf unsafe.Pointer, __nbyte c.SizeT, __offset c.LongLong) c.SsizeT + +//go:linkname Sbrk C.sbrk +func Sbrk(_llcppg_param1 c.Int) unsafe.Pointer + +//go:linkname Setpgrp C.setpgrp +func Setpgrp() c.Int + +//go:linkname Setregid C.setregid +func Setregid(_llcppg_param1 c.Uint, _llcppg_param2 c.Uint) c.Int + +//go:linkname Setreuid C.setreuid +func Setreuid(_llcppg_param1 c.Uint, _llcppg_param2 c.Uint) c.Int + +//go:linkname Sync C.sync +func Sync() + +//go:linkname Ualarm C.ualarm +func Ualarm(_llcppg_param1 c.Uint, _llcppg_param2 c.Uint) c.Uint + +//go:linkname Usleep C.usleep +func Usleep(_llcppg_param1 c.Uint) c.Int + +// End XSI +// +//go:linkname Vfork C.vfork +func Vfork() c.Int + +//go:linkname GetloginR C.getlogin_r +func GetloginR(_llcppg_param1 *c.Char, _llcppg_param2 c.SizeT) c.Int + +//go:linkname Gethostname C.gethostname +func Gethostname(_llcppg_param1 *c.Char, _llcppg_param2 c.SizeT) c.Int + +//go:linkname Setegid C.setegid +func Setegid(_llcppg_param1 c.Uint) c.Int + +//go:linkname Seteuid C.seteuid +func Seteuid(_llcppg_param1 c.Uint) c.Int + +// llgo:link (*AccessxDescriptor).AccessxNp C.accessx_np +func (self *AccessxDescriptor) AccessxNp(_llcppg_param2 c.SizeT, _llcppg_param3 *c.Int, _llcppg_param4 c.Uint) c.Int { + return 0 +} + +//go:linkname Acct C.acct +func Acct(_llcppg_param1 *c.Char) c.Int + +//go:linkname Endusershell C.endusershell +func Endusershell() + +//go:linkname ExecvP C.execvP +func ExecvP(__file *c.Char, __searchpath *c.Char, __argv **c.Char) c.Int + +//go:linkname Fflagstostr C.fflagstostr +func Fflagstostr(_llcppg_param1 c.Ulong) *c.Char + +//go:linkname Getdomainname C.getdomainname +func Getdomainname(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + +//go:linkname Getgrouplist C.getgrouplist +func Getgrouplist(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 *c.Int, _llcppg_param4 *c.Int) c.Int + +//go:linkname Getmode C.getmode +func Getmode(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Uint16T) c.Uint16T + +//go:linkname Getpeereid C.getpeereid +func Getpeereid(_llcppg_param1 c.Int, _llcppg_param2 *c.Uint, _llcppg_param3 *c.Uint) c.Int + +//go:linkname GetsgroupsNp C.getsgroups_np +func GetsgroupsNp(_llcppg_param1 *c.Int, _llcppg_param2 UuidT) c.Int + +//go:linkname Getusershell C.getusershell +func Getusershell() *c.Char + +//go:linkname GetwgroupsNp C.getwgroups_np +func GetwgroupsNp(_llcppg_param1 *c.Int, _llcppg_param2 UuidT) c.Int + +//go:linkname Initgroups C.initgroups +func Initgroups(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + +//go:linkname Issetugid C.issetugid +func Issetugid() c.Int + +//go:linkname Mkdtemp C.mkdtemp +func Mkdtemp(_llcppg_param1 *c.Char) *c.Char + +// returns errno +// +//go:linkname MkpathNp C.mkpath_np +func MkpathNp(path *c.Char, omode c.Uint16T) c.Int + +//go:linkname MkpathatNp C.mkpathat_np +func MkpathatNp(dfd c.Int, path *c.Char, omode c.Uint16T) c.Int + +//go:linkname Mkstemps C.mkstemps +func Mkstemps(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + +//go:linkname Mkostemp C.mkostemp +func Mkostemp(path *c.Char, oflags c.Int) c.Int + +// Non-portable mkstemp that uses open_dprotected_np +// +//go:linkname Mkostemps C.mkostemps +func Mkostemps(path *c.Char, slen c.Int, oflags c.Int) c.Int + +// Non-portable mkstemp that uses open_dprotected_np +// +//go:linkname MkstempDprotectedNp C.mkstemp_dprotected_np +func MkstempDprotectedNp(path *c.Char, dpclass c.Int, dpflags c.Int) c.Int + +//go:linkname MkdtempatNp C.mkdtempat_np +func MkdtempatNp(dfd c.Int, path *c.Char) *c.Char + +//go:linkname MkstempsatNp C.mkstempsat_np +func MkstempsatNp(dfd c.Int, path *c.Char, slen c.Int) c.Int + +//go:linkname MkostempsatNp C.mkostempsat_np +func MkostempsatNp(dfd c.Int, path *c.Char, slen c.Int, oflags c.Int) c.Int + +//go:linkname Nfssvc C.nfssvc +func Nfssvc(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer) c.Int + +//go:linkname Reboot C.reboot +func Reboot(_llcppg_param1 c.Int) c.Int + +//go:linkname Revoke C.revoke +func Revoke(_llcppg_param1 *c.Char) c.Int + +//go:linkname Rcmd C.rcmd +func Rcmd(_llcppg_param1 **c.Char, _llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char, _llcppg_param5 *c.Char, _llcppg_param6 *c.Int) c.Int + +//go:linkname RcmdAf C.rcmd_af +func RcmdAf(_llcppg_param1 **c.Char, _llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char, _llcppg_param5 *c.Char, _llcppg_param6 *c.Int, _llcppg_param7 c.Int) c.Int + +//go:linkname Rresvport C.rresvport +func Rresvport(_llcppg_param1 *c.Int) c.Int + +//go:linkname RresvportAf C.rresvport_af +func RresvportAf(_llcppg_param1 *c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname Iruserok C.iruserok +func Iruserok(_llcppg_param1 c.Ulong, _llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char) c.Int + +//go:linkname IruserokSa C.iruserok_sa +func IruserokSa(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 *c.Char, _llcppg_param5 *c.Char) c.Int + +//go:linkname Ruserok C.ruserok +func Ruserok(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char) c.Int + +//go:linkname Setdomainname C.setdomainname +func Setdomainname(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + +//go:linkname Setgroups C.setgroups +func Setgroups(_llcppg_param1 c.Int, _llcppg_param2 *c.Uint) c.Int + +//go:linkname Sethostid C.sethostid +func Sethostid(_llcppg_param1 c.Long) + +//go:linkname Sethostname C.sethostname +func Sethostname(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + +//go:linkname Setlogin C.setlogin +func Setlogin(_llcppg_param1 *c.Char) c.Int + +//go:linkname Setmode C.setmode +func Setmode(_llcppg_param1 *c.Char) unsafe.Pointer + +//go:linkname Setrgid C.setrgid +func Setrgid(_llcppg_param1 c.Uint) c.Int + +//go:linkname Setruid C.setruid +func Setruid(_llcppg_param1 c.Uint) c.Int + +//go:linkname SetsgroupsNp C.setsgroups_np +func SetsgroupsNp(_llcppg_param1 c.Int, _llcppg_param2 UuidT) c.Int + +//go:linkname Setusershell C.setusershell +func Setusershell() + +//go:linkname SetwgroupsNp C.setwgroups_np +func SetwgroupsNp(_llcppg_param1 c.Int, _llcppg_param2 UuidT) c.Int + +//go:linkname Strtofflags C.strtofflags +func Strtofflags(_llcppg_param1 **c.Char, _llcppg_param2 *c.Ulong, _llcppg_param3 *c.Ulong) c.Int + +//go:linkname Swapon C.swapon +func Swapon(_llcppg_param1 *c.Char) c.Int + +//go:linkname Ttyslot C.ttyslot +func Ttyslot() c.Int + +//go:linkname Undelete C.undelete +func Undelete(_llcppg_param1 *c.Char) c.Int + +//go:linkname Fgetattrlist C.fgetattrlist +func Fgetattrlist(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.SizeT, _llcppg_param5 c.Uint) c.Int + +//go:linkname Fsetattrlist C.fsetattrlist +func Fsetattrlist(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.SizeT, _llcppg_param5 c.Uint) c.Int + +//go:linkname Getattrlist C.getattrlist +func Getattrlist(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.SizeT, _llcppg_param5 c.Uint) c.Int + +//go:linkname Setattrlist C.setattrlist +func Setattrlist(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.SizeT, _llcppg_param5 c.Uint) c.Int + +//go:linkname Exchangedata C.exchangedata +func Exchangedata(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char, _llcppg_param3 c.Uint) c.Int + +//go:linkname Getdirentriesattr C.getdirentriesattr +func Getdirentriesattr(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.SizeT, _llcppg_param5 *c.Uint, _llcppg_param6 *c.Uint, _llcppg_param7 *c.Uint, _llcppg_param8 c.Uint) c.Int + +//go:linkname Fsctl C.fsctl +func Fsctl(_llcppg_param1 *c.Char, _llcppg_param2 c.Ulong, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.Uint) c.Int + +//go:linkname Ffsctl C.ffsctl +func Ffsctl(_llcppg_param1 c.Int, _llcppg_param2 c.Ulong, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.Uint) c.Int + +//go:linkname FsyncVolumeNp C.fsync_volume_np +func FsyncVolumeNp(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname SyncVolumeNp C.sync_volume_np +func SyncVolumeNp(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + +//go:linkname Optreset C.optreset +var Optreset c.Int + +type Utimbuf struct { + Actime c.Long + Modtime c.Long +} + +//go:linkname Utime C.utime +func Utime(_llcppg_param1 *c.Char, _llcppg_param2 *Utimbuf) c.Int diff --git a/c/os/libc_linux_amd64.go b/c/os/libc_linux_amd64.go new file mode 100644 index 00000000..f4a49da1 --- /dev/null +++ b/c/os/libc_linux_amd64.go @@ -0,0 +1,1656 @@ +//go:build linux && amd64 && !android + +// Code generated by llcppg; DO NOT EDIT. +// Classified from the common libc binding. + +package os + +import ( + "github.com/goplus/lib/c" + llsignal "github.com/goplus/lib/c/signal" + llsys "github.com/goplus/lib/c/sys" + lltime "github.com/goplus/lib/c/time" + "unsafe" +) + +type FlockT struct { + LType int16 + LWhence int16 + LStart c.Long + LLen c.Long + LPid c.Int +} + +// The purpose of all the unions is to have the kernel-compatible layout +// while keeping the API type as 'long int', and among machines where +// __syscall_slong_t is not 'long int', this only does the right thing +// for little-endian ones, like x32. +type Rusage struct { + RuUtime llsys.Timeval + RuStime llsys.Timeval + _llcppg_anon_8 + _llcppg_anon_9 + _llcppg_anon_10 + _llcppg_anon_11 + _llcppg_anon_12 + _llcppg_anon_13 + _llcppg_anon_14 + _llcppg_anon_15 + _llcppg_anon_16 + _llcppg_anon_17 + _llcppg_anon_18 + _llcppg_anon_19 + _llcppg_anon_20 + _llcppg_anon_21 +} + +type _llcppg_anon_8 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_9 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_10 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_11 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_12 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_13 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_14 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_15 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_16 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_17 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_18 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_19 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_20 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_21 struct { + _xgo_union [1]uint64 +} + +func (p *_llcppg_anon_8) XGof_ref_ru_maxrss() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_8) XGof_ref___ru_maxrss_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_9) XGof_ref_ru_ixrss() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_9) XGof_ref___ru_ixrss_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_10) XGof_ref_ru_idrss() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_10) XGof_ref___ru_idrss_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_11) XGof_ref_ru_isrss() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_11) XGof_ref___ru_isrss_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_12) XGof_ref_ru_minflt() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_12) XGof_ref___ru_minflt_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_13) XGof_ref_ru_majflt() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_13) XGof_ref___ru_majflt_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_14) XGof_ref_ru_nswap() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_14) XGof_ref___ru_nswap_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_15) XGof_ref_ru_inblock() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_15) XGof_ref___ru_inblock_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_16) XGof_ref_ru_oublock() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_16) XGof_ref___ru_oublock_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_17) XGof_ref_ru_msgsnd() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_17) XGof_ref___ru_msgsnd_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_18) XGof_ref_ru_msgrcv() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_18) XGof_ref___ru_msgrcv_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_19) XGof_ref_ru_nsignals() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_19) XGof_ref___ru_nsignals_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_20) XGof_ref_ru_nvcsw() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_20) XGof_ref___ru_nvcsw_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_21) XGof_ref_ru_nivcsw() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_21) XGof_ref___ru_nivcsw_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +// The official definition. +type SchedParam struct { + X__SchedPriority c.Int +} + +type Statvfs struct { + FBsize c.Ulong + FFrsize c.Ulong + FBlocks c.Ulong + FBfree c.Ulong + FBavail c.Ulong + FFiles c.Ulong + FFfree c.Ulong + FFavail c.Ulong + FFsid c.Ulong + FFlag c.Ulong + FNamemax c.Ulong + X__FSpare [6]c.Int +} + +type Termios struct { + CIflag c.Uint + COflag c.Uint + CCflag c.Uint + CLflag c.Uint + CLine c.Uint8T + CCc [32]c.Uint8T + CIspeed c.Uint + COspeed c.Uint +} + +type X__FsidT struct { + X__Val [2]c.Int +} + +type X__CaddrT = *c.Char + +const MAXNAMLEN = 255 + +// File types for `d_type'. +const ( + DT_UNKNOWN = 0 + DT_FIFO = 1 + DT_CHR = 2 + DT_DIR = 4 + DT_BLK = 6 + DT_REG = 8 + DT_LNK = 10 + DT_SOCK = 12 + DT_WHT = 14 +) + +// llgo:link (*DIR).ReaddirR C.readdir_r +func (self *DIR) ReaddirR(__entry *Dirent, __result **Dirent) c.Int { + return 0 +} + +// Rewind DIRP to the beginning of the directory. +// +// llgo:link (*DIR).Rewinddir C.rewinddir +func (self *DIR) Rewinddir() { +} + +// Seek to position POS on DIRP. +// +// llgo:link (*DIR).Seekdir C.seekdir +func (self *DIR) Seekdir(__pos c.Long) { +} + +// Return the current position of DIRP. +// +// llgo:link (*DIR).Telldir C.telldir +func (self *DIR) Telldir() c.Long { + return 0 +} + +// Return the file descriptor used by DIRP. +// +// llgo:link (*DIR).Dirfd C.dirfd +func (self *DIR) Dirfd() c.Int { + return 0 +} + +//go:linkname Scandir C.scandir +func Scandir(__dir *c.Char, __namelist ***Dirent, __selector func(_llcppg_param1 *Dirent) c.Int, __cmp func(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int) c.Int + +//go:linkname Alphasort C.alphasort +func Alphasort(__e1 **Dirent, __e2 **Dirent) c.Int + +//go:linkname Getdirentries C.getdirentries +func Getdirentries(__fd c.Int, __buf *c.Char, __nbytes c.SizeT, __basep *c.Long) c.Long + +// Open the shared object c.FILE and map it in; return a handle that can be +// passed to `dlsym' to get symbol values from it. +// +//go:linkname Dlopen C.dlopen +func Dlopen(__file *c.Char, __mode c.Int) unsafe.Pointer + +// Unmap and close a shared object opened by `dlopen'. +// The handle cannot be used again after calling `dlclose'. +// +//go:linkname Dlclose C.dlclose +func Dlclose(__handle unsafe.Pointer) c.Int + +// Find the run-time address in the shared object HANDLE refers to +// of the symbol called NAME. +// +//go:linkname Dlsym C.dlsym +func Dlsym(__handle unsafe.Pointer, __name *c.Char) unsafe.Pointer + +// When any of the above functions fails, call this function +// to return a string describing the error. Each call resets +// the error string so that a following call returns null. +// +//go:linkname Dlerror C.dlerror +func Dlerror() *c.Char + +const ( + S_IFMT = 61440 + S_IFDIR = 16384 + S_IFCHR = 8192 + S_IFBLK = 24576 + S_IFREG = 32768 +) + +const S_IFIFO = 4096 + +const S_IFLNK = 40960 + +const S_IFSOCK = 49152 + +const ( + // Set user ID on execution. + S_ISUID = 2048 + // Set group ID on execution. + S_ISGID = 1024 +) + +// Save swapped text after use (sticky bit). This is pretty well obsolete. +const S_ISVTX = 512 + +const ( + // Read by owner. + S_IRUSR = 256 + // Write by owner. + S_IWUSR = 128 + // Execute by owner. + S_IXUSR = 64 +) + +// Read, write, and execute by owner. +const S_IRWXU = 448 + +const ( + // Read by group. + S_IRGRP = 32 + // Write by group. + S_IWGRP = 16 + // Execute by group. + S_IXGRP = 8 +) + +// Read, write, and execute by group. +const S_IRWXG = 56 + +const ( + // Read by others. + S_IROTH = 4 + // Write by others. + S_IWOTH = 2 + // Execute by others. + S_IXOTH = 1 +) + +// Read, write, and execute by others. +const S_IRWXO = 7 + +// Values for the second argument to access. +// These may be OR'd together. +const ( + R_OK = 4 + // Test for write permission. + W_OK = 2 + // Test for execute permission. + // Test for existence. + F_OK = 0 +) + +const ( + // Seek from beginning of file. + SEEK_SET = 0 + // Seek from current position. + SEEK_CUR = 1 + // Seek from end of file. + SEEK_END = 2 +) + +// Special value used to indicate +// the *at functions should use the +// current working directory. +const AT_FDCWD = -100 + +const ( + // Do not follow symbolic links. + AT_SYMLINK_NOFOLLOW = 256 + // Remove directory instead of + // unlinking file. + AT_REMOVEDIR = 512 +) + +// Follow symbolic links. +const AT_SYMLINK_FOLLOW = 1024 + +// Test access permitted for +// effective IDs, not real IDs. +const AT_EACCESS = 512 + +const ( + // Unlock a previously locked region. + F_ULOCK = 0 + // Lock a region for exclusive use. + F_LOCK = 1 + // Test and lock a region for exclusive use. + F_TLOCK = 2 + // Test a region for other processes locks. + F_TEST = 3 +) + +//go:linkname Lockf C.lockf +func Lockf(__fd c.Int, __cmd c.Int, __len c.Long) c.Int + +//go:linkname PosixFadvise C.posix_fadvise +func PosixFadvise(__fd c.Int, __offset c.Long, __len c.Long, __advise c.Int) c.Int + +//go:linkname PosixFallocate C.posix_fallocate +func PosixFallocate(__fd c.Int, __offset c.Long, __len c.Long) c.Int + +// Bits set in the FLAGS argument to `glob'. +const ( + GLOB_ERR = 1 + // Append a slash to each name. + GLOB_MARK = 2 + // Don't sort the names. + GLOB_NOSORT = 4 + // Insert PGLOB->gl_offs NULLs. + GLOB_DOOFFS = 8 + // If nothing matches, return the pattern. + GLOB_NOCHECK = 16 + // Append to results of a previous call. + GLOB_APPEND = 32 + // Backslashes don't quote metacharacters. + GLOB_NOESCAPE = 64 + // Leading `.' can be matched by metachars. + GLOB_PERIOD = 128 +) + +const ( + // Set in gl_flags if any metachars seen. + GLOB_MAGCHAR = 256 + // Use gl_opendir et al functions. + GLOB_ALTDIRFUNC = 512 + // Expand "{a,b}" to "a" "b". + GLOB_BRACE = 1024 + // If no magic chars, return the pattern. + GLOB_NOMAGIC = 2048 + // Expand ~user and ~ to home directories. + GLOB_TILDE = 4096 + // Match only directories. + GLOB_ONLYDIR = 8192 + // Like GLOB_TILDE but return an error + // if the user name is not available. + GLOB_TILDE_CHECK = 16384 +) + +// Error returns from `glob'. +const ( + GLOB_NOSPACE = 1 + // Read error. + GLOB_ABORTED = 2 + // No matches found. + GLOB_NOMATCH = 3 + // Not implemented. + GLOB_NOSYS = 4 +) + +// Reasonable value for the buffer sized used in the reentrant +// functions below. But better use `sysconf'. +const NSS_BUFLEN_GROUP = 1024 + +// The group structure. +type Group struct { + GrName *c.Char + GrPasswd *c.Char + GrGid c.Uint + GrMem **c.Char +} + +// Rewind the group-file stream. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Setgrent C.setgrent +func Setgrent() + +// Close the group-file stream. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endgrent C.endgrent +func Endgrent() + +// Read an entry from the group-file stream, opening it if necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getgrent C.getgrent +func Getgrent() *Group + +// Search for an entry with a matching group ID. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getgrgid C.getgrgid +func Getgrgid(__gid c.Uint) *Group + +// Search for an entry with a matching group name. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getgrnam C.getgrnam +func Getgrnam(__name *c.Char) *Group + +// Search for an entry with a matching group ID. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname GetgrgidR C.getgrgid_r +func GetgrgidR(__gid c.Uint, __resultbuf *Group, __buffer *c.Char, __buflen c.SizeT, __result **Group) c.Int + +// Search for an entry with a matching group name. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname GetgrnamR C.getgrnam_r +func GetgrnamR(__name *c.Char, __resultbuf *Group, __buffer *c.Char, __buflen c.SizeT, __result **Group) c.Int + +// Set the group set for the current user to GROUPS (N of them). +// +//go:linkname Setgroups C.setgroups +func Setgroups(__n c.SizeT, __groups *c.Uint) c.Int + +// Store at most *NGROUPS members of the group set for USER into +// GROUPS. Also include GROUP. The actual number of groups found is +// returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Getgrouplist C.getgrouplist +func Getgrouplist(__user *c.Char, __group c.Uint, __groups *c.Uint, __ngroups *c.Int) c.Int + +// Initialize the group set for the current user +// by reading the group database and using all groups +// of which USER is a member. Also include GROUP. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Initgroups C.initgroups +func Initgroups(__user *c.Char, __group c.Uint) c.Int + +// Reasonable value for the buffer sized used in the reentrant +// functions below. But better use `sysconf'. +const NSS_BUFLEN_PASSWD = 1024 + +// The passwd structure. +type Passwd struct { + PwName *c.Char + PwPasswd *c.Char + PwUid c.Uint + PwGid c.Uint + PwGecos *c.Char + PwDir *c.Char + PwShell *c.Char +} + +// Rewind the password-file stream. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Setpwent C.setpwent +func Setpwent() + +// Close the password-file stream. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endpwent C.endpwent +func Endpwent() + +// Read an entry from the password-file stream, opening it if necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getpwent C.getpwent +func Getpwent() *Passwd + +// Write the given entry onto the given stream. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +// llgo:link (*Passwd).Putpwent C.putpwent +func (self *Passwd) Putpwent(__f *c.FILE) c.Int { + return 0 +} + +// Search for an entry with a matching user ID. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getpwuid C.getpwuid +func Getpwuid(__uid c.Uint) *Passwd + +// Search for an entry with a matching username. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getpwnam C.getpwnam +func Getpwnam(__name *c.Char) *Passwd + +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +// llgo:link (*Passwd).GetpwentR C.getpwent_r +func (self *Passwd) GetpwentR(__buffer *c.Char, __buflen c.SizeT, __result **Passwd) c.Int { + return 0 +} + +//go:linkname GetpwuidR C.getpwuid_r +func GetpwuidR(__uid c.Uint, __resultbuf *Passwd, __buffer *c.Char, __buflen c.SizeT, __result **Passwd) c.Int + +//go:linkname GetpwnamR C.getpwnam_r +func GetpwnamR(__name *c.Char, __resultbuf *Passwd, __buffer *c.Char, __buflen c.SizeT, __result **Passwd) c.Int + +// Set scheduling parameters for a process. +// +//go:linkname SchedSetparam C.sched_setparam +func SchedSetparam(__pid c.Int, __param *SchedParam) c.Int + +// Retrieve scheduling parameters for a particular process. +// +//go:linkname SchedGetparam C.sched_getparam +func SchedGetparam(__pid c.Int, __param *SchedParam) c.Int + +// Set scheduling algorithm and/or parameters for a process. +// +//go:linkname SchedSetscheduler C.sched_setscheduler +func SchedSetscheduler(__pid c.Int, __policy c.Int, __param *SchedParam) c.Int + +// Retrieve scheduling algorithm for a particular purpose. +// +//go:linkname SchedGetscheduler C.sched_getscheduler +func SchedGetscheduler(__pid c.Int) c.Int + +// Yield the processor. +// +//go:linkname SchedYield C.sched_yield +func SchedYield() c.Int + +// Get maximum priority value for a scheduler. +// +//go:linkname SchedGetPriorityMax C.sched_get_priority_max +func SchedGetPriorityMax(__algorithm c.Int) c.Int + +// Get minimum priority value for a scheduler. +// +//go:linkname SchedGetPriorityMin C.sched_get_priority_min +func SchedGetPriorityMin(__algorithm c.Int) c.Int + +// Get the SCHED_RR interval for the named process. +// +//go:linkname SchedRrGetInterval C.sched_rr_get_interval +func SchedRrGetInterval(__pid c.Int, __t *lltime.Timespec) c.Int + +// Flags to be set in the `posix_spawnattr_t'. +const ( + POSIX_SPAWN_RESETIDS = 1 + POSIX_SPAWN_SETPGROUP = 2 + POSIX_SPAWN_SETSIGDEF = 4 + POSIX_SPAWN_SETSIGMASK = 8 + POSIX_SPAWN_SETSCHEDPARAM = 16 + POSIX_SPAWN_SETSCHEDULER = 32 +) + +// Data structure to contain attributes for thread creation. +type PosixSpawnattrT struct { + X__Flags int16 + X__Pgrp c.Int + X__Sd llsignal.SigsetT + X__Ss llsignal.SigsetT + X__Sp SchedParam + X__Policy c.Int + X__Pad [16]c.Int +} + +// Initialize data structure with attributes for `spawn' to default values. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrInit C.posix_spawnattr_init +func (self *PosixSpawnattrT) PosixSpawnattrInit() c.Int { + return 0 +} + +// Free resources associated with ATTR. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrDestroy C.posix_spawnattr_destroy +func (self *PosixSpawnattrT) PosixSpawnattrDestroy() c.Int { + return 0 +} + +// Store signal mask for signals with default handling from ATTR in +// SIGDEFAULT. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigdefault C.posix_spawnattr_getsigdefault +func (self *PosixSpawnattrT) PosixSpawnattrGetsigdefault(__sigdefault *llsignal.SigsetT) c.Int { + return 0 +} + +// Set signal mask for signals with default handling in ATTR to SIGDEFAULT. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigdefault C.posix_spawnattr_setsigdefault +func (self *PosixSpawnattrT) PosixSpawnattrSetsigdefault(__sigdefault *llsignal.SigsetT) c.Int { + return 0 +} + +// Store signal mask for the new process from ATTR in SIGMASK. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigmask C.posix_spawnattr_getsigmask +func (self *PosixSpawnattrT) PosixSpawnattrGetsigmask(__sigmask *llsignal.SigsetT) c.Int { + return 0 +} + +// Set signal mask for the new process in ATTR to SIGMASK. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigmask C.posix_spawnattr_setsigmask +func (self *PosixSpawnattrT) PosixSpawnattrSetsigmask(__sigmask *llsignal.SigsetT) c.Int { + return 0 +} + +// Get flag word from the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetflags C.posix_spawnattr_getflags +func (self *PosixSpawnattrT) PosixSpawnattrGetflags(__flags *int16) c.Int { + return 0 +} + +// Store flags in the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetflags C.posix_spawnattr_setflags +func (self *PosixSpawnattrT) PosixSpawnattrSetflags(__flags int16) c.Int { + return 0 +} + +// Get process group ID from the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetpgroup C.posix_spawnattr_getpgroup +func (self *PosixSpawnattrT) PosixSpawnattrGetpgroup(__pgroup *c.Int) c.Int { + return 0 +} + +// Store process group ID in the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetpgroup C.posix_spawnattr_setpgroup +func (self *PosixSpawnattrT) PosixSpawnattrSetpgroup(__pgroup c.Int) c.Int { + return 0 +} + +// Get scheduling policy from the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetschedpolicy C.posix_spawnattr_getschedpolicy +func (self *PosixSpawnattrT) PosixSpawnattrGetschedpolicy(__schedpolicy *c.Int) c.Int { + return 0 +} + +// Store scheduling policy in the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetschedpolicy C.posix_spawnattr_setschedpolicy +func (self *PosixSpawnattrT) PosixSpawnattrSetschedpolicy(__schedpolicy c.Int) c.Int { + return 0 +} + +// Get scheduling parameters from the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetschedparam C.posix_spawnattr_getschedparam +func (self *PosixSpawnattrT) PosixSpawnattrGetschedparam(__schedparam *SchedParam) c.Int { + return 0 +} + +// Store scheduling parameters in the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetschedparam C.posix_spawnattr_setschedparam +func (self *PosixSpawnattrT) PosixSpawnattrSetschedparam(__schedparam *SchedParam) c.Int { + return 0 +} + +const ( + // Seek from beginning of file. + L_SET = 0 + // Seek from current position. + L_INCR = 1 + // Seek from end of file. + L_XTND = 2 +) + +// Apply or remove an advisory lock, according to OPERATION, +// on the file FD refers to. +// +//go:linkname Flock C.flock +func Flock(__fd c.Int, __operation c.Int) c.Int + +//go:linkname Mmap C.mmap +func Mmap(__addr unsafe.Pointer, __len c.SizeT, __prot c.Int, __flags c.Int, __fd c.Int, __offset c.Long) unsafe.Pointer + +// Deallocate any mapping for the region starting at ADDR and extending LEN +// bytes. Returns 0 if successful, -1 for errors (and sets errno). +// +//go:linkname Munmap C.munmap +func Munmap(__addr unsafe.Pointer, __len c.SizeT) c.Int + +// Change the memory protection of the region starting at ADDR and +// extending LEN bytes to PROT. Returns 0 if successful, -1 for errors +// (and sets errno). +// +//go:linkname Mprotect C.mprotect +func Mprotect(__addr unsafe.Pointer, __len c.SizeT, __prot c.Int) c.Int + +// Synchronize the region starting at ADDR and extending LEN bytes with the +// file it maps. Filesystem operations on a file being mapped are +// unpredictable before this is done. Flags are from the MS_* set. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Msync C.msync +func Msync(__addr unsafe.Pointer, __len c.SizeT, __flags c.Int) c.Int + +// Advise the system about particular usage patterns the program follows +// for the region starting at ADDR and extending LEN bytes. +// +//go:linkname Madvise C.madvise +func Madvise(__addr unsafe.Pointer, __len c.SizeT, __advice c.Int) c.Int + +// This is the POSIX name for this function. +// +//go:linkname PosixMadvise C.posix_madvise +func PosixMadvise(__addr unsafe.Pointer, __len c.SizeT, __advice c.Int) c.Int + +// Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to +// be memory resident. +// +//go:linkname Mlock C.mlock +func Mlock(__addr unsafe.Pointer, __len c.SizeT) c.Int + +// Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN). +// +//go:linkname Munlock C.munlock +func Munlock(__addr unsafe.Pointer, __len c.SizeT) c.Int + +// Cause all currently mapped pages of the process to be memory resident +// until unlocked by a call to the `munlockall', until the process exits, +// or until the process calls `execve'. +// +//go:linkname Mlockall C.mlockall +func Mlockall(__flags c.Int) c.Int + +// All currently mapped pages of the process' address space become +// unlocked. +// +//go:linkname Munlockall C.munlockall +func Munlockall() c.Int + +// mincore returns the memory residency status of the pages in the +// current process's address space specified by [start, start + len). +// The status is returned in a vector of bytes. The least significant +// bit of each byte is 1 if the referenced page is in memory, otherwise +// it is zero. +// +//go:linkname Mincore C.mincore +func Mincore(__start unsafe.Pointer, __len c.SizeT, __vec *uint8) c.Int + +// Open shared memory segment. +// +//go:linkname ShmOpen C.shm_open +func ShmOpen(__name *c.Char, __oflag c.Int, __mode c.Uint) c.Int + +// Remove shared memory segment. +// +//go:linkname ShmUnlink C.shm_unlink +func ShmUnlink(__name *c.Char) c.Int + +// Return resource usage information on process indicated by WHO +// and put it in *USAGE. Returns 0 for success, -1 for failure. +// +//go:linkname Getrusage C.getrusage +func Getrusage(__who c.Int, __usage *Rusage) c.Int + +// Return the highest priority of any process specified by WHICH and WHO +// (see above); if WHO is zero, the current process, process group, or user +// (as specified by WHO) is used. A lower priority number means higher +// priority. Priorities range from PRIO_MIN to PRIO_MAX (above). +// +//go:linkname Getpriority C.getpriority +func Getpriority(__which c.Int, __who c.Uint) c.Int + +// Set the priority of all processes specified by WHICH and WHO (see above) +// to PRIO. Returns 0 on success, -1 on errors. +// +//go:linkname Setpriority C.setpriority +func Setpriority(__which c.Int, __who c.Uint, __prio c.Int) c.Int + +const ( + S_IREAD = 256 + S_IWRITE = 128 + S_IEXEC = 64 +) + +// Macros for common mode bit masks. +const ( + ACCESSPERMS = 511 + // 07777 + ALLPERMS = 4095 + // 0666 + DEFFILEMODE = 438 +) + +// Block size for `st_blocks'. +const S_BLKSIZE = 512 + +// Set file access permissions for c.FILE to MODE. +// If c.FILE is a symbolic link, this affects the link itself +// rather than its target. +// +//go:linkname Lchmod C.lchmod +func Lchmod(__file *c.Char, __mode c.Uint) c.Int + +// Like mkdir, create a new directory with permission bits MODE. But +// interpret relative PATH names relative to the directory associated +// with FD. +// +//go:linkname Mkdirat C.mkdirat +func Mkdirat(__fd c.Int, __path *c.Char, __mode c.Uint) c.Int + +// Like mknod, create a new device file with permission bits MODE and +// device number DEV. But interpret relative PATH names relative to +// the directory associated with FD. +// +//go:linkname Mknodat C.mknodat +func Mknodat(__fd c.Int, __path *c.Char, __mode c.Uint, __dev c.Ulong) c.Int + +// Like mkfifo, create a new FIFO with permission bits MODE. But +// interpret relative PATH names relative to the directory associated +// with FD. +// +//go:linkname Mkfifoat C.mkfifoat +func Mkfifoat(__fd c.Int, __path *c.Char, __mode c.Uint) c.Int + +// Set file access and modification times relative to directory file +// descriptor. +// +//go:linkname Utimensat C.utimensat +func Utimensat(__fd c.Int, __path *c.Char, __times *lltime.Timespec, __flags c.Int) c.Int + +// Set file access and modification times of the file associated with FD. +// +//go:linkname Futimens C.futimens +func Futimens(__fd c.Int, __times *lltime.Timespec) c.Int + +//go:linkname Fstatvfs C.fstatvfs +func Fstatvfs(__fildes c.Int, __buf *Statvfs) c.Int + +// Structure describing CPU time used by a process and its children. +type Tms struct { + TmsUtime c.Long + TmsStime c.Long + TmsCutime c.Long + TmsCstime c.Long +} + +// Store the CPU time used by this process and all its +// dead children (and their dead children) in BUFFER. +// Return the elapsed real time, or (clock_t) -1 for errors. +// All times are in CLK_TCKths of a second. +// +// llgo:link (*Tms).Times C.times +func (self *Tms) Times() c.Long { + return 0 +} + +type FsidT = X__FsidT + +type CaddrT = X__CaddrT + +// Read data from file descriptor FD, and put the result in the +// buffers described by IOVEC, which is a vector of COUNT 'struct iovec's. +// The buffers are filled in the order specified. +// Operates just like 'read' (see ) except that data are +// put in IOVEC instead of a contiguous buffer. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Readv C.readv +func Readv(__fd c.Int, __iovec *c.Iovec, __count c.Int) c.SsizeT + +// Write data pointed by the buffers described by IOVEC, which +// is a vector of COUNT 'struct iovec's, to file descriptor FD. +// The data is written in the order specified. +// Operates just like 'write' (see ) except that the data +// are taken from IOVEC instead of a contiguous buffer. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Writev C.writev +func Writev(__fd c.Int, __iovec *c.Iovec, __count c.Int) c.SsizeT + +// Read data from file descriptor FD at the given position OFFSET +// without change the file pointer, and put the result in the buffers +// described by IOVEC, which is a vector of COUNT 'struct iovec's. +// The buffers are filled in the order specified. Operates just like +// 'pread' (see ) except that data are put in IOVEC instead +// of a contiguous buffer. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Preadv C.preadv +func Preadv(__fd c.Int, __iovec *c.Iovec, __count c.Int, __offset c.Long) c.SsizeT + +// Write data pointed by the buffers described by IOVEC, which is a +// vector of COUNT 'struct iovec's, to file descriptor FD at the given +// position OFFSET without change the file pointer. The data is +// written in the order specified. Operates just like 'pwrite' (see +// ) except that the data are taken from IOVEC instead of a +// contiguous buffer. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Pwritev C.pwritev +func Pwritev(__fd c.Int, __iovec *c.Iovec, __count c.Int, __offset c.Long) c.SsizeT + +// Note that SVID assumes all members have the same size. +const SYS_NMLN = 65 + +// Structure describing the system and machine. +type Utsname struct { + Sysname [65]c.Char + Nodename [65]c.Char + Release [65]c.Char + Version [65]c.Char + Machine [65]c.Char + X__Domainname [65]c.Char +} + +// Put information about the system in NAME. +// +// llgo:link (*Utsname).Uname C.uname +func (self *Utsname) Uname() c.Int { + return 0 +} + +const WCOREFLAG = 128 + +// Special values for the PID argument to `waitpid' and `wait4'. +const ( + WAIT_ANY = -1 + // Any process in my process group. + WAIT_MYPGRP = 0 +) + +type IdtypeT c.Uint + +const ( + P_ALL IdtypeT = 0 + P_PID IdtypeT = 1 + // Wait for members of process group. + P_PGID IdtypeT = 2 +) + +// Wait for a childing matching IDTYPE and ID to change the status and +// place appropriate information in *INFOP. +// If IDTYPE is P_PID, match any process whose process ID is ID. +// If IDTYPE is P_PGID, match any process whose process group is ID. +// If IDTYPE is P_ALL, match any process. +// If the WNOHANG bit is set in OPTIONS, and that child +// is not already dead, clear *INFOP and return 0. If successful, store +// exit code and status in *INFOP. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +// llgo:link IdtypeT.Waitid C.waitid +func (self IdtypeT) Waitid(__id c.Uint, __infop *llsignal.SiginfoT, __options c.Int) c.Int { + return 0 +} + +// Return the output baud rate stored in *TERMIOS_P. +// +// llgo:link (*Termios).Cfgetospeed C.cfgetospeed +func (self *Termios) Cfgetospeed() c.Uint { + return 0 +} + +// Return the input baud rate stored in *TERMIOS_P. +// +// llgo:link (*Termios).Cfgetispeed C.cfgetispeed +func (self *Termios) Cfgetispeed() c.Uint { + return 0 +} + +// Set the output baud rate stored in *TERMIOS_P to SPEED. +// +// llgo:link (*Termios).Cfsetospeed C.cfsetospeed +func (self *Termios) Cfsetospeed(__speed c.Uint) c.Int { + return 0 +} + +// Set the input baud rate stored in *TERMIOS_P to SPEED. +// +// llgo:link (*Termios).Cfsetispeed C.cfsetispeed +func (self *Termios) Cfsetispeed(__speed c.Uint) c.Int { + return 0 +} + +// Set both the input and output baud rates in *TERMIOS_OP to SPEED. +// +// llgo:link (*Termios).Cfsetspeed C.cfsetspeed +func (self *Termios) Cfsetspeed(__speed c.Uint) c.Int { + return 0 +} + +// Put the state of FD into *TERMIOS_P. +// +//go:linkname Tcgetattr C.tcgetattr +func Tcgetattr(__fd c.Int, __termios_p *Termios) c.Int + +// Set the state of FD to *TERMIOS_P. +// Values for OPTIONAL_ACTIONS (TCSA*) are in . +// +//go:linkname Tcsetattr C.tcsetattr +func Tcsetattr(__fd c.Int, __optional_actions c.Int, __termios_p *Termios) c.Int + +// Set *TERMIOS_P to indicate raw mode. +// +// llgo:link (*Termios).Cfmakeraw C.cfmakeraw +func (self *Termios) Cfmakeraw() { +} + +// Send zero bits on FD. +// +//go:linkname Tcsendbreak C.tcsendbreak +func Tcsendbreak(__fd c.Int, __duration c.Int) c.Int + +// Wait for pending output to be written on FD. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Tcdrain C.tcdrain +func Tcdrain(__fd c.Int) c.Int + +// Flush pending data on FD. +// Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in . +// +//go:linkname Tcflush C.tcflush +func Tcflush(__fd c.Int, __queue_selector c.Int) c.Int + +// Suspend or restart transmission on FD. +// Values for ACTION (TC[IO]{OFF,ON}) are in . +// +//go:linkname Tcflow C.tcflow +func Tcflow(__fd c.Int, __action c.Int) c.Int + +// Get process group ID for session leader for controlling terminal FD. +// +//go:linkname Tcgetsid C.tcgetsid +func Tcgetsid(__fd c.Int) c.Int + +// Standard file descriptors. +const ( + STDIN_FILENO = 0 + // Standard output. + STDOUT_FILENO = 1 + // Standard error output. + STDERR_FILENO = 2 +) + +// Test for access to NAME using the real UID and real GID. +// +//go:linkname Access C.access +func Access(__name *c.Char, __type c.Int) c.Int + +// Read NBYTES into BUF from FD at the given position OFFSET without +// changing the file pointer. Return the number read, -1 for errors +// or 0 for EOF. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Pread C.pread +func Pread(__fd c.Int, __buf unsafe.Pointer, __nbytes c.SizeT, __offset c.Long) c.SsizeT + +// Write N bytes of BUF to FD at the given position OFFSET without +// changing the file pointer. Return the number written, or -1. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Pwrite C.pwrite +func Pwrite(__fd c.Int, __buf unsafe.Pointer, __n c.SizeT, __offset c.Long) c.SsizeT + +// Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. +// If SECONDS is zero, any currently scheduled alarm will be cancelled. +// The function returns the number of seconds remaining until the last +// alarm scheduled would have signaled, or zero if there wasn't one. +// There is no return value to indicate an error, but you can set `errno' +// to 0 and check its value after calling `alarm', and this might tell you. +// The signal may come late due to processor scheduling. +// +//go:linkname Alarm C.alarm +func Alarm(__seconds c.Uint) c.Uint + +// Make the process sleep for SECONDS seconds, or until a signal arrives +// and is not ignored. The function returns the number of seconds less +// than SECONDS which it actually slept (thus zero if it slept the full time). +// If a signal handler does a `longjmp' or modifies the handling of the +// SIGALRM signal while inside `sleep' call, the handling of the SIGALRM +// signal afterwards is undefined. There is no return value to indicate +// error, but if `sleep' returns SECONDS, it probably didn't work. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Sleep C.sleep +func Sleep(__seconds c.Uint) c.Uint + +// Set an alarm to go off (generating a SIGALRM signal) in VALUE +// microseconds. If INTERVAL is nonzero, when the alarm goes off, the +// timer is reset to go off every INTERVAL microseconds thereafter. +// Returns the number of microseconds remaining before the alarm. +// +//go:linkname Ualarm C.ualarm +func Ualarm(__value c.Uint, __interval c.Uint) c.Uint + +// Sleep USECONDS microseconds, or until a signal arrives that is not blocked +// or ignored. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Usleep C.usleep +func Usleep(__useconds c.Uint) c.Int + +// Suspend the process until a signal arrives. +// This always returns -1 and sets `errno' to EINTR. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Pause C.pause +func Pause() c.Int + +// Put the absolute pathname of the current working directory in BUF. +// If successful, return BUF. If not, put an error message in +// BUF and return NULL. BUF should be at least PATH_MAX bytes long. +// +//go:linkname Getwd C.getwd +func Getwd(__buf *c.Char) *c.Char + +// Execute the file FD refers to, overlaying the running program image. +// ARGV and ENVP are passed to the new program, as for `execve'. +// +//go:linkname Fexecve C.fexecve +func Fexecve(__fd c.Int, __argv **c.Char, __envp **c.Char) c.Int + +// Add INC to priority of the current process. +// +//go:linkname Nice C.nice +func Nice(__inc c.Int) c.Int + +// Terminate program execution with the low-order 8 bits of STATUS. +// +//go:linkname X_exit C._exit +func X_exit(__status c.Int) + +// Get file-specific configuration information about PATH. +// +//go:linkname Pathconf C.pathconf +func Pathconf(__path *c.Char, __name c.Int) c.Long + +// Get file-specific configuration about descriptor FD. +// +//go:linkname Fpathconf C.fpathconf +func Fpathconf(__fd c.Int, __name c.Int) c.Long + +// Get the value of the system variable NAME. +// +//go:linkname Sysconf C.sysconf +func Sysconf(__name c.Int) c.Long + +// Get the value of the string-valued system variable NAME. +// +//go:linkname Confstr C.confstr +func Confstr(__name c.Int, __buf *c.Char, __len c.SizeT) c.SizeT + +// Get the process group ID of the calling process. +// +//go:linkname Getpgrp C.getpgrp +func Getpgrp() c.Int + +//go:linkname Getpgid C.getpgid +func Getpgid(__pid c.Int) c.Int + +// Set the process group ID of the process matching PID to PGID. +// If PID is zero, the current process's process group ID is set. +// If PGID is zero, the process ID of the process is used. +// +//go:linkname Setpgid C.setpgid +func Setpgid(__pid c.Int, __pgid c.Int) c.Int + +// Set the process group ID of the calling process to its own PID. +// This is exactly the same as `setpgid (0, 0)'. +// +//go:linkname Setpgrp C.setpgrp +func Setpgrp() c.Int + +// Create a new session with the calling process as its leader. +// The process group IDs of the session and the calling process +// are set to the process ID of the calling process, which is returned. +// +//go:linkname Setsid C.setsid +func Setsid() c.Int + +// Return the session ID of the given process. +// +//go:linkname Getsid C.getsid +func Getsid(__pid c.Int) c.Int + +// If SIZE is zero, return the number of supplementary groups +// the calling process is in. Otherwise, fill in the group IDs +// of its supplementary groups in LIST and return the number written. +// +//go:linkname Getgroups C.getgroups +func Getgroups(__size c.Int, __list *c.Uint) c.Int + +// Set the user ID of the calling process to UID. +// If the calling process is the super-user, set the real +// and effective user IDs, and the saved set-user-ID to UID; +// if not, the effective user ID is set to UID. +// +//go:linkname Setuid C.setuid +func Setuid(__uid c.Uint) c.Int + +// Set the real user ID of the calling process to RUID, +// and the effective user ID of the calling process to EUID. +// +//go:linkname Setreuid C.setreuid +func Setreuid(__ruid c.Uint, __euid c.Uint) c.Int + +// Set the effective user ID of the calling process to UID. +// +//go:linkname Seteuid C.seteuid +func Seteuid(__uid c.Uint) c.Int + +// Set the group ID of the calling process to GID. +// If the calling process is the super-user, set the real +// and effective group IDs, and the saved set-group-ID to GID; +// if not, the effective group ID is set to GID. +// +//go:linkname Setgid C.setgid +func Setgid(__gid c.Uint) c.Int + +// Set the real group ID of the calling process to RGID, +// and the effective group ID of the calling process to EGID. +// +//go:linkname Setregid C.setregid +func Setregid(__rgid c.Uint, __egid c.Uint) c.Int + +// Set the effective group ID of the calling process to GID. +// +//go:linkname Setegid C.setegid +func Setegid(__gid c.Uint) c.Int + +// Clone the calling process, but without copying the whole address space. +// The calling process is suspended until the new process exits or is +// replaced by a call to `execve'. Return -1 for errors, 0 to the new process, +// and the process ID of the new process to the old process. +// +//go:linkname Vfork C.vfork +func Vfork() c.Int + +// Return the pathname of the terminal FD is open on, or NULL on errors. +// The returned storage is good only until the next call to this function. +// +//go:linkname Ttyname C.ttyname +func Ttyname(__fd c.Int) *c.Char + +// Store at most BUFLEN characters of the pathname of the terminal FD is +// open on in BUF. Return 0 on success, otherwise an error number. +// +//go:linkname TtynameR C.ttyname_r +func TtynameR(__fd c.Int, __buf *c.Char, __buflen c.SizeT) c.Int + +// Return the index into the active-logins file (utmp) for +// the controlling terminal. +// +//go:linkname Ttyslot C.ttyslot +func Ttyslot() c.Int + +// Like link but relative paths in TO and FROM are interpreted relative +// to FROMFD and TOFD respectively. +// +//go:linkname Linkat C.linkat +func Linkat(__fromfd c.Int, __from *c.Char, __tofd c.Int, __to *c.Char, __flags c.Int) c.Int + +// Like symlink but a relative path in TO is interpreted relative to TOFD. +// +//go:linkname Symlinkat C.symlinkat +func Symlinkat(__from *c.Char, __tofd c.Int, __to *c.Char) c.Int + +// Like readlink but a relative PATH is interpreted relative to FD. +// +//go:linkname Readlinkat C.readlinkat +func Readlinkat(__fd c.Int, __path *c.Char, __buf *c.Char, __len c.SizeT) c.SsizeT + +// Return the foreground process group ID of FD. +// +//go:linkname Tcgetpgrp C.tcgetpgrp +func Tcgetpgrp(__fd c.Int) c.Int + +// Set the foreground process group ID of FD set PGRP_ID. +// +//go:linkname Tcsetpgrp C.tcsetpgrp +func Tcsetpgrp(__fd c.Int, __pgrp_id c.Int) c.Int + +// Return the login name of the user. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getlogin C.getlogin +func Getlogin() *c.Char + +// Return at most NAME_LEN characters of the login name of the user in NAME. +// If it cannot be determined or some other error occurred, return the error +// code. Otherwise return 0. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname GetloginR C.getlogin_r +func GetloginR(__name *c.Char, __name_len c.SizeT) c.Int + +// Set the login name returned by `getlogin'. +// +//go:linkname Setlogin C.setlogin +func Setlogin(__name *c.Char) c.Int + +// Put the name of the current host in no more than LEN bytes of NAME. +// The result is null-terminated if LEN is large enough for the full +// name and the terminator. +// +//go:linkname Gethostname C.gethostname +func Gethostname(__name *c.Char, __len c.SizeT) c.Int + +// Set the name of the current host to NAME, which is LEN bytes long. +// This call is restricted to the super-user. +// +//go:linkname Sethostname C.sethostname +func Sethostname(__name *c.Char, __len c.SizeT) c.Int + +// Set the current machine's Internet number to ID. +// This call is restricted to the super-user. +// +//go:linkname Sethostid C.sethostid +func Sethostid(__id c.Long) c.Int + +// Get and set the NIS (aka YP) domain name, if any. +// Called just like `gethostname' and `sethostname'. +// The NIS domain name is usually the empty string when not using NIS. +// +//go:linkname Getdomainname C.getdomainname +func Getdomainname(__name *c.Char, __len c.SizeT) c.Int + +// Ignore +// +//go:linkname Setdomainname C.setdomainname +func Setdomainname(__name *c.Char, __len c.SizeT) c.Int + +// Revoke access permissions to all processes currently communicating +// with the control terminal, and then send a SIGHUP signal to the process +// group of the control terminal. +// +//go:linkname Vhangup C.vhangup +func Vhangup() c.Int + +// Revoke the access of all descriptors currently open on c.FILE. +// +//go:linkname Revoke C.revoke +func Revoke(__file *c.Char) c.Int + +// Enable statistical profiling, writing samples of the PC into at most +// SIZE bytes of SAMPLE_BUFFER; every processor clock tick while profiling +// is enabled, the system examines the user PC and increments +// SAMPLE_BUFFER[((PC - OFFSET) / 2) * SCALE / 65536]. If SCALE is zero, +// disable profiling. Returns zero on success, -1 on error. +// +//go:linkname Profil C.profil +func Profil(__sample_buffer *uint16, __size c.SizeT, __offset c.SizeT, __scale c.Uint) c.Int + +// Turn accounting on if NAME is an existing file. The system will then write +// a record for each process as it terminates, to this file. If NAME is NULL, +// turn accounting off. This call is restricted to the super-user. +// +//go:linkname Acct C.acct +func Acct(__name *c.Char) c.Int + +// Successive calls return the shells listed in `/etc/shells'. +// +//go:linkname Getusershell C.getusershell +func Getusershell() *c.Char + +// Discard cached info. +// +//go:linkname Endusershell C.endusershell +func Endusershell() + +// Rewind and re-read the file. +// +//go:linkname Setusershell C.setusershell +func Setusershell() + +// Put the program in the background, and dissociate from the controlling +// terminal. If NOCHDIR is zero, do `chdir ("/")'. If NOCLOSE is zero, +// redirects stdin, stdout, and stderr to /dev/null. +// +//go:linkname Daemon C.daemon +func Daemon(__nochdir c.Int, __noclose c.Int) c.Int + +// Prompt with PROMPT and read a string from the terminal without echoing. +// Uses /dev/tty if possible; otherwise stderr and stdin. +// +//go:linkname Getpass C.getpass +func Getpass(__prompt *c.Char) *c.Char + +// Return identifier for the current host. +// +//go:linkname Gethostid C.gethostid +func Gethostid() c.Long + +// Make all changes done to all files actually appear on disk. +// +//go:linkname Sync C.sync +func Sync() + +// Return the number of bytes in a page. This is the system's page size, +// which is not necessarily the same as the hardware page size. +// +//go:linkname Getpagesize C.getpagesize +func Getpagesize() c.Int + +// Return the maximum number of file descriptors +// the current process could possibly have. +// +//go:linkname Getdtablesize C.getdtablesize +func Getdtablesize() c.Int + +// Set the end of accessible data space (aka "the break") to ADDR. +// Returns zero on success and -1 for errors (with errno set). +// +//go:linkname Brk C.brk +func Brk(__addr unsafe.Pointer) c.Int + +// Increase or decrease the end of accessible data space by DELTA bytes. +// If successful, returns the address the previous end of data space +// (i.e. the beginning of the new space, if DELTA > 0); +// returns (void *) -1 for errors (with errno set). +// +//go:linkname Sbrk C.sbrk +func Sbrk(__delta c.IntptrT) unsafe.Pointer + +// Synchronize at least the data part of a file with the underlying +// media. +// +//go:linkname Fdatasync C.fdatasync +func Fdatasync(__fildes c.Int) c.Int + +// Structure describing file times. +type Utimbuf struct { + Actime c.Long + Modtime c.Long +} + +// Set the access and modification times of c.FILE to those given in +// FILE_TIMES. If FILE_TIMES is NULL, set them to the current time. +// +//go:linkname Utime C.utime +func Utime(__file *c.Char, __file_times *Utimbuf) c.Int + +const ( + EAGAIN = 11 + F_GETFL = 3 + F_SETFL = 4 + O_ACCMODE = 3 + O_CREAT = 64 + O_NONBLOCK = 2048 + O_RDONLY = 0 + O_RDWR = 2 + O_TRUNC = 512 + O_WRONLY = 1 +) diff --git a/c/os/libc_linux_arm64.go b/c/os/libc_linux_arm64.go new file mode 100644 index 00000000..1ec9ebf6 --- /dev/null +++ b/c/os/libc_linux_arm64.go @@ -0,0 +1,1664 @@ +//go:build linux && arm64 && !android + +// Code generated by llcppg; DO NOT EDIT. +// Classified from the common libc binding. + +package os + +import ( + "github.com/goplus/lib/c" + llsignal "github.com/goplus/lib/c/signal" + llsys "github.com/goplus/lib/c/sys" + lltime "github.com/goplus/lib/c/time" + "unsafe" +) + +type FlockT struct { + LType int16 + LWhence int16 + LStart c.Long + LLen c.Long + LPid c.Int +} + +// The purpose of all the unions is to have the kernel-compatible layout +// while keeping the API type as 'long int', and among machines where +// __syscall_slong_t is not 'long int', this only does the right thing +// for little-endian ones, like x32. +type Rusage struct { + RuUtime llsys.Timeval + RuStime llsys.Timeval + _llcppg_anon_7 + _llcppg_anon_8 + _llcppg_anon_9 + _llcppg_anon_10 + _llcppg_anon_11 + _llcppg_anon_12 + _llcppg_anon_13 + _llcppg_anon_14 + _llcppg_anon_15 + _llcppg_anon_16 + _llcppg_anon_17 + _llcppg_anon_18 + _llcppg_anon_19 + _llcppg_anon_20 +} + +type _llcppg_anon_7 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_8 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_9 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_10 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_11 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_12 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_13 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_14 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_15 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_16 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_17 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_18 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_19 struct { + _xgo_union [1]uint64 +} + +type _llcppg_anon_20 struct { + _xgo_union [1]uint64 +} + +func (p *_llcppg_anon_7) XGof_ref_ru_maxrss() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_7) XGof_ref___ru_maxrss_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_8) XGof_ref_ru_ixrss() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_8) XGof_ref___ru_ixrss_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_9) XGof_ref_ru_idrss() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_9) XGof_ref___ru_idrss_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_10) XGof_ref_ru_isrss() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_10) XGof_ref___ru_isrss_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_11) XGof_ref_ru_minflt() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_11) XGof_ref___ru_minflt_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_12) XGof_ref_ru_majflt() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_12) XGof_ref___ru_majflt_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_13) XGof_ref_ru_nswap() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_13) XGof_ref___ru_nswap_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_14) XGof_ref_ru_inblock() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_14) XGof_ref___ru_inblock_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_15) XGof_ref_ru_oublock() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_15) XGof_ref___ru_oublock_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_16) XGof_ref_ru_msgsnd() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_16) XGof_ref___ru_msgsnd_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_17) XGof_ref_ru_msgrcv() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_17) XGof_ref___ru_msgrcv_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_18) XGof_ref_ru_nsignals() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_18) XGof_ref___ru_nsignals_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_19) XGof_ref_ru_nvcsw() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_19) XGof_ref___ru_nvcsw_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_20) XGof_ref_ru_nivcsw() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +func (p *_llcppg_anon_20) XGof_ref___ru_nivcsw_word() *c.Long { + return (*c.Long)(unsafe.Pointer(p)) +} + +// The official definition. +type SchedParam struct { + X__SchedPriority c.Int +} + +type Statvfs struct { + FBsize c.Ulong + FFrsize c.Ulong + FBlocks c.Ulong + FBfree c.Ulong + FBavail c.Ulong + FFiles c.Ulong + FFfree c.Ulong + FFavail c.Ulong + FFsid c.Ulong + FFlag c.Ulong + FNamemax c.Ulong + X__FSpare [6]c.Int +} + +type Termios struct { + CIflag c.Uint + COflag c.Uint + CCflag c.Uint + CLflag c.Uint + CLine c.Uint8T + CCc [32]c.Uint8T + CIspeed c.Uint + COspeed c.Uint +} + +type X__FsidT struct { + X__Val [2]c.Int +} + +type X__CaddrT = *uint8 + +const MAXNAMLEN = 255 + +// File types for `d_type'. +const ( + DT_UNKNOWN = 0 + DT_FIFO = 1 + DT_CHR = 2 + DT_DIR = 4 + DT_BLK = 6 + DT_REG = 8 + DT_LNK = 10 + DT_SOCK = 12 + DT_WHT = 14 +) + +// llgo:link (*DIR).ReaddirR C.readdir_r +func (self *DIR) ReaddirR(__entry *Dirent, __result **Dirent) c.Int { + return 0 +} + +// Rewind DIRP to the beginning of the directory. +// +// llgo:link (*DIR).Rewinddir C.rewinddir +func (self *DIR) Rewinddir() { +} + +// Seek to position POS on DIRP. +// +// llgo:link (*DIR).Seekdir C.seekdir +func (self *DIR) Seekdir(__pos c.Long) { +} + +// Return the current position of DIRP. +// +// llgo:link (*DIR).Telldir C.telldir +func (self *DIR) Telldir() c.Long { + return 0 +} + +// Return the file descriptor used by DIRP. +// +// llgo:link (*DIR).Dirfd C.dirfd +func (self *DIR) Dirfd() c.Int { + return 0 +} + +//go:linkname Scandir C.scandir +func Scandir(__dir *uint8, __namelist ***Dirent, __selector func(_llcppg_param1 *Dirent) c.Int, __cmp func(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int) c.Int + +//go:linkname Alphasort C.alphasort +func Alphasort(__e1 **Dirent, __e2 **Dirent) c.Int + +//go:linkname Getdirentries C.getdirentries +func Getdirentries(__fd c.Int, __buf *uint8, __nbytes c.SizeT, __basep *c.Long) c.Long + +// Open the shared object c.FILE and map it in; return a handle that can be +// passed to `dlsym' to get symbol values from it. +// +//go:linkname Dlopen C.dlopen +func Dlopen(__file *uint8, __mode c.Int) unsafe.Pointer + +// Unmap and close a shared object opened by `dlopen'. +// The handle cannot be used again after calling `dlclose'. +// +//go:linkname Dlclose C.dlclose +func Dlclose(__handle unsafe.Pointer) c.Int + +// Find the run-time address in the shared object HANDLE refers to +// of the symbol called NAME. +// +//go:linkname Dlsym C.dlsym +func Dlsym(__handle unsafe.Pointer, __name *uint8) unsafe.Pointer + +// When any of the above functions fails, call this function +// to return a string describing the error. Each call resets +// the error string so that a following call returns null. +// +//go:linkname Dlerror C.dlerror +func Dlerror() *uint8 + +const ( + S_IFMT = 61440 + S_IFDIR = 16384 + S_IFCHR = 8192 + S_IFBLK = 24576 + S_IFREG = 32768 +) + +const S_IFIFO = 4096 + +const S_IFLNK = 40960 + +const S_IFSOCK = 49152 + +const ( + // Set user ID on execution. + S_ISUID = 2048 + // Set group ID on execution. + S_ISGID = 1024 +) + +// Save swapped text after use (sticky bit). This is pretty well obsolete. +const S_ISVTX = 512 + +const ( + // Read by owner. + S_IRUSR = 256 + // Write by owner. + S_IWUSR = 128 + // Execute by owner. + S_IXUSR = 64 +) + +// Read, write, and execute by owner. +const S_IRWXU = 448 + +const ( + // Read by group. + S_IRGRP = 32 + // Write by group. + S_IWGRP = 16 + // Execute by group. + S_IXGRP = 8 +) + +// Read, write, and execute by group. +const S_IRWXG = 56 + +const ( + // Read by others. + S_IROTH = 4 + // Write by others. + S_IWOTH = 2 + // Execute by others. + S_IXOTH = 1 +) + +// Read, write, and execute by others. +const S_IRWXO = 7 + +// Values for the second argument to access. +// These may be OR'd together. +const ( + R_OK = 4 + // Test for write permission. + W_OK = 2 + // Test for execute permission. + // Test for existence. + F_OK = 0 +) + +const ( + // Seek from beginning of file. + SEEK_SET = 0 + // Seek from current position. + SEEK_CUR = 1 + // Seek from end of file. + SEEK_END = 2 +) + +// Special value used to indicate +// the *at functions should use the +// current working directory. +const AT_FDCWD = -100 + +const ( + // Do not follow symbolic links. + AT_SYMLINK_NOFOLLOW = 256 + // Remove directory instead of + // unlinking file. + AT_REMOVEDIR = 512 +) + +// Follow symbolic links. +const AT_SYMLINK_FOLLOW = 1024 + +// Test access permitted for +// effective IDs, not real IDs. +const AT_EACCESS = 512 + +const ( + // Unlock a previously locked region. + F_ULOCK = 0 + // Lock a region for exclusive use. + F_LOCK = 1 + // Test and lock a region for exclusive use. + F_TLOCK = 2 + // Test a region for other processes locks. + F_TEST = 3 +) + +//go:linkname Lockf C.lockf +func Lockf(__fd c.Int, __cmd c.Int, __len c.Long) c.Int + +//go:linkname PosixFadvise C.posix_fadvise +func PosixFadvise(__fd c.Int, __offset c.Long, __len c.Long, __advise c.Int) c.Int + +//go:linkname PosixFallocate C.posix_fallocate +func PosixFallocate(__fd c.Int, __offset c.Long, __len c.Long) c.Int + +// Bits set in the FLAGS argument to `glob'. +const ( + GLOB_ERR = 1 + // Append a slash to each name. + GLOB_MARK = 2 + // Don't sort the names. + GLOB_NOSORT = 4 + // Insert PGLOB->gl_offs NULLs. + GLOB_DOOFFS = 8 + // If nothing matches, return the pattern. + GLOB_NOCHECK = 16 + // Append to results of a previous call. + GLOB_APPEND = 32 + // Backslashes don't quote metacharacters. + GLOB_NOESCAPE = 64 + // Leading `.' can be matched by metachars. + GLOB_PERIOD = 128 +) + +const ( + // Set in gl_flags if any metachars seen. + GLOB_MAGCHAR = 256 + // Use gl_opendir et al functions. + GLOB_ALTDIRFUNC = 512 + // Expand "{a,b}" to "a" "b". + GLOB_BRACE = 1024 + // If no magic chars, return the pattern. + GLOB_NOMAGIC = 2048 + // Expand ~user and ~ to home directories. + GLOB_TILDE = 4096 + // Match only directories. + GLOB_ONLYDIR = 8192 + // Like GLOB_TILDE but return an error + // if the user name is not available. + GLOB_TILDE_CHECK = 16384 +) + +// Error returns from `glob'. +const ( + GLOB_NOSPACE = 1 + // Read error. + GLOB_ABORTED = 2 + // No matches found. + GLOB_NOMATCH = 3 + // Not implemented. + GLOB_NOSYS = 4 +) + +// Reasonable value for the buffer sized used in the reentrant +// functions below. But better use `sysconf'. +const NSS_BUFLEN_GROUP = 1024 + +// The group structure. +type Group struct { + GrName *uint8 + GrPasswd *uint8 + GrGid c.Uint + GrMem **uint8 +} + +// Rewind the group-file stream. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Setgrent C.setgrent +func Setgrent() + +// Close the group-file stream. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endgrent C.endgrent +func Endgrent() + +// Read an entry from the group-file stream, opening it if necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getgrent C.getgrent +func Getgrent() *Group + +// Search for an entry with a matching group ID. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getgrgid C.getgrgid +func Getgrgid(__gid c.Uint) *Group + +// Search for an entry with a matching group name. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getgrnam C.getgrnam +func Getgrnam(__name *uint8) *Group + +// Search for an entry with a matching group ID. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname GetgrgidR C.getgrgid_r +func GetgrgidR(__gid c.Uint, __resultbuf *Group, __buffer *uint8, __buflen c.SizeT, __result **Group) c.Int + +// Search for an entry with a matching group name. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname GetgrnamR C.getgrnam_r +func GetgrnamR(__name *uint8, __resultbuf *Group, __buffer *uint8, __buflen c.SizeT, __result **Group) c.Int + +// Set the group set for the current user to GROUPS (N of them). +// +//go:linkname Setgroups C.setgroups +func Setgroups(__n c.SizeT, __groups *c.Uint) c.Int + +// Store at most *NGROUPS members of the group set for USER into +// GROUPS. Also include GROUP. The actual number of groups found is +// returned in *NGROUPS. Return -1 if the if *NGROUPS is too small. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Getgrouplist C.getgrouplist +func Getgrouplist(__user *uint8, __group c.Uint, __groups *c.Uint, __ngroups *c.Int) c.Int + +// Initialize the group set for the current user +// by reading the group database and using all groups +// of which USER is a member. Also include GROUP. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Initgroups C.initgroups +func Initgroups(__user *uint8, __group c.Uint) c.Int + +// Reasonable value for the buffer sized used in the reentrant +// functions below. But better use `sysconf'. +const NSS_BUFLEN_PASSWD = 1024 + +// The passwd structure. +type Passwd struct { + PwName *uint8 + PwPasswd *uint8 + PwUid c.Uint + PwGid c.Uint + PwGecos *uint8 + PwDir *uint8 + PwShell *uint8 +} + +// Rewind the password-file stream. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Setpwent C.setpwent +func Setpwent() + +// Close the password-file stream. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Endpwent C.endpwent +func Endpwent() + +// Read an entry from the password-file stream, opening it if necessary. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getpwent C.getpwent +func Getpwent() *Passwd + +// Write the given entry onto the given stream. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +// llgo:link (*Passwd).Putpwent C.putpwent +func (self *Passwd) Putpwent(__f *c.FILE) c.Int { + return 0 +} + +// Search for an entry with a matching user ID. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getpwuid C.getpwuid +func Getpwuid(__uid c.Uint) *Passwd + +// Search for an entry with a matching username. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getpwnam C.getpwnam +func Getpwnam(__name *uint8) *Passwd + +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +// llgo:link (*Passwd).GetpwentR C.getpwent_r +func (self *Passwd) GetpwentR(__buffer *uint8, __buflen c.SizeT, __result **Passwd) c.Int { + return 0 +} + +//go:linkname GetpwuidR C.getpwuid_r +func GetpwuidR(__uid c.Uint, __resultbuf *Passwd, __buffer *uint8, __buflen c.SizeT, __result **Passwd) c.Int + +//go:linkname GetpwnamR C.getpwnam_r +func GetpwnamR(__name *uint8, __resultbuf *Passwd, __buffer *uint8, __buflen c.SizeT, __result **Passwd) c.Int + +// Set scheduling parameters for a process. +// +//go:linkname SchedSetparam C.sched_setparam +func SchedSetparam(__pid c.Int, __param *SchedParam) c.Int + +// Retrieve scheduling parameters for a particular process. +// +//go:linkname SchedGetparam C.sched_getparam +func SchedGetparam(__pid c.Int, __param *SchedParam) c.Int + +// Set scheduling algorithm and/or parameters for a process. +// +//go:linkname SchedSetscheduler C.sched_setscheduler +func SchedSetscheduler(__pid c.Int, __policy c.Int, __param *SchedParam) c.Int + +// Retrieve scheduling algorithm for a particular purpose. +// +//go:linkname SchedGetscheduler C.sched_getscheduler +func SchedGetscheduler(__pid c.Int) c.Int + +// Yield the processor. +// +//go:linkname SchedYield C.sched_yield +func SchedYield() c.Int + +// Get maximum priority value for a scheduler. +// +//go:linkname SchedGetPriorityMax C.sched_get_priority_max +func SchedGetPriorityMax(__algorithm c.Int) c.Int + +// Get minimum priority value for a scheduler. +// +//go:linkname SchedGetPriorityMin C.sched_get_priority_min +func SchedGetPriorityMin(__algorithm c.Int) c.Int + +// Get the SCHED_RR interval for the named process. +// +//go:linkname SchedRrGetInterval C.sched_rr_get_interval +func SchedRrGetInterval(__pid c.Int, __t *lltime.Timespec) c.Int + +// Flags to be set in the `posix_spawnattr_t'. +const ( + POSIX_SPAWN_RESETIDS = 1 + POSIX_SPAWN_SETPGROUP = 2 + POSIX_SPAWN_SETSIGDEF = 4 + POSIX_SPAWN_SETSIGMASK = 8 + POSIX_SPAWN_SETSCHEDPARAM = 16 + POSIX_SPAWN_SETSCHEDULER = 32 +) + +// Data structure to contain attributes for thread creation. +type PosixSpawnattrT struct { + X__Flags int16 + X__Pgrp c.Int + X__Sd llsignal.SigsetT + X__Ss llsignal.SigsetT + X__Sp SchedParam + X__Policy c.Int + X__Pad [16]c.Int +} + +// Initialize data structure with attributes for `spawn' to default values. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrInit C.posix_spawnattr_init +func (self *PosixSpawnattrT) PosixSpawnattrInit() c.Int { + return 0 +} + +// Free resources associated with ATTR. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrDestroy C.posix_spawnattr_destroy +func (self *PosixSpawnattrT) PosixSpawnattrDestroy() c.Int { + return 0 +} + +// Store signal mask for signals with default handling from ATTR in +// SIGDEFAULT. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigdefault C.posix_spawnattr_getsigdefault +func (self *PosixSpawnattrT) PosixSpawnattrGetsigdefault(__sigdefault *llsignal.SigsetT) c.Int { + return 0 +} + +// Set signal mask for signals with default handling in ATTR to SIGDEFAULT. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigdefault C.posix_spawnattr_setsigdefault +func (self *PosixSpawnattrT) PosixSpawnattrSetsigdefault(__sigdefault *llsignal.SigsetT) c.Int { + return 0 +} + +// Store signal mask for the new process from ATTR in SIGMASK. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigmask C.posix_spawnattr_getsigmask +func (self *PosixSpawnattrT) PosixSpawnattrGetsigmask(__sigmask *llsignal.SigsetT) c.Int { + return 0 +} + +// Set signal mask for the new process in ATTR to SIGMASK. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigmask C.posix_spawnattr_setsigmask +func (self *PosixSpawnattrT) PosixSpawnattrSetsigmask(__sigmask *llsignal.SigsetT) c.Int { + return 0 +} + +// Get flag word from the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetflags C.posix_spawnattr_getflags +func (self *PosixSpawnattrT) PosixSpawnattrGetflags(__flags *int16) c.Int { + return 0 +} + +// Store flags in the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetflags C.posix_spawnattr_setflags +func (self *PosixSpawnattrT) PosixSpawnattrSetflags(__flags int16) c.Int { + return 0 +} + +// Get process group ID from the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetpgroup C.posix_spawnattr_getpgroup +func (self *PosixSpawnattrT) PosixSpawnattrGetpgroup(__pgroup *c.Int) c.Int { + return 0 +} + +// Store process group ID in the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetpgroup C.posix_spawnattr_setpgroup +func (self *PosixSpawnattrT) PosixSpawnattrSetpgroup(__pgroup c.Int) c.Int { + return 0 +} + +// Get scheduling policy from the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetschedpolicy C.posix_spawnattr_getschedpolicy +func (self *PosixSpawnattrT) PosixSpawnattrGetschedpolicy(__schedpolicy *c.Int) c.Int { + return 0 +} + +// Store scheduling policy in the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetschedpolicy C.posix_spawnattr_setschedpolicy +func (self *PosixSpawnattrT) PosixSpawnattrSetschedpolicy(__schedpolicy c.Int) c.Int { + return 0 +} + +// Get scheduling parameters from the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetschedparam C.posix_spawnattr_getschedparam +func (self *PosixSpawnattrT) PosixSpawnattrGetschedparam(__schedparam *SchedParam) c.Int { + return 0 +} + +// Store scheduling parameters in the attribute structure. +// +// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetschedparam C.posix_spawnattr_setschedparam +func (self *PosixSpawnattrT) PosixSpawnattrSetschedparam(__schedparam *SchedParam) c.Int { + return 0 +} + +const ( + // Seek from beginning of file. + L_SET = 0 + // Seek from current position. + L_INCR = 1 + // Seek from end of file. + L_XTND = 2 +) + +// Apply or remove an advisory lock, according to OPERATION, +// on the file FD refers to. +// +//go:linkname Flock C.flock +func Flock(__fd c.Int, __operation c.Int) c.Int + +//go:linkname Mmap C.mmap +func Mmap(__addr unsafe.Pointer, __len c.SizeT, __prot c.Int, __flags c.Int, __fd c.Int, __offset c.Long) unsafe.Pointer + +// Deallocate any mapping for the region starting at ADDR and extending LEN +// bytes. Returns 0 if successful, -1 for errors (and sets errno). +// +//go:linkname Munmap C.munmap +func Munmap(__addr unsafe.Pointer, __len c.SizeT) c.Int + +// Change the memory protection of the region starting at ADDR and +// extending LEN bytes to PROT. Returns 0 if successful, -1 for errors +// (and sets errno). +// +//go:linkname Mprotect C.mprotect +func Mprotect(__addr unsafe.Pointer, __len c.SizeT, __prot c.Int) c.Int + +// Synchronize the region starting at ADDR and extending LEN bytes with the +// file it maps. Filesystem operations on a file being mapped are +// unpredictable before this is done. Flags are from the MS_* set. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Msync C.msync +func Msync(__addr unsafe.Pointer, __len c.SizeT, __flags c.Int) c.Int + +// Advise the system about particular usage patterns the program follows +// for the region starting at ADDR and extending LEN bytes. +// +//go:linkname Madvise C.madvise +func Madvise(__addr unsafe.Pointer, __len c.SizeT, __advice c.Int) c.Int + +// This is the POSIX name for this function. +// +//go:linkname PosixMadvise C.posix_madvise +func PosixMadvise(__addr unsafe.Pointer, __len c.SizeT, __advice c.Int) c.Int + +// Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to +// be memory resident. +// +//go:linkname Mlock C.mlock +func Mlock(__addr unsafe.Pointer, __len c.SizeT) c.Int + +// Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN). +// +//go:linkname Munlock C.munlock +func Munlock(__addr unsafe.Pointer, __len c.SizeT) c.Int + +// Cause all currently mapped pages of the process to be memory resident +// until unlocked by a call to the `munlockall', until the process exits, +// or until the process calls `execve'. +// +//go:linkname Mlockall C.mlockall +func Mlockall(__flags c.Int) c.Int + +// All currently mapped pages of the process' address space become +// unlocked. +// +//go:linkname Munlockall C.munlockall +func Munlockall() c.Int + +// mincore returns the memory residency status of the pages in the +// current process's address space specified by [start, start + len). +// The status is returned in a vector of bytes. The least significant +// bit of each byte is 1 if the referenced page is in memory, otherwise +// it is zero. +// +//go:linkname Mincore C.mincore +func Mincore(__start unsafe.Pointer, __len c.SizeT, __vec *uint8) c.Int + +// Open shared memory segment. +// +//go:linkname ShmOpen C.shm_open +func ShmOpen(__name *uint8, __oflag c.Int, __mode c.Uint) c.Int + +// Remove shared memory segment. +// +//go:linkname ShmUnlink C.shm_unlink +func ShmUnlink(__name *uint8) c.Int + +// Return resource usage information on process indicated by WHO +// and put it in *USAGE. Returns 0 for success, -1 for failure. +// +//go:linkname Getrusage C.getrusage +func Getrusage(__who c.Int, __usage *Rusage) c.Int + +// Return the highest priority of any process specified by WHICH and WHO +// (see above); if WHO is zero, the current process, process group, or user +// (as specified by WHO) is used. A lower priority number means higher +// priority. Priorities range from PRIO_MIN to PRIO_MAX (above). +// +//go:linkname Getpriority C.getpriority +func Getpriority(__which c.Int, __who c.Uint) c.Int + +// Set the priority of all processes specified by WHICH and WHO (see above) +// to PRIO. Returns 0 on success, -1 on errors. +// +//go:linkname Setpriority C.setpriority +func Setpriority(__which c.Int, __who c.Uint, __prio c.Int) c.Int + +const ( + S_IREAD = 256 + S_IWRITE = 128 + S_IEXEC = 64 +) + +// Macros for common mode bit masks. +const ( + ACCESSPERMS = 511 + // 07777 + ALLPERMS = 4095 + // 0666 + DEFFILEMODE = 438 +) + +// Block size for `st_blocks'. +const S_BLKSIZE = 512 + +// Set file access permissions for c.FILE to MODE. +// If c.FILE is a symbolic link, this affects the link itself +// rather than its target. +// +//go:linkname Lchmod C.lchmod +func Lchmod(__file *uint8, __mode c.Uint) c.Int + +// Like mkdir, create a new directory with permission bits MODE. But +// interpret relative PATH names relative to the directory associated +// with FD. +// +//go:linkname Mkdirat C.mkdirat +func Mkdirat(__fd c.Int, __path *uint8, __mode c.Uint) c.Int + +// Like mknod, create a new device file with permission bits MODE and +// device number DEV. But interpret relative PATH names relative to +// the directory associated with FD. +// +//go:linkname Mknodat C.mknodat +func Mknodat(__fd c.Int, __path *uint8, __mode c.Uint, __dev c.Ulong) c.Int + +// Like mkfifo, create a new FIFO with permission bits MODE. But +// interpret relative PATH names relative to the directory associated +// with FD. +// +//go:linkname Mkfifoat C.mkfifoat +func Mkfifoat(__fd c.Int, __path *uint8, __mode c.Uint) c.Int + +// Set file access and modification times relative to directory file +// descriptor. +// +//go:linkname Utimensat C.utimensat +func Utimensat(__fd c.Int, __path *uint8, __times *lltime.Timespec, __flags c.Int) c.Int + +// Set file access and modification times of the file associated with FD. +// +//go:linkname Futimens C.futimens +func Futimens(__fd c.Int, __times *lltime.Timespec) c.Int + +//go:linkname Fstatvfs C.fstatvfs +func Fstatvfs(__fildes c.Int, __buf *Statvfs) c.Int + +// Structure describing CPU time used by a process and its children. +type Tms struct { + TmsUtime c.Long + TmsStime c.Long + TmsCutime c.Long + TmsCstime c.Long +} + +// Store the CPU time used by this process and all its +// dead children (and their dead children) in BUFFER. +// Return the elapsed real time, or (clock_t) -1 for errors. +// All times are in CLK_TCKths of a second. +// +// llgo:link (*Tms).Times C.times +func (self *Tms) Times() c.Long { + return 0 +} + +type FsidT = X__FsidT + +type CaddrT = X__CaddrT + +// Read data from file descriptor FD, and put the result in the +// buffers described by IOVEC, which is a vector of COUNT 'struct iovec's. +// The buffers are filled in the order specified. +// Operates just like 'read' (see ) except that data are +// put in IOVEC instead of a contiguous buffer. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Readv C.readv +func Readv(__fd c.Int, __iovec *c.Iovec, __count c.Int) c.SsizeT + +// Write data pointed by the buffers described by IOVEC, which +// is a vector of COUNT 'struct iovec's, to file descriptor FD. +// The data is written in the order specified. +// Operates just like 'write' (see ) except that the data +// are taken from IOVEC instead of a contiguous buffer. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Writev C.writev +func Writev(__fd c.Int, __iovec *c.Iovec, __count c.Int) c.SsizeT + +// Read data from file descriptor FD at the given position OFFSET +// without change the file pointer, and put the result in the buffers +// described by IOVEC, which is a vector of COUNT 'struct iovec's. +// The buffers are filled in the order specified. Operates just like +// 'pread' (see ) except that data are put in IOVEC instead +// of a contiguous buffer. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Preadv C.preadv +func Preadv(__fd c.Int, __iovec *c.Iovec, __count c.Int, __offset c.Long) c.SsizeT + +// Write data pointed by the buffers described by IOVEC, which is a +// vector of COUNT 'struct iovec's, to file descriptor FD at the given +// position OFFSET without change the file pointer. The data is +// written in the order specified. Operates just like 'pwrite' (see +// ) except that the data are taken from IOVEC instead of a +// contiguous buffer. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Pwritev C.pwritev +func Pwritev(__fd c.Int, __iovec *c.Iovec, __count c.Int, __offset c.Long) c.SsizeT + +// Note that SVID assumes all members have the same size. +const SYS_NMLN = 65 + +// Structure describing the system and machine. +type Utsname struct { + Sysname [65]uint8 + Nodename [65]uint8 + Release [65]uint8 + Version [65]uint8 + Machine [65]uint8 + X__Domainname [65]uint8 +} + +// Put information about the system in NAME. +// +// llgo:link (*Utsname).Uname C.uname +func (self *Utsname) Uname() c.Int { + return 0 +} + +const WCOREFLAG = 128 + +// Special values for the PID argument to `waitpid' and `wait4'. +const ( + WAIT_ANY = -1 + // Any process in my process group. + WAIT_MYPGRP = 0 +) + +type IdtypeT c.Uint + +const ( + P_ALL IdtypeT = 0 + P_PID IdtypeT = 1 + // Wait for members of process group. + P_PGID IdtypeT = 2 +) + +// Wait for a childing matching IDTYPE and ID to change the status and +// place appropriate information in *INFOP. +// If IDTYPE is P_PID, match any process whose process ID is ID. +// If IDTYPE is P_PGID, match any process whose process group is ID. +// If IDTYPE is P_ALL, match any process. +// If the WNOHANG bit is set in OPTIONS, and that child +// is not already dead, clear *INFOP and return 0. If successful, store +// exit code and status in *INFOP. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +// llgo:link IdtypeT.Waitid C.waitid +func (self IdtypeT) Waitid(__id c.Uint, __infop *llsignal.SiginfoT, __options c.Int) c.Int { + return 0 +} + +// Return the output baud rate stored in *TERMIOS_P. +// +// llgo:link (*Termios).Cfgetospeed C.cfgetospeed +func (self *Termios) Cfgetospeed() c.Uint { + return 0 +} + +// Return the input baud rate stored in *TERMIOS_P. +// +// llgo:link (*Termios).Cfgetispeed C.cfgetispeed +func (self *Termios) Cfgetispeed() c.Uint { + return 0 +} + +// Set the output baud rate stored in *TERMIOS_P to SPEED. +// +// llgo:link (*Termios).Cfsetospeed C.cfsetospeed +func (self *Termios) Cfsetospeed(__speed c.Uint) c.Int { + return 0 +} + +// Set the input baud rate stored in *TERMIOS_P to SPEED. +// +// llgo:link (*Termios).Cfsetispeed C.cfsetispeed +func (self *Termios) Cfsetispeed(__speed c.Uint) c.Int { + return 0 +} + +// Set both the input and output baud rates in *TERMIOS_OP to SPEED. +// +// llgo:link (*Termios).Cfsetspeed C.cfsetspeed +func (self *Termios) Cfsetspeed(__speed c.Uint) c.Int { + return 0 +} + +// Put the state of FD into *TERMIOS_P. +// +//go:linkname Tcgetattr C.tcgetattr +func Tcgetattr(__fd c.Int, __termios_p *Termios) c.Int + +// Set the state of FD to *TERMIOS_P. +// Values for OPTIONAL_ACTIONS (TCSA*) are in . +// +//go:linkname Tcsetattr C.tcsetattr +func Tcsetattr(__fd c.Int, __optional_actions c.Int, __termios_p *Termios) c.Int + +// Set *TERMIOS_P to indicate raw mode. +// +// llgo:link (*Termios).Cfmakeraw C.cfmakeraw +func (self *Termios) Cfmakeraw() { +} + +// Send zero bits on FD. +// +//go:linkname Tcsendbreak C.tcsendbreak +func Tcsendbreak(__fd c.Int, __duration c.Int) c.Int + +// Wait for pending output to be written on FD. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Tcdrain C.tcdrain +func Tcdrain(__fd c.Int) c.Int + +// Flush pending data on FD. +// Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in . +// +//go:linkname Tcflush C.tcflush +func Tcflush(__fd c.Int, __queue_selector c.Int) c.Int + +// Suspend or restart transmission on FD. +// Values for ACTION (TC[IO]{OFF,ON}) are in . +// +//go:linkname Tcflow C.tcflow +func Tcflow(__fd c.Int, __action c.Int) c.Int + +// Get process group ID for session leader for controlling terminal FD. +// +//go:linkname Tcgetsid C.tcgetsid +func Tcgetsid(__fd c.Int) c.Int + +// Standard file descriptors. +const ( + STDIN_FILENO = 0 + // Standard output. + STDOUT_FILENO = 1 + // Standard error output. + STDERR_FILENO = 2 +) + +// Test for access to NAME using the real UID and real GID. +// +//go:linkname Access C.access +func Access(__name *uint8, __type c.Int) c.Int + +// Read NBYTES into BUF from FD at the given position OFFSET without +// changing the file pointer. Return the number read, -1 for errors +// or 0 for EOF. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Pread C.pread +func Pread(__fd c.Int, __buf unsafe.Pointer, __nbytes c.SizeT, __offset c.Long) c.SsizeT + +// Write N bytes of BUF to FD at the given position OFFSET without +// changing the file pointer. Return the number written, or -1. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Pwrite C.pwrite +func Pwrite(__fd c.Int, __buf unsafe.Pointer, __n c.SizeT, __offset c.Long) c.SsizeT + +// Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. +// If SECONDS is zero, any currently scheduled alarm will be cancelled. +// The function returns the number of seconds remaining until the last +// alarm scheduled would have signaled, or zero if there wasn't one. +// There is no return value to indicate an error, but you can set `errno' +// to 0 and check its value after calling `alarm', and this might tell you. +// The signal may come late due to processor scheduling. +// +//go:linkname Alarm C.alarm +func Alarm(__seconds c.Uint) c.Uint + +// Make the process sleep for SECONDS seconds, or until a signal arrives +// and is not ignored. The function returns the number of seconds less +// than SECONDS which it actually slept (thus zero if it slept the full time). +// If a signal handler does a `longjmp' or modifies the handling of the +// SIGALRM signal while inside `sleep' call, the handling of the SIGALRM +// signal afterwards is undefined. There is no return value to indicate +// error, but if `sleep' returns SECONDS, it probably didn't work. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Sleep C.sleep +func Sleep(__seconds c.Uint) c.Uint + +// Set an alarm to go off (generating a SIGALRM signal) in VALUE +// microseconds. If INTERVAL is nonzero, when the alarm goes off, the +// timer is reset to go off every INTERVAL microseconds thereafter. +// Returns the number of microseconds remaining before the alarm. +// +//go:linkname Ualarm C.ualarm +func Ualarm(__value c.Uint, __interval c.Uint) c.Uint + +// Sleep USECONDS microseconds, or until a signal arrives that is not blocked +// or ignored. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Usleep C.usleep +func Usleep(__useconds c.Uint) c.Int + +// Suspend the process until a signal arrives. +// This always returns -1 and sets `errno' to EINTR. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname Pause C.pause +func Pause() c.Int + +// Put the absolute pathname of the current working directory in BUF. +// If successful, return BUF. If not, put an error message in +// BUF and return NULL. BUF should be at least PATH_MAX bytes long. +// +//go:linkname Getwd C.getwd +func Getwd(__buf *uint8) *uint8 + +// Execute the file FD refers to, overlaying the running program image. +// ARGV and ENVP are passed to the new program, as for `execve'. +// +//go:linkname Fexecve C.fexecve +func Fexecve(__fd c.Int, __argv **uint8, __envp **uint8) c.Int + +// Add INC to priority of the current process. +// +//go:linkname Nice C.nice +func Nice(__inc c.Int) c.Int + +// Terminate program execution with the low-order 8 bits of STATUS. +// +//go:linkname X_exit C._exit +func X_exit(__status c.Int) + +// Get file-specific configuration information about PATH. +// +//go:linkname Pathconf C.pathconf +func Pathconf(__path *uint8, __name c.Int) c.Long + +// Get file-specific configuration about descriptor FD. +// +//go:linkname Fpathconf C.fpathconf +func Fpathconf(__fd c.Int, __name c.Int) c.Long + +// Get the value of the system variable NAME. +// +//go:linkname Sysconf C.sysconf +func Sysconf(__name c.Int) c.Long + +// Get the value of the string-valued system variable NAME. +// +//go:linkname Confstr C.confstr +func Confstr(__name c.Int, __buf *uint8, __len c.SizeT) c.SizeT + +// Get the process group ID of the calling process. +// +//go:linkname Getpgrp C.getpgrp +func Getpgrp() c.Int + +//go:linkname Getpgid C.getpgid +func Getpgid(__pid c.Int) c.Int + +// Set the process group ID of the process matching PID to PGID. +// If PID is zero, the current process's process group ID is set. +// If PGID is zero, the process ID of the process is used. +// +//go:linkname Setpgid C.setpgid +func Setpgid(__pid c.Int, __pgid c.Int) c.Int + +// Set the process group ID of the calling process to its own PID. +// This is exactly the same as `setpgid (0, 0)'. +// +//go:linkname Setpgrp C.setpgrp +func Setpgrp() c.Int + +// Create a new session with the calling process as its leader. +// The process group IDs of the session and the calling process +// are set to the process ID of the calling process, which is returned. +// +//go:linkname Setsid C.setsid +func Setsid() c.Int + +// Return the session ID of the given process. +// +//go:linkname Getsid C.getsid +func Getsid(__pid c.Int) c.Int + +// If SIZE is zero, return the number of supplementary groups +// the calling process is in. Otherwise, fill in the group IDs +// of its supplementary groups in LIST and return the number written. +// +//go:linkname Getgroups C.getgroups +func Getgroups(__size c.Int, __list *c.Uint) c.Int + +// Set the user ID of the calling process to UID. +// If the calling process is the super-user, set the real +// and effective user IDs, and the saved set-user-ID to UID; +// if not, the effective user ID is set to UID. +// +//go:linkname Setuid C.setuid +func Setuid(__uid c.Uint) c.Int + +// Set the real user ID of the calling process to RUID, +// and the effective user ID of the calling process to EUID. +// +//go:linkname Setreuid C.setreuid +func Setreuid(__ruid c.Uint, __euid c.Uint) c.Int + +// Set the effective user ID of the calling process to UID. +// +//go:linkname Seteuid C.seteuid +func Seteuid(__uid c.Uint) c.Int + +// Set the group ID of the calling process to GID. +// If the calling process is the super-user, set the real +// and effective group IDs, and the saved set-group-ID to GID; +// if not, the effective group ID is set to GID. +// +//go:linkname Setgid C.setgid +func Setgid(__gid c.Uint) c.Int + +// Set the real group ID of the calling process to RGID, +// and the effective group ID of the calling process to EGID. +// +//go:linkname Setregid C.setregid +func Setregid(__rgid c.Uint, __egid c.Uint) c.Int + +// Set the effective group ID of the calling process to GID. +// +//go:linkname Setegid C.setegid +func Setegid(__gid c.Uint) c.Int + +// Clone the calling process, but without copying the whole address space. +// The calling process is suspended until the new process exits or is +// replaced by a call to `execve'. Return -1 for errors, 0 to the new process, +// and the process ID of the new process to the old process. +// +//go:linkname Vfork C.vfork +func Vfork() c.Int + +// Return the pathname of the terminal FD is open on, or NULL on errors. +// The returned storage is good only until the next call to this function. +// +//go:linkname Ttyname C.ttyname +func Ttyname(__fd c.Int) *uint8 + +// Store at most BUFLEN characters of the pathname of the terminal FD is +// open on in BUF. Return 0 on success, otherwise an error number. +// +//go:linkname TtynameR C.ttyname_r +func TtynameR(__fd c.Int, __buf *uint8, __buflen c.SizeT) c.Int + +// Return the index into the active-logins file (utmp) for +// the controlling terminal. +// +//go:linkname Ttyslot C.ttyslot +func Ttyslot() c.Int + +// Like link but relative paths in TO and FROM are interpreted relative +// to FROMFD and TOFD respectively. +// +//go:linkname Linkat C.linkat +func Linkat(__fromfd c.Int, __from *uint8, __tofd c.Int, __to *uint8, __flags c.Int) c.Int + +// Like symlink but a relative path in TO is interpreted relative to TOFD. +// +//go:linkname Symlinkat C.symlinkat +func Symlinkat(__from *uint8, __tofd c.Int, __to *uint8) c.Int + +// Like readlink but a relative PATH is interpreted relative to FD. +// +//go:linkname Readlinkat C.readlinkat +func Readlinkat(__fd c.Int, __path *uint8, __buf *uint8, __len c.SizeT) c.SsizeT + +// Return the foreground process group ID of FD. +// +//go:linkname Tcgetpgrp C.tcgetpgrp +func Tcgetpgrp(__fd c.Int) c.Int + +// Set the foreground process group ID of FD set PGRP_ID. +// +//go:linkname Tcsetpgrp C.tcsetpgrp +func Tcsetpgrp(__fd c.Int, __pgrp_id c.Int) c.Int + +// Return the login name of the user. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname Getlogin C.getlogin +func Getlogin() *uint8 + +// Return at most NAME_LEN characters of the login name of the user in NAME. +// If it cannot be determined or some other error occurred, return the error +// code. Otherwise return 0. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname GetloginR C.getlogin_r +func GetloginR(__name *uint8, __name_len c.SizeT) c.Int + +// Set the login name returned by `getlogin'. +// +//go:linkname Setlogin C.setlogin +func Setlogin(__name *uint8) c.Int + +// Put the name of the current host in no more than LEN bytes of NAME. +// The result is null-terminated if LEN is large enough for the full +// name and the terminator. +// +//go:linkname Gethostname C.gethostname +func Gethostname(__name *uint8, __len c.SizeT) c.Int + +// Set the name of the current host to NAME, which is LEN bytes long. +// This call is restricted to the super-user. +// +//go:linkname Sethostname C.sethostname +func Sethostname(__name *uint8, __len c.SizeT) c.Int + +// Set the current machine's Internet number to ID. +// This call is restricted to the super-user. +// +//go:linkname Sethostid C.sethostid +func Sethostid(__id c.Long) c.Int + +// Get and set the NIS (aka YP) domain name, if any. +// Called just like `gethostname' and `sethostname'. +// The NIS domain name is usually the empty string when not using NIS. +// +//go:linkname Getdomainname C.getdomainname +func Getdomainname(__name *uint8, __len c.SizeT) c.Int + +// Ignore +// +//go:linkname Setdomainname C.setdomainname +func Setdomainname(__name *uint8, __len c.SizeT) c.Int + +// Revoke access permissions to all processes currently communicating +// with the control terminal, and then send a SIGHUP signal to the process +// group of the control terminal. +// +//go:linkname Vhangup C.vhangup +func Vhangup() c.Int + +// Revoke the access of all descriptors currently open on c.FILE. +// +//go:linkname Revoke C.revoke +func Revoke(__file *uint8) c.Int + +// Enable statistical profiling, writing samples of the PC into at most +// SIZE bytes of SAMPLE_BUFFER; every processor clock tick while profiling +// is enabled, the system examines the user PC and increments +// SAMPLE_BUFFER[((PC - OFFSET) / 2) * SCALE / 65536]. If SCALE is zero, +// disable profiling. Returns zero on success, -1 on error. +// +//go:linkname Profil C.profil +func Profil(__sample_buffer *uint16, __size c.SizeT, __offset c.SizeT, __scale c.Uint) c.Int + +// Turn accounting on if NAME is an existing file. The system will then write +// a record for each process as it terminates, to this file. If NAME is NULL, +// turn accounting off. This call is restricted to the super-user. +// +//go:linkname Acct C.acct +func Acct(__name *uint8) c.Int + +// Successive calls return the shells listed in `/etc/shells'. +// +//go:linkname Getusershell C.getusershell +func Getusershell() *uint8 + +// Discard cached info. +// +//go:linkname Endusershell C.endusershell +func Endusershell() + +// Rewind and re-read the file. +// +//go:linkname Setusershell C.setusershell +func Setusershell() + +// Put the program in the background, and dissociate from the controlling +// terminal. If NOCHDIR is zero, do `chdir ("/")'. If NOCLOSE is zero, +// redirects stdin, stdout, and stderr to /dev/null. +// +//go:linkname Daemon C.daemon +func Daemon(__nochdir c.Int, __noclose c.Int) c.Int + +// Prompt with PROMPT and read a string from the terminal without echoing. +// Uses /dev/tty if possible; otherwise stderr and stdin. +// +//go:linkname Getpass C.getpass +func Getpass(__prompt *uint8) *uint8 + +// Return identifier for the current host. +// +//go:linkname Gethostid C.gethostid +func Gethostid() c.Long + +// Make all changes done to all files actually appear on disk. +// +//go:linkname Sync C.sync +func Sync() + +// Return the number of bytes in a page. This is the system's page size, +// which is not necessarily the same as the hardware page size. +// +//go:linkname Getpagesize C.getpagesize +func Getpagesize() c.Int + +// Return the maximum number of file descriptors +// the current process could possibly have. +// +//go:linkname Getdtablesize C.getdtablesize +func Getdtablesize() c.Int + +// Set the end of accessible data space (aka "the break") to ADDR. +// Returns zero on success and -1 for errors (with errno set). +// +//go:linkname Brk C.brk +func Brk(__addr unsafe.Pointer) c.Int + +// Increase or decrease the end of accessible data space by DELTA bytes. +// If successful, returns the address the previous end of data space +// (i.e. the beginning of the new space, if DELTA > 0); +// returns (void *) -1 for errors (with errno set). +// +//go:linkname Sbrk C.sbrk +func Sbrk(__delta c.IntptrT) unsafe.Pointer + +// Synchronize at least the data part of a file with the underlying +// media. +// +//go:linkname Fdatasync C.fdatasync +func Fdatasync(__fildes c.Int) c.Int + +// Structure describing file times. +type Utimbuf struct { + Actime c.Long + Modtime c.Long +} + +// Set the access and modification times of c.FILE to those given in +// FILE_TIMES. If FILE_TIMES is NULL, set them to the current time. +// +//go:linkname Utime C.utime +func Utime(__file *uint8, __file_times *Utimbuf) c.Int + +type Dirent struct { + DIno c.Ulong + DOff c.Long + DReclen uint16 + DType uint8 + DName [256]uint8 +} + +const ( + EAGAIN = 11 + F_GETFL = 3 + F_SETFL = 4 + O_ACCMODE = 3 + O_CREAT = 64 + O_NONBLOCK = 2048 + O_RDONLY = 0 + O_RDWR = 2 + O_TRUNC = 512 + O_WRONLY = 1 +) diff --git a/c/os/libgen_darwin_arm64.go b/c/os/libgen_darwin_arm64.go deleted file mode 100644 index b48b26ca..00000000 --- a/c/os/libgen_darwin_arm64.go +++ /dev/null @@ -1,22 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -//go:linkname Basename C.basename -func Basename(_llcppg_param1 *c.Char) *c.Char - -//go:linkname Dirname C.dirname -func Dirname(_llcppg_param1 *c.Char) *c.Char - -//go:linkname BasenameR C.basename_r -func BasenameR(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char) *c.Char - -//go:linkname DirnameR C.dirname_r -func DirnameR(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char) *c.Char diff --git a/c/os/libgen_linux_amd64.go b/c/os/libgen_linux_amd64.go deleted file mode 100644 index 49dee03a..00000000 --- a/c/os/libgen_linux_amd64.go +++ /dev/null @@ -1,27 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_LIBGEN_H = 1 - -// Return directory part of PATH or "." if none is available. -// -//go:linkname Dirname C.dirname -func Dirname(__path *c.Char) *c.Char - -// Return final component of PATH. -// -// This is the weird XPG version of this function. It sometimes will -// modify its argument. Therefore we normally use the GNU version (in -// ) and only if this header is included make the XPG -// version available under the real name. -// -//go:linkname X__XpgBasename C.__xpg_basename -func X__XpgBasename(__path *c.Char) *c.Char diff --git a/c/os/libgen_linux_arm64.go b/c/os/libgen_linux_arm64.go deleted file mode 100644 index 0430ede0..00000000 --- a/c/os/libgen_linux_arm64.go +++ /dev/null @@ -1,24 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import _ "unsafe" - -const X_LIBGEN_H = 1 - -// Return directory part of PATH or "." if none is available. -// -//go:linkname Dirname C.dirname -func Dirname(__path *uint8) *uint8 - -// Return final component of PATH. -// -// This is the weird XPG version of this function. It sometimes will -// modify its argument. Therefore we normally use the GNU version (in -// ) and only if this header is included make the XPG -// version available under the real name. -// -//go:linkname X__XpgBasename C.__xpg_basename -func X__XpgBasename(__path *uint8) *uint8 diff --git a/c/os/llcppg.pub b/c/os/llcppg.pub index fd78191c..c2f3bd92 100644 --- a/c/os/llcppg.pub +++ b/c/os/llcppg.pub @@ -3,142 +3,30 @@ D github.com/goplus/lib/c/sys D github.com/goplus/lib/c/time T DIR DIR T Dl_info DlInfo -T __blkcnt64_t X__Blkcnt64T -T __blkcnt_t X__BlkcntT -T __blksize_t X__BlksizeT T __caddr_t X__CaddrT -T __clock_t X__ClockT -T __clockid_t X__ClockidT -T __cpu_mask X__CpuMask -T __daddr_t X__DaddrT -T __darwin_blkcnt_t X__DarwinBlkcntT -T __darwin_blksize_t X__DarwinBlksizeT -T __darwin_clock_t X__DarwinClockT -T __darwin_ct_rune_t X__DarwinCtRuneT -T __darwin_dev_t X__DarwinDevT -T __darwin_fsblkcnt_t X__DarwinFsblkcntT -T __darwin_fsfilcnt_t X__DarwinFsfilcntT -T __darwin_gid_t X__DarwinGidT -T __darwin_id_t X__DarwinIdT -T __darwin_ino64_t X__DarwinIno64T -T __darwin_ino_t X__DarwinInoT -T __darwin_intptr_t X__DarwinIntptrT -T __darwin_mach_port_name_t X__DarwinMachPortNameT -T __darwin_mach_port_t X__DarwinMachPortT -T __darwin_mbstate_t X__DarwinMbstateT -T __darwin_mode_t X__DarwinModeT -T __darwin_natural_t X__DarwinNaturalT -T __darwin_off_t X__DarwinOffT -T __darwin_pid_t X__DarwinPidT -T __darwin_ptrdiff_t X__DarwinPtrdiffT -T __darwin_rune_t X__DarwinRuneT -T __darwin_sigset_t X__DarwinSigsetT -T __darwin_size_t X__DarwinSizeT -T __darwin_socklen_t X__DarwinSocklenT -T __darwin_ssize_t X__DarwinSsizeT -T __darwin_suseconds_t X__DarwinSusecondsT -T __darwin_time_t X__DarwinTimeT -T __darwin_uid_t X__DarwinUidT -T __darwin_useconds_t X__DarwinUsecondsT -T __darwin_uuid_string_t X__DarwinUuidStringT T __darwin_uuid_t X__DarwinUuidT -T __darwin_wchar_t X__DarwinWcharT -T __darwin_wint_t X__DarwinWintT -T __dev_t X__DevT -T __dirstream X__Dirstream -T __fsblkcnt64_t X__Fsblkcnt64T -T __fsblkcnt_t X__FsblkcntT -T __fsfilcnt64_t X__Fsfilcnt64T -T __fsfilcnt_t X__FsfilcntT T __fsid_t X__FsidT -T __fsword_t X__FswordT -T __gid_t X__GidT -T __id_t X__IdT -T __ino64_t X__Ino64T -T __ino_t X__InoT -T __int16_t X__Int16T -T __int32_t X__Int32T -T __int64_t X__Int64T -T __int8_t X__Int8T -T __intptr_t X__IntptrT -T __key_t X__KeyT -T __loff_t X__LoffT -T __mbstate_t X__MbstateT -T __mode_t X__ModeT -T __nlink_t X__NlinkT -T __off64_t X__Off64T -T __off_t X__OffT -T __pid_t X__PidT -T __priority_which X__PriorityWhich -T __priority_which_t X__PriorityWhichT -T __qaddr_t X__QaddrT -T __quad_t X__QuadT -T __rlim64_t X__Rlim64T -T __rlim_t X__RlimT -T __rlimit_resource X__RlimitResource -T __rlimit_resource_t X__RlimitResourceT -T __rusage_who X__RusageWho -T __rusage_who_t X__RusageWhoT -T __sched_param X__SchedParam -T __size_t X__SizeT -T __socklen_t X__SocklenT -T __spawn_action X__SpawnAction -T __ssize_t X__SsizeT -T __suseconds_t X__SusecondsT -T __syscall_slong_t X__SyscallSlongT -T __syscall_ulong_t X__SyscallUlongT -T __time_t X__TimeT -T __timer_t X__TimerT -T __u_char X__UChar -T __u_int X__UInt -T __u_long X__ULong -T __u_quad_t X__UQuadT -T __u_short X__UShort -T __uid_t X__UidT -T __uint16_t X__Uint16T -T __uint32_t X__Uint32T -T __uint64_t X__Uint64T -T __uint8_t X__Uint8T -T __useconds_t X__UsecondsT -T _filesec X_filesec -T _telldir X_telldir -T blkcnt_t BlkcntT -T blksize_t BlksizeT +T accessx_descriptor AccessxDescriptor T caddr_t CaddrT -T cc_t CcT -T clock_t ClockT -T cpu_set_t CpuSetT -T daddr_t DaddrT T dev_t DevT T dirent Dirent T dl_info DlInfo -T errno_t ErrnoT T fattributiontag Fattributiontag T fattributiontag_t FattributiontagT T fchecklv Fchecklv T fchecklv_t FchecklvT -T fd_mask FdMask -T fd_set FdSet T fgetsigsinfo Fgetsigsinfo T fgetsigsinfo_t FgetsigsinfoT T filesec_property_t FilesecPropertyT -T filesec_t FilesecT -T fixpt_t FixptT T flock FlockT T flocktimeout Flocktimeout T fpunchhole Fpunchhole T fpunchhole_t FpunchholeT -T fsblkcnt_t FsblkcntT -T fsfilcnt_t FsfilcntT -T fsid Fsid T fsid_t FsidT T fsignatures Fsignatures T fsignatures_t FsignaturesT -T fsobj_id FsobjId -T fsobj_id_t FsobjIdT T fspecread Fspecread T fspecread_t FspecreadT -T fssearchblock Fssearchblock T fstore Fstore T fstore_t FstoreT T fsupplement Fsupplement @@ -146,42 +34,20 @@ T fsupplement_t FsupplementT T ftrimactivefile Ftrimactivefile T ftrimactivefile_t FtrimactivefileT T gid_t GidT -T glob_t GlobT T group Group -T id_t IdT T idtype_t IdtypeT -T in_addr_t InAddrT -T in_port_t InPortT -T ino64_t Ino64T -T ino_t InoT -T int16_t Int16T -T int32_t Int32T -T int64_t Int64T -T int8_t Int8T -T intptr_t IntptrT -T kauth_cred_t KauthCredT -T key_t KeyT -T loff_t LoffT -T log2phys Log2phys T mach_port_t MachPortT T mode_t ModeT -T nlink_t NlinkT T off_t OffT T ostat Ostat T passwd Passwd T pid_t PidT -T posix_cred PosixCred -T posix_cred_t PosixCredT T posix_spawn_file_actions_t PosixSpawnFileActionsT T posix_spawnattr_t PosixSpawnattrT T proc_rlimit_control_wakeupmon ProcRlimitControlWakeupmon T qaddr_t QaddrT -T quad_t QuadT T radvisory Radvisory -T register_t RegisterT -T rlim_t RlimT T rlimit Rlimit -T rsize_t RsizeT T rusage Rusage T rusage_info_current RusageInfoCurrent T rusage_info_t RusageInfoT @@ -193,41 +59,13 @@ T rusage_info_v4 RusageInfoV4 T rusage_info_v5 RusageInfoV5 T rusage_info_v6 RusageInfoV6 T sched_param SchedParam -T searchstate Searchstate -T segsz_t SegszT T semaphore_t SemaphoreT -T size_t SizeT -T socklen_t SocklenT -T speed_t SpeedT -T ssize_t SsizeT T stat StatT T statvfs Statvfs -T suseconds_t SusecondsT -T swblk_t SwblkT -T tcflag_t TcflagT T termios Termios -T time_t TimeT -T timespec Timespec -T timeval Timeval T tms Tms -T u_char UChar -T u_int UInt -T u_int16_t UInt16T -T u_int32_t UInt32T -T u_int64_t UInt64T -T u_int8_t UInt8T -T u_long ULong -T u_quad_t UQuadT -T u_short UShort -T ucred Ucred T uid_t UidT -T uint Uint -T uintptr_t UintptrT T uio_rw UioRw -T ulong Ulong -T useconds_t UsecondsT -T ushort Ushort T utimbuf Utimbuf T utsname Utsname T uuid_t UuidT -T wait WaitStatus diff --git a/c/os/llcppg_darwin_arm64.go b/c/os/llcppg_darwin_arm64.go deleted file mode 100644 index e1b975fd..00000000 --- a/c/os/llcppg_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type SemaphoreT = MachPortT diff --git a/c/os/pwd_darwin_arm64.go b/c/os/pwd_darwin_arm64.go deleted file mode 100644 index 374d0483..00000000 --- a/c/os/pwd_darwin_arm64.go +++ /dev/null @@ -1,92 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const ( - X_PATH_PWD = "/etc" - X_PATH_PASSWD = "/etc/passwd" - X_PASSWD = "passwd" - X_PATH_MASTERPASSWD = "/etc/master.passwd" - X_PATH_MASTERPASSWD_LOCK = "/etc/ptmp" - X_MASTERPASSWD = "master.passwd" -) -const ( - X_PATH_MP_DB = "/etc/pwd.db" - X_MP_DB = "pwd.db" - X_PATH_SMP_DB = "/etc/spwd.db" - X_SMP_DB = "spwd.db" -) -const X_PATH_PWD_MKDB = "/usr/sbin/pwd_mkdb" - -// max length, not counting NULL -const X_PASSWORD_LEN = 128 -const ( - // flag for no specified uid. - X_PASSWORD_NOUID = 1 - // flag for no specified gid. - X_PASSWORD_NOGID = 2 - // flag for no specified change. - X_PASSWORD_NOCHG = 4 - // flag for no specified expire. - X_PASSWORD_NOEXP = 8 -) -const ( - // days to warn about expiry - X_PASSWORD_WARNDAYS = 14 - // special day to force password - // change at next login - X_PASSWORD_CHGNOW = -1 -) - -type Passwd struct { - PwName *c.Char - PwPasswd *c.Char - PwUid UidT - PwGid GidT - PwChange X__DarwinTimeT - PwClass *c.Char - PwGecos *c.Char - PwDir *c.Char - PwShell *c.Char - PwExpire X__DarwinTimeT -} - -//go:linkname Getpwuid C.getpwuid -func Getpwuid(_llcppg_param1 UidT) *Passwd - -//go:linkname Getpwnam C.getpwnam -func Getpwnam(_llcppg_param1 *c.Char) *Passwd - -//go:linkname GetpwuidR C.getpwuid_r -func GetpwuidR(_llcppg_param1 UidT, _llcppg_param2 *Passwd, _llcppg_param3 *c.Char, _llcppg_param4 SizeT, _llcppg_param5 **Passwd) c.Int - -//go:linkname GetpwnamR C.getpwnam_r -func GetpwnamR(_llcppg_param1 *c.Char, _llcppg_param2 *Passwd, _llcppg_param3 *c.Char, _llcppg_param4 SizeT, _llcppg_param5 **Passwd) c.Int - -//go:linkname Getpwent C.getpwent -func Getpwent() *Passwd - -//go:linkname Setpwent C.setpwent -func Setpwent() - -//go:linkname Endpwent C.endpwent -func Endpwent() - -//go:linkname Setpassent C.setpassent -func Setpassent(_llcppg_param1 c.Int) c.Int - -//go:linkname UserFromUid C.user_from_uid -func UserFromUid(_llcppg_param1 UidT, _llcppg_param2 c.Int) *c.Char - -//go:linkname Getpwuuid C.getpwuuid -func Getpwuuid(_llcppg_param1 UuidT) *Passwd - -//go:linkname GetpwuuidR C.getpwuuid_r -func GetpwuuidR(_llcppg_param1 UuidT, _llcppg_param2 *Passwd, _llcppg_param3 *c.Char, _llcppg_param4 SizeT, _llcppg_param5 **Passwd) c.Int diff --git a/c/os/pwd_linux_amd64.go b/c/os/pwd_linux_amd64.go deleted file mode 100644 index a58e9b2f..00000000 --- a/c/os/pwd_linux_amd64.go +++ /dev/null @@ -1,116 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_PWD_H = 1 - -// Reasonable value for the buffer sized used in the reentrant -// functions below. But better use `sysconf'. -const NSS_BUFLEN_PASSWD = 1024 - -// The passwd structure. -type Passwd struct { - PwName *c.Char - PwPasswd *c.Char - PwUid X__UidT - PwGid X__GidT - PwGecos *c.Char - PwDir *c.Char - PwShell *c.Char -} - -// Rewind the password-file stream. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Setpwent C.setpwent -func Setpwent() - -// Close the password-file stream. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Endpwent C.endpwent -func Endpwent() - -// Read an entry from the password-file stream, opening it if necessary. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getpwent C.getpwent -func Getpwent() *Passwd - -// Read an entry from STREAM. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Fgetpwent C.fgetpwent -func Fgetpwent(__stream *c.FILE) *Passwd - -// Write the given entry onto the given stream. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -// llgo:link (*Passwd).Putpwent C.putpwent -func (self *Passwd) Putpwent(__f *c.FILE) c.Int { - return 0 -} - -// Search for an entry with a matching user ID. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getpwuid C.getpwuid -func Getpwuid(__uid X__UidT) *Passwd - -// Search for an entry with a matching username. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getpwnam C.getpwnam -func Getpwnam(__name *c.Char) *Passwd - -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -// llgo:link (*Passwd).GetpwentR C.getpwent_r -func (self *Passwd) GetpwentR(__buffer *c.Char, __buflen SizeT, __result **Passwd) c.Int { - return 0 -} - -//go:linkname GetpwuidR C.getpwuid_r -func GetpwuidR(__uid X__UidT, __resultbuf *Passwd, __buffer *c.Char, __buflen SizeT, __result **Passwd) c.Int - -//go:linkname GetpwnamR C.getpwnam_r -func GetpwnamR(__name *c.Char, __resultbuf *Passwd, __buffer *c.Char, __buflen SizeT, __result **Passwd) c.Int - -// Read an entry from STREAM. This function is not standardized and -// probably never will. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname FgetpwentR C.fgetpwent_r -func FgetpwentR(__stream *c.FILE, __resultbuf *Passwd, __buffer *c.Char, __buflen SizeT, __result **Passwd) c.Int diff --git a/c/os/pwd_linux_arm64.go b/c/os/pwd_linux_arm64.go deleted file mode 100644 index 1093f2e8..00000000 --- a/c/os/pwd_linux_arm64.go +++ /dev/null @@ -1,116 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_PWD_H = 1 - -// Reasonable value for the buffer sized used in the reentrant -// functions below. But better use `sysconf'. -const NSS_BUFLEN_PASSWD = 1024 - -// The passwd structure. -type Passwd struct { - PwName *uint8 - PwPasswd *uint8 - PwUid X__UidT - PwGid X__GidT - PwGecos *uint8 - PwDir *uint8 - PwShell *uint8 -} - -// Rewind the password-file stream. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Setpwent C.setpwent -func Setpwent() - -// Close the password-file stream. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Endpwent C.endpwent -func Endpwent() - -// Read an entry from the password-file stream, opening it if necessary. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getpwent C.getpwent -func Getpwent() *Passwd - -// Read an entry from STREAM. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname Fgetpwent C.fgetpwent -func Fgetpwent(__stream *c.FILE) *Passwd - -// Write the given entry onto the given stream. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -// llgo:link (*Passwd).Putpwent C.putpwent -func (self *Passwd) Putpwent(__f *c.FILE) c.Int { - return 0 -} - -// Search for an entry with a matching user ID. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getpwuid C.getpwuid -func Getpwuid(__uid X__UidT) *Passwd - -// Search for an entry with a matching username. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getpwnam C.getpwnam -func Getpwnam(__name *uint8) *Passwd - -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -// llgo:link (*Passwd).GetpwentR C.getpwent_r -func (self *Passwd) GetpwentR(__buffer *uint8, __buflen SizeT, __result **Passwd) c.Int { - return 0 -} - -//go:linkname GetpwuidR C.getpwuid_r -func GetpwuidR(__uid X__UidT, __resultbuf *Passwd, __buffer *uint8, __buflen SizeT, __result **Passwd) c.Int - -//go:linkname GetpwnamR C.getpwnam_r -func GetpwnamR(__name *uint8, __resultbuf *Passwd, __buffer *uint8, __buflen SizeT, __result **Passwd) c.Int - -// Read an entry from STREAM. This function is not standardized and -// probably never will. -// -// This function is not part of POSIX and therefore no official -// cancellation point. But due to similarity with an POSIX interface -// or due to the implementation it is a cancellation point and -// therefore not marked with __THROW. -// -//go:linkname FgetpwentR C.fgetpwent_r -func FgetpwentR(__stream *c.FILE, __resultbuf *Passwd, __buffer *uint8, __buflen SizeT, __result **Passwd) c.Int diff --git a/c/os/sched_darwin_arm64.go b/c/os/sched_darwin_arm64.go deleted file mode 100644 index 3a271ee2..00000000 --- a/c/os/sched_darwin_arm64.go +++ /dev/null @@ -1,24 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type SchedParam struct { - SchedPriority c.Int - X__Opaque [4]c.Char -} - -//go:linkname SchedYield C.sched_yield -func SchedYield() c.Int - -//go:linkname SchedGetPriorityMin C.sched_get_priority_min -func SchedGetPriorityMin(_llcppg_param1 c.Int) c.Int - -//go:linkname SchedGetPriorityMax C.sched_get_priority_max -func SchedGetPriorityMax(_llcppg_param1 c.Int) c.Int diff --git a/c/os/sched_linux_amd64.go b/c/os/sched_linux_amd64.go deleted file mode 100644 index 614116ea..00000000 --- a/c/os/sched_linux_amd64.go +++ /dev/null @@ -1,53 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/lib/c/time" - _ "unsafe" -) - -const X_SCHED_H = 1 - -// Set scheduling parameters for a process. -// -//go:linkname SchedSetparam C.sched_setparam -func SchedSetparam(__pid X__PidT, __param *SchedParam) c.Int - -// Retrieve scheduling parameters for a particular process. -// -//go:linkname SchedGetparam C.sched_getparam -func SchedGetparam(__pid X__PidT, __param *SchedParam) c.Int - -// Set scheduling algorithm and/or parameters for a process. -// -//go:linkname SchedSetscheduler C.sched_setscheduler -func SchedSetscheduler(__pid X__PidT, __policy c.Int, __param *SchedParam) c.Int - -// Retrieve scheduling algorithm for a particular purpose. -// -//go:linkname SchedGetscheduler C.sched_getscheduler -func SchedGetscheduler(__pid X__PidT) c.Int - -// Yield the processor. -// -//go:linkname SchedYield C.sched_yield -func SchedYield() c.Int - -// Get maximum priority value for a scheduler. -// -//go:linkname SchedGetPriorityMax C.sched_get_priority_max -func SchedGetPriorityMax(__algorithm c.Int) c.Int - -// Get minimum priority value for a scheduler. -// -//go:linkname SchedGetPriorityMin C.sched_get_priority_min -func SchedGetPriorityMin(__algorithm c.Int) c.Int - -// Get the SCHED_RR interval for the named process. -// -//go:linkname SchedRrGetInterval C.sched_rr_get_interval -func SchedRrGetInterval(__pid X__PidT, __t *time.Timespec) c.Int diff --git a/c/os/sched_linux_arm64.go b/c/os/sched_linux_arm64.go deleted file mode 100644 index be21490f..00000000 --- a/c/os/sched_linux_arm64.go +++ /dev/null @@ -1,53 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/lib/c/time" - _ "unsafe" -) - -const X_SCHED_H = 1 - -// Set scheduling parameters for a process. -// -//go:linkname SchedSetparam C.sched_setparam -func SchedSetparam(__pid X__PidT, __param *SchedParam) c.Int - -// Retrieve scheduling parameters for a particular process. -// -//go:linkname SchedGetparam C.sched_getparam -func SchedGetparam(__pid X__PidT, __param *SchedParam) c.Int - -// Set scheduling algorithm and/or parameters for a process. -// -//go:linkname SchedSetscheduler C.sched_setscheduler -func SchedSetscheduler(__pid X__PidT, __policy c.Int, __param *SchedParam) c.Int - -// Retrieve scheduling algorithm for a particular purpose. -// -//go:linkname SchedGetscheduler C.sched_getscheduler -func SchedGetscheduler(__pid X__PidT) c.Int - -// Yield the processor. -// -//go:linkname SchedYield C.sched_yield -func SchedYield() c.Int - -// Get maximum priority value for a scheduler. -// -//go:linkname SchedGetPriorityMax C.sched_get_priority_max -func SchedGetPriorityMax(__algorithm c.Int) c.Int - -// Get minimum priority value for a scheduler. -// -//go:linkname SchedGetPriorityMin C.sched_get_priority_min -func SchedGetPriorityMin(__algorithm c.Int) c.Int - -// Get the SCHED_RR interval for the named process. -// -//go:linkname SchedRrGetInterval C.sched_rr_get_interval -func SchedRrGetInterval(__pid X__PidT, __t *time.Timespec) c.Int diff --git a/c/os/spawn_darwin_arm64.go b/c/os/spawn_darwin_arm64.go deleted file mode 100644 index 1fd440c3..00000000 --- a/c/os/spawn_darwin_arm64.go +++ /dev/null @@ -1,145 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/lib/c/signal" - _ "unsafe" -) - -// flags for CPU Security Mitigation attribute -// POSIX_SPAWN_NP_CSM_ALL should be used in most cases, -// the individual flags are provided only for performance evaluation etc -const ( - POSIX_SPAWN_NP_CSM_ALL = 1 - POSIX_SPAWN_NP_CSM_NOSMT = 2 - POSIX_SPAWN_NP_CSM_TECS = 4 -) - -// Opaque types for use with posix_spawn() family functions. Internals are -// not defined, and should not be accessed directly. Types are defined as -// mandated by POSIX. -type PosixSpawnattrT uintptr -type PosixSpawnFileActionsT uintptr - -//go:linkname PosixSpawn C.posix_spawn -func PosixSpawn(_llcppg_param1 *PidT, _llcppg_param2 *c.Char, _llcppg_param3 *PosixSpawnFileActionsT, _llcppg_param4 *PosixSpawnattrT, __argv **c.Char, __envp **c.Char) c.Int - -//go:linkname PosixSpawnp C.posix_spawnp -func PosixSpawnp(_llcppg_param1 *PidT, _llcppg_param2 *c.Char, _llcppg_param3 *PosixSpawnFileActionsT, _llcppg_param4 *PosixSpawnattrT, __argv **c.Char, __envp **c.Char) c.Int - -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddclose C.posix_spawn_file_actions_addclose -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddclose(_llcppg_param2 c.Int) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAdddup2 C.posix_spawn_file_actions_adddup2 -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAdddup2(_llcppg_param2 c.Int, _llcppg_param3 c.Int) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddopen C.posix_spawn_file_actions_addopen -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddopen(_llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 c.Int, _llcppg_param5 ModeT) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsDestroy C.posix_spawn_file_actions_destroy -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsDestroy() c.Int { - return 0 -} - -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsInit C.posix_spawn_file_actions_init -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsInit() c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrDestroy C.posix_spawnattr_destroy -func (self *PosixSpawnattrT) PosixSpawnattrDestroy() c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigdefault C.posix_spawnattr_getsigdefault -func (self *PosixSpawnattrT) PosixSpawnattrGetsigdefault(_llcppg_param2 *signal.SigsetT) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetflags C.posix_spawnattr_getflags -func (self *PosixSpawnattrT) PosixSpawnattrGetflags(_llcppg_param2 *int16) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetpgroup C.posix_spawnattr_getpgroup -func (self *PosixSpawnattrT) PosixSpawnattrGetpgroup(_llcppg_param2 *PidT) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigmask C.posix_spawnattr_getsigmask -func (self *PosixSpawnattrT) PosixSpawnattrGetsigmask(_llcppg_param2 *signal.SigsetT) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrInit C.posix_spawnattr_init -func (self *PosixSpawnattrT) PosixSpawnattrInit() c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigdefault C.posix_spawnattr_setsigdefault -func (self *PosixSpawnattrT) PosixSpawnattrSetsigdefault(_llcppg_param2 *signal.SigsetT) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetflags C.posix_spawnattr_setflags -func (self *PosixSpawnattrT) PosixSpawnattrSetflags(_llcppg_param2 int16) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetpgroup C.posix_spawnattr_setpgroup -func (self *PosixSpawnattrT) PosixSpawnattrSetpgroup(_llcppg_param2 PidT) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigmask C.posix_spawnattr_setsigmask -func (self *PosixSpawnattrT) PosixSpawnattrSetsigmask(_llcppg_param2 *signal.SigsetT) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetauditsessionportNp C.posix_spawnattr_setauditsessionport_np -func (self *PosixSpawnattrT) PosixSpawnattrSetauditsessionportNp(_llcppg_param2 MachPortT) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetspecialportNp C.posix_spawnattr_setspecialport_np -func (self *PosixSpawnattrT) PosixSpawnattrSetspecialportNp(_llcppg_param2 MachPortT, _llcppg_param3 c.Int) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetnosmtNp C.posix_spawnattr_setnosmt_np -func (self *PosixSpawnattrT) PosixSpawnattrSetnosmtNp() c.Int { - return 0 -} - -// Set CPU Security Mitigation on the spawned process -// This attribute affects all threads and is inherited on fork and exec -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetCsmNp C.posix_spawnattr_set_csm_np -func (self *PosixSpawnattrT) PosixSpawnattrSetCsmNp(flags c.Uint32T) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddinheritNp C.posix_spawn_file_actions_addinherit_np -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddinheritNp(_llcppg_param2 c.Int) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddchdirNp C.posix_spawn_file_actions_addchdir_np -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddchdirNp(_llcppg_param2 *c.Char) c.Int { - return 0 -} - -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddfchdirNp C.posix_spawn_file_actions_addfchdir_np -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddfchdirNp(_llcppg_param2 c.Int) c.Int { - return 0 -} diff --git a/c/os/spawn_linux_amd64.go b/c/os/spawn_linux_amd64.go deleted file mode 100644 index 87386ab1..00000000 --- a/c/os/spawn_linux_amd64.go +++ /dev/null @@ -1,199 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/lib/c/signal" - _ "unsafe" -) - -const X_SPAWN_H = 1 - -// Flags to be set in the `posix_spawnattr_t'. -const ( - POSIX_SPAWN_RESETIDS = 1 - POSIX_SPAWN_SETPGROUP = 2 - POSIX_SPAWN_SETSIGDEF = 4 - POSIX_SPAWN_SETSIGMASK = 8 - POSIX_SPAWN_SETSCHEDPARAM = 16 - POSIX_SPAWN_SETSCHEDULER = 32 -) - -// Data structure to contain attributes for thread creation. -type PosixSpawnattrT struct { - X__Flags int16 - X__Pgrp signal.PidT - X__Sd signal.SigsetT - X__Ss signal.SigsetT - X__Sp SchedParam - X__Policy c.Int - X__Pad [16]c.Int -} - -// Data structure to contain information about the actions to be -// performed in the new process with respect to file descriptors. -type PosixSpawnFileActionsT struct { - X__Allocated c.Int - X__Used c.Int - X__Actions *X__SpawnAction - X__Pad [16]c.Int -} -type X__SpawnAction struct { -} - -// Spawn a new process executing PATH with the attributes describes in *ATTRP. -// Before running the process perform the actions described in FILE-ACTIONS. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname PosixSpawn C.posix_spawn -func PosixSpawn(__pid *signal.PidT, __path *c.Char, __file_actions *PosixSpawnFileActionsT, __attrp *PosixSpawnattrT, __argv **c.Char, __envp **c.Char) c.Int - -// Similar to `posix_spawn' but search for FILE in the PATH. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname PosixSpawnp C.posix_spawnp -func PosixSpawnp(__pid *signal.PidT, __file *c.Char, __file_actions *PosixSpawnFileActionsT, __attrp *PosixSpawnattrT, __argv **c.Char, __envp **c.Char) c.Int - -// Initialize data structure with attributes for `spawn' to default values. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrInit C.posix_spawnattr_init -func (self *PosixSpawnattrT) PosixSpawnattrInit() c.Int { - return 0 -} - -// Free resources associated with ATTR. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrDestroy C.posix_spawnattr_destroy -func (self *PosixSpawnattrT) PosixSpawnattrDestroy() c.Int { - return 0 -} - -// Store signal mask for signals with default handling from ATTR in -// SIGDEFAULT. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigdefault C.posix_spawnattr_getsigdefault -func (self *PosixSpawnattrT) PosixSpawnattrGetsigdefault(__sigdefault *signal.SigsetT) c.Int { - return 0 -} - -// Set signal mask for signals with default handling in ATTR to SIGDEFAULT. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigdefault C.posix_spawnattr_setsigdefault -func (self *PosixSpawnattrT) PosixSpawnattrSetsigdefault(__sigdefault *signal.SigsetT) c.Int { - return 0 -} - -// Store signal mask for the new process from ATTR in SIGMASK. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigmask C.posix_spawnattr_getsigmask -func (self *PosixSpawnattrT) PosixSpawnattrGetsigmask(__sigmask *signal.SigsetT) c.Int { - return 0 -} - -// Set signal mask for the new process in ATTR to SIGMASK. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigmask C.posix_spawnattr_setsigmask -func (self *PosixSpawnattrT) PosixSpawnattrSetsigmask(__sigmask *signal.SigsetT) c.Int { - return 0 -} - -// Get flag word from the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetflags C.posix_spawnattr_getflags -func (self *PosixSpawnattrT) PosixSpawnattrGetflags(__flags *int16) c.Int { - return 0 -} - -// Store flags in the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetflags C.posix_spawnattr_setflags -func (self *PosixSpawnattrT) PosixSpawnattrSetflags(__flags int16) c.Int { - return 0 -} - -// Get process group ID from the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetpgroup C.posix_spawnattr_getpgroup -func (self *PosixSpawnattrT) PosixSpawnattrGetpgroup(__pgroup *signal.PidT) c.Int { - return 0 -} - -// Store process group ID in the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetpgroup C.posix_spawnattr_setpgroup -func (self *PosixSpawnattrT) PosixSpawnattrSetpgroup(__pgroup signal.PidT) c.Int { - return 0 -} - -// Get scheduling policy from the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetschedpolicy C.posix_spawnattr_getschedpolicy -func (self *PosixSpawnattrT) PosixSpawnattrGetschedpolicy(__schedpolicy *c.Int) c.Int { - return 0 -} - -// Store scheduling policy in the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetschedpolicy C.posix_spawnattr_setschedpolicy -func (self *PosixSpawnattrT) PosixSpawnattrSetschedpolicy(__schedpolicy c.Int) c.Int { - return 0 -} - -// Get scheduling parameters from the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetschedparam C.posix_spawnattr_getschedparam -func (self *PosixSpawnattrT) PosixSpawnattrGetschedparam(__schedparam *SchedParam) c.Int { - return 0 -} - -// Store scheduling parameters in the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetschedparam C.posix_spawnattr_setschedparam -func (self *PosixSpawnattrT) PosixSpawnattrSetschedparam(__schedparam *SchedParam) c.Int { - return 0 -} - -// Initialize data structure for file attribute for `spawn' call. -// -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsInit C.posix_spawn_file_actions_init -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsInit() c.Int { - return 0 -} - -// Free resources associated with FILE-ACTIONS. -// -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsDestroy C.posix_spawn_file_actions_destroy -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsDestroy() c.Int { - return 0 -} - -// Add an action to FILE-ACTIONS which tells the implementation to call -// `open' for the given file during the `spawn' call. -// -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddopen C.posix_spawn_file_actions_addopen -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddopen(__fd c.Int, __path *c.Char, __oflag c.Int, __mode ModeT) c.Int { - return 0 -} - -// Add an action to FILE-ACTIONS which tells the implementation to call -// `close' for the given file descriptor during the `spawn' call. -// -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddclose C.posix_spawn_file_actions_addclose -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddclose(__fd c.Int) c.Int { - return 0 -} - -// Add an action to FILE-ACTIONS which tells the implementation to call -// `dup2' for the given file descriptors during the `spawn' call. -// -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAdddup2 C.posix_spawn_file_actions_adddup2 -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAdddup2(__fd c.Int, __newfd c.Int) c.Int { - return 0 -} diff --git a/c/os/spawn_linux_arm64.go b/c/os/spawn_linux_arm64.go deleted file mode 100644 index 0bec7603..00000000 --- a/c/os/spawn_linux_arm64.go +++ /dev/null @@ -1,199 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/lib/c/signal" - _ "unsafe" -) - -const X_SPAWN_H = 1 - -// Flags to be set in the `posix_spawnattr_t'. -const ( - POSIX_SPAWN_RESETIDS = 1 - POSIX_SPAWN_SETPGROUP = 2 - POSIX_SPAWN_SETSIGDEF = 4 - POSIX_SPAWN_SETSIGMASK = 8 - POSIX_SPAWN_SETSCHEDPARAM = 16 - POSIX_SPAWN_SETSCHEDULER = 32 -) - -// Data structure to contain attributes for thread creation. -type PosixSpawnattrT struct { - X__Flags int16 - X__Pgrp signal.PidT - X__Sd signal.SigsetT - X__Ss signal.SigsetT - X__Sp SchedParam - X__Policy c.Int - X__Pad [16]c.Int -} - -// Data structure to contain information about the actions to be -// performed in the new process with respect to file descriptors. -type PosixSpawnFileActionsT struct { - X__Allocated c.Int - X__Used c.Int - X__Actions *X__SpawnAction - X__Pad [16]c.Int -} -type X__SpawnAction struct { -} - -// Spawn a new process executing PATH with the attributes describes in *ATTRP. -// Before running the process perform the actions described in FILE-ACTIONS. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname PosixSpawn C.posix_spawn -func PosixSpawn(__pid *signal.PidT, __path *uint8, __file_actions *PosixSpawnFileActionsT, __attrp *PosixSpawnattrT, __argv **uint8, __envp **uint8) c.Int - -// Similar to `posix_spawn' but search for FILE in the PATH. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname PosixSpawnp C.posix_spawnp -func PosixSpawnp(__pid *signal.PidT, __file *uint8, __file_actions *PosixSpawnFileActionsT, __attrp *PosixSpawnattrT, __argv **uint8, __envp **uint8) c.Int - -// Initialize data structure with attributes for `spawn' to default values. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrInit C.posix_spawnattr_init -func (self *PosixSpawnattrT) PosixSpawnattrInit() c.Int { - return 0 -} - -// Free resources associated with ATTR. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrDestroy C.posix_spawnattr_destroy -func (self *PosixSpawnattrT) PosixSpawnattrDestroy() c.Int { - return 0 -} - -// Store signal mask for signals with default handling from ATTR in -// SIGDEFAULT. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigdefault C.posix_spawnattr_getsigdefault -func (self *PosixSpawnattrT) PosixSpawnattrGetsigdefault(__sigdefault *signal.SigsetT) c.Int { - return 0 -} - -// Set signal mask for signals with default handling in ATTR to SIGDEFAULT. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigdefault C.posix_spawnattr_setsigdefault -func (self *PosixSpawnattrT) PosixSpawnattrSetsigdefault(__sigdefault *signal.SigsetT) c.Int { - return 0 -} - -// Store signal mask for the new process from ATTR in SIGMASK. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetsigmask C.posix_spawnattr_getsigmask -func (self *PosixSpawnattrT) PosixSpawnattrGetsigmask(__sigmask *signal.SigsetT) c.Int { - return 0 -} - -// Set signal mask for the new process in ATTR to SIGMASK. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetsigmask C.posix_spawnattr_setsigmask -func (self *PosixSpawnattrT) PosixSpawnattrSetsigmask(__sigmask *signal.SigsetT) c.Int { - return 0 -} - -// Get flag word from the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetflags C.posix_spawnattr_getflags -func (self *PosixSpawnattrT) PosixSpawnattrGetflags(__flags *int16) c.Int { - return 0 -} - -// Store flags in the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetflags C.posix_spawnattr_setflags -func (self *PosixSpawnattrT) PosixSpawnattrSetflags(__flags int16) c.Int { - return 0 -} - -// Get process group ID from the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetpgroup C.posix_spawnattr_getpgroup -func (self *PosixSpawnattrT) PosixSpawnattrGetpgroup(__pgroup *signal.PidT) c.Int { - return 0 -} - -// Store process group ID in the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetpgroup C.posix_spawnattr_setpgroup -func (self *PosixSpawnattrT) PosixSpawnattrSetpgroup(__pgroup signal.PidT) c.Int { - return 0 -} - -// Get scheduling policy from the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetschedpolicy C.posix_spawnattr_getschedpolicy -func (self *PosixSpawnattrT) PosixSpawnattrGetschedpolicy(__schedpolicy *c.Int) c.Int { - return 0 -} - -// Store scheduling policy in the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetschedpolicy C.posix_spawnattr_setschedpolicy -func (self *PosixSpawnattrT) PosixSpawnattrSetschedpolicy(__schedpolicy c.Int) c.Int { - return 0 -} - -// Get scheduling parameters from the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrGetschedparam C.posix_spawnattr_getschedparam -func (self *PosixSpawnattrT) PosixSpawnattrGetschedparam(__schedparam *SchedParam) c.Int { - return 0 -} - -// Store scheduling parameters in the attribute structure. -// -// llgo:link (*PosixSpawnattrT).PosixSpawnattrSetschedparam C.posix_spawnattr_setschedparam -func (self *PosixSpawnattrT) PosixSpawnattrSetschedparam(__schedparam *SchedParam) c.Int { - return 0 -} - -// Initialize data structure for file attribute for `spawn' call. -// -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsInit C.posix_spawn_file_actions_init -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsInit() c.Int { - return 0 -} - -// Free resources associated with FILE-ACTIONS. -// -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsDestroy C.posix_spawn_file_actions_destroy -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsDestroy() c.Int { - return 0 -} - -// Add an action to FILE-ACTIONS which tells the implementation to call -// `open' for the given file during the `spawn' call. -// -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddopen C.posix_spawn_file_actions_addopen -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddopen(__fd c.Int, __path *uint8, __oflag c.Int, __mode ModeT) c.Int { - return 0 -} - -// Add an action to FILE-ACTIONS which tells the implementation to call -// `close' for the given file descriptor during the `spawn' call. -// -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddclose C.posix_spawn_file_actions_addclose -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddclose(__fd c.Int) c.Int { - return 0 -} - -// Add an action to FILE-ACTIONS which tells the implementation to call -// `dup2' for the given file descriptors during the `spawn' call. -// -// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAdddup2 C.posix_spawn_file_actions_adddup2 -func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAdddup2(__fd c.Int, __newfd c.Int) c.Int { - return 0 -} diff --git a/c/os/sys-_types-_blkcnt_t_darwin_arm64.go b/c/os/sys-_types-_blkcnt_t_darwin_arm64.go deleted file mode 100644 index d4d3036a..00000000 --- a/c/os/sys-_types-_blkcnt_t_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type BlkcntT = X__DarwinBlkcntT diff --git a/c/os/sys-_types-_blksize_t_darwin_arm64.go b/c/os/sys-_types-_blksize_t_darwin_arm64.go deleted file mode 100644 index f91c23da..00000000 --- a/c/os/sys-_types-_blksize_t_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type BlksizeT = X__DarwinBlksizeT diff --git a/c/os/sys-_types-_caddr_t_darwin_arm64.go b/c/os/sys-_types-_caddr_t_darwin_arm64.go deleted file mode 100644 index f05841de..00000000 --- a/c/os/sys-_types-_caddr_t_darwin_arm64.go +++ /dev/null @@ -1,9 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -type CaddrT = *c.Char diff --git a/c/os/sys-_types-_clock_t_darwin_arm64.go b/c/os/sys-_types-_clock_t_darwin_arm64.go deleted file mode 100644 index 82193a07..00000000 --- a/c/os/sys-_types-_clock_t_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type ClockT = X__DarwinClockT diff --git a/c/os/sys-_types-_errno_t_darwin_arm64.go b/c/os/sys-_types-_errno_t_darwin_arm64.go deleted file mode 100644 index bacc4f10..00000000 --- a/c/os/sys-_types-_errno_t_darwin_arm64.go +++ /dev/null @@ -1,9 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -type ErrnoT = c.Int diff --git a/c/os/sys-_types-_fd_def_darwin_arm64.go b/c/os/sys-_types-_fd_def_darwin_arm64.go deleted file mode 100644 index d74e003a..00000000 --- a/c/os/sys-_types-_fd_def_darwin_arm64.go +++ /dev/null @@ -1,22 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const X__DARWIN_FD_SETSIZE = 1024 -const -// bits in a byte -X__DARWIN_NBBY = 8 - -type FdSet struct { - FdsBits [32]X__Int32T -} - -//go:linkname X__DarwinCheckFdSetOverflow C.__darwin_check_fd_set_overflow -func X__DarwinCheckFdSetOverflow(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 c.Int) c.Int diff --git a/c/os/sys-_types-_fd_setsize_darwin_arm64.go b/c/os/sys-_types-_fd_setsize_darwin_arm64.go deleted file mode 100644 index 148b9571..00000000 --- a/c/os/sys-_types-_fd_setsize_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -const FD_SETSIZE = 1024 diff --git a/c/os/sys-_types-_filesec_t_darwin_arm64.go b/c/os/sys-_types-_filesec_t_darwin_arm64.go deleted file mode 100644 index 3d44ce31..00000000 --- a/c/os/sys-_types-_filesec_t_darwin_arm64.go +++ /dev/null @@ -1,9 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type X_filesec struct { -} -type FilesecT = *X_filesec diff --git a/c/os/sys-_types-_fsblkcnt_t_darwin_arm64.go b/c/os/sys-_types-_fsblkcnt_t_darwin_arm64.go deleted file mode 100644 index 1ea1baae..00000000 --- a/c/os/sys-_types-_fsblkcnt_t_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type FsblkcntT = X__DarwinFsblkcntT diff --git a/c/os/sys-_types-_fsfilcnt_t_darwin_arm64.go b/c/os/sys-_types-_fsfilcnt_t_darwin_arm64.go deleted file mode 100644 index bc35e786..00000000 --- a/c/os/sys-_types-_fsfilcnt_t_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type FsfilcntT = X__DarwinFsfilcntT diff --git a/c/os/sys-_types-_fsid_t_darwin_arm64.go b/c/os/sys-_types-_fsid_t_darwin_arm64.go deleted file mode 100644 index 6fcbce7f..00000000 --- a/c/os/sys-_types-_fsid_t_darwin_arm64.go +++ /dev/null @@ -1,12 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type Fsid struct { - Val [2]Int32T -} - -// file system id type -type FsidT = Fsid diff --git a/c/os/sys-_types-_fsobj_id_t_darwin_arm64.go b/c/os/sys-_types-_fsobj_id_t_darwin_arm64.go deleted file mode 100644 index 55a04690..00000000 --- a/c/os/sys-_types-_fsobj_id_t_darwin_arm64.go +++ /dev/null @@ -1,11 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type FsobjId struct { - FidObjno UInt32T - FidGeneration UInt32T -} -type FsobjIdT = FsobjId diff --git a/c/os/sys-_types-_id_t_darwin_arm64.go b/c/os/sys-_types-_id_t_darwin_arm64.go deleted file mode 100644 index c75c63a0..00000000 --- a/c/os/sys-_types-_id_t_darwin_arm64.go +++ /dev/null @@ -1,8 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// can hold pid_t, gid_t, or uid_t -type IdT = X__DarwinIdT diff --git a/c/os/sys-_types-_in_addr_t_darwin_arm64.go b/c/os/sys-_types-_in_addr_t_darwin_arm64.go deleted file mode 100644 index 29b579ee..00000000 --- a/c/os/sys-_types-_in_addr_t_darwin_arm64.go +++ /dev/null @@ -1,8 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// base type for internet address -type InAddrT = X__Uint32T diff --git a/c/os/sys-_types-_in_port_t_darwin_arm64.go b/c/os/sys-_types-_in_port_t_darwin_arm64.go deleted file mode 100644 index 1e878c01..00000000 --- a/c/os/sys-_types-_in_port_t_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type InPortT = X__Uint16T diff --git a/c/os/sys-_types-_ino64_t_darwin_arm64.go b/c/os/sys-_types-_ino64_t_darwin_arm64.go deleted file mode 100644 index cd251e43..00000000 --- a/c/os/sys-_types-_ino64_t_darwin_arm64.go +++ /dev/null @@ -1,8 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// 64bit inode number -type Ino64T = X__DarwinIno64T diff --git a/c/os/sys-_types-_ino_t_darwin_arm64.go b/c/os/sys-_types-_ino_t_darwin_arm64.go deleted file mode 100644 index e9c23b07..00000000 --- a/c/os/sys-_types-_ino_t_darwin_arm64.go +++ /dev/null @@ -1,8 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// inode number -type InoT = X__DarwinInoT diff --git a/c/os/sys-_types-_int16_t_darwin_arm64.go b/c/os/sys-_types-_int16_t_darwin_arm64.go deleted file mode 100644 index c25179b3..00000000 --- a/c/os/sys-_types-_int16_t_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type Int16T = int16 diff --git a/c/os/sys-_types-_int32_t_darwin_arm64.go b/c/os/sys-_types-_int32_t_darwin_arm64.go deleted file mode 100644 index 1f3d8db1..00000000 --- a/c/os/sys-_types-_int32_t_darwin_arm64.go +++ /dev/null @@ -1,9 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -type Int32T = c.Int diff --git a/c/os/sys-_types-_int64_t_darwin_arm64.go b/c/os/sys-_types-_int64_t_darwin_arm64.go deleted file mode 100644 index fc9ee351..00000000 --- a/c/os/sys-_types-_int64_t_darwin_arm64.go +++ /dev/null @@ -1,9 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -type Int64T = c.LongLong diff --git a/c/os/sys-_types-_int8_t_darwin_arm64.go b/c/os/sys-_types-_int8_t_darwin_arm64.go deleted file mode 100644 index 2eac1d8d..00000000 --- a/c/os/sys-_types-_int8_t_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type Int8T = int8 diff --git a/c/os/sys-_types-_intptr_t_darwin_arm64.go b/c/os/sys-_types-_intptr_t_darwin_arm64.go deleted file mode 100644 index bc5a7fa8..00000000 --- a/c/os/sys-_types-_intptr_t_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type IntptrT = X__DarwinIntptrT diff --git a/c/os/sys-_types-_key_t_darwin_arm64.go b/c/os/sys-_types-_key_t_darwin_arm64.go deleted file mode 100644 index dc57f13b..00000000 --- a/c/os/sys-_types-_key_t_darwin_arm64.go +++ /dev/null @@ -1,8 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// IPC key (for Sys V IPC) -type KeyT = X__Int32T diff --git a/c/os/sys-_types-_mach_port_t_darwin_arm64.go b/c/os/sys-_types-_mach_port_t_darwin_arm64.go deleted file mode 100644 index 8dbab09c..00000000 --- a/c/os/sys-_types-_mach_port_t_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type MachPortT = X__DarwinMachPortT diff --git a/c/os/sys-_types-_nlink_t_darwin_arm64.go b/c/os/sys-_types-_nlink_t_darwin_arm64.go deleted file mode 100644 index 7cf0f3c3..00000000 --- a/c/os/sys-_types-_nlink_t_darwin_arm64.go +++ /dev/null @@ -1,8 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// link count -type NlinkT = X__Uint16T diff --git a/c/os/sys-_types-_o_dsync_darwin_arm64.go b/c/os/sys-_types-_o_dsync_darwin_arm64.go deleted file mode 100644 index f6c9067b..00000000 --- a/c/os/sys-_types-_o_dsync_darwin_arm64.go +++ /dev/null @@ -1,8 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// synch I/O data integrity -const O_DSYNC = 4194304 diff --git a/c/os/sys-_types-_o_sync_darwin_arm64.go b/c/os/sys-_types-_o_sync_darwin_arm64.go deleted file mode 100644 index 07c9ec09..00000000 --- a/c/os/sys-_types-_o_sync_darwin_arm64.go +++ /dev/null @@ -1,8 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// synch I/O file integrity -const O_SYNC = 128 diff --git a/c/os/sys-_types-_rsize_t_darwin_arm64.go b/c/os/sys-_types-_rsize_t_darwin_arm64.go deleted file mode 100644 index dfe00aad..00000000 --- a/c/os/sys-_types-_rsize_t_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type RsizeT = X__DarwinSizeT diff --git a/c/os/sys-_types-_s_ifmt_darwin_arm64.go b/c/os/sys-_types-_s_ifmt_darwin_arm64.go deleted file mode 100644 index 4be6fee9..00000000 --- a/c/os/sys-_types-_s_ifmt_darwin_arm64.go +++ /dev/null @@ -1,78 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// File type -const ( - S_IFMT = 61440 - // [XSI] named pipe (fifo) - S_IFIFO = 4096 - // [XSI] character special - S_IFCHR = 8192 - // [XSI] directory - S_IFDIR = 16384 - // [XSI] block special - S_IFBLK = 24576 - // [XSI] regular - S_IFREG = 32768 - // [XSI] symbolic link - S_IFLNK = 40960 - // [XSI] socket - S_IFSOCK = 49152 -) - -// OBSOLETE: whiteout -const S_IFWHT = 57344 - -// Read, write, execute/search by owner -const ( - S_IRWXU = 448 - // [XSI] R for owner - S_IRUSR = 256 - // [XSI] W for owner - S_IWUSR = 128 - // [XSI] X for owner - S_IXUSR = 64 -) - -// Read, write, execute/search by group -const ( - S_IRWXG = 56 - // [XSI] R for group - S_IRGRP = 32 - // [XSI] W for group - S_IWGRP = 16 - // [XSI] X for group - S_IXGRP = 8 -) - -// Read, write, execute/search by others -const ( - S_IRWXO = 7 - // [XSI] R for other - S_IROTH = 4 - // [XSI] W for other - S_IWOTH = 2 - // [XSI] X for other - S_IXOTH = 1 -) -const ( - // [XSI] set user id on execution - S_ISUID = 2048 - // [XSI] set group id on execution - S_ISGID = 1024 - // [XSI] directory restrcted delete - S_ISVTX = 512 -) -const ( - // sticky bit: not supported - S_ISTXT = 512 - // backward compatability - S_IREAD = 256 - // backward compatability - S_IWRITE = 128 - // backward compatability - S_IEXEC = 64 -) diff --git a/c/os/sys-_types-_seek_set_darwin_arm64.go b/c/os/sys-_types-_seek_set_darwin_arm64.go deleted file mode 100644 index 196ff97e..00000000 --- a/c/os/sys-_types-_seek_set_darwin_arm64.go +++ /dev/null @@ -1,20 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -const ( - // set file offset to offset - SEEK_SET = 0 - // set file offset to current plus offset - SEEK_CUR = 1 - // set file offset to EOF plus offset - SEEK_END = 2 -) - -// set file offset to the start of the next hole greater than or equal to the supplied offset -const SEEK_HOLE = 3 - -// set file offset to the start of the next non-hole file region greater than or equal to the supplied offset -const SEEK_DATA = 4 diff --git a/c/os/sys-_types-_size_t_darwin_arm64.go b/c/os/sys-_types-_size_t_darwin_arm64.go deleted file mode 100644 index 375ecd83..00000000 --- a/c/os/sys-_types-_size_t_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type SizeT = X__DarwinSizeT diff --git a/c/os/sys-_types-_ssize_t_darwin_arm64.go b/c/os/sys-_types-_ssize_t_darwin_arm64.go deleted file mode 100644 index 0b21d8f3..00000000 --- a/c/os/sys-_types-_ssize_t_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type SsizeT = X__DarwinSsizeT diff --git a/c/os/sys-_types-_suseconds_t_darwin_arm64.go b/c/os/sys-_types-_suseconds_t_darwin_arm64.go deleted file mode 100644 index 9010ad97..00000000 --- a/c/os/sys-_types-_suseconds_t_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type SusecondsT = X__DarwinSusecondsT diff --git a/c/os/sys-_types-_time_t_darwin_arm64.go b/c/os/sys-_types-_time_t_darwin_arm64.go deleted file mode 100644 index 667da2e7..00000000 --- a/c/os/sys-_types-_time_t_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type TimeT = X__DarwinTimeT diff --git a/c/os/sys-_types-_timespec_darwin_arm64.go b/c/os/sys-_types-_timespec_darwin_arm64.go deleted file mode 100644 index 83dd28e7..00000000 --- a/c/os/sys-_types-_timespec_darwin_arm64.go +++ /dev/null @@ -1,12 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -type Timespec struct { - TvSec X__DarwinTimeT - TvNsec c.Long -} diff --git a/c/os/sys-_types-_timeval_darwin_arm64.go b/c/os/sys-_types-_timeval_darwin_arm64.go deleted file mode 100644 index 56fc9819..00000000 --- a/c/os/sys-_types-_timeval_darwin_arm64.go +++ /dev/null @@ -1,10 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type Timeval struct { - TvSec X__DarwinTimeT - TvUsec X__DarwinSusecondsT -} diff --git a/c/os/sys-_types-_u_char_darwin_arm64.go b/c/os/sys-_types-_u_char_darwin_arm64.go deleted file mode 100644 index f0133dda..00000000 --- a/c/os/sys-_types-_u_char_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type UChar = uint8 diff --git a/c/os/sys-_types-_u_int16_t_darwin_arm64.go b/c/os/sys-_types-_u_int16_t_darwin_arm64.go deleted file mode 100644 index 7e005a82..00000000 --- a/c/os/sys-_types-_u_int16_t_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type UInt16T = uint16 diff --git a/c/os/sys-_types-_u_int32_t_darwin_arm64.go b/c/os/sys-_types-_u_int32_t_darwin_arm64.go deleted file mode 100644 index d19dedc1..00000000 --- a/c/os/sys-_types-_u_int32_t_darwin_arm64.go +++ /dev/null @@ -1,9 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -type UInt32T = c.Uint diff --git a/c/os/sys-_types-_u_int64_t_darwin_arm64.go b/c/os/sys-_types-_u_int64_t_darwin_arm64.go deleted file mode 100644 index ddecef84..00000000 --- a/c/os/sys-_types-_u_int64_t_darwin_arm64.go +++ /dev/null @@ -1,9 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -type UInt64T = c.UlongLong diff --git a/c/os/sys-_types-_u_int8_t_darwin_arm64.go b/c/os/sys-_types-_u_int8_t_darwin_arm64.go deleted file mode 100644 index 4a316e12..00000000 --- a/c/os/sys-_types-_u_int8_t_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type UInt8T = uint8 diff --git a/c/os/sys-_types-_u_int_darwin_arm64.go b/c/os/sys-_types-_u_int_darwin_arm64.go deleted file mode 100644 index 5bc999a7..00000000 --- a/c/os/sys-_types-_u_int_darwin_arm64.go +++ /dev/null @@ -1,9 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -type UInt = c.Uint diff --git a/c/os/sys-_types-_u_short_darwin_arm64.go b/c/os/sys-_types-_u_short_darwin_arm64.go deleted file mode 100644 index 2a2698cd..00000000 --- a/c/os/sys-_types-_u_short_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type UShort = uint16 diff --git a/c/os/sys-_types-_uintptr_t_darwin_arm64.go b/c/os/sys-_types-_uintptr_t_darwin_arm64.go deleted file mode 100644 index bfa58112..00000000 --- a/c/os/sys-_types-_uintptr_t_darwin_arm64.go +++ /dev/null @@ -1,9 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -type UintptrT = c.Ulong diff --git a/c/os/sys-_types-_useconds_t_darwin_arm64.go b/c/os/sys-_types-_useconds_t_darwin_arm64.go deleted file mode 100644 index 982d78d6..00000000 --- a/c/os/sys-_types-_useconds_t_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type UsecondsT = X__DarwinUsecondsT diff --git a/c/os/sys-_types-_uuid_t_darwin_arm64.go b/c/os/sys-_types-_uuid_t_darwin_arm64.go deleted file mode 100644 index 8dcdae86..00000000 --- a/c/os/sys-_types-_uuid_t_darwin_arm64.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type UuidT = X__DarwinUuidT diff --git a/c/os/sys-_types_darwin_arm64.go b/c/os/sys-_types_darwin_arm64.go deleted file mode 100644 index 1dcc04b1..00000000 --- a/c/os/sys-_types_darwin_arm64.go +++ /dev/null @@ -1,63 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -// total blocks -type X__DarwinBlkcntT = X__Int64T - -// preferred block size -type X__DarwinBlksizeT = X__Int32T - -// dev_t -type X__DarwinDevT = X__Int32T - -// Used by statvfs and fstatvfs -type X__DarwinFsblkcntT = c.Uint - -// Used by statvfs and fstatvfs -type X__DarwinFsfilcntT = c.Uint - -// [???] process and group IDs -type X__DarwinGidT = X__Uint32T - -// [XSI] pid_t, uid_t, or gid_t -type X__DarwinIdT = X__Uint32T - -// [???] Used for 64 bit inodes -type X__DarwinIno64T = X__Uint64T - -// [???] Used for inodes -type X__DarwinInoT = X__DarwinIno64T - -// Used by mach -type X__DarwinMachPortNameT = X__DarwinNaturalT - -// Used by mach -type X__DarwinMachPortT = X__DarwinMachPortNameT - -// [???] Some file attributes -type X__DarwinModeT = X__Uint16T - -// [???] Used for file sizes -type X__DarwinOffT = X__Int64T - -// [???] process and group IDs -type X__DarwinPidT = X__Int32T - -// [???] signal set -type X__DarwinSigsetT = X__Uint32T - -// [???] microseconds -type X__DarwinSusecondsT = X__Int32T - -// [???] user IDs -type X__DarwinUidT = X__Uint32T - -// [???] microseconds -type X__DarwinUsecondsT = X__Uint32T -type X__DarwinUuidT = [16]uint8 -type X__DarwinUuidStringT = [37]c.Char diff --git a/c/os/sys-dirent_darwin_arm64.go b/c/os/sys-dirent_darwin_arm64.go deleted file mode 100644 index 2709c9cf..00000000 --- a/c/os/sys-dirent_darwin_arm64.go +++ /dev/null @@ -1,24 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -const X__DARWIN_MAXNAMLEN = 255 -const X__DARWIN_MAXPATHLEN = 1024 - -// File types -const MAXNAMLEN = 255 - -// File types -const ( - DT_UNKNOWN = 0 - DT_FIFO = 1 - DT_CHR = 2 - DT_DIR = 4 - DT_BLK = 6 - DT_REG = 8 - DT_LNK = 10 - DT_SOCK = 12 - DT_WHT = 14 -) diff --git a/c/os/sys-fcntl_darwin_arm64.go b/c/os/sys-fcntl_darwin_arm64.go deleted file mode 100644 index 9ecb976f..00000000 --- a/c/os/sys-fcntl_darwin_arm64.go +++ /dev/null @@ -1,525 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const ( - FREAD = 1 - FWRITE = 2 -) -const -// set append mode -O_APPEND = 8 -const ( - // open with shared file lock - O_SHLOCK = 16 - // open with exclusive file lock - O_EXLOCK = 32 - // signal pgrp when data ready - O_ASYNC = 64 - // source compatibility: do not use - O_FSYNC = 128 - // don't follow symlinks - O_NOFOLLOW = 256 -) -const -// error if already exists -O_EXCL = 2048 - -// descriptor requested for event notifications only -const O_EVTONLY = 32768 - -// don't assign controlling terminal -const O_NOCTTY = 131072 -const O_DIRECTORY = 1048576 - -// allow open of a symlink -const O_SYMLINK = 2097152 - -// implicitly set FD_CLOEXEC -const O_CLOEXEC = 16777216 - -// no symlinks allowed in path -const O_NOFOLLOW_ANY = 536870912 -const ( - // open file for execute only - O_EXEC = 1073741824 - // open directory for search only - O_SEARCH = 1074790400 -) - -// Descriptor value for the current working directory -const AT_FDCWD = -2 - -// Flags for the at functions -const ( - AT_EACCESS = 16 - // Act on the symlink itself not the target - AT_SYMLINK_NOFOLLOW = 32 - // Act on target of symlink - AT_SYMLINK_FOLLOW = 64 - // Path refers to directory - AT_REMOVEDIR = 128 -) -const ( - // Return real device inodes resides on for fstatat(2) - AT_REALDEV = 512 - // Use only the fd and Ignore the path for fstatat(2) - AT_FDONLY = 1024 - // Path should not contain any symlinks - AT_SYMLINK_NOFOLLOW_ANY = 2048 -) - -// Data Protection Flags -const ( - O_DP_GETRAWENCRYPTED = 1 - O_DP_GETRAWUNENCRYPTED = 2 - O_DP_AUTHENTICATE = 4 -) - -// Descriptor value for openat_authenticated_np() to skip authentication with another fd -const AUTH_OPEN_NOAUTHFD = -1 -const ( - // kernel/compat - FAPPEND = 8 - // kernel/compat - FASYNC = 64 - // kernel - FFSYNC = 128 - // kernel - FFDSYNC = 4194304 -) -const ( - CPF_OVERWRITE = 1 - CPF_IGNORE_MODE = 2 - CPF_MASK = 3 -) - -// command values -const ( - F_DUPFD = 0 - // get file descriptor flags - F_GETFD = 1 - // set file descriptor flags - F_SETFD = 2 - // get SIGIO/SIGURG proc/pgrp - F_GETOWN = 5 - // set SIGIO/SIGURG proc/pgrp - F_SETOWN = 6 - // get record locking information - F_GETLK = 7 - // set record locking information - F_SETLK = 8 - // F_SETLK; wait if blocked - F_SETLKW = 9 -) - -// F_SETLK; wait if blocked, return on timeout -const F_SETLKWTIMEOUT = 10 -const ( - F_FLUSH_DATA = 40 - // Used for regression test - F_CHKCLEAN = 41 - // Preallocate storage - F_PREALLOCATE = 42 - // Truncate a file. Equivalent to calling truncate(2) - F_SETSIZE = 43 - // Issue an advisory read async with no copy to user - F_RDADVISE = 44 - // turn read ahead off/on for this fd - F_RDAHEAD = 45 -) - -// 46,47 used to be F_READBOOTSTRAP and F_WRITEBOOTSTRAP -const ( - F_NOCACHE = 48 - // file offset to device offset - F_LOG2PHYS = 49 - // return the full path of the fd - F_GETPATH = 50 - // fsync + ask the drive to flush to the media - F_FULLFSYNC = 51 - // find which component (if any) is a package - F_PATHPKG_CHECK = 52 - // "freeze" all fs operations - F_FREEZE_FS = 53 - // "thaw" all fs operations - F_THAW_FS = 54 - // turn data caching off/on (globally) for this file - F_GLOBAL_NOCACHE = 55 -) - -// add detached signatures -const F_ADDSIGS = 59 - -// add signature from same file (used by dyld for shared libs) -const F_ADDFILESIGS = 61 - -// used in conjunction with F_NOCACHE to indicate that DIRECT, synchonous writes -const F_NODIRECT = 62 -const ( - // Get the protection class of a file from the EA, returns int - F_GETPROTECTIONCLASS = 63 - // Set the protection class of a file for the EA, requires int - F_SETPROTECTIONCLASS = 64 -) - -// file offset to device offset, extended -const F_LOG2PHYS_EXT = 65 - -// See man fcntl(2) F_GETLK -// Similar to F_GETLK but in addition l_pid is treated as an input parameter -// which is used as a matching value when searching locks on the file -// so that only locks owned by the process with pid l_pid are returned. -// However, any flock(2) type lock will also be found with the returned value -// of l_pid set to -1 (as with F_GETLK). -const F_GETLKPID = 66 -const ( - // Mark the file as being the backing store for another filesystem - F_SETBACKINGSTORE = 70 - // return the full path of the FD, but error in specific mtmd circumstances - F_GETPATH_MTMINFO = 71 -) - -// Returns the code directory, with associated hashes, to the caller -const F_GETCODEDIR = 72 -const ( - // No SIGPIPE generated on EPIPE - F_SETNOSIGPIPE = 73 - // Status of SIGPIPE for this fd - F_GETNOSIGPIPE = 74 -) - -// For some cases, we need to rewrap the key for AKS/MKB -const F_TRANSCODEKEY = 75 - -// file being written to a by single writer... if throttling enabled, writes -const F_SINGLE_WRITER = 76 - -// Get the protection version number for this filesystem -const F_GETPROTECTIONLEVEL = 77 - -// Add detached code signatures (used by dyld for shared libs) -const F_FINDSIGS = 78 - -// Add signature from same file, only if it is signed by Apple (used by dyld for simulator) -const F_ADDFILESIGS_FOR_DYLD_SIM = 83 - -// fsync + issue barrier to drive -const F_BARRIERFSYNC = 85 -const ( - // Acquire or release open file description lock - F_OFD_SETLK = 90 - // (as F_OFD_SETLK but blocking if conflicting lock) - F_OFD_SETLKW = 91 - // Examine OFD lock - F_OFD_GETLK = 92 -) - -// (as F_OFD_SETLKW but return if timeout) -const F_OFD_SETLKWTIMEOUT = 93 -const ( - // Add signature from same file, return end offset in structure on success - F_ADDFILESIGS_RETURN = 97 - // Check if Library Validation allows this Mach-O file to be mapped into the calling process - F_CHECK_LV = 98 -) - -// Deallocate a range of the file -const F_PUNCHHOLE = 99 - -// Trim an active file -const F_TRIM_ACTIVE_FILE = 100 - -// Asynchronous advisory read fcntl for regular and compressed file -const F_SPECULATIVE_READ = 101 - -// return the full path without firmlinks of the fd -const F_GETPATH_NOFIRMLINK = 102 -const ( - // Add signature from same file, return information - F_ADDFILESIGS_INFO = 103 - // Add supplemental signature from same file with fd reference to original - F_ADDFILESUPPL = 104 - // Look up code signature information attached to a file or slice - F_GETSIGSINFO = 105 -) -const ( - // Acquire or release lease - F_SETLEASE = 106 - // Retrieve lease information - F_GETLEASE = 107 -) - -// Transfer allocated extents beyond leof to a different file -const F_TRANSFEREXTENTS = 110 - -// Based on flags, query/set/delete a file's attribution tag -const F_ATTRIBUTION_TAG = 111 - -// FS-specific fcntl()'s numbers begin at 0x00010000 and go up -const FCNTL_FS_SPECIFIC_BASE = 65536 - -// mark the dup with FD_CLOEXEC -const F_DUPFD_CLOEXEC = 67 - -// file descriptor flags (F_GETFD, F_SETFD) -const FD_CLOEXEC = 1 - -// record locking flags (F_GETLK, F_SETLK, F_SETLKW) -const ( - F_RDLCK = 1 - // unlock - F_UNLCK = 2 - // exclusive or write lock - F_WRLCK = 3 -) -const ( - // allocate contigious space - F_ALLOCATECONTIG = 2 - // allocate all requested space or no space at all - F_ALLOCATEALL = 4 - // do not free space upon close(2) - F_ALLOCATEPERSIST = 8 -) - -// Make it past all of the SEEK pos modes so that -const F_PEOFPOSMODE = 3 - -// we can keep them in sync should we desire -const F_VOLPOSMODE = 4 - -// detached code signatures data type - -// information passed by user to system used by F_ADDSIGS and F_ADDFILESIGS. -// F_ADDFILESIGS is a shortcut for files that contain their own signature and -// doesn't require mapping of the file in order to load the signature. -const USER_FSIGNATURES_CDHASH_LEN = 20 - -// At this time F_GETSIGSINFO can only indicate platformness. -// -// As additional requestable information is defined, new keys will be added and the -// fgetsigsinfo_t structure will be lengthened to add space for the additional information -const GETSIGSINFO_PLATFORM_BINARY = 1 - -// lock operations for flock(2) -const ( - LOCK_SH = 1 - // exclusive file lock - LOCK_EX = 2 - // don't block when locking - LOCK_NB = 4 - // unlock file - LOCK_UN = 8 -) - -// fattributiontag_t used by F_ATTRIBUTION_TAG -const ATTRIBUTION_NAME_MAX = 255 - -// ft_flags (F_ATTRIBUTION_TAG) -const ( - F_CREATE_TAG = 1 - F_DELETE_TAG = 2 - F_QUERY_TAG = 4 -) -const ( - // force window to popup on open - O_POPUP = 2147483648 - // small, clean popup window - O_ALERT = 536870912 -) - -// Advisory file segment locking data type - -// information passed to system by user -type FlockT struct { - LStart OffT - LLen OffT - LPid PidT - LType int16 - LWhence int16 -} - -// Advisory file segment locking with time out - -// Information passed to system by user for F_SETLKWTIMEOUT -type Flocktimeout struct { - Fl FlockT - Timeout Timespec -} -type Radvisory struct { - RaOffset OffT - RaCount c.Int -} -type Fsignatures struct { - FsFileStart OffT - FsBlobStart unsafe.Pointer - FsBlobSize SizeT - FsFsignaturesSize SizeT - FsCdhash [20]c.Char - FsHashType c.Int -} -type Fsupplement struct { - FsFileStart OffT - FsBlobStart OffT - FsBlobSize SizeT - FsOrigFd c.Int -} - -// DYLD needs to check if the object is allowed to be combined -// into the main binary. This is done between the code signature -// is loaded and dyld is doing all the work to process the LOAD commands. -// -// While this could be done in F_ADDFILESIGS.* family the hook into -// the MAC module doesn't say no when LV isn't enabled and then that -// is cached on the vnode, and the MAC module never gets change once -// a process that library validation enabled. -type Fchecklv struct { - LvFileStart OffT - LvErrorMessageSize SizeT - LvErrorMessage unsafe.Pointer -} - -// fgetsigsinfo_t used by F_GETSIGSINFO command -type Fgetsigsinfo struct { - FgFileStart OffT - FgInfoRequest c.Int - FgSigIsPlatform c.Int -} -type Fstore struct { - FstFlags c.Uint - FstPosmode c.Int - FstOffset OffT - FstLength OffT - FstBytesalloc OffT -} - -// fpunchhole_t used by F_PUNCHHOLE -type Fpunchhole struct { - FpFlags c.Uint - Reserved c.Uint - FpOffset OffT - FpLength OffT -} - -// factive_file_trim_t used by F_TRIM_ACTIVE_FILE -type Ftrimactivefile struct { - FtaOffset OffT - FtaLength OffT -} - -// fspecread_t used by F_SPECULATIVE_READ -type Fspecread struct { - FsrFlags c.Uint - Reserved c.Uint - FsrOffset OffT - FsrLength OffT -} -type Fattributiontag struct { - FtFlags c.Uint - FtHash c.UlongLong - FtAttributionName [255]c.Char -} -type Log2phys struct { - L2pFlags c.Uint - L2pContigbytes OffT - L2pDevoffset OffT -} -type FilesecPropertyT c.Uint - -const ( - FILESEC_OWNER FilesecPropertyT = 1 - FILESEC_GROUP FilesecPropertyT = 2 - FILESEC_UUID FilesecPropertyT = 3 - FILESEC_MODE FilesecPropertyT = 4 - FILESEC_ACL FilesecPropertyT = 5 - FILESEC_GRPUUID FilesecPropertyT = 6 - // XXX these are private to the implementation - FILESEC_ACL_RAW FilesecPropertyT = 100 - FILESEC_ACL_ALLOCSIZE FilesecPropertyT = 101 -) - -type FsignaturesT = Fsignatures -type FsupplementT = Fsupplement - -// DYLD needs to check if the object is allowed to be combined -// into the main binary. This is done between the code signature -// is loaded and dyld is doing all the work to process the LOAD commands. -// -// While this could be done in F_ADDFILESIGS.* family the hook into -// the MAC module doesn't say no when LV isn't enabled and then that -// is cached on the vnode, and the MAC module never gets change once -// a process that library validation enabled. -type FchecklvT = Fchecklv - -// fgetsigsinfo_t used by F_GETSIGSINFO command -type FgetsigsinfoT = Fgetsigsinfo -type FstoreT = Fstore - -// fpunchhole_t used by F_PUNCHHOLE -type FpunchholeT = Fpunchhole - -// factive_file_trim_t used by F_TRIM_ACTIVE_FILE -type FtrimactivefileT = Ftrimactivefile - -// fspecread_t used by F_SPECULATIVE_READ -type FspecreadT = Fspecread -type FattributiontagT = Fattributiontag - -// data-protected non-portable open(2) : -// -// int open_dprotected_np(user_addr_t path, int flags, int class, int dpflags, int mode) -// -//go:linkname OpenxNp C.openx_np -func OpenxNp(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 FilesecT) c.Int - -// data-protected non-portable open(2) : -// -// int open_dprotected_np(user_addr_t path, int flags, int class, int dpflags, int mode) -// -//go:linkname OpenDprotectedNp C.open_dprotected_np -func OpenDprotectedNp(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 c.Int, __llgo_va_list ...any) c.Int - -//go:linkname OpenatDprotectedNp C.openat_dprotected_np -func OpenatDprotectedNp(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.Int, _llcppg_param4 c.Int, _llcppg_param5 c.Int, __llgo_va_list ...any) c.Int - -//go:linkname OpenatAuthenticatedNp C.openat_authenticated_np -func OpenatAuthenticatedNp(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.Int, _llcppg_param4 c.Int) c.Int - -//go:linkname Flock C.flock -func Flock(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int - -//go:linkname FilesecInit C.filesec_init -func FilesecInit() FilesecT - -// llgo:link FilesecT.FilesecDup C.filesec_dup -func (self FilesecT) FilesecDup() FilesecT { - return self -} - -// llgo:link FilesecT.FilesecFree C.filesec_free -func (self FilesecT) FilesecFree() { -} - -// llgo:link FilesecT.FilesecGetProperty C.filesec_get_property -func (self FilesecT) FilesecGetProperty(_llcppg_param2 FilesecPropertyT, _llcppg_param3 unsafe.Pointer) c.Int { - return 0 -} - -// llgo:link FilesecT.FilesecQueryProperty C.filesec_query_property -func (self FilesecT) FilesecQueryProperty(_llcppg_param2 FilesecPropertyT, _llcppg_param3 *c.Int) c.Int { - return 0 -} - -// llgo:link FilesecT.FilesecSetProperty C.filesec_set_property -func (self FilesecT) FilesecSetProperty(_llcppg_param2 FilesecPropertyT, _llcppg_param3 unsafe.Pointer) c.Int { - return 0 -} - -// llgo:link FilesecT.FilesecUnsetProperty C.filesec_unset_property -func (self FilesecT) FilesecUnsetProperty(_llcppg_param2 FilesecPropertyT) c.Int { - return 0 -} diff --git a/c/os/sys-file_darwin_arm64.go b/c/os/sys-file_darwin_arm64.go deleted file mode 100644 index a8b01016..00000000 --- a/c/os/sys-file_darwin_arm64.go +++ /dev/null @@ -1,12 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -type PosixCred struct { -} -type Ucred struct { -} -type KauthCredT = *Ucred -type PosixCredT = *PosixCred diff --git a/c/os/sys-file_linux_amd64.go b/c/os/sys-file_linux_amd64.go deleted file mode 100644 index ff591373..00000000 --- a/c/os/sys-file_linux_amd64.go +++ /dev/null @@ -1,26 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_SYS_FILE_H = 1 -const ( - // Seek from beginning of file. - L_SET = 0 - // Seek from current position. - L_INCR = 1 - // Seek from end of file. - L_XTND = 2 -) - -// Apply or remove an advisory lock, according to OPERATION, -// on the file FD refers to. -// -//go:linkname Flock C.flock -func Flock(__fd c.Int, __operation c.Int) c.Int diff --git a/c/os/sys-file_linux_arm64.go b/c/os/sys-file_linux_arm64.go deleted file mode 100644 index 602b4761..00000000 --- a/c/os/sys-file_linux_arm64.go +++ /dev/null @@ -1,26 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_SYS_FILE_H = 1 -const ( - // Seek from beginning of file. - L_SET = 0 - // Seek from current position. - L_INCR = 1 - // Seek from end of file. - L_XTND = 2 -) - -// Apply or remove an advisory lock, according to OPERATION, -// on the file FD refers to. -// -//go:linkname Flock C.flock -func Flock(__fd c.Int, __operation c.Int) c.Int diff --git a/c/os/sys-mman_darwin_arm64.go b/c/os/sys-mman_darwin_arm64.go deleted file mode 100644 index aa860388..00000000 --- a/c/os/sys-mman_darwin_arm64.go +++ /dev/null @@ -1,229 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -// Protections are chosen from these bits, or-ed together -const ( - PROT_NONE = 0 - // [MC2] pages can be read - PROT_READ = 1 - // [MC2] pages can be written - PROT_WRITE = 2 - // [MC2] pages can be executed - PROT_EXEC = 4 -) - -// Flags contain sharing type and options. -// Sharing types; choose one. -const ( - MAP_SHARED = 1 - // [MF|SHM] changes are private - MAP_PRIVATE = 2 -) - -// Obsolete -const MAP_COPY = 2 - -// Other flags -const MAP_FIXED = 16 -const ( - // Sun: rename private pages to file - MAP_RENAME = 32 - // Sun: don't reserve needed swap area - MAP_NORESERVE = 64 - // previously unimplemented MAP_INHERIT - MAP_RESERVED0080 = 128 - // for MAP_FILE, don't change file size - MAP_NOEXTEND = 256 - // region may contain semaphores - MAP_HASSEMAPHORE = 512 - // don't cache pages for this mapping - MAP_NOCACHE = 1024 - // Allocate a region that will be used for JIT purposes - MAP_JIT = 2048 -) - -// Mapping type -const ( - MAP_FILE = 0 - // allocated from memory, swap space - MAP_ANON = 4096 - MAP_ANONYMOUS = 4096 -) - -// The MAP_RESILIENT_* flags can be used when the caller wants to map some -// possibly unreliable memory and be able to access it safely, possibly -// getting the wrong contents rather than raising any exception. -// For safety reasons, such mappings have to be read-only (PROT_READ access -// only). -// -// MAP_RESILIENT_CODESIGN: -// -// accessing this mapping will not generate code-signing violations, -// even if the contents are tainted. -// -// MAP_RESILIENT_MEDIA: -// -// accessing this mapping will not generate an exception if the contents -// are not available (unreachable removable or remote media, access beyond -// end-of-file, ...). Missing contents will be replaced with zeroes. -const ( - MAP_RESILIENT_CODESIGN = 8192 - // no backing-store failures - MAP_RESILIENT_MEDIA = 16384 -) - -// Return virtual addresses <4G only -const MAP_32BIT = 32768 - -// Flags used to support translated processes. -const MAP_TRANSLATED_ALLOW_EXECUTE = 131072 - -// UNIX03 compliance -const MAP_UNIX03 = 262144 - -// Allocate a region that will be protected by TPRO -const MAP_TPRO = 524288 - -// Process memory locking -const ( - MCL_CURRENT = 1 - // [ML] Lock all future memory as well - MCL_FUTURE = 2 -) - -// msync() flags -const ( - MS_ASYNC = 1 - // [MF|SIO] invalidate all cached data - MS_INVALIDATE = 2 - // [MF|SIO] msync synchronously - MS_SYNC = 16 -) -const ( - // invalidate pages, leave mapped - MS_KILLPAGES = 4 - // deactivate pages, leave mapped - MS_DEACTIVATE = 8 -) - -// Advice to madvise -const ( - POSIX_MADV_NORMAL = 0 - // [MC1] expect random page refs - POSIX_MADV_RANDOM = 1 - // [MC1] expect sequential page refs - POSIX_MADV_SEQUENTIAL = 2 - // [MC1] will need these pages - POSIX_MADV_WILLNEED = 3 - // [MC1] dont need these pages - POSIX_MADV_DONTNEED = 4 -) -const ( - MADV_NORMAL = 0 - MADV_RANDOM = 1 - MADV_SEQUENTIAL = 2 - MADV_WILLNEED = 3 - MADV_DONTNEED = 4 - // pages unneeded, discard contents - MADV_FREE = 5 - // zero the wired pages that have not been unwired before the entry is deleted - MADV_ZERO_WIRED_PAGES = 6 - // pages can be reused (by anyone) - MADV_FREE_REUSABLE = 7 - // caller wants to reuse those pages - MADV_FREE_REUSE = 8 - MADV_CAN_REUSE = 9 - // page out now (internal only) - MADV_PAGEOUT = 10 -) - -// Return bits from mincore -const ( - MINCORE_INCORE = 1 - // Page has been referenced by us - MINCORE_REFERENCED = 2 - // Page has been modified by us - MINCORE_MODIFIED = 4 - // Page has been referenced - MINCORE_REFERENCED_OTHER = 8 - // Page has been modified - MINCORE_MODIFIED_OTHER = 16 - // Page has been paged out - MINCORE_PAGED_OUT = 32 - // Page has been copied - MINCORE_COPIED = 64 - // Page belongs to an anonymous object - MINCORE_ANONYMOUS = 128 -) - -// [ML] -// -//go:linkname Mlockall C.mlockall -func Mlockall(_llcppg_param1 c.Int) c.Int - -// [MR] -// -//go:linkname Munlockall C.munlockall -func Munlockall() c.Int - -// [MR] -// -//go:linkname Mlock C.mlock -func Mlock(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT) c.Int - -// [MC3] -// -//go:linkname Mmap C.mmap -func Mmap(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT, _llcppg_param3 c.Int, _llcppg_param4 c.Int, _llcppg_param5 c.Int, _llcppg_param6 OffT) unsafe.Pointer - -// [MPR] -// -//go:linkname Mprotect C.mprotect -func Mprotect(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT, _llcppg_param3 c.Int) c.Int - -// [MF|SIO] -// -//go:linkname Msync C.msync -func Msync(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT, _llcppg_param3 c.Int) c.Int - -// [MR] -// -//go:linkname Munlock C.munlock -func Munlock(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT) c.Int - -// [MC3] -// -//go:linkname Munmap C.munmap -func Munmap(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT) c.Int - -// [SHM] -// -//go:linkname ShmOpen C.shm_open -func ShmOpen(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, __llgo_va_list ...any) c.Int - -// [ADV] -// -//go:linkname ShmUnlink C.shm_unlink -func ShmUnlink(_llcppg_param1 *c.Char) c.Int - -// [ADV] -// -//go:linkname PosixMadvise C.posix_madvise -func PosixMadvise(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT, _llcppg_param3 c.Int) c.Int - -//go:linkname Madvise C.madvise -func Madvise(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT, _llcppg_param3 c.Int) c.Int - -//go:linkname Mincore C.mincore -func Mincore(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT, _llcppg_param3 *c.Char) c.Int - -//go:linkname Minherit C.minherit -func Minherit(_llcppg_param1 unsafe.Pointer, _llcppg_param2 SizeT, _llcppg_param3 c.Int) c.Int diff --git a/c/os/sys-mman_linux_amd64.go b/c/os/sys-mman_linux_amd64.go deleted file mode 100644 index 4ef71645..00000000 --- a/c/os/sys-mman_linux_amd64.go +++ /dev/null @@ -1,92 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const X_SYS_MMAN_H = 1 - -//go:linkname Mmap C.mmap -func Mmap(__addr unsafe.Pointer, __len SizeT, __prot c.Int, __flags c.Int, __fd c.Int, __offset X__OffT) unsafe.Pointer - -// Deallocate any mapping for the region starting at ADDR and extending LEN -// bytes. Returns 0 if successful, -1 for errors (and sets errno). -// -//go:linkname Munmap C.munmap -func Munmap(__addr unsafe.Pointer, __len SizeT) c.Int - -// Change the memory protection of the region starting at ADDR and -// extending LEN bytes to PROT. Returns 0 if successful, -1 for errors -// (and sets errno). -// -//go:linkname Mprotect C.mprotect -func Mprotect(__addr unsafe.Pointer, __len SizeT, __prot c.Int) c.Int - -// Synchronize the region starting at ADDR and extending LEN bytes with the -// file it maps. Filesystem operations on a file being mapped are -// unpredictable before this is done. Flags are from the MS_* set. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Msync C.msync -func Msync(__addr unsafe.Pointer, __len SizeT, __flags c.Int) c.Int - -// Advise the system about particular usage patterns the program follows -// for the region starting at ADDR and extending LEN bytes. -// -//go:linkname Madvise C.madvise -func Madvise(__addr unsafe.Pointer, __len SizeT, __advice c.Int) c.Int - -// This is the POSIX name for this function. -// -//go:linkname PosixMadvise C.posix_madvise -func PosixMadvise(__addr unsafe.Pointer, __len SizeT, __advice c.Int) c.Int - -// Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to -// be memory resident. -// -//go:linkname Mlock C.mlock -func Mlock(__addr unsafe.Pointer, __len SizeT) c.Int - -// Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN). -// -//go:linkname Munlock C.munlock -func Munlock(__addr unsafe.Pointer, __len SizeT) c.Int - -// Cause all currently mapped pages of the process to be memory resident -// until unlocked by a call to the `munlockall', until the process exits, -// or until the process calls `execve'. -// -//go:linkname Mlockall C.mlockall -func Mlockall(__flags c.Int) c.Int - -// All currently mapped pages of the process' address space become -// unlocked. -// -//go:linkname Munlockall C.munlockall -func Munlockall() c.Int - -// mincore returns the memory residency status of the pages in the -// current process's address space specified by [start, start + len). -// The status is returned in a vector of bytes. The least significant -// bit of each byte is 1 if the referenced page is in memory, otherwise -// it is zero. -// -//go:linkname Mincore C.mincore -func Mincore(__start unsafe.Pointer, __len SizeT, __vec *uint8) c.Int - -// Open shared memory segment. -// -//go:linkname ShmOpen C.shm_open -func ShmOpen(__name *c.Char, __oflag c.Int, __mode ModeT) c.Int - -// Remove shared memory segment. -// -//go:linkname ShmUnlink C.shm_unlink -func ShmUnlink(__name *c.Char) c.Int diff --git a/c/os/sys-mman_linux_arm64.go b/c/os/sys-mman_linux_arm64.go deleted file mode 100644 index 60d4be73..00000000 --- a/c/os/sys-mman_linux_arm64.go +++ /dev/null @@ -1,92 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const X_SYS_MMAN_H = 1 - -//go:linkname Mmap C.mmap -func Mmap(__addr unsafe.Pointer, __len SizeT, __prot c.Int, __flags c.Int, __fd c.Int, __offset X__OffT) unsafe.Pointer - -// Deallocate any mapping for the region starting at ADDR and extending LEN -// bytes. Returns 0 if successful, -1 for errors (and sets errno). -// -//go:linkname Munmap C.munmap -func Munmap(__addr unsafe.Pointer, __len SizeT) c.Int - -// Change the memory protection of the region starting at ADDR and -// extending LEN bytes to PROT. Returns 0 if successful, -1 for errors -// (and sets errno). -// -//go:linkname Mprotect C.mprotect -func Mprotect(__addr unsafe.Pointer, __len SizeT, __prot c.Int) c.Int - -// Synchronize the region starting at ADDR and extending LEN bytes with the -// file it maps. Filesystem operations on a file being mapped are -// unpredictable before this is done. Flags are from the MS_* set. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Msync C.msync -func Msync(__addr unsafe.Pointer, __len SizeT, __flags c.Int) c.Int - -// Advise the system about particular usage patterns the program follows -// for the region starting at ADDR and extending LEN bytes. -// -//go:linkname Madvise C.madvise -func Madvise(__addr unsafe.Pointer, __len SizeT, __advice c.Int) c.Int - -// This is the POSIX name for this function. -// -//go:linkname PosixMadvise C.posix_madvise -func PosixMadvise(__addr unsafe.Pointer, __len SizeT, __advice c.Int) c.Int - -// Guarantee all whole pages mapped by the range [ADDR,ADDR+LEN) to -// be memory resident. -// -//go:linkname Mlock C.mlock -func Mlock(__addr unsafe.Pointer, __len SizeT) c.Int - -// Unlock whole pages previously mapped by the range [ADDR,ADDR+LEN). -// -//go:linkname Munlock C.munlock -func Munlock(__addr unsafe.Pointer, __len SizeT) c.Int - -// Cause all currently mapped pages of the process to be memory resident -// until unlocked by a call to the `munlockall', until the process exits, -// or until the process calls `execve'. -// -//go:linkname Mlockall C.mlockall -func Mlockall(__flags c.Int) c.Int - -// All currently mapped pages of the process' address space become -// unlocked. -// -//go:linkname Munlockall C.munlockall -func Munlockall() c.Int - -// mincore returns the memory residency status of the pages in the -// current process's address space specified by [start, start + len). -// The status is returned in a vector of bytes. The least significant -// bit of each byte is 1 if the referenced page is in memory, otherwise -// it is zero. -// -//go:linkname Mincore C.mincore -func Mincore(__start unsafe.Pointer, __len SizeT, __vec *uint8) c.Int - -// Open shared memory segment. -// -//go:linkname ShmOpen C.shm_open -func ShmOpen(__name *uint8, __oflag c.Int, __mode ModeT) c.Int - -// Remove shared memory segment. -// -//go:linkname ShmUnlink C.shm_unlink -func ShmUnlink(__name *uint8) c.Int diff --git a/c/os/sys-resource_darwin_arm64.go b/c/os/sys-resource_darwin_arm64.go deleted file mode 100644 index 2a654d4f..00000000 --- a/c/os/sys-resource_darwin_arm64.go +++ /dev/null @@ -1,468 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -// Possible values of the first parameter to getpriority()/setpriority(), -// used to indicate the type of the second parameter. -const ( - PRIO_PROCESS = 0 - // Second argument is a GID - PRIO_PGRP = 1 - // Second argument is a UID - PRIO_USER = 2 -) -const ( - // Second argument is always 0 (current thread) - PRIO_DARWIN_THREAD = 3 - // Second argument is a PID - PRIO_DARWIN_PROCESS = 4 -) - -// Range limitations for the value of the third parameter to setpriority(). -const ( - PRIO_MIN = -20 - PRIO_MAX = 20 -) - -// use PRIO_DARWIN_BG to set the current thread into "background" state -// which lowers CPU, disk IO, and networking priorites until thread terminates -// or "background" state is revoked -const PRIO_DARWIN_BG = 4096 - -// use PRIO_DARWIN_NONUI to restrict a process's ability to make calls to -// the GPU. (deprecated) -const PRIO_DARWIN_NONUI = 4097 - -// Possible values of the first parameter to getrusage(), used to indicate -// the scope of the information to be returned. -const ( - RUSAGE_SELF = 0 - // Current process' children - RUSAGE_CHILDREN = -1 -) - -// Flavors for proc_pid_rusage(). -const ( - RUSAGE_INFO_V0 = 0 - RUSAGE_INFO_V1 = 1 - RUSAGE_INFO_V2 = 2 - RUSAGE_INFO_V3 = 3 - RUSAGE_INFO_V4 = 4 - RUSAGE_INFO_V5 = 5 - RUSAGE_INFO_V6 = 6 - RUSAGE_INFO_CURRENT = 6 -) - -// Flags for RUSAGE_INFO_V5 -const RU_PROC_RUNS_RESLIDE = 1 - -// Possible values of the first parameter to getrlimit()/setrlimit(), to -// indicate for which resource the operation is being performed. -const ( - RLIMIT_CPU = 0 - // file size - RLIMIT_FSIZE = 1 - // data segment size - RLIMIT_DATA = 2 - // stack size - RLIMIT_STACK = 3 - // core file size - RLIMIT_CORE = 4 - // address space (resident set size) - RLIMIT_AS = 5 -) -const ( - // source compatibility alias - RLIMIT_RSS = 5 - // locked-in-memory address space - RLIMIT_MEMLOCK = 6 - // number of processes - RLIMIT_NPROC = 7 -) - -// number of open files -const RLIMIT_NOFILE = 8 - -// total number of resource limits -const RLIM_NLIMITS = 9 - -// Set bit for strict POSIX -const X_RLIMIT_POSIX_FLAG = 4096 - -// proc_rlimit_control() -// -// Resource limit flavors -const ( - RLIMIT_WAKEUPS_MONITOR = 1 - // Configure the CPU usage monitor. - RLIMIT_CPU_USAGE_MONITOR = 2 - // Configure a blocking, per-thread, CPU limits. - RLIMIT_THREAD_CPULIMITS = 3 - // Configure memory footprint interval tracking - RLIMIT_FOOTPRINT_INTERVAL = 4 -) - -// Flags for wakeups monitor control. -const ( - WAKEMON_ENABLE = 1 - WAKEMON_DISABLE = 2 - WAKEMON_GET_PARAMS = 4 - WAKEMON_SET_DEFAULTS = 8 - // Configure the task so that violations are fatal. - WAKEMON_MAKE_FATAL = 16 -) - -// Flags for CPU usage monitor control. -const CPUMON_MAKE_FATAL = 4096 - -// Flags for memory footprint interval tracking. -const FOOTPRINT_INTERVAL_RESET = 1 - -// I/O type -const ( - IOPOL_TYPE_DISK = 0 - IOPOL_TYPE_VFS_ATIME_UPDATES = 2 - IOPOL_TYPE_VFS_MATERIALIZE_DATALESS_FILES = 3 - IOPOL_TYPE_VFS_STATFS_NO_DATA_VOLUME = 4 - IOPOL_TYPE_VFS_TRIGGER_RESOLVE = 5 - IOPOL_TYPE_VFS_IGNORE_CONTENT_PROTECTION = 6 - IOPOL_TYPE_VFS_IGNORE_PERMISSIONS = 7 - IOPOL_TYPE_VFS_SKIP_MTIME_UPDATE = 8 - IOPOL_TYPE_VFS_ALLOW_LOW_SPACE_WRITES = 9 - IOPOL_TYPE_VFS_DISALLOW_RW_FOR_O_EVTONLY = 10 -) - -// scope -const ( - IOPOL_SCOPE_PROCESS = 0 - IOPOL_SCOPE_THREAD = 1 - IOPOL_SCOPE_DARWIN_BG = 2 -) - -// I/O Priority -const ( - IOPOL_DEFAULT = 0 - IOPOL_IMPORTANT = 1 - IOPOL_PASSIVE = 2 - IOPOL_THROTTLE = 3 - IOPOL_UTILITY = 4 - IOPOL_STANDARD = 5 -) - -// compatibility with older names -const ( - IOPOL_APPLICATION = 5 - IOPOL_NORMAL = 1 -) -const ( - IOPOL_ATIME_UPDATES_DEFAULT = 0 - IOPOL_ATIME_UPDATES_OFF = 1 -) -const ( - IOPOL_MATERIALIZE_DATALESS_FILES_DEFAULT = 0 - IOPOL_MATERIALIZE_DATALESS_FILES_OFF = 1 - IOPOL_MATERIALIZE_DATALESS_FILES_ON = 2 -) -const ( - IOPOL_VFS_STATFS_NO_DATA_VOLUME_DEFAULT = 0 - IOPOL_VFS_STATFS_FORCE_NO_DATA_VOLUME = 1 -) -const ( - IOPOL_VFS_TRIGGER_RESOLVE_DEFAULT = 0 - IOPOL_VFS_TRIGGER_RESOLVE_OFF = 1 -) -const ( - IOPOL_VFS_CONTENT_PROTECTION_DEFAULT = 0 - IOPOL_VFS_CONTENT_PROTECTION_IGNORE = 1 -) -const ( - IOPOL_VFS_IGNORE_PERMISSIONS_OFF = 0 - IOPOL_VFS_IGNORE_PERMISSIONS_ON = 1 -) -const ( - IOPOL_VFS_SKIP_MTIME_UPDATE_OFF = 0 - IOPOL_VFS_SKIP_MTIME_UPDATE_ON = 1 -) -const ( - IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_OFF = 0 - IOPOL_VFS_ALLOW_LOW_SPACE_WRITES_ON = 1 -) -const ( - IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_DEFAULT = 0 - IOPOL_VFS_DISALLOW_RW_FOR_O_EVTONLY_ON = 1 -) -const ( - IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_DEFAULT = 0 - IOPOL_VFS_NOCACHE_WRITE_FS_BLKSIZE_ON = 1 -) - -// A structure representing an accounting of resource utilization. The -// address of an instance of this structure is the second parameter to -// getrusage(). -// -// Note: All values other than ru_utime and ru_stime are implementaiton -// -// defined and subject to change in a future release. Their use -// is discouraged for standards compliant programs. -type Rusage struct { - RuUtime Timeval - RuStime Timeval - RuMaxrss c.Long - RuIxrss c.Long - RuIdrss c.Long - RuIsrss c.Long - RuMinflt c.Long - RuMajflt c.Long - RuNswap c.Long - RuInblock c.Long - RuOublock c.Long - RuMsgsnd c.Long - RuMsgrcv c.Long - RuNsignals c.Long - RuNvcsw c.Long - RuNivcsw c.Long -} -type RusageInfoV0 struct { - RiUuid [16]c.Uint8T - RiUserTime c.Uint64T - RiSystemTime c.Uint64T - RiPkgIdleWkups c.Uint64T - RiInterruptWkups c.Uint64T - RiPageins c.Uint64T - RiWiredSize c.Uint64T - RiResidentSize c.Uint64T - RiPhysFootprint c.Uint64T - RiProcStartAbstime c.Uint64T - RiProcExitAbstime c.Uint64T -} -type RusageInfoV1 struct { - RiUuid [16]c.Uint8T - RiUserTime c.Uint64T - RiSystemTime c.Uint64T - RiPkgIdleWkups c.Uint64T - RiInterruptWkups c.Uint64T - RiPageins c.Uint64T - RiWiredSize c.Uint64T - RiResidentSize c.Uint64T - RiPhysFootprint c.Uint64T - RiProcStartAbstime c.Uint64T - RiProcExitAbstime c.Uint64T - RiChildUserTime c.Uint64T - RiChildSystemTime c.Uint64T - RiChildPkgIdleWkups c.Uint64T - RiChildInterruptWkups c.Uint64T - RiChildPageins c.Uint64T - RiChildElapsedAbstime c.Uint64T -} -type RusageInfoV2 struct { - RiUuid [16]c.Uint8T - RiUserTime c.Uint64T - RiSystemTime c.Uint64T - RiPkgIdleWkups c.Uint64T - RiInterruptWkups c.Uint64T - RiPageins c.Uint64T - RiWiredSize c.Uint64T - RiResidentSize c.Uint64T - RiPhysFootprint c.Uint64T - RiProcStartAbstime c.Uint64T - RiProcExitAbstime c.Uint64T - RiChildUserTime c.Uint64T - RiChildSystemTime c.Uint64T - RiChildPkgIdleWkups c.Uint64T - RiChildInterruptWkups c.Uint64T - RiChildPageins c.Uint64T - RiChildElapsedAbstime c.Uint64T - RiDiskioBytesread c.Uint64T - RiDiskioByteswritten c.Uint64T -} -type RusageInfoV3 struct { - RiUuid [16]c.Uint8T - RiUserTime c.Uint64T - RiSystemTime c.Uint64T - RiPkgIdleWkups c.Uint64T - RiInterruptWkups c.Uint64T - RiPageins c.Uint64T - RiWiredSize c.Uint64T - RiResidentSize c.Uint64T - RiPhysFootprint c.Uint64T - RiProcStartAbstime c.Uint64T - RiProcExitAbstime c.Uint64T - RiChildUserTime c.Uint64T - RiChildSystemTime c.Uint64T - RiChildPkgIdleWkups c.Uint64T - RiChildInterruptWkups c.Uint64T - RiChildPageins c.Uint64T - RiChildElapsedAbstime c.Uint64T - RiDiskioBytesread c.Uint64T - RiDiskioByteswritten c.Uint64T - RiCpuTimeQosDefault c.Uint64T - RiCpuTimeQosMaintenance c.Uint64T - RiCpuTimeQosBackground c.Uint64T - RiCpuTimeQosUtility c.Uint64T - RiCpuTimeQosLegacy c.Uint64T - RiCpuTimeQosUserInitiated c.Uint64T - RiCpuTimeQosUserInteractive c.Uint64T - RiBilledSystemTime c.Uint64T - RiServicedSystemTime c.Uint64T -} -type RusageInfoV4 struct { - RiUuid [16]c.Uint8T - RiUserTime c.Uint64T - RiSystemTime c.Uint64T - RiPkgIdleWkups c.Uint64T - RiInterruptWkups c.Uint64T - RiPageins c.Uint64T - RiWiredSize c.Uint64T - RiResidentSize c.Uint64T - RiPhysFootprint c.Uint64T - RiProcStartAbstime c.Uint64T - RiProcExitAbstime c.Uint64T - RiChildUserTime c.Uint64T - RiChildSystemTime c.Uint64T - RiChildPkgIdleWkups c.Uint64T - RiChildInterruptWkups c.Uint64T - RiChildPageins c.Uint64T - RiChildElapsedAbstime c.Uint64T - RiDiskioBytesread c.Uint64T - RiDiskioByteswritten c.Uint64T - RiCpuTimeQosDefault c.Uint64T - RiCpuTimeQosMaintenance c.Uint64T - RiCpuTimeQosBackground c.Uint64T - RiCpuTimeQosUtility c.Uint64T - RiCpuTimeQosLegacy c.Uint64T - RiCpuTimeQosUserInitiated c.Uint64T - RiCpuTimeQosUserInteractive c.Uint64T - RiBilledSystemTime c.Uint64T - RiServicedSystemTime c.Uint64T - RiLogicalWrites c.Uint64T - RiLifetimeMaxPhysFootprint c.Uint64T - RiInstructions c.Uint64T - RiCycles c.Uint64T - RiBilledEnergy c.Uint64T - RiServicedEnergy c.Uint64T - RiIntervalMaxPhysFootprint c.Uint64T - RiRunnableTime c.Uint64T -} -type RusageInfoV5 struct { - RiUuid [16]c.Uint8T - RiUserTime c.Uint64T - RiSystemTime c.Uint64T - RiPkgIdleWkups c.Uint64T - RiInterruptWkups c.Uint64T - RiPageins c.Uint64T - RiWiredSize c.Uint64T - RiResidentSize c.Uint64T - RiPhysFootprint c.Uint64T - RiProcStartAbstime c.Uint64T - RiProcExitAbstime c.Uint64T - RiChildUserTime c.Uint64T - RiChildSystemTime c.Uint64T - RiChildPkgIdleWkups c.Uint64T - RiChildInterruptWkups c.Uint64T - RiChildPageins c.Uint64T - RiChildElapsedAbstime c.Uint64T - RiDiskioBytesread c.Uint64T - RiDiskioByteswritten c.Uint64T - RiCpuTimeQosDefault c.Uint64T - RiCpuTimeQosMaintenance c.Uint64T - RiCpuTimeQosBackground c.Uint64T - RiCpuTimeQosUtility c.Uint64T - RiCpuTimeQosLegacy c.Uint64T - RiCpuTimeQosUserInitiated c.Uint64T - RiCpuTimeQosUserInteractive c.Uint64T - RiBilledSystemTime c.Uint64T - RiServicedSystemTime c.Uint64T - RiLogicalWrites c.Uint64T - RiLifetimeMaxPhysFootprint c.Uint64T - RiInstructions c.Uint64T - RiCycles c.Uint64T - RiBilledEnergy c.Uint64T - RiServicedEnergy c.Uint64T - RiIntervalMaxPhysFootprint c.Uint64T - RiRunnableTime c.Uint64T - RiFlags c.Uint64T -} -type RusageInfoV6 struct { - RiUuid [16]c.Uint8T - RiUserTime c.Uint64T - RiSystemTime c.Uint64T - RiPkgIdleWkups c.Uint64T - RiInterruptWkups c.Uint64T - RiPageins c.Uint64T - RiWiredSize c.Uint64T - RiResidentSize c.Uint64T - RiPhysFootprint c.Uint64T - RiProcStartAbstime c.Uint64T - RiProcExitAbstime c.Uint64T - RiChildUserTime c.Uint64T - RiChildSystemTime c.Uint64T - RiChildPkgIdleWkups c.Uint64T - RiChildInterruptWkups c.Uint64T - RiChildPageins c.Uint64T - RiChildElapsedAbstime c.Uint64T - RiDiskioBytesread c.Uint64T - RiDiskioByteswritten c.Uint64T - RiCpuTimeQosDefault c.Uint64T - RiCpuTimeQosMaintenance c.Uint64T - RiCpuTimeQosBackground c.Uint64T - RiCpuTimeQosUtility c.Uint64T - RiCpuTimeQosLegacy c.Uint64T - RiCpuTimeQosUserInitiated c.Uint64T - RiCpuTimeQosUserInteractive c.Uint64T - RiBilledSystemTime c.Uint64T - RiServicedSystemTime c.Uint64T - RiLogicalWrites c.Uint64T - RiLifetimeMaxPhysFootprint c.Uint64T - RiInstructions c.Uint64T - RiCycles c.Uint64T - RiBilledEnergy c.Uint64T - RiServicedEnergy c.Uint64T - RiIntervalMaxPhysFootprint c.Uint64T - RiRunnableTime c.Uint64T - RiFlags c.Uint64T - RiUserPtime c.Uint64T - RiSystemPtime c.Uint64T - RiPinstructions c.Uint64T - RiPcycles c.Uint64T - RiEnergyNj c.Uint64T - RiPenergyNj c.Uint64T - RiReserved [14]c.Uint64T -} - -// A structure representing a resource limit. The address of an instance -// of this structure is the second parameter to getrlimit()/setrlimit(). -type Rlimit struct { - RlimCur RlimT - RlimMax RlimT -} -type ProcRlimitControlWakeupmon struct { - WmFlags c.Uint32T - WmRate Int32T -} - -// Resource limit type (low 63 bits, excluding the sign bit) -type RlimT = X__Uint64T -type RusageInfoT uintptr -type RusageInfoCurrent = RusageInfoV6 - -//go:linkname Getpriority C.getpriority -func Getpriority(_llcppg_param1 c.Int, _llcppg_param2 IdT) c.Int - -//go:linkname GetiopolicyNp C.getiopolicy_np -func GetiopolicyNp(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int - -//go:linkname Getrusage C.getrusage -func Getrusage(_llcppg_param1 c.Int, _llcppg_param2 *Rusage) c.Int - -//go:linkname Setpriority C.setpriority -func Setpriority(_llcppg_param1 c.Int, _llcppg_param2 IdT, _llcppg_param3 c.Int) c.Int - -//go:linkname SetiopolicyNp C.setiopolicy_np -func SetiopolicyNp(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int) c.Int diff --git a/c/os/sys-resource_linux_amd64.go b/c/os/sys-resource_linux_amd64.go deleted file mode 100644 index d4f6245e..00000000 --- a/c/os/sys-resource_linux_amd64.go +++ /dev/null @@ -1,36 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_SYS_RESOURCE_H = 1 - -type X__RlimitResourceT = c.Int -type X__RusageWhoT = c.Int -type X__PriorityWhichT = c.Int - -// Return resource usage information on process indicated by WHO -// and put it in *USAGE. Returns 0 for success, -1 for failure. -// -//go:linkname Getrusage C.getrusage -func Getrusage(__who X__RusageWhoT, __usage *Rusage) c.Int - -// Return the highest priority of any process specified by WHICH and WHO -// (see above); if WHO is zero, the current process, process group, or user -// (as specified by WHO) is used. A lower priority number means higher -// priority. Priorities range from PRIO_MIN to PRIO_MAX (above). -// -//go:linkname Getpriority C.getpriority -func Getpriority(__which X__PriorityWhichT, __who IdT) c.Int - -// Set the priority of all processes specified by WHICH and WHO (see above) -// to PRIO. Returns 0 on success, -1 on errors. -// -//go:linkname Setpriority C.setpriority -func Setpriority(__which X__PriorityWhichT, __who IdT, __prio c.Int) c.Int diff --git a/c/os/sys-resource_linux_arm64.go b/c/os/sys-resource_linux_arm64.go deleted file mode 100644 index 0f42b879..00000000 --- a/c/os/sys-resource_linux_arm64.go +++ /dev/null @@ -1,36 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_SYS_RESOURCE_H = 1 - -type X__RlimitResourceT = c.Int -type X__RusageWhoT = c.Int -type X__PriorityWhichT = c.Int - -// Return resource usage information on process indicated by WHO -// and put it in *USAGE. Returns 0 for success, -1 for failure. -// -//go:linkname Getrusage C.getrusage -func Getrusage(__who X__RusageWhoT, __usage *Rusage) c.Int - -// Return the highest priority of any process specified by WHICH and WHO -// (see above); if WHO is zero, the current process, process group, or user -// (as specified by WHO) is used. A lower priority number means higher -// priority. Priorities range from PRIO_MIN to PRIO_MAX (above). -// -//go:linkname Getpriority C.getpriority -func Getpriority(__which X__PriorityWhichT, __who IdT) c.Int - -// Set the priority of all processes specified by WHICH and WHO (see above) -// to PRIO. Returns 0 on success, -1 on errors. -// -//go:linkname Setpriority C.setpriority -func Setpriority(__which X__PriorityWhichT, __who IdT, __prio c.Int) c.Int diff --git a/c/os/sys-stat_darwin_arm64.go b/c/os/sys-stat_darwin_arm64.go deleted file mode 100644 index f39ee979..00000000 --- a/c/os/sys-stat_darwin_arm64.go +++ /dev/null @@ -1,168 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -// 0777 -const ACCESSPERMS = 511 - -// 7777 -const ALLPERMS = 4095 - -// 0666 -const DEFFILEMODE = 438 - -// block size used in the stat struct -const S_BLKSIZE = 512 - -// Definitions of flags stored in file flags word. -// -// Super-user and owner changeable flags. -const ( - UF_SETTABLE = 65535 - // do not dump file - UF_NODUMP = 1 - // file may not be changed - UF_IMMUTABLE = 2 - // writes to file may only append - UF_APPEND = 4 - // directory is opaque wrt. union - UF_OPAQUE = 8 -) - -// file is compressed (some file-systems) -const UF_COMPRESSED = 32 - -// UF_TRACKED is used for dealing with document IDs. We no longer issue -// -// notifications for deletes or renames for files which have UF_TRACKED set. -const UF_TRACKED = 64 - -// entitlement required for reading -const UF_DATAVAULT = 128 - -// Bits 0x0100 through 0x4000 are currently undefined. -const UF_HIDDEN = 32768 - -// Super-user changeable flags. -const ( - SF_SUPPORTED = 10420224 - // mask of superuser changeable flags - SF_SETTABLE = 1073676288 - // mask of system read-only synthetic flags - SF_SYNTHETIC = 3221225472 - // file is archived - SF_ARCHIVED = 65536 - // file may not be changed - SF_IMMUTABLE = 131072 - // writes to file may only append - SF_APPEND = 262144 - // entitlement required for writing - SF_RESTRICTED = 524288 - // Item may not be removed, renamed or mounted on - SF_NOUNLINK = 1048576 -) - -// file is a firmlink -const SF_FIRMLINK = 8388608 - -// Synthetic flags. -// -// These are read-only. We keep them out of SF_SUPPORTED so that -// attempts to set them will fail. -const SF_DATALESS = 1073741824 - -// Extended flags ("EF") returned by ATTR_CMNEXT_EXT_FLAGS from getattrlist/getattrlistbulk -const ( - EF_MAY_SHARE_BLOCKS = 1 - // file has no xattrs at all - EF_NO_XATTRS = 2 - // file is a sync root for iCloud - EF_IS_SYNC_ROOT = 4 - // file is purgeable - EF_IS_PURGEABLE = 8 - // file has at least one sparse region - EF_IS_SPARSE = 16 - // a synthetic directory/symlink - EF_IS_SYNTHETIC = 32 - // file shares all of its blocks with another file - EF_SHARES_ALL_BLOCKS = 64 -) -const ( - UTIME_NOW = -1 - UTIME_OMIT = -2 -) - -// XXX So deprecated, it would make your head spin -// -// The old stat structure. In fact, this is not used by the kernel at all, -// and should not be used by user space, and should be removed from this -// header file entirely (along with the unused cvtstat() prototype in -// vnode_internal.h). -type Ostat struct { - StDev X__Uint16T - StIno InoT - StMode ModeT - StNlink NlinkT - StUid X__Uint16T - StGid X__Uint16T - StRdev X__Uint16T - StSize X__Int32T - StAtimespec Timespec - StMtimespec Timespec - StCtimespec Timespec - StBlksize X__Int32T - StBlocks X__Int32T - StFlags X__Uint32T - StGen X__Uint32T -} - -//go:linkname Mkdirat C.mkdirat -func Mkdirat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 ModeT) c.Int - -//go:linkname Mkfifoat C.mkfifoat -func Mkfifoat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 ModeT) c.Int - -//go:linkname Mknodat C.mknodat -func Mknodat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 ModeT, _llcppg_param4 DevT) c.Int - -//go:linkname Futimens C.futimens -func Futimens(__fd c.Int, __times *Timespec) c.Int - -//go:linkname Utimensat C.utimensat -func Utimensat(__fd c.Int, __path *c.Char, __times *Timespec, __flag c.Int) c.Int - -//go:linkname Chflags C.chflags -func Chflags(_llcppg_param1 *c.Char, _llcppg_param2 X__Uint32T) c.Int - -//go:linkname ChmodxNp C.chmodx_np -func ChmodxNp(_llcppg_param1 *c.Char, _llcppg_param2 FilesecT) c.Int - -//go:linkname Fchflags C.fchflags -func Fchflags(_llcppg_param1 c.Int, _llcppg_param2 X__Uint32T) c.Int - -//go:linkname FchmodxNp C.fchmodx_np -func FchmodxNp(_llcppg_param1 c.Int, _llcppg_param2 FilesecT) c.Int - -//go:linkname Lchflags C.lchflags -func Lchflags(_llcppg_param1 *c.Char, _llcppg_param2 X__Uint32T) c.Int - -//go:linkname Lchmod C.lchmod -func Lchmod(_llcppg_param1 *c.Char, _llcppg_param2 ModeT) c.Int - -//go:linkname MkdirxNp C.mkdirx_np -func MkdirxNp(_llcppg_param1 *c.Char, _llcppg_param2 FilesecT) c.Int - -//go:linkname MkfifoxNp C.mkfifox_np -func MkfifoxNp(_llcppg_param1 *c.Char, _llcppg_param2 FilesecT) c.Int - -// llgo:link FilesecT.UmaskxNp C.umaskx_np -func (self FilesecT) UmaskxNp() c.Int { - return 0 -} diff --git a/c/os/sys-stat_linux_amd64.go b/c/os/sys-stat_linux_amd64.go deleted file mode 100644 index 379f2072..00000000 --- a/c/os/sys-stat_linux_amd64.go +++ /dev/null @@ -1,76 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/lib/c/time" - _ "unsafe" -) - -const X_SYS_STAT_H = 1 -const ( - S_IREAD = 256 - S_IWRITE = 128 - S_IEXEC = 64 -) - -// Macros for common mode bit masks. -const ( - ACCESSPERMS = 511 - // 07777 - ALLPERMS = 4095 - // 0666 - DEFFILEMODE = 438 -) - -// Block size for `st_blocks'. -const S_BLKSIZE = 512 -const X_MKNOD_VER = 0 - -// Set file access permissions for FILE to MODE. -// If FILE is a symbolic link, this affects the link itself -// rather than its target. -// -//go:linkname Lchmod C.lchmod -func Lchmod(__file *c.Char, __mode X__ModeT) c.Int - -// Like mkdir, create a new directory with permission bits MODE. But -// interpret relative PATH names relative to the directory associated -// with FD. -// -//go:linkname Mkdirat C.mkdirat -func Mkdirat(__fd c.Int, __path *c.Char, __mode X__ModeT) c.Int - -// Like mknod, create a new device file with permission bits MODE and -// device number DEV. But interpret relative PATH names relative to -// the directory associated with FD. -// -//go:linkname Mknodat C.mknodat -func Mknodat(__fd c.Int, __path *c.Char, __mode X__ModeT, __dev X__DevT) c.Int - -// Like mkfifo, create a new FIFO with permission bits MODE. But -// interpret relative PATH names relative to the directory associated -// with FD. -// -//go:linkname Mkfifoat C.mkfifoat -func Mkfifoat(__fd c.Int, __path *c.Char, __mode X__ModeT) c.Int - -// Set file access and modification times relative to directory file -// descriptor. -// -//go:linkname Utimensat C.utimensat -func Utimensat(__fd c.Int, __path *c.Char, __times *time.Timespec, __flags c.Int) c.Int - -// Set file access and modification times of the file associated with FD. -// -//go:linkname Futimens C.futimens -func Futimens(__fd c.Int, __times *time.Timespec) c.Int - -//go:linkname X__Xmknod C.__xmknod -func X__Xmknod(__ver c.Int, __path *c.Char, __mode X__ModeT, __dev *X__DevT) c.Int - -//go:linkname X__Xmknodat C.__xmknodat -func X__Xmknodat(__ver c.Int, __fd c.Int, __path *c.Char, __mode X__ModeT, __dev *X__DevT) c.Int diff --git a/c/os/sys-stat_linux_arm64.go b/c/os/sys-stat_linux_arm64.go deleted file mode 100644 index 8f6c9e74..00000000 --- a/c/os/sys-stat_linux_arm64.go +++ /dev/null @@ -1,76 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/lib/c/time" - _ "unsafe" -) - -const X_SYS_STAT_H = 1 -const ( - S_IREAD = 256 - S_IWRITE = 128 - S_IEXEC = 64 -) - -// Macros for common mode bit masks. -const ( - ACCESSPERMS = 511 - // 07777 - ALLPERMS = 4095 - // 0666 - DEFFILEMODE = 438 -) - -// Block size for `st_blocks'. -const S_BLKSIZE = 512 -const X_MKNOD_VER = 0 - -// Set file access permissions for FILE to MODE. -// If FILE is a symbolic link, this affects the link itself -// rather than its target. -// -//go:linkname Lchmod C.lchmod -func Lchmod(__file *uint8, __mode X__ModeT) c.Int - -// Like mkdir, create a new directory with permission bits MODE. But -// interpret relative PATH names relative to the directory associated -// with FD. -// -//go:linkname Mkdirat C.mkdirat -func Mkdirat(__fd c.Int, __path *uint8, __mode X__ModeT) c.Int - -// Like mknod, create a new device file with permission bits MODE and -// device number DEV. But interpret relative PATH names relative to -// the directory associated with FD. -// -//go:linkname Mknodat C.mknodat -func Mknodat(__fd c.Int, __path *uint8, __mode X__ModeT, __dev X__DevT) c.Int - -// Like mkfifo, create a new FIFO with permission bits MODE. But -// interpret relative PATH names relative to the directory associated -// with FD. -// -//go:linkname Mkfifoat C.mkfifoat -func Mkfifoat(__fd c.Int, __path *uint8, __mode X__ModeT) c.Int - -// Set file access and modification times relative to directory file -// descriptor. -// -//go:linkname Utimensat C.utimensat -func Utimensat(__fd c.Int, __path *uint8, __times *time.Timespec, __flags c.Int) c.Int - -// Set file access and modification times of the file associated with FD. -// -//go:linkname Futimens C.futimens -func Futimens(__fd c.Int, __times *time.Timespec) c.Int - -//go:linkname X__Xmknod C.__xmknod -func X__Xmknod(__ver c.Int, __path *uint8, __mode X__ModeT, __dev *X__DevT) c.Int - -//go:linkname X__Xmknodat C.__xmknodat -func X__Xmknodat(__ver c.Int, __fd c.Int, __path *uint8, __mode X__ModeT, __dev *X__DevT) c.Int diff --git a/c/os/sys-statvfs_darwin_arm64.go b/c/os/sys-statvfs_darwin_arm64.go deleted file mode 100644 index 090bd8c7..00000000 --- a/c/os/sys-statvfs_darwin_arm64.go +++ /dev/null @@ -1,35 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -// Defined bits for f_flag field value -const ( - ST_RDONLY = 1 - // Does not honor setuid/setgid - ST_NOSUID = 2 -) - -// Following structure is used as a statvfs/fstatvfs function parameter -type Statvfs struct { - FBsize c.Ulong - FFrsize c.Ulong - FBlocks FsblkcntT - FBfree FsblkcntT - FBavail FsblkcntT - FFiles FsfilcntT - FFfree FsfilcntT - FFavail FsfilcntT - FFsid c.Ulong - FFlag c.Ulong - FNamemax c.Ulong -} - -//go:linkname Fstatvfs C.fstatvfs -func Fstatvfs(_llcppg_param1 c.Int, _llcppg_param2 *Statvfs) c.Int diff --git a/c/os/sys-statvfs_linux_amd64.go b/c/os/sys-statvfs_linux_amd64.go deleted file mode 100644 index 4958770f..00000000 --- a/c/os/sys-statvfs_linux_amd64.go +++ /dev/null @@ -1,15 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_SYS_STATVFS_H = 1 - -//go:linkname Fstatvfs C.fstatvfs -func Fstatvfs(__fildes c.Int, __buf *Statvfs) c.Int diff --git a/c/os/sys-statvfs_linux_arm64.go b/c/os/sys-statvfs_linux_arm64.go deleted file mode 100644 index bfe88cbe..00000000 --- a/c/os/sys-statvfs_linux_arm64.go +++ /dev/null @@ -1,15 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_SYS_STATVFS_H = 1 - -//go:linkname Fstatvfs C.fstatvfs -func Fstatvfs(__fildes c.Int, __buf *Statvfs) c.Int diff --git a/c/os/sys-termios_darwin_arm64.go b/c/os/sys-termios_darwin_arm64.go deleted file mode 100644 index 0830efff..00000000 --- a/c/os/sys-termios_darwin_arm64.go +++ /dev/null @@ -1,384 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -// Special Control Characters -// -// Index into c_cc[] character array. -// -// Name Subscript Enabled by -const ( - VEOF = 0 - // ICANON - VEOL = 1 -) - -// ICANON together with IEXTEN -const VEOL2 = 2 - -// ICANON -const VERASE = 3 - -// ICANON together with IEXTEN -const VWERASE = 4 - -// ICANON -const VKILL = 5 - -// ICANON together with IEXTEN -const VREPRINT = 6 - -// 7 spare 1 -const ( - VINTR = 8 - // ISIG - VQUIT = 9 - // ISIG - VSUSP = 10 -) - -// ISIG together with IEXTEN -const VDSUSP = 11 -const ( - // IXON, IXOFF - VSTART = 12 - // IXON, IXOFF - VSTOP = 13 -) -const ( - // IEXTEN - VLNEXT = 14 - // IEXTEN - VDISCARD = 15 -) -const ( - // !ICANON - VMIN = 16 - // !ICANON - VTIME = 17 -) - -// ICANON together with IEXTEN -const VSTATUS = 18 -const NCCS = 20 - -// Input flags - software input processing -const ( - IGNBRK = 1 - // map BREAK to SIGINTR - BRKINT = 2 - // ignore (discard) parity errors - IGNPAR = 4 - // mark parity and framing errors - PARMRK = 8 - // enable checking of parity errors - INPCK = 16 - // strip 8th bit off chars - ISTRIP = 32 - // map NL into CR - INLCR = 64 - // ignore CR - IGNCR = 128 - // map CR to NL (ala CRMOD) - ICRNL = 256 - // enable output flow control - IXON = 512 - // enable input flow control - IXOFF = 1024 - // any char will restart after stop - IXANY = 2048 -) -const ( - // ring bell on input queue full - IMAXBEL = 8192 - // maintain state for UTF-8 VERASE - IUTF8 = 16384 -) - -// Output flags - software output processing -const ( - OPOST = 1 - // map NL to CR-NL (ala CRMOD) - ONLCR = 2 -) -const ( - // expand tabs to spaces - OXTABS = 4 - // discard EOT's (^D) on output) - ONOEOT = 8 -) - -// The following block of features is unimplemented. Use of these flags in -// programs will currently result in unexpected behaviour. -// -// - Begin unimplemented features -const ( - OCRNL = 16 - // no CR output at column 0 - ONOCR = 32 - // NL performs CR function - ONLRET = 64 - // use fill characters for delay - OFILL = 128 - // \n delay - NLDLY = 768 - // horizontal tab delay - TABDLY = 3076 - // \r delay - CRDLY = 12288 - // form feed delay - FFDLY = 16384 - // \b delay - BSDLY = 32768 - // vertical tab delay - VTDLY = 65536 - // fill is DEL, else NUL - OFDEL = 131072 -) - -// These manifest constants have the same names as those in the header -// , so you are not permitted to have both definitions -// in scope simultaneously in the same compilation unit. Nevertheless, -// they are required to be in scope when _POSIX_C_SOURCE is requested; -// this means that including the header before this -// one when _POSIX_C_SOURCE is in scope will result in redefintions. We -// attempt to maintain these as the same values so as to avoid this being -// an outright error in most compilers. -const ( - NL0 = 0 - NL1 = 256 -) -const ( - NL2 = 512 - NL3 = 768 -) - -// not in sys/ioctl_compat.h, use OXTABS value -const ( - TAB0 = 0 - TAB1 = 1024 - TAB2 = 2048 -) - -// not in sys/ioctl_compat.h, use OXTABS value -const ( - TAB3 = 4 - CR0 = 0 - CR1 = 4096 - CR2 = 8192 - CR3 = 12288 - FF0 = 0 - FF1 = 16384 - BS0 = 0 - BS1 = 32768 - VT0 = 0 - VT1 = 65536 -) - -// ignore control flags -const CIGNORE = 1 -const ( - // character size mask - CSIZE = 768 - // 5 bits (pseudo) - CS5 = 0 - // 6 bits - CS6 = 256 - // 7 bits - CS7 = 512 - // 8 bits - CS8 = 768 - // send 2 stop bits - CSTOPB = 1024 - // enable receiver - CREAD = 2048 - // parity enable - PARENB = 4096 - // odd parity, else even - PARODD = 8192 - // hang up on last close - HUPCL = 16384 - // ignore modem status lines - CLOCAL = 32768 -) -const ( - // CTS flow control of output - CCTS_OFLOW = 65536 - // RTS flow control of input - CRTS_IFLOW = 131072 - // DTR flow control of input - CDTR_IFLOW = 262144 - // DSR flow control of output - CDSR_OFLOW = 524288 - // DCD flow control of output - CCAR_OFLOW = 1048576 - // old name for CCAR_OFLOW - MDMBUF = 1048576 -) - -// visual erase for line kill -const ECHOKE = 1 -const ( - // visually erase chars - ECHOE = 2 - // echo NL after line kill - ECHOK = 4 - // enable echoing - ECHO = 8 - // echo NL even if ECHO is off - ECHONL = 16 -) -const ( - // visual erase mode for hardcopy - ECHOPRT = 32 - // echo control chars as ^(Char) - ECHOCTL = 64 -) -const ( - // enable signals INTR, QUIT, [D]SUSP - ISIG = 128 - // canonicalize input lines - ICANON = 256 -) - -// use alternate WERASE algorithm -const ALTWERASE = 512 - -// enable DISCARD and LNEXT -const IEXTEN = 1024 - -// external processing -const EXTPROC = 2048 - -// stop background jobs from output -const TOSTOP = 4194304 -const ( - // output being flushed (state) - FLUSHO = 8388608 - // no kernel output from VSTATUS - NOKERNINFO = 33554432 - // XXX retype pending input (state) - PENDIN = 536870912 -) - -// don't flush after interrupt -const NOFLSH = 2147483648 - -// Commands passed to tcsetattr() for setting the termios structure. -const ( - TCSANOW = 0 - // drain output, then change - TCSADRAIN = 1 - // drain output, flush input - TCSAFLUSH = 2 -) - -// flag - don't alter h.w. state -const TCSASOFT = 16 - -// Standard speeds -const ( - B0 = 0 - B50 = 50 - B75 = 75 - B110 = 110 - B134 = 134 - B150 = 150 - B200 = 200 - B300 = 300 - B600 = 600 - B1200 = 1200 - B1800 = 1800 - B2400 = 2400 - B4800 = 4800 - B9600 = 9600 - B19200 = 19200 - B38400 = 38400 -) -const ( - B7200 = 7200 - B14400 = 14400 - B28800 = 28800 - B57600 = 57600 - B76800 = 76800 - B115200 = 115200 - B230400 = 230400 - EXTA = 19200 - EXTB = 38400 -) -const ( - TCIFLUSH = 1 - TCOFLUSH = 2 - TCIOFLUSH = 3 - TCOOFF = 1 - TCOON = 2 - TCIOFF = 3 - TCION = 4 -) - -type Termios struct { - CIflag TcflagT - COflag TcflagT - CCflag TcflagT - CLflag TcflagT - CCc [20]CcT - CIspeed SpeedT - COspeed SpeedT -} -type TcflagT = c.Ulong -type CcT = uint8 -type SpeedT = c.Ulong - -// llgo:link (*Termios).Cfgetispeed C.cfgetispeed -func (self *Termios) Cfgetispeed() SpeedT { - return 0 -} - -// llgo:link (*Termios).Cfgetospeed C.cfgetospeed -func (self *Termios) Cfgetospeed() SpeedT { - return 0 -} - -// llgo:link (*Termios).Cfsetispeed C.cfsetispeed -func (self *Termios) Cfsetispeed(_llcppg_param2 SpeedT) c.Int { - return 0 -} - -// llgo:link (*Termios).Cfsetospeed C.cfsetospeed -func (self *Termios) Cfsetospeed(_llcppg_param2 SpeedT) c.Int { - return 0 -} - -//go:linkname Tcgetattr C.tcgetattr -func Tcgetattr(_llcppg_param1 c.Int, _llcppg_param2 *Termios) c.Int - -//go:linkname Tcsetattr C.tcsetattr -func Tcsetattr(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 *Termios) c.Int - -//go:linkname Tcdrain C.tcdrain -func Tcdrain(_llcppg_param1 c.Int) c.Int - -//go:linkname Tcflow C.tcflow -func Tcflow(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int - -//go:linkname Tcflush C.tcflush -func Tcflush(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int - -//go:linkname Tcsendbreak C.tcsendbreak -func Tcsendbreak(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int - -// llgo:link (*Termios).Cfmakeraw C.cfmakeraw -func (self *Termios) Cfmakeraw() { -} - -// llgo:link (*Termios).Cfsetspeed C.cfsetspeed -func (self *Termios) Cfsetspeed(_llcppg_param2 SpeedT) c.Int { - return 0 -} diff --git a/c/os/sys-times_darwin_arm64.go b/c/os/sys-times_darwin_arm64.go deleted file mode 100644 index 62b8333e..00000000 --- a/c/os/sys-times_darwin_arm64.go +++ /dev/null @@ -1,18 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -// [XSI] Structure whose address is passed as the first parameter to times() -type Tms struct { - TmsUtime ClockT - TmsStime ClockT - TmsCutime ClockT - TmsCstime ClockT -} - -// llgo:link (*Tms).Times C.times -func (self *Tms) Times() ClockT { - return 0 -} diff --git a/c/os/sys-times_linux_amd64.go b/c/os/sys-times_linux_amd64.go deleted file mode 100644 index f3eb7a4c..00000000 --- a/c/os/sys-times_linux_amd64.go +++ /dev/null @@ -1,27 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c/time" - -const X_SYS_TIMES_H = 1 - -// Structure describing CPU time used by a process and its children. -type Tms struct { - TmsUtime time.ClockT - TmsStime time.ClockT - TmsCutime time.ClockT - TmsCstime time.ClockT -} - -// Store the CPU time used by this process and all its -// dead children (and their dead children) in BUFFER. -// Return the elapsed real time, or (clock_t) -1 for errors. -// All times are in CLK_TCKths of a second. -// -// llgo:link (*Tms).Times C.times -func (self *Tms) Times() time.ClockT { - return 0 -} diff --git a/c/os/sys-times_linux_arm64.go b/c/os/sys-times_linux_arm64.go deleted file mode 100644 index 37f8dd7a..00000000 --- a/c/os/sys-times_linux_arm64.go +++ /dev/null @@ -1,27 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c/time" - -const X_SYS_TIMES_H = 1 - -// Structure describing CPU time used by a process and its children. -type Tms struct { - TmsUtime time.ClockT - TmsStime time.ClockT - TmsCutime time.ClockT - TmsCstime time.ClockT -} - -// Store the CPU time used by this process and all its -// dead children (and their dead children) in BUFFER. -// Return the elapsed real time, or (clock_t) -1 for errors. -// All times are in CLK_TCKths of a second. -// -// llgo:link (*Tms).Times C.times -func (self *Tms) Times() time.ClockT { - return 0 -} diff --git a/c/os/sys-types_darwin_arm64.go b/c/os/sys-types_darwin_arm64.go deleted file mode 100644 index be36fd5b..00000000 --- a/c/os/sys-types_darwin_arm64.go +++ /dev/null @@ -1,37 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -const -// bits in a byte -NBBY = 8 - -type ULong = c.Ulong - -// Sys V compatibility -type Ushort = uint16 - -// Sys V compatibility -type Uint = c.Uint - -// quads -type UQuadT = UInt64T -type QuadT = Int64T -type QaddrT = *QuadT - -// disk address -type DaddrT = Int32T - -// fixed point number -type FixptT = UInt32T - -// segment size -type SegszT = Int32T - -// swap offset -type SwblkT = Int32T -type FdMask = X__Int32T diff --git a/c/os/sys-types_linux_amd64.go b/c/os/sys-types_linux_amd64.go deleted file mode 100644 index 934c10ec..00000000 --- a/c/os/sys-types_linux_amd64.go +++ /dev/null @@ -1,50 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -const X_SYS_TYPES_H = 1 -const X__BIT_TYPES_DEFINED__ = 1 - -type UChar = X__UChar -type UShort = X__UShort -type UInt = X__UInt -type ULong = X__ULong -type QuadT = X__QuadT -type UQuadT = X__UQuadT -type FsidT = X__FsidT -type LoffT = X__LoffT -type InoT = X__InoT -type NlinkT = X__NlinkT -type IdT = X__IdT -type SsizeT = X__SsizeT -type DaddrT = X__DaddrT -type CaddrT = X__CaddrT -type KeyT = X__KeyT - -// Old compatibility names for C types. -type Ulong = c.Ulong -type Ushort = uint16 -type Uint = c.Uint -type Int8T = int8 -type Int16T = int16 -type Int32T = c.Int -type Int64T = c.Long -type UInt8T = uint8 -type UInt16T = uint16 -type UInt32T = c.Uint -type UInt64T = c.Ulong -type RegisterT = c.Long -type BlksizeT = X__BlksizeT - -// Type to count number of disk blocks. -type BlkcntT = X__BlkcntT - -// Type to count file system blocks. -type FsblkcntT = X__FsblkcntT - -// Type to count file system inodes. -type FsfilcntT = X__FsfilcntT diff --git a/c/os/sys-types_linux_arm64.go b/c/os/sys-types_linux_arm64.go deleted file mode 100644 index 6596b29e..00000000 --- a/c/os/sys-types_linux_arm64.go +++ /dev/null @@ -1,50 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -const X_SYS_TYPES_H = 1 -const X__BIT_TYPES_DEFINED__ = 1 - -type UChar = X__UChar -type UShort = X__UShort -type UInt = X__UInt -type ULong = X__ULong -type QuadT = X__QuadT -type UQuadT = X__UQuadT -type FsidT = X__FsidT -type LoffT = X__LoffT -type InoT = X__InoT -type NlinkT = X__NlinkT -type IdT = X__IdT -type SsizeT = X__SsizeT -type DaddrT = X__DaddrT -type CaddrT = X__CaddrT -type KeyT = X__KeyT - -// Old compatibility names for C types. -type Ulong = c.Ulong -type Ushort = uint16 -type Uint = c.Uint -type Int8T = int8 -type Int16T = int16 -type Int32T = c.Int -type Int64T = c.Long -type UInt8T = uint8 -type UInt16T = uint16 -type UInt32T = c.Uint -type UInt64T = c.Ulong -type RegisterT = c.Long -type BlksizeT = X__BlksizeT - -// Type to count number of disk blocks. -type BlkcntT = X__BlkcntT - -// Type to count file system blocks. -type FsblkcntT = X__FsblkcntT - -// Type to count file system inodes. -type FsfilcntT = X__FsfilcntT diff --git a/c/os/sys-uio_darwin_arm64.go b/c/os/sys-uio_darwin_arm64.go deleted file mode 100644 index 653c0934..00000000 --- a/c/os/sys-uio_darwin_arm64.go +++ /dev/null @@ -1,39 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -// IO direction for uio_t. -// -// UIO_READ - data moves into iovec(s) associated with uio_t -// UIO_WRITE - data moves out of iovec(s) associated with uio_t -type UioRw c.Uint - -const ( - // IO direction for uio_t. - // UIO_READ - data moves into iovec(s) associated with uio_t - // UIO_WRITE - data moves out of iovec(s) associated with uio_t - UIO_READ UioRw = 0 - // IO direction for uio_t. - // UIO_READ - data moves into iovec(s) associated with uio_t - // UIO_WRITE - data moves out of iovec(s) associated with uio_t - UIO_WRITE UioRw = 1 -) - -//go:linkname Readv C.readv -func Readv(_llcppg_param1 c.Int, _llcppg_param2 *c.Iovec, _llcppg_param3 c.Int) SsizeT - -//go:linkname Writev C.writev -func Writev(_llcppg_param1 c.Int, _llcppg_param2 *c.Iovec, _llcppg_param3 c.Int) SsizeT - -//go:linkname Preadv C.preadv -func Preadv(_llcppg_param1 c.Int, _llcppg_param2 *c.Iovec, _llcppg_param3 c.Int, _llcppg_param4 OffT) SsizeT - -//go:linkname Pwritev C.pwritev -func Pwritev(_llcppg_param1 c.Int, _llcppg_param2 *c.Iovec, _llcppg_param3 c.Int, _llcppg_param4 OffT) SsizeT diff --git a/c/os/sys-uio_linux_amd64.go b/c/os/sys-uio_linux_amd64.go deleted file mode 100644 index c6e6fd02..00000000 --- a/c/os/sys-uio_linux_amd64.go +++ /dev/null @@ -1,62 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_SYS_UIO_H = 1 - -// Read data from file descriptor FD, and put the result in the -// buffers described by IOVEC, which is a vector of COUNT 'struct iovec's. -// The buffers are filled in the order specified. -// Operates just like 'read' (see ) except that data are -// put in IOVEC instead of a contiguous buffer. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Readv C.readv -func Readv(__fd c.Int, __iovec *c.Iovec, __count c.Int) SsizeT - -// Write data pointed by the buffers described by IOVEC, which -// is a vector of COUNT 'struct iovec's, to file descriptor FD. -// The data is written in the order specified. -// Operates just like 'write' (see ) except that the data -// are taken from IOVEC instead of a contiguous buffer. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Writev C.writev -func Writev(__fd c.Int, __iovec *c.Iovec, __count c.Int) SsizeT - -// Read data from file descriptor FD at the given position OFFSET -// without change the file pointer, and put the result in the buffers -// described by IOVEC, which is a vector of COUNT 'struct iovec's. -// The buffers are filled in the order specified. Operates just like -// 'pread' (see ) except that data are put in IOVEC instead -// of a contiguous buffer. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Preadv C.preadv -func Preadv(__fd c.Int, __iovec *c.Iovec, __count c.Int, __offset X__OffT) SsizeT - -// Write data pointed by the buffers described by IOVEC, which is a -// vector of COUNT 'struct iovec's, to file descriptor FD at the given -// position OFFSET without change the file pointer. The data is -// written in the order specified. Operates just like 'pwrite' (see -// ) except that the data are taken from IOVEC instead of a -// contiguous buffer. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Pwritev C.pwritev -func Pwritev(__fd c.Int, __iovec *c.Iovec, __count c.Int, __offset X__OffT) SsizeT diff --git a/c/os/sys-uio_linux_arm64.go b/c/os/sys-uio_linux_arm64.go deleted file mode 100644 index 86177c27..00000000 --- a/c/os/sys-uio_linux_arm64.go +++ /dev/null @@ -1,62 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_SYS_UIO_H = 1 - -// Read data from file descriptor FD, and put the result in the -// buffers described by IOVEC, which is a vector of COUNT 'struct iovec's. -// The buffers are filled in the order specified. -// Operates just like 'read' (see ) except that data are -// put in IOVEC instead of a contiguous buffer. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Readv C.readv -func Readv(__fd c.Int, __iovec *c.Iovec, __count c.Int) SsizeT - -// Write data pointed by the buffers described by IOVEC, which -// is a vector of COUNT 'struct iovec's, to file descriptor FD. -// The data is written in the order specified. -// Operates just like 'write' (see ) except that the data -// are taken from IOVEC instead of a contiguous buffer. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Writev C.writev -func Writev(__fd c.Int, __iovec *c.Iovec, __count c.Int) SsizeT - -// Read data from file descriptor FD at the given position OFFSET -// without change the file pointer, and put the result in the buffers -// described by IOVEC, which is a vector of COUNT 'struct iovec's. -// The buffers are filled in the order specified. Operates just like -// 'pread' (see ) except that data are put in IOVEC instead -// of a contiguous buffer. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Preadv C.preadv -func Preadv(__fd c.Int, __iovec *c.Iovec, __count c.Int, __offset X__OffT) SsizeT - -// Write data pointed by the buffers described by IOVEC, which is a -// vector of COUNT 'struct iovec's, to file descriptor FD at the given -// position OFFSET without change the file pointer. The data is -// written in the order specified. Operates just like 'pwrite' (see -// ) except that the data are taken from IOVEC instead of a -// contiguous buffer. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Pwritev C.pwritev -func Pwritev(__fd c.Int, __iovec *c.Iovec, __count c.Int, __offset X__OffT) SsizeT diff --git a/c/os/sys-utsname_darwin_arm64.go b/c/os/sys-utsname_darwin_arm64.go deleted file mode 100644 index 22368d9e..00000000 --- a/c/os/sys-utsname_darwin_arm64.go +++ /dev/null @@ -1,22 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -const X_SYS_NAMELEN = 256 - -type Utsname struct { - Sysname [256]c.Char - Nodename [256]c.Char - Release [256]c.Char - Version [256]c.Char - Machine [256]c.Char -} - -// llgo:link (*Utsname).Uname C.uname -func (self *Utsname) Uname() c.Int { - return 0 -} diff --git a/c/os/sys-utsname_linux_amd64.go b/c/os/sys-utsname_linux_amd64.go deleted file mode 100644 index 55fa2faf..00000000 --- a/c/os/sys-utsname_linux_amd64.go +++ /dev/null @@ -1,26 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -const X_SYS_UTSNAME_H = 1 - -// Structure describing the system and machine. -type Utsname struct { - Sysname [65]c.Char - Nodename [65]c.Char - Release [65]c.Char - Version [65]c.Char - Machine [65]c.Char - X__Domainname [65]c.Char -} - -// Put information about the system in NAME. -// -// llgo:link (*Utsname).Uname C.uname -func (self *Utsname) Uname() c.Int { - return 0 -} diff --git a/c/os/sys-utsname_linux_arm64.go b/c/os/sys-utsname_linux_arm64.go deleted file mode 100644 index 3ad84c7a..00000000 --- a/c/os/sys-utsname_linux_arm64.go +++ /dev/null @@ -1,26 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import "github.com/goplus/lib/c" - -const X_SYS_UTSNAME_H = 1 - -// Structure describing the system and machine. -type Utsname struct { - Sysname [65]uint8 - Nodename [65]uint8 - Release [65]uint8 - Version [65]uint8 - Machine [65]uint8 - X__Domainname [65]uint8 -} - -// Put information about the system in NAME. -// -// llgo:link (*Utsname).Uname C.uname -func (self *Utsname) Uname() c.Int { - return 0 -} diff --git a/c/os/sys-wait_darwin_arm64.go b/c/os/sys-wait_darwin_arm64.go deleted file mode 100644 index 8a09277c..00000000 --- a/c/os/sys-wait_darwin_arm64.go +++ /dev/null @@ -1,163 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/lib/c/bitfield" - "github.com/goplus/lib/c/signal" - "unsafe" -) - -// Option bits for the third argument of wait4. WNOHANG causes the -// wait to not hang if there are no stopped or terminated processes, rather -// returning an error indication in this case (pid==0). WUNTRACED -// indicates that the caller should receive status about untraced children -// which stop due to signals. If children are stopped and a wait without -// this option is done, it is as though they were still running... nothing -// about them is returned. -const ( - WNOHANG = 1 - // [XSI] notify on stop, untraced child - WUNTRACED = 2 -) -const WCOREFLAG = 128 - -// _WSTATUS if process is stopped -const X_WSTOPPED = 127 - -// WUNTRACED defined for wait4() but not for waitid() -const WEXITED = 4 - -// waitid() parameter -const WSTOPPED = 8 -const ( - // [XSI] Any child stopped then continued - WCONTINUED = 16 - // [XSI] Leave process returned waitable - WNOWAIT = 32 -) - -// Tokens for special values of the "pid" parameter to wait4. -const ( - WAIT_ANY = -1 - // any process in my process group - WAIT_MYPGRP = 0 -) - -// [XSI] The type idtype_t shall be defined as an enumeration type whose -// possible values shall include at least P_ALL, P_PID, and P_PGID. -type IdtypeT c.Uint - -const ( - P_ALL IdtypeT = 0 - P_PID IdtypeT = 1 - P_PGID IdtypeT = 2 -) - -type WaitStatus struct { - _xgo_union [1]uint32 -} - -func (p *WaitStatus) XGof_ref_w_status() *c.Int { - return (*c.Int)(unsafe.Pointer(p)) -} - -// Terminated process status. -type _llcppg_anon_0 struct { - _xgo_align [0]uint32 - _xgo_bits_0 [4]uint8 -} - -func (p *WaitStatus) XGof_ref_w_T() *_llcppg_anon_0 { - return (*_llcppg_anon_0)(unsafe.Pointer(p)) -} - -// Stopped process status. Returned -// only for traced children unless requested -// with the WUNTRACED option bit. -type _llcppg_anon_1 struct { - _xgo_align [0]uint32 - _xgo_bits_0 [4]uint8 -} - -func (p *WaitStatus) XGof_ref_w_S() *_llcppg_anon_1 { - return (*_llcppg_anon_1)(unsafe.Pointer(p)) -} - -// llgo:link IdtypeT.Waitid C.waitid -func (self IdtypeT) Waitid(_llcppg_param2 IdT, _llcppg_param3 *signal.SiginfoT, _llcppg_param4 c.Int) c.Int { - return 0 -} - -// unsigned int w_Termsig : 7 -func (p *_llcppg_anon_0) XGof_get_w_Termsig() c.Uint { - return c.Uint(bitfield.Unsigned(unsafe.Pointer(p), 0, 7)) -} - -// unsigned int w_Termsig : 7 -func (p *_llcppg_anon_0) XGof_set_w_Termsig(v c.Uint) { - bitfield.Set(unsafe.Pointer(p), 0, 7, uint64(v)) -} - -// unsigned int w_Coredump : 1 -func (p *_llcppg_anon_0) XGof_get_w_Coredump() c.Uint { - return c.Uint(bitfield.Unsigned(unsafe.Pointer(p), 7, 1)) -} - -// unsigned int w_Coredump : 1 -func (p *_llcppg_anon_0) XGof_set_w_Coredump(v c.Uint) { - bitfield.Set(unsafe.Pointer(p), 7, 1, uint64(v)) -} - -// unsigned int w_Retcode : 8 -func (p *_llcppg_anon_0) XGof_get_w_Retcode() c.Uint { - return c.Uint(bitfield.Unsigned(unsafe.Pointer(p), 8, 8)) -} - -// unsigned int w_Retcode : 8 -func (p *_llcppg_anon_0) XGof_set_w_Retcode(v c.Uint) { - bitfield.Set(unsafe.Pointer(p), 8, 8, uint64(v)) -} - -// unsigned int w_Filler : 16 -func (p *_llcppg_anon_0) XGof_get_w_Filler() c.Uint { - return c.Uint(bitfield.Unsigned(unsafe.Pointer(p), 16, 16)) -} - -// unsigned int w_Filler : 16 -func (p *_llcppg_anon_0) XGof_set_w_Filler(v c.Uint) { - bitfield.Set(unsafe.Pointer(p), 16, 16, uint64(v)) -} - -// unsigned int w_Stopval : 8 -func (p *_llcppg_anon_1) XGof_get_w_Stopval() c.Uint { - return c.Uint(bitfield.Unsigned(unsafe.Pointer(p), 0, 8)) -} - -// unsigned int w_Stopval : 8 -func (p *_llcppg_anon_1) XGof_set_w_Stopval(v c.Uint) { - bitfield.Set(unsafe.Pointer(p), 0, 8, uint64(v)) -} - -// unsigned int w_Stopsig : 8 -func (p *_llcppg_anon_1) XGof_get_w_Stopsig() c.Uint { - return c.Uint(bitfield.Unsigned(unsafe.Pointer(p), 8, 8)) -} - -// unsigned int w_Stopsig : 8 -func (p *_llcppg_anon_1) XGof_set_w_Stopsig(v c.Uint) { - bitfield.Set(unsafe.Pointer(p), 8, 8, uint64(v)) -} - -// unsigned int w_Filler : 16 -func (p *_llcppg_anon_1) XGof_get_w_Filler() c.Uint { - return c.Uint(bitfield.Unsigned(unsafe.Pointer(p), 16, 16)) -} - -// unsigned int w_Filler : 16 -func (p *_llcppg_anon_1) XGof_set_w_Filler(v c.Uint) { - bitfield.Set(unsafe.Pointer(p), 16, 16, uint64(v)) -} diff --git a/c/os/sys-wait_linux_amd64.go b/c/os/sys-wait_linux_amd64.go deleted file mode 100644 index e022ac09..00000000 --- a/c/os/sys-wait_linux_amd64.go +++ /dev/null @@ -1,45 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/lib/c/signal" -) - -const X_SYS_WAIT_H = 1 - -// Special values for the PID argument to `waitpid' and `wait4'. -const ( - WAIT_ANY = -1 - // Any process in my process group. - WAIT_MYPGRP = 0 -) - -type IdtypeT c.Uint - -const ( - P_ALL IdtypeT = 0 - P_PID IdtypeT = 1 - // Wait for members of process group. - P_PGID IdtypeT = 2 -) - -// Wait for a childing matching IDTYPE and ID to change the status and -// place appropriate information in *INFOP. -// If IDTYPE is P_PID, match any process whose process ID is ID. -// If IDTYPE is P_PGID, match any process whose process group is ID. -// If IDTYPE is P_ALL, match any process. -// If the WNOHANG bit is set in OPTIONS, and that child -// is not already dead, clear *INFOP and return 0. If successful, store -// exit code and status in *INFOP. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -// llgo:link IdtypeT.Waitid C.waitid -func (self IdtypeT) Waitid(__id X__IdT, __infop *signal.SiginfoT, __options c.Int) c.Int { - return 0 -} diff --git a/c/os/sys-wait_linux_arm64.go b/c/os/sys-wait_linux_arm64.go deleted file mode 100644 index 86599aad..00000000 --- a/c/os/sys-wait_linux_arm64.go +++ /dev/null @@ -1,45 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "github.com/goplus/lib/c/signal" -) - -const X_SYS_WAIT_H = 1 - -// Special values for the PID argument to `waitpid' and `wait4'. -const ( - WAIT_ANY = -1 - // Any process in my process group. - WAIT_MYPGRP = 0 -) - -type IdtypeT c.Uint - -const ( - P_ALL IdtypeT = 0 - P_PID IdtypeT = 1 - // Wait for members of process group. - P_PGID IdtypeT = 2 -) - -// Wait for a childing matching IDTYPE and ID to change the status and -// place appropriate information in *INFOP. -// If IDTYPE is P_PID, match any process whose process ID is ID. -// If IDTYPE is P_PGID, match any process whose process group is ID. -// If IDTYPE is P_ALL, match any process. -// If the WNOHANG bit is set in OPTIONS, and that child -// is not already dead, clear *INFOP and return 0. If successful, store -// exit code and status in *INFOP. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -// llgo:link IdtypeT.Waitid C.waitid -func (self IdtypeT) Waitid(__id X__IdT, __infop *signal.SiginfoT, __options c.Int) c.Int { - return 0 -} diff --git a/c/os/termios_darwin_arm64.go b/c/os/termios_darwin_arm64.go deleted file mode 100644 index 41cb579a..00000000 --- a/c/os/termios_darwin_arm64.go +++ /dev/null @@ -1,13 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -//go:linkname Tcgetsid C.tcgetsid -func Tcgetsid(_llcppg_param1 c.Int) PidT diff --git a/c/os/termios_linux_amd64.go b/c/os/termios_linux_amd64.go deleted file mode 100644 index ad7eb887..00000000 --- a/c/os/termios_linux_amd64.go +++ /dev/null @@ -1,94 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_TERMIOS_H = 1 - -// Return the output baud rate stored in *TERMIOS_P. -// -// llgo:link (*Termios).Cfgetospeed C.cfgetospeed -func (self *Termios) Cfgetospeed() SpeedT { - return 0 -} - -// Return the input baud rate stored in *TERMIOS_P. -// -// llgo:link (*Termios).Cfgetispeed C.cfgetispeed -func (self *Termios) Cfgetispeed() SpeedT { - return 0 -} - -// Set the output baud rate stored in *TERMIOS_P to SPEED. -// -// llgo:link (*Termios).Cfsetospeed C.cfsetospeed -func (self *Termios) Cfsetospeed(__speed SpeedT) c.Int { - return 0 -} - -// Set the input baud rate stored in *TERMIOS_P to SPEED. -// -// llgo:link (*Termios).Cfsetispeed C.cfsetispeed -func (self *Termios) Cfsetispeed(__speed SpeedT) c.Int { - return 0 -} - -// Set both the input and output baud rates in *TERMIOS_OP to SPEED. -// -// llgo:link (*Termios).Cfsetspeed C.cfsetspeed -func (self *Termios) Cfsetspeed(__speed SpeedT) c.Int { - return 0 -} - -// Put the state of FD into *TERMIOS_P. -// -//go:linkname Tcgetattr C.tcgetattr -func Tcgetattr(__fd c.Int, __termios_p *Termios) c.Int - -// Set the state of FD to *TERMIOS_P. -// Values for OPTIONAL_ACTIONS (TCSA*) are in . -// -//go:linkname Tcsetattr C.tcsetattr -func Tcsetattr(__fd c.Int, __optional_actions c.Int, __termios_p *Termios) c.Int - -// Set *TERMIOS_P to indicate raw mode. -// -// llgo:link (*Termios).Cfmakeraw C.cfmakeraw -func (self *Termios) Cfmakeraw() { -} - -// Send zero bits on FD. -// -//go:linkname Tcsendbreak C.tcsendbreak -func Tcsendbreak(__fd c.Int, __duration c.Int) c.Int - -// Wait for pending output to be written on FD. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Tcdrain C.tcdrain -func Tcdrain(__fd c.Int) c.Int - -// Flush pending data on FD. -// Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in . -// -//go:linkname Tcflush C.tcflush -func Tcflush(__fd c.Int, __queue_selector c.Int) c.Int - -// Suspend or restart transmission on FD. -// Values for ACTION (TC[IO]{OFF,ON}) are in . -// -//go:linkname Tcflow C.tcflow -func Tcflow(__fd c.Int, __action c.Int) c.Int - -// Get process group ID for session leader for controlling terminal FD. -// -//go:linkname Tcgetsid C.tcgetsid -func Tcgetsid(__fd c.Int) X__PidT diff --git a/c/os/termios_linux_arm64.go b/c/os/termios_linux_arm64.go deleted file mode 100644 index 34b78d31..00000000 --- a/c/os/termios_linux_arm64.go +++ /dev/null @@ -1,94 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_TERMIOS_H = 1 - -// Return the output baud rate stored in *TERMIOS_P. -// -// llgo:link (*Termios).Cfgetospeed C.cfgetospeed -func (self *Termios) Cfgetospeed() SpeedT { - return 0 -} - -// Return the input baud rate stored in *TERMIOS_P. -// -// llgo:link (*Termios).Cfgetispeed C.cfgetispeed -func (self *Termios) Cfgetispeed() SpeedT { - return 0 -} - -// Set the output baud rate stored in *TERMIOS_P to SPEED. -// -// llgo:link (*Termios).Cfsetospeed C.cfsetospeed -func (self *Termios) Cfsetospeed(__speed SpeedT) c.Int { - return 0 -} - -// Set the input baud rate stored in *TERMIOS_P to SPEED. -// -// llgo:link (*Termios).Cfsetispeed C.cfsetispeed -func (self *Termios) Cfsetispeed(__speed SpeedT) c.Int { - return 0 -} - -// Set both the input and output baud rates in *TERMIOS_OP to SPEED. -// -// llgo:link (*Termios).Cfsetspeed C.cfsetspeed -func (self *Termios) Cfsetspeed(__speed SpeedT) c.Int { - return 0 -} - -// Put the state of FD into *TERMIOS_P. -// -//go:linkname Tcgetattr C.tcgetattr -func Tcgetattr(__fd c.Int, __termios_p *Termios) c.Int - -// Set the state of FD to *TERMIOS_P. -// Values for OPTIONAL_ACTIONS (TCSA*) are in . -// -//go:linkname Tcsetattr C.tcsetattr -func Tcsetattr(__fd c.Int, __optional_actions c.Int, __termios_p *Termios) c.Int - -// Set *TERMIOS_P to indicate raw mode. -// -// llgo:link (*Termios).Cfmakeraw C.cfmakeraw -func (self *Termios) Cfmakeraw() { -} - -// Send zero bits on FD. -// -//go:linkname Tcsendbreak C.tcsendbreak -func Tcsendbreak(__fd c.Int, __duration c.Int) c.Int - -// Wait for pending output to be written on FD. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Tcdrain C.tcdrain -func Tcdrain(__fd c.Int) c.Int - -// Flush pending data on FD. -// Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in . -// -//go:linkname Tcflush C.tcflush -func Tcflush(__fd c.Int, __queue_selector c.Int) c.Int - -// Suspend or restart transmission on FD. -// Values for ACTION (TC[IO]{OFF,ON}) are in . -// -//go:linkname Tcflow C.tcflow -func Tcflow(__fd c.Int, __action c.Int) c.Int - -// Get process group ID for session leader for controlling terminal FD. -// -//go:linkname Tcgetsid C.tcgetsid -func Tcgetsid(__fd c.Int) X__PidT diff --git a/c/os/unistd_darwin_arm64.go b/c/os/unistd_darwin_arm64.go deleted file mode 100644 index 95aa95f8..00000000 --- a/c/os/unistd_darwin_arm64.go +++ /dev/null @@ -1,739 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const ( - // standard input file descriptor - STDIN_FILENO = 0 - // standard output file descriptor - STDOUT_FILENO = 1 - // standard error file descriptor - STDERR_FILENO = 2 -) - -// _POSIX_VERSION and _POSIX2_VERSION from sys/unistd.h -const ( - X_XOPEN_VERSION = 600 - // Older standard - X_XOPEN_XCU_VERSION = 4 -) - -// Please keep this list in the same order as the applicable standard -const ( - X_POSIX_ADVISORY_INFO = -1 - // [AIO] - X_POSIX_ASYNCHRONOUS_IO = -1 - // [BAR] - X_POSIX_BARRIERS = -1 - // [CS] - X_POSIX_CLOCK_SELECTION = -1 - // [CPT] - X_POSIX_CPUTIME = -1 - // [ML] - X_POSIX_MEMLOCK = -1 - // [MR] - X_POSIX_MEMLOCK_RANGE = -1 - // [MSG] - X_POSIX_MESSAGE_PASSING = -1 - // [MON] - X_POSIX_MONOTONIC_CLOCK = -1 - // [PIO] - X_POSIX_PRIORITIZED_IO = -1 - // [PS] - X_POSIX_PRIORITY_SCHEDULING = -1 - // [RS] - X_POSIX_RAW_SOCKETS = -1 - // [RTS] - X_POSIX_REALTIME_SIGNALS = -1 - // [SEM] - X_POSIX_SEMAPHORES = -1 - // [SHM] - X_POSIX_SHARED_MEMORY_OBJECTS = -1 - // [SPI] - X_POSIX_SPIN_LOCKS = -1 - // [SS] - X_POSIX_SPORADIC_SERVER = -1 - // [SIO] - X_POSIX_SYNCHRONIZED_IO = -1 - // [TCT] - X_POSIX_THREAD_CPUTIME = -1 - // [TPI] - X_POSIX_THREAD_PRIO_INHERIT = -1 - // [TPP] - X_POSIX_THREAD_PRIO_PROTECT = -1 - // [TPS] - X_POSIX_THREAD_PRIORITY_SCHEDULING = -1 - // [TSP] - X_POSIX_THREAD_SPORADIC_SERVER = -1 - // [TMO] - X_POSIX_TIMEOUTS = -1 - // [TMR] - X_POSIX_TIMERS = -1 - // [TRC] - X_POSIX_TRACE = -1 - // [TEF] - X_POSIX_TRACE_EVENT_FILTER = -1 - // [TRI] - X_POSIX_TRACE_INHERIT = -1 - // [TRL] - X_POSIX_TRACE_LOG = -1 - // [TYM] - X_POSIX_TYPED_MEMORY_OBJECTS = -1 -) -const ( - // fort77 command - X_POSIX2_FORT_DEV = -1 - X_POSIX2_PBS = -1 - X_POSIX2_PBS_ACCOUNTING = -1 - X_POSIX2_PBS_CHECKPOINT = -1 - X_POSIX2_PBS_LOCATE = -1 - X_POSIX2_PBS_MESSAGE = -1 - X_POSIX2_PBS_TRACK = -1 -) -const ( - X__ILP32_OFF32 = -1 - X__ILP32_OFFBIG = -1 -) -const ( - X__LP64_OFF64 = 1 - X__LPBIG_OFFBIG = 1 -) -const ( - X_POSIX_V6_ILP32_OFF32 = -1 - X_POSIX_V6_ILP32_OFFBIG = -1 - X_POSIX_V6_LP64_OFF64 = 1 - X_POSIX_V6_LPBIG_OFFBIG = 1 -) -const ( - X_POSIX_V7_ILP32_OFF32 = -1 - X_POSIX_V7_ILP32_OFFBIG = -1 - X_POSIX_V7_LP64_OFF64 = 1 - X_POSIX_V7_LPBIG_OFFBIG = 1 -) -const ( - X_V6_ILP32_OFF32 = -1 - X_V6_ILP32_OFFBIG = -1 - X_V6_LP64_OFF64 = 1 - X_V6_LPBIG_OFFBIG = 1 -) - -// Removed in Issue 7 -const ( - X_XBS5_ILP32_OFF32 = -1 - X_XBS5_ILP32_OFFBIG = -1 - X_XBS5_LP64_OFF64 = 1 - X_XBS5_LPBIG_OFFBIG = 1 -) -const ( - X_XOPEN_CRYPT = 1 - // XXX required - X_XOPEN_ENH_I18N = 1 - // no ftime gcvt, wcswcs - X_XOPEN_LEGACY = -1 - // no q'ed signals, mq_* - X_XOPEN_REALTIME = -1 - // no posix_spawn, et. al. - X_XOPEN_REALTIME_THREADS = -1 - X_XOPEN_SHM = 1 - // Issue 6 - X_XOPEN_STREAMS = -1 - X_XOPEN_UNIX = 1 -) - -// configurable system variables -const ( - X_SC_ARG_MAX = 1 - X_SC_CHILD_MAX = 2 - X_SC_CLK_TCK = 3 - X_SC_NGROUPS_MAX = 4 - X_SC_OPEN_MAX = 5 - X_SC_JOB_CONTROL = 6 - X_SC_SAVED_IDS = 7 - X_SC_VERSION = 8 - X_SC_BC_BASE_MAX = 9 - X_SC_BC_DIM_MAX = 10 - X_SC_BC_SCALE_MAX = 11 - X_SC_BC_STRING_MAX = 12 - X_SC_COLL_WEIGHTS_MAX = 13 - X_SC_EXPR_NEST_MAX = 14 - X_SC_LINE_MAX = 15 - X_SC_RE_DUP_MAX = 16 - X_SC_2_VERSION = 17 - X_SC_2_C_BIND = 18 - X_SC_2_C_DEV = 19 - X_SC_2_CHAR_TERM = 20 - X_SC_2_FORT_DEV = 21 - X_SC_2_FORT_RUN = 22 - X_SC_2_LOCALEDEF = 23 - X_SC_2_SW_DEV = 24 - X_SC_2_UPE = 25 - X_SC_STREAM_MAX = 26 - X_SC_TZNAME_MAX = 27 -) -const ( - X_SC_ASYNCHRONOUS_IO = 28 - X_SC_PAGESIZE = 29 - X_SC_MEMLOCK = 30 - X_SC_MEMLOCK_RANGE = 31 - X_SC_MEMORY_PROTECTION = 32 - X_SC_MESSAGE_PASSING = 33 - X_SC_PRIORITIZED_IO = 34 - X_SC_PRIORITY_SCHEDULING = 35 - X_SC_REALTIME_SIGNALS = 36 - X_SC_SEMAPHORES = 37 - X_SC_FSYNC = 38 - X_SC_SHARED_MEMORY_OBJECTS = 39 - X_SC_SYNCHRONIZED_IO = 40 - X_SC_TIMERS = 41 - X_SC_AIO_LISTIO_MAX = 42 - X_SC_AIO_MAX = 43 - X_SC_AIO_PRIO_DELTA_MAX = 44 - X_SC_DELAYTIMER_MAX = 45 - X_SC_MQ_OPEN_MAX = 46 - // swap _SC_PAGESIZE vs. BSD - X_SC_MAPPED_FILES = 47 - X_SC_RTSIG_MAX = 48 - X_SC_SEM_NSEMS_MAX = 49 - X_SC_SEM_VALUE_MAX = 50 - X_SC_SIGQUEUE_MAX = 51 - X_SC_TIMER_MAX = 52 -) -const ( - X_SC_NPROCESSORS_CONF = 57 - X_SC_NPROCESSORS_ONLN = 58 -) -const ( - X_SC_2_PBS = 59 - X_SC_2_PBS_ACCOUNTING = 60 - X_SC_2_PBS_CHECKPOINT = 61 - X_SC_2_PBS_LOCATE = 62 - X_SC_2_PBS_MESSAGE = 63 - X_SC_2_PBS_TRACK = 64 - X_SC_ADVISORY_INFO = 65 - X_SC_BARRIERS = 66 - X_SC_CLOCK_SELECTION = 67 - X_SC_CPUTIME = 68 - X_SC_FILE_LOCKING = 69 - X_SC_GETGR_R_SIZE_MAX = 70 - X_SC_GETPW_R_SIZE_MAX = 71 - X_SC_HOST_NAME_MAX = 72 - X_SC_LOGIN_NAME_MAX = 73 - X_SC_MONOTONIC_CLOCK = 74 - X_SC_MQ_PRIO_MAX = 75 - X_SC_READER_WRITER_LOCKS = 76 - X_SC_REGEXP = 77 - X_SC_SHELL = 78 - X_SC_SPAWN = 79 - X_SC_SPIN_LOCKS = 80 - X_SC_SPORADIC_SERVER = 81 - X_SC_THREAD_ATTR_STACKADDR = 82 - X_SC_THREAD_ATTR_STACKSIZE = 83 - X_SC_THREAD_CPUTIME = 84 - X_SC_THREAD_DESTRUCTOR_ITERATIONS = 85 - X_SC_THREAD_KEYS_MAX = 86 - X_SC_THREAD_PRIO_INHERIT = 87 - X_SC_THREAD_PRIO_PROTECT = 88 - X_SC_THREAD_PRIORITY_SCHEDULING = 89 - X_SC_THREAD_PROCESS_SHARED = 90 - X_SC_THREAD_SAFE_FUNCTIONS = 91 - X_SC_THREAD_SPORADIC_SERVER = 92 - X_SC_THREAD_STACK_MIN = 93 - X_SC_THREAD_THREADS_MAX = 94 - X_SC_TIMEOUTS = 95 - X_SC_THREADS = 96 - X_SC_TRACE = 97 - X_SC_TRACE_EVENT_FILTER = 98 - X_SC_TRACE_INHERIT = 99 - X_SC_TRACE_LOG = 100 - X_SC_TTY_NAME_MAX = 101 - X_SC_TYPED_MEMORY_OBJECTS = 102 - X_SC_V6_ILP32_OFF32 = 103 - X_SC_V6_ILP32_OFFBIG = 104 - X_SC_V6_LP64_OFF64 = 105 - X_SC_V6_LPBIG_OFFBIG = 106 - X_SC_IPV6 = 118 - X_SC_RAW_SOCKETS = 119 - X_SC_SYMLOOP_MAX = 120 -) -const ( - X_SC_ATEXIT_MAX = 107 - X_SC_IOV_MAX = 56 - X_SC_PAGE_SIZE = 29 - X_SC_XOPEN_CRYPT = 108 - X_SC_XOPEN_ENH_I18N = 109 - // Issue 6 - X_SC_XOPEN_LEGACY = 110 - // Issue 6 - X_SC_XOPEN_REALTIME = 111 - // Issue 6 - X_SC_XOPEN_REALTIME_THREADS = 112 - X_SC_XOPEN_SHM = 113 - // Issue 6 - X_SC_XOPEN_STREAMS = 114 - X_SC_XOPEN_UNIX = 115 - X_SC_XOPEN_VERSION = 116 - X_SC_XOPEN_XCU_VERSION = 121 -) - -// Removed in Issue 7 -const ( - X_SC_XBS5_ILP32_OFF32 = 122 - X_SC_XBS5_ILP32_OFFBIG = 123 - X_SC_XBS5_LP64_OFF64 = 124 - X_SC_XBS5_LPBIG_OFFBIG = 125 -) -const ( - X_SC_SS_REPL_MAX = 126 - X_SC_TRACE_EVENT_NAME_MAX = 127 - X_SC_TRACE_NAME_MAX = 128 - X_SC_TRACE_SYS_MAX = 129 - X_SC_TRACE_USER_EVENT_MAX = 130 -) - -// Removed in Issue 6 -const X_SC_PASS_MAX = 131 -const X_SC_PHYS_PAGES = 200 -const ( - X_CS_POSIX_V6_ILP32_OFF32_CFLAGS = 2 - X_CS_POSIX_V6_ILP32_OFF32_LDFLAGS = 3 - X_CS_POSIX_V6_ILP32_OFF32_LIBS = 4 - X_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS = 5 - X_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS = 6 - X_CS_POSIX_V6_ILP32_OFFBIG_LIBS = 7 - X_CS_POSIX_V6_LP64_OFF64_CFLAGS = 8 - X_CS_POSIX_V6_LP64_OFF64_LDFLAGS = 9 - X_CS_POSIX_V6_LP64_OFF64_LIBS = 10 - X_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS = 11 - X_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS = 12 - X_CS_POSIX_V6_LPBIG_OFFBIG_LIBS = 13 - X_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS = 14 -) - -// Removed in Issue 7 -const ( - X_CS_XBS5_ILP32_OFF32_CFLAGS = 20 - X_CS_XBS5_ILP32_OFF32_LDFLAGS = 21 - X_CS_XBS5_ILP32_OFF32_LIBS = 22 - X_CS_XBS5_ILP32_OFF32_LINTFLAGS = 23 - X_CS_XBS5_ILP32_OFFBIG_CFLAGS = 24 - X_CS_XBS5_ILP32_OFFBIG_LDFLAGS = 25 - X_CS_XBS5_ILP32_OFFBIG_LIBS = 26 - X_CS_XBS5_ILP32_OFFBIG_LINTFLAGS = 27 - X_CS_XBS5_LP64_OFF64_CFLAGS = 28 - X_CS_XBS5_LP64_OFF64_LDFLAGS = 29 - X_CS_XBS5_LP64_OFF64_LIBS = 30 - X_CS_XBS5_LP64_OFF64_LINTFLAGS = 31 - X_CS_XBS5_LPBIG_OFFBIG_CFLAGS = 32 - X_CS_XBS5_LPBIG_OFFBIG_LDFLAGS = 33 - X_CS_XBS5_LPBIG_OFFBIG_LIBS = 34 - X_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS = 35 -) -const ( - X_CS_DARWIN_USER_DIR = 65536 - X_CS_DARWIN_USER_TEMP_DIR = 65537 - X_CS_DARWIN_USER_CACHE_DIR = 65538 -) - -// These F_* are really XSI or Issue 6 -const ( - F_ULOCK = 0 - // lock a section for exclusive use - F_LOCK = 1 - // test and lock a section for exclusive use - F_TLOCK = 2 - // test a section for locks by other procs - F_TEST = 3 -) -const ( - // Flush data and metadata to platter, not just to disk cache - SYNC_VOLUME_FULLSYNC = 1 - // Wait for sync to complete - SYNC_VOLUME_WAIT = 2 -) - -type Fssearchblock struct { -} -type Searchstate struct { -} - -//go:linkname X_exit C._exit -func X_exit(_llcppg_param1 c.Int) - -//go:linkname Access C.access -func Access(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int - -//go:linkname Alarm C.alarm -func Alarm(_llcppg_param1 c.Uint) c.Uint - -//go:linkname Fpathconf C.fpathconf -func Fpathconf(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Long - -//go:linkname Getgroups C.getgroups -func Getgroups(_llcppg_param1 c.Int, _llcppg_param2 *GidT) c.Int - -//go:linkname Getlogin C.getlogin -func Getlogin() *c.Char - -//go:linkname Getpgrp C.getpgrp -func Getpgrp() PidT - -//go:linkname Pathconf C.pathconf -func Pathconf(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Long - -//go:linkname Pause C.pause -func Pause() c.Int - -//go:linkname Setgid C.setgid -func Setgid(_llcppg_param1 GidT) c.Int - -//go:linkname Setpgid C.setpgid -func Setpgid(_llcppg_param1 PidT, _llcppg_param2 PidT) c.Int - -//go:linkname Setsid C.setsid -func Setsid() PidT - -//go:linkname Setuid C.setuid -func Setuid(_llcppg_param1 UidT) c.Int - -//go:linkname Sleep C.sleep -func Sleep(_llcppg_param1 c.Uint) c.Uint - -//go:linkname Sysconf C.sysconf -func Sysconf(_llcppg_param1 c.Int) c.Long - -//go:linkname Tcgetpgrp C.tcgetpgrp -func Tcgetpgrp(_llcppg_param1 c.Int) PidT - -//go:linkname Tcsetpgrp C.tcsetpgrp -func Tcsetpgrp(_llcppg_param1 c.Int, _llcppg_param2 PidT) c.Int - -//go:linkname Ttyname C.ttyname -func Ttyname(_llcppg_param1 c.Int) *c.Char - -//go:linkname TtynameR C.ttyname_r -func TtynameR(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 SizeT) c.Int - -//go:linkname Confstr C.confstr -func Confstr(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 SizeT) SizeT - -//go:linkname Getopt C.getopt -func Getopt(_llcppg_param1 c.Int, _llcppg_param2 **c.Char, _llcppg_param3 *c.Char) c.Int - -// getopt(3) external variables -// -//go:linkname Optarg C.optarg -var Optarg *c.Char - -//go:linkname Optind C.optind -var Optind c.Int - -//go:linkname Opterr C.opterr -var Opterr c.Int - -//go:linkname Optopt C.optopt -var Optopt c.Int - -//go:linkname Brk C.brk -func Brk(_llcppg_param1 unsafe.Pointer) unsafe.Pointer - -//go:linkname Crypt C.crypt -func Crypt(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char) *c.Char - -//go:linkname Encrypt C.encrypt -func Encrypt(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) - -//go:linkname Gethostid C.gethostid -func Gethostid() c.Long - -//go:linkname Getpgid C.getpgid -func Getpgid(_llcppg_param1 PidT) PidT - -//go:linkname Getsid C.getsid -func Getsid(_llcppg_param1 PidT) PidT - -//go:linkname Getdtablesize C.getdtablesize -func Getdtablesize() c.Int - -//go:linkname Getpagesize C.getpagesize -func Getpagesize() c.Int - -//go:linkname Getpass C.getpass -func Getpass(_llcppg_param1 *c.Char) *c.Char - -//go:linkname Getwd C.getwd -func Getwd(_llcppg_param1 *c.Char) *c.Char - -//go:linkname Lockf C.lockf -func Lockf(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 OffT) c.Int - -//go:linkname Nice C.nice -func Nice(_llcppg_param1 c.Int) c.Int - -//go:linkname Pread C.pread -func Pread(__fd c.Int, __buf unsafe.Pointer, __nbyte SizeT, __offset OffT) SsizeT - -//go:linkname Pwrite C.pwrite -func Pwrite(__fd c.Int, __buf unsafe.Pointer, __nbyte SizeT, __offset OffT) SsizeT - -//go:linkname Sbrk C.sbrk -func Sbrk(_llcppg_param1 c.Int) unsafe.Pointer - -//go:linkname Setpgrp C.setpgrp -func Setpgrp() PidT - -//go:linkname Setregid C.setregid -func Setregid(_llcppg_param1 GidT, _llcppg_param2 GidT) c.Int - -//go:linkname Setreuid C.setreuid -func Setreuid(_llcppg_param1 UidT, _llcppg_param2 UidT) c.Int - -//go:linkname Swab C.swab -func Swab(_llcppg_param1 unsafe.Pointer, _llcppg_param2 unsafe.Pointer, _llcppg_param3 SsizeT) - -//go:linkname Sync C.sync -func Sync() - -//go:linkname Ualarm C.ualarm -func Ualarm(_llcppg_param1 UsecondsT, _llcppg_param2 UsecondsT) UsecondsT - -//go:linkname Usleep C.usleep -func Usleep(_llcppg_param1 UsecondsT) c.Int - -// End XSI -// -//go:linkname Vfork C.vfork -func Vfork() c.Int - -//go:linkname GetloginR C.getlogin_r -func GetloginR(_llcppg_param1 *c.Char, _llcppg_param2 SizeT) c.Int - -//go:linkname Gethostname C.gethostname -func Gethostname(_llcppg_param1 *c.Char, _llcppg_param2 SizeT) c.Int - -//go:linkname Setegid C.setegid -func Setegid(_llcppg_param1 GidT) c.Int - -//go:linkname Seteuid C.seteuid -func Seteuid(_llcppg_param1 UidT) c.Int - -//go:linkname X_Exit C._Exit -func X_Exit(_llcppg_param1 c.Int) - -//go:linkname Acct C.acct -func Acct(_llcppg_param1 *c.Char) c.Int - -//go:linkname Endusershell C.endusershell -func Endusershell() - -//go:linkname ExecvP C.execvP -func ExecvP(__file *c.Char, __searchpath *c.Char, __argv **c.Char) c.Int - -//go:linkname Fflagstostr C.fflagstostr -func Fflagstostr(_llcppg_param1 c.Ulong) *c.Char - -//go:linkname Getdomainname C.getdomainname -func Getdomainname(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int - -//go:linkname Getgrouplist C.getgrouplist -func Getgrouplist(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 *c.Int, _llcppg_param4 *c.Int) c.Int - -//go:linkname Getmode C.getmode -func Getmode(_llcppg_param1 unsafe.Pointer, _llcppg_param2 ModeT) ModeT - -//go:linkname Getpeereid C.getpeereid -func Getpeereid(_llcppg_param1 c.Int, _llcppg_param2 *UidT, _llcppg_param3 *GidT) c.Int - -//go:linkname GetsgroupsNp C.getsgroups_np -func GetsgroupsNp(_llcppg_param1 *c.Int, _llcppg_param2 UuidT) c.Int - -//go:linkname Getusershell C.getusershell -func Getusershell() *c.Char - -//go:linkname GetwgroupsNp C.getwgroups_np -func GetwgroupsNp(_llcppg_param1 *c.Int, _llcppg_param2 UuidT) c.Int - -//go:linkname Initgroups C.initgroups -func Initgroups(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int - -//go:linkname Issetugid C.issetugid -func Issetugid() c.Int - -//go:linkname Mkdtemp C.mkdtemp -func Mkdtemp(_llcppg_param1 *c.Char) *c.Char - -// returns errno -// -//go:linkname MkpathNp C.mkpath_np -func MkpathNp(path *c.Char, omode ModeT) c.Int - -//go:linkname MkpathatNp C.mkpathat_np -func MkpathatNp(dfd c.Int, path *c.Char, omode ModeT) c.Int - -//go:linkname Mkstemp C.mkstemp -func Mkstemp(_llcppg_param1 *c.Char) c.Int - -//go:linkname Mkstemps C.mkstemps -func Mkstemps(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int - -//go:linkname Mktemp C.mktemp -func Mktemp(_llcppg_param1 *c.Char) *c.Char - -//go:linkname Mkostemp C.mkostemp -func Mkostemp(path *c.Char, oflags c.Int) c.Int - -// Non-portable mkstemp that uses open_dprotected_np -// -//go:linkname Mkostemps C.mkostemps -func Mkostemps(path *c.Char, slen c.Int, oflags c.Int) c.Int - -// Non-portable mkstemp that uses open_dprotected_np -// -//go:linkname MkstempDprotectedNp C.mkstemp_dprotected_np -func MkstempDprotectedNp(path *c.Char, dpclass c.Int, dpflags c.Int) c.Int - -//go:linkname MkdtempatNp C.mkdtempat_np -func MkdtempatNp(dfd c.Int, path *c.Char) *c.Char - -//go:linkname MkstempsatNp C.mkstempsat_np -func MkstempsatNp(dfd c.Int, path *c.Char, slen c.Int) c.Int - -//go:linkname MkostempsatNp C.mkostempsat_np -func MkostempsatNp(dfd c.Int, path *c.Char, slen c.Int, oflags c.Int) c.Int - -//go:linkname Nfssvc C.nfssvc -func Nfssvc(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer) c.Int - -//go:linkname PthreadSetugidNp C.pthread_setugid_np -func PthreadSetugidNp(_llcppg_param1 UidT, _llcppg_param2 GidT) c.Int - -//go:linkname PthreadGetugidNp C.pthread_getugid_np -func PthreadGetugidNp(_llcppg_param1 *UidT, _llcppg_param2 *GidT) c.Int - -//go:linkname Reboot C.reboot -func Reboot(_llcppg_param1 c.Int) c.Int - -//go:linkname Revoke C.revoke -func Revoke(_llcppg_param1 *c.Char) c.Int - -//go:linkname Rcmd C.rcmd -func Rcmd(_llcppg_param1 **c.Char, _llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char, _llcppg_param5 *c.Char, _llcppg_param6 *c.Int) c.Int - -//go:linkname RcmdAf C.rcmd_af -func RcmdAf(_llcppg_param1 **c.Char, _llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char, _llcppg_param5 *c.Char, _llcppg_param6 *c.Int, _llcppg_param7 c.Int) c.Int - -//go:linkname Rresvport C.rresvport -func Rresvport(_llcppg_param1 *c.Int) c.Int - -//go:linkname RresvportAf C.rresvport_af -func RresvportAf(_llcppg_param1 *c.Int, _llcppg_param2 c.Int) c.Int - -//go:linkname Iruserok C.iruserok -func Iruserok(_llcppg_param1 c.Ulong, _llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char) c.Int - -//go:linkname IruserokSa C.iruserok_sa -func IruserokSa(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Int, _llcppg_param3 c.Int, _llcppg_param4 *c.Char, _llcppg_param5 *c.Char) c.Int - -//go:linkname Ruserok C.ruserok -func Ruserok(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 *c.Char, _llcppg_param4 *c.Char) c.Int - -//go:linkname Setdomainname C.setdomainname -func Setdomainname(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int - -//go:linkname Setgroups C.setgroups -func Setgroups(_llcppg_param1 c.Int, _llcppg_param2 *GidT) c.Int - -//go:linkname Sethostid C.sethostid -func Sethostid(_llcppg_param1 c.Long) - -//go:linkname Sethostname C.sethostname -func Sethostname(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int - -//go:linkname Setkey C.setkey -func Setkey(_llcppg_param1 *c.Char) - -//go:linkname Setlogin C.setlogin -func Setlogin(_llcppg_param1 *c.Char) c.Int - -//go:linkname Setmode C.setmode -func Setmode(_llcppg_param1 *c.Char) unsafe.Pointer - -//go:linkname Setrgid C.setrgid -func Setrgid(_llcppg_param1 GidT) c.Int - -//go:linkname Setruid C.setruid -func Setruid(_llcppg_param1 UidT) c.Int - -//go:linkname SetsgroupsNp C.setsgroups_np -func SetsgroupsNp(_llcppg_param1 c.Int, _llcppg_param2 UuidT) c.Int - -//go:linkname Setusershell C.setusershell -func Setusershell() - -//go:linkname SetwgroupsNp C.setwgroups_np -func SetwgroupsNp(_llcppg_param1 c.Int, _llcppg_param2 UuidT) c.Int - -//go:linkname Strtofflags C.strtofflags -func Strtofflags(_llcppg_param1 **c.Char, _llcppg_param2 *c.Ulong, _llcppg_param3 *c.Ulong) c.Int - -//go:linkname Swapon C.swapon -func Swapon(_llcppg_param1 *c.Char) c.Int - -//go:linkname Ttyslot C.ttyslot -func Ttyslot() c.Int - -//go:linkname Undelete C.undelete -func Undelete(_llcppg_param1 *c.Char) c.Int - -//go:linkname Valloc C.valloc -func Valloc(_llcppg_param1 SizeT) unsafe.Pointer - -// getsubopt(3) external variable -// -//go:linkname Suboptarg C.suboptarg -var Suboptarg *c.Char - -//go:linkname Getsubopt C.getsubopt -func Getsubopt(_llcppg_param1 **c.Char, _llcppg_param2 **c.Char, _llcppg_param3 **c.Char) c.Int - -//go:linkname Fgetattrlist C.fgetattrlist -func Fgetattrlist(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 SizeT, _llcppg_param5 c.Uint) c.Int - -//go:linkname Fsetattrlist C.fsetattrlist -func Fsetattrlist(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 SizeT, _llcppg_param5 c.Uint) c.Int - -//go:linkname Getattrlist C.getattrlist -func Getattrlist(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 SizeT, _llcppg_param5 c.Uint) c.Int - -//go:linkname Setattrlist C.setattrlist -func Setattrlist(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 SizeT, _llcppg_param5 c.Uint) c.Int - -//go:linkname Exchangedata C.exchangedata -func Exchangedata(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char, _llcppg_param3 c.Uint) c.Int - -//go:linkname Getdirentriesattr C.getdirentriesattr -func Getdirentriesattr(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 SizeT, _llcppg_param5 *c.Uint, _llcppg_param6 *c.Uint, _llcppg_param7 *c.Uint, _llcppg_param8 c.Uint) c.Int - -//go:linkname Searchfs C.searchfs -func Searchfs(_llcppg_param1 *c.Char, _llcppg_param2 *Fssearchblock, _llcppg_param3 *c.Ulong, _llcppg_param4 c.Uint, _llcppg_param5 c.Uint, _llcppg_param6 *Searchstate) c.Int - -//go:linkname Fsctl C.fsctl -func Fsctl(_llcppg_param1 *c.Char, _llcppg_param2 c.Ulong, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.Uint) c.Int - -//go:linkname Ffsctl C.ffsctl -func Ffsctl(_llcppg_param1 c.Int, _llcppg_param2 c.Ulong, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.Uint) c.Int - -//go:linkname FsyncVolumeNp C.fsync_volume_np -func FsyncVolumeNp(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int - -//go:linkname SyncVolumeNp C.sync_volume_np -func SyncVolumeNp(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int - -//go:linkname Optreset C.optreset -var Optreset c.Int diff --git a/c/os/unistd_linux_amd64.go b/c/os/unistd_linux_amd64.go deleted file mode 100644 index a0611693..00000000 --- a/c/os/unistd_linux_amd64.go +++ /dev/null @@ -1,448 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const X_UNISTD_H = 1 -const X_XOPEN_VERSION = 700 - -// Commands and utilities from XPG4 are available. -const X_XOPEN_XCU_VERSION = 4 - -// We are compatible with the old published standards as well. -const ( - X_XOPEN_XPG2 = 1 - X_XOPEN_XPG3 = 1 - X_XOPEN_XPG4 = 1 -) - -// The X/Open Unix extensions are available. -const X_XOPEN_UNIX = 1 - -// Encryption is present. -const X_XOPEN_CRYPT = 1 - -// The enhanced internationalization capabilities according to XPG4.2 -// are present. -const X_XOPEN_ENH_I18N = 1 - -// The legacy interfaces are also available. -const X_XOPEN_LEGACY = 1 - -// Standard file descriptors. -const ( - STDIN_FILENO = 0 - // Standard output. - STDOUT_FILENO = 1 - // Standard error output. - STDERR_FILENO = 2 -) - -type UsecondsT = X__UsecondsT -type IntptrT = X__IntptrT -type SocklenT = X__SocklenT - -// Test for access to NAME using the real UID and real GID. -// -//go:linkname Access C.access -func Access(__name *c.Char, __type c.Int) c.Int - -// Read NBYTES into BUF from FD at the given position OFFSET without -// changing the file pointer. Return the number read, -1 for errors -// or 0 for EOF. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Pread C.pread -func Pread(__fd c.Int, __buf unsafe.Pointer, __nbytes SizeT, __offset X__OffT) SsizeT - -// Write N bytes of BUF to FD at the given position OFFSET without -// changing the file pointer. Return the number written, or -1. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Pwrite C.pwrite -func Pwrite(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __offset X__OffT) SsizeT - -// Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. -// If SECONDS is zero, any currently scheduled alarm will be cancelled. -// The function returns the number of seconds remaining until the last -// alarm scheduled would have signaled, or zero if there wasn't one. -// There is no return value to indicate an error, but you can set `errno' -// to 0 and check its value after calling `alarm', and this might tell you. -// The signal may come late due to processor scheduling. -// -//go:linkname Alarm C.alarm -func Alarm(__seconds c.Uint) c.Uint - -// Make the process sleep for SECONDS seconds, or until a signal arrives -// and is not ignored. The function returns the number of seconds less -// than SECONDS which it actually slept (thus zero if it slept the full time). -// If a signal handler does a `longjmp' or modifies the handling of the -// SIGALRM signal while inside `sleep' call, the handling of the SIGALRM -// signal afterwards is undefined. There is no return value to indicate -// error, but if `sleep' returns SECONDS, it probably didn't work. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Sleep C.sleep -func Sleep(__seconds c.Uint) c.Uint - -// Set an alarm to go off (generating a SIGALRM signal) in VALUE -// microseconds. If INTERVAL is nonzero, when the alarm goes off, the -// timer is reset to go off every INTERVAL microseconds thereafter. -// Returns the number of microseconds remaining before the alarm. -// -//go:linkname Ualarm C.ualarm -func Ualarm(__value X__UsecondsT, __interval X__UsecondsT) X__UsecondsT - -// Sleep USECONDS microseconds, or until a signal arrives that is not blocked -// or ignored. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Usleep C.usleep -func Usleep(__useconds X__UsecondsT) c.Int - -// Suspend the process until a signal arrives. -// This always returns -1 and sets `errno' to EINTR. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Pause C.pause -func Pause() c.Int - -// Put the absolute pathname of the current working directory in BUF. -// If successful, return BUF. If not, put an error message in -// BUF and return NULL. BUF should be at least PATH_MAX bytes long. -// -//go:linkname Getwd C.getwd -func Getwd(__buf *c.Char) *c.Char - -// NULL-terminated array of "NAME=VALUE" environment variables. -// -//go:linkname X__Environ C.__environ -var X__Environ **c.Char - -// Execute the file FD refers to, overlaying the running program image. -// ARGV and ENVP are passed to the new program, as for `execve'. -// -//go:linkname Fexecve C.fexecve -func Fexecve(__fd c.Int, __argv **c.Char, __envp **c.Char) c.Int - -// Add INC to priority of the current process. -// -//go:linkname Nice C.nice -func Nice(__inc c.Int) c.Int - -// Terminate program execution with the low-order 8 bits of STATUS. -// -//go:linkname X_exit C._exit -func X_exit(__status c.Int) - -// Get file-specific configuration information about PATH. -// -//go:linkname Pathconf C.pathconf -func Pathconf(__path *c.Char, __name c.Int) c.Long - -// Get file-specific configuration about descriptor FD. -// -//go:linkname Fpathconf C.fpathconf -func Fpathconf(__fd c.Int, __name c.Int) c.Long - -// Get the value of the system variable NAME. -// -//go:linkname Sysconf C.sysconf -func Sysconf(__name c.Int) c.Long - -// Get the value of the string-valued system variable NAME. -// -//go:linkname Confstr C.confstr -func Confstr(__name c.Int, __buf *c.Char, __len SizeT) SizeT - -// Get the process group ID of the calling process. -// -//go:linkname Getpgrp C.getpgrp -func Getpgrp() X__PidT - -// Get the process group ID of process PID. -// -//go:linkname X__Getpgid C.__getpgid -func X__Getpgid(__pid X__PidT) X__PidT - -//go:linkname Getpgid C.getpgid -func Getpgid(__pid X__PidT) X__PidT - -// Set the process group ID of the process matching PID to PGID. -// If PID is zero, the current process's process group ID is set. -// If PGID is zero, the process ID of the process is used. -// -//go:linkname Setpgid C.setpgid -func Setpgid(__pid X__PidT, __pgid X__PidT) c.Int - -// Set the process group ID of the calling process to its own PID. -// This is exactly the same as `setpgid (0, 0)'. -// -//go:linkname Setpgrp C.setpgrp -func Setpgrp() c.Int - -// Create a new session with the calling process as its leader. -// The process group IDs of the session and the calling process -// are set to the process ID of the calling process, which is returned. -// -//go:linkname Setsid C.setsid -func Setsid() X__PidT - -// Return the session ID of the given process. -// -//go:linkname Getsid C.getsid -func Getsid(__pid X__PidT) X__PidT - -// If SIZE is zero, return the number of supplementary groups -// the calling process is in. Otherwise, fill in the group IDs -// of its supplementary groups in LIST and return the number written. -// -//go:linkname Getgroups C.getgroups -func Getgroups(__size c.Int, __list *X__GidT) c.Int - -// Set the user ID of the calling process to UID. -// If the calling process is the super-user, set the real -// and effective user IDs, and the saved set-user-ID to UID; -// if not, the effective user ID is set to UID. -// -//go:linkname Setuid C.setuid -func Setuid(__uid X__UidT) c.Int - -// Set the real user ID of the calling process to RUID, -// and the effective user ID of the calling process to EUID. -// -//go:linkname Setreuid C.setreuid -func Setreuid(__ruid X__UidT, __euid X__UidT) c.Int - -// Set the effective user ID of the calling process to UID. -// -//go:linkname Seteuid C.seteuid -func Seteuid(__uid X__UidT) c.Int - -// Set the group ID of the calling process to GID. -// If the calling process is the super-user, set the real -// and effective group IDs, and the saved set-group-ID to GID; -// if not, the effective group ID is set to GID. -// -//go:linkname Setgid C.setgid -func Setgid(__gid X__GidT) c.Int - -// Set the real group ID of the calling process to RGID, -// and the effective group ID of the calling process to EGID. -// -//go:linkname Setregid C.setregid -func Setregid(__rgid X__GidT, __egid X__GidT) c.Int - -// Set the effective group ID of the calling process to GID. -// -//go:linkname Setegid C.setegid -func Setegid(__gid X__GidT) c.Int - -// Clone the calling process, but without copying the whole address space. -// The calling process is suspended until the new process exits or is -// replaced by a call to `execve'. Return -1 for errors, 0 to the new process, -// and the process ID of the new process to the old process. -// -//go:linkname Vfork C.vfork -func Vfork() c.Int - -// Return the pathname of the terminal FD is open on, or NULL on errors. -// The returned storage is good only until the next call to this function. -// -//go:linkname Ttyname C.ttyname -func Ttyname(__fd c.Int) *c.Char - -// Store at most BUFLEN characters of the pathname of the terminal FD is -// open on in BUF. Return 0 on success, otherwise an error number. -// -//go:linkname TtynameR C.ttyname_r -func TtynameR(__fd c.Int, __buf *c.Char, __buflen SizeT) c.Int - -// Return the index into the active-logins file (utmp) for -// the controlling terminal. -// -//go:linkname Ttyslot C.ttyslot -func Ttyslot() c.Int - -// Like link but relative paths in TO and FROM are interpreted relative -// to FROMFD and TOFD respectively. -// -//go:linkname Linkat C.linkat -func Linkat(__fromfd c.Int, __from *c.Char, __tofd c.Int, __to *c.Char, __flags c.Int) c.Int - -// Like symlink but a relative path in TO is interpreted relative to TOFD. -// -//go:linkname Symlinkat C.symlinkat -func Symlinkat(__from *c.Char, __tofd c.Int, __to *c.Char) c.Int - -// Like readlink but a relative PATH is interpreted relative to FD. -// -//go:linkname Readlinkat C.readlinkat -func Readlinkat(__fd c.Int, __path *c.Char, __buf *c.Char, __len SizeT) SsizeT - -// Return the foreground process group ID of FD. -// -//go:linkname Tcgetpgrp C.tcgetpgrp -func Tcgetpgrp(__fd c.Int) X__PidT - -// Set the foreground process group ID of FD set PGRP_ID. -// -//go:linkname Tcsetpgrp C.tcsetpgrp -func Tcsetpgrp(__fd c.Int, __pgrp_id X__PidT) c.Int - -// Return the login name of the user. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getlogin C.getlogin -func Getlogin() *c.Char - -// Return at most NAME_LEN characters of the login name of the user in NAME. -// If it cannot be determined or some other error occurred, return the error -// code. Otherwise return 0. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname GetloginR C.getlogin_r -func GetloginR(__name *c.Char, __name_len SizeT) c.Int - -// Set the login name returned by `getlogin'. -// -//go:linkname Setlogin C.setlogin -func Setlogin(__name *c.Char) c.Int - -// Put the name of the current host in no more than LEN bytes of NAME. -// The result is null-terminated if LEN is large enough for the full -// name and the terminator. -// -//go:linkname Gethostname C.gethostname -func Gethostname(__name *c.Char, __len SizeT) c.Int - -// Set the name of the current host to NAME, which is LEN bytes long. -// This call is restricted to the super-user. -// -//go:linkname Sethostname C.sethostname -func Sethostname(__name *c.Char, __len SizeT) c.Int - -// Set the current machine's Internet number to ID. -// This call is restricted to the super-user. -// -//go:linkname Sethostid C.sethostid -func Sethostid(__id c.Long) c.Int - -// Get and set the NIS (aka YP) domain name, if any. -// Called just like `gethostname' and `sethostname'. -// The NIS domain name is usually the empty string when not using NIS. -// -//go:linkname Getdomainname C.getdomainname -func Getdomainname(__name *c.Char, __len SizeT) c.Int - -//go:linkname Setdomainname C.setdomainname -func Setdomainname(__name *c.Char, __len SizeT) c.Int - -// Revoke access permissions to all processes currently communicating -// with the control terminal, and then send a SIGHUP signal to the process -// group of the control terminal. -// -//go:linkname Vhangup C.vhangup -func Vhangup() c.Int - -// Revoke the access of all descriptors currently open on FILE. -// -//go:linkname Revoke C.revoke -func Revoke(__file *c.Char) c.Int - -// Turn accounting on if NAME is an existing file. The system will then write -// a record for each process as it terminates, to this file. If NAME is NULL, -// turn accounting off. This call is restricted to the super-user. -// -//go:linkname Acct C.acct -func Acct(__name *c.Char) c.Int - -// Successive calls return the shells listed in `/etc/shells'. -// -//go:linkname Getusershell C.getusershell -func Getusershell() *c.Char - -// Discard cached info. -// -//go:linkname Endusershell C.endusershell -func Endusershell() - -// Rewind and re-read the file. -// -//go:linkname Setusershell C.setusershell -func Setusershell() - -// Put the program in the background, and dissociate from the controlling -// terminal. If NOCHDIR is zero, do `chdir ("/")'. If NOCLOSE is zero, -// redirects stdin, stdout, and stderr to /dev/null. -// -//go:linkname Daemon C.daemon -func Daemon(__nochdir c.Int, __noclose c.Int) c.Int - -// Prompt with PROMPT and read a string from the terminal without echoing. -// Uses /dev/tty if possible; otherwise stderr and stdin. -// -//go:linkname Getpass C.getpass -func Getpass(__prompt *c.Char) *c.Char - -// Return identifier for the current host. -// -//go:linkname Gethostid C.gethostid -func Gethostid() c.Long - -// Make all changes done to all files actually appear on disk. -// -//go:linkname Sync C.sync -func Sync() - -// Return the number of bytes in a page. This is the system's page size, -// which is not necessarily the same as the hardware page size. -// -//go:linkname Getpagesize C.getpagesize -func Getpagesize() c.Int - -// Return the maximum number of file descriptors -// the current process could possibly have. -// -//go:linkname Getdtablesize C.getdtablesize -func Getdtablesize() c.Int - -// Set the end of accessible data space (aka "the break") to ADDR. -// Returns zero on success and -1 for errors (with errno set). -// -//go:linkname Brk C.brk -func Brk(__addr unsafe.Pointer) c.Int - -// Increase or decrease the end of accessible data space by DELTA bytes. -// If successful, returns the address the previous end of data space -// (i.e. the beginning of the new space, if DELTA > 0); -// returns (void *) -1 for errors (with errno set). -// -//go:linkname Sbrk C.sbrk -func Sbrk(__delta IntptrT) unsafe.Pointer - -// Synchronize at least the data part of a file with the underlying -// media. -// -//go:linkname Fdatasync C.fdatasync -func Fdatasync(__fildes c.Int) c.Int diff --git a/c/os/unistd_linux_arm64.go b/c/os/unistd_linux_arm64.go deleted file mode 100644 index 3ec50c91..00000000 --- a/c/os/unistd_linux_arm64.go +++ /dev/null @@ -1,448 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - "unsafe" -) - -const X_UNISTD_H = 1 -const X_XOPEN_VERSION = 700 - -// Commands and utilities from XPG4 are available. -const X_XOPEN_XCU_VERSION = 4 - -// We are compatible with the old published standards as well. -const ( - X_XOPEN_XPG2 = 1 - X_XOPEN_XPG3 = 1 - X_XOPEN_XPG4 = 1 -) - -// The X/Open Unix extensions are available. -const X_XOPEN_UNIX = 1 - -// Encryption is present. -const X_XOPEN_CRYPT = 1 - -// The enhanced internationalization capabilities according to XPG4.2 -// are present. -const X_XOPEN_ENH_I18N = 1 - -// The legacy interfaces are also available. -const X_XOPEN_LEGACY = 1 - -// Standard file descriptors. -const ( - STDIN_FILENO = 0 - // Standard output. - STDOUT_FILENO = 1 - // Standard error output. - STDERR_FILENO = 2 -) - -type UsecondsT = X__UsecondsT -type IntptrT = X__IntptrT -type SocklenT = X__SocklenT - -// Test for access to NAME using the real UID and real GID. -// -//go:linkname Access C.access -func Access(__name *uint8, __type c.Int) c.Int - -// Read NBYTES into BUF from FD at the given position OFFSET without -// changing the file pointer. Return the number read, -1 for errors -// or 0 for EOF. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Pread C.pread -func Pread(__fd c.Int, __buf unsafe.Pointer, __nbytes SizeT, __offset X__OffT) SsizeT - -// Write N bytes of BUF to FD at the given position OFFSET without -// changing the file pointer. Return the number written, or -1. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Pwrite C.pwrite -func Pwrite(__fd c.Int, __buf unsafe.Pointer, __n SizeT, __offset X__OffT) SsizeT - -// Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. -// If SECONDS is zero, any currently scheduled alarm will be cancelled. -// The function returns the number of seconds remaining until the last -// alarm scheduled would have signaled, or zero if there wasn't one. -// There is no return value to indicate an error, but you can set `errno' -// to 0 and check its value after calling `alarm', and this might tell you. -// The signal may come late due to processor scheduling. -// -//go:linkname Alarm C.alarm -func Alarm(__seconds c.Uint) c.Uint - -// Make the process sleep for SECONDS seconds, or until a signal arrives -// and is not ignored. The function returns the number of seconds less -// than SECONDS which it actually slept (thus zero if it slept the full time). -// If a signal handler does a `longjmp' or modifies the handling of the -// SIGALRM signal while inside `sleep' call, the handling of the SIGALRM -// signal afterwards is undefined. There is no return value to indicate -// error, but if `sleep' returns SECONDS, it probably didn't work. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Sleep C.sleep -func Sleep(__seconds c.Uint) c.Uint - -// Set an alarm to go off (generating a SIGALRM signal) in VALUE -// microseconds. If INTERVAL is nonzero, when the alarm goes off, the -// timer is reset to go off every INTERVAL microseconds thereafter. -// Returns the number of microseconds remaining before the alarm. -// -//go:linkname Ualarm C.ualarm -func Ualarm(__value X__UsecondsT, __interval X__UsecondsT) X__UsecondsT - -// Sleep USECONDS microseconds, or until a signal arrives that is not blocked -// or ignored. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Usleep C.usleep -func Usleep(__useconds X__UsecondsT) c.Int - -// Suspend the process until a signal arrives. -// This always returns -1 and sets `errno' to EINTR. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Pause C.pause -func Pause() c.Int - -// Put the absolute pathname of the current working directory in BUF. -// If successful, return BUF. If not, put an error message in -// BUF and return NULL. BUF should be at least PATH_MAX bytes long. -// -//go:linkname Getwd C.getwd -func Getwd(__buf *uint8) *uint8 - -// NULL-terminated array of "NAME=VALUE" environment variables. -// -//go:linkname X__Environ C.__environ -var X__Environ **uint8 - -// Execute the file FD refers to, overlaying the running program image. -// ARGV and ENVP are passed to the new program, as for `execve'. -// -//go:linkname Fexecve C.fexecve -func Fexecve(__fd c.Int, __argv **uint8, __envp **uint8) c.Int - -// Add INC to priority of the current process. -// -//go:linkname Nice C.nice -func Nice(__inc c.Int) c.Int - -// Terminate program execution with the low-order 8 bits of STATUS. -// -//go:linkname X_exit C._exit -func X_exit(__status c.Int) - -// Get file-specific configuration information about PATH. -// -//go:linkname Pathconf C.pathconf -func Pathconf(__path *uint8, __name c.Int) c.Long - -// Get file-specific configuration about descriptor FD. -// -//go:linkname Fpathconf C.fpathconf -func Fpathconf(__fd c.Int, __name c.Int) c.Long - -// Get the value of the system variable NAME. -// -//go:linkname Sysconf C.sysconf -func Sysconf(__name c.Int) c.Long - -// Get the value of the string-valued system variable NAME. -// -//go:linkname Confstr C.confstr -func Confstr(__name c.Int, __buf *uint8, __len SizeT) SizeT - -// Get the process group ID of the calling process. -// -//go:linkname Getpgrp C.getpgrp -func Getpgrp() X__PidT - -// Get the process group ID of process PID. -// -//go:linkname X__Getpgid C.__getpgid -func X__Getpgid(__pid X__PidT) X__PidT - -//go:linkname Getpgid C.getpgid -func Getpgid(__pid X__PidT) X__PidT - -// Set the process group ID of the process matching PID to PGID. -// If PID is zero, the current process's process group ID is set. -// If PGID is zero, the process ID of the process is used. -// -//go:linkname Setpgid C.setpgid -func Setpgid(__pid X__PidT, __pgid X__PidT) c.Int - -// Set the process group ID of the calling process to its own PID. -// This is exactly the same as `setpgid (0, 0)'. -// -//go:linkname Setpgrp C.setpgrp -func Setpgrp() c.Int - -// Create a new session with the calling process as its leader. -// The process group IDs of the session and the calling process -// are set to the process ID of the calling process, which is returned. -// -//go:linkname Setsid C.setsid -func Setsid() X__PidT - -// Return the session ID of the given process. -// -//go:linkname Getsid C.getsid -func Getsid(__pid X__PidT) X__PidT - -// If SIZE is zero, return the number of supplementary groups -// the calling process is in. Otherwise, fill in the group IDs -// of its supplementary groups in LIST and return the number written. -// -//go:linkname Getgroups C.getgroups -func Getgroups(__size c.Int, __list *X__GidT) c.Int - -// Set the user ID of the calling process to UID. -// If the calling process is the super-user, set the real -// and effective user IDs, and the saved set-user-ID to UID; -// if not, the effective user ID is set to UID. -// -//go:linkname Setuid C.setuid -func Setuid(__uid X__UidT) c.Int - -// Set the real user ID of the calling process to RUID, -// and the effective user ID of the calling process to EUID. -// -//go:linkname Setreuid C.setreuid -func Setreuid(__ruid X__UidT, __euid X__UidT) c.Int - -// Set the effective user ID of the calling process to UID. -// -//go:linkname Seteuid C.seteuid -func Seteuid(__uid X__UidT) c.Int - -// Set the group ID of the calling process to GID. -// If the calling process is the super-user, set the real -// and effective group IDs, and the saved set-group-ID to GID; -// if not, the effective group ID is set to GID. -// -//go:linkname Setgid C.setgid -func Setgid(__gid X__GidT) c.Int - -// Set the real group ID of the calling process to RGID, -// and the effective group ID of the calling process to EGID. -// -//go:linkname Setregid C.setregid -func Setregid(__rgid X__GidT, __egid X__GidT) c.Int - -// Set the effective group ID of the calling process to GID. -// -//go:linkname Setegid C.setegid -func Setegid(__gid X__GidT) c.Int - -// Clone the calling process, but without copying the whole address space. -// The calling process is suspended until the new process exits or is -// replaced by a call to `execve'. Return -1 for errors, 0 to the new process, -// and the process ID of the new process to the old process. -// -//go:linkname Vfork C.vfork -func Vfork() c.Int - -// Return the pathname of the terminal FD is open on, or NULL on errors. -// The returned storage is good only until the next call to this function. -// -//go:linkname Ttyname C.ttyname -func Ttyname(__fd c.Int) *uint8 - -// Store at most BUFLEN characters of the pathname of the terminal FD is -// open on in BUF. Return 0 on success, otherwise an error number. -// -//go:linkname TtynameR C.ttyname_r -func TtynameR(__fd c.Int, __buf *uint8, __buflen SizeT) c.Int - -// Return the index into the active-logins file (utmp) for -// the controlling terminal. -// -//go:linkname Ttyslot C.ttyslot -func Ttyslot() c.Int - -// Like link but relative paths in TO and FROM are interpreted relative -// to FROMFD and TOFD respectively. -// -//go:linkname Linkat C.linkat -func Linkat(__fromfd c.Int, __from *uint8, __tofd c.Int, __to *uint8, __flags c.Int) c.Int - -// Like symlink but a relative path in TO is interpreted relative to TOFD. -// -//go:linkname Symlinkat C.symlinkat -func Symlinkat(__from *uint8, __tofd c.Int, __to *uint8) c.Int - -// Like readlink but a relative PATH is interpreted relative to FD. -// -//go:linkname Readlinkat C.readlinkat -func Readlinkat(__fd c.Int, __path *uint8, __buf *uint8, __len SizeT) SsizeT - -// Return the foreground process group ID of FD. -// -//go:linkname Tcgetpgrp C.tcgetpgrp -func Tcgetpgrp(__fd c.Int) X__PidT - -// Set the foreground process group ID of FD set PGRP_ID. -// -//go:linkname Tcsetpgrp C.tcsetpgrp -func Tcsetpgrp(__fd c.Int, __pgrp_id X__PidT) c.Int - -// Return the login name of the user. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname Getlogin C.getlogin -func Getlogin() *uint8 - -// Return at most NAME_LEN characters of the login name of the user in NAME. -// If it cannot be determined or some other error occurred, return the error -// code. Otherwise return 0. -// -// This function is a possible cancellation point and therefore not -// marked with __THROW. -// -//go:linkname GetloginR C.getlogin_r -func GetloginR(__name *uint8, __name_len SizeT) c.Int - -// Set the login name returned by `getlogin'. -// -//go:linkname Setlogin C.setlogin -func Setlogin(__name *uint8) c.Int - -// Put the name of the current host in no more than LEN bytes of NAME. -// The result is null-terminated if LEN is large enough for the full -// name and the terminator. -// -//go:linkname Gethostname C.gethostname -func Gethostname(__name *uint8, __len SizeT) c.Int - -// Set the name of the current host to NAME, which is LEN bytes long. -// This call is restricted to the super-user. -// -//go:linkname Sethostname C.sethostname -func Sethostname(__name *uint8, __len SizeT) c.Int - -// Set the current machine's Internet number to ID. -// This call is restricted to the super-user. -// -//go:linkname Sethostid C.sethostid -func Sethostid(__id c.Long) c.Int - -// Get and set the NIS (aka YP) domain name, if any. -// Called just like `gethostname' and `sethostname'. -// The NIS domain name is usually the empty string when not using NIS. -// -//go:linkname Getdomainname C.getdomainname -func Getdomainname(__name *uint8, __len SizeT) c.Int - -//go:linkname Setdomainname C.setdomainname -func Setdomainname(__name *uint8, __len SizeT) c.Int - -// Revoke access permissions to all processes currently communicating -// with the control terminal, and then send a SIGHUP signal to the process -// group of the control terminal. -// -//go:linkname Vhangup C.vhangup -func Vhangup() c.Int - -// Revoke the access of all descriptors currently open on FILE. -// -//go:linkname Revoke C.revoke -func Revoke(__file *uint8) c.Int - -// Turn accounting on if NAME is an existing file. The system will then write -// a record for each process as it terminates, to this file. If NAME is NULL, -// turn accounting off. This call is restricted to the super-user. -// -//go:linkname Acct C.acct -func Acct(__name *uint8) c.Int - -// Successive calls return the shells listed in `/etc/shells'. -// -//go:linkname Getusershell C.getusershell -func Getusershell() *uint8 - -// Discard cached info. -// -//go:linkname Endusershell C.endusershell -func Endusershell() - -// Rewind and re-read the file. -// -//go:linkname Setusershell C.setusershell -func Setusershell() - -// Put the program in the background, and dissociate from the controlling -// terminal. If NOCHDIR is zero, do `chdir ("/")'. If NOCLOSE is zero, -// redirects stdin, stdout, and stderr to /dev/null. -// -//go:linkname Daemon C.daemon -func Daemon(__nochdir c.Int, __noclose c.Int) c.Int - -// Prompt with PROMPT and read a string from the terminal without echoing. -// Uses /dev/tty if possible; otherwise stderr and stdin. -// -//go:linkname Getpass C.getpass -func Getpass(__prompt *uint8) *uint8 - -// Return identifier for the current host. -// -//go:linkname Gethostid C.gethostid -func Gethostid() c.Long - -// Make all changes done to all files actually appear on disk. -// -//go:linkname Sync C.sync -func Sync() - -// Return the number of bytes in a page. This is the system's page size, -// which is not necessarily the same as the hardware page size. -// -//go:linkname Getpagesize C.getpagesize -func Getpagesize() c.Int - -// Return the maximum number of file descriptors -// the current process could possibly have. -// -//go:linkname Getdtablesize C.getdtablesize -func Getdtablesize() c.Int - -// Set the end of accessible data space (aka "the break") to ADDR. -// Returns zero on success and -1 for errors (with errno set). -// -//go:linkname Brk C.brk -func Brk(__addr unsafe.Pointer) c.Int - -// Increase or decrease the end of accessible data space by DELTA bytes. -// If successful, returns the address the previous end of data space -// (i.e. the beginning of the new space, if DELTA > 0); -// returns (void *) -1 for errors (with errno set). -// -//go:linkname Sbrk C.sbrk -func Sbrk(__delta IntptrT) unsafe.Pointer - -// Synchronize at least the data part of a file with the underlying -// media. -// -//go:linkname Fdatasync C.fdatasync -func Fdatasync(__fildes c.Int) c.Int diff --git a/c/os/utime_darwin_arm64.go b/c/os/utime_darwin_arm64.go deleted file mode 100644 index eaa83a0a..00000000 --- a/c/os/utime_darwin_arm64.go +++ /dev/null @@ -1,18 +0,0 @@ -//go:build darwin && arm64 && !ios - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -type Utimbuf struct { - Actime TimeT - Modtime TimeT -} - -//go:linkname Utime C.utime -func Utime(_llcppg_param1 *c.Char, _llcppg_param2 *Utimbuf) c.Int diff --git a/c/os/utime_linux_amd64.go b/c/os/utime_linux_amd64.go deleted file mode 100644 index 484b09ae..00000000 --- a/c/os/utime_linux_amd64.go +++ /dev/null @@ -1,24 +0,0 @@ -//go:build linux && amd64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_UTIME_H = 1 - -// Structure describing file times. -type Utimbuf struct { - Actime X__TimeT - Modtime X__TimeT -} - -// Set the access and modification times of FILE to those given in -// FILE_TIMES. If FILE_TIMES is NULL, set them to the current time. -// -//go:linkname Utime C.utime -func Utime(__file *c.Char, __file_times *Utimbuf) c.Int diff --git a/c/os/utime_linux_arm64.go b/c/os/utime_linux_arm64.go deleted file mode 100644 index 8c0e4056..00000000 --- a/c/os/utime_linux_arm64.go +++ /dev/null @@ -1,24 +0,0 @@ -//go:build linux && arm64 && !android - -// Code generated by llcppg; DO NOT EDIT. - -package os - -import ( - "github.com/goplus/lib/c" - _ "unsafe" -) - -const X_UTIME_H = 1 - -// Structure describing file times. -type Utimbuf struct { - Actime X__TimeT - Modtime X__TimeT -} - -// Set the access and modification times of FILE to those given in -// FILE_TIMES. If FILE_TIMES is NULL, set them to the current time. -// -//go:linkname Utime C.utime -func Utime(__file *uint8, __file_times *Utimbuf) c.Int From 683b9fda43fb4a1ceef781f6a198b6216ef9e408 Mon Sep 17 00:00:00 2001 From: Rick Guo Date: Tue, 20 Oct 2026 00:21:44 +0800 Subject: [PATCH 4/6] Publish expanded unified libc classification for c/os --- c/os/libc_darwin_arm64.go | 158 +++++++++++++++++-- c/os/libc_linux_amd64.go | 250 +++++++++++++++++++++++------- c/os/libc_linux_arm64.go | 250 +++++++++++++++++++++++------- c/os/llcppg-flags-linux_amd64.cfg | 25 --- c/os/llcppg-flags-linux_arm64.cfg | 25 --- c/os/llcppg-linux_amd64.cfg | 141 ----------------- c/os/llcppg-linux_arm64.cfg | 141 ----------------- c/os/llcppg.cfg | 141 +---------------- c/os/llcppg.pub | 14 +- 9 files changed, 549 insertions(+), 596 deletions(-) delete mode 100644 c/os/llcppg-flags-linux_amd64.cfg delete mode 100644 c/os/llcppg-flags-linux_arm64.cfg delete mode 100644 c/os/llcppg-linux_amd64.cfg delete mode 100644 c/os/llcppg-linux_arm64.cfg diff --git a/c/os/libc_darwin_arm64.go b/c/os/libc_darwin_arm64.go index 61823e16..b73023c7 100644 --- a/c/os/libc_darwin_arm64.go +++ b/c/os/libc_darwin_arm64.go @@ -28,6 +28,9 @@ const ( // there's nothing more to read in the kernel ) +type X_telldir struct { +} + // llgo:link (*DIR).ReaddirR C.readdir_r func (self *DIR) ReaddirR(_llcppg_param2 *Dirent, _llcppg_param3 **Dirent) c.Int { return 0 @@ -148,6 +151,45 @@ const ( GLOB_ABEND = -2 ) +type GlobT struct { + GlPathc c.SizeT + GlMatchc c.Int + GlOffs c.SizeT + GlFlags c.Int + GlPathv **c.Char + GlErrfunc llcppgCallback14 + GlClosedir llcppgCallback13 + GlReaddir llcppgCallback12 + GlOpendir llcppgCallback11 + GlLstat llcppgCallback10 + GlStat llcppgCallback9 +} + +// llgo:type C +type llcppgCallback9 = func(_llcppg_param1 *c.Char, _llcppg_param2 *StatT) c.Int + +// llgo:type C +type llcppgCallback10 = func(_llcppg_param1 *c.Char, _llcppg_param2 *StatT) c.Int + +// llgo:type C +type llcppgCallback11 = func(_llcppg_param1 *c.Char) unsafe.Pointer + +// llgo:type C +type llcppgCallback12 = func(_llcppg_param1 unsafe.Pointer) *Dirent + +// llgo:type C +type llcppgCallback13 = func(_llcppg_param1 unsafe.Pointer) + +// llgo:type C +type llcppgCallback14 = func(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int + +//go:linkname Glob C.glob +func Glob(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 func(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int, _llcppg_param4 *GlobT) c.Int + +// llgo:link (*GlobT).Globfree C.globfree +func (self *GlobT) Globfree() { +} + type Group struct { GrName *c.Char GrPasswd *c.Char @@ -420,6 +462,11 @@ func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddfchdirNp(_llcppg_par return 0 } +type X_filesec struct { +} + +type FilesecT = *X_filesec + type MachPortT = c.Uint type UuidT = X__DarwinUuidT @@ -937,6 +984,13 @@ type FspecreadT = Fspecread type FattributiontagT = Fattributiontag +// data-protected non-portable open(2) : +// +// int open_dprotected_np(user_addr_t path, int flags, int class, int dpflags, int mode) +// +//go:linkname OpenxNp C.openx_np +func OpenxNp(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 FilesecT) c.Int + // data-protected non-portable open(2) : // // int open_dprotected_np(user_addr_t path, int flags, int class, int dpflags, int mode) @@ -953,6 +1007,48 @@ func OpenatAuthenticatedNp(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg //go:linkname Flock C.flock func Flock(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int +//go:linkname FilesecInit C.filesec_init +func FilesecInit() FilesecT + +// llgo:link FilesecT.FilesecDup C.filesec_dup +func (self FilesecT) FilesecDup() FilesecT { + return self +} + +// llgo:link FilesecT.FilesecFree C.filesec_free +func (self FilesecT) FilesecFree() { +} + +// llgo:link FilesecT.FilesecGetProperty C.filesec_get_property +func (self FilesecT) FilesecGetProperty(_llcppg_param2 FilesecPropertyT, _llcppg_param3 unsafe.Pointer) c.Int { + return 0 +} + +// llgo:link FilesecT.FilesecQueryProperty C.filesec_query_property +func (self FilesecT) FilesecQueryProperty(_llcppg_param2 FilesecPropertyT, _llcppg_param3 *c.Int) c.Int { + return 0 +} + +// llgo:link FilesecT.FilesecSetProperty C.filesec_set_property +func (self FilesecT) FilesecSetProperty(_llcppg_param2 FilesecPropertyT, _llcppg_param3 unsafe.Pointer) c.Int { + return 0 +} + +// llgo:link FilesecT.FilesecUnsetProperty C.filesec_unset_property +func (self FilesecT) FilesecUnsetProperty(_llcppg_param2 FilesecPropertyT) c.Int { + return 0 +} + +type PosixCred struct { +} + +type Ucred struct { +} + +type KauthCredT = *Ucred + +type PosixCredT = *PosixCred + // Protections are chosen from these bits, or-ed together const ( PROT_NONE = 0 @@ -1782,15 +1878,41 @@ func Utimensat(__fd c.Int, __path *c.Char, __times *lltime.Timespec, __flag c.In //go:linkname Chflags C.chflags func Chflags(_llcppg_param1 *c.Char, _llcppg_param2 c.Uint) c.Int +//go:linkname ChmodxNp C.chmodx_np +func ChmodxNp(_llcppg_param1 *c.Char, _llcppg_param2 FilesecT) c.Int + //go:linkname Fchflags C.fchflags func Fchflags(_llcppg_param1 c.Int, _llcppg_param2 c.Uint) c.Int +//go:linkname FchmodxNp C.fchmodx_np +func FchmodxNp(_llcppg_param1 c.Int, _llcppg_param2 FilesecT) c.Int + +//go:linkname FstatxNp C.fstatx_np +func FstatxNp(_llcppg_param1 c.Int, _llcppg_param2 *StatT, _llcppg_param3 FilesecT) c.Int + //go:linkname Lchflags C.lchflags func Lchflags(_llcppg_param1 *c.Char, _llcppg_param2 c.Uint) c.Int //go:linkname Lchmod C.lchmod func Lchmod(_llcppg_param1 *c.Char, _llcppg_param2 c.Uint16T) c.Int +//go:linkname LstatxNp C.lstatx_np +func LstatxNp(_llcppg_param1 *c.Char, _llcppg_param2 *StatT, _llcppg_param3 FilesecT) c.Int + +//go:linkname MkdirxNp C.mkdirx_np +func MkdirxNp(_llcppg_param1 *c.Char, _llcppg_param2 FilesecT) c.Int + +//go:linkname MkfifoxNp C.mkfifox_np +func MkfifoxNp(_llcppg_param1 *c.Char, _llcppg_param2 FilesecT) c.Int + +//go:linkname StatxNp C.statx_np +func StatxNp(_llcppg_param1 *c.Char, _llcppg_param2 *StatT, _llcppg_param3 FilesecT) c.Int + +// llgo:link FilesecT.UmaskxNp C.umaskx_np +func (self FilesecT) UmaskxNp() c.Int { + return 0 +} + // Defined bits for f_flag field value const ( ST_RDONLY = 1 @@ -1799,7 +1921,7 @@ const ( ) // Following structure is used as a statvfs/fstatvfs function parameter -type Statvfs struct { +type StatvfsT struct { FBsize c.Ulong FFrsize c.Ulong FBlocks c.Uint @@ -1814,7 +1936,10 @@ type Statvfs struct { } //go:linkname Fstatvfs C.fstatvfs -func Fstatvfs(_llcppg_param1 c.Int, _llcppg_param2 *Statvfs) c.Int +func Fstatvfs(_llcppg_param1 c.Int, _llcppg_param2 *StatvfsT) c.Int + +//go:linkname Statvfs C.statvfs +func Statvfs(_llcppg_param1 *c.Char, _llcppg_param2 *StatvfsT) c.Int // Special Control Characters // @@ -2204,14 +2329,14 @@ func (self *Termios) Cfsetspeed(_llcppg_param2 c.Ulong) c.Int { // [XSI] Structure whose address is passed as the first parameter to times() type Tms struct { - TmsUtime c.Ulong - TmsStime c.Ulong - TmsCutime c.Ulong - TmsCstime c.Ulong + TmsUtime lltime.ClockT + TmsStime lltime.ClockT + TmsCutime lltime.ClockT + TmsCstime lltime.ClockT } // llgo:link (*Tms).Times C.times -func (self *Tms) Times() c.Ulong { +func (self *Tms) Times() lltime.ClockT { return 0 } @@ -2347,6 +2472,12 @@ const ( SYNC_VOLUME_WAIT = 2 ) +type Fssearchblock struct { +} + +type Searchstate struct { +} + //go:linkname X_exit C._exit func X_exit(_llcppg_param1 c.Int) @@ -2407,9 +2538,6 @@ func TtynameR(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.Siz //go:linkname Confstr C.confstr func Confstr(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.SizeT) c.SizeT -//go:linkname Getopt C.getopt -func Getopt(_llcppg_param1 c.Int, _llcppg_param2 **c.Char, _llcppg_param3 *c.Char) c.Int - // getopt(3) external variables // //go:linkname Optarg C.optarg @@ -2486,9 +2614,6 @@ func Sync() //go:linkname Ualarm C.ualarm func Ualarm(_llcppg_param1 c.Uint, _llcppg_param2 c.Uint) c.Uint -//go:linkname Usleep C.usleep -func Usleep(_llcppg_param1 c.Uint) c.Int - // End XSI // //go:linkname Vfork C.vfork @@ -2679,6 +2804,9 @@ func Exchangedata(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char, _llcppg_param3 //go:linkname Getdirentriesattr C.getdirentriesattr func Getdirentriesattr(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.SizeT, _llcppg_param5 *c.Uint, _llcppg_param6 *c.Uint, _llcppg_param7 *c.Uint, _llcppg_param8 c.Uint) c.Int +//go:linkname Searchfs C.searchfs +func Searchfs(_llcppg_param1 *c.Char, _llcppg_param2 *Fssearchblock, _llcppg_param3 *c.Ulong, _llcppg_param4 c.Uint, _llcppg_param5 c.Uint, _llcppg_param6 *Searchstate) c.Int + //go:linkname Fsctl C.fsctl func Fsctl(_llcppg_param1 *c.Char, _llcppg_param2 c.Ulong, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.Uint) c.Int @@ -2695,8 +2823,8 @@ func SyncVolumeNp(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int var Optreset c.Int type Utimbuf struct { - Actime c.Long - Modtime c.Long + Actime lltime.TimeT + Modtime lltime.TimeT } //go:linkname Utime C.utime diff --git a/c/os/libc_linux_amd64.go b/c/os/libc_linux_amd64.go index f4a49da1..ad353a54 100644 --- a/c/os/libc_linux_amd64.go +++ b/c/os/libc_linux_amd64.go @@ -28,7 +28,6 @@ type FlockT struct { type Rusage struct { RuUtime llsys.Timeval RuStime llsys.Timeval - _llcppg_anon_8 _llcppg_anon_9 _llcppg_anon_10 _llcppg_anon_11 @@ -42,10 +41,7 @@ type Rusage struct { _llcppg_anon_19 _llcppg_anon_20 _llcppg_anon_21 -} - -type _llcppg_anon_8 struct { - _xgo_union [1]uint64 + _llcppg_anon_22 } type _llcppg_anon_9 struct { @@ -100,115 +96,119 @@ type _llcppg_anon_21 struct { _xgo_union [1]uint64 } -func (p *_llcppg_anon_8) XGof_ref_ru_maxrss() *c.Long { +type _llcppg_anon_22 struct { + _xgo_union [1]uint64 +} + +func (p *_llcppg_anon_9) XGof_ref_ru_maxrss() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_8) XGof_ref___ru_maxrss_word() *c.Long { +func (p *_llcppg_anon_9) XGof_ref___ru_maxrss_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_9) XGof_ref_ru_ixrss() *c.Long { +func (p *_llcppg_anon_10) XGof_ref_ru_ixrss() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_9) XGof_ref___ru_ixrss_word() *c.Long { +func (p *_llcppg_anon_10) XGof_ref___ru_ixrss_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_10) XGof_ref_ru_idrss() *c.Long { +func (p *_llcppg_anon_11) XGof_ref_ru_idrss() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_10) XGof_ref___ru_idrss_word() *c.Long { +func (p *_llcppg_anon_11) XGof_ref___ru_idrss_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_11) XGof_ref_ru_isrss() *c.Long { +func (p *_llcppg_anon_12) XGof_ref_ru_isrss() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_11) XGof_ref___ru_isrss_word() *c.Long { +func (p *_llcppg_anon_12) XGof_ref___ru_isrss_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_12) XGof_ref_ru_minflt() *c.Long { +func (p *_llcppg_anon_13) XGof_ref_ru_minflt() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_12) XGof_ref___ru_minflt_word() *c.Long { +func (p *_llcppg_anon_13) XGof_ref___ru_minflt_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_13) XGof_ref_ru_majflt() *c.Long { +func (p *_llcppg_anon_14) XGof_ref_ru_majflt() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_13) XGof_ref___ru_majflt_word() *c.Long { +func (p *_llcppg_anon_14) XGof_ref___ru_majflt_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_14) XGof_ref_ru_nswap() *c.Long { +func (p *_llcppg_anon_15) XGof_ref_ru_nswap() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_14) XGof_ref___ru_nswap_word() *c.Long { +func (p *_llcppg_anon_15) XGof_ref___ru_nswap_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_15) XGof_ref_ru_inblock() *c.Long { +func (p *_llcppg_anon_16) XGof_ref_ru_inblock() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_15) XGof_ref___ru_inblock_word() *c.Long { +func (p *_llcppg_anon_16) XGof_ref___ru_inblock_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_16) XGof_ref_ru_oublock() *c.Long { +func (p *_llcppg_anon_17) XGof_ref_ru_oublock() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_16) XGof_ref___ru_oublock_word() *c.Long { +func (p *_llcppg_anon_17) XGof_ref___ru_oublock_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_17) XGof_ref_ru_msgsnd() *c.Long { +func (p *_llcppg_anon_18) XGof_ref_ru_msgsnd() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_17) XGof_ref___ru_msgsnd_word() *c.Long { +func (p *_llcppg_anon_18) XGof_ref___ru_msgsnd_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_18) XGof_ref_ru_msgrcv() *c.Long { +func (p *_llcppg_anon_19) XGof_ref_ru_msgrcv() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_18) XGof_ref___ru_msgrcv_word() *c.Long { +func (p *_llcppg_anon_19) XGof_ref___ru_msgrcv_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_19) XGof_ref_ru_nsignals() *c.Long { +func (p *_llcppg_anon_20) XGof_ref_ru_nsignals() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_19) XGof_ref___ru_nsignals_word() *c.Long { +func (p *_llcppg_anon_20) XGof_ref___ru_nsignals_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_20) XGof_ref_ru_nvcsw() *c.Long { +func (p *_llcppg_anon_21) XGof_ref_ru_nvcsw() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_20) XGof_ref___ru_nvcsw_word() *c.Long { +func (p *_llcppg_anon_21) XGof_ref___ru_nvcsw_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_21) XGof_ref_ru_nivcsw() *c.Long { +func (p *_llcppg_anon_22) XGof_ref_ru_nivcsw() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_21) XGof_ref___ru_nivcsw_word() *c.Long { +func (p *_llcppg_anon_22) XGof_ref___ru_nivcsw_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } @@ -217,7 +217,7 @@ type SchedParam struct { X__SchedPriority c.Int } -type Statvfs struct { +type StatvfsT struct { FBsize c.Ulong FFrsize c.Ulong FBlocks c.Ulong @@ -264,6 +264,9 @@ const ( DT_WHT = 14 ) +type X__Dirstream struct { +} + // llgo:link (*DIR).ReaddirR C.readdir_r func (self *DIR) ReaddirR(__entry *Dirent, __result **Dirent) c.Int { return 0 @@ -304,7 +307,7 @@ func Alphasort(__e1 **Dirent, __e2 **Dirent) c.Int //go:linkname Getdirentries C.getdirentries func Getdirentries(__fd c.Int, __buf *c.Char, __nbytes c.SizeT, __basep *c.Long) c.Long -// Open the shared object c.FILE and map it in; return a handle that can be +// Open the shared object FILE and map it in; return a handle that can be // passed to `dlsym' to get symbol values from it. // //go:linkname Dlopen C.dlopen @@ -497,6 +500,42 @@ const ( GLOB_NOSYS = 4 ) +type GlobT struct { + GlPathc c.Ulong + GlPathv **c.Char + GlOffs c.Ulong + GlFlags c.Int + GlClosedir llcppgCallback9 + GlReaddir llcppgCallback8 + GlOpendir llcppgCallback7 + GlLstat llcppgCallback6 + GlStat llcppgCallback5 +} + +// llgo:type C +type llcppgCallback5 = func(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer) c.Int + +// llgo:type C +type llcppgCallback6 = func(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer) c.Int + +// llgo:type C +type llcppgCallback7 = func(_llcppg_param1 *c.Char) unsafe.Pointer + +// llgo:type C +type llcppgCallback8 = func(_llcppg_param1 unsafe.Pointer) unsafe.Pointer + +// llgo:type C +type llcppgCallback9 = func(_llcppg_param1 unsafe.Pointer) + +//go:linkname Glob C.glob +func Glob(__pattern *c.Char, __flags c.Int, __errfunc func(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int, __pglob *GlobT) c.Int + +// Free storage allocated in PGLOB by a previous `glob' call. +// +// llgo:link (*GlobT).Globfree C.globfree +func (self *GlobT) Globfree() { +} + // Reasonable value for the buffer sized used in the reentrant // functions below. But better use `sysconf'. const NSS_BUFLEN_GROUP = 1024 @@ -533,6 +572,16 @@ func Endgrent() //go:linkname Getgrent C.getgrent func Getgrent() *Group +// Read a group entry from STREAM. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Fgetgrent C.fgetgrent +func Fgetgrent(__stream *c.FILE) *Group + // Search for an entry with a matching group ID. // // This function is a possible cancellation point and therefore not @@ -565,6 +614,17 @@ func GetgrgidR(__gid c.Uint, __resultbuf *Group, __buffer *c.Char, __buflen c.Si //go:linkname GetgrnamR C.getgrnam_r func GetgrnamR(__name *c.Char, __resultbuf *Group, __buffer *c.Char, __buflen c.SizeT, __result **Group) c.Int +// Read a group entry from STREAM. This function is not standardized +// an probably never will. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname FgetgrentR C.fgetgrent_r +func FgetgrentR(__stream *c.FILE, __resultbuf *Group, __buffer *c.Char, __buflen c.SizeT, __result **Group) c.Int + // Set the group set for the current user to GROUPS (N of them). // //go:linkname Setgroups C.setgroups @@ -633,6 +693,16 @@ func Endpwent() //go:linkname Getpwent C.getpwent func Getpwent() *Passwd +// Read an entry from STREAM. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Fgetpwent C.fgetpwent +func Fgetpwent(__stream *c.FILE) *Passwd + // Write the given entry onto the given stream. // // This function is not part of POSIX and therefore no official @@ -677,6 +747,17 @@ func GetpwuidR(__uid c.Uint, __resultbuf *Passwd, __buffer *c.Char, __buflen c.S //go:linkname GetpwnamR C.getpwnam_r func GetpwnamR(__name *c.Char, __resultbuf *Passwd, __buffer *c.Char, __buflen c.SizeT, __result **Passwd) c.Int +// Read an entry from STREAM. This function is not standardized and +// probably never will. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname FgetpwentR C.fgetpwent_r +func FgetpwentR(__stream *c.FILE, __resultbuf *Passwd, __buffer *c.Char, __buflen c.SizeT, __result **Passwd) c.Int + // Set scheduling parameters for a process. // //go:linkname SchedSetparam C.sched_setparam @@ -738,6 +819,35 @@ type PosixSpawnattrT struct { X__Pad [16]c.Int } +// Data structure to contain information about the actions to be +// performed in the new process with respect to file descriptors. +type PosixSpawnFileActionsT struct { + X__Allocated c.Int + X__Used c.Int + X__Actions *X__SpawnAction + X__Pad [16]c.Int +} + +type X__SpawnAction struct { +} + +// Spawn a new process executing PATH with the attributes describes in *ATTRP. +// Before running the process perform the actions described in FILE-ACTIONS. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname PosixSpawn C.posix_spawn +func PosixSpawn(__pid *c.Int, __path *c.Char, __file_actions *PosixSpawnFileActionsT, __attrp *PosixSpawnattrT, __argv **c.Char, __envp **c.Char) c.Int + +// Similar to `posix_spawn' but search for FILE in the PATH. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname PosixSpawnp C.posix_spawnp +func PosixSpawnp(__pid *c.Int, __file *c.Char, __file_actions *PosixSpawnFileActionsT, __attrp *PosixSpawnattrT, __argv **c.Char, __envp **c.Char) c.Int + // Initialize data structure with attributes for `spawn' to default values. // // llgo:link (*PosixSpawnattrT).PosixSpawnattrInit C.posix_spawnattr_init @@ -837,6 +947,44 @@ func (self *PosixSpawnattrT) PosixSpawnattrSetschedparam(__schedparam *SchedPara return 0 } +// Initialize data structure for file attribute for `spawn' call. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsInit C.posix_spawn_file_actions_init +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsInit() c.Int { + return 0 +} + +// Free resources associated with FILE-ACTIONS. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsDestroy C.posix_spawn_file_actions_destroy +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsDestroy() c.Int { + return 0 +} + +// Add an action to FILE-ACTIONS which tells the implementation to call +// `open' for the given file during the `spawn' call. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddopen C.posix_spawn_file_actions_addopen +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddopen(__fd c.Int, __path *c.Char, __oflag c.Int, __mode c.Uint) c.Int { + return 0 +} + +// Add an action to FILE-ACTIONS which tells the implementation to call +// `close' for the given file descriptor during the `spawn' call. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddclose C.posix_spawn_file_actions_addclose +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddclose(__fd c.Int) c.Int { + return 0 +} + +// Add an action to FILE-ACTIONS which tells the implementation to call +// `dup2' for the given file descriptors during the `spawn' call. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAdddup2 C.posix_spawn_file_actions_adddup2 +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAdddup2(__fd c.Int, __newfd c.Int) c.Int { + return 0 +} + const ( // Seek from beginning of file. L_SET = 0 @@ -970,8 +1118,8 @@ const ( // Block size for `st_blocks'. const S_BLKSIZE = 512 -// Set file access permissions for c.FILE to MODE. -// If c.FILE is a symbolic link, this affects the link itself +// Set file access permissions for FILE to MODE. +// If FILE is a symbolic link, this affects the link itself // rather than its target. // //go:linkname Lchmod C.lchmod @@ -1009,15 +1157,18 @@ func Utimensat(__fd c.Int, __path *c.Char, __times *lltime.Timespec, __flags c.I //go:linkname Futimens C.futimens func Futimens(__fd c.Int, __times *lltime.Timespec) c.Int +//go:linkname Statvfs C.statvfs +func Statvfs(__file *c.Char, __buf *StatvfsT) c.Int + //go:linkname Fstatvfs C.fstatvfs -func Fstatvfs(__fildes c.Int, __buf *Statvfs) c.Int +func Fstatvfs(__fildes c.Int, __buf *StatvfsT) c.Int // Structure describing CPU time used by a process and its children. type Tms struct { - TmsUtime c.Long - TmsStime c.Long - TmsCutime c.Long - TmsCstime c.Long + TmsUtime lltime.ClockT + TmsStime lltime.ClockT + TmsCutime lltime.ClockT + TmsCstime lltime.ClockT } // Store the CPU time used by this process and all its @@ -1026,7 +1177,7 @@ type Tms struct { // All times are in CLK_TCKths of a second. // // llgo:link (*Tms).Times C.times -func (self *Tms) Times() c.Long { +func (self *Tms) Times() lltime.ClockT { return 0 } @@ -1287,15 +1438,6 @@ func Sleep(__seconds c.Uint) c.Uint //go:linkname Ualarm C.ualarm func Ualarm(__value c.Uint, __interval c.Uint) c.Uint -// Sleep USECONDS microseconds, or until a signal arrives that is not blocked -// or ignored. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Usleep C.usleep -func Usleep(__useconds c.Uint) c.Int - // Suspend the process until a signal arrives. // This always returns -1 and sets `errno' to EINTR. // @@ -1539,7 +1681,7 @@ func Setdomainname(__name *c.Char, __len c.SizeT) c.Int //go:linkname Vhangup C.vhangup func Vhangup() c.Int -// Revoke the access of all descriptors currently open on c.FILE. +// Revoke the access of all descriptors currently open on FILE. // //go:linkname Revoke C.revoke func Revoke(__file *c.Char) c.Int @@ -1636,7 +1778,7 @@ type Utimbuf struct { Modtime c.Long } -// Set the access and modification times of c.FILE to those given in +// Set the access and modification times of FILE to those given in // FILE_TIMES. If FILE_TIMES is NULL, set them to the current time. // //go:linkname Utime C.utime diff --git a/c/os/libc_linux_arm64.go b/c/os/libc_linux_arm64.go index 1ec9ebf6..f79c1d04 100644 --- a/c/os/libc_linux_arm64.go +++ b/c/os/libc_linux_arm64.go @@ -28,7 +28,6 @@ type FlockT struct { type Rusage struct { RuUtime llsys.Timeval RuStime llsys.Timeval - _llcppg_anon_7 _llcppg_anon_8 _llcppg_anon_9 _llcppg_anon_10 @@ -42,10 +41,7 @@ type Rusage struct { _llcppg_anon_18 _llcppg_anon_19 _llcppg_anon_20 -} - -type _llcppg_anon_7 struct { - _xgo_union [1]uint64 + _llcppg_anon_21 } type _llcppg_anon_8 struct { @@ -100,115 +96,119 @@ type _llcppg_anon_20 struct { _xgo_union [1]uint64 } -func (p *_llcppg_anon_7) XGof_ref_ru_maxrss() *c.Long { +type _llcppg_anon_21 struct { + _xgo_union [1]uint64 +} + +func (p *_llcppg_anon_8) XGof_ref_ru_maxrss() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_7) XGof_ref___ru_maxrss_word() *c.Long { +func (p *_llcppg_anon_8) XGof_ref___ru_maxrss_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_8) XGof_ref_ru_ixrss() *c.Long { +func (p *_llcppg_anon_9) XGof_ref_ru_ixrss() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_8) XGof_ref___ru_ixrss_word() *c.Long { +func (p *_llcppg_anon_9) XGof_ref___ru_ixrss_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_9) XGof_ref_ru_idrss() *c.Long { +func (p *_llcppg_anon_10) XGof_ref_ru_idrss() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_9) XGof_ref___ru_idrss_word() *c.Long { +func (p *_llcppg_anon_10) XGof_ref___ru_idrss_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_10) XGof_ref_ru_isrss() *c.Long { +func (p *_llcppg_anon_11) XGof_ref_ru_isrss() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_10) XGof_ref___ru_isrss_word() *c.Long { +func (p *_llcppg_anon_11) XGof_ref___ru_isrss_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_11) XGof_ref_ru_minflt() *c.Long { +func (p *_llcppg_anon_12) XGof_ref_ru_minflt() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_11) XGof_ref___ru_minflt_word() *c.Long { +func (p *_llcppg_anon_12) XGof_ref___ru_minflt_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_12) XGof_ref_ru_majflt() *c.Long { +func (p *_llcppg_anon_13) XGof_ref_ru_majflt() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_12) XGof_ref___ru_majflt_word() *c.Long { +func (p *_llcppg_anon_13) XGof_ref___ru_majflt_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_13) XGof_ref_ru_nswap() *c.Long { +func (p *_llcppg_anon_14) XGof_ref_ru_nswap() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_13) XGof_ref___ru_nswap_word() *c.Long { +func (p *_llcppg_anon_14) XGof_ref___ru_nswap_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_14) XGof_ref_ru_inblock() *c.Long { +func (p *_llcppg_anon_15) XGof_ref_ru_inblock() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_14) XGof_ref___ru_inblock_word() *c.Long { +func (p *_llcppg_anon_15) XGof_ref___ru_inblock_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_15) XGof_ref_ru_oublock() *c.Long { +func (p *_llcppg_anon_16) XGof_ref_ru_oublock() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_15) XGof_ref___ru_oublock_word() *c.Long { +func (p *_llcppg_anon_16) XGof_ref___ru_oublock_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_16) XGof_ref_ru_msgsnd() *c.Long { +func (p *_llcppg_anon_17) XGof_ref_ru_msgsnd() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_16) XGof_ref___ru_msgsnd_word() *c.Long { +func (p *_llcppg_anon_17) XGof_ref___ru_msgsnd_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_17) XGof_ref_ru_msgrcv() *c.Long { +func (p *_llcppg_anon_18) XGof_ref_ru_msgrcv() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_17) XGof_ref___ru_msgrcv_word() *c.Long { +func (p *_llcppg_anon_18) XGof_ref___ru_msgrcv_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_18) XGof_ref_ru_nsignals() *c.Long { +func (p *_llcppg_anon_19) XGof_ref_ru_nsignals() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_18) XGof_ref___ru_nsignals_word() *c.Long { +func (p *_llcppg_anon_19) XGof_ref___ru_nsignals_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_19) XGof_ref_ru_nvcsw() *c.Long { +func (p *_llcppg_anon_20) XGof_ref_ru_nvcsw() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_19) XGof_ref___ru_nvcsw_word() *c.Long { +func (p *_llcppg_anon_20) XGof_ref___ru_nvcsw_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_20) XGof_ref_ru_nivcsw() *c.Long { +func (p *_llcppg_anon_21) XGof_ref_ru_nivcsw() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_20) XGof_ref___ru_nivcsw_word() *c.Long { +func (p *_llcppg_anon_21) XGof_ref___ru_nivcsw_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } @@ -217,7 +217,7 @@ type SchedParam struct { X__SchedPriority c.Int } -type Statvfs struct { +type StatvfsT struct { FBsize c.Ulong FFrsize c.Ulong FBlocks c.Ulong @@ -264,6 +264,9 @@ const ( DT_WHT = 14 ) +type X__Dirstream struct { +} + // llgo:link (*DIR).ReaddirR C.readdir_r func (self *DIR) ReaddirR(__entry *Dirent, __result **Dirent) c.Int { return 0 @@ -304,7 +307,7 @@ func Alphasort(__e1 **Dirent, __e2 **Dirent) c.Int //go:linkname Getdirentries C.getdirentries func Getdirentries(__fd c.Int, __buf *uint8, __nbytes c.SizeT, __basep *c.Long) c.Long -// Open the shared object c.FILE and map it in; return a handle that can be +// Open the shared object FILE and map it in; return a handle that can be // passed to `dlsym' to get symbol values from it. // //go:linkname Dlopen C.dlopen @@ -497,6 +500,42 @@ const ( GLOB_NOSYS = 4 ) +type GlobT struct { + GlPathc c.Ulong + GlPathv **uint8 + GlOffs c.Ulong + GlFlags c.Int + GlClosedir llcppgCallback9 + GlReaddir llcppgCallback8 + GlOpendir llcppgCallback7 + GlLstat llcppgCallback6 + GlStat llcppgCallback5 +} + +// llgo:type C +type llcppgCallback5 = func(_llcppg_param1 *uint8, _llcppg_param2 unsafe.Pointer) c.Int + +// llgo:type C +type llcppgCallback6 = func(_llcppg_param1 *uint8, _llcppg_param2 unsafe.Pointer) c.Int + +// llgo:type C +type llcppgCallback7 = func(_llcppg_param1 *uint8) unsafe.Pointer + +// llgo:type C +type llcppgCallback8 = func(_llcppg_param1 unsafe.Pointer) unsafe.Pointer + +// llgo:type C +type llcppgCallback9 = func(_llcppg_param1 unsafe.Pointer) + +//go:linkname Glob C.glob +func Glob(__pattern *uint8, __flags c.Int, __errfunc func(_llcppg_param1 *uint8, _llcppg_param2 c.Int) c.Int, __pglob *GlobT) c.Int + +// Free storage allocated in PGLOB by a previous `glob' call. +// +// llgo:link (*GlobT).Globfree C.globfree +func (self *GlobT) Globfree() { +} + // Reasonable value for the buffer sized used in the reentrant // functions below. But better use `sysconf'. const NSS_BUFLEN_GROUP = 1024 @@ -533,6 +572,16 @@ func Endgrent() //go:linkname Getgrent C.getgrent func Getgrent() *Group +// Read a group entry from STREAM. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Fgetgrent C.fgetgrent +func Fgetgrent(__stream *c.FILE) *Group + // Search for an entry with a matching group ID. // // This function is a possible cancellation point and therefore not @@ -565,6 +614,17 @@ func GetgrgidR(__gid c.Uint, __resultbuf *Group, __buffer *uint8, __buflen c.Siz //go:linkname GetgrnamR C.getgrnam_r func GetgrnamR(__name *uint8, __resultbuf *Group, __buffer *uint8, __buflen c.SizeT, __result **Group) c.Int +// Read a group entry from STREAM. This function is not standardized +// an probably never will. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname FgetgrentR C.fgetgrent_r +func FgetgrentR(__stream *c.FILE, __resultbuf *Group, __buffer *uint8, __buflen c.SizeT, __result **Group) c.Int + // Set the group set for the current user to GROUPS (N of them). // //go:linkname Setgroups C.setgroups @@ -633,6 +693,16 @@ func Endpwent() //go:linkname Getpwent C.getpwent func Getpwent() *Passwd +// Read an entry from STREAM. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname Fgetpwent C.fgetpwent +func Fgetpwent(__stream *c.FILE) *Passwd + // Write the given entry onto the given stream. // // This function is not part of POSIX and therefore no official @@ -677,6 +747,17 @@ func GetpwuidR(__uid c.Uint, __resultbuf *Passwd, __buffer *uint8, __buflen c.Si //go:linkname GetpwnamR C.getpwnam_r func GetpwnamR(__name *uint8, __resultbuf *Passwd, __buffer *uint8, __buflen c.SizeT, __result **Passwd) c.Int +// Read an entry from STREAM. This function is not standardized and +// probably never will. +// +// This function is not part of POSIX and therefore no official +// cancellation point. But due to similarity with an POSIX interface +// or due to the implementation it is a cancellation point and +// therefore not marked with __THROW. +// +//go:linkname FgetpwentR C.fgetpwent_r +func FgetpwentR(__stream *c.FILE, __resultbuf *Passwd, __buffer *uint8, __buflen c.SizeT, __result **Passwd) c.Int + // Set scheduling parameters for a process. // //go:linkname SchedSetparam C.sched_setparam @@ -738,6 +819,35 @@ type PosixSpawnattrT struct { X__Pad [16]c.Int } +// Data structure to contain information about the actions to be +// performed in the new process with respect to file descriptors. +type PosixSpawnFileActionsT struct { + X__Allocated c.Int + X__Used c.Int + X__Actions *X__SpawnAction + X__Pad [16]c.Int +} + +type X__SpawnAction struct { +} + +// Spawn a new process executing PATH with the attributes describes in *ATTRP. +// Before running the process perform the actions described in FILE-ACTIONS. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname PosixSpawn C.posix_spawn +func PosixSpawn(__pid *c.Int, __path *uint8, __file_actions *PosixSpawnFileActionsT, __attrp *PosixSpawnattrT, __argv **uint8, __envp **uint8) c.Int + +// Similar to `posix_spawn' but search for FILE in the PATH. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname PosixSpawnp C.posix_spawnp +func PosixSpawnp(__pid *c.Int, __file *uint8, __file_actions *PosixSpawnFileActionsT, __attrp *PosixSpawnattrT, __argv **uint8, __envp **uint8) c.Int + // Initialize data structure with attributes for `spawn' to default values. // // llgo:link (*PosixSpawnattrT).PosixSpawnattrInit C.posix_spawnattr_init @@ -837,6 +947,44 @@ func (self *PosixSpawnattrT) PosixSpawnattrSetschedparam(__schedparam *SchedPara return 0 } +// Initialize data structure for file attribute for `spawn' call. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsInit C.posix_spawn_file_actions_init +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsInit() c.Int { + return 0 +} + +// Free resources associated with FILE-ACTIONS. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsDestroy C.posix_spawn_file_actions_destroy +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsDestroy() c.Int { + return 0 +} + +// Add an action to FILE-ACTIONS which tells the implementation to call +// `open' for the given file during the `spawn' call. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddopen C.posix_spawn_file_actions_addopen +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddopen(__fd c.Int, __path *uint8, __oflag c.Int, __mode c.Uint) c.Int { + return 0 +} + +// Add an action to FILE-ACTIONS which tells the implementation to call +// `close' for the given file descriptor during the `spawn' call. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAddclose C.posix_spawn_file_actions_addclose +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddclose(__fd c.Int) c.Int { + return 0 +} + +// Add an action to FILE-ACTIONS which tells the implementation to call +// `dup2' for the given file descriptors during the `spawn' call. +// +// llgo:link (*PosixSpawnFileActionsT).PosixSpawnFileActionsAdddup2 C.posix_spawn_file_actions_adddup2 +func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAdddup2(__fd c.Int, __newfd c.Int) c.Int { + return 0 +} + const ( // Seek from beginning of file. L_SET = 0 @@ -970,8 +1118,8 @@ const ( // Block size for `st_blocks'. const S_BLKSIZE = 512 -// Set file access permissions for c.FILE to MODE. -// If c.FILE is a symbolic link, this affects the link itself +// Set file access permissions for FILE to MODE. +// If FILE is a symbolic link, this affects the link itself // rather than its target. // //go:linkname Lchmod C.lchmod @@ -1009,15 +1157,18 @@ func Utimensat(__fd c.Int, __path *uint8, __times *lltime.Timespec, __flags c.In //go:linkname Futimens C.futimens func Futimens(__fd c.Int, __times *lltime.Timespec) c.Int +//go:linkname Statvfs C.statvfs +func Statvfs(__file *uint8, __buf *StatvfsT) c.Int + //go:linkname Fstatvfs C.fstatvfs -func Fstatvfs(__fildes c.Int, __buf *Statvfs) c.Int +func Fstatvfs(__fildes c.Int, __buf *StatvfsT) c.Int // Structure describing CPU time used by a process and its children. type Tms struct { - TmsUtime c.Long - TmsStime c.Long - TmsCutime c.Long - TmsCstime c.Long + TmsUtime lltime.ClockT + TmsStime lltime.ClockT + TmsCutime lltime.ClockT + TmsCstime lltime.ClockT } // Store the CPU time used by this process and all its @@ -1026,7 +1177,7 @@ type Tms struct { // All times are in CLK_TCKths of a second. // // llgo:link (*Tms).Times C.times -func (self *Tms) Times() c.Long { +func (self *Tms) Times() lltime.ClockT { return 0 } @@ -1287,15 +1438,6 @@ func Sleep(__seconds c.Uint) c.Uint //go:linkname Ualarm C.ualarm func Ualarm(__value c.Uint, __interval c.Uint) c.Uint -// Sleep USECONDS microseconds, or until a signal arrives that is not blocked -// or ignored. -// -// This function is a cancellation point and therefore not marked with -// __THROW. -// -//go:linkname Usleep C.usleep -func Usleep(__useconds c.Uint) c.Int - // Suspend the process until a signal arrives. // This always returns -1 and sets `errno' to EINTR. // @@ -1539,7 +1681,7 @@ func Setdomainname(__name *uint8, __len c.SizeT) c.Int //go:linkname Vhangup C.vhangup func Vhangup() c.Int -// Revoke the access of all descriptors currently open on c.FILE. +// Revoke the access of all descriptors currently open on FILE. // //go:linkname Revoke C.revoke func Revoke(__file *uint8) c.Int @@ -1636,7 +1778,7 @@ type Utimbuf struct { Modtime c.Long } -// Set the access and modification times of c.FILE to those given in +// Set the access and modification times of FILE to those given in // FILE_TIMES. If FILE_TIMES is NULL, set them to the current time. // //go:linkname Utime C.utime diff --git a/c/os/llcppg-flags-linux_amd64.cfg b/c/os/llcppg-flags-linux_amd64.cfg deleted file mode 100644 index 53155e3b..00000000 --- a/c/os/llcppg-flags-linux_amd64.cfg +++ /dev/null @@ -1,25 +0,0 @@ -{ - "Name": "os", - "Language": "c", - "Dir": ".sysroot/flags", - "Stdlib": ".sysroot/stdlib", - "Files": [ - "flags.h" - ], - "Deps": [ - ".." - ], - "Rename": { - "_llcppg_flag_F_GETFL": "F_GETFL", - "_llcppg_flag_F_SETFL": "F_SETFL", - "_llcppg_flag_O_RDONLY": "O_RDONLY", - "_llcppg_flag_O_WRONLY": "O_WRONLY", - "_llcppg_flag_O_RDWR": "O_RDWR", - "_llcppg_flag_O_ACCMODE": "O_ACCMODE", - "_llcppg_flag_O_NONBLOCK": "O_NONBLOCK", - "_llcppg_flag_O_CREAT": "O_CREAT", - "_llcppg_flag_O_TRUNC": "O_TRUNC", - "_llcppg_flag_EAGAIN": "EAGAIN" - }, - "FailFast": 0 -} diff --git a/c/os/llcppg-flags-linux_arm64.cfg b/c/os/llcppg-flags-linux_arm64.cfg deleted file mode 100644 index 53155e3b..00000000 --- a/c/os/llcppg-flags-linux_arm64.cfg +++ /dev/null @@ -1,25 +0,0 @@ -{ - "Name": "os", - "Language": "c", - "Dir": ".sysroot/flags", - "Stdlib": ".sysroot/stdlib", - "Files": [ - "flags.h" - ], - "Deps": [ - ".." - ], - "Rename": { - "_llcppg_flag_F_GETFL": "F_GETFL", - "_llcppg_flag_F_SETFL": "F_SETFL", - "_llcppg_flag_O_RDONLY": "O_RDONLY", - "_llcppg_flag_O_WRONLY": "O_WRONLY", - "_llcppg_flag_O_RDWR": "O_RDWR", - "_llcppg_flag_O_ACCMODE": "O_ACCMODE", - "_llcppg_flag_O_NONBLOCK": "O_NONBLOCK", - "_llcppg_flag_O_CREAT": "O_CREAT", - "_llcppg_flag_O_TRUNC": "O_TRUNC", - "_llcppg_flag_EAGAIN": "EAGAIN" - }, - "FailFast": 0 -} diff --git a/c/os/llcppg-linux_amd64.cfg b/c/os/llcppg-linux_amd64.cfg deleted file mode 100644 index d3e9ac2e..00000000 --- a/c/os/llcppg-linux_amd64.cfg +++ /dev/null @@ -1,141 +0,0 @@ -{ - "Name": "os", - "Language": "c", - "Dir": ".sysroot/include", - "Stdlib": ".sysroot/stdlib", - "Files": [ - "llcppg.h" - ], - "Deps": [ - "..", - "../signal", - "../sys", - "../time" - ], - "FailFast": 0, - "FuncIgnore": [ - "__fxstat", - "__fxstat64", - "__fxstatat", - "__fxstatat64", - "__lxstat", - "__lxstat64", - "__xstat", - "__xstat64", - "add_profil", - "alloca", - "chdir", - "chmod", - "chown", - "chroot", - "close", - "closedir", - "creat", - "dup", - "dup2", - "dup3", - "execl", - "execle", - "execlp", - "execv", - "execve", - "execvp", - "exit", - "faccessat", - "fchdir", - "fchmod", - "fchmodat", - "fchown", - "fchownat", - "fcntl", - "fdopendir", - "fork", - "fstat", - "fstatat", - "fstatx_np", - "fsync", - "ftruncate", - "getcwd", - "getdirentries", - "getegid", - "getenv", - "geteuid", - "getgid", - "getpid", - "getppid", - "getrlimit", - "getuid", - "if_nameindex", - "isatty", - "kill", - "lchown", - "link", - "llgoClearenv", - "llgoErrno", - "longjmperror", - "lseek", - "lstat", - "lstatx_np", - "mkdir", - "mkfifo", - "mknod", - "open", - "openat", - "opendir", - "pfctlinput", - "pipe", - "profil", - "putenv", - "read", - "readdir", - "readlink", - "remove", - "rename", - "rmdir", - "setenv", - "setgrfile", - "setrlimit", - "sigaction", - "sigvec", - "stat", - "statvfs", - "statx_np", - "symlink", - "syscall", - "sysctl", - "sysctlbyname", - "sysctlnametomib", - "truncate", - "umask", - "unlink", - "unlinkat", - "unsetenv", - "unwhiteout", - "wait", - "wait3", - "wait4", - "waitpid", - "write" - ], - "TypeIgnore": [ - "va_list", - "stat" - ], - "Rename": { - "_llcppg_flock_type": "FlockT", - "_llcppg_wait_type": "WaitStatus" - }, - "MacroIgnore": [ - "EAGAIN", - "F_GETFL", - "F_SETFL", - "O_ACCMODE", - "O_CREAT", - "O_NONBLOCK", - "O_RDONLY", - "O_RDWR", - "O_TRUNC", - "O_WRONLY", - "PATH_MAX" - ] -} diff --git a/c/os/llcppg-linux_arm64.cfg b/c/os/llcppg-linux_arm64.cfg deleted file mode 100644 index d3e9ac2e..00000000 --- a/c/os/llcppg-linux_arm64.cfg +++ /dev/null @@ -1,141 +0,0 @@ -{ - "Name": "os", - "Language": "c", - "Dir": ".sysroot/include", - "Stdlib": ".sysroot/stdlib", - "Files": [ - "llcppg.h" - ], - "Deps": [ - "..", - "../signal", - "../sys", - "../time" - ], - "FailFast": 0, - "FuncIgnore": [ - "__fxstat", - "__fxstat64", - "__fxstatat", - "__fxstatat64", - "__lxstat", - "__lxstat64", - "__xstat", - "__xstat64", - "add_profil", - "alloca", - "chdir", - "chmod", - "chown", - "chroot", - "close", - "closedir", - "creat", - "dup", - "dup2", - "dup3", - "execl", - "execle", - "execlp", - "execv", - "execve", - "execvp", - "exit", - "faccessat", - "fchdir", - "fchmod", - "fchmodat", - "fchown", - "fchownat", - "fcntl", - "fdopendir", - "fork", - "fstat", - "fstatat", - "fstatx_np", - "fsync", - "ftruncate", - "getcwd", - "getdirentries", - "getegid", - "getenv", - "geteuid", - "getgid", - "getpid", - "getppid", - "getrlimit", - "getuid", - "if_nameindex", - "isatty", - "kill", - "lchown", - "link", - "llgoClearenv", - "llgoErrno", - "longjmperror", - "lseek", - "lstat", - "lstatx_np", - "mkdir", - "mkfifo", - "mknod", - "open", - "openat", - "opendir", - "pfctlinput", - "pipe", - "profil", - "putenv", - "read", - "readdir", - "readlink", - "remove", - "rename", - "rmdir", - "setenv", - "setgrfile", - "setrlimit", - "sigaction", - "sigvec", - "stat", - "statvfs", - "statx_np", - "symlink", - "syscall", - "sysctl", - "sysctlbyname", - "sysctlnametomib", - "truncate", - "umask", - "unlink", - "unlinkat", - "unsetenv", - "unwhiteout", - "wait", - "wait3", - "wait4", - "waitpid", - "write" - ], - "TypeIgnore": [ - "va_list", - "stat" - ], - "Rename": { - "_llcppg_flock_type": "FlockT", - "_llcppg_wait_type": "WaitStatus" - }, - "MacroIgnore": [ - "EAGAIN", - "F_GETFL", - "F_SETFL", - "O_ACCMODE", - "O_CREAT", - "O_NONBLOCK", - "O_RDONLY", - "O_RDWR", - "O_TRUNC", - "O_WRONLY", - "PATH_MAX" - ] -} diff --git a/c/os/llcppg.cfg b/c/os/llcppg.cfg index 8a3f6a7f..75e27be3 100644 --- a/c/os/llcppg.cfg +++ b/c/os/llcppg.cfg @@ -1,142 +1,3 @@ { - "Name": "os", - "Language": "c", - "Dir": ".sysroot/include", - "Stdlib": ".sysroot/stdlib", - "Files": [ - "llcppg.h" - ], - "Deps": [ - "..", - "../signal", - "../sys", - "../time" - ], - "FailFast": 0, - "FuncIgnore": [ - "__fxstat", - "__fxstat64", - "__fxstatat", - "__fxstatat64", - "__lxstat", - "__lxstat64", - "__xstat", - "__xstat64", - "add_profil", - "alloca", - "chdir", - "chmod", - "chown", - "chroot", - "close", - "closedir", - "creat", - "dup", - "dup2", - "dup3", - "execl", - "execle", - "execlp", - "execv", - "execve", - "execvp", - "exit", - "faccessat", - "fchdir", - "fchmod", - "fchmodat", - "fchown", - "fchownat", - "fcntl", - "fdopendir", - "fork", - "fstat", - "fstatat", - "fstatx_np", - "fsync", - "ftruncate", - "getcwd", - "getdirentries", - "getegid", - "getenv", - "geteuid", - "getgid", - "getpid", - "getppid", - "getrlimit", - "getuid", - "if_nameindex", - "isatty", - "kill", - "lchown", - "link", - "llgoClearenv", - "llgoErrno", - "longjmperror", - "lseek", - "lstat", - "lstatx_np", - "mkdir", - "mkfifo", - "mknod", - "open", - "openat", - "opendir", - "pfctlinput", - "pipe", - "profil", - "putenv", - "read", - "readdir", - "readlink", - "remove", - "rename", - "rmdir", - "setenv", - "setgrfile", - "setrlimit", - "sigaction", - "sigvec", - "stat", - "statvfs", - "statx_np", - "symlink", - "syscall", - "sysctl", - "sysctlbyname", - "sysctlnametomib", - "truncate", - "umask", - "unlink", - "unlinkat", - "unsetenv", - "unwhiteout", - "wait", - "wait3", - "wait4", - "waitpid", - "write" - ], - "TypeIgnore": [ - "va_list", - "stat", - "glob_t" - ], - "Rename": { - "_llcppg_flock_type": "FlockT", - "_llcppg_wait_type": "WaitStatus" - }, - "MacroIgnore": [ - "EAGAIN", - "F_GETFL", - "F_SETFL", - "O_ACCMODE", - "O_CREAT", - "O_NONBLOCK", - "O_RDONLY", - "O_RDWR", - "O_TRUNC", - "O_WRONLY", - "PATH_MAX" - ] + "Dir": ".sysroot/include" } diff --git a/c/os/llcppg.pub b/c/os/llcppg.pub index c2f3bd92..0920eb11 100644 --- a/c/os/llcppg.pub +++ b/c/os/llcppg.pub @@ -5,7 +5,11 @@ T DIR DIR T Dl_info DlInfo T __caddr_t X__CaddrT T __darwin_uuid_t X__DarwinUuidT +T __dirstream X__Dirstream T __fsid_t X__FsidT +T __spawn_action X__SpawnAction +T _filesec X_filesec +T _telldir X_telldir T accessx_descriptor AccessxDescriptor T caddr_t CaddrT T dev_t DevT @@ -18,6 +22,7 @@ T fchecklv_t FchecklvT T fgetsigsinfo Fgetsigsinfo T fgetsigsinfo_t FgetsigsinfoT T filesec_property_t FilesecPropertyT +T filesec_t FilesecT T flock FlockT T flocktimeout Flocktimeout T fpunchhole Fpunchhole @@ -27,6 +32,7 @@ T fsignatures Fsignatures T fsignatures_t FsignaturesT T fspecread Fspecread T fspecread_t FspecreadT +T fssearchblock Fssearchblock T fstore Fstore T fstore_t FstoreT T fsupplement Fsupplement @@ -34,14 +40,18 @@ T fsupplement_t FsupplementT T ftrimactivefile Ftrimactivefile T ftrimactivefile_t FtrimactivefileT T gid_t GidT +T glob_t GlobT T group Group T idtype_t IdtypeT +T kauth_cred_t KauthCredT T mach_port_t MachPortT T mode_t ModeT T off_t OffT T ostat Ostat T passwd Passwd T pid_t PidT +T posix_cred PosixCred +T posix_cred_t PosixCredT T posix_spawn_file_actions_t PosixSpawnFileActionsT T posix_spawnattr_t PosixSpawnattrT T proc_rlimit_control_wakeupmon ProcRlimitControlWakeupmon @@ -59,11 +69,13 @@ T rusage_info_v4 RusageInfoV4 T rusage_info_v5 RusageInfoV5 T rusage_info_v6 RusageInfoV6 T sched_param SchedParam +T searchstate Searchstate T semaphore_t SemaphoreT T stat StatT -T statvfs Statvfs +T statvfs StatvfsT T termios Termios T tms Tms +T ucred Ucred T uid_t UidT T uio_rw UioRw T utimbuf Utimbuf From 11bd5eee7d8529dd76f1211a2c5375015fe735f0 Mon Sep 17 00:00:00 2001 From: Rick Guo Date: Tue, 20 Oct 2026 14:03:34 +0800 Subject: [PATCH 5/6] Regenerate c/os native APIs and verify native calls --- c/os/_libc_darwin_arm64.c | 60 ++ ...generated_native_darwin_arm64_llgo_test.go | 30 + c/os/generated_native_llgo_test.go | 42 ++ c/os/libc_darwin_arm64.go | 522 +++++++++++++++- c/os/libc_linux_amd64.go | 568 ++++++++++++++++-- c/os/libc_linux_arm64.go | 568 ++++++++++++++++-- c/os/llcppg.pub | 5 + c/os/native_files_darwin_other.go | 5 + c/os/os_darwin.go | 4 +- 9 files changed, 1686 insertions(+), 118 deletions(-) create mode 100644 c/os/_libc_darwin_arm64.c create mode 100644 c/os/generated_native_darwin_arm64_llgo_test.go create mode 100644 c/os/generated_native_llgo_test.go create mode 100644 c/os/native_files_darwin_other.go diff --git a/c/os/_libc_darwin_arm64.c b/c/os/_libc_darwin_arm64.c new file mode 100644 index 00000000..199f27bd --- /dev/null +++ b/c/os/_libc_darwin_arm64.c @@ -0,0 +1,60 @@ +// Code generated by llcppg; classified from the common libc binding. +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int _llcppg___darwin_check_fd_set(int _a, const void *_b) { + return __darwin_check_fd_set(_a, _b); +} + +int _llcppg___darwin_fd_isset(int _fd, const struct fd_set *_p) { + return __darwin_fd_isset(_fd, _p); +} diff --git a/c/os/generated_native_darwin_arm64_llgo_test.go b/c/os/generated_native_darwin_arm64_llgo_test.go new file mode 100644 index 00000000..1ca8cbb8 --- /dev/null +++ b/c/os/generated_native_darwin_arm64_llgo_test.go @@ -0,0 +1,30 @@ +//go:build llgo && darwin && arm64 && !ios + +package os + +import ( + "testing" + "unsafe" +) + +func TestGeneratedMachMessageHeaderLayout(t *testing.T) { + var header MachMsgHeaderT + if unsafe.Sizeof(header) != 24 || unsafe.Alignof(header) != 4 { + t.Fatalf("mach_msg_header_t = %d/%d, want 24/4", unsafe.Sizeof(header), unsafe.Alignof(header)) + } +} +func TestGeneratedUUIDOutputBuffer(t *testing.T) { + var value UuidT + for i := range value { + value[i] = 0xa5 + } + UuidClear(&value[0]) + for i, b := range value { + if b != 0 { + t.Fatalf("uuid_clear left byte %d = %d", i, b) + } + } + if result := UuidIsNull(&value[0]); result == 0 { + t.Fatal("cleared uuid is not nil") + } +} diff --git a/c/os/generated_native_llgo_test.go b/c/os/generated_native_llgo_test.go new file mode 100644 index 00000000..84986448 --- /dev/null +++ b/c/os/generated_native_llgo_test.go @@ -0,0 +1,42 @@ +//go:build llgo && ((darwin && arm64 && !ios) || (linux && (amd64 || arm64) && !android)) + +package os + +import ( + "github.com/goplus/lib/c" + "testing" + "unsafe" +) + +func TestGeneratedPipeIO(t *testing.T) { + var pair [2]c.Int + if result := NativePipe(&pair[0]); result != 0 { + t.Fatalf("pipe = %d", result) + } + defer func() { + for _, fd := range pair { + if result := NativeClose(fd); result != 0 { + t.Errorf("close = %d", result) + } + } + }() + input := [6]byte{0, 1, 127, 128, 254, 255} + var output [6]byte + for offset := 0; offset < len(input); { + n := NativeWrite(pair[1], unsafe.Pointer(&input[offset]), c.SizeT(len(input)-offset)) + if n <= 0 { + t.Fatalf("write = %d", n) + } + offset += int(n) + } + for offset := 0; offset < len(output); { + n := NativeRead(pair[0], unsafe.Pointer(&output[offset]), c.SizeT(len(output)-offset)) + if n <= 0 { + t.Fatalf("read = %d", n) + } + offset += int(n) + } + if output != input { + t.Fatalf("pipe data = %v, want %v", output, input) + } +} diff --git a/c/os/libc_darwin_arm64.go b/c/os/libc_darwin_arm64.go index b73023c7..844d6dea 100644 --- a/c/os/libc_darwin_arm64.go +++ b/c/os/libc_darwin_arm64.go @@ -31,6 +31,25 @@ const ( type X_telldir struct { } +// llgo:type C +type llcppgCallback38 = func(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int + +// llgo:type C +type llcppgCallback39 = func(_llcppg_param1 *Dirent) c.Int + +// llgo:link (*DIR).NativeClosedir C.closedir +func (self *DIR) NativeClosedir() c.Int { + return 0 +} + +//go:linkname NativeOpendir C.opendir +func NativeOpendir(_llcppg_param1 *c.Char) *DIR + +// llgo:link (*DIR).NativeReaddir C.readdir +func (self *DIR) NativeReaddir() *Dirent { + return nil +} + // llgo:link (*DIR).ReaddirR C.readdir_r func (self *DIR) ReaddirR(_llcppg_param2 *Dirent, _llcppg_param3 **Dirent) c.Int { return 0 @@ -49,6 +68,9 @@ func (self *DIR) Telldir() c.Long { return 0 } +//go:linkname NativeFdopendir C.fdopendir +func NativeFdopendir(_llcppg_param1 c.Int) *DIR + //go:linkname Alphasort C.alphasort func Alphasort(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int @@ -58,7 +80,13 @@ func (self *DIR) Dirfd() c.Int { } //go:linkname Scandir C.scandir -func Scandir(_llcppg_param1 *c.Char, _llcppg_param2 ***Dirent, _llcppg_param3 func(_llcppg_param1 *Dirent) c.Int, _llcppg_param4 func(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int) c.Int +func Scandir(_llcppg_param1 *c.Char, _llcppg_param2 ***Dirent, _llcppg_param3 llcppgCallback39, _llcppg_param4 llcppgCallback38) c.Int + +//go:linkname Getdirentries C.getdirentries_is_not_available_when_64_bit_inodes_are_in_effect +func Getdirentries(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.Int, _llcppg_param4 *c.Long) c.Int + +//go:linkname X__Opendir2 C.__opendir2 +func X__Opendir2(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) *DIR const ( RTLD_LAZY = 1 @@ -100,6 +128,9 @@ func Dlsym(__handle unsafe.Pointer, __symbol *c.Char) unsafe.Pointer //go:linkname DlopenPreflight C.dlopen_preflight func DlopenPreflight(__path *c.Char) bool +//go:linkname Gethostuuid C.gethostuuid +func Gethostuuid(_llcppg_param1 *uint8, _llcppg_param2 *lltime.Timespec) c.Int + // Believed to have been introduced in 1003.2-1992 const ( GLOB_APPEND = 1 @@ -157,34 +188,37 @@ type GlobT struct { GlOffs c.SizeT GlFlags c.Int GlPathv **c.Char - GlErrfunc llcppgCallback14 - GlClosedir llcppgCallback13 - GlReaddir llcppgCallback12 - GlOpendir llcppgCallback11 - GlLstat llcppgCallback10 - GlStat llcppgCallback9 + GlErrfunc llcppgCallback37 + GlClosedir llcppgCallback36 + GlReaddir llcppgCallback35 + GlOpendir llcppgCallback34 + GlLstat llcppgCallback33 + GlStat llcppgCallback32 } // llgo:type C -type llcppgCallback9 = func(_llcppg_param1 *c.Char, _llcppg_param2 *StatT) c.Int +type llcppgCallback32 = func(_llcppg_param1 *c.Char, _llcppg_param2 *StatT) c.Int + +// llgo:type C +type llcppgCallback33 = func(_llcppg_param1 *c.Char, _llcppg_param2 *StatT) c.Int // llgo:type C -type llcppgCallback10 = func(_llcppg_param1 *c.Char, _llcppg_param2 *StatT) c.Int +type llcppgCallback34 = func(_llcppg_param1 *c.Char) unsafe.Pointer // llgo:type C -type llcppgCallback11 = func(_llcppg_param1 *c.Char) unsafe.Pointer +type llcppgCallback35 = func(_llcppg_param1 unsafe.Pointer) *Dirent // llgo:type C -type llcppgCallback12 = func(_llcppg_param1 unsafe.Pointer) *Dirent +type llcppgCallback36 = func(_llcppg_param1 unsafe.Pointer) // llgo:type C -type llcppgCallback13 = func(_llcppg_param1 unsafe.Pointer) +type llcppgCallback37 = func(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int // llgo:type C -type llcppgCallback14 = func(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int +type llcppgCallback31 = func(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int //go:linkname Glob C.glob -func Glob(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 func(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int, _llcppg_param4 *GlobT) c.Int +func Glob(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 llcppgCallback31, _llcppg_param4 *GlobT) c.Int // llgo:link (*GlobT).Globfree C.globfree func (self *GlobT) Globfree() { @@ -232,16 +266,72 @@ func Endgrent() func GroupFromGid(_llcppg_param1 c.Uint, _llcppg_param2 c.Int) *c.Char //go:linkname Getgruuid C.getgruuid -func Getgruuid(_llcppg_param1 UuidT) *Group +func Getgruuid(_llcppg_param1 *uint8) *Group //go:linkname GetgruuidR C.getgruuid_r -func GetgruuidR(_llcppg_param1 UuidT, _llcppg_param2 *Group, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT, _llcppg_param5 **Group) c.Int +func GetgruuidR(_llcppg_param1 *uint8, _llcppg_param2 *Group, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT, _llcppg_param5 **Group) c.Int + +//go:linkname Setgrfile C.setgrfile +func Setgrfile(_llcppg_param1 *c.Char) //go:linkname Setgroupent C.setgroupent func Setgroupent(_llcppg_param1 c.Int) c.Int type SemaphoreT = MachPortT +type MachMsgHeaderT struct { + MsghBits c.Uint + MsghSize c.Uint + MsghRemotePort MachPortT + MsghLocalPort MachPortT + MsghVoucherPort c.Uint + MsghId c.Int +} + +// Routine: mach_msg_overwrite +// Purpose: +// Send and/or receive a message. If the message operation +// is interrupted, and the user did not request an indication +// of that fact, then restart the appropriate parts of the +// operation silently (trap version does not restart). +// +// Distinct send and receive buffers may be specified. If +// no separate receive buffer is specified, the msg parameter +// will be used for both send and receive operations. +// +// In addition to a distinct receive buffer, that buffer may +// already contain scatter control information to direct the +// receiving of the message. +// +// llgo:link (*MachMsgHeaderT).MachMsgOverwrite C.mach_msg_overwrite +func (self *MachMsgHeaderT) MachMsgOverwrite(option c.Int, send_size c.Uint, rcv_size c.Uint, rcv_name c.Uint, timeout c.Uint, notify c.Uint, rcv_msg *MachMsgHeaderT, rcv_limit c.Uint) c.Int { + return 0 +} + +// Routine: mach_msg +// Purpose: +// Send and/or receive a message. If the message operation +// is interrupted, and the user did not request an indication +// of that fact, then restart the appropriate parts of the +// operation silently (trap version does not restart). +// +// llgo:link (*MachMsgHeaderT).MachMsg C.mach_msg +func (self *MachMsgHeaderT) MachMsg(option c.Int, send_size c.Uint, rcv_size c.Uint, rcv_name c.Uint, timeout c.Uint, notify c.Uint) c.Int { + return 0 +} + +// Routine: mach_voucher_deallocate +// Purpose: +// +// Deallocate a mach voucher created or received in a message. Drops +// one (send right) reference to the voucher. +// +//go:linkname MachVoucherDeallocate C.mach_voucher_deallocate +func MachVoucherDeallocate(voucher c.Uint) c.Int + +//go:linkname VmStats C.vm_stats +func VmStats(info unsafe.Pointer, count *c.Uint) c.Int + type SchedParam struct { SchedPriority c.Int X__Opaque [4]c.Char @@ -297,10 +387,10 @@ func Setpassent(_llcppg_param1 c.Int) c.Int func UserFromUid(_llcppg_param1 c.Uint, _llcppg_param2 c.Int) *c.Char //go:linkname Getpwuuid C.getpwuuid -func Getpwuuid(_llcppg_param1 UuidT) *Passwd +func Getpwuuid(_llcppg_param1 *uint8) *Passwd //go:linkname GetpwuuidR C.getpwuuid_r -func GetpwuuidR(_llcppg_param1 UuidT, _llcppg_param2 *Passwd, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT, _llcppg_param5 **Passwd) c.Int +func GetpwuuidR(_llcppg_param1 *uint8, _llcppg_param2 *Passwd, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT, _llcppg_param5 **Passwd) c.Int // flags for CPU Security Mitigation attribute // POSIX_SPAWN_NP_CSM_ALL should be used in most cases, @@ -462,6 +552,20 @@ func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddfchdirNp(_llcppg_par return 0 } +//go:linkname NativeSelect C.select +func NativeSelect(_llcppg_param1 c.Int, _llcppg_param2 *llsys.FdSet, _llcppg_param3 *llsys.FdSet, _llcppg_param4 *llsys.FdSet, _llcppg_param5 *llsys.Timeval) c.Int + +//go:linkname X__DarwinCheckFdSetOverflow C.__darwin_check_fd_set_overflow +func X__DarwinCheckFdSetOverflow(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 c.Int) c.Int + +//go:linkname X__DarwinCheckFdSet C._llcppg___darwin_check_fd_set +func X__DarwinCheckFdSet(_a c.Int, _b unsafe.Pointer) c.Int + +// This inline avoids argument side-effect issues with FD_ISSET() +// +//go:linkname X__DarwinFdIsset C._llcppg___darwin_fd_isset +func X__DarwinFdIsset(_fd c.Int, _p *llsys.FdSet) c.Int + type X_filesec struct { } @@ -473,6 +577,8 @@ type UuidT = X__DarwinUuidT type X__DarwinUuidT = [16]uint8 +type X__DarwinUuidStringT = [37]c.Char + // File types const MAXNAMLEN = 255 @@ -489,6 +595,9 @@ const ( DT_WHT = 14 ) +//go:linkname X__Error C.__error +func X__Error() *c.Int + const ( FREAD = 1 FWRITE = 2 @@ -984,6 +1093,18 @@ type FspecreadT = Fspecread type FattributiontagT = Fattributiontag +//go:linkname NativeOpen C.open +func NativeOpen(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, __llgo_va_list ...any) c.Int + +//go:linkname NativeOpenat C.openat +func NativeOpenat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.Int, __llgo_va_list ...any) c.Int + +//go:linkname NativeCreat C.creat +func NativeCreat(_llcppg_param1 *c.Char, _llcppg_param2 c.Uint16T) c.Int + +//go:linkname NativeFcntl C.fcntl +func NativeFcntl(_llcppg_param1 c.Int, _llcppg_param2 c.Int, __llgo_va_list ...any) c.Int + // data-protected non-portable open(2) : // // int open_dprotected_np(user_addr_t path, int flags, int class, int dpflags, int mode) @@ -1271,6 +1392,95 @@ func Mincore(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_para //go:linkname Minherit C.minherit func Minherit(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.SizeT, _llcppg_param3 c.Int) c.Int +// Requestable events. If poll(2) finds any of these set, they are +// copied to revents on return. +const ( + POLLIN = 1 + // OOB/Urgent readable data + POLLPRI = 2 + // file descriptor is writeable + POLLOUT = 4 + // non-OOB/URG data available + POLLRDNORM = 64 + // no write type differentiation + POLLWRNORM = 4 + // OOB/Urgent readable data + POLLRDBAND = 128 + // OOB/Urgent data can be written + POLLWRBAND = 256 +) + +// FreeBSD extensions: polling on a regular file might return one +// of these events (currently only supported on local filesystems). +const ( + POLLEXTEND = 512 + // file attributes may have changed + POLLATTRIB = 1024 + // (un)link/rename may have happened + POLLNLINK = 2048 + // file's contents may have changed + POLLWRITE = 4096 +) + +// These events are set if they occur regardless of whether they were +// requested. +const ( + POLLERR = 8 + // file descriptor was "hung up" + POLLHUP = 16 + // requested events "invalid" + POLLNVAL = 32 +) + +const POLLSTANDARD = 511 + +type Pollfd struct { + Fd c.Int + Events int16 + Revents int16 +} + +// This is defined here (instead of ) because this is where +// traditional SVR4 code will look to find it. +// +// llgo:link (*Pollfd).Poll C.poll +func (self *Pollfd) Poll(_llcppg_param2 c.Uint, _llcppg_param3 c.Int) c.Int { + return 0 +} + +// ! +// @function qos_class_self +// +// @abstract +// Returns the requested QOS class of the current thread. +// +// @return +// One of the QOS class values in qos_class_t. +// +//go:linkname QosClassSelf C.qos_class_self +func QosClassSelf() c.Uint + +// ! +// @function qos_class_main +// +// @abstract +// Returns the initial requested QOS class of the main thread. +// +// @discussion +// The QOS class that the main thread of a process is created with depends on +// the type of process (e.g. application or daemon) and on how it has been +// launched. +// +// This function returns that initial requested QOS class value chosen by the +// system to enable propagation of that classification to matching work not +// executing on the main thread. +// +// @return +// One of the QOS class values in qos_class_t. +// +//go:linkname QosClassMain C.qos_class_main +func QosClassMain() c.Uint + // Possible values of the first parameter to getpriority()/setpriority(), // used to indicate the type of the second parameter. const ( @@ -1736,6 +1946,9 @@ func Getpriority(_llcppg_param1 c.Int, _llcppg_param2 c.Uint) c.Int //go:linkname GetiopolicyNp C.getiopolicy_np func GetiopolicyNp(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int +//go:linkname NativeGetrlimit C.getrlimit +func NativeGetrlimit(_llcppg_param1 c.Int, _llcppg_param2 *Rlimit) c.Int + //go:linkname Getrusage C.getrusage func Getrusage(_llcppg_param1 c.Int, _llcppg_param2 *Rusage) c.Int @@ -1745,6 +1958,9 @@ func Setpriority(_llcppg_param1 c.Int, _llcppg_param2 c.Uint, _llcppg_param3 c.I //go:linkname SetiopolicyNp C.setiopolicy_np func SetiopolicyNp(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.Int) c.Int +//go:linkname NativeSetrlimit C.setrlimit +func NativeSetrlimit(_llcppg_param1 c.Int, _llcppg_param2 *Rlimit) c.Int + // 0777 const ACCESSPERMS = 511 @@ -1860,6 +2076,41 @@ type Ostat struct { StGen c.Uint } +// [XSI] +// +//go:linkname NativeChmod C.chmod +func NativeChmod(_llcppg_param1 *c.Char, _llcppg_param2 c.Uint16T) c.Int + +//go:linkname NativeFchmod C.fchmod +func NativeFchmod(_llcppg_param1 c.Int, _llcppg_param2 c.Uint16T) c.Int + +//go:linkname NativeFstat C.fstat +func NativeFstat(_llcppg_param1 c.Int, _llcppg_param2 *StatT) c.Int + +//go:linkname NativeLstat C.lstat +func NativeLstat(_llcppg_param1 *c.Char, _llcppg_param2 *StatT) c.Int + +//go:linkname NativeMkdir C.mkdir +func NativeMkdir(_llcppg_param1 *c.Char, _llcppg_param2 c.Uint16T) c.Int + +//go:linkname NativeMkfifo C.mkfifo +func NativeMkfifo(_llcppg_param1 *c.Char, _llcppg_param2 c.Uint16T) c.Int + +//go:linkname NativeStat C.stat +func NativeStat(_llcppg_param1 *c.Char, _llcppg_param2 *StatT) c.Int + +//go:linkname NativeMknod C.mknod +func NativeMknod(_llcppg_param1 *c.Char, _llcppg_param2 c.Uint16T, _llcppg_param3 c.Int) c.Int + +//go:linkname NativeUmask C.umask +func NativeUmask(_llcppg_param1 c.Uint16T) c.Uint16T + +//go:linkname NativeFchmodat C.fchmodat +func NativeFchmodat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.Uint16T, _llcppg_param4 c.Int) c.Int + +//go:linkname NativeFstatat C.fstatat +func NativeFstatat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 *StatT, _llcppg_param4 c.Int) c.Int + //go:linkname Mkdirat C.mkdirat func Mkdirat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.Uint16T) c.Int @@ -2373,12 +2624,64 @@ func Preadv(_llcppg_param1 c.Int, _llcppg_param2 *c.Iovec, _llcppg_param3 c.Int, //go:linkname Pwritev C.pwritev func Pwritev(_llcppg_param1 c.Int, _llcppg_param2 *c.Iovec, _llcppg_param3 c.Int, _llcppg_param4 c.LongLong) c.SsizeT +// access function +const ( + F_OK = 0 + // test for execute or search permission + // test for write permission + W_OK = 2 + // test for read permission + R_OK = 4 +) + +// whence values for lseek(2); renamed by POSIX 1003.1 +const ( + L_SET = 0 + L_INCR = 1 + L_XTND = 2 +) + +const ( + ACCESSX_MAX_DESCRIPTORS = 100 + ACCESSX_MAX_TABLESIZE = 16384 +) + type AccessxDescriptor struct { AdNameOffset c.Uint AdFlags c.Int AdPad [2]c.Int } +//go:linkname Getattrlistbulk C.getattrlistbulk +func Getattrlistbulk(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.SizeT, _llcppg_param5 c.UlongLong) c.Int + +//go:linkname Getattrlistat C.getattrlistat +func Getattrlistat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 unsafe.Pointer, _llcppg_param4 unsafe.Pointer, _llcppg_param5 c.SizeT, _llcppg_param6 c.Ulong) c.Int + +//go:linkname Setattrlistat C.setattrlistat +func Setattrlistat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 unsafe.Pointer, _llcppg_param4 unsafe.Pointer, _llcppg_param5 c.SizeT, _llcppg_param6 c.Uint) c.Int + +//go:linkname Freadlink C.freadlink +func Freadlink(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.SizeT) c.SsizeT + +//go:linkname NativeFaccessat C.faccessat +func NativeFaccessat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.Int, _llcppg_param4 c.Int) c.Int + +//go:linkname NativeFchownat C.fchownat +func NativeFchownat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.Uint, _llcppg_param4 c.Uint, _llcppg_param5 c.Int) c.Int + +//go:linkname Linkat C.linkat +func Linkat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.Int, _llcppg_param4 *c.Char, _llcppg_param5 c.Int) c.Int + +//go:linkname Readlinkat C.readlinkat +func Readlinkat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 *c.Char, _llcppg_param4 c.SizeT) c.SsizeT + +//go:linkname Symlinkat C.symlinkat +func Symlinkat(_llcppg_param1 *c.Char, _llcppg_param2 c.Int, _llcppg_param3 *c.Char) c.Int + +//go:linkname NativeUnlinkat C.unlinkat +func NativeUnlinkat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.Int) c.Int + type Utsname struct { Sysname [256]c.Char Nodename [256]c.Char @@ -2437,11 +2740,23 @@ const ( P_PGID IdtypeT = 2 ) +//go:linkname NativeWait C.wait +func NativeWait(_llcppg_param1 *c.Int) c.Int + +//go:linkname NativeWaitpid C.waitpid +func NativeWaitpid(_llcppg_param1 c.Int, _llcppg_param2 *c.Int, _llcppg_param3 c.Int) c.Int + // llgo:link IdtypeT.Waitid C.waitid func (self IdtypeT) Waitid(_llcppg_param2 c.Uint, _llcppg_param3 *llsignal.SiginfoT, _llcppg_param4 c.Int) c.Int { return 0 } +//go:linkname NativeWait3 C.wait3 +func NativeWait3(_llcppg_param1 *c.Int, _llcppg_param2 c.Int, _llcppg_param3 *Rusage) c.Int + +//go:linkname NativeWait4 C.wait4 +func NativeWait4(_llcppg_param1 c.Int, _llcppg_param2 *c.Int, _llcppg_param3 c.Int, _llcppg_param4 *Rusage) c.Int + //go:linkname Tcgetsid C.tcgetsid func Tcgetsid(_llcppg_param1 c.Int) c.Int @@ -2487,9 +2802,57 @@ func Access(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int //go:linkname Alarm C.alarm func Alarm(_llcppg_param1 c.Uint) c.Uint +//go:linkname NativeChdir C.chdir +func NativeChdir(_llcppg_param1 *c.Char) c.Int + +//go:linkname NativeChown C.chown +func NativeChown(_llcppg_param1 *c.Char, _llcppg_param2 c.Uint, _llcppg_param3 c.Uint) c.Int + +//go:linkname NativeClose C.close +func NativeClose(_llcppg_param1 c.Int) c.Int + +//go:linkname NativeDup C.dup +func NativeDup(_llcppg_param1 c.Int) c.Int + +//go:linkname NativeDup2 C.dup2 +func NativeDup2(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int + +//go:linkname NativeExecl C.execl +func NativeExecl(__path *c.Char, __arg0 *c.Char, __llgo_va_list ...any) c.Int + +//go:linkname NativeExecle C.execle +func NativeExecle(__path *c.Char, __arg0 *c.Char, __llgo_va_list ...any) c.Int + +//go:linkname NativeExeclp C.execlp +func NativeExeclp(__file *c.Char, __arg0 *c.Char, __llgo_va_list ...any) c.Int + +//go:linkname NativeExecv C.execv +func NativeExecv(__path *c.Char, __argv **c.Char) c.Int + +//go:linkname NativeExecve C.execve +func NativeExecve(__file *c.Char, __argv **c.Char, __envp **c.Char) c.Int + +//go:linkname NativeExecvp C.execvp +func NativeExecvp(__file *c.Char, __argv **c.Char) c.Int + +//go:linkname NativeFork C.fork +func NativeFork() c.Int + //go:linkname Fpathconf C.fpathconf func Fpathconf(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Long +//go:linkname NativeGetcwd C.getcwd +func NativeGetcwd(_llcppg_param1 *c.Char, _llcppg_param2 c.SizeT) *c.Char + +//go:linkname NativeGetegid C.getegid +func NativeGetegid() c.Uint + +//go:linkname NativeGeteuid C.geteuid +func NativeGeteuid() c.Uint + +//go:linkname NativeGetgid C.getgid +func NativeGetgid() c.Uint + //go:linkname Getgroups C.getgroups func Getgroups(_llcppg_param1 c.Int, _llcppg_param2 *c.Uint) c.Int @@ -2499,12 +2862,39 @@ func Getlogin() *c.Char //go:linkname Getpgrp C.getpgrp func Getpgrp() c.Int +//go:linkname NativeGetpid C.getpid +func NativeGetpid() c.Int + +//go:linkname NativeGetppid C.getppid +func NativeGetppid() c.Int + +//go:linkname NativeGetuid C.getuid +func NativeGetuid() c.Uint + +//go:linkname NativeIsatty C.isatty +func NativeIsatty(_llcppg_param1 c.Int) c.Int + +//go:linkname NativeLink C.link +func NativeLink(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char) c.Int + +//go:linkname NativeLseek C.lseek +func NativeLseek(_llcppg_param1 c.Int, _llcppg_param2 c.LongLong, _llcppg_param3 c.Int) c.LongLong + //go:linkname Pathconf C.pathconf func Pathconf(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Long //go:linkname Pause C.pause func Pause() c.Int +//go:linkname NativePipe C.pipe +func NativePipe(_llcppg_param1 *c.Int) c.Int + +//go:linkname NativeRead C.read +func NativeRead(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 c.SizeT) c.SsizeT + +//go:linkname NativeRmdir C.rmdir +func NativeRmdir(_llcppg_param1 *c.Char) c.Int + //go:linkname Setgid C.setgid func Setgid(_llcppg_param1 c.Uint) c.Int @@ -2535,9 +2925,18 @@ func Ttyname(_llcppg_param1 c.Int) *c.Char //go:linkname TtynameR C.ttyname_r func TtynameR(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.SizeT) c.Int +//go:linkname NativeUnlink C.unlink +func NativeUnlink(_llcppg_param1 *c.Char) c.Int + +//go:linkname NativeWrite C.write +func NativeWrite(__fd c.Int, __buf unsafe.Pointer, __nbyte c.SizeT) c.SsizeT + //go:linkname Confstr C.confstr func Confstr(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.SizeT) c.SizeT +//go:linkname NativeGetopt C.getopt +func NativeGetopt(_llcppg_param1 c.Int, _llcppg_param2 **c.Char, _llcppg_param3 *c.Char) c.Int + // getopt(3) external variables // //go:linkname Optarg C.optarg @@ -2555,12 +2954,18 @@ var Optopt c.Int //go:linkname Brk C.brk func Brk(_llcppg_param1 unsafe.Pointer) unsafe.Pointer +//go:linkname NativeChroot C.chroot +func NativeChroot(_llcppg_param1 *c.Char) c.Int + //go:linkname Crypt C.crypt func Crypt(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char) *c.Char //go:linkname Encrypt C.encrypt func Encrypt(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) +//go:linkname NativeFchdir C.fchdir +func NativeFchdir(_llcppg_param1 c.Int) c.Int + //go:linkname Gethostid C.gethostid func Gethostid() c.Long @@ -2584,6 +2989,9 @@ func Getpass(_llcppg_param1 *c.Char) *c.Char //go:linkname Getwd C.getwd func Getwd(_llcppg_param1 *c.Char) *c.Char +//go:linkname NativeLchown C.lchown +func NativeLchown(_llcppg_param1 *c.Char, _llcppg_param2 c.Uint, _llcppg_param3 c.Uint) c.Int + //go:linkname Lockf C.lockf func Lockf(_llcppg_param1 c.Int, _llcppg_param2 c.Int, _llcppg_param3 c.LongLong) c.Int @@ -2611,26 +3019,47 @@ func Setreuid(_llcppg_param1 c.Uint, _llcppg_param2 c.Uint) c.Int //go:linkname Sync C.sync func Sync() +//go:linkname NativeTruncate C.truncate +func NativeTruncate(_llcppg_param1 *c.Char, _llcppg_param2 c.LongLong) c.Int + //go:linkname Ualarm C.ualarm func Ualarm(_llcppg_param1 c.Uint, _llcppg_param2 c.Uint) c.Uint +//go:linkname NativeUsleep C.usleep +func NativeUsleep(_llcppg_param1 c.Uint) c.Int + // End XSI // //go:linkname Vfork C.vfork func Vfork() c.Int +//go:linkname NativeFsync C.fsync +func NativeFsync(_llcppg_param1 c.Int) c.Int + +//go:linkname NativeFtruncate C.ftruncate +func NativeFtruncate(_llcppg_param1 c.Int, _llcppg_param2 c.LongLong) c.Int + //go:linkname GetloginR C.getlogin_r func GetloginR(_llcppg_param1 *c.Char, _llcppg_param2 c.SizeT) c.Int +//go:linkname NativeFchown C.fchown +func NativeFchown(_llcppg_param1 c.Int, _llcppg_param2 c.Uint, _llcppg_param3 c.Uint) c.Int + //go:linkname Gethostname C.gethostname func Gethostname(_llcppg_param1 *c.Char, _llcppg_param2 c.SizeT) c.Int +//go:linkname NativeReadlink C.readlink +func NativeReadlink(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char, _llcppg_param3 c.SizeT) c.SsizeT + //go:linkname Setegid C.setegid func Setegid(_llcppg_param1 c.Uint) c.Int //go:linkname Seteuid C.seteuid func Seteuid(_llcppg_param1 c.Uint) c.Int +//go:linkname NativeSymlink C.symlink +func NativeSymlink(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char) c.Int + // llgo:link (*AccessxDescriptor).AccessxNp C.accessx_np func (self *AccessxDescriptor) AccessxNp(_llcppg_param2 c.SizeT, _llcppg_param3 *c.Int, _llcppg_param4 c.Uint) c.Int { return 0 @@ -2639,6 +3068,9 @@ func (self *AccessxDescriptor) AccessxNp(_llcppg_param2 c.SizeT, _llcppg_param3 //go:linkname Acct C.acct func Acct(_llcppg_param1 *c.Char) c.Int +//go:linkname AddProfil C.add_profil +func AddProfil(_llcppg_param1 *c.Char, _llcppg_param2 c.SizeT, _llcppg_param3 c.Ulong, _llcppg_param4 c.Uint) c.Int + //go:linkname Endusershell C.endusershell func Endusershell() @@ -2661,13 +3093,13 @@ func Getmode(_llcppg_param1 unsafe.Pointer, _llcppg_param2 c.Uint16T) c.Uint16T func Getpeereid(_llcppg_param1 c.Int, _llcppg_param2 *c.Uint, _llcppg_param3 *c.Uint) c.Int //go:linkname GetsgroupsNp C.getsgroups_np -func GetsgroupsNp(_llcppg_param1 *c.Int, _llcppg_param2 UuidT) c.Int +func GetsgroupsNp(_llcppg_param1 *c.Int, _llcppg_param2 *uint8) c.Int //go:linkname Getusershell C.getusershell func Getusershell() *c.Char //go:linkname GetwgroupsNp C.getwgroups_np -func GetwgroupsNp(_llcppg_param1 *c.Int, _llcppg_param2 UuidT) c.Int +func GetwgroupsNp(_llcppg_param1 *c.Int, _llcppg_param2 *uint8) c.Int //go:linkname Initgroups C.initgroups func Initgroups(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int @@ -2714,6 +3146,9 @@ func MkostempsatNp(dfd c.Int, path *c.Char, slen c.Int, oflags c.Int) c.Int //go:linkname Nfssvc C.nfssvc func Nfssvc(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer) c.Int +//go:linkname Profil C.profil +func Profil(_llcppg_param1 *c.Char, _llcppg_param2 c.SizeT, _llcppg_param3 c.Ulong, _llcppg_param4 c.Uint) c.Int + //go:linkname Reboot C.reboot func Reboot(_llcppg_param1 c.Int) c.Int @@ -2766,13 +3201,13 @@ func Setrgid(_llcppg_param1 c.Uint) c.Int func Setruid(_llcppg_param1 c.Uint) c.Int //go:linkname SetsgroupsNp C.setsgroups_np -func SetsgroupsNp(_llcppg_param1 c.Int, _llcppg_param2 UuidT) c.Int +func SetsgroupsNp(_llcppg_param1 c.Int, _llcppg_param2 *uint8) c.Int //go:linkname Setusershell C.setusershell func Setusershell() //go:linkname SetwgroupsNp C.setwgroups_np -func SetwgroupsNp(_llcppg_param1 c.Int, _llcppg_param2 UuidT) c.Int +func SetwgroupsNp(_llcppg_param1 c.Int, _llcppg_param2 *uint8) c.Int //go:linkname Strtofflags C.strtofflags func Strtofflags(_llcppg_param1 **c.Char, _llcppg_param2 *c.Ulong, _llcppg_param3 *c.Ulong) c.Int @@ -2786,6 +3221,12 @@ func Ttyslot() c.Int //go:linkname Undelete C.undelete func Undelete(_llcppg_param1 *c.Char) c.Int +//go:linkname Unwhiteout C.unwhiteout +func Unwhiteout(_llcppg_param1 *c.Char) c.Int + +//go:linkname NativeSyscall C.syscall +func NativeSyscall(_llcppg_param1 c.Int, __llgo_va_list ...any) c.Int + //go:linkname Fgetattrlist C.fgetattrlist func Fgetattrlist(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.SizeT, _llcppg_param5 c.Uint) c.Int @@ -2829,3 +3270,40 @@ type Utimbuf struct { //go:linkname Utime C.utime func Utime(_llcppg_param1 *c.Char, _llcppg_param2 *Utimbuf) c.Int + +type UuidStringT = X__DarwinUuidStringT + +//go:linkname UuidClear C.uuid_clear +func UuidClear(uu *uint8) + +//go:linkname UuidCompare C.uuid_compare +func UuidCompare(uu1 *uint8, uu2 *uint8) c.Int + +//go:linkname UuidCopy C.uuid_copy +func UuidCopy(dst *uint8, src *uint8) + +//go:linkname UuidGenerate C.uuid_generate +func UuidGenerate(out *uint8) + +//go:linkname UuidGenerateRandom C.uuid_generate_random +func UuidGenerateRandom(out *uint8) + +//go:linkname UuidGenerateTime C.uuid_generate_time +func UuidGenerateTime(out *uint8) + +//go:linkname UuidIsNull C.uuid_is_null +func UuidIsNull(uu *uint8) c.Int + +//go:linkname UuidParse C.uuid_parse +func UuidParse(in *c.Char, uu *uint8) c.Int + +//go:linkname UuidUnparse C.uuid_unparse +func UuidUnparse(uu *uint8, out *c.Char) + +//go:linkname UuidUnparseLower C.uuid_unparse_lower +func UuidUnparseLower(uu *uint8, out *c.Char) + +//go:linkname UuidUnparseUpper C.uuid_unparse_upper +func UuidUnparseUpper(uu *uint8, out *c.Char) + +const LLGoFiles = "$LIBC_CC_FLAGS: _os/os.c; _libc_darwin_arm64.c" diff --git a/c/os/libc_linux_amd64.go b/c/os/libc_linux_amd64.go index ad353a54..7588f469 100644 --- a/c/os/libc_linux_amd64.go +++ b/c/os/libc_linux_amd64.go @@ -21,6 +21,11 @@ type FlockT struct { LPid c.Int } +type Rlimit struct { + RlimCur c.Ulong + RlimMax c.Ulong +} + // The purpose of all the unions is to have the kernel-compatible layout // while keeping the API type as 'long int', and among machines where // __syscall_slong_t is not 'long int', this only does the right thing @@ -28,7 +33,6 @@ type FlockT struct { type Rusage struct { RuUtime llsys.Timeval RuStime llsys.Timeval - _llcppg_anon_9 _llcppg_anon_10 _llcppg_anon_11 _llcppg_anon_12 @@ -42,10 +46,7 @@ type Rusage struct { _llcppg_anon_20 _llcppg_anon_21 _llcppg_anon_22 -} - -type _llcppg_anon_9 struct { - _xgo_union [1]uint64 + _llcppg_anon_23 } type _llcppg_anon_10 struct { @@ -100,115 +101,119 @@ type _llcppg_anon_22 struct { _xgo_union [1]uint64 } -func (p *_llcppg_anon_9) XGof_ref_ru_maxrss() *c.Long { +type _llcppg_anon_23 struct { + _xgo_union [1]uint64 +} + +func (p *_llcppg_anon_10) XGof_ref_ru_maxrss() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_9) XGof_ref___ru_maxrss_word() *c.Long { +func (p *_llcppg_anon_10) XGof_ref___ru_maxrss_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_10) XGof_ref_ru_ixrss() *c.Long { +func (p *_llcppg_anon_11) XGof_ref_ru_ixrss() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_10) XGof_ref___ru_ixrss_word() *c.Long { +func (p *_llcppg_anon_11) XGof_ref___ru_ixrss_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_11) XGof_ref_ru_idrss() *c.Long { +func (p *_llcppg_anon_12) XGof_ref_ru_idrss() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_11) XGof_ref___ru_idrss_word() *c.Long { +func (p *_llcppg_anon_12) XGof_ref___ru_idrss_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_12) XGof_ref_ru_isrss() *c.Long { +func (p *_llcppg_anon_13) XGof_ref_ru_isrss() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_12) XGof_ref___ru_isrss_word() *c.Long { +func (p *_llcppg_anon_13) XGof_ref___ru_isrss_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_13) XGof_ref_ru_minflt() *c.Long { +func (p *_llcppg_anon_14) XGof_ref_ru_minflt() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_13) XGof_ref___ru_minflt_word() *c.Long { +func (p *_llcppg_anon_14) XGof_ref___ru_minflt_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_14) XGof_ref_ru_majflt() *c.Long { +func (p *_llcppg_anon_15) XGof_ref_ru_majflt() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_14) XGof_ref___ru_majflt_word() *c.Long { +func (p *_llcppg_anon_15) XGof_ref___ru_majflt_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_15) XGof_ref_ru_nswap() *c.Long { +func (p *_llcppg_anon_16) XGof_ref_ru_nswap() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_15) XGof_ref___ru_nswap_word() *c.Long { +func (p *_llcppg_anon_16) XGof_ref___ru_nswap_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_16) XGof_ref_ru_inblock() *c.Long { +func (p *_llcppg_anon_17) XGof_ref_ru_inblock() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_16) XGof_ref___ru_inblock_word() *c.Long { +func (p *_llcppg_anon_17) XGof_ref___ru_inblock_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_17) XGof_ref_ru_oublock() *c.Long { +func (p *_llcppg_anon_18) XGof_ref_ru_oublock() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_17) XGof_ref___ru_oublock_word() *c.Long { +func (p *_llcppg_anon_18) XGof_ref___ru_oublock_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_18) XGof_ref_ru_msgsnd() *c.Long { +func (p *_llcppg_anon_19) XGof_ref_ru_msgsnd() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_18) XGof_ref___ru_msgsnd_word() *c.Long { +func (p *_llcppg_anon_19) XGof_ref___ru_msgsnd_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_19) XGof_ref_ru_msgrcv() *c.Long { +func (p *_llcppg_anon_20) XGof_ref_ru_msgrcv() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_19) XGof_ref___ru_msgrcv_word() *c.Long { +func (p *_llcppg_anon_20) XGof_ref___ru_msgrcv_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_20) XGof_ref_ru_nsignals() *c.Long { +func (p *_llcppg_anon_21) XGof_ref_ru_nsignals() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_20) XGof_ref___ru_nsignals_word() *c.Long { +func (p *_llcppg_anon_21) XGof_ref___ru_nsignals_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_21) XGof_ref_ru_nvcsw() *c.Long { +func (p *_llcppg_anon_22) XGof_ref_ru_nvcsw() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_21) XGof_ref___ru_nvcsw_word() *c.Long { +func (p *_llcppg_anon_22) XGof_ref___ru_nvcsw_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_22) XGof_ref_ru_nivcsw() *c.Long { +func (p *_llcppg_anon_23) XGof_ref_ru_nivcsw() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_22) XGof_ref___ru_nivcsw_word() *c.Long { +func (p *_llcppg_anon_23) XGof_ref___ru_nivcsw_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } @@ -267,6 +272,45 @@ const ( type X__Dirstream struct { } +// llgo:type C +type llcppgCallback20 = func(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int + +// llgo:type C +type llcppgCallback21 = func(_llcppg_param1 *Dirent) c.Int + +// Open a directory stream on NAME. +// Return a DIR stream on the directory, or NULL if it could not be opened. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname NativeOpendir C.opendir +func NativeOpendir(__name *c.Char) *DIR + +// Same as opendir, but open the stream on the file descriptor FD. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname NativeFdopendir C.fdopendir +func NativeFdopendir(__fd c.Int) *DIR + +// Close the directory stream DIRP. +// Return 0 if successful, -1 if not. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +// llgo:link (*DIR).NativeClosedir C.closedir +func (self *DIR) NativeClosedir() c.Int { + return 0 +} + +// llgo:link (*DIR).NativeReaddir C.readdir +func (self *DIR) NativeReaddir() *Dirent { + return nil +} + // llgo:link (*DIR).ReaddirR C.readdir_r func (self *DIR) ReaddirR(__entry *Dirent, __result **Dirent) c.Int { return 0 @@ -299,7 +343,7 @@ func (self *DIR) Dirfd() c.Int { } //go:linkname Scandir C.scandir -func Scandir(__dir *c.Char, __namelist ***Dirent, __selector func(_llcppg_param1 *Dirent) c.Int, __cmp func(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int) c.Int +func Scandir(__dir *c.Char, __namelist ***Dirent, __selector llcppgCallback21, __cmp llcppgCallback20) c.Int //go:linkname Alphasort C.alphasort func Alphasort(__e1 **Dirent, __e2 **Dirent) c.Int @@ -443,6 +487,24 @@ const ( F_TEST = 3 ) +// Do the file control operation described by CMD on FD. +// The remaining arguments are interpreted depending on CMD. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeFcntl C.fcntl +func NativeFcntl(__fd c.Int, __cmd c.Int, __llgo_va_list ...any) c.Int + +//go:linkname NativeOpen C.open +func NativeOpen(__file *c.Char, __oflag c.Int, __llgo_va_list ...any) c.Int + +//go:linkname NativeOpenat C.openat +func NativeOpenat(__fd c.Int, __file *c.Char, __oflag c.Int, __llgo_va_list ...any) c.Int + +//go:linkname NativeCreat C.creat +func NativeCreat(__file *c.Char, __mode c.Uint) c.Int + //go:linkname Lockf C.lockf func Lockf(__fd c.Int, __cmd c.Int, __len c.Long) c.Int @@ -501,34 +563,37 @@ const ( ) type GlobT struct { - GlPathc c.Ulong + GlPathc c.SizeT GlPathv **c.Char - GlOffs c.Ulong + GlOffs c.SizeT GlFlags c.Int - GlClosedir llcppgCallback9 - GlReaddir llcppgCallback8 - GlOpendir llcppgCallback7 - GlLstat llcppgCallback6 - GlStat llcppgCallback5 + GlClosedir llcppgCallback19 + GlReaddir llcppgCallback18 + GlOpendir llcppgCallback17 + GlLstat llcppgCallback16 + GlStat llcppgCallback15 } // llgo:type C -type llcppgCallback5 = func(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer) c.Int +type llcppgCallback15 = func(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer) c.Int + +// llgo:type C +type llcppgCallback16 = func(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer) c.Int // llgo:type C -type llcppgCallback6 = func(_llcppg_param1 *c.Char, _llcppg_param2 unsafe.Pointer) c.Int +type llcppgCallback17 = func(_llcppg_param1 *c.Char) unsafe.Pointer // llgo:type C -type llcppgCallback7 = func(_llcppg_param1 *c.Char) unsafe.Pointer +type llcppgCallback18 = func(_llcppg_param1 unsafe.Pointer) unsafe.Pointer // llgo:type C -type llcppgCallback8 = func(_llcppg_param1 unsafe.Pointer) unsafe.Pointer +type llcppgCallback19 = func(_llcppg_param1 unsafe.Pointer) // llgo:type C -type llcppgCallback9 = func(_llcppg_param1 unsafe.Pointer) +type llcppgCallback14 = func(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int //go:linkname Glob C.glob -func Glob(__pattern *c.Char, __flags c.Int, __errfunc func(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) c.Int, __pglob *GlobT) c.Int +func Glob(__pattern *c.Char, __flags c.Int, __errfunc llcppgCallback14, __pglob *GlobT) c.Int // Free storage allocated in PGLOB by a previous `glob' call. // @@ -1080,6 +1145,33 @@ func ShmOpen(__name *c.Char, __oflag c.Int, __mode c.Uint) c.Int //go:linkname ShmUnlink C.shm_unlink func ShmUnlink(__name *c.Char) c.Int +// Data structure describing a polling request. +type Pollfd struct { + Fd c.Int + Events int16 + Revents int16 +} + +// Poll the file descriptors described by the NFDS structures starting at +// FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for +// an event to occur; if TIMEOUT is -1, block until an event occurs. +// Returns the number of file descriptors with events, zero if timed out, +// or -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +// llgo:link (*Pollfd).Poll C.poll +func (self *Pollfd) Poll(__nfds c.Ulong, __timeout c.Int) c.Int { + return 0 +} + +//go:linkname NativeGetrlimit C.getrlimit +func NativeGetrlimit(__resource c.Int, __rlimits *Rlimit) c.Int + +//go:linkname NativeSetrlimit C.setrlimit +func NativeSetrlimit(__resource c.Int, __rlimits *Rlimit) c.Int + // Return resource usage information on process indicated by WHO // and put it in *USAGE. Returns 0 for success, -1 for failure. // @@ -1118,6 +1210,32 @@ const ( // Block size for `st_blocks'. const S_BLKSIZE = 512 +// Get file attributes for FILE and put them in BUF. +// +//go:linkname NativeStat C.stat +func NativeStat(__file *c.Char, __buf *StatT) c.Int + +// Get file attributes for the file, device, pipe, or socket +// that file descriptor FD is open on and put them in BUF. +// +//go:linkname NativeFstat C.fstat +func NativeFstat(__fd c.Int, __buf *StatT) c.Int + +//go:linkname NativeFstatat C.fstatat +func NativeFstatat(__fd c.Int, __file *c.Char, __buf *StatT, __flag c.Int) c.Int + +// Get file attributes about FILE and put them in BUF. +// If FILE is a symbolic link, do not follow it. +// +//go:linkname NativeLstat C.lstat +func NativeLstat(__file *c.Char, __buf *StatT) c.Int + +// Set file access permissions for FILE to MODE. +// If FILE is a symbolic link, this affects its target instead. +// +//go:linkname NativeChmod C.chmod +func NativeChmod(__file *c.Char, __mode c.Uint) c.Int + // Set file access permissions for FILE to MODE. // If FILE is a symbolic link, this affects the link itself // rather than its target. @@ -1125,6 +1243,26 @@ const S_BLKSIZE = 512 //go:linkname Lchmod C.lchmod func Lchmod(__file *c.Char, __mode c.Uint) c.Int +//go:linkname NativeFchmod C.fchmod +func NativeFchmod(__fd c.Int, __mode c.Uint) c.Int + +// Set file access permissions of FILE relative to +// the directory FD is open on. +// +//go:linkname NativeFchmodat C.fchmodat +func NativeFchmodat(__fd c.Int, __file *c.Char, __mode c.Uint, __flag c.Int) c.Int + +// Set the file creation mask of the current process to MASK, +// and return the old creation mask. +// +//go:linkname NativeUmask C.umask +func NativeUmask(__mask c.Uint) c.Uint + +// Create a new directory named PATH, with permission bits MODE. +// +//go:linkname NativeMkdir C.mkdir +func NativeMkdir(__path *c.Char, __mode c.Uint) c.Int + // Like mkdir, create a new directory with permission bits MODE. But // interpret relative PATH names relative to the directory associated // with FD. @@ -1132,6 +1270,9 @@ func Lchmod(__file *c.Char, __mode c.Uint) c.Int //go:linkname Mkdirat C.mkdirat func Mkdirat(__fd c.Int, __path *c.Char, __mode c.Uint) c.Int +//go:linkname NativeMknod C.mknod +func NativeMknod(__path *c.Char, __mode c.Uint, __dev c.Ulong) c.Int + // Like mknod, create a new device file with permission bits MODE and // device number DEV. But interpret relative PATH names relative to // the directory associated with FD. @@ -1139,6 +1280,11 @@ func Mkdirat(__fd c.Int, __path *c.Char, __mode c.Uint) c.Int //go:linkname Mknodat C.mknodat func Mknodat(__fd c.Int, __path *c.Char, __mode c.Uint, __dev c.Ulong) c.Int +// Create a new FIFO named PATH, with permission bits MODE. +// +//go:linkname NativeMkfifo C.mkfifo +func NativeMkfifo(__path *c.Char, __mode c.Uint) c.Int + // Like mkfifo, create a new FIFO with permission bits MODE. But // interpret relative PATH names relative to the directory associated // with FD. @@ -1157,12 +1303,39 @@ func Utimensat(__fd c.Int, __path *c.Char, __times *lltime.Timespec, __flags c.I //go:linkname Futimens C.futimens func Futimens(__fd c.Int, __times *lltime.Timespec) c.Int +//go:linkname X__Fxstat C.__fxstat +func X__Fxstat(__ver c.Int, __fildes c.Int, __stat_buf *StatT) c.Int + +//go:linkname X__Xstat C.__xstat +func X__Xstat(__ver c.Int, __filename *c.Char, __stat_buf *StatT) c.Int + +//go:linkname X__Lxstat C.__lxstat +func X__Lxstat(__ver c.Int, __filename *c.Char, __stat_buf *StatT) c.Int + +//go:linkname X__Fxstatat C.__fxstatat +func X__Fxstatat(__ver c.Int, __fildes c.Int, __filename *c.Char, __stat_buf *StatT, __flag c.Int) c.Int + +//go:linkname X__Xmknod C.__xmknod +func X__Xmknod(__ver c.Int, __path *c.Char, __mode c.Uint, __dev *c.Ulong) c.Int + +//go:linkname X__Xmknodat C.__xmknodat +func X__Xmknodat(__ver c.Int, __fd c.Int, __path *c.Char, __mode c.Uint, __dev *c.Ulong) c.Int + //go:linkname Statvfs C.statvfs func Statvfs(__file *c.Char, __buf *StatvfsT) c.Int //go:linkname Fstatvfs C.fstatvfs func Fstatvfs(__fildes c.Int, __buf *StatvfsT) c.Int +//go:linkname GnuDevMajor C.gnu_dev_major +func GnuDevMajor(__dev c.UlongLong) c.Uint + +//go:linkname GnuDevMinor C.gnu_dev_minor +func GnuDevMinor(__dev c.UlongLong) c.Uint + +//go:linkname GnuDevMakedev C.gnu_dev_makedev +func GnuDevMakedev(__major c.Uint, __minor c.Uint) c.UlongLong + // Structure describing CPU time used by a process and its children. type Tms struct { TmsUtime lltime.ClockT @@ -1273,6 +1446,34 @@ const ( P_PGID IdtypeT = 2 ) +// NativeWait for a child to die. When one does, put its status in *STAT_LOC +// and return its process ID. For errors, return (pid_t) -1. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeWait C.wait +func NativeWait(__stat_loc *c.Int) c.Int + +// Wait for a child matching PID to die. +// If PID is greater than 0, match any process whose process ID is PID. +// If PID is (pid_t) -1, match any process. +// If PID is (pid_t) 0, match any process with the +// same process group as the current process. +// If PID is less than -1, match any process whose +// process group is the absolute value of PID. +// If the WNOHANG bit is set in OPTIONS, and that child +// is not already dead, return (pid_t) 0. If successful, +// return PID and store the dead child's status in STAT_LOC. +// Return (pid_t) -1 for errors. If the WUNTRACED bit is +// set in OPTIONS, return status for stopped children; otherwise don't. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeWaitpid C.waitpid +func NativeWaitpid(__pid c.Int, __stat_loc *c.Int, __options c.Int) c.Int + // Wait for a childing matching IDTYPE and ID to change the status and // place appropriate information in *INFOP. // If IDTYPE is P_PID, match any process whose process ID is ID. @@ -1290,6 +1491,20 @@ func (self IdtypeT) Waitid(__id c.Uint, __infop *llsignal.SiginfoT, __options c. return 0 } +// Wait for a child to exit. When one does, put its status in *STAT_LOC and +// return its process ID. For errors return (pid_t) -1. If USAGE is not +// nil, store information about the child's resource usage there. If the +// WUNTRACED bit is set in OPTIONS, return status for stopped children; +// otherwise don't. +// +//go:linkname NativeWait3 C.wait3 +func NativeWait3(__stat_loc *c.Int, __options c.Int, __usage *Rusage) c.Int + +// PID is like waitpid. Other args are like wait3. +// +//go:linkname NativeWait4 C.wait4 +func NativeWait4(__pid c.Int, __stat_loc *c.Int, __options c.Int, __usage *Rusage) c.Int + // Return the output baud rate stored in *TERMIOS_P. // // llgo:link (*Termios).Cfgetospeed C.cfgetospeed @@ -1386,6 +1601,41 @@ const ( //go:linkname Access C.access func Access(__name *c.Char, __type c.Int) c.Int +// Test for access to FILE relative to the directory FD is open on. +// If AT_EACCESS is set in FLAG, then use effective IDs like `eaccess', +// otherwise use real IDs like `access'. +// +//go:linkname NativeFaccessat C.faccessat +func NativeFaccessat(__fd c.Int, __file *c.Char, __type c.Int, __flag c.Int) c.Int + +//go:linkname NativeLseek C.lseek +func NativeLseek(__fd c.Int, __offset c.Long, __whence c.Int) c.Long + +// NativeClose the file descriptor FD. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeClose C.close +func NativeClose(__fd c.Int) c.Int + +// NativeRead NBYTES into BUF from FD. Return the +// number read, -1 for errors or 0 for EOF. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeRead C.read +func NativeRead(__fd c.Int, __buf unsafe.Pointer, __nbytes c.SizeT) c.SsizeT + +// NativeWrite N bytes of BUF to FD. Return the number written, or -1. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeWrite C.write +func NativeWrite(__fd c.Int, __buf unsafe.Pointer, __n c.SizeT) c.SsizeT + // Read NBYTES into BUF from FD at the given position OFFSET without // changing the file pointer. Return the number read, -1 for errors // or 0 for EOF. @@ -1405,6 +1655,14 @@ func Pread(__fd c.Int, __buf unsafe.Pointer, __nbytes c.SizeT, __offset c.Long) //go:linkname Pwrite C.pwrite func Pwrite(__fd c.Int, __buf unsafe.Pointer, __n c.SizeT, __offset c.Long) c.SsizeT +// Create a one-way communication channel (pipe). +// If successful, two file descriptors are stored in PIPEDES; +// bytes written on PIPEDES[1] can be read from PIPEDES[0]. +// Returns 0 if successful, -1 if not. +// +//go:linkname NativePipe C.pipe +func NativePipe(__pipedes *c.Int) c.Int + // Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. // If SECONDS is zero, any currently scheduled alarm will be cancelled. // The function returns the number of seconds remaining until the last @@ -1438,6 +1696,15 @@ func Sleep(__seconds c.Uint) c.Uint //go:linkname Ualarm C.ualarm func Ualarm(__value c.Uint, __interval c.Uint) c.Uint +// Sleep USECONDS microseconds, or until a signal arrives that is not blocked +// or ignored. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeUsleep C.usleep +func NativeUsleep(__useconds c.Uint) c.Int + // Suspend the process until a signal arrives. // This always returns -1 and sets `errno' to EINTR. // @@ -1447,6 +1714,49 @@ func Ualarm(__value c.Uint, __interval c.Uint) c.Uint //go:linkname Pause C.pause func Pause() c.Int +// Change the owner and group of FILE. +// +//go:linkname NativeChown C.chown +func NativeChown(__file *c.Char, __owner c.Uint, __group c.Uint) c.Int + +// Change the owner and group of the file that FD is open on. +// +//go:linkname NativeFchown C.fchown +func NativeFchown(__fd c.Int, __owner c.Uint, __group c.Uint) c.Int + +// Change owner and group of FILE, if it is a symbolic +// link the ownership of the symbolic link is changed. +// +//go:linkname NativeLchown C.lchown +func NativeLchown(__file *c.Char, __owner c.Uint, __group c.Uint) c.Int + +// Change the owner and group of FILE relative to the directory FD is open +// on. +// +//go:linkname NativeFchownat C.fchownat +func NativeFchownat(__fd c.Int, __file *c.Char, __owner c.Uint, __group c.Uint, __flag c.Int) c.Int + +// Change the process's working directory to PATH. +// +//go:linkname NativeChdir C.chdir +func NativeChdir(__path *c.Char) c.Int + +// Change the process's working directory to the one FD is open on. +// +//go:linkname NativeFchdir C.fchdir +func NativeFchdir(__fd c.Int) c.Int + +// Get the pathname of the current working directory, +// and put it in SIZE bytes of BUF. Returns NULL if the +// directory couldn't be determined or SIZE was too small. +// If successful, returns BUF. In GNU, if BUF is NULL, +// an array is allocated with `malloc'; the array is SIZE +// bytes long, unless SIZE == 0, in which case it is as +// big as necessary. +// +//go:linkname NativeGetcwd C.getcwd +func NativeGetcwd(__buf *c.Char, __size c.SizeT) *c.Char + // Put the absolute pathname of the current working directory in BUF. // If successful, return BUF. If not, put an error message in // BUF and return NULL. BUF should be at least PATH_MAX bytes long. @@ -1454,12 +1764,58 @@ func Pause() c.Int //go:linkname Getwd C.getwd func Getwd(__buf *c.Char) *c.Char +// Duplicate FD, returning a new file descriptor on the same file. +// +//go:linkname NativeDup C.dup +func NativeDup(__fd c.Int) c.Int + +// Duplicate FD to FD2, closing FD2 and making it open on the same file. +// +//go:linkname NativeDup2 C.dup2 +func NativeDup2(__fd c.Int, __fd2 c.Int) c.Int + +// Replace the current process, executing PATH with arguments ARGV and +// environment ENVP. ARGV and ENVP are terminated by NULL pointers. +// +//go:linkname NativeExecve C.execve +func NativeExecve(__path *c.Char, __argv **c.Char, __envp **c.Char) c.Int + // Execute the file FD refers to, overlaying the running program image. // ARGV and ENVP are passed to the new program, as for `execve'. // //go:linkname Fexecve C.fexecve func Fexecve(__fd c.Int, __argv **c.Char, __envp **c.Char) c.Int +// Execute PATH with arguments ARGV and environment from `environ'. +// +//go:linkname NativeExecv C.execv +func NativeExecv(__path *c.Char, __argv **c.Char) c.Int + +// Execute PATH with all arguments after PATH until a NULL pointer, +// and the argument after that for environment. +// +//go:linkname NativeExecle C.execle +func NativeExecle(__path *c.Char, __arg *c.Char, __llgo_va_list ...any) c.Int + +// Execute PATH with all arguments after PATH until +// a NULL pointer and environment from `environ'. +// +//go:linkname NativeExecl C.execl +func NativeExecl(__path *c.Char, __arg *c.Char, __llgo_va_list ...any) c.Int + +// Execute FILE, searching in the `PATH' environment variable if it contains +// no slashes, with arguments ARGV and environment from `environ'. +// +//go:linkname NativeExecvp C.execvp +func NativeExecvp(__file *c.Char, __argv **c.Char) c.Int + +// Execute FILE, searching in the `PATH' environment variable if +// it contains no slashes, with all arguments after FILE until a +// NULL pointer and environment from `environ'. +// +//go:linkname NativeExeclp C.execlp +func NativeExeclp(__file *c.Char, __arg *c.Char, __llgo_va_list ...any) c.Int + // Add INC to priority of the current process. // //go:linkname Nice C.nice @@ -1490,11 +1846,26 @@ func Sysconf(__name c.Int) c.Long //go:linkname Confstr C.confstr func Confstr(__name c.Int, __buf *c.Char, __len c.SizeT) c.SizeT +// Get the process ID of the calling process. +// +//go:linkname NativeGetpid C.getpid +func NativeGetpid() c.Int + +// Get the process ID of the calling process's parent. +// +//go:linkname NativeGetppid C.getppid +func NativeGetppid() c.Int + // Get the process group ID of the calling process. // //go:linkname Getpgrp C.getpgrp func Getpgrp() c.Int +// Get the process group ID of process PID. +// +//go:linkname X__Getpgid C.__getpgid +func X__Getpgid(__pid c.Int) c.Int + //go:linkname Getpgid C.getpgid func Getpgid(__pid c.Int) c.Int @@ -1523,6 +1894,26 @@ func Setsid() c.Int //go:linkname Getsid C.getsid func Getsid(__pid c.Int) c.Int +// Get the real user ID of the calling process. +// +//go:linkname NativeGetuid C.getuid +func NativeGetuid() c.Uint + +// Get the effective user ID of the calling process. +// +//go:linkname NativeGeteuid C.geteuid +func NativeGeteuid() c.Uint + +// Get the real group ID of the calling process. +// +//go:linkname NativeGetgid C.getgid +func NativeGetgid() c.Uint + +// Get the effective group ID of the calling process. +// +//go:linkname NativeGetegid C.getegid +func NativeGetegid() c.Uint + // If SIZE is zero, return the number of supplementary groups // the calling process is in. Otherwise, fill in the group IDs // of its supplementary groups in LIST and return the number written. @@ -1568,6 +1959,13 @@ func Setregid(__rgid c.Uint, __egid c.Uint) c.Int //go:linkname Setegid C.setegid func Setegid(__gid c.Uint) c.Int +// Clone the calling process, creating an exact copy. +// Return -1 for errors, 0 to the new process, +// and the process ID of the new process to the old process. +// +//go:linkname NativeFork C.fork +func NativeFork() c.Int + // Clone the calling process, but without copying the whole address space. // The calling process is suspended until the new process exits or is // replaced by a call to `execve'. Return -1 for errors, 0 to the new process, @@ -1588,18 +1986,41 @@ func Ttyname(__fd c.Int) *c.Char //go:linkname TtynameR C.ttyname_r func TtynameR(__fd c.Int, __buf *c.Char, __buflen c.SizeT) c.Int +// Return 1 if FD is a valid descriptor associated +// with a terminal, zero if not. +// +//go:linkname NativeIsatty C.isatty +func NativeIsatty(__fd c.Int) c.Int + // Return the index into the active-logins file (utmp) for // the controlling terminal. // //go:linkname Ttyslot C.ttyslot func Ttyslot() c.Int +// Make a link to FROM named TO. +// +//go:linkname NativeLink C.link +func NativeLink(__from *c.Char, __to *c.Char) c.Int + // Like link but relative paths in TO and FROM are interpreted relative // to FROMFD and TOFD respectively. // //go:linkname Linkat C.linkat func Linkat(__fromfd c.Int, __from *c.Char, __tofd c.Int, __to *c.Char, __flags c.Int) c.Int +// Make a symbolic link to FROM named TO. +// +//go:linkname NativeSymlink C.symlink +func NativeSymlink(__from *c.Char, __to *c.Char) c.Int + +// Read the contents of the symbolic link PATH into no more than +// LEN bytes of BUF. The contents are not null-terminated. +// Returns the number of characters read, or -1 for errors. +// +//go:linkname NativeReadlink C.readlink +func NativeReadlink(__path *c.Char, __buf *c.Char, __len c.SizeT) c.SsizeT + // Like symlink but a relative path in TO is interpreted relative to TOFD. // //go:linkname Symlinkat C.symlinkat @@ -1610,6 +2031,21 @@ func Symlinkat(__from *c.Char, __tofd c.Int, __to *c.Char) c.Int //go:linkname Readlinkat C.readlinkat func Readlinkat(__fd c.Int, __path *c.Char, __buf *c.Char, __len c.SizeT) c.SsizeT +// Remove the link NAME. +// +//go:linkname NativeUnlink C.unlink +func NativeUnlink(__name *c.Char) c.Int + +// Remove the link NAME relative to FD. +// +//go:linkname NativeUnlinkat C.unlinkat +func NativeUnlinkat(__fd c.Int, __name *c.Char, __flag c.Int) c.Int + +// Remove the directory PATH. +// +//go:linkname NativeRmdir C.rmdir +func NativeRmdir(__path *c.Char) c.Int + // Return the foreground process group ID of FD. // //go:linkname Tcgetpgrp C.tcgetpgrp @@ -1724,12 +2160,26 @@ func Setusershell() //go:linkname Daemon C.daemon func Daemon(__nochdir c.Int, __noclose c.Int) c.Int +// Make PATH be the root directory (the starting point for absolute paths). +// This call is restricted to the super-user. +// +//go:linkname NativeChroot C.chroot +func NativeChroot(__path *c.Char) c.Int + // Prompt with PROMPT and read a string from the terminal without echoing. // Uses /dev/tty if possible; otherwise stderr and stdin. // //go:linkname Getpass C.getpass func Getpass(__prompt *c.Char) *c.Char +// Make all changes done to FD actually appear on disk. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeFsync C.fsync +func NativeFsync(__fd c.Int) c.Int + // Return identifier for the current host. // //go:linkname Gethostid C.gethostid @@ -1752,6 +2202,16 @@ func Getpagesize() c.Int //go:linkname Getdtablesize C.getdtablesize func Getdtablesize() c.Int +// Ignore +// +//go:linkname NativeTruncate C.truncate +func NativeTruncate(__file *c.Char, __length c.Long) c.Int + +// Ignore +// +//go:linkname NativeFtruncate C.ftruncate +func NativeFtruncate(__fd c.Int, __length c.Long) c.Int + // Set the end of accessible data space (aka "the break") to ADDR. // Returns zero on success and -1 for errors (with errno set). // @@ -1766,6 +2226,20 @@ func Brk(__addr unsafe.Pointer) c.Int //go:linkname Sbrk C.sbrk func Sbrk(__delta c.IntptrT) unsafe.Pointer +// Invoke `system call' number SYSNO, passing it the remaining arguments. +// This is completely system-dependent, and not often useful. +// +// In Unix, `syscall' sets `errno' for all errors and most calls return -1 +// for errors; in many systems you cannot pass arguments or get return +// values for all system calls (`pipe', `fork', and `getppid' typically +// among them). +// +// In Mach, all system calls take normal arguments and always return an +// error code (zero for success). +// +//go:linkname NativeSyscall C.syscall +func NativeSyscall(__sysno c.Long, __llgo_va_list ...any) c.Long + // Synchronize at least the data part of a file with the underlying // media. // diff --git a/c/os/libc_linux_arm64.go b/c/os/libc_linux_arm64.go index f79c1d04..9be9889e 100644 --- a/c/os/libc_linux_arm64.go +++ b/c/os/libc_linux_arm64.go @@ -21,6 +21,11 @@ type FlockT struct { LPid c.Int } +type Rlimit struct { + RlimCur c.Ulong + RlimMax c.Ulong +} + // The purpose of all the unions is to have the kernel-compatible layout // while keeping the API type as 'long int', and among machines where // __syscall_slong_t is not 'long int', this only does the right thing @@ -28,7 +33,6 @@ type FlockT struct { type Rusage struct { RuUtime llsys.Timeval RuStime llsys.Timeval - _llcppg_anon_8 _llcppg_anon_9 _llcppg_anon_10 _llcppg_anon_11 @@ -42,10 +46,7 @@ type Rusage struct { _llcppg_anon_19 _llcppg_anon_20 _llcppg_anon_21 -} - -type _llcppg_anon_8 struct { - _xgo_union [1]uint64 + _llcppg_anon_22 } type _llcppg_anon_9 struct { @@ -100,115 +101,119 @@ type _llcppg_anon_21 struct { _xgo_union [1]uint64 } -func (p *_llcppg_anon_8) XGof_ref_ru_maxrss() *c.Long { +type _llcppg_anon_22 struct { + _xgo_union [1]uint64 +} + +func (p *_llcppg_anon_9) XGof_ref_ru_maxrss() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_8) XGof_ref___ru_maxrss_word() *c.Long { +func (p *_llcppg_anon_9) XGof_ref___ru_maxrss_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_9) XGof_ref_ru_ixrss() *c.Long { +func (p *_llcppg_anon_10) XGof_ref_ru_ixrss() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_9) XGof_ref___ru_ixrss_word() *c.Long { +func (p *_llcppg_anon_10) XGof_ref___ru_ixrss_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_10) XGof_ref_ru_idrss() *c.Long { +func (p *_llcppg_anon_11) XGof_ref_ru_idrss() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_10) XGof_ref___ru_idrss_word() *c.Long { +func (p *_llcppg_anon_11) XGof_ref___ru_idrss_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_11) XGof_ref_ru_isrss() *c.Long { +func (p *_llcppg_anon_12) XGof_ref_ru_isrss() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_11) XGof_ref___ru_isrss_word() *c.Long { +func (p *_llcppg_anon_12) XGof_ref___ru_isrss_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_12) XGof_ref_ru_minflt() *c.Long { +func (p *_llcppg_anon_13) XGof_ref_ru_minflt() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_12) XGof_ref___ru_minflt_word() *c.Long { +func (p *_llcppg_anon_13) XGof_ref___ru_minflt_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_13) XGof_ref_ru_majflt() *c.Long { +func (p *_llcppg_anon_14) XGof_ref_ru_majflt() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_13) XGof_ref___ru_majflt_word() *c.Long { +func (p *_llcppg_anon_14) XGof_ref___ru_majflt_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_14) XGof_ref_ru_nswap() *c.Long { +func (p *_llcppg_anon_15) XGof_ref_ru_nswap() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_14) XGof_ref___ru_nswap_word() *c.Long { +func (p *_llcppg_anon_15) XGof_ref___ru_nswap_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_15) XGof_ref_ru_inblock() *c.Long { +func (p *_llcppg_anon_16) XGof_ref_ru_inblock() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_15) XGof_ref___ru_inblock_word() *c.Long { +func (p *_llcppg_anon_16) XGof_ref___ru_inblock_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_16) XGof_ref_ru_oublock() *c.Long { +func (p *_llcppg_anon_17) XGof_ref_ru_oublock() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_16) XGof_ref___ru_oublock_word() *c.Long { +func (p *_llcppg_anon_17) XGof_ref___ru_oublock_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_17) XGof_ref_ru_msgsnd() *c.Long { +func (p *_llcppg_anon_18) XGof_ref_ru_msgsnd() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_17) XGof_ref___ru_msgsnd_word() *c.Long { +func (p *_llcppg_anon_18) XGof_ref___ru_msgsnd_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_18) XGof_ref_ru_msgrcv() *c.Long { +func (p *_llcppg_anon_19) XGof_ref_ru_msgrcv() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_18) XGof_ref___ru_msgrcv_word() *c.Long { +func (p *_llcppg_anon_19) XGof_ref___ru_msgrcv_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_19) XGof_ref_ru_nsignals() *c.Long { +func (p *_llcppg_anon_20) XGof_ref_ru_nsignals() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_19) XGof_ref___ru_nsignals_word() *c.Long { +func (p *_llcppg_anon_20) XGof_ref___ru_nsignals_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_20) XGof_ref_ru_nvcsw() *c.Long { +func (p *_llcppg_anon_21) XGof_ref_ru_nvcsw() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_20) XGof_ref___ru_nvcsw_word() *c.Long { +func (p *_llcppg_anon_21) XGof_ref___ru_nvcsw_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_21) XGof_ref_ru_nivcsw() *c.Long { +func (p *_llcppg_anon_22) XGof_ref_ru_nivcsw() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } -func (p *_llcppg_anon_21) XGof_ref___ru_nivcsw_word() *c.Long { +func (p *_llcppg_anon_22) XGof_ref___ru_nivcsw_word() *c.Long { return (*c.Long)(unsafe.Pointer(p)) } @@ -267,6 +272,45 @@ const ( type X__Dirstream struct { } +// llgo:type C +type llcppgCallback20 = func(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int + +// llgo:type C +type llcppgCallback21 = func(_llcppg_param1 *Dirent) c.Int + +// Open a directory stream on NAME. +// Return a DIR stream on the directory, or NULL if it could not be opened. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname NativeOpendir C.opendir +func NativeOpendir(__name *uint8) *DIR + +// Same as opendir, but open the stream on the file descriptor FD. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +//go:linkname NativeFdopendir C.fdopendir +func NativeFdopendir(__fd c.Int) *DIR + +// Close the directory stream DIRP. +// Return 0 if successful, -1 if not. +// +// This function is a possible cancellation point and therefore not +// marked with __THROW. +// +// llgo:link (*DIR).NativeClosedir C.closedir +func (self *DIR) NativeClosedir() c.Int { + return 0 +} + +// llgo:link (*DIR).NativeReaddir C.readdir +func (self *DIR) NativeReaddir() *Dirent { + return nil +} + // llgo:link (*DIR).ReaddirR C.readdir_r func (self *DIR) ReaddirR(__entry *Dirent, __result **Dirent) c.Int { return 0 @@ -299,7 +343,7 @@ func (self *DIR) Dirfd() c.Int { } //go:linkname Scandir C.scandir -func Scandir(__dir *uint8, __namelist ***Dirent, __selector func(_llcppg_param1 *Dirent) c.Int, __cmp func(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c.Int) c.Int +func Scandir(__dir *uint8, __namelist ***Dirent, __selector llcppgCallback21, __cmp llcppgCallback20) c.Int //go:linkname Alphasort C.alphasort func Alphasort(__e1 **Dirent, __e2 **Dirent) c.Int @@ -443,6 +487,24 @@ const ( F_TEST = 3 ) +// Do the file control operation described by CMD on FD. +// The remaining arguments are interpreted depending on CMD. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeFcntl C.fcntl +func NativeFcntl(__fd c.Int, __cmd c.Int, __llgo_va_list ...any) c.Int + +//go:linkname NativeOpen C.open +func NativeOpen(__file *uint8, __oflag c.Int, __llgo_va_list ...any) c.Int + +//go:linkname NativeOpenat C.openat +func NativeOpenat(__fd c.Int, __file *uint8, __oflag c.Int, __llgo_va_list ...any) c.Int + +//go:linkname NativeCreat C.creat +func NativeCreat(__file *uint8, __mode c.Uint) c.Int + //go:linkname Lockf C.lockf func Lockf(__fd c.Int, __cmd c.Int, __len c.Long) c.Int @@ -501,34 +563,37 @@ const ( ) type GlobT struct { - GlPathc c.Ulong + GlPathc c.SizeT GlPathv **uint8 - GlOffs c.Ulong + GlOffs c.SizeT GlFlags c.Int - GlClosedir llcppgCallback9 - GlReaddir llcppgCallback8 - GlOpendir llcppgCallback7 - GlLstat llcppgCallback6 - GlStat llcppgCallback5 + GlClosedir llcppgCallback19 + GlReaddir llcppgCallback18 + GlOpendir llcppgCallback17 + GlLstat llcppgCallback16 + GlStat llcppgCallback15 } // llgo:type C -type llcppgCallback5 = func(_llcppg_param1 *uint8, _llcppg_param2 unsafe.Pointer) c.Int +type llcppgCallback15 = func(_llcppg_param1 *uint8, _llcppg_param2 unsafe.Pointer) c.Int + +// llgo:type C +type llcppgCallback16 = func(_llcppg_param1 *uint8, _llcppg_param2 unsafe.Pointer) c.Int // llgo:type C -type llcppgCallback6 = func(_llcppg_param1 *uint8, _llcppg_param2 unsafe.Pointer) c.Int +type llcppgCallback17 = func(_llcppg_param1 *uint8) unsafe.Pointer // llgo:type C -type llcppgCallback7 = func(_llcppg_param1 *uint8) unsafe.Pointer +type llcppgCallback18 = func(_llcppg_param1 unsafe.Pointer) unsafe.Pointer // llgo:type C -type llcppgCallback8 = func(_llcppg_param1 unsafe.Pointer) unsafe.Pointer +type llcppgCallback19 = func(_llcppg_param1 unsafe.Pointer) // llgo:type C -type llcppgCallback9 = func(_llcppg_param1 unsafe.Pointer) +type llcppgCallback14 = func(_llcppg_param1 *uint8, _llcppg_param2 c.Int) c.Int //go:linkname Glob C.glob -func Glob(__pattern *uint8, __flags c.Int, __errfunc func(_llcppg_param1 *uint8, _llcppg_param2 c.Int) c.Int, __pglob *GlobT) c.Int +func Glob(__pattern *uint8, __flags c.Int, __errfunc llcppgCallback14, __pglob *GlobT) c.Int // Free storage allocated in PGLOB by a previous `glob' call. // @@ -1080,6 +1145,33 @@ func ShmOpen(__name *uint8, __oflag c.Int, __mode c.Uint) c.Int //go:linkname ShmUnlink C.shm_unlink func ShmUnlink(__name *uint8) c.Int +// Data structure describing a polling request. +type Pollfd struct { + Fd c.Int + Events int16 + Revents int16 +} + +// Poll the file descriptors described by the NFDS structures starting at +// FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for +// an event to occur; if TIMEOUT is -1, block until an event occurs. +// Returns the number of file descriptors with events, zero if timed out, +// or -1 for errors. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +// llgo:link (*Pollfd).Poll C.poll +func (self *Pollfd) Poll(__nfds c.Ulong, __timeout c.Int) c.Int { + return 0 +} + +//go:linkname NativeGetrlimit C.getrlimit +func NativeGetrlimit(__resource c.Int, __rlimits *Rlimit) c.Int + +//go:linkname NativeSetrlimit C.setrlimit +func NativeSetrlimit(__resource c.Int, __rlimits *Rlimit) c.Int + // Return resource usage information on process indicated by WHO // and put it in *USAGE. Returns 0 for success, -1 for failure. // @@ -1118,6 +1210,32 @@ const ( // Block size for `st_blocks'. const S_BLKSIZE = 512 +// Get file attributes for FILE and put them in BUF. +// +//go:linkname NativeStat C.stat +func NativeStat(__file *uint8, __buf *StatT) c.Int + +// Get file attributes for the file, device, pipe, or socket +// that file descriptor FD is open on and put them in BUF. +// +//go:linkname NativeFstat C.fstat +func NativeFstat(__fd c.Int, __buf *StatT) c.Int + +//go:linkname NativeFstatat C.fstatat +func NativeFstatat(__fd c.Int, __file *uint8, __buf *StatT, __flag c.Int) c.Int + +// Get file attributes about FILE and put them in BUF. +// If FILE is a symbolic link, do not follow it. +// +//go:linkname NativeLstat C.lstat +func NativeLstat(__file *uint8, __buf *StatT) c.Int + +// Set file access permissions for FILE to MODE. +// If FILE is a symbolic link, this affects its target instead. +// +//go:linkname NativeChmod C.chmod +func NativeChmod(__file *uint8, __mode c.Uint) c.Int + // Set file access permissions for FILE to MODE. // If FILE is a symbolic link, this affects the link itself // rather than its target. @@ -1125,6 +1243,26 @@ const S_BLKSIZE = 512 //go:linkname Lchmod C.lchmod func Lchmod(__file *uint8, __mode c.Uint) c.Int +//go:linkname NativeFchmod C.fchmod +func NativeFchmod(__fd c.Int, __mode c.Uint) c.Int + +// Set file access permissions of FILE relative to +// the directory FD is open on. +// +//go:linkname NativeFchmodat C.fchmodat +func NativeFchmodat(__fd c.Int, __file *uint8, __mode c.Uint, __flag c.Int) c.Int + +// Set the file creation mask of the current process to MASK, +// and return the old creation mask. +// +//go:linkname NativeUmask C.umask +func NativeUmask(__mask c.Uint) c.Uint + +// Create a new directory named PATH, with permission bits MODE. +// +//go:linkname NativeMkdir C.mkdir +func NativeMkdir(__path *uint8, __mode c.Uint) c.Int + // Like mkdir, create a new directory with permission bits MODE. But // interpret relative PATH names relative to the directory associated // with FD. @@ -1132,6 +1270,9 @@ func Lchmod(__file *uint8, __mode c.Uint) c.Int //go:linkname Mkdirat C.mkdirat func Mkdirat(__fd c.Int, __path *uint8, __mode c.Uint) c.Int +//go:linkname NativeMknod C.mknod +func NativeMknod(__path *uint8, __mode c.Uint, __dev c.Ulong) c.Int + // Like mknod, create a new device file with permission bits MODE and // device number DEV. But interpret relative PATH names relative to // the directory associated with FD. @@ -1139,6 +1280,11 @@ func Mkdirat(__fd c.Int, __path *uint8, __mode c.Uint) c.Int //go:linkname Mknodat C.mknodat func Mknodat(__fd c.Int, __path *uint8, __mode c.Uint, __dev c.Ulong) c.Int +// Create a new FIFO named PATH, with permission bits MODE. +// +//go:linkname NativeMkfifo C.mkfifo +func NativeMkfifo(__path *uint8, __mode c.Uint) c.Int + // Like mkfifo, create a new FIFO with permission bits MODE. But // interpret relative PATH names relative to the directory associated // with FD. @@ -1157,12 +1303,39 @@ func Utimensat(__fd c.Int, __path *uint8, __times *lltime.Timespec, __flags c.In //go:linkname Futimens C.futimens func Futimens(__fd c.Int, __times *lltime.Timespec) c.Int +//go:linkname X__Fxstat C.__fxstat +func X__Fxstat(__ver c.Int, __fildes c.Int, __stat_buf *StatT) c.Int + +//go:linkname X__Xstat C.__xstat +func X__Xstat(__ver c.Int, __filename *uint8, __stat_buf *StatT) c.Int + +//go:linkname X__Lxstat C.__lxstat +func X__Lxstat(__ver c.Int, __filename *uint8, __stat_buf *StatT) c.Int + +//go:linkname X__Fxstatat C.__fxstatat +func X__Fxstatat(__ver c.Int, __fildes c.Int, __filename *uint8, __stat_buf *StatT, __flag c.Int) c.Int + +//go:linkname X__Xmknod C.__xmknod +func X__Xmknod(__ver c.Int, __path *uint8, __mode c.Uint, __dev *c.Ulong) c.Int + +//go:linkname X__Xmknodat C.__xmknodat +func X__Xmknodat(__ver c.Int, __fd c.Int, __path *uint8, __mode c.Uint, __dev *c.Ulong) c.Int + //go:linkname Statvfs C.statvfs func Statvfs(__file *uint8, __buf *StatvfsT) c.Int //go:linkname Fstatvfs C.fstatvfs func Fstatvfs(__fildes c.Int, __buf *StatvfsT) c.Int +//go:linkname GnuDevMajor C.gnu_dev_major +func GnuDevMajor(__dev c.UlongLong) c.Uint + +//go:linkname GnuDevMinor C.gnu_dev_minor +func GnuDevMinor(__dev c.UlongLong) c.Uint + +//go:linkname GnuDevMakedev C.gnu_dev_makedev +func GnuDevMakedev(__major c.Uint, __minor c.Uint) c.UlongLong + // Structure describing CPU time used by a process and its children. type Tms struct { TmsUtime lltime.ClockT @@ -1273,6 +1446,34 @@ const ( P_PGID IdtypeT = 2 ) +// NativeWait for a child to die. When one does, put its status in *STAT_LOC +// and return its process ID. For errors, return (pid_t) -1. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeWait C.wait +func NativeWait(__stat_loc *c.Int) c.Int + +// Wait for a child matching PID to die. +// If PID is greater than 0, match any process whose process ID is PID. +// If PID is (pid_t) -1, match any process. +// If PID is (pid_t) 0, match any process with the +// same process group as the current process. +// If PID is less than -1, match any process whose +// process group is the absolute value of PID. +// If the WNOHANG bit is set in OPTIONS, and that child +// is not already dead, return (pid_t) 0. If successful, +// return PID and store the dead child's status in STAT_LOC. +// Return (pid_t) -1 for errors. If the WUNTRACED bit is +// set in OPTIONS, return status for stopped children; otherwise don't. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeWaitpid C.waitpid +func NativeWaitpid(__pid c.Int, __stat_loc *c.Int, __options c.Int) c.Int + // Wait for a childing matching IDTYPE and ID to change the status and // place appropriate information in *INFOP. // If IDTYPE is P_PID, match any process whose process ID is ID. @@ -1290,6 +1491,20 @@ func (self IdtypeT) Waitid(__id c.Uint, __infop *llsignal.SiginfoT, __options c. return 0 } +// Wait for a child to exit. When one does, put its status in *STAT_LOC and +// return its process ID. For errors return (pid_t) -1. If USAGE is not +// nil, store information about the child's resource usage there. If the +// WUNTRACED bit is set in OPTIONS, return status for stopped children; +// otherwise don't. +// +//go:linkname NativeWait3 C.wait3 +func NativeWait3(__stat_loc *c.Int, __options c.Int, __usage *Rusage) c.Int + +// PID is like waitpid. Other args are like wait3. +// +//go:linkname NativeWait4 C.wait4 +func NativeWait4(__pid c.Int, __stat_loc *c.Int, __options c.Int, __usage *Rusage) c.Int + // Return the output baud rate stored in *TERMIOS_P. // // llgo:link (*Termios).Cfgetospeed C.cfgetospeed @@ -1386,6 +1601,41 @@ const ( //go:linkname Access C.access func Access(__name *uint8, __type c.Int) c.Int +// Test for access to FILE relative to the directory FD is open on. +// If AT_EACCESS is set in FLAG, then use effective IDs like `eaccess', +// otherwise use real IDs like `access'. +// +//go:linkname NativeFaccessat C.faccessat +func NativeFaccessat(__fd c.Int, __file *uint8, __type c.Int, __flag c.Int) c.Int + +//go:linkname NativeLseek C.lseek +func NativeLseek(__fd c.Int, __offset c.Long, __whence c.Int) c.Long + +// NativeClose the file descriptor FD. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeClose C.close +func NativeClose(__fd c.Int) c.Int + +// NativeRead NBYTES into BUF from FD. Return the +// number read, -1 for errors or 0 for EOF. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeRead C.read +func NativeRead(__fd c.Int, __buf unsafe.Pointer, __nbytes c.SizeT) c.SsizeT + +// NativeWrite N bytes of BUF to FD. Return the number written, or -1. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeWrite C.write +func NativeWrite(__fd c.Int, __buf unsafe.Pointer, __n c.SizeT) c.SsizeT + // Read NBYTES into BUF from FD at the given position OFFSET without // changing the file pointer. Return the number read, -1 for errors // or 0 for EOF. @@ -1405,6 +1655,14 @@ func Pread(__fd c.Int, __buf unsafe.Pointer, __nbytes c.SizeT, __offset c.Long) //go:linkname Pwrite C.pwrite func Pwrite(__fd c.Int, __buf unsafe.Pointer, __n c.SizeT, __offset c.Long) c.SsizeT +// Create a one-way communication channel (pipe). +// If successful, two file descriptors are stored in PIPEDES; +// bytes written on PIPEDES[1] can be read from PIPEDES[0]. +// Returns 0 if successful, -1 if not. +// +//go:linkname NativePipe C.pipe +func NativePipe(__pipedes *c.Int) c.Int + // Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. // If SECONDS is zero, any currently scheduled alarm will be cancelled. // The function returns the number of seconds remaining until the last @@ -1438,6 +1696,15 @@ func Sleep(__seconds c.Uint) c.Uint //go:linkname Ualarm C.ualarm func Ualarm(__value c.Uint, __interval c.Uint) c.Uint +// Sleep USECONDS microseconds, or until a signal arrives that is not blocked +// or ignored. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeUsleep C.usleep +func NativeUsleep(__useconds c.Uint) c.Int + // Suspend the process until a signal arrives. // This always returns -1 and sets `errno' to EINTR. // @@ -1447,6 +1714,49 @@ func Ualarm(__value c.Uint, __interval c.Uint) c.Uint //go:linkname Pause C.pause func Pause() c.Int +// Change the owner and group of FILE. +// +//go:linkname NativeChown C.chown +func NativeChown(__file *uint8, __owner c.Uint, __group c.Uint) c.Int + +// Change the owner and group of the file that FD is open on. +// +//go:linkname NativeFchown C.fchown +func NativeFchown(__fd c.Int, __owner c.Uint, __group c.Uint) c.Int + +// Change owner and group of FILE, if it is a symbolic +// link the ownership of the symbolic link is changed. +// +//go:linkname NativeLchown C.lchown +func NativeLchown(__file *uint8, __owner c.Uint, __group c.Uint) c.Int + +// Change the owner and group of FILE relative to the directory FD is open +// on. +// +//go:linkname NativeFchownat C.fchownat +func NativeFchownat(__fd c.Int, __file *uint8, __owner c.Uint, __group c.Uint, __flag c.Int) c.Int + +// Change the process's working directory to PATH. +// +//go:linkname NativeChdir C.chdir +func NativeChdir(__path *uint8) c.Int + +// Change the process's working directory to the one FD is open on. +// +//go:linkname NativeFchdir C.fchdir +func NativeFchdir(__fd c.Int) c.Int + +// Get the pathname of the current working directory, +// and put it in SIZE bytes of BUF. Returns NULL if the +// directory couldn't be determined or SIZE was too small. +// If successful, returns BUF. In GNU, if BUF is NULL, +// an array is allocated with `malloc'; the array is SIZE +// bytes long, unless SIZE == 0, in which case it is as +// big as necessary. +// +//go:linkname NativeGetcwd C.getcwd +func NativeGetcwd(__buf *uint8, __size c.SizeT) *uint8 + // Put the absolute pathname of the current working directory in BUF. // If successful, return BUF. If not, put an error message in // BUF and return NULL. BUF should be at least PATH_MAX bytes long. @@ -1454,12 +1764,58 @@ func Pause() c.Int //go:linkname Getwd C.getwd func Getwd(__buf *uint8) *uint8 +// Duplicate FD, returning a new file descriptor on the same file. +// +//go:linkname NativeDup C.dup +func NativeDup(__fd c.Int) c.Int + +// Duplicate FD to FD2, closing FD2 and making it open on the same file. +// +//go:linkname NativeDup2 C.dup2 +func NativeDup2(__fd c.Int, __fd2 c.Int) c.Int + +// Replace the current process, executing PATH with arguments ARGV and +// environment ENVP. ARGV and ENVP are terminated by NULL pointers. +// +//go:linkname NativeExecve C.execve +func NativeExecve(__path *uint8, __argv **uint8, __envp **uint8) c.Int + // Execute the file FD refers to, overlaying the running program image. // ARGV and ENVP are passed to the new program, as for `execve'. // //go:linkname Fexecve C.fexecve func Fexecve(__fd c.Int, __argv **uint8, __envp **uint8) c.Int +// Execute PATH with arguments ARGV and environment from `environ'. +// +//go:linkname NativeExecv C.execv +func NativeExecv(__path *uint8, __argv **uint8) c.Int + +// Execute PATH with all arguments after PATH until a NULL pointer, +// and the argument after that for environment. +// +//go:linkname NativeExecle C.execle +func NativeExecle(__path *uint8, __arg *uint8, __llgo_va_list ...any) c.Int + +// Execute PATH with all arguments after PATH until +// a NULL pointer and environment from `environ'. +// +//go:linkname NativeExecl C.execl +func NativeExecl(__path *uint8, __arg *uint8, __llgo_va_list ...any) c.Int + +// Execute FILE, searching in the `PATH' environment variable if it contains +// no slashes, with arguments ARGV and environment from `environ'. +// +//go:linkname NativeExecvp C.execvp +func NativeExecvp(__file *uint8, __argv **uint8) c.Int + +// Execute FILE, searching in the `PATH' environment variable if +// it contains no slashes, with all arguments after FILE until a +// NULL pointer and environment from `environ'. +// +//go:linkname NativeExeclp C.execlp +func NativeExeclp(__file *uint8, __arg *uint8, __llgo_va_list ...any) c.Int + // Add INC to priority of the current process. // //go:linkname Nice C.nice @@ -1490,11 +1846,26 @@ func Sysconf(__name c.Int) c.Long //go:linkname Confstr C.confstr func Confstr(__name c.Int, __buf *uint8, __len c.SizeT) c.SizeT +// Get the process ID of the calling process. +// +//go:linkname NativeGetpid C.getpid +func NativeGetpid() c.Int + +// Get the process ID of the calling process's parent. +// +//go:linkname NativeGetppid C.getppid +func NativeGetppid() c.Int + // Get the process group ID of the calling process. // //go:linkname Getpgrp C.getpgrp func Getpgrp() c.Int +// Get the process group ID of process PID. +// +//go:linkname X__Getpgid C.__getpgid +func X__Getpgid(__pid c.Int) c.Int + //go:linkname Getpgid C.getpgid func Getpgid(__pid c.Int) c.Int @@ -1523,6 +1894,26 @@ func Setsid() c.Int //go:linkname Getsid C.getsid func Getsid(__pid c.Int) c.Int +// Get the real user ID of the calling process. +// +//go:linkname NativeGetuid C.getuid +func NativeGetuid() c.Uint + +// Get the effective user ID of the calling process. +// +//go:linkname NativeGeteuid C.geteuid +func NativeGeteuid() c.Uint + +// Get the real group ID of the calling process. +// +//go:linkname NativeGetgid C.getgid +func NativeGetgid() c.Uint + +// Get the effective group ID of the calling process. +// +//go:linkname NativeGetegid C.getegid +func NativeGetegid() c.Uint + // If SIZE is zero, return the number of supplementary groups // the calling process is in. Otherwise, fill in the group IDs // of its supplementary groups in LIST and return the number written. @@ -1568,6 +1959,13 @@ func Setregid(__rgid c.Uint, __egid c.Uint) c.Int //go:linkname Setegid C.setegid func Setegid(__gid c.Uint) c.Int +// Clone the calling process, creating an exact copy. +// Return -1 for errors, 0 to the new process, +// and the process ID of the new process to the old process. +// +//go:linkname NativeFork C.fork +func NativeFork() c.Int + // Clone the calling process, but without copying the whole address space. // The calling process is suspended until the new process exits or is // replaced by a call to `execve'. Return -1 for errors, 0 to the new process, @@ -1588,18 +1986,41 @@ func Ttyname(__fd c.Int) *uint8 //go:linkname TtynameR C.ttyname_r func TtynameR(__fd c.Int, __buf *uint8, __buflen c.SizeT) c.Int +// Return 1 if FD is a valid descriptor associated +// with a terminal, zero if not. +// +//go:linkname NativeIsatty C.isatty +func NativeIsatty(__fd c.Int) c.Int + // Return the index into the active-logins file (utmp) for // the controlling terminal. // //go:linkname Ttyslot C.ttyslot func Ttyslot() c.Int +// Make a link to FROM named TO. +// +//go:linkname NativeLink C.link +func NativeLink(__from *uint8, __to *uint8) c.Int + // Like link but relative paths in TO and FROM are interpreted relative // to FROMFD and TOFD respectively. // //go:linkname Linkat C.linkat func Linkat(__fromfd c.Int, __from *uint8, __tofd c.Int, __to *uint8, __flags c.Int) c.Int +// Make a symbolic link to FROM named TO. +// +//go:linkname NativeSymlink C.symlink +func NativeSymlink(__from *uint8, __to *uint8) c.Int + +// Read the contents of the symbolic link PATH into no more than +// LEN bytes of BUF. The contents are not null-terminated. +// Returns the number of characters read, or -1 for errors. +// +//go:linkname NativeReadlink C.readlink +func NativeReadlink(__path *uint8, __buf *uint8, __len c.SizeT) c.SsizeT + // Like symlink but a relative path in TO is interpreted relative to TOFD. // //go:linkname Symlinkat C.symlinkat @@ -1610,6 +2031,21 @@ func Symlinkat(__from *uint8, __tofd c.Int, __to *uint8) c.Int //go:linkname Readlinkat C.readlinkat func Readlinkat(__fd c.Int, __path *uint8, __buf *uint8, __len c.SizeT) c.SsizeT +// Remove the link NAME. +// +//go:linkname NativeUnlink C.unlink +func NativeUnlink(__name *uint8) c.Int + +// Remove the link NAME relative to FD. +// +//go:linkname NativeUnlinkat C.unlinkat +func NativeUnlinkat(__fd c.Int, __name *uint8, __flag c.Int) c.Int + +// Remove the directory PATH. +// +//go:linkname NativeRmdir C.rmdir +func NativeRmdir(__path *uint8) c.Int + // Return the foreground process group ID of FD. // //go:linkname Tcgetpgrp C.tcgetpgrp @@ -1724,12 +2160,26 @@ func Setusershell() //go:linkname Daemon C.daemon func Daemon(__nochdir c.Int, __noclose c.Int) c.Int +// Make PATH be the root directory (the starting point for absolute paths). +// This call is restricted to the super-user. +// +//go:linkname NativeChroot C.chroot +func NativeChroot(__path *uint8) c.Int + // Prompt with PROMPT and read a string from the terminal without echoing. // Uses /dev/tty if possible; otherwise stderr and stdin. // //go:linkname Getpass C.getpass func Getpass(__prompt *uint8) *uint8 +// Make all changes done to FD actually appear on disk. +// +// This function is a cancellation point and therefore not marked with +// __THROW. +// +//go:linkname NativeFsync C.fsync +func NativeFsync(__fd c.Int) c.Int + // Return identifier for the current host. // //go:linkname Gethostid C.gethostid @@ -1752,6 +2202,16 @@ func Getpagesize() c.Int //go:linkname Getdtablesize C.getdtablesize func Getdtablesize() c.Int +// Ignore +// +//go:linkname NativeTruncate C.truncate +func NativeTruncate(__file *uint8, __length c.Long) c.Int + +// Ignore +// +//go:linkname NativeFtruncate C.ftruncate +func NativeFtruncate(__fd c.Int, __length c.Long) c.Int + // Set the end of accessible data space (aka "the break") to ADDR. // Returns zero on success and -1 for errors (with errno set). // @@ -1766,6 +2226,20 @@ func Brk(__addr unsafe.Pointer) c.Int //go:linkname Sbrk C.sbrk func Sbrk(__delta c.IntptrT) unsafe.Pointer +// Invoke `system call' number SYSNO, passing it the remaining arguments. +// This is completely system-dependent, and not often useful. +// +// In Unix, `syscall' sets `errno' for all errors and most calls return -1 +// for errors; in many systems you cannot pass arguments or get return +// values for all system calls (`pipe', `fork', and `getppid' typically +// among them). +// +// In Mach, all system calls take normal arguments and always return an +// error code (zero for success). +// +//go:linkname NativeSyscall C.syscall +func NativeSyscall(__sysno c.Long, __llgo_va_list ...any) c.Long + // Synchronize at least the data part of a file with the underlying // media. // diff --git a/c/os/llcppg.pub b/c/os/llcppg.pub index 0920eb11..d82882cd 100644 --- a/c/os/llcppg.pub +++ b/c/os/llcppg.pub @@ -4,6 +4,7 @@ D github.com/goplus/lib/c/time T DIR DIR T Dl_info DlInfo T __caddr_t X__CaddrT +T __darwin_uuid_string_t X__DarwinUuidStringT T __darwin_uuid_t X__DarwinUuidT T __dirstream X__Dirstream T __fsid_t X__FsidT @@ -27,6 +28,7 @@ T flock FlockT T flocktimeout Flocktimeout T fpunchhole Fpunchhole T fpunchhole_t FpunchholeT +T fsid Fsid T fsid_t FsidT T fsignatures Fsignatures T fsignatures_t FsignaturesT @@ -44,12 +46,14 @@ T glob_t GlobT T group Group T idtype_t IdtypeT T kauth_cred_t KauthCredT +T mach_msg_header_t MachMsgHeaderT T mach_port_t MachPortT T mode_t ModeT T off_t OffT T ostat Ostat T passwd Passwd T pid_t PidT +T pollfd Pollfd T posix_cred PosixCred T posix_cred_t PosixCredT T posix_spawn_file_actions_t PosixSpawnFileActionsT @@ -80,4 +84,5 @@ T uid_t UidT T uio_rw UioRw T utimbuf Utimbuf T utsname Utsname +T uuid_string_t UuidStringT T uuid_t UuidT diff --git a/c/os/native_files_darwin_other.go b/c/os/native_files_darwin_other.go new file mode 100644 index 00000000..75b7eafa --- /dev/null +++ b/c/os/native_files_darwin_other.go @@ -0,0 +1,5 @@ +//go:build darwin && (!arm64 || ios) + +package os + +const LLGoFiles = llgoLegacyFilesDarwin diff --git a/c/os/os_darwin.go b/c/os/os_darwin.go index b9ca31ea..a00311ac 100644 --- a/c/os/os_darwin.go +++ b/c/os/os_darwin.go @@ -23,8 +23,8 @@ import ( ) const ( - LLGoFiles = "_os/os.c" - LLGoPackage = "link" + llgoLegacyFilesDarwin = "_os/os.c" + LLGoPackage = "link" ) const ( From a828bcd957bbf171806cc46f6835669f59842bce Mon Sep 17 00:00:00 2001 From: Rick Guo Date: Tue, 20 Oct 2026 15:18:11 +0800 Subject: [PATCH 6/6] Replace redundant Native bindings while preserving public contracts --- c/os/dir.go | 3 -- c/os/functions_default.go | 6 ---- c/os/generated_native_llgo_test.go | 2 +- c/os/legacy_functions_other.go | 38 +++++++++++++++++++++++ c/os/libc_darwin_arm64.go | 50 ++++++++++++++---------------- c/os/libc_linux_amd64.go | 42 ++++++++++++------------- c/os/libc_linux_arm64.go | 42 ++++++++++++------------- c/os/os.go | 21 ------------- 8 files changed, 103 insertions(+), 101 deletions(-) create mode 100644 c/os/legacy_functions_other.go diff --git a/c/os/dir.go b/c/os/dir.go index bd3cf9e2..8fdfac4b 100644 --- a/c/os/dir.go +++ b/c/os/dir.go @@ -14,6 +14,3 @@ type DIR struct { //go:linkname Opendir C.opendir func Opendir(name *c.Char) *DIR - -//go:linkname Closedir C.closedir -func Closedir(dir *DIR) c.Int diff --git a/c/os/functions_default.go b/c/os/functions_default.go index 1efcb374..1e4d639c 100644 --- a/c/os/functions_default.go +++ b/c/os/functions_default.go @@ -27,12 +27,6 @@ func Getcwd(buffer c.Pointer, size uintptr) *c.Char //go:linkname Open C.open func Open(path *c.Char, flags c.Int, __llgo_va_list ...any) c.Int -//go:linkname Fcntl C.fcntl -func Fcntl(a c.Int, b c.Int, __llgo_va_list ...any) c.Int - -//go:linkname Close C.close -func Close(fd c.Int) c.Int - //go:linkname Read C.read func Read(fd c.Int, buf c.Pointer, count uintptr) int diff --git a/c/os/generated_native_llgo_test.go b/c/os/generated_native_llgo_test.go index 84986448..9d0cf012 100644 --- a/c/os/generated_native_llgo_test.go +++ b/c/os/generated_native_llgo_test.go @@ -15,7 +15,7 @@ func TestGeneratedPipeIO(t *testing.T) { } defer func() { for _, fd := range pair { - if result := NativeClose(fd); result != 0 { + if result := Close(fd); result != 0 { t.Errorf("close = %d", result) } } diff --git a/c/os/legacy_functions_other.go b/c/os/legacy_functions_other.go new file mode 100644 index 00000000..4a961848 --- /dev/null +++ b/c/os/legacy_functions_other.go @@ -0,0 +1,38 @@ +//go:build !windows && !((darwin && arm64 && !ios) || (linux && (amd64 || arm64) && !android)) + +package os + +import ( + "github.com/goplus/lib/c" + _ "unsafe" +) + +//go:linkname Closedir C.closedir +func Closedir(dir *DIR) c.Int + +//go:linkname Close C.close +func Close(fd c.Int) c.Int + +//go:linkname Fchdir C.fchdir +func Fchdir(dirfd c.Int) c.Int + +//go:linkname Dup C.dup +func Dup(fd c.Int) c.Int + +//go:linkname Dup2 C.dup2 +func Dup2(oldfd c.Int, newfd c.Int) c.Int + +//go:linkname Fsync C.fsync +func Fsync(fd c.Int) c.Int + +//go:linkname Isatty C.isatty +func Isatty(fd c.Int) c.Int + +// In Mach, all system calls take normal arguments and always return an +// error code (zero for success). +// +//go:linkname Syscall C.syscall +func Syscall(sysno c.Long, __llgo_va_list ...any) c.Long + +//go:linkname Fcntl C.fcntl +func Fcntl(a c.Int, b c.Int, __llgo_va_list ...any) c.Int diff --git a/c/os/libc_darwin_arm64.go b/c/os/libc_darwin_arm64.go index 844d6dea..7ba26708 100644 --- a/c/os/libc_darwin_arm64.go +++ b/c/os/libc_darwin_arm64.go @@ -37,10 +37,8 @@ type llcppgCallback38 = func(_llcppg_param1 **Dirent, _llcppg_param2 **Dirent) c // llgo:type C type llcppgCallback39 = func(_llcppg_param1 *Dirent) c.Int -// llgo:link (*DIR).NativeClosedir C.closedir -func (self *DIR) NativeClosedir() c.Int { - return 0 -} +//go:linkname Closedir C.closedir +func Closedir(self *DIR) c.Int //go:linkname NativeOpendir C.opendir func NativeOpendir(_llcppg_param1 *c.Char) *DIR @@ -552,8 +550,8 @@ func (self *PosixSpawnFileActionsT) PosixSpawnFileActionsAddfchdirNp(_llcppg_par return 0 } -//go:linkname NativeSelect C.select -func NativeSelect(_llcppg_param1 c.Int, _llcppg_param2 *llsys.FdSet, _llcppg_param3 *llsys.FdSet, _llcppg_param4 *llsys.FdSet, _llcppg_param5 *llsys.Timeval) c.Int +//go:linkname Select C.select +func Select(_llcppg_param1 c.Int, _llcppg_param2 *llsys.FdSet, _llcppg_param3 *llsys.FdSet, _llcppg_param4 *llsys.FdSet, _llcppg_param5 *llsys.Timeval) c.Int //go:linkname X__DarwinCheckFdSetOverflow C.__darwin_check_fd_set_overflow func X__DarwinCheckFdSetOverflow(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 c.Int) c.Int @@ -1102,8 +1100,8 @@ func NativeOpenat(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c //go:linkname NativeCreat C.creat func NativeCreat(_llcppg_param1 *c.Char, _llcppg_param2 c.Uint16T) c.Int -//go:linkname NativeFcntl C.fcntl -func NativeFcntl(_llcppg_param1 c.Int, _llcppg_param2 c.Int, __llgo_va_list ...any) c.Int +//go:linkname Fcntl C.fcntl +func Fcntl(_llcppg_param1 c.Int, _llcppg_param2 c.Int, __llgo_va_list ...any) c.Int // data-protected non-portable open(2) : // @@ -2808,14 +2806,14 @@ func NativeChdir(_llcppg_param1 *c.Char) c.Int //go:linkname NativeChown C.chown func NativeChown(_llcppg_param1 *c.Char, _llcppg_param2 c.Uint, _llcppg_param3 c.Uint) c.Int -//go:linkname NativeClose C.close -func NativeClose(_llcppg_param1 c.Int) c.Int +//go:linkname Close C.close +func Close(_llcppg_param1 c.Int) c.Int -//go:linkname NativeDup C.dup -func NativeDup(_llcppg_param1 c.Int) c.Int +//go:linkname Dup C.dup +func Dup(_llcppg_param1 c.Int) c.Int -//go:linkname NativeDup2 C.dup2 -func NativeDup2(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int +//go:linkname Dup2 C.dup2 +func Dup2(_llcppg_param1 c.Int, _llcppg_param2 c.Int) c.Int //go:linkname NativeExecl C.execl func NativeExecl(__path *c.Char, __arg0 *c.Char, __llgo_va_list ...any) c.Int @@ -2871,8 +2869,8 @@ func NativeGetppid() c.Int //go:linkname NativeGetuid C.getuid func NativeGetuid() c.Uint -//go:linkname NativeIsatty C.isatty -func NativeIsatty(_llcppg_param1 c.Int) c.Int +//go:linkname Isatty C.isatty +func Isatty(_llcppg_param1 c.Int) c.Int //go:linkname NativeLink C.link func NativeLink(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char) c.Int @@ -2934,8 +2932,8 @@ func NativeWrite(__fd c.Int, __buf unsafe.Pointer, __nbyte c.SizeT) c.SsizeT //go:linkname Confstr C.confstr func Confstr(_llcppg_param1 c.Int, _llcppg_param2 *c.Char, _llcppg_param3 c.SizeT) c.SizeT -//go:linkname NativeGetopt C.getopt -func NativeGetopt(_llcppg_param1 c.Int, _llcppg_param2 **c.Char, _llcppg_param3 *c.Char) c.Int +//go:linkname Getopt C.getopt +func Getopt(_llcppg_param1 c.Int, _llcppg_param2 **c.Char, _llcppg_param3 *c.Char) c.Int // getopt(3) external variables // @@ -2963,8 +2961,8 @@ func Crypt(_llcppg_param1 *c.Char, _llcppg_param2 *c.Char) *c.Char //go:linkname Encrypt C.encrypt func Encrypt(_llcppg_param1 *c.Char, _llcppg_param2 c.Int) -//go:linkname NativeFchdir C.fchdir -func NativeFchdir(_llcppg_param1 c.Int) c.Int +//go:linkname Fchdir C.fchdir +func Fchdir(_llcppg_param1 c.Int) c.Int //go:linkname Gethostid C.gethostid func Gethostid() c.Long @@ -3025,16 +3023,16 @@ func NativeTruncate(_llcppg_param1 *c.Char, _llcppg_param2 c.LongLong) c.Int //go:linkname Ualarm C.ualarm func Ualarm(_llcppg_param1 c.Uint, _llcppg_param2 c.Uint) c.Uint -//go:linkname NativeUsleep C.usleep -func NativeUsleep(_llcppg_param1 c.Uint) c.Int +//go:linkname Usleep C.usleep +func Usleep(_llcppg_param1 c.Uint) c.Int // End XSI // //go:linkname Vfork C.vfork func Vfork() c.Int -//go:linkname NativeFsync C.fsync -func NativeFsync(_llcppg_param1 c.Int) c.Int +//go:linkname Fsync C.fsync +func Fsync(_llcppg_param1 c.Int) c.Int //go:linkname NativeFtruncate C.ftruncate func NativeFtruncate(_llcppg_param1 c.Int, _llcppg_param2 c.LongLong) c.Int @@ -3224,8 +3222,8 @@ func Undelete(_llcppg_param1 *c.Char) c.Int //go:linkname Unwhiteout C.unwhiteout func Unwhiteout(_llcppg_param1 *c.Char) c.Int -//go:linkname NativeSyscall C.syscall -func NativeSyscall(_llcppg_param1 c.Int, __llgo_va_list ...any) c.Int +//go:linkname Syscall C.syscall +func Syscall(_llcppg_param1 c.Int, __llgo_va_list ...any) c.Int //go:linkname Fgetattrlist C.fgetattrlist func Fgetattrlist(_llcppg_param1 c.Int, _llcppg_param2 unsafe.Pointer, _llcppg_param3 unsafe.Pointer, _llcppg_param4 c.SizeT, _llcppg_param5 c.Uint) c.Int diff --git a/c/os/libc_linux_amd64.go b/c/os/libc_linux_amd64.go index 7588f469..9c4922b3 100644 --- a/c/os/libc_linux_amd64.go +++ b/c/os/libc_linux_amd64.go @@ -301,10 +301,8 @@ func NativeFdopendir(__fd c.Int) *DIR // This function is a possible cancellation point and therefore not // marked with __THROW. // -// llgo:link (*DIR).NativeClosedir C.closedir -func (self *DIR) NativeClosedir() c.Int { - return 0 -} +//go:linkname Closedir C.closedir +func Closedir(self *DIR) c.Int // llgo:link (*DIR).NativeReaddir C.readdir func (self *DIR) NativeReaddir() *Dirent { @@ -493,8 +491,8 @@ const ( // This function is a cancellation point and therefore not marked with // __THROW. // -//go:linkname NativeFcntl C.fcntl -func NativeFcntl(__fd c.Int, __cmd c.Int, __llgo_va_list ...any) c.Int +//go:linkname Fcntl C.fcntl +func Fcntl(__fd c.Int, __cmd c.Int, __llgo_va_list ...any) c.Int //go:linkname NativeOpen C.open func NativeOpen(__file *c.Char, __oflag c.Int, __llgo_va_list ...any) c.Int @@ -1616,8 +1614,8 @@ func NativeLseek(__fd c.Int, __offset c.Long, __whence c.Int) c.Long // This function is a cancellation point and therefore not marked with // __THROW. // -//go:linkname NativeClose C.close -func NativeClose(__fd c.Int) c.Int +//go:linkname Close C.close +func Close(__fd c.Int) c.Int // NativeRead NBYTES into BUF from FD. Return the // number read, -1 for errors or 0 for EOF. @@ -1702,8 +1700,8 @@ func Ualarm(__value c.Uint, __interval c.Uint) c.Uint // This function is a cancellation point and therefore not marked with // __THROW. // -//go:linkname NativeUsleep C.usleep -func NativeUsleep(__useconds c.Uint) c.Int +//go:linkname Usleep C.usleep +func Usleep(__useconds c.Uint) c.Int // Suspend the process until a signal arrives. // This always returns -1 and sets `errno' to EINTR. @@ -1743,8 +1741,8 @@ func NativeChdir(__path *c.Char) c.Int // Change the process's working directory to the one FD is open on. // -//go:linkname NativeFchdir C.fchdir -func NativeFchdir(__fd c.Int) c.Int +//go:linkname Fchdir C.fchdir +func Fchdir(__fd c.Int) c.Int // Get the pathname of the current working directory, // and put it in SIZE bytes of BUF. Returns NULL if the @@ -1766,13 +1764,13 @@ func Getwd(__buf *c.Char) *c.Char // Duplicate FD, returning a new file descriptor on the same file. // -//go:linkname NativeDup C.dup -func NativeDup(__fd c.Int) c.Int +//go:linkname Dup C.dup +func Dup(__fd c.Int) c.Int // Duplicate FD to FD2, closing FD2 and making it open on the same file. // -//go:linkname NativeDup2 C.dup2 -func NativeDup2(__fd c.Int, __fd2 c.Int) c.Int +//go:linkname Dup2 C.dup2 +func Dup2(__fd c.Int, __fd2 c.Int) c.Int // Replace the current process, executing PATH with arguments ARGV and // environment ENVP. ARGV and ENVP are terminated by NULL pointers. @@ -1989,8 +1987,8 @@ func TtynameR(__fd c.Int, __buf *c.Char, __buflen c.SizeT) c.Int // Return 1 if FD is a valid descriptor associated // with a terminal, zero if not. // -//go:linkname NativeIsatty C.isatty -func NativeIsatty(__fd c.Int) c.Int +//go:linkname Isatty C.isatty +func Isatty(__fd c.Int) c.Int // Return the index into the active-logins file (utmp) for // the controlling terminal. @@ -2177,8 +2175,8 @@ func Getpass(__prompt *c.Char) *c.Char // This function is a cancellation point and therefore not marked with // __THROW. // -//go:linkname NativeFsync C.fsync -func NativeFsync(__fd c.Int) c.Int +//go:linkname Fsync C.fsync +func Fsync(__fd c.Int) c.Int // Return identifier for the current host. // @@ -2237,8 +2235,8 @@ func Sbrk(__delta c.IntptrT) unsafe.Pointer // In Mach, all system calls take normal arguments and always return an // error code (zero for success). // -//go:linkname NativeSyscall C.syscall -func NativeSyscall(__sysno c.Long, __llgo_va_list ...any) c.Long +//go:linkname Syscall C.syscall +func Syscall(__sysno c.Long, __llgo_va_list ...any) c.Long // Synchronize at least the data part of a file with the underlying // media. diff --git a/c/os/libc_linux_arm64.go b/c/os/libc_linux_arm64.go index 9be9889e..85d4087f 100644 --- a/c/os/libc_linux_arm64.go +++ b/c/os/libc_linux_arm64.go @@ -301,10 +301,8 @@ func NativeFdopendir(__fd c.Int) *DIR // This function is a possible cancellation point and therefore not // marked with __THROW. // -// llgo:link (*DIR).NativeClosedir C.closedir -func (self *DIR) NativeClosedir() c.Int { - return 0 -} +//go:linkname Closedir C.closedir +func Closedir(self *DIR) c.Int // llgo:link (*DIR).NativeReaddir C.readdir func (self *DIR) NativeReaddir() *Dirent { @@ -493,8 +491,8 @@ const ( // This function is a cancellation point and therefore not marked with // __THROW. // -//go:linkname NativeFcntl C.fcntl -func NativeFcntl(__fd c.Int, __cmd c.Int, __llgo_va_list ...any) c.Int +//go:linkname Fcntl C.fcntl +func Fcntl(__fd c.Int, __cmd c.Int, __llgo_va_list ...any) c.Int //go:linkname NativeOpen C.open func NativeOpen(__file *uint8, __oflag c.Int, __llgo_va_list ...any) c.Int @@ -1616,8 +1614,8 @@ func NativeLseek(__fd c.Int, __offset c.Long, __whence c.Int) c.Long // This function is a cancellation point and therefore not marked with // __THROW. // -//go:linkname NativeClose C.close -func NativeClose(__fd c.Int) c.Int +//go:linkname Close C.close +func Close(__fd c.Int) c.Int // NativeRead NBYTES into BUF from FD. Return the // number read, -1 for errors or 0 for EOF. @@ -1702,8 +1700,8 @@ func Ualarm(__value c.Uint, __interval c.Uint) c.Uint // This function is a cancellation point and therefore not marked with // __THROW. // -//go:linkname NativeUsleep C.usleep -func NativeUsleep(__useconds c.Uint) c.Int +//go:linkname Usleep C.usleep +func Usleep(__useconds c.Uint) c.Int // Suspend the process until a signal arrives. // This always returns -1 and sets `errno' to EINTR. @@ -1743,8 +1741,8 @@ func NativeChdir(__path *uint8) c.Int // Change the process's working directory to the one FD is open on. // -//go:linkname NativeFchdir C.fchdir -func NativeFchdir(__fd c.Int) c.Int +//go:linkname Fchdir C.fchdir +func Fchdir(__fd c.Int) c.Int // Get the pathname of the current working directory, // and put it in SIZE bytes of BUF. Returns NULL if the @@ -1766,13 +1764,13 @@ func Getwd(__buf *uint8) *uint8 // Duplicate FD, returning a new file descriptor on the same file. // -//go:linkname NativeDup C.dup -func NativeDup(__fd c.Int) c.Int +//go:linkname Dup C.dup +func Dup(__fd c.Int) c.Int // Duplicate FD to FD2, closing FD2 and making it open on the same file. // -//go:linkname NativeDup2 C.dup2 -func NativeDup2(__fd c.Int, __fd2 c.Int) c.Int +//go:linkname Dup2 C.dup2 +func Dup2(__fd c.Int, __fd2 c.Int) c.Int // Replace the current process, executing PATH with arguments ARGV and // environment ENVP. ARGV and ENVP are terminated by NULL pointers. @@ -1989,8 +1987,8 @@ func TtynameR(__fd c.Int, __buf *uint8, __buflen c.SizeT) c.Int // Return 1 if FD is a valid descriptor associated // with a terminal, zero if not. // -//go:linkname NativeIsatty C.isatty -func NativeIsatty(__fd c.Int) c.Int +//go:linkname Isatty C.isatty +func Isatty(__fd c.Int) c.Int // Return the index into the active-logins file (utmp) for // the controlling terminal. @@ -2177,8 +2175,8 @@ func Getpass(__prompt *uint8) *uint8 // This function is a cancellation point and therefore not marked with // __THROW. // -//go:linkname NativeFsync C.fsync -func NativeFsync(__fd c.Int) c.Int +//go:linkname Fsync C.fsync +func Fsync(__fd c.Int) c.Int // Return identifier for the current host. // @@ -2237,8 +2235,8 @@ func Sbrk(__delta c.IntptrT) unsafe.Pointer // In Mach, all system calls take normal arguments and always return an // error code (zero for success). // -//go:linkname NativeSyscall C.syscall -func NativeSyscall(__sysno c.Long, __llgo_va_list ...any) c.Long +//go:linkname Syscall C.syscall +func Syscall(__sysno c.Long, __llgo_va_list ...any) c.Long // Synchronize at least the data part of a file with the underlying // media. diff --git a/c/os/os.go b/c/os/os.go index 00ba8353..18e1048e 100644 --- a/c/os/os.go +++ b/c/os/os.go @@ -95,9 +95,6 @@ func Unsetenv(name *c.Char) c.Int // ----------------------------------------------------------------------------- -//go:linkname Fchdir C.fchdir -func Fchdir(dirfd c.Int) c.Int - //go:linkname Faccessat C.faccessat func Faccessat(dirfd c.Int, path *c.Char, mode c.Int, flags c.Int) c.Int @@ -115,12 +112,6 @@ func Openat(dirfd c.Int, path *c.Char, flags c.Int, mode ModeT) c.Int //go:linkname Creat C.creat func Creat(path *c.Char, mode ModeT) c.Int -//go:linkname Dup C.dup -func Dup(fd c.Int) c.Int - -//go:linkname Dup2 C.dup2 -func Dup2(oldfd c.Int, newfd c.Int) c.Int - //go:linkname Dup3 C.dup3 func Dup3(oldfd c.Int, newfd c.Int, flags c.Int) c.Int @@ -133,9 +124,6 @@ func Mknod(path *c.Char, mode ModeT, dev DevT) c.Int //go:linkname Lseek C.lseek func Lseek(fd c.Int, offset OffT, whence c.Int) OffT -//go:linkname Fsync C.fsync -func Fsync(fd c.Int) c.Int - //go:linkname Ftruncate C.ftruncate func Ftruncate(fd c.Int, length OffT) c.Int @@ -145,9 +133,6 @@ func Fchmod(fd c.Int, mode ModeT) c.Int //go:linkname Fchown C.fchown func Fchown(fd c.Int, owner UidT, group GidT) c.Int -//go:linkname Isatty C.isatty -func Isatty(fd c.Int) c.Int - // ----------------------------------------------------------------------------- // Execl(const char *path, const char *arg0, ..., /*, (char *)0, */) @@ -194,12 +179,6 @@ func Getppid() PidT // values for all system calls (`pipe', `fork', and `getppid' typically // among them). -// In Mach, all system calls take normal arguments and always return an -// error code (zero for success). -// -//go:linkname Syscall C.syscall -func Syscall(sysno c.Long, __llgo_va_list ...any) c.Long - // If wait() returns due to a stopped or terminated child process, the process ID // of the child is returned to the calling process. Otherwise, a value of -1 is // returned and errno is set to indicate the error.