diff --git a/headers/private/kernel/vfs.h b/headers/private/kernel/vfs.h index cdde48d47c..89d98b5801 100644 --- a/headers/private/kernel/vfs.h +++ b/headers/private/kernel/vfs.h @@ -176,7 +176,7 @@ int _user_open_dir_entry_ref(dev_t device, ino_t inode, const char *name); int _user_open_dir(int fd, const char *path); int _user_open_parent_dir(int fd, char *name, size_t nameLength); -status_t _user_fcntl(int fd, int op, uint32 argument); +status_t _user_fcntl(int fd, int op, size_t argument); status_t _user_fsync(int fd); status_t _user_flock(int fd, int op); status_t _user_read_stat(int fd, const char *path, bool traverseLink, diff --git a/headers/private/system/syscalls.h b/headers/private/system/syscalls.h index 17f9b73d79..b104bb6cf8 100644 --- a/headers/private/system/syscalls.h +++ b/headers/private/system/syscalls.h @@ -253,7 +253,7 @@ extern int _kern_open_dir_entry_ref(dev_t device, ino_t inode, extern int _kern_open_dir(int fd, const char *path); extern int _kern_open_parent_dir(int fd, char *name, size_t nameLength); -extern status_t _kern_fcntl(int fd, int op, uint32 argument); +extern status_t _kern_fcntl(int fd, int op, size_t argument); extern status_t _kern_fsync(int fd); extern status_t _kern_flock(int fd, int op); extern off_t _kern_seek(int fd, off_t pos, int seekType); diff --git a/src/system/kernel/fs/vfs.cpp b/src/system/kernel/fs/vfs.cpp index 6e4dfd2d39..ace23089f2 100644 --- a/src/system/kernel/fs/vfs.cpp +++ b/src/system/kernel/fs/vfs.cpp @@ -5917,7 +5917,7 @@ common_ioctl(struct file_descriptor* descriptor, ulong op, void* buffer, static status_t -common_fcntl(int fd, int op, uint32 argument, bool kernel) +common_fcntl(int fd, int op, size_t argument, bool kernel) { struct flock flock; @@ -5934,10 +5934,9 @@ common_fcntl(int fd, int op, uint32 argument, bool kernel) status_t status = B_OK; if (op == F_SETLK || op == F_SETLKW || op == F_GETLK) { - // TODO: x86_64 needs ulong argument here. if (descriptor->type != FDTYPE_FILE) status = B_BAD_VALUE; - else if (user_memcpy(&flock, (struct flock*)((ulong)argument), + else if (user_memcpy(&flock, (struct flock*)argument, sizeof(struct flock)) != B_OK) status = B_BAD_ADDRESS; @@ -6019,8 +6018,7 @@ common_fcntl(int fd, int op, uint32 argument, bool kernel) status = get_advisory_lock(vnode, &flock); if (status == B_OK) { // copy back flock structure - // TODO: x86_64 - status = user_memcpy((struct flock*)((ulong)argument), &flock, + status = user_memcpy((struct flock*)argument, &flock, sizeof(struct flock)); } } else @@ -8087,7 +8085,7 @@ _kern_open_dir(int fd, const char* path) status_t -_kern_fcntl(int fd, int op, uint32 argument) +_kern_fcntl(int fd, int op, size_t argument) { return common_fcntl(fd, op, argument, true); } @@ -8901,7 +8899,7 @@ _user_open_parent_dir(int fd, char* userName, size_t nameLength) status_t -_user_fcntl(int fd, int op, uint32 argument) +_user_fcntl(int fd, int op, size_t argument) { status_t status = common_fcntl(fd, op, argument, false); if (op == F_SETLKW) diff --git a/src/system/libroot/posix/fcntl.cpp b/src/system/libroot/posix/fcntl.cpp index 2f99596145..1a82dec027 100644 --- a/src/system/libroot/posix/fcntl.cpp +++ b/src/system/libroot/posix/fcntl.cpp @@ -65,7 +65,7 @@ fcntl(int fd, int op, ...) { va_list args; va_start(args, op); - uint32 argument = va_arg(args, uint32); + size_t argument = va_arg(args, size_t); va_end(args); status_t error = _kern_fcntl(fd, op, argument);