--- Gnu-Mach/linux/dev/glue/misc.c 2020/09/02 04:43:25 1.1.1.2 +++ Gnu-Mach/linux/dev/glue/misc.c 2020/09/02 04:45:59 1.1.1.3 @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -66,10 +67,7 @@ #include #include #include - -extern boolean_t vm_map_lookup_entry (register vm_map_t, register vm_offset_t, - vm_map_entry_t *); -extern int printf (const char *, ...); +#include int (*dispatch_scsi_info_ptr) (int ino, char *buffer, char **start, off_t offset, int length, int inout) = 0; @@ -84,34 +82,34 @@ linux_to_mach_error (int err) case 0: return D_SUCCESS; - case -LINUX_EPERM: + case -EPERM: return D_INVALID_OPERATION; - case -LINUX_EIO: + case -EIO: return D_IO_ERROR; - case -LINUX_ENXIO: + case -ENXIO: return D_NO_SUCH_DEVICE; - case -LINUX_EACCES: + case -EACCES: return D_INVALID_OPERATION; - case -LINUX_EFAULT: + case -EFAULT: return D_INVALID_SIZE; - case -LINUX_EBUSY: + case -EBUSY: return D_ALREADY_OPEN; - case -LINUX_EINVAL: + case -EINVAL: return D_INVALID_SIZE; - case -LINUX_EROFS: + case -EROFS: return D_READ_ONLY; - case -LINUX_EWOULDBLOCK: + case -EWOULDBLOCK: return D_WOULD_BLOCK; - case -LINUX_ENOMEM: + case -ENOMEM: return D_NO_MEMORY; default: @@ -123,6 +121,8 @@ linux_to_mach_error (int err) int issig () { + if (!current_thread()) + return 0; return current_thread ()->wait_result != THREAD_AWAKENED; } @@ -148,7 +148,7 @@ verify_area (int rw, const void *p, unsi || (entry->protection & prot) != prot) { vm_map_unlock_read (current_map ()); - return -LINUX_EFAULT; + return -EFAULT; } if (entry->vme_end - entry->vme_start >= len) break; @@ -229,7 +229,12 @@ add_blkdev_randomness (int major) void do_gettimeofday (struct timeval *tv) { - host_get_time (1, tv); + /* + * XXX: The first argument should be mach_host_self (), but that's too + * expensive, and the host argument is not used by host_get_time (), + * only checked not to be HOST_NULL. + */ + host_get_time ((host_t) 1, (time_value_t *) tv); } int