hostname.c 428 B

1234567891011121314151617
  1. #include <unistd.h>
  2. #include <syscall.h>
  3. #include <syscall_nums.h>
  4. #include <errno.h>
  5. DEFN_SYSCALL1(sethostname, SYS_SETHOSTNAME, char *);
  6. DEFN_SYSCALL1(gethostname, SYS_GETHOSTNAME, char *);
  7. int gethostname(char * name, size_t len) {
  8. (void)len; /* TODO */
  9. __sets_errno(syscall_gethostname(name));
  10. }
  11. int sethostname(const char * name, size_t len) {
  12. (void)len; /* TODO */
  13. __sets_errno(syscall_sethostname((char*)name));
  14. }