mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Kernel: Make KCOVDevice::ioctl() return KResult
Recent ioctl() changes broke this, this commit fixes that and the build.
This commit is contained in:
parent
713b18b7a6
commit
e76af0fe16
Notes:
sideshowbarker
2024-07-18 08:17:31 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/e76af0fe168
4 changed files with 13 additions and 13 deletions
|
@ -75,9 +75,9 @@ KResultOr<NonnullRefPtr<FileDescription>> KCOVDevice::open(int options)
|
|||
return File::open(options);
|
||||
}
|
||||
|
||||
int KCOVDevice::ioctl(FileDescription&, unsigned request, FlatPtr arg)
|
||||
KResult KCOVDevice::ioctl(FileDescription&, unsigned request, Userspace<void*> arg)
|
||||
{
|
||||
int error = 0;
|
||||
KResult return_value = KSuccess;
|
||||
auto thread = Thread::current();
|
||||
auto tid = thread->tid();
|
||||
auto pid = thread->pid();
|
||||
|
@ -90,19 +90,19 @@ int KCOVDevice::ioctl(FileDescription&, unsigned request, FlatPtr arg)
|
|||
switch (request) {
|
||||
case KCOV_SETBUFSIZE: {
|
||||
if (kcov_instance->state >= KCOVInstance::TRACING) {
|
||||
error = EBUSY;
|
||||
return_value = EBUSY;
|
||||
break;
|
||||
}
|
||||
error = kcov_instance->buffer_allocate(arg);
|
||||
return_value = kcov_instance->buffer_allocate((FlatPtr)arg.unsafe_userspace_ptr());
|
||||
break;
|
||||
}
|
||||
case KCOV_ENABLE: {
|
||||
if (kcov_instance->state >= KCOVInstance::TRACING) {
|
||||
error = EBUSY;
|
||||
return_value = EBUSY;
|
||||
break;
|
||||
}
|
||||
if (!kcov_instance->has_buffer()) {
|
||||
error = ENOBUFS;
|
||||
return_value = ENOBUFS;
|
||||
break;
|
||||
}
|
||||
VERIFY(kcov_instance->state == KCOVInstance::OPENED);
|
||||
|
@ -113,7 +113,7 @@ int KCOVDevice::ioctl(FileDescription&, unsigned request, FlatPtr arg)
|
|||
case KCOV_DISABLE: {
|
||||
auto maybe_kcov_instance = thread_instance->get(tid);
|
||||
if (!maybe_kcov_instance.has_value()) {
|
||||
error = ENOENT;
|
||||
return_value = ENOENT;
|
||||
break;
|
||||
}
|
||||
VERIFY(kcov_instance->state == KCOVInstance::TRACING);
|
||||
|
@ -122,11 +122,11 @@ int KCOVDevice::ioctl(FileDescription&, unsigned request, FlatPtr arg)
|
|||
break;
|
||||
}
|
||||
default: {
|
||||
error = EINVAL;
|
||||
return_value = EINVAL;
|
||||
}
|
||||
};
|
||||
|
||||
return error;
|
||||
return return_value;
|
||||
}
|
||||
|
||||
KResultOr<Region*> KCOVDevice::mmap(Process& process, FileDescription&, const Range& range, u64 offset, int prot, bool shared)
|
||||
|
|
|
@ -37,7 +37,7 @@ protected:
|
|||
virtual void start_request(AsyncBlockDeviceRequest& request) override final { request.complete(AsyncDeviceRequest::Failure); }
|
||||
virtual KResultOr<size_t> read(FileDescription&, u64, UserOrKernelBuffer&, size_t) override { return -EINVAL; }
|
||||
virtual KResultOr<size_t> write(FileDescription&, u64, const UserOrKernelBuffer&, size_t) override { return -EINVAL; }
|
||||
virtual int ioctl(FileDescription&, unsigned request, FlatPtr arg) override;
|
||||
virtual KResult ioctl(FileDescription&, unsigned request, Userspace<void*> arg) override;
|
||||
|
||||
private:
|
||||
KCOVDevice();
|
||||
|
|
|
@ -15,7 +15,7 @@ KCOVInstance::KCOVInstance(ProcessID pid)
|
|||
state = UNUSED;
|
||||
}
|
||||
|
||||
int KCOVInstance::buffer_allocate(size_t buffer_size_in_entries)
|
||||
KResult KCOVInstance::buffer_allocate(size_t buffer_size_in_entries)
|
||||
{
|
||||
// first entry contains index of last PC
|
||||
this->m_buffer_size_in_entries = buffer_size_in_entries - 1;
|
||||
|
@ -40,7 +40,7 @@ int KCOVInstance::buffer_allocate(size_t buffer_size_in_entries)
|
|||
if (!this->has_buffer())
|
||||
return ENOMEM;
|
||||
|
||||
return 0;
|
||||
return KSuccess;
|
||||
}
|
||||
|
||||
void KCOVInstance::buffer_add_pc(u64 pc)
|
||||
|
|
|
@ -30,7 +30,7 @@ class KCOVInstance final {
|
|||
public:
|
||||
explicit KCOVInstance(ProcessID pid);
|
||||
|
||||
int buffer_allocate(size_t buffer_size_in_entries);
|
||||
KResult buffer_allocate(size_t buffer_size_in_entries);
|
||||
bool has_buffer() const { return m_buffer != nullptr; }
|
||||
void buffer_add_pc(u64 pc);
|
||||
|
||||
|
|
Loading…
Reference in a new issue