2024-02-23 22:32:32 +01:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2024 shadPS4 Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
2023-10-30 22:04:57 +01:00
|
|
|
#pragma once
|
2023-11-06 00:11:54 +01:00
|
|
|
|
2023-11-05 12:41:10 +01:00
|
|
|
#include "common/types.h"
|
2024-06-10 21:59:12 +02:00
|
|
|
#include "core/libraries/kernel/time_management.h"
|
2023-11-06 00:11:54 +01:00
|
|
|
|
|
|
|
namespace Core::Loader {
|
|
|
|
class SymbolsResolver;
|
|
|
|
}
|
2023-10-30 22:04:57 +01:00
|
|
|
|
2024-04-13 23:35:48 +02:00
|
|
|
namespace Libraries::Kernel {
|
2023-11-06 00:11:54 +01:00
|
|
|
|
2024-06-20 17:09:40 +02:00
|
|
|
constexpr int ORBIS_MAX_PATH = 255;
|
|
|
|
|
2024-01-26 17:01:27 +01:00
|
|
|
struct SceKernelIovec {
|
2024-02-23 21:57:57 +01:00
|
|
|
void* iov_base;
|
2024-02-27 23:10:34 +01:00
|
|
|
std::size_t iov_len;
|
2024-01-26 17:01:27 +01:00
|
|
|
};
|
|
|
|
|
2024-05-05 11:43:01 +02:00
|
|
|
struct OrbisKernelStat {
|
|
|
|
u32 st_dev;
|
|
|
|
u32 st_ino;
|
|
|
|
u16 st_mode;
|
|
|
|
u16 st_nlink;
|
|
|
|
u32 st_uid;
|
|
|
|
u32 st_gid;
|
|
|
|
u32 st_rdev;
|
2024-06-10 21:59:12 +02:00
|
|
|
OrbisKernelTimespec st_atim;
|
|
|
|
OrbisKernelTimespec st_mtim;
|
|
|
|
OrbisKernelTimespec st_ctim;
|
2024-05-05 11:43:01 +02:00
|
|
|
s64 st_size;
|
|
|
|
s64 st_blocks;
|
|
|
|
u32 st_blksize;
|
|
|
|
u32 st_flags;
|
|
|
|
u32 st_gen;
|
|
|
|
s32 st_lspare;
|
2024-06-10 21:59:12 +02:00
|
|
|
OrbisKernelTimespec st_birthtim;
|
|
|
|
unsigned int : (8 / 2) * (16 - static_cast<int>(sizeof(OrbisKernelTimespec)));
|
|
|
|
unsigned int : (8 / 2) * (16 - static_cast<int>(sizeof(OrbisKernelTimespec)));
|
2024-05-05 11:43:01 +02:00
|
|
|
};
|
|
|
|
|
2024-06-20 17:09:40 +02:00
|
|
|
struct OrbisKernelDirent {
|
|
|
|
u32 d_fileno; /* file number of entry */
|
|
|
|
u16 d_reclen; /* length of this record */
|
|
|
|
u8 d_type; /* file type, see below */
|
|
|
|
u8 d_namlen; /* length of string in d_name */
|
|
|
|
char d_name[ORBIS_MAX_PATH + 1]; /* name must be no longer than this */
|
|
|
|
};
|
|
|
|
|
2024-05-05 11:43:01 +02:00
|
|
|
// flags for Open
|
|
|
|
constexpr int ORBIS_KERNEL_O_RDONLY = 0x0000;
|
|
|
|
constexpr int ORBIS_KERNEL_O_WRONLY = 0x0001;
|
|
|
|
constexpr int ORBIS_KERNEL_O_RDWR = 0x0002;
|
|
|
|
|
|
|
|
constexpr int ORBIS_KERNEL_O_NONBLOCK = 0x0004;
|
|
|
|
constexpr int ORBIS_KERNEL_O_APPEND = 0x0008;
|
|
|
|
constexpr int ORBIS_KERNEL_O_FSYNC = 0x0080;
|
|
|
|
constexpr int ORBIS_KERNEL_O_SYNC = 0x0080;
|
|
|
|
constexpr int ORBIS_KERNEL_O_CREAT = 0x0200;
|
|
|
|
constexpr int ORBIS_KERNEL_O_TRUNC = 0x0400;
|
|
|
|
constexpr int ORBIS_KERNEL_O_EXCL = 0x0800;
|
|
|
|
constexpr int ORBIS_KERNEL_O_DSYNC = 0x1000;
|
|
|
|
constexpr int ORBIS_KERNEL_O_DIRECT = 0x00010000;
|
|
|
|
constexpr int ORBIS_KERNEL_O_DIRECTORY = 0x00020000;
|
|
|
|
|
2024-02-23 21:57:57 +01:00
|
|
|
int PS4_SYSV_ABI sceKernelOpen(const char* path, int flags, /* SceKernelMode*/ u16 mode);
|
2023-10-30 22:04:57 +01:00
|
|
|
|
2024-02-23 21:57:57 +01:00
|
|
|
int PS4_SYSV_ABI posix_open(const char* path, int flags, /* SceKernelMode*/ u16 mode);
|
2024-03-22 17:12:37 +01:00
|
|
|
s64 PS4_SYSV_ABI lseek(int d, s64 offset, int whence);
|
2023-10-30 22:04:57 +01:00
|
|
|
|
2024-04-13 23:35:48 +02:00
|
|
|
void fileSystemSymbolsRegister(Core::Loader::SymbolsResolver* sym);
|
2023-10-30 22:04:57 +01:00
|
|
|
|
2024-04-13 23:35:48 +02:00
|
|
|
} // namespace Libraries::Kernel
|