mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 20:28:11 +00:00
Add sys$gethostname and /bin/hostname
This commit is contained in:
parent
3faaa3e04a
commit
53abfa7ea1
16 changed files with 77 additions and 40 deletions
38
LibC/errno.h
38
LibC/errno.h
|
@ -1,42 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#define EPERM 1 // Operation not permitted
|
||||
#define ENOENT 2 // No such file or directory
|
||||
#define ESRCH 3 // No such process
|
||||
#define EINTR 4 // Interrupted system call
|
||||
#define EIO 5 // I/O error
|
||||
#define ENXIO 6 // No such device or address
|
||||
#define E2BIG 7 // Argument list too long
|
||||
#define ENOEXEC 8 // Exec format error
|
||||
#define EBADF 9 // Bad file number
|
||||
#define ECHILD 10 // No child processes
|
||||
#define EAGAIN 11 // Try again
|
||||
#define ENOMEM 12 // Out of memory
|
||||
#define EACCES 13 // Permission denied
|
||||
#define EFAULT 14 // Bad address
|
||||
#define ENOTBLK 15 // Block device required
|
||||
#define EBUSY 16 // Device or resource busy
|
||||
#define EEXIST 17 // File exists
|
||||
#define EXDEV 18 // Cross-device link
|
||||
#define ENODEV 19 // No such device
|
||||
#define ENOTDIR 20 // Not a directory
|
||||
#define EISDIR 21 // Is a directory
|
||||
#define EINVAL 22 // Invalid argument
|
||||
#define ENFILE 23 // File table overflow
|
||||
#define EMFILE 24 // Too many open files
|
||||
#define ENOTTY 25 // Not a typewriter
|
||||
#define ETXTBSY 26 // Text file busy
|
||||
#define EFBIG 27 // File too large
|
||||
#define ENOSPC 28 // No space left on device
|
||||
#define ESPIPE 29 // Illegal seek
|
||||
#define EROFS 30 // Read-only file system
|
||||
#define EMLINK 31 // Too many links
|
||||
#define EPIPE 32 // Broken pipe
|
||||
#define EDOM 33 // Math argument out of domain of func
|
||||
#define ERANGE 34 // Math result not representable
|
||||
|
||||
#define EOVERFLOW 75 // Value too large for defined data type
|
||||
|
||||
#include <Kernel/errno.h>
|
||||
|
||||
#define __RETURN_WITH_ERRNO(rc, good_ret, bad_ret) \
|
||||
do { \
|
||||
|
|
|
@ -50,6 +50,7 @@ const char* strerror(int errnum)
|
|||
case EPIPE: return "Broken pipe";
|
||||
case EDOM: return "Math argument out of domain";
|
||||
case ERANGE: return "Math result not representable";
|
||||
case ENAMETOOLONG: return "Name too long";
|
||||
case EOVERFLOW: return "Value too large for data type";
|
||||
}
|
||||
printf("strerror() missing string for errnum=%d\n", errnum);
|
||||
|
|
|
@ -62,5 +62,11 @@ int sleep(unsigned seconds)
|
|||
return Syscall::invoke(Syscall::Sleep, (dword)seconds);
|
||||
}
|
||||
|
||||
int gethostname(char* buffer, size_t size)
|
||||
{
|
||||
int rc = Syscall::invoke(Syscall::PosixGethostname, (dword)buffer, (dword)size);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,9 @@ pid_t waitpid(pid_t);
|
|||
char* getcwd(char* buffer, size_t size);
|
||||
int lstat(const char* path, stat* statbuf);
|
||||
int sleep(unsigned seconds);
|
||||
int gethostname(char*, size_t);
|
||||
|
||||
#define HOST_NAME_MAX 64
|
||||
|
||||
#define S_IFMT 0170000
|
||||
#define S_IFDIR 0040000
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue