mirror of
https://github.com/tnn2/esp-idf-libssh.git
synced 2026-02-04 12:20:42 +09:00
add stubs of missing libc functions
This commit is contained in:
1
components/libssh/compat/netinet/tcp.h
Normal file
1
components/libssh/compat/netinet/tcp.h
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/* lwip doesn't provide this file */
|
||||||
2
components/libssh/compat/poll.h
Normal file
2
components/libssh/compat/poll.h
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/* esp-idf has <sys/poll.h> but not <poll.h> */
|
||||||
|
#include <sys/poll.h>
|
||||||
31
components/libssh/compat/stubs.h
Normal file
31
components/libssh/compat/stubs.h
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#include <net/if.h>
|
||||||
|
#include <pwd.h>
|
||||||
|
#include <glob.h>
|
||||||
|
|
||||||
|
#if !defined(GLOB_NOMATCH)
|
||||||
|
#define GLOB_NOMATCH -3
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define gai_strerror(ecode) "unknown error"
|
||||||
|
#define getuid() getuid_stub() (uid_t)0
|
||||||
|
|
||||||
|
static inline int getpwuid_r_stub(struct passwd **result) { errno = ENOENT; *result = NULL; return 1; }
|
||||||
|
#define getpwuid_r(uid,passwd,buffer,buflen,result) getpwuid_r_stub(result)
|
||||||
|
|
||||||
|
static inline struct passwd *getpwnam_stub() { errno = ENOENT; return NULL; }
|
||||||
|
#define getpwnam(name) getpwnam_stub()
|
||||||
|
|
||||||
|
static inline int gethostname_stub(char *name, size_t namelen) {strlcpy(name, "esp32", namelen); return 0; }
|
||||||
|
#define gethostname(name, namelen) gethostname_stub(name, namelen)
|
||||||
|
|
||||||
|
static inline pid_t waitpid_stub() { errno = ENOSYS; return (pid_t)-1; }
|
||||||
|
#define waitpid(pid,status,options) waitpid_stub()
|
||||||
|
|
||||||
|
static inline int glob_stub() { errno = ENOENT; return GLOB_NOMATCH; }
|
||||||
|
#define glob(pattern, flags, errfunc, pglob) glob_stub()
|
||||||
|
|
||||||
|
#define globfree(pglob) do { } while(0)
|
||||||
|
|
||||||
|
|
||||||
|
static inline int socketpair_stub() { errno = ENOSYS; return -1; }
|
||||||
|
#define socketpair(d, type, protocol, sv) socketpair_stub()
|
||||||
Reference in New Issue
Block a user