mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:47:45 +00:00
Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
parent
38d62563b3
commit
5e1499d104
1615 changed files with 10257 additions and 10257 deletions
|
@ -44,7 +44,7 @@ void* __tlsdesc_static(void*);
|
|||
|
||||
namespace ELF {
|
||||
|
||||
Result<NonnullRefPtr<DynamicLoader>, DlErrorMessage> DynamicLoader::try_create(int fd, DeprecatedString filepath)
|
||||
Result<NonnullRefPtr<DynamicLoader>, DlErrorMessage> DynamicLoader::try_create(int fd, ByteString filepath)
|
||||
{
|
||||
VERIFY(filepath.starts_with('/'));
|
||||
|
||||
|
@ -56,9 +56,9 @@ Result<NonnullRefPtr<DynamicLoader>, DlErrorMessage> DynamicLoader::try_create(i
|
|||
VERIFY(stat.st_size >= 0);
|
||||
auto size = static_cast<size_t>(stat.st_size);
|
||||
if (size < sizeof(Elf_Ehdr))
|
||||
return DlErrorMessage { DeprecatedString::formatted("File {} has invalid ELF header", filepath) };
|
||||
return DlErrorMessage { ByteString::formatted("File {} has invalid ELF header", filepath) };
|
||||
|
||||
DeprecatedString file_mmap_name = DeprecatedString::formatted("ELF_DYN: {}", filepath);
|
||||
ByteString file_mmap_name = ByteString::formatted("ELF_DYN: {}", filepath);
|
||||
auto* data = mmap_with_name(nullptr, size, PROT_READ, MAP_SHARED, fd, 0, file_mmap_name.characters());
|
||||
if (data == MAP_FAILED) {
|
||||
return DlErrorMessage { "DynamicLoader::try_create mmap" };
|
||||
|
@ -70,7 +70,7 @@ Result<NonnullRefPtr<DynamicLoader>, DlErrorMessage> DynamicLoader::try_create(i
|
|||
return loader;
|
||||
}
|
||||
|
||||
DynamicLoader::DynamicLoader(int fd, DeprecatedString filepath, void* data, size_t size)
|
||||
DynamicLoader::DynamicLoader(int fd, ByteString filepath, void* data, size_t size)
|
||||
: m_filepath(move(filepath))
|
||||
, m_file_size(size)
|
||||
, m_image_fd(fd)
|
||||
|
@ -293,19 +293,19 @@ Result<NonnullRefPtr<DynamicObject>, DlErrorMessage> DynamicLoader::load_stage_3
|
|||
// If we don't have textrels, .text has already been made executable by this point in load_stage_2.
|
||||
for (auto& text_segment : m_text_segments) {
|
||||
if (mprotect(text_segment.address().as_ptr(), text_segment.size(), PROT_READ | PROT_EXEC) < 0) {
|
||||
return DlErrorMessage { DeprecatedString::formatted("mprotect .text: PROT_READ | PROT_EXEC: {}", strerror(errno)) };
|
||||
return DlErrorMessage { ByteString::formatted("mprotect .text: PROT_READ | PROT_EXEC: {}", strerror(errno)) };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_relro_segment_size) {
|
||||
if (mprotect(m_relro_segment_address.as_ptr(), m_relro_segment_size, PROT_READ) < 0) {
|
||||
return DlErrorMessage { DeprecatedString::formatted("mprotect .relro: PROT_READ: {}", strerror(errno)) };
|
||||
return DlErrorMessage { ByteString::formatted("mprotect .relro: PROT_READ: {}", strerror(errno)) };
|
||||
}
|
||||
|
||||
#ifdef AK_OS_SERENITY
|
||||
if (set_mmap_name(m_relro_segment_address.as_ptr(), m_relro_segment_size, DeprecatedString::formatted("{}: .relro", m_filepath).characters()) < 0) {
|
||||
return DlErrorMessage { DeprecatedString::formatted("set_mmap_name .relro: {}", strerror(errno)) };
|
||||
if (set_mmap_name(m_relro_segment_address.as_ptr(), m_relro_segment_size, ByteString::formatted("{}: .relro", m_filepath).characters()) < 0) {
|
||||
return DlErrorMessage { ByteString::formatted("set_mmap_name .relro: {}", strerror(errno)) };
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ void DynamicLoader::load_program_headers()
|
|||
}
|
||||
|
||||
// Now that we can't accidentally block our requested space, re-map our ELF image.
|
||||
DeprecatedString file_mmap_name = DeprecatedString::formatted("ELF_DYN: {}", m_filepath);
|
||||
ByteString file_mmap_name = ByteString::formatted("ELF_DYN: {}", m_filepath);
|
||||
auto* data = mmap_with_name(nullptr, m_file_size, PROT_READ, MAP_SHARED, m_image_fd, 0, file_mmap_name.characters());
|
||||
if (data == MAP_FAILED) {
|
||||
perror("mmap new mapping");
|
||||
|
@ -444,9 +444,9 @@ void DynamicLoader::load_program_headers()
|
|||
|
||||
// Pre-allocate any malloc memory needed before unmapping the reservation.
|
||||
// We don't want any future malloc to accidentally mmap a reserved address!
|
||||
DeprecatedString text_segment_name = DeprecatedString::formatted("{}: .text", m_filepath);
|
||||
DeprecatedString rodata_segment_name = DeprecatedString::formatted("{}: .rodata", m_filepath);
|
||||
DeprecatedString data_segment_name = DeprecatedString::formatted("{}: .data", m_filepath);
|
||||
ByteString text_segment_name = ByteString::formatted("{}: .text", m_filepath);
|
||||
ByteString rodata_segment_name = ByteString::formatted("{}: .rodata", m_filepath);
|
||||
ByteString data_segment_name = ByteString::formatted("{}: .data", m_filepath);
|
||||
|
||||
m_text_segments.ensure_capacity(map_regions.size());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue