Changed argument type of fcntl syscall from uint32 to size_t.
Since this argument may be used to pass pointers, uint32 is not correct for 64-bit. Effectively no change on 32-bit targets, both size_t and uint32 are unsigned long there.
This commit is contained in:
parent
5f6b522746
commit
195a0f350e
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user