mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibC+Kernel: Switch off_t to 64 bits
This commit is contained in:
parent
b05b4d4b24
commit
7a079f7780
Notes:
sideshowbarker
2024-07-18 21:15:56 +09:00
Author: https://github.com/boricj Commit: https://github.com/SerenityOS/serenity/commit/7a079f77809 Pull-request: https://github.com/SerenityOS/serenity/pull/5766 Reviewed-by: https://github.com/supercomputer7
7 changed files with 23 additions and 13 deletions
|
@ -244,7 +244,7 @@ struct SC_mmap_params {
|
|||
int32_t prot;
|
||||
int32_t flags;
|
||||
int32_t fd;
|
||||
ssize_t offset;
|
||||
int64_t offset;
|
||||
StringArgument name;
|
||||
};
|
||||
|
||||
|
|
|
@ -276,7 +276,6 @@ public:
|
|||
KResultOr<int> sys$dump_backtrace();
|
||||
KResultOr<pid_t> sys$gettid();
|
||||
KResultOr<int> sys$donate(pid_t tid);
|
||||
KResultOr<int> sys$ftruncate(int fd, off_t);
|
||||
KResultOr<pid_t> sys$setsid();
|
||||
KResultOr<pid_t> sys$getsid(pid_t);
|
||||
KResultOr<int> sys$setpgid(pid_t pid, pid_t pgid);
|
||||
|
@ -299,7 +298,8 @@ public:
|
|||
KResultOr<ssize_t> sys$writev(int fd, Userspace<const struct iovec*> iov, int iov_count);
|
||||
KResultOr<int> sys$fstat(int fd, Userspace<stat*>);
|
||||
KResultOr<int> sys$stat(Userspace<const Syscall::SC_stat_params*>);
|
||||
KResultOr<int> sys$lseek(int fd, off_t, int whence);
|
||||
KResultOr<int> sys$lseek(int fd, Userspace<off_t*>, int whence);
|
||||
KResultOr<int> sys$ftruncate(int fd, Userspace<off_t*>);
|
||||
KResultOr<int> sys$kill(pid_t pid_or_pgid, int sig);
|
||||
[[noreturn]] void sys$exit(int status);
|
||||
KResultOr<int> sys$sigreturn(RegisterState& registers);
|
||||
|
|
|
@ -29,9 +29,12 @@
|
|||
|
||||
namespace Kernel {
|
||||
|
||||
KResultOr<int> Process::sys$ftruncate(int fd, off_t length)
|
||||
KResultOr<int> Process::sys$ftruncate(int fd, Userspace<off_t*> userspace_length)
|
||||
{
|
||||
REQUIRE_PROMISE(stdio);
|
||||
off_t length;
|
||||
if (!copy_from_user(&length, userspace_length))
|
||||
return EFAULT;
|
||||
if (length < 0)
|
||||
return EINVAL;
|
||||
auto description = file_description(fd);
|
||||
|
|
|
@ -29,13 +29,22 @@
|
|||
|
||||
namespace Kernel {
|
||||
|
||||
KResultOr<int> Process::sys$lseek(int fd, off_t offset, int whence)
|
||||
KResultOr<int> Process::sys$lseek(int fd, Userspace<off_t*> userspace_offset, int whence)
|
||||
{
|
||||
REQUIRE_PROMISE(stdio);
|
||||
auto description = file_description(fd);
|
||||
if (!description)
|
||||
return EBADF;
|
||||
return description->seek(offset, whence);
|
||||
off_t offset;
|
||||
if (!copy_from_user(&offset, userspace_offset))
|
||||
return EFAULT;
|
||||
offset = description->seek(offset, whence);
|
||||
if (!copy_to_user(userspace_offset, &offset))
|
||||
return EFAULT;
|
||||
if (offset < 0)
|
||||
return offset;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -424,9 +424,7 @@ struct sigaction {
|
|||
#define CLD_STOPPED 4
|
||||
#define CLD_CONTINUED 5
|
||||
|
||||
#define OFF_T_MAX 2147483647
|
||||
|
||||
typedef ssize_t off_t;
|
||||
typedef i64 off_t;
|
||||
typedef i64 time_t;
|
||||
|
||||
struct utimbuf {
|
||||
|
|
|
@ -55,7 +55,7 @@ typedef int id_t;
|
|||
typedef __WINT_TYPE__ wint_t;
|
||||
|
||||
typedef uint32_t ino_t;
|
||||
typedef ssize_t off_t;
|
||||
typedef int64_t off_t;
|
||||
|
||||
typedef uint32_t dev_t;
|
||||
typedef uint16_t mode_t;
|
||||
|
|
|
@ -440,8 +440,8 @@ ssize_t readlink(const char* path, char* buffer, size_t size)
|
|||
|
||||
off_t lseek(int fd, off_t offset, int whence)
|
||||
{
|
||||
int rc = syscall(SC_lseek, fd, offset, whence);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
int rc = syscall(SC_lseek, fd, &offset, whence);
|
||||
__RETURN_WITH_ERRNO(rc, offset, -1);
|
||||
}
|
||||
|
||||
int link(const char* old_path, const char* new_path)
|
||||
|
@ -633,7 +633,7 @@ char* getlogin()
|
|||
|
||||
int ftruncate(int fd, off_t length)
|
||||
{
|
||||
int rc = syscall(SC_ftruncate, fd, length);
|
||||
int rc = syscall(SC_ftruncate, fd, &length);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue