mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-07-02 19:09:16 +00:00
userspace/libc: add stub gethostname function
Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
@ -94,6 +94,7 @@ extern "C"
|
|||||||
gid_t getgid(void);
|
gid_t getgid(void);
|
||||||
int getgroups(int, gid_t[]);
|
int getgroups(int, gid_t[]);
|
||||||
long gethostid(void);
|
long gethostid(void);
|
||||||
|
int gethostname(char *name, size_t namelen);
|
||||||
char *getlogin(void);
|
char *getlogin(void);
|
||||||
int getlogin_r(char *, size_t);
|
int getlogin_r(char *, size_t);
|
||||||
int getopt(int, char *const[], const char *);
|
int getopt(int, char *const[], const char *);
|
||||||
|
@ -179,6 +179,25 @@ export uid_t geteuid(void);
|
|||||||
export gid_t getgid(void);
|
export gid_t getgid(void);
|
||||||
export int getgroups(int, gid_t[]);
|
export int getgroups(int, gid_t[]);
|
||||||
export long gethostid(void);
|
export long gethostid(void);
|
||||||
|
|
||||||
|
export int gethostname(char *name, size_t namelen)
|
||||||
|
{
|
||||||
|
if (namelen == 0)
|
||||||
|
{
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
strncpy(name, "localhost", namelen);
|
||||||
|
if (namelen < strlen("localhost") + 1)
|
||||||
|
{
|
||||||
|
errno = ENAMETOOLONG;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
export char *getlogin(void);
|
export char *getlogin(void);
|
||||||
export int getlogin_r(char *, size_t);
|
export int getlogin_r(char *, size_t);
|
||||||
export int getopt(int, char *const[], const char *);
|
export int getopt(int, char *const[], const char *);
|
||||||
|
Reference in New Issue
Block a user