runtime: rename clite conflicts function names

This commit is contained in:
Li Jie
2025-01-08 17:04:10 +08:00
parent 27052c21be
commit 6e6b8b404f
5 changed files with 15 additions and 11 deletions

View File

@@ -1,12 +1,14 @@
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
int llgoClearenv() { int cliteClearenv()
{
extern char **environ; extern char **environ;
if (environ != NULL) { if (environ != NULL)
{
*environ = NULL; *environ = NULL;
} }
return 0; return 0;
} }
int llgoErrno() { return errno; } int cliteErrno() { return errno; }

View File

@@ -70,7 +70,7 @@ type (
StatT = syscall.Stat_t StatT = syscall.Stat_t
) )
//go:linkname Errno C.llgoErrno //go:linkname Errno C.cliteErrno
func Errno() c.Int func Errno() c.Int
//go:linkname Umask C.umask //go:linkname Umask C.umask

View File

@@ -25,5 +25,5 @@ const (
LLGoPackage = "link" LLGoPackage = "link"
) )
//go:linkname Clearenv C.llgoClearenv //go:linkname Clearenv C.cliteClearenv
func Clearenv() func Clearenv()

View File

@@ -2,17 +2,19 @@
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
pthread_once_t llgoSyncOnceInitVal = PTHREAD_ONCE_INIT; pthread_once_t cliteSyncOnceInitVal = PTHREAD_ONCE_INIT;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// wrap return type to void // wrap return type to void
void wrap_pthread_mutex_lock(pthread_mutex_t *mutex) { void clite_wrap_pthread_mutex_lock(pthread_mutex_t *mutex)
{
pthread_mutex_lock(mutex); pthread_mutex_lock(mutex);
} }
// wrap return type to void // wrap return type to void
void wrap_pthread_mutex_unlock(pthread_mutex_t *mutex) { void clite_wrap_pthread_mutex_unlock(pthread_mutex_t *mutex)
{
pthread_mutex_unlock(mutex); pthread_mutex_unlock(mutex);
} }

View File

@@ -36,7 +36,7 @@ const (
// Once is an object that will perform exactly one action. // Once is an object that will perform exactly one action.
type Once C.pthread_once_t type Once C.pthread_once_t
//go:linkname OnceInit llgoSyncOnceInitVal //go:linkname OnceInit cliteSyncOnceInitVal
var OnceInit Once var OnceInit Once
// llgo:link (*Once).Do C.pthread_once // llgo:link (*Once).Do C.pthread_once
@@ -79,10 +79,10 @@ func (m *Mutex) Destroy() {}
// llgo:link (*Mutex).TryLock C.pthread_mutex_trylock // llgo:link (*Mutex).TryLock C.pthread_mutex_trylock
func (m *Mutex) TryLock() c.Int { return 0 } func (m *Mutex) TryLock() c.Int { return 0 }
// llgo:link (*Mutex).Lock C.wrap_pthread_mutex_lock // llgo:link (*Mutex).Lock C.clite_wrap_pthread_mutex_lock
func (m *Mutex) Lock() {} func (m *Mutex) Lock() {}
// llgo:link (*Mutex).Unlock C.wrap_pthread_mutex_unlock // llgo:link (*Mutex).Unlock C.clite_wrap_pthread_mutex_unlock
func (m *Mutex) Unlock() {} func (m *Mutex) Unlock() {}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------