mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:47:34 +00:00
Everywhere: Run clang-format
This commit is contained in:
parent
0376c127f6
commit
086969277e
1665 changed files with 8479 additions and 8479 deletions
|
@ -12,8 +12,8 @@ namespace Archive {
|
|||
unsigned TarFileHeader::expected_checksum() const
|
||||
{
|
||||
auto checksum = 0u;
|
||||
const u8* u8_this = reinterpret_cast<const u8*>(this);
|
||||
const u8* u8_m_checksum = reinterpret_cast<const u8*>(&m_checksum);
|
||||
u8 const* u8_this = reinterpret_cast<u8 const*>(this);
|
||||
u8 const* u8_m_checksum = reinterpret_cast<u8 const*>(&m_checksum);
|
||||
for (auto i = 0u; i < sizeof(TarFileHeader); ++i) {
|
||||
if (u8_this + i >= u8_m_checksum && u8_this + i < u8_m_checksum + sizeof(m_checksum)) {
|
||||
checksum += ' ';
|
||||
|
|
|
@ -38,7 +38,7 @@ constexpr StringView posix1_tar_magic = ""; // POSIX.1-1988 format magic
|
|||
constexpr StringView posix1_tar_version = ""; // POSIX.1-1988 format version
|
||||
|
||||
template<size_t N>
|
||||
static size_t get_field_as_integral(const char (&field)[N])
|
||||
static size_t get_field_as_integral(char const (&field)[N])
|
||||
{
|
||||
size_t value = 0;
|
||||
for (size_t i = 0; i < N; ++i) {
|
||||
|
@ -53,7 +53,7 @@ static size_t get_field_as_integral(const char (&field)[N])
|
|||
}
|
||||
|
||||
template<size_t N>
|
||||
static StringView get_field_as_string_view(const char (&field)[N])
|
||||
static StringView get_field_as_string_view(char const (&field)[N])
|
||||
{
|
||||
return { field, min(__builtin_strlen(field), N) };
|
||||
}
|
||||
|
@ -95,23 +95,23 @@ public:
|
|||
// FIXME: support ustar filename prefix
|
||||
StringView prefix() const { return get_field_as_string_view(m_prefix); }
|
||||
|
||||
void set_filename(const String& filename) { set_field(m_filename, filename); }
|
||||
void set_filename(String const& filename) { set_field(m_filename, filename); }
|
||||
void set_mode(mode_t mode) { set_octal_field(m_mode, mode); }
|
||||
void set_uid(uid_t uid) { set_octal_field(m_uid, uid); }
|
||||
void set_gid(gid_t gid) { set_octal_field(m_gid, gid); }
|
||||
void set_size(size_t size) { set_octal_field(m_size, size); }
|
||||
void set_timestamp(time_t timestamp) { set_octal_field(m_timestamp, timestamp); }
|
||||
void set_type_flag(TarFileType type) { m_type_flag = to_underlying(type); }
|
||||
void set_link_name(const String& link_name) { set_field(m_link_name, link_name); }
|
||||
void set_link_name(String const& link_name) { set_field(m_link_name, link_name); }
|
||||
// magic doesn't necessarily include a null byte
|
||||
void set_magic(StringView magic) { set_field(m_magic, magic); }
|
||||
// version doesn't necessarily include a null byte
|
||||
void set_version(StringView version) { set_field(m_version, version); }
|
||||
void set_owner_name(const String& owner_name) { set_field(m_owner_name, owner_name); }
|
||||
void set_group_name(const String& group_name) { set_field(m_group_name, group_name); }
|
||||
void set_owner_name(String const& owner_name) { set_field(m_owner_name, owner_name); }
|
||||
void set_group_name(String const& group_name) { set_field(m_group_name, group_name); }
|
||||
void set_major(int major) { set_octal_field(m_major, major); }
|
||||
void set_minor(int minor) { set_octal_field(m_minor, minor); }
|
||||
void set_prefix(const String& prefix) { set_field(m_prefix, prefix); }
|
||||
void set_prefix(String const& prefix) { set_field(m_prefix, prefix); }
|
||||
|
||||
unsigned expected_checksum() const;
|
||||
void calculate_checksum();
|
||||
|
|
|
@ -128,7 +128,7 @@ TarOutputStream::TarOutputStream(OutputStream& stream)
|
|||
{
|
||||
}
|
||||
|
||||
void TarOutputStream::add_directory(const String& path, mode_t mode)
|
||||
void TarOutputStream::add_directory(String const& path, mode_t mode)
|
||||
{
|
||||
VERIFY(!m_finished);
|
||||
TarFileHeader header {};
|
||||
|
@ -144,7 +144,7 @@ void TarOutputStream::add_directory(const String& path, mode_t mode)
|
|||
VERIFY(m_stream.write_or_error(Bytes { &padding, block_size - sizeof(header) }));
|
||||
}
|
||||
|
||||
void TarOutputStream::add_file(const String& path, mode_t mode, ReadonlyBytes bytes)
|
||||
void TarOutputStream::add_file(String const& path, mode_t mode, ReadonlyBytes bytes)
|
||||
{
|
||||
VERIFY(!m_finished);
|
||||
TarFileHeader header {};
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
void advance();
|
||||
bool finished() const { return m_finished; }
|
||||
bool valid() const;
|
||||
const TarFileHeader& header() const { return m_header; }
|
||||
TarFileHeader const& header() const { return m_header; }
|
||||
TarFileStream file_contents();
|
||||
|
||||
template<VoidFunction<StringView, StringView> F>
|
||||
|
@ -56,8 +56,8 @@ private:
|
|||
class TarOutputStream {
|
||||
public:
|
||||
TarOutputStream(OutputStream&);
|
||||
void add_file(const String& path, mode_t, ReadonlyBytes);
|
||||
void add_directory(const String& path, mode_t);
|
||||
void add_file(String const& path, mode_t, ReadonlyBytes);
|
||||
void add_directory(String const& path, mode_t);
|
||||
void finish();
|
||||
|
||||
private:
|
||||
|
|
|
@ -80,7 +80,7 @@ Optional<Zip> Zip::try_create(ReadonlyBytes buffer)
|
|||
};
|
||||
}
|
||||
|
||||
bool Zip::for_each_member(Function<IterationDecision(const ZipMember&)> callback)
|
||||
bool Zip::for_each_member(Function<IterationDecision(ZipMember const&)> callback)
|
||||
{
|
||||
size_t member_offset = m_members_start_offset;
|
||||
for (size_t i = 0; i < m_member_count; i++) {
|
||||
|
@ -119,7 +119,7 @@ static u16 minimum_version_needed(ZipCompressionMethod method)
|
|||
return method == ZipCompressionMethod::Deflate ? 20 : 10;
|
||||
}
|
||||
|
||||
void ZipOutputStream::add_member(const ZipMember& member)
|
||||
void ZipOutputStream::add_member(ZipMember const& member)
|
||||
{
|
||||
VERIFY(!m_finished);
|
||||
VERIFY(member.name.length() <= UINT16_MAX);
|
||||
|
@ -151,7 +151,7 @@ void ZipOutputStream::finish()
|
|||
|
||||
auto file_header_offset = 0u;
|
||||
auto central_directory_size = 0u;
|
||||
for (const ZipMember& member : m_members) {
|
||||
for (ZipMember const& member : m_members) {
|
||||
auto zip_version = minimum_version_needed(member.compression_method);
|
||||
CentralDirectoryRecord central_directory_record {
|
||||
.made_by_version = zip_version,
|
||||
|
|
|
@ -42,7 +42,7 @@ struct [[gnu::packed]] EndOfCentralDirectory {
|
|||
u32 central_directory_size;
|
||||
u32 central_directory_offset;
|
||||
u16 comment_length;
|
||||
const u8* comment;
|
||||
u8 const* comment;
|
||||
|
||||
bool read(ReadonlyBytes buffer)
|
||||
{
|
||||
|
@ -103,9 +103,9 @@ struct [[gnu::packed]] CentralDirectoryRecord {
|
|||
u16 internal_attributes;
|
||||
u32 external_attributes;
|
||||
u32 local_file_header_offset;
|
||||
const u8* name;
|
||||
const u8* extra_data;
|
||||
const u8* comment;
|
||||
u8 const* name;
|
||||
u8 const* extra_data;
|
||||
u8 const* comment;
|
||||
|
||||
bool read(ReadonlyBytes buffer)
|
||||
{
|
||||
|
@ -167,9 +167,9 @@ struct [[gnu::packed]] LocalFileHeader {
|
|||
u32 uncompressed_size;
|
||||
u16 name_length;
|
||||
u16 extra_data_length;
|
||||
const u8* name;
|
||||
const u8* extra_data;
|
||||
const u8* compressed_data;
|
||||
u8 const* name;
|
||||
u8 const* extra_data;
|
||||
u8 const* compressed_data;
|
||||
|
||||
bool read(ReadonlyBytes buffer)
|
||||
{
|
||||
|
@ -218,7 +218,7 @@ struct ZipMember {
|
|||
class Zip {
|
||||
public:
|
||||
static Optional<Zip> try_create(ReadonlyBytes buffer);
|
||||
bool for_each_member(Function<IterationDecision(const ZipMember&)>);
|
||||
bool for_each_member(Function<IterationDecision(ZipMember const&)>);
|
||||
|
||||
private:
|
||||
static bool find_end_of_central_directory_offset(ReadonlyBytes, size_t& offset);
|
||||
|
@ -237,7 +237,7 @@ private:
|
|||
class ZipOutputStream {
|
||||
public:
|
||||
ZipOutputStream(OutputStream&);
|
||||
void add_member(const ZipMember&);
|
||||
void add_member(ZipMember const&);
|
||||
void finish();
|
||||
|
||||
private:
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
return MUST(adopt_nonnull_ref_or_enomem(new (nothrow) Buffer));
|
||||
}
|
||||
|
||||
Sample const* samples() const { return (const Sample*)data(); }
|
||||
Sample const* samples() const { return (Sample const*)data(); }
|
||||
|
||||
ErrorOr<FixedArray<Sample>> to_sample_array() const
|
||||
{
|
||||
|
@ -86,7 +86,7 @@ private:
|
|||
|
||||
Core::AnonymousBuffer m_buffer;
|
||||
const i32 m_id { -1 };
|
||||
const int m_sample_count { 0 };
|
||||
int const m_sample_count { 0 };
|
||||
};
|
||||
|
||||
// This only works for double resamplers, and therefore cannot be part of the class
|
||||
|
|
|
@ -101,7 +101,7 @@ private:
|
|||
u16 m_min_block_size { 0 };
|
||||
u16 m_max_block_size { 0 };
|
||||
// Frames are units of encoded audio data, both of these are 24-bit
|
||||
u32 m_min_frame_size { 0 }; //24 bit
|
||||
u32 m_min_frame_size { 0 }; // 24 bit
|
||||
u32 m_max_frame_size { 0 }; // 24 bit
|
||||
u64 m_total_samples { 0 }; // 36 bit
|
||||
u8 m_md5_checksum[128 / 8]; // 128 bit (!)
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
|
||||
virtual MaybeLoaderError reset() = 0;
|
||||
|
||||
virtual MaybeLoaderError seek(const int sample_index) = 0;
|
||||
virtual MaybeLoaderError seek(int const sample_index) = 0;
|
||||
|
||||
// total_samples() and loaded_samples() should be independent
|
||||
// of the number of channels.
|
||||
|
@ -63,7 +63,7 @@ public:
|
|||
LoaderSamples get_more_samples(size_t max_bytes_to_read_from_input = 128 * KiB) const { return m_plugin->get_more_samples(max_bytes_to_read_from_input); }
|
||||
|
||||
MaybeLoaderError reset() const { return m_plugin->reset(); }
|
||||
MaybeLoaderError seek(const int position) const { return m_plugin->seek(position); }
|
||||
MaybeLoaderError seek(int const position) const { return m_plugin->seek(position); }
|
||||
|
||||
int loaded_samples() const { return m_plugin->loaded_samples(); }
|
||||
int total_samples() const { return m_plugin->total_samples(); }
|
||||
|
|
|
@ -112,7 +112,7 @@ HuffmanDecodeResult<T> huffman_decode(InputBitStream& bitstream, Span<HuffmanNod
|
|||
size_t bits_read = 0;
|
||||
|
||||
while (!node->is_leaf() && !bitstream.has_any_error() && max_bits_to_read-- > 0) {
|
||||
const bool direction = bitstream.read_bit_big_endian();
|
||||
bool const direction = bitstream.read_bit_big_endian();
|
||||
++bits_read;
|
||||
if (direction) {
|
||||
if (node->left == -1)
|
||||
|
|
|
@ -36,7 +36,7 @@ MaybeLoaderError WavLoaderPlugin::initialize()
|
|||
return {};
|
||||
}
|
||||
|
||||
WavLoaderPlugin::WavLoaderPlugin(const Bytes& buffer)
|
||||
WavLoaderPlugin::WavLoaderPlugin(Bytes const& buffer)
|
||||
{
|
||||
m_stream = make<InputMemoryStream>(buffer);
|
||||
if (!m_stream) {
|
||||
|
@ -91,7 +91,7 @@ LoaderSamples WavLoaderPlugin::get_more_samples(size_t max_bytes_to_read_from_in
|
|||
return buffer.release_value();
|
||||
}
|
||||
|
||||
MaybeLoaderError WavLoaderPlugin::seek(const int sample_index)
|
||||
MaybeLoaderError WavLoaderPlugin::seek(int const sample_index)
|
||||
{
|
||||
dbgln_if(AWAVLOADER_DEBUG, "seek sample_index {}", sample_index);
|
||||
if (sample_index < 0 || sample_index >= m_total_samples)
|
||||
|
|
|
@ -34,7 +34,7 @@ class Buffer;
|
|||
class WavLoaderPlugin : public LoaderPlugin {
|
||||
public:
|
||||
explicit WavLoaderPlugin(StringView path);
|
||||
explicit WavLoaderPlugin(const Bytes& buffer);
|
||||
explicit WavLoaderPlugin(Bytes const& buffer);
|
||||
|
||||
virtual MaybeLoaderError initialize() override;
|
||||
|
||||
|
@ -46,7 +46,7 @@ public:
|
|||
|
||||
// sample_index 0 is the start of the raw audio sample data
|
||||
// within the file/stream.
|
||||
virtual MaybeLoaderError seek(const int sample_index) override;
|
||||
virtual MaybeLoaderError seek(int const sample_index) override;
|
||||
|
||||
virtual int loaded_samples() override { return m_loaded_samples; }
|
||||
virtual int total_samples() override { return m_total_samples; }
|
||||
|
|
|
@ -40,7 +40,7 @@ void WavWriter::set_file(StringView path)
|
|||
m_finalized = false;
|
||||
}
|
||||
|
||||
void WavWriter::write_samples(const u8* samples, size_t size)
|
||||
void WavWriter::write_samples(u8 const* samples, size_t size)
|
||||
{
|
||||
m_data_sz += size;
|
||||
m_file->write(samples, size);
|
||||
|
|
|
@ -22,9 +22,9 @@ public:
|
|||
~WavWriter();
|
||||
|
||||
bool has_error() const { return !m_error_string.is_null(); }
|
||||
const char* error_string() const { return m_error_string.characters(); }
|
||||
char const* error_string() const { return m_error_string.characters(); }
|
||||
|
||||
void write_samples(const u8* samples, size_t size);
|
||||
void write_samples(u8 const* samples, size_t size);
|
||||
void finalize(); // You can finalize manually or let the destructor do it.
|
||||
|
||||
u32 sample_rate() const { return m_sample_rate; }
|
||||
|
|
|
@ -12,16 +12,16 @@
|
|||
|
||||
extern "C" {
|
||||
|
||||
const char* inet_ntop(int af, const void* src, char* dst, socklen_t len)
|
||||
char const* inet_ntop(int af, void const* src, char* dst, socklen_t len)
|
||||
{
|
||||
if (af == AF_INET) {
|
||||
if (len < INET_ADDRSTRLEN) {
|
||||
errno = ENOSPC;
|
||||
return nullptr;
|
||||
}
|
||||
auto* bytes = (const unsigned char*)src;
|
||||
auto* bytes = (unsigned char const*)src;
|
||||
snprintf(dst, len, "%u.%u.%u.%u", bytes[0], bytes[1], bytes[2], bytes[3]);
|
||||
return (const char*)dst;
|
||||
return (char const*)dst;
|
||||
} else if (af == AF_INET6) {
|
||||
if (len < INET6_ADDRSTRLEN) {
|
||||
errno = ENOSPC;
|
||||
|
@ -32,14 +32,14 @@ const char* inet_ntop(int af, const void* src, char* dst, socklen_t len)
|
|||
errno = ENOSPC;
|
||||
return nullptr;
|
||||
}
|
||||
return (const char*)dst;
|
||||
return (char const*)dst;
|
||||
}
|
||||
|
||||
errno = EAFNOSUPPORT;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int inet_pton(int af, const char* src, void* dst)
|
||||
int inet_pton(int af, char const* src, void* dst)
|
||||
{
|
||||
if (af == AF_INET) {
|
||||
unsigned a, b, c, d;
|
||||
|
@ -78,7 +78,7 @@ int inet_pton(int af, const char* src, void* dst)
|
|||
return -1;
|
||||
}
|
||||
|
||||
in_addr_t inet_addr(const char* str)
|
||||
in_addr_t inet_addr(char const* str)
|
||||
{
|
||||
in_addr_t tmp {};
|
||||
int rc = inet_pton(AF_INET, str, &tmp);
|
||||
|
|
|
@ -16,10 +16,10 @@ __BEGIN_DECLS
|
|||
#define INET_ADDRSTRLEN 16
|
||||
#define INET6_ADDRSTRLEN 46
|
||||
|
||||
const char* inet_ntop(int af, const void* src, char* dst, socklen_t);
|
||||
int inet_pton(int af, const char* src, void* dst);
|
||||
char const* inet_ntop(int af, void const* src, char* dst, socklen_t);
|
||||
int inet_pton(int af, char const* src, void* dst);
|
||||
|
||||
static inline int inet_aton(const char* cp, struct in_addr* inp)
|
||||
static inline int inet_aton(char const* cp, struct in_addr* inp)
|
||||
{
|
||||
return inet_pton(AF_INET, cp, inp);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ extern "C" {
|
|||
|
||||
extern bool __stdio_is_initialized;
|
||||
|
||||
void __assertion_failed(const char* msg)
|
||||
void __assertion_failed(char const* msg)
|
||||
{
|
||||
if (__heap_is_stable) {
|
||||
dbgln("ASSERTION FAILED: {}", msg);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
__BEGIN_DECLS
|
||||
|
||||
#ifndef NDEBUG
|
||||
__attribute__((noreturn)) void __assertion_failed(const char* msg);
|
||||
__attribute__((noreturn)) void __assertion_failed(char const* msg);
|
||||
# define assert(expr) \
|
||||
(__builtin_expect(!(expr), 0) \
|
||||
? __assertion_failed(#expr "\n" __FILE__ ":" __stringify(__LINE__)) \
|
||||
|
|
|
@ -19,7 +19,7 @@ struct PthreadFunctions {
|
|||
int (*pthread_once)(pthread_once_t*, void (*)(void));
|
||||
|
||||
int (*pthread_cond_broadcast)(pthread_cond_t*);
|
||||
int (*pthread_cond_init)(pthread_cond_t*, const pthread_condattr_t*);
|
||||
int (*pthread_cond_init)(pthread_cond_t*, pthread_condattr_t const*);
|
||||
int (*pthread_cond_signal)(pthread_cond_t*);
|
||||
int (*pthread_cond_wait)(pthread_cond_t*, pthread_mutex_t*);
|
||||
int (*pthread_cond_destroy)(pthread_cond_t*);
|
||||
|
|
|
@ -18,7 +18,7 @@ void __pthread_fork_atfork_register_prepare(void (*)(void));
|
|||
void __pthread_fork_atfork_register_parent(void (*)(void));
|
||||
void __pthread_fork_atfork_register_child(void (*)(void));
|
||||
|
||||
int __pthread_mutex_init(pthread_mutex_t*, const pthread_mutexattr_t*);
|
||||
int __pthread_mutex_init(pthread_mutex_t*, pthread_mutexattr_t const*);
|
||||
int __pthread_mutex_lock(pthread_mutex_t*);
|
||||
int __pthread_mutex_trylock(pthread_mutex_t*);
|
||||
int __pthread_mutex_lock_pessimistic_np(pthread_mutex_t*);
|
||||
|
@ -29,7 +29,7 @@ typedef void (*KeyDestructor)(void*);
|
|||
int __pthread_key_create(pthread_key_t*, KeyDestructor);
|
||||
int __pthread_key_delete(pthread_key_t);
|
||||
void* __pthread_getspecific(pthread_key_t);
|
||||
int __pthread_setspecific(pthread_key_t, const void*);
|
||||
int __pthread_setspecific(pthread_key_t, void const*);
|
||||
|
||||
int __pthread_self(void);
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
// This is technically an implementation detail, but we require this for testing.
|
||||
// The key always has to be the first struct member.
|
||||
struct search_tree_node {
|
||||
const void* key;
|
||||
void const* key;
|
||||
struct search_tree_node* left;
|
||||
struct search_tree_node* right;
|
||||
};
|
||||
|
||||
struct search_tree_node* new_tree_node(const void* key);
|
||||
struct search_tree_node* new_tree_node(void const* key);
|
||||
void delete_node_recursive(struct search_tree_node* node);
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
void clear_err() { m_error = 0; }
|
||||
|
||||
size_t read(u8*, size_t);
|
||||
size_t write(const u8*, size_t);
|
||||
size_t write(u8 const*, size_t);
|
||||
|
||||
template<typename CharType>
|
||||
bool gets(CharType*, size_t);
|
||||
|
@ -84,7 +84,7 @@ private:
|
|||
bool is_not_empty() const { return m_ungotten || !m_empty; }
|
||||
size_t buffered_size() const;
|
||||
|
||||
const u8* begin_dequeue(size_t& available_size) const;
|
||||
u8 const* begin_dequeue(size_t& available_size) const;
|
||||
void did_dequeue(size_t actual_size);
|
||||
|
||||
u8* begin_enqueue(size_t& available_size) const;
|
||||
|
@ -114,7 +114,7 @@ private:
|
|||
|
||||
// Read or write using the underlying fd, bypassing the buffer.
|
||||
ssize_t do_read(u8*, size_t);
|
||||
ssize_t do_write(const u8*, size_t);
|
||||
ssize_t do_write(u8 const*, size_t);
|
||||
|
||||
// Read some data into the buffer.
|
||||
bool read_into_buffer();
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
extern "C" {
|
||||
|
||||
const char _ctype_[256] = {
|
||||
char const _ctype_[256] = {
|
||||
_C, _C, _C, _C, _C, _C, _C, _C,
|
||||
_C, _C | _S, _C | _S, _C | _S, _C | _S, _C | _S, _C, _C,
|
||||
_C, _C, _C, _C, _C, _C, _C, _C,
|
||||
|
|
|
@ -20,7 +20,7 @@ __BEGIN_DECLS
|
|||
#define _X 0100
|
||||
#define _B 0200
|
||||
|
||||
extern const char _ctype_[256];
|
||||
extern char const _ctype_[256];
|
||||
|
||||
static inline int __inline_isalnum(int c)
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
extern "C" {
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/opendir.html
|
||||
DIR* opendir(const char* name)
|
||||
DIR* opendir(char const* name)
|
||||
{
|
||||
int fd = open(name, O_RDONLY | O_DIRECTORY);
|
||||
if (fd == -1)
|
||||
|
@ -229,7 +229,7 @@ int alphasort(const struct dirent** d1, const struct dirent** d2)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/scandir.html
|
||||
int scandir(const char* dir_name,
|
||||
int scandir(char const* dir_name,
|
||||
struct dirent*** namelist,
|
||||
int (*select)(const struct dirent*),
|
||||
int (*compare)(const struct dirent**, const struct dirent**))
|
||||
|
@ -273,10 +273,10 @@ int scandir(const char* dir_name,
|
|||
|
||||
// Sort the entries if the user provided a comparator.
|
||||
if (compare) {
|
||||
qsort(tmp_names.data(), tmp_names.size(), sizeof(struct dirent*), (int (*)(const void*, const void*))compare);
|
||||
qsort(tmp_names.data(), tmp_names.size(), sizeof(struct dirent*), (int (*)(void const*, void const*))compare);
|
||||
}
|
||||
|
||||
const int size = tmp_names.size();
|
||||
int const size = tmp_names.size();
|
||||
auto** names = static_cast<struct dirent**>(kmalloc_array(size, sizeof(struct dirent*)));
|
||||
if (names == nullptr) {
|
||||
return -1;
|
||||
|
|
|
@ -28,7 +28,7 @@ struct __DIR {
|
|||
typedef struct __DIR DIR;
|
||||
|
||||
DIR* fdopendir(int fd);
|
||||
DIR* opendir(const char* name);
|
||||
DIR* opendir(char const* name);
|
||||
int closedir(DIR*);
|
||||
void rewinddir(DIR*);
|
||||
struct dirent* readdir(DIR*);
|
||||
|
@ -36,7 +36,7 @@ int readdir_r(DIR*, struct dirent*, struct dirent**);
|
|||
int dirfd(DIR*);
|
||||
|
||||
int alphasort(const struct dirent** d1, const struct dirent** d2);
|
||||
int scandir(const char* dirp, struct dirent*** namelist,
|
||||
int scandir(char const* dirp, struct dirent*** namelist,
|
||||
int (*filter)(const struct dirent*),
|
||||
int (*compar)(const struct dirent**, const struct dirent**));
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ typedef struct elfhdr {
|
|||
Elf32_Half e_shentsize; /* section header entry size */
|
||||
Elf32_Half e_shnum; /* number of section header entries */
|
||||
Elf32_Half e_shstrndx; /* section header table's "section
|
||||
header string table" entry offset */
|
||||
header string table" entry offset */
|
||||
} Elf32_Ehdr;
|
||||
|
||||
typedef struct {
|
||||
|
@ -223,7 +223,7 @@ typedef struct {
|
|||
/* Section Header */
|
||||
typedef struct {
|
||||
Elf32_Word sh_name; /* name - index into section header
|
||||
string table section */
|
||||
string table section */
|
||||
Elf32_Word sh_type; /* type */
|
||||
Elf32_Word sh_flags; /* flags */
|
||||
Elf32_Addr sh_addr; /* address */
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
extern const char* const sys_errlist[];
|
||||
extern char const* const sys_errlist[];
|
||||
extern int sys_nerr;
|
||||
|
||||
#ifdef NO_TLS
|
||||
|
|
|
@ -30,7 +30,7 @@ int create_inode_watcher(unsigned flags)
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int inode_watcher_add_watch(int fd, const char* path, size_t path_length, unsigned event_mask)
|
||||
int inode_watcher_add_watch(int fd, char const* path, size_t path_length, unsigned event_mask)
|
||||
{
|
||||
Syscall::SC_inode_watcher_add_watch_params params { { path, path_length }, fd, event_mask };
|
||||
int rc = syscall(SC_inode_watcher_add_watch, ¶ms);
|
||||
|
@ -43,12 +43,12 @@ int inode_watcher_remove_watch(int fd, int wd)
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int creat(const char* path, mode_t mode)
|
||||
int creat(char const* path, mode_t mode)
|
||||
{
|
||||
return open(path, O_CREAT | O_WRONLY | O_TRUNC, mode);
|
||||
}
|
||||
|
||||
int open(const char* path, int options, ...)
|
||||
int open(char const* path, int options, ...)
|
||||
{
|
||||
if (!path) {
|
||||
errno = EFAULT;
|
||||
|
@ -68,7 +68,7 @@ int open(const char* path, int options, ...)
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int openat(int dirfd, const char* path, int options, ...)
|
||||
int openat(int dirfd, char const* path, int options, ...)
|
||||
{
|
||||
if (!path) {
|
||||
errno = EFAULT;
|
||||
|
|
|
@ -11,13 +11,13 @@
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
int creat(const char* path, mode_t);
|
||||
int open(const char* path, int options, ...);
|
||||
int openat(int dirfd, const char* path, int options, ...);
|
||||
int creat(char const* path, mode_t);
|
||||
int open(char const* path, int options, ...);
|
||||
int openat(int dirfd, char const* path, int options, ...);
|
||||
|
||||
int fcntl(int fd, int cmd, ...);
|
||||
int create_inode_watcher(unsigned flags);
|
||||
int inode_watcher_add_watch(int fd, const char* path, size_t path_length, unsigned event_mask);
|
||||
int inode_watcher_add_watch(int fd, char const* path, size_t path_length, unsigned event_mask);
|
||||
int inode_watcher_remove_watch(int fd, int wd);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -61,7 +61,7 @@ int fegetenv(fenv_t* env)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int fesetenv(const fenv_t* env)
|
||||
int fesetenv(fenv_t const* env)
|
||||
{
|
||||
if (!env)
|
||||
return 1;
|
||||
|
@ -96,7 +96,7 @@ int feholdexcept(fenv_t* env)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int feupdateenv(const fenv_t* env)
|
||||
int feupdateenv(fenv_t const* env)
|
||||
{
|
||||
auto currently_raised_exceptions = fetestexcept(FE_ALL_EXCEPT);
|
||||
|
||||
|
@ -113,7 +113,7 @@ int fegetexceptflag(fexcept_t* except, int exceptions)
|
|||
*except = (uint16_t)fetestexcept(exceptions);
|
||||
return 0;
|
||||
}
|
||||
int fesetexceptflag(const fexcept_t* except, int exceptions)
|
||||
int fesetexceptflag(fexcept_t const* except, int exceptions)
|
||||
{
|
||||
if (!except)
|
||||
return 1;
|
||||
|
|
|
@ -32,12 +32,12 @@ typedef struct fenv_t {
|
|||
uint32_t __mxcsr;
|
||||
} fenv_t;
|
||||
|
||||
#define FE_DFL_ENV ((const fenv_t*)-1)
|
||||
#define FE_DFL_ENV ((fenv_t const*)-1)
|
||||
|
||||
int fegetenv(fenv_t*);
|
||||
int fesetenv(const fenv_t*);
|
||||
int fesetenv(fenv_t const*);
|
||||
int feholdexcept(fenv_t*);
|
||||
int feupdateenv(const fenv_t*);
|
||||
int feupdateenv(fenv_t const*);
|
||||
|
||||
#define FE_INVALID 1u << 0
|
||||
#define FE_DIVBYZERO 1u << 2
|
||||
|
@ -48,7 +48,7 @@ int feupdateenv(const fenv_t*);
|
|||
|
||||
typedef uint16_t fexcept_t;
|
||||
int fegetexceptflag(fexcept_t*, int exceptions);
|
||||
int fesetexceptflag(const fexcept_t*, int exceptions);
|
||||
int fesetexceptflag(fexcept_t const*, int exceptions);
|
||||
|
||||
int feclearexcept(int exceptions);
|
||||
int fetestexcept(int exceptions);
|
||||
|
|
|
@ -22,7 +22,7 @@ char* optarg = nullptr;
|
|||
// processed". Well, this is how we do it.
|
||||
static size_t s_index_into_multioption_argument = 0;
|
||||
|
||||
[[gnu::format(printf, 1, 2)]] static inline void report_error(const char* format, ...)
|
||||
[[gnu::format(printf, 1, 2)]] static inline void report_error(char const* format, ...)
|
||||
{
|
||||
if (!opterr)
|
||||
return;
|
||||
|
@ -41,14 +41,14 @@ namespace {
|
|||
|
||||
class OptionParser {
|
||||
public:
|
||||
OptionParser(int argc, char* const* argv, StringView short_options, const option* long_options, int* out_long_option_index = nullptr);
|
||||
OptionParser(int argc, char* const* argv, StringView short_options, option const* long_options, int* out_long_option_index = nullptr);
|
||||
int getopt();
|
||||
|
||||
private:
|
||||
bool lookup_short_option(char option, int& needs_value) const;
|
||||
int handle_short_option();
|
||||
|
||||
const option* lookup_long_option(char* raw) const;
|
||||
option const* lookup_long_option(char* raw) const;
|
||||
int handle_long_option();
|
||||
|
||||
void shift_argv();
|
||||
|
@ -57,7 +57,7 @@ private:
|
|||
size_t m_argc { 0 };
|
||||
char* const* m_argv { nullptr };
|
||||
StringView m_short_options;
|
||||
const option* m_long_options { nullptr };
|
||||
option const* m_long_options { nullptr };
|
||||
int* m_out_long_option_index { nullptr };
|
||||
bool m_stop_on_first_non_option { false };
|
||||
|
||||
|
@ -65,7 +65,7 @@ private:
|
|||
size_t m_consumed_args { 0 };
|
||||
};
|
||||
|
||||
OptionParser::OptionParser(int argc, char* const* argv, StringView short_options, const option* long_options, int* out_long_option_index)
|
||||
OptionParser::OptionParser(int argc, char* const* argv, StringView short_options, option const* long_options, int* out_long_option_index)
|
||||
: m_argc(argc)
|
||||
, m_argv(argv)
|
||||
, m_short_options(short_options)
|
||||
|
@ -204,7 +204,7 @@ int OptionParser::handle_short_option()
|
|||
return option;
|
||||
}
|
||||
|
||||
const option* OptionParser::lookup_long_option(char* raw) const
|
||||
option const* OptionParser::lookup_long_option(char* raw) const
|
||||
{
|
||||
StringView arg = raw;
|
||||
|
||||
|
@ -336,14 +336,14 @@ bool OptionParser::find_next_option()
|
|||
|
||||
}
|
||||
|
||||
int getopt(int argc, char* const* argv, const char* short_options)
|
||||
int getopt(int argc, char* const* argv, char const* short_options)
|
||||
{
|
||||
option dummy { nullptr, 0, nullptr, 0 };
|
||||
OptionParser parser { argc, argv, short_options, &dummy };
|
||||
return parser.getopt();
|
||||
}
|
||||
|
||||
int getopt_long(int argc, char* const* argv, const char* short_options, const struct option* long_options, int* out_long_option_index)
|
||||
int getopt_long(int argc, char* const* argv, char const* short_options, const struct option* long_options, int* out_long_option_index)
|
||||
{
|
||||
OptionParser parser { argc, argv, short_options, long_options, out_long_option_index };
|
||||
return parser.getopt();
|
||||
|
|
|
@ -15,7 +15,7 @@ __BEGIN_DECLS
|
|||
#define optional_argument 2
|
||||
|
||||
struct option {
|
||||
const char* name;
|
||||
char const* name;
|
||||
int has_arg;
|
||||
int* flag;
|
||||
int val;
|
||||
|
@ -26,6 +26,6 @@ extern int optopt;
|
|||
extern int optind;
|
||||
extern int optreset;
|
||||
extern char* optarg;
|
||||
int getopt_long(int argc, char* const* argv, const char* short_options, const struct option* long_options, int* out_long_option_index);
|
||||
int getopt_long(int argc, char* const* argv, char const* short_options, const struct option* long_options, int* out_long_option_index);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -24,7 +24,7 @@ static struct group s_group;
|
|||
static String s_name;
|
||||
static String s_passwd;
|
||||
static Vector<String> s_members;
|
||||
static Vector<const char*> s_members_ptrs;
|
||||
static Vector<char const*> s_members_ptrs;
|
||||
|
||||
void setgrent()
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ struct group* getgrgid(gid_t gid)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
struct group* getgrnam(const char* name)
|
||||
struct group* getgrnam(char const* name)
|
||||
{
|
||||
setgrent();
|
||||
while (auto* gr = getgrent()) {
|
||||
|
@ -75,7 +75,7 @@ struct group* getgrnam(const char* name)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
static bool parse_grpdb_entry(const String& line)
|
||||
static bool parse_grpdb_entry(String const& line)
|
||||
{
|
||||
auto parts = line.split_view(':', true);
|
||||
if (parts.size() != 4) {
|
||||
|
@ -140,7 +140,7 @@ struct group* getgrent()
|
|||
}
|
||||
}
|
||||
|
||||
int initgroups(const char* user, gid_t extra_gid)
|
||||
int initgroups(char const* user, gid_t extra_gid)
|
||||
{
|
||||
size_t count = 0;
|
||||
gid_t gids[32];
|
||||
|
@ -169,7 +169,7 @@ int putgrent(const struct group* group, FILE* stream)
|
|||
return -1;
|
||||
}
|
||||
|
||||
auto is_valid_field = [](const char* str) {
|
||||
auto is_valid_field = [](char const* str) {
|
||||
return str && !strpbrk(str, ":\n");
|
||||
};
|
||||
|
||||
|
|
|
@ -23,10 +23,10 @@ struct group {
|
|||
struct group* getgrent(void);
|
||||
void setgrent(void);
|
||||
void endgrent(void);
|
||||
struct group* getgrnam(const char* name);
|
||||
struct group* getgrnam(char const* name);
|
||||
struct group* getgrgid(gid_t);
|
||||
int putgrent(const struct group*, FILE*);
|
||||
|
||||
int initgroups(const char* user, gid_t);
|
||||
int initgroups(char const* user, gid_t);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -13,7 +13,7 @@ __BEGIN_DECLS
|
|||
|
||||
typedef void* iconv_t;
|
||||
|
||||
extern iconv_t iconv_open(const char* tocode, const char* fromcode);
|
||||
extern iconv_t iconv_open(char const* tocode, char const* fromcode);
|
||||
extern size_t iconv(iconv_t, char** inbuf, size_t* inbytesleft, char** outbuf, size_t* outbytesleft);
|
||||
extern int iconv_close(iconv_t);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ imaxdiv_t imaxdiv(intmax_t numerator, intmax_t denominator)
|
|||
return result;
|
||||
}
|
||||
|
||||
intmax_t strtoimax(const char* str, char** endptr, int base)
|
||||
intmax_t strtoimax(char const* str, char** endptr, int base)
|
||||
{
|
||||
long long_value = strtoll(str, endptr, base);
|
||||
|
||||
|
@ -42,7 +42,7 @@ intmax_t strtoimax(const char* str, char** endptr, int base)
|
|||
return long_value;
|
||||
}
|
||||
|
||||
uintmax_t strtoumax(const char* str, char** endptr, int base)
|
||||
uintmax_t strtoumax(char const* str, char** endptr, int base)
|
||||
{
|
||||
unsigned long ulong_value = strtoull(str, endptr, base);
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ typedef struct imaxdiv_t {
|
|||
} imaxdiv_t;
|
||||
imaxdiv_t imaxdiv(intmax_t, intmax_t);
|
||||
|
||||
intmax_t strtoimax(const char*, char** endptr, int base);
|
||||
uintmax_t strtoumax(const char*, char** endptr, int base);
|
||||
intmax_t strtoimax(char const*, char** endptr, int base);
|
||||
uintmax_t strtoumax(char const*, char** endptr, int base);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <langinfo.h>
|
||||
|
||||
// Values taken from glibc's en_US locale files.
|
||||
static const char* __nl_langinfo(nl_item item)
|
||||
static char const* __nl_langinfo(nl_item item)
|
||||
{
|
||||
switch (item) {
|
||||
case CODESET:
|
||||
|
|
|
@ -18,7 +18,7 @@ __BEGIN_DECLS
|
|||
|
||||
struct dl_phdr_info {
|
||||
ElfW(Addr) dlpi_addr;
|
||||
const char* dlpi_name;
|
||||
char const* dlpi_name;
|
||||
const ElfW(Phdr) * dlpi_phdr;
|
||||
ElfW(Half) dlpi_phnum;
|
||||
};
|
||||
|
|
|
@ -45,7 +45,7 @@ static struct lconv default_locale = {
|
|||
default_empty_value
|
||||
};
|
||||
|
||||
char* setlocale(int, const char*)
|
||||
char* setlocale(int, char const*)
|
||||
{
|
||||
static char locale[2];
|
||||
memcpy(locale, "C", 2);
|
||||
|
|
|
@ -55,6 +55,6 @@ struct lconv {
|
|||
};
|
||||
|
||||
struct lconv* localeconv(void);
|
||||
char* setlocale(int category, const char* locale);
|
||||
char* setlocale(int category, char const* locale);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -56,25 +56,25 @@ static bool s_scrub_free = true;
|
|||
static bool s_profiling = false;
|
||||
static bool s_in_userspace_emulator = false;
|
||||
|
||||
ALWAYS_INLINE static void ue_notify_malloc(const void* ptr, size_t size)
|
||||
ALWAYS_INLINE static void ue_notify_malloc(void const* ptr, size_t size)
|
||||
{
|
||||
if (s_in_userspace_emulator)
|
||||
syscall(SC_emuctl, 1, size, (FlatPtr)ptr);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE static void ue_notify_free(const void* ptr)
|
||||
ALWAYS_INLINE static void ue_notify_free(void const* ptr)
|
||||
{
|
||||
if (s_in_userspace_emulator)
|
||||
syscall(SC_emuctl, 2, (FlatPtr)ptr, 0);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE static void ue_notify_realloc(const void* ptr, size_t size)
|
||||
ALWAYS_INLINE static void ue_notify_realloc(void const* ptr, size_t size)
|
||||
{
|
||||
if (s_in_userspace_emulator)
|
||||
syscall(SC_emuctl, 3, size, (FlatPtr)ptr);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE static void ue_notify_chunk_size_changed(const void* block, size_t chunk_size)
|
||||
ALWAYS_INLINE static void ue_notify_chunk_size_changed(void const* block, size_t chunk_size)
|
||||
{
|
||||
if (s_in_userspace_emulator)
|
||||
syscall(SC_emuctl, 4, chunk_size, (FlatPtr)block);
|
||||
|
@ -176,7 +176,7 @@ static BigAllocator* big_allocator_for_size(size_t size)
|
|||
|
||||
extern "C" {
|
||||
|
||||
static void* os_alloc(size_t size, const char* name)
|
||||
static void* os_alloc(size_t size, char const* name)
|
||||
{
|
||||
int flags = MAP_ANONYMOUS | MAP_PRIVATE | MAP_PURGEABLE;
|
||||
#if ARCH(X86_64)
|
||||
|
@ -525,7 +525,7 @@ size_t malloc_size(void const* ptr)
|
|||
if (!ptr)
|
||||
return 0;
|
||||
void* page_base = (void*)((FlatPtr)ptr & ChunkedBlock::block_mask);
|
||||
auto* header = (const CommonHeader*)page_base;
|
||||
auto* header = (CommonHeader const*)page_base;
|
||||
auto size = header->m_size;
|
||||
if (header->m_magic == MAGIC_BIGALLOC_HEADER)
|
||||
size -= sizeof(BigAllocationBlock);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
const in6_addr in6addr_any = IN6ADDR_ANY_INIT;
|
||||
const in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
|
||||
|
||||
unsigned int if_nametoindex([[maybe_unused]] const char* ifname)
|
||||
unsigned int if_nametoindex([[maybe_unused]] char const* ifname)
|
||||
{
|
||||
errno = ENODEV;
|
||||
return -1;
|
||||
|
|
|
@ -37,9 +37,9 @@ static constexpr u32 lookup_server_endpoint_magic = "LookupServer"sv.hash();
|
|||
|
||||
// Get service entry buffers and file information for the getservent() family of functions.
|
||||
static FILE* services_file = nullptr;
|
||||
static const char* services_path = "/etc/services";
|
||||
static char const* services_path = "/etc/services";
|
||||
|
||||
static bool fill_getserv_buffers(const char* line, ssize_t read);
|
||||
static bool fill_getserv_buffers(char const* line, ssize_t read);
|
||||
static servent __getserv_buffer;
|
||||
static String __getserv_name_buffer;
|
||||
static String __getserv_protocol_buffer;
|
||||
|
@ -51,9 +51,9 @@ static ssize_t service_file_offset = 0;
|
|||
|
||||
// Get protocol entry buffers and file information for the getprotent() family of functions.
|
||||
static FILE* protocols_file = nullptr;
|
||||
static const char* protocols_path = "/etc/protocols";
|
||||
static char const* protocols_path = "/etc/protocols";
|
||||
|
||||
static bool fill_getproto_buffers(const char* line, ssize_t read);
|
||||
static bool fill_getproto_buffers(char const* line, ssize_t read);
|
||||
static protoent __getproto_buffer;
|
||||
static String __getproto_name_buffer;
|
||||
static Vector<ByteBuffer> __getproto_alias_list_buffer;
|
||||
|
@ -75,7 +75,7 @@ static int connect_to_lookup_server()
|
|||
"/tmp/portal/lookup"
|
||||
};
|
||||
|
||||
if (connect(fd, (const sockaddr*)&address, sizeof(address)) < 0) {
|
||||
if (connect(fd, (sockaddr const*)&address, sizeof(address)) < 0) {
|
||||
perror("connect_to_lookup_server");
|
||||
close(fd);
|
||||
return -1;
|
||||
|
@ -85,7 +85,7 @@ static int connect_to_lookup_server()
|
|||
|
||||
static String gethostbyname_name_buffer;
|
||||
|
||||
hostent* gethostbyname(const char* name)
|
||||
hostent* gethostbyname(char const* name)
|
||||
{
|
||||
h_errno = 0;
|
||||
|
||||
|
@ -205,7 +205,7 @@ hostent* gethostbyname(const char* name)
|
|||
|
||||
static String gethostbyaddr_name_buffer;
|
||||
|
||||
hostent* gethostbyaddr(const void* addr, socklen_t addr_size, int type)
|
||||
hostent* gethostbyaddr(void const* addr, socklen_t addr_size, int type)
|
||||
{
|
||||
h_errno = 0;
|
||||
|
||||
|
@ -229,7 +229,7 @@ hostent* gethostbyaddr(const void* addr, socklen_t addr_size, int type)
|
|||
close(fd);
|
||||
});
|
||||
|
||||
const in_addr_t& in_addr = ((const struct in_addr*)addr)->s_addr;
|
||||
in_addr_t const& in_addr = ((const struct in_addr*)addr)->s_addr;
|
||||
|
||||
struct [[gnu::packed]] {
|
||||
u32 message_size;
|
||||
|
@ -367,7 +367,7 @@ struct servent* getservent()
|
|||
return service_entry;
|
||||
}
|
||||
|
||||
struct servent* getservbyname(const char* name, const char* protocol)
|
||||
struct servent* getservbyname(char const* name, char const* protocol)
|
||||
{
|
||||
if (name == nullptr)
|
||||
return nullptr;
|
||||
|
@ -394,7 +394,7 @@ struct servent* getservbyname(const char* name, const char* protocol)
|
|||
return current_service;
|
||||
}
|
||||
|
||||
struct servent* getservbyport(int port, const char* protocol)
|
||||
struct servent* getservbyport(int port, char const* protocol)
|
||||
{
|
||||
bool previous_file_open_setting = keep_service_file_open;
|
||||
setservent(1);
|
||||
|
@ -444,7 +444,7 @@ void endservent()
|
|||
// Fill the service entry buffer with the information contained
|
||||
// in the currently read line, returns true if successful,
|
||||
// false if failure occurs.
|
||||
static bool fill_getserv_buffers(const char* line, ssize_t read)
|
||||
static bool fill_getserv_buffers(char const* line, ssize_t read)
|
||||
{
|
||||
// Splitting the line by tab delimiter and filling the servent buffers name, port, and protocol members.
|
||||
auto split_line = StringView(line, read).replace(" ", "\t", true).split('\t');
|
||||
|
@ -555,7 +555,7 @@ struct protoent* getprotoent()
|
|||
return protocol_entry;
|
||||
}
|
||||
|
||||
struct protoent* getprotobyname(const char* name)
|
||||
struct protoent* getprotobyname(char const* name)
|
||||
{
|
||||
bool previous_file_open_setting = keep_protocols_file_open;
|
||||
setprotoent(1);
|
||||
|
@ -623,7 +623,7 @@ void endprotoent()
|
|||
protocols_file = nullptr;
|
||||
}
|
||||
|
||||
static bool fill_getproto_buffers(const char* line, ssize_t read)
|
||||
static bool fill_getproto_buffers(char const* line, ssize_t read)
|
||||
{
|
||||
String string_line = String(line, read);
|
||||
auto split_line = string_line.replace(" ", "\t", true).split('\t');
|
||||
|
@ -660,7 +660,7 @@ static bool fill_getproto_buffers(const char* line, ssize_t read)
|
|||
return true;
|
||||
}
|
||||
|
||||
int getaddrinfo(const char* __restrict node, const char* __restrict service, const struct addrinfo* __restrict hints, struct addrinfo** __restrict res)
|
||||
int getaddrinfo(char const* __restrict node, char const* __restrict service, const struct addrinfo* __restrict hints, struct addrinfo** __restrict res)
|
||||
{
|
||||
*res = nullptr;
|
||||
|
||||
|
@ -678,7 +678,7 @@ int getaddrinfo(const char* __restrict node, const char* __restrict service, con
|
|||
if (!host_ent)
|
||||
return EAI_FAIL;
|
||||
|
||||
const char* proto = nullptr;
|
||||
char const* proto = nullptr;
|
||||
if (hints && hints->ai_socktype) {
|
||||
switch (hints->ai_socktype) {
|
||||
case SOCK_STREAM:
|
||||
|
@ -767,7 +767,7 @@ void freeaddrinfo(struct addrinfo* res)
|
|||
}
|
||||
}
|
||||
|
||||
const char* gai_strerror(int errcode)
|
||||
char const* gai_strerror(int errcode)
|
||||
{
|
||||
switch (errcode) {
|
||||
case EAI_ADDRFAMILY:
|
||||
|
@ -804,7 +804,7 @@ int getnameinfo(const struct sockaddr* __restrict addr, socklen_t addrlen, char*
|
|||
if (addr->sa_family != AF_INET || addrlen < sizeof(sockaddr_in))
|
||||
return EAI_FAMILY;
|
||||
|
||||
const sockaddr_in* sin = reinterpret_cast<const sockaddr_in*>(addr);
|
||||
sockaddr_in const* sin = reinterpret_cast<sockaddr_in const*>(addr);
|
||||
|
||||
if (host && hostlen > 0) {
|
||||
if (flags != 0)
|
||||
|
|
|
@ -20,8 +20,8 @@ struct hostent {
|
|||
#define h_addr h_addr_list[0]
|
||||
};
|
||||
|
||||
struct hostent* gethostbyname(const char*);
|
||||
struct hostent* gethostbyaddr(const void* addr, socklen_t len, int type);
|
||||
struct hostent* gethostbyname(char const*);
|
||||
struct hostent* gethostbyaddr(void const* addr, socklen_t len, int type);
|
||||
|
||||
struct servent {
|
||||
char* s_name;
|
||||
|
@ -31,8 +31,8 @@ struct servent {
|
|||
};
|
||||
|
||||
struct servent* getservent(void);
|
||||
struct servent* getservbyname(const char* name, const char* protocol);
|
||||
struct servent* getservbyport(int port, const char* protocol);
|
||||
struct servent* getservbyname(char const* name, char const* protocol);
|
||||
struct servent* getservbyport(int port, char const* protocol);
|
||||
void setservent(int stay_open);
|
||||
void endservent(void);
|
||||
|
||||
|
@ -43,7 +43,7 @@ struct protoent {
|
|||
};
|
||||
|
||||
void endprotoent(void);
|
||||
struct protoent* getprotobyname(const char* name);
|
||||
struct protoent* getprotobyname(char const* name);
|
||||
struct protoent* getprotobynumber(int proto);
|
||||
struct protoent* getprotoent(void);
|
||||
void setprotoent(int stay_open);
|
||||
|
@ -96,9 +96,9 @@ struct addrinfo {
|
|||
#define NI_NOFQDN 4
|
||||
#define NI_DGRAM 5
|
||||
|
||||
int getaddrinfo(const char* __restrict node, const char* __restrict service, const struct addrinfo* __restrict hints, struct addrinfo** __restrict res);
|
||||
int getaddrinfo(char const* __restrict node, char const* __restrict service, const struct addrinfo* __restrict hints, struct addrinfo** __restrict res);
|
||||
void freeaddrinfo(struct addrinfo* res);
|
||||
const char* gai_strerror(int errcode);
|
||||
char const* gai_strerror(int errcode);
|
||||
int getnameinfo(const struct sockaddr* __restrict addr, socklen_t addrlen, char* __restrict host, socklen_t hostlen, char* __restrict serv, socklen_t servlen, int flags);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -23,7 +23,7 @@ int poll(pollfd* fds, nfds_t nfds, int timeout_ms)
|
|||
return ppoll(fds, nfds, timeout_ts, nullptr);
|
||||
}
|
||||
|
||||
int ppoll(pollfd* fds, nfds_t nfds, const timespec* timeout, const sigset_t* sigmask)
|
||||
int ppoll(pollfd* fds, nfds_t nfds, timespec const* timeout, sigset_t const* sigmask)
|
||||
{
|
||||
Syscall::SC_poll_params params { fds, nfds, timeout, sigmask };
|
||||
int rc = syscall(SC_poll, ¶ms);
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
__BEGIN_DECLS
|
||||
|
||||
int poll(struct pollfd* fds, nfds_t nfds, int timeout);
|
||||
int ppoll(struct pollfd* fds, nfds_t nfds, const struct timespec* timeout, const sigset_t* sigmask);
|
||||
int ppoll(struct pollfd* fds, nfds_t nfds, const struct timespec* timeout, sigset_t const* sigmask);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -56,7 +56,7 @@ int pthread_cond_broadcast(pthread_cond_t* cond)
|
|||
return s_pthread_functions.pthread_cond_broadcast(cond);
|
||||
}
|
||||
|
||||
int pthread_cond_init(pthread_cond_t* cond, const pthread_condattr_t* attr)
|
||||
int pthread_cond_init(pthread_cond_t* cond, pthread_condattr_t const* attr)
|
||||
{
|
||||
VERIFY(s_pthread_functions.pthread_cond_init);
|
||||
return s_pthread_functions.pthread_cond_init(cond, attr);
|
||||
|
|
|
@ -97,7 +97,7 @@ static constexpr u32 MUTEX_UNLOCKED = 0;
|
|||
static constexpr u32 MUTEX_LOCKED_NO_NEED_TO_WAKE = 1;
|
||||
static constexpr u32 MUTEX_LOCKED_NEED_TO_WAKE = 2;
|
||||
|
||||
int __pthread_mutex_init(pthread_mutex_t* mutex, const pthread_mutexattr_t* attributes)
|
||||
int __pthread_mutex_init(pthread_mutex_t* mutex, pthread_mutexattr_t const* attributes)
|
||||
{
|
||||
mutex->lock = 0;
|
||||
mutex->owner = 0;
|
||||
|
@ -106,7 +106,7 @@ int __pthread_mutex_init(pthread_mutex_t* mutex, const pthread_mutexattr_t* attr
|
|||
return 0;
|
||||
}
|
||||
|
||||
int pthread_mutex_init(pthread_mutex_t*, const pthread_mutexattr_t*) __attribute__((weak, alias("__pthread_mutex_init")));
|
||||
int pthread_mutex_init(pthread_mutex_t*, pthread_mutexattr_t const*) __attribute__((weak, alias("__pthread_mutex_init")));
|
||||
|
||||
int __pthread_mutex_trylock(pthread_mutex_t* mutex)
|
||||
{
|
||||
|
|
|
@ -68,7 +68,7 @@ void* __pthread_getspecific(pthread_key_t key)
|
|||
|
||||
void* pthread_getspecific(pthread_key_t) __attribute__((weak, alias("__pthread_getspecific")));
|
||||
|
||||
int __pthread_setspecific(pthread_key_t key, const void* value)
|
||||
int __pthread_setspecific(pthread_key_t key, void const* value)
|
||||
{
|
||||
if (key < 0)
|
||||
return EINVAL;
|
||||
|
@ -79,7 +79,7 @@ int __pthread_setspecific(pthread_key_t key, const void* value)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int pthread_setspecific(pthread_key_t, const void*) __attribute__((weak, alias("__pthread_setspecific")));
|
||||
int pthread_setspecific(pthread_key_t, void const*) __attribute__((weak, alias("__pthread_setspecific")));
|
||||
|
||||
void __pthread_key_destroy_for_current_thread()
|
||||
{
|
||||
|
|
|
@ -66,7 +66,7 @@ struct passwd* getpwuid(uid_t uid)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
struct passwd* getpwnam(const char* name)
|
||||
struct passwd* getpwnam(char const* name)
|
||||
{
|
||||
setpwent();
|
||||
while (auto* pw = getpwent()) {
|
||||
|
@ -76,7 +76,7 @@ struct passwd* getpwnam(const char* name)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
static bool parse_pwddb_entry(const String& line)
|
||||
static bool parse_pwddb_entry(String const& line)
|
||||
{
|
||||
auto parts = line.split_view(':', true);
|
||||
if (parts.size() != 7) {
|
||||
|
@ -168,7 +168,7 @@ static void construct_pwd(struct passwd* pwd, char* buf, struct passwd** result)
|
|||
pwd->pw_shell = buf_shell;
|
||||
}
|
||||
|
||||
int getpwnam_r(const char* name, struct passwd* pwd, char* buf, size_t buflen, struct passwd** result)
|
||||
int getpwnam_r(char const* name, struct passwd* pwd, char* buf, size_t buflen, struct passwd** result)
|
||||
{
|
||||
// FIXME: This is a HACK!
|
||||
TemporaryChange name_change { s_name, {} };
|
||||
|
@ -191,7 +191,7 @@ int getpwnam_r(const char* name, struct passwd* pwd, char* buf, size_t buflen, s
|
|||
return 0;
|
||||
}
|
||||
|
||||
const auto total_buffer_length = s_name.length() + s_passwd.length() + s_gecos.length() + s_dir.length() + s_shell.length() + 5;
|
||||
auto const total_buffer_length = s_name.length() + s_passwd.length() + s_gecos.length() + s_dir.length() + s_shell.length() + 5;
|
||||
if (buflen < total_buffer_length)
|
||||
return ERANGE;
|
||||
|
||||
|
@ -222,7 +222,7 @@ int getpwuid_r(uid_t uid, struct passwd* pwd, char* buf, size_t buflen, struct p
|
|||
return 0;
|
||||
}
|
||||
|
||||
const auto total_buffer_length = s_name.length() + s_passwd.length() + s_gecos.length() + s_dir.length() + s_shell.length() + 5;
|
||||
auto const total_buffer_length = s_name.length() + s_passwd.length() + s_gecos.length() + s_dir.length() + s_shell.length() + 5;
|
||||
if (buflen < total_buffer_length)
|
||||
return ERANGE;
|
||||
|
||||
|
@ -237,7 +237,7 @@ int putpwent(const struct passwd* p, FILE* stream)
|
|||
return -1;
|
||||
}
|
||||
|
||||
auto is_valid_field = [](const char* str) {
|
||||
auto is_valid_field = [](char const* str) {
|
||||
return str && !strpbrk(str, ":\n");
|
||||
};
|
||||
|
||||
|
|
|
@ -25,11 +25,11 @@ struct passwd {
|
|||
struct passwd* getpwent(void);
|
||||
void setpwent(void);
|
||||
void endpwent(void);
|
||||
struct passwd* getpwnam(const char* name);
|
||||
struct passwd* getpwnam(char const* name);
|
||||
struct passwd* getpwuid(uid_t);
|
||||
int putpwent(const struct passwd* p, FILE* stream);
|
||||
|
||||
int getpwnam_r(const char* name, struct passwd* pwd, char* buf, size_t buflen, struct passwd** result);
|
||||
int getpwnam_r(char const* name, struct passwd* pwd, char* buf, size_t buflen, struct passwd** result);
|
||||
int getpwuid_r(uid_t, struct passwd* pwd, char* buf, size_t buflen, struct passwd** result);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -28,12 +28,12 @@ private:
|
|||
namespace AK {
|
||||
|
||||
template<>
|
||||
inline void swap(const SizedObject& a, const SizedObject& b)
|
||||
inline void swap(SizedObject const& a, SizedObject const& b)
|
||||
{
|
||||
VERIFY(a.size() == b.size());
|
||||
const size_t size = a.size();
|
||||
const auto a_data = reinterpret_cast<char*>(a.data());
|
||||
const auto b_data = reinterpret_cast<char*>(b.data());
|
||||
auto const a_data = reinterpret_cast<char*>(a.data());
|
||||
auto const b_data = reinterpret_cast<char*>(b.data());
|
||||
for (auto i = 0u; i < size; ++i) {
|
||||
swap(a_data[i], b_data[i]);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ private:
|
|||
};
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/qsort.html
|
||||
void qsort(void* bot, size_t nmemb, size_t size, int (*compar)(const void*, const void*))
|
||||
void qsort(void* bot, size_t nmemb, size_t size, int (*compar)(void const*, void const*))
|
||||
{
|
||||
if (nmemb <= 1) {
|
||||
return;
|
||||
|
@ -68,10 +68,10 @@ void qsort(void* bot, size_t nmemb, size_t size, int (*compar)(const void*, cons
|
|||
|
||||
SizedObjectSlice slice { bot, size };
|
||||
|
||||
AK::dual_pivot_quick_sort(slice, 0, nmemb - 1, [=](const SizedObject& a, const SizedObject& b) { return compar(a.data(), b.data()) < 0; });
|
||||
AK::dual_pivot_quick_sort(slice, 0, nmemb - 1, [=](SizedObject const& a, SizedObject const& b) { return compar(a.data(), b.data()) < 0; });
|
||||
}
|
||||
|
||||
void qsort_r(void* bot, size_t nmemb, size_t size, int (*compar)(const void*, const void*, void*), void* arg)
|
||||
void qsort_r(void* bot, size_t nmemb, size_t size, int (*compar)(void const*, void const*, void*), void* arg)
|
||||
{
|
||||
if (nmemb <= 1) {
|
||||
return;
|
||||
|
@ -79,5 +79,5 @@ void qsort_r(void* bot, size_t nmemb, size_t size, int (*compar)(const void*, co
|
|||
|
||||
SizedObjectSlice slice { bot, size };
|
||||
|
||||
AK::dual_pivot_quick_sort(slice, 0, nmemb - 1, [=](const SizedObject& a, const SizedObject& b) { return compar(a.data(), b.data(), arg) < 0; });
|
||||
AK::dual_pivot_quick_sort(slice, 0, nmemb - 1, [=](SizedObject const& a, SizedObject const& b) { return compar(a.data(), b.data(), arg) < 0; });
|
||||
}
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
static void* s_libregex;
|
||||
static pthread_mutex_t s_libregex_lock;
|
||||
|
||||
static int (*s_regcomp)(regex_t*, const char*, int);
|
||||
static int (*s_regexec)(const regex_t*, const char*, size_t, regmatch_t[], int);
|
||||
static size_t (*s_regerror)(int, const regex_t*, char*, size_t);
|
||||
static int (*s_regcomp)(regex_t*, char const*, int);
|
||||
static int (*s_regexec)(regex_t const*, char const*, size_t, regmatch_t[], int);
|
||||
static size_t (*s_regerror)(int, regex_t const*, char*, size_t);
|
||||
static void (*s_regfree)(regex_t*);
|
||||
|
||||
static void ensure_libregex()
|
||||
|
@ -24,9 +24,9 @@ static void ensure_libregex()
|
|||
if (!s_libregex) {
|
||||
s_libregex = __dlopen("libregex.so", RTLD_NOW).value();
|
||||
|
||||
s_regcomp = reinterpret_cast<int (*)(regex_t*, const char*, int)>(__dlsym(s_libregex, "regcomp").value());
|
||||
s_regexec = reinterpret_cast<int (*)(const regex_t*, const char*, size_t, regmatch_t[], int)>(__dlsym(s_libregex, "regexec").value());
|
||||
s_regerror = reinterpret_cast<size_t (*)(int, const regex_t*, char*, size_t)>(__dlsym(s_libregex, "regerror").value());
|
||||
s_regcomp = reinterpret_cast<int (*)(regex_t*, char const*, int)>(__dlsym(s_libregex, "regcomp").value());
|
||||
s_regexec = reinterpret_cast<int (*)(regex_t const*, char const*, size_t, regmatch_t[], int)>(__dlsym(s_libregex, "regexec").value());
|
||||
s_regerror = reinterpret_cast<size_t (*)(int, regex_t const*, char*, size_t)>(__dlsym(s_libregex, "regerror").value());
|
||||
s_regfree = reinterpret_cast<void (*)(regex_t*)>(__dlsym(s_libregex, "regfree").value());
|
||||
}
|
||||
pthread_mutex_unlock(&s_libregex_lock);
|
||||
|
@ -34,19 +34,19 @@ static void ensure_libregex()
|
|||
|
||||
extern "C" {
|
||||
|
||||
int __attribute__((weak)) regcomp(regex_t* reg, const char* pattern, int cflags)
|
||||
int __attribute__((weak)) regcomp(regex_t* reg, char const* pattern, int cflags)
|
||||
{
|
||||
ensure_libregex();
|
||||
return s_regcomp(reg, pattern, cflags);
|
||||
}
|
||||
|
||||
int __attribute__((weak)) regexec(const regex_t* reg, const char* string, size_t nmatch, regmatch_t pmatch[], int eflags)
|
||||
int __attribute__((weak)) regexec(regex_t const* reg, char const* string, size_t nmatch, regmatch_t pmatch[], int eflags)
|
||||
{
|
||||
ensure_libregex();
|
||||
return s_regexec(reg, string, nmatch, pmatch, eflags);
|
||||
}
|
||||
|
||||
size_t __attribute__((weak)) regerror(int errcode, const regex_t* reg, char* errbuf, size_t errbuf_size)
|
||||
size_t __attribute__((weak)) regerror(int errcode, regex_t const* reg, char* errbuf, size_t errbuf_size)
|
||||
{
|
||||
ensure_libregex();
|
||||
return s_regerror(errcode, reg, errbuf, errbuf_size);
|
||||
|
|
|
@ -101,9 +101,9 @@ enum __RegexAllFlags {
|
|||
|
||||
#define REG_SEARCH __Regex_Last << 1
|
||||
|
||||
int regcomp(regex_t*, const char*, int);
|
||||
int regexec(const regex_t*, const char*, size_t, regmatch_t[], int);
|
||||
size_t regerror(int, const regex_t*, char*, size_t);
|
||||
int regcomp(regex_t*, char const*, int);
|
||||
int regexec(regex_t const*, char const*, size_t, regmatch_t[], int);
|
||||
size_t regerror(int, regex_t const*, char*, size_t);
|
||||
void regfree(regex_t*);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
int res_query(const char* dname, int class_, int type, unsigned char* answer, int anslen);
|
||||
int res_query(char const* dname, int class_, int type, unsigned char* answer, int anslen);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -384,7 +384,7 @@ private:
|
|||
size_t count { 0 };
|
||||
};
|
||||
|
||||
extern "C" int vsscanf(const char* input, const char* format, va_list ap)
|
||||
extern "C" int vsscanf(char const* input, char const* format, va_list ap)
|
||||
{
|
||||
GenericLexer format_lexer { format };
|
||||
GenericLexer input_lexer { input };
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <bits/search.h>
|
||||
#include <search.h>
|
||||
|
||||
struct search_tree_node* new_tree_node(const void* key)
|
||||
struct search_tree_node* new_tree_node(void const* key)
|
||||
{
|
||||
auto* node = static_cast<struct search_tree_node*>(malloc(sizeof(struct search_tree_node)));
|
||||
|
||||
|
@ -37,7 +37,7 @@ void delete_node_recursive(struct search_tree_node* node)
|
|||
extern "C" {
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/tsearch.html
|
||||
void* tsearch(const void* key, void** rootp, int (*comparator)(const void*, const void*))
|
||||
void* tsearch(void const* key, void** rootp, int (*comparator)(void const*, void const*))
|
||||
{
|
||||
if (!rootp)
|
||||
return nullptr;
|
||||
|
@ -71,7 +71,7 @@ void* tsearch(const void* key, void** rootp, int (*comparator)(const void*, cons
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/tfind.html
|
||||
void* tfind(const void* key, void* const* rootp, int (*comparator)(const void*, const void*))
|
||||
void* tfind(void const* key, void* const* rootp, int (*comparator)(void const*, void const*))
|
||||
{
|
||||
if (!rootp)
|
||||
return nullptr;
|
||||
|
@ -93,13 +93,13 @@ void* tfind(const void* key, void* const* rootp, int (*comparator)(const void*,
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/tdelete.html
|
||||
void* tdelete(const void*, void**, int (*)(const void*, const void*))
|
||||
void* tdelete(void const*, void**, int (*)(void const*, void const*))
|
||||
{
|
||||
dbgln("FIXME: Implement tdelete()");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void twalk_internal(const struct search_tree_node* node, void (*action)(const void*, VISIT, int), int depth)
|
||||
static void twalk_internal(const struct search_tree_node* node, void (*action)(void const*, VISIT, int), int depth)
|
||||
{
|
||||
if (!node)
|
||||
return;
|
||||
|
@ -117,7 +117,7 @@ static void twalk_internal(const struct search_tree_node* node, void (*action)(c
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/twalk.html
|
||||
void twalk(const void* rootp, void (*action)(const void*, VISIT, int))
|
||||
void twalk(void const* rootp, void (*action)(void const*, VISIT, int))
|
||||
{
|
||||
auto node = static_cast<const struct search_tree_node*>(rootp);
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@ typedef enum {
|
|||
leaf,
|
||||
} VISIT;
|
||||
|
||||
void* tsearch(const void*, void**, int (*)(const void*, const void*));
|
||||
void* tfind(const void*, void* const*, int (*)(const void*, const void*));
|
||||
void* tdelete(const void*, void**, int (*)(const void*, const void*));
|
||||
void twalk(const void*, void (*)(const void*, VISIT, int));
|
||||
void* tsearch(void const*, void**, int (*)(void const*, void const*));
|
||||
void* tfind(void const*, void* const*, int (*)(void const*, void const*));
|
||||
void* tdelete(void const*, void**, int (*)(void const*, void const*));
|
||||
void twalk(void const*, void (*)(void const*, VISIT, int));
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -101,7 +101,7 @@ int anon_create(size_t size, int options)
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int serenity_readlink(const char* path, size_t path_length, char* buffer, size_t buffer_size)
|
||||
int serenity_readlink(char const* path, size_t path_length, char* buffer, size_t buffer_size)
|
||||
{
|
||||
Syscall::SC_readlink_params small_params {
|
||||
{ path, path_length },
|
||||
|
@ -111,7 +111,7 @@ int serenity_readlink(const char* path, size_t path_length, char* buffer, size_t
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int setkeymap(const char* name, const u32* map, u32* const shift_map, const u32* alt_map, const u32* altgr_map, const u32* shift_altgr_map)
|
||||
int setkeymap(char const* name, u32 const* map, u32* const shift_map, u32 const* alt_map, u32 const* altgr_map, u32 const* shift_altgr_map)
|
||||
{
|
||||
Syscall::SC_setkeymap_params params { map, shift_map, alt_map, altgr_map, shift_altgr_map, { name, strlen(name) } };
|
||||
return syscall(SC_setkeymap, ¶ms);
|
||||
|
@ -131,10 +131,10 @@ int getkeymap(char* name_buffer, size_t name_buffer_size, u32* map, u32* shift_m
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
u16 internet_checksum(const void* ptr, size_t count)
|
||||
u16 internet_checksum(void const* ptr, size_t count)
|
||||
{
|
||||
u32 checksum = 0;
|
||||
auto* w = (const u16*)ptr;
|
||||
auto* w = (u16 const*)ptr;
|
||||
while (count > 1) {
|
||||
checksum += ntohs(*w++);
|
||||
if (checksum & 0x80000000)
|
||||
|
|
|
@ -60,12 +60,12 @@ int get_stack_bounds(uintptr_t* user_stack_base, size_t* user_stack_size);
|
|||
|
||||
int anon_create(size_t size, int options);
|
||||
|
||||
int serenity_readlink(const char* path, size_t path_length, char* buffer, size_t buffer_size);
|
||||
int serenity_readlink(char const* path, size_t path_length, char* buffer, size_t buffer_size);
|
||||
|
||||
int getkeymap(char* name_buffer, size_t name_buffer_size, uint32_t* map, uint32_t* shift_map, uint32_t* alt_map, uint32_t* altgr_map, uint32_t* shift_altgr_map);
|
||||
int setkeymap(const char* name, const uint32_t* map, uint32_t* const shift_map, const uint32_t* alt_map, const uint32_t* altgr_map, const uint32_t* shift_altgr_map);
|
||||
int setkeymap(char const* name, uint32_t const* map, uint32_t* const shift_map, uint32_t const* alt_map, uint32_t const* altgr_map, uint32_t const* shift_altgr_map);
|
||||
|
||||
uint16_t internet_checksum(const void* ptr, size_t count);
|
||||
uint16_t internet_checksum(void const* ptr, size_t count);
|
||||
|
||||
int emuctl(uintptr_t command, uintptr_t arg0, uintptr_t arg1);
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ void endspent()
|
|||
s_pwdp = {};
|
||||
}
|
||||
|
||||
struct spwd* getspnam(const char* name)
|
||||
struct spwd* getspnam(char const* name)
|
||||
{
|
||||
setspent();
|
||||
while (auto* sp = getspent()) {
|
||||
|
@ -62,7 +62,7 @@ struct spwd* getspnam(const char* name)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
static bool parse_shadow_entry(const String& line)
|
||||
static bool parse_shadow_entry(String const& line)
|
||||
{
|
||||
auto parts = line.split_view(':', true);
|
||||
if (parts.size() != 9) {
|
||||
|
@ -192,7 +192,7 @@ static void construct_spwd(struct spwd* sp, char* buf, struct spwd** result)
|
|||
sp->sp_pwdp = buf_pwdp;
|
||||
}
|
||||
|
||||
int getspnam_r(const char* name, struct spwd* sp, char* buf, size_t buflen, struct spwd** result)
|
||||
int getspnam_r(char const* name, struct spwd* sp, char* buf, size_t buflen, struct spwd** result)
|
||||
{
|
||||
// FIXME: This is a HACK!
|
||||
TemporaryChange name_change { s_name, {} };
|
||||
|
@ -212,7 +212,7 @@ int getspnam_r(const char* name, struct spwd* sp, char* buf, size_t buflen, stru
|
|||
return 0;
|
||||
}
|
||||
|
||||
const auto total_buffer_length = s_name.length() + s_pwdp.length() + 8;
|
||||
auto const total_buffer_length = s_name.length() + s_pwdp.length() + 8;
|
||||
if (buflen < total_buffer_length)
|
||||
return ERANGE;
|
||||
|
||||
|
@ -227,7 +227,7 @@ int putspent(struct spwd* p, FILE* stream)
|
|||
return -1;
|
||||
}
|
||||
|
||||
auto is_valid_field = [](const char* str) {
|
||||
auto is_valid_field = [](char const* str) {
|
||||
return str && !strpbrk(str, ":\n");
|
||||
};
|
||||
|
||||
|
|
|
@ -27,13 +27,13 @@ struct spwd {
|
|||
struct spwd* getspent(void);
|
||||
void setspent(void);
|
||||
void endspent(void);
|
||||
struct spwd* getspnam(const char* name);
|
||||
struct spwd* getspnam(char const* name);
|
||||
int putspent(struct spwd* p, FILE* stream);
|
||||
|
||||
int getspent_r(struct spwd* spbuf, char* buf, size_t buflen, struct spwd** spbufp);
|
||||
int getspnam_r(const char* name, struct spwd* spbuf, char* buf, size_t buflen, struct spwd** spbufp);
|
||||
int getspnam_r(char const* name, struct spwd* spbuf, char* buf, size_t buflen, struct spwd** spbufp);
|
||||
|
||||
int fgetspent_r(FILE* fp, struct spwd* spbuf, char* buf, size_t buflen, struct spwd** spbufp);
|
||||
int sgetspent_r(const char* s, struct spwd* spbuf, char* buf, size_t buflen, struct spwd** spbufp);
|
||||
int sgetspent_r(char const* s, struct spwd* spbuf, char* buf, size_t buflen, struct spwd** spbufp);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -84,7 +84,7 @@ int sigaddset(sigset_t* set, int sig)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaltstack.html
|
||||
int sigaltstack(const stack_t* ss, stack_t* old_ss)
|
||||
int sigaltstack(stack_t const* ss, stack_t* old_ss)
|
||||
{
|
||||
int rc = syscall(SC_sigaltstack, ss, old_ss);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
|
@ -102,7 +102,7 @@ int sigdelset(sigset_t* set, int sig)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigismember.html
|
||||
int sigismember(const sigset_t* set, int sig)
|
||||
int sigismember(sigset_t const* set, int sig)
|
||||
{
|
||||
if (sig < 1 || sig > 32) {
|
||||
errno = EINVAL;
|
||||
|
@ -114,7 +114,7 @@ int sigismember(const sigset_t* set, int sig)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigprocmask.html
|
||||
int sigprocmask(int how, const sigset_t* set, sigset_t* old_set)
|
||||
int sigprocmask(int how, sigset_t const* set, sigset_t* old_set)
|
||||
{
|
||||
int rc = syscall(SC_sigprocmask, how, set, old_set);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
|
@ -127,7 +127,7 @@ int sigpending(sigset_t* set)
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
const char* sys_siglist[NSIG] = {
|
||||
char const* sys_siglist[NSIG] = {
|
||||
"Invalid signal number",
|
||||
"Hangup",
|
||||
"Interrupt",
|
||||
|
@ -173,7 +173,7 @@ void siglongjmp(jmp_buf env, int val)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigsuspend.html
|
||||
int sigsuspend(const sigset_t* set)
|
||||
int sigsuspend(sigset_t const* set)
|
||||
{
|
||||
return pselect(0, nullptr, nullptr, nullptr, nullptr, set);
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ int sigtimedwait(sigset_t const* set, siginfo_t* info, struct timespec const* ti
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
const char* sys_signame[] = {
|
||||
char const* sys_signame[] = {
|
||||
"INVAL",
|
||||
"HUP",
|
||||
"INT",
|
||||
|
@ -237,9 +237,9 @@ const char* sys_signame[] = {
|
|||
"SYS",
|
||||
};
|
||||
|
||||
static_assert(sizeof(sys_signame) == sizeof(const char*) * NSIG);
|
||||
static_assert(sizeof(sys_signame) == sizeof(char const*) * NSIG);
|
||||
|
||||
int getsignalbyname(const char* name)
|
||||
int getsignalbyname(char const* name)
|
||||
{
|
||||
VERIFY(name);
|
||||
StringView name_sv(name);
|
||||
|
@ -252,7 +252,7 @@ int getsignalbyname(const char* name)
|
|||
return -1;
|
||||
}
|
||||
|
||||
const char* getsignalname(int signal)
|
||||
char const* getsignalname(int signal)
|
||||
{
|
||||
if (signal < 0 || signal >= NSIG) {
|
||||
errno = EINVAL;
|
||||
|
|
|
@ -17,25 +17,25 @@ __BEGIN_DECLS
|
|||
int kill(pid_t, int sig);
|
||||
int killpg(int pgrp, int sig);
|
||||
sighandler_t signal(int sig, sighandler_t);
|
||||
int pthread_sigmask(int how, const sigset_t* set, sigset_t* old_set);
|
||||
int pthread_sigmask(int how, sigset_t const* set, sigset_t* old_set);
|
||||
int sigaction(int sig, const struct sigaction* act, struct sigaction* old_act);
|
||||
int sigemptyset(sigset_t*);
|
||||
int sigfillset(sigset_t*);
|
||||
int sigaddset(sigset_t*, int sig);
|
||||
int sigaltstack(const stack_t* ss, stack_t* old_ss);
|
||||
int sigaltstack(stack_t const* ss, stack_t* old_ss);
|
||||
int sigdelset(sigset_t*, int sig);
|
||||
int sigismember(const sigset_t*, int sig);
|
||||
int sigprocmask(int how, const sigset_t* set, sigset_t* old_set);
|
||||
int sigismember(sigset_t const*, int sig);
|
||||
int sigprocmask(int how, sigset_t const* set, sigset_t* old_set);
|
||||
int sigpending(sigset_t*);
|
||||
int sigsuspend(const sigset_t*);
|
||||
int sigsuspend(sigset_t const*);
|
||||
int sigtimedwait(sigset_t const*, siginfo_t*, struct timespec const*);
|
||||
int sigwait(sigset_t const*, int*);
|
||||
int sigwaitinfo(sigset_t const*, siginfo_t*);
|
||||
int raise(int sig);
|
||||
int getsignalbyname(const char*);
|
||||
const char* getsignalname(int);
|
||||
int getsignalbyname(char const*);
|
||||
char const* getsignalname(int);
|
||||
|
||||
extern const char* sys_siglist[NSIG];
|
||||
extern const char* sys_signame[NSIG];
|
||||
extern char const* sys_siglist[NSIG];
|
||||
extern char const* sys_signame[NSIG];
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -29,7 +29,7 @@ struct posix_spawn_file_actions_state {
|
|||
|
||||
extern "C" {
|
||||
|
||||
[[noreturn]] static void posix_spawn_child(const char* path, const posix_spawn_file_actions_t* file_actions, const posix_spawnattr_t* attr, char* const argv[], char* const envp[], int (*exec)(const char*, char* const[], char* const[]))
|
||||
[[noreturn]] static void posix_spawn_child(char const* path, posix_spawn_file_actions_t const* file_actions, posix_spawnattr_t const* attr, char* const argv[], char* const envp[], int (*exec)(char const*, char* const[], char* const[]))
|
||||
{
|
||||
if (attr) {
|
||||
short flags = attr->flags;
|
||||
|
@ -86,7 +86,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
if (file_actions) {
|
||||
for (const auto& action : file_actions->state->actions) {
|
||||
for (auto const& action : file_actions->state->actions) {
|
||||
if (action() < 0) {
|
||||
perror("posix_spawn file action");
|
||||
_exit(127);
|
||||
|
@ -100,7 +100,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn.html
|
||||
int posix_spawn(pid_t* out_pid, const char* path, const posix_spawn_file_actions_t* file_actions, const posix_spawnattr_t* attr, char* const argv[], char* const envp[])
|
||||
int posix_spawn(pid_t* out_pid, char const* path, posix_spawn_file_actions_t const* file_actions, posix_spawnattr_t const* attr, char* const argv[], char* const envp[])
|
||||
{
|
||||
pid_t child_pid = fork();
|
||||
if (child_pid < 0)
|
||||
|
@ -115,7 +115,7 @@ int posix_spawn(pid_t* out_pid, const char* path, const posix_spawn_file_actions
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawnp.html
|
||||
int posix_spawnp(pid_t* out_pid, const char* path, const posix_spawn_file_actions_t* file_actions, const posix_spawnattr_t* attr, char* const argv[], char* const envp[])
|
||||
int posix_spawnp(pid_t* out_pid, char const* path, posix_spawn_file_actions_t const* file_actions, posix_spawnattr_t const* attr, char* const argv[], char* const envp[])
|
||||
{
|
||||
pid_t child_pid = fork();
|
||||
if (child_pid < 0)
|
||||
|
@ -130,7 +130,7 @@ int posix_spawnp(pid_t* out_pid, const char* path, const posix_spawn_file_action
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn_file_actions_addchdir.html
|
||||
int posix_spawn_file_actions_addchdir(posix_spawn_file_actions_t* actions, const char* path)
|
||||
int posix_spawn_file_actions_addchdir(posix_spawn_file_actions_t* actions, char const* path)
|
||||
{
|
||||
actions->state->actions.append([path]() { return chdir(path); });
|
||||
return 0;
|
||||
|
@ -157,7 +157,7 @@ int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t* actions, int ol
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn_file_actions_addopen.html
|
||||
int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t* actions, int want_fd, const char* path, int flags, mode_t mode)
|
||||
int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t* actions, int want_fd, char const* path, int flags, mode_t mode)
|
||||
{
|
||||
actions->state->actions.append([want_fd, path, flags, mode]() {
|
||||
int opened_fd = open(path, flags, mode);
|
||||
|
@ -191,42 +191,42 @@ int posix_spawnattr_destroy(posix_spawnattr_t*)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawnattr_getflags.html
|
||||
int posix_spawnattr_getflags(const posix_spawnattr_t* attr, short* out_flags)
|
||||
int posix_spawnattr_getflags(posix_spawnattr_t const* attr, short* out_flags)
|
||||
{
|
||||
*out_flags = attr->flags;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawnattr_getpgroup.html
|
||||
int posix_spawnattr_getpgroup(const posix_spawnattr_t* attr, pid_t* out_pgroup)
|
||||
int posix_spawnattr_getpgroup(posix_spawnattr_t const* attr, pid_t* out_pgroup)
|
||||
{
|
||||
*out_pgroup = attr->pgroup;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawnattr_getschedparam.html
|
||||
int posix_spawnattr_getschedparam(const posix_spawnattr_t* attr, struct sched_param* out_schedparam)
|
||||
int posix_spawnattr_getschedparam(posix_spawnattr_t const* attr, struct sched_param* out_schedparam)
|
||||
{
|
||||
*out_schedparam = attr->schedparam;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawnattr_getschedpolicy.html
|
||||
int posix_spawnattr_getschedpolicy(const posix_spawnattr_t* attr, int* out_schedpolicy)
|
||||
int posix_spawnattr_getschedpolicy(posix_spawnattr_t const* attr, int* out_schedpolicy)
|
||||
{
|
||||
*out_schedpolicy = attr->schedpolicy;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawnattr_getsigdefault.html
|
||||
int posix_spawnattr_getsigdefault(const posix_spawnattr_t* attr, sigset_t* out_sigdefault)
|
||||
int posix_spawnattr_getsigdefault(posix_spawnattr_t const* attr, sigset_t* out_sigdefault)
|
||||
{
|
||||
*out_sigdefault = attr->sigdefault;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawnattr_getsigmask.html
|
||||
int posix_spawnattr_getsigmask(const posix_spawnattr_t* attr, sigset_t* out_sigmask)
|
||||
int posix_spawnattr_getsigmask(posix_spawnattr_t const* attr, sigset_t* out_sigmask)
|
||||
{
|
||||
*out_sigmask = attr->sigmask;
|
||||
return 0;
|
||||
|
@ -276,14 +276,14 @@ int posix_spawnattr_setschedpolicy(posix_spawnattr_t* attr, int schedpolicy)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawnattr_setsigdefault.html
|
||||
int posix_spawnattr_setsigdefault(posix_spawnattr_t* attr, const sigset_t* sigdefault)
|
||||
int posix_spawnattr_setsigdefault(posix_spawnattr_t* attr, sigset_t const* sigdefault)
|
||||
{
|
||||
attr->sigdefault = *sigdefault;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawnattr_setsigmask.html
|
||||
int posix_spawnattr_setsigmask(posix_spawnattr_t* attr, const sigset_t* sigmask)
|
||||
int posix_spawnattr_setsigmask(posix_spawnattr_t* attr, sigset_t const* sigmask)
|
||||
{
|
||||
attr->sigmask = *sigmask;
|
||||
return 0;
|
||||
|
|
|
@ -49,30 +49,30 @@ typedef struct {
|
|||
sigset_t sigmask;
|
||||
} posix_spawnattr_t;
|
||||
|
||||
int posix_spawn(pid_t*, const char*, const posix_spawn_file_actions_t*, const posix_spawnattr_t*, char* const argv[], char* const envp[]);
|
||||
int posix_spawnp(pid_t*, const char*, const posix_spawn_file_actions_t*, const posix_spawnattr_t*, char* const argv[], char* const envp[]);
|
||||
int posix_spawn(pid_t*, char const*, posix_spawn_file_actions_t const*, posix_spawnattr_t const*, char* const argv[], char* const envp[]);
|
||||
int posix_spawnp(pid_t*, char const*, posix_spawn_file_actions_t const*, posix_spawnattr_t const*, char* const argv[], char* const envp[]);
|
||||
|
||||
int posix_spawn_file_actions_addchdir(posix_spawn_file_actions_t*, const char*);
|
||||
int posix_spawn_file_actions_addchdir(posix_spawn_file_actions_t*, char const*);
|
||||
int posix_spawn_file_actions_addfchdir(posix_spawn_file_actions_t*, int);
|
||||
int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t*, int);
|
||||
int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t*, int old_fd, int new_fd);
|
||||
int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t*, int fd, const char*, int flags, mode_t);
|
||||
int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t*, int fd, char const*, int flags, mode_t);
|
||||
int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t*);
|
||||
int posix_spawn_file_actions_init(posix_spawn_file_actions_t*);
|
||||
|
||||
int posix_spawnattr_destroy(posix_spawnattr_t*);
|
||||
int posix_spawnattr_getflags(const posix_spawnattr_t*, short*);
|
||||
int posix_spawnattr_getpgroup(const posix_spawnattr_t*, pid_t*);
|
||||
int posix_spawnattr_getschedparam(const posix_spawnattr_t*, struct sched_param*);
|
||||
int posix_spawnattr_getschedpolicy(const posix_spawnattr_t*, int*);
|
||||
int posix_spawnattr_getsigdefault(const posix_spawnattr_t*, sigset_t*);
|
||||
int posix_spawnattr_getsigmask(const posix_spawnattr_t*, sigset_t*);
|
||||
int posix_spawnattr_getflags(posix_spawnattr_t const*, short*);
|
||||
int posix_spawnattr_getpgroup(posix_spawnattr_t const*, pid_t*);
|
||||
int posix_spawnattr_getschedparam(posix_spawnattr_t const*, struct sched_param*);
|
||||
int posix_spawnattr_getschedpolicy(posix_spawnattr_t const*, int*);
|
||||
int posix_spawnattr_getsigdefault(posix_spawnattr_t const*, sigset_t*);
|
||||
int posix_spawnattr_getsigmask(posix_spawnattr_t const*, sigset_t*);
|
||||
int posix_spawnattr_init(posix_spawnattr_t*);
|
||||
int posix_spawnattr_setflags(posix_spawnattr_t*, short);
|
||||
int posix_spawnattr_setpgroup(posix_spawnattr_t*, pid_t);
|
||||
int posix_spawnattr_setschedparam(posix_spawnattr_t*, const struct sched_param*);
|
||||
int posix_spawnattr_setschedpolicy(posix_spawnattr_t*, int);
|
||||
int posix_spawnattr_setsigdefault(posix_spawnattr_t*, const sigset_t*);
|
||||
int posix_spawnattr_setsigmask(posix_spawnattr_t*, const sigset_t*);
|
||||
int posix_spawnattr_setsigdefault(posix_spawnattr_t*, sigset_t const*);
|
||||
int posix_spawnattr_setsigmask(posix_spawnattr_t*, sigset_t const*);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -22,7 +22,7 @@ mode_t umask(mode_t mask)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/mkdir.html
|
||||
int mkdir(const char* pathname, mode_t mode)
|
||||
int mkdir(char const* pathname, mode_t mode)
|
||||
{
|
||||
if (!pathname) {
|
||||
errno = EFAULT;
|
||||
|
@ -33,7 +33,7 @@ int mkdir(const char* pathname, mode_t mode)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/chmod.html
|
||||
int chmod(const char* pathname, mode_t mode)
|
||||
int chmod(char const* pathname, mode_t mode)
|
||||
{
|
||||
return fchmodat(AT_FDCWD, pathname, mode, 0);
|
||||
}
|
||||
|
@ -69,12 +69,12 @@ int fchmod(int fd, mode_t mode)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/mkfifo.html
|
||||
int mkfifo(const char* pathname, mode_t mode)
|
||||
int mkfifo(char const* pathname, mode_t mode)
|
||||
{
|
||||
return mknod(pathname, mode | S_IFIFO, 0);
|
||||
}
|
||||
|
||||
static int do_stat(int dirfd, const char* path, struct stat* statbuf, bool follow_symlinks)
|
||||
static int do_stat(int dirfd, char const* path, struct stat* statbuf, bool follow_symlinks)
|
||||
{
|
||||
if (!path) {
|
||||
errno = EFAULT;
|
||||
|
@ -86,13 +86,13 @@ static int do_stat(int dirfd, const char* path, struct stat* statbuf, bool follo
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/lstat.html
|
||||
int lstat(const char* path, struct stat* statbuf)
|
||||
int lstat(char const* path, struct stat* statbuf)
|
||||
{
|
||||
return do_stat(AT_FDCWD, path, statbuf, false);
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/stat.html
|
||||
int stat(const char* path, struct stat* statbuf)
|
||||
int stat(char const* path, struct stat* statbuf)
|
||||
{
|
||||
return do_stat(AT_FDCWD, path, statbuf, true);
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ int fstat(int fd, struct stat* statbuf)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/fstatat.html
|
||||
int fstatat(int fd, const char* path, struct stat* statbuf, int flags)
|
||||
int fstatat(int fd, char const* path, struct stat* statbuf, int flags)
|
||||
{
|
||||
return do_stat(fd, path, statbuf, !(flags & AT_SYMLINK_NOFOLLOW));
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ ssize_t FILE::do_read(u8* data, size_t size)
|
|||
return nread;
|
||||
}
|
||||
|
||||
ssize_t FILE::do_write(const u8* data, size_t size)
|
||||
ssize_t FILE::do_write(u8 const* data, size_t size)
|
||||
{
|
||||
int nwritten = ::write(m_fd, data, size);
|
||||
|
||||
|
@ -154,7 +154,7 @@ bool FILE::read_into_buffer()
|
|||
bool FILE::write_from_buffer()
|
||||
{
|
||||
size_t size;
|
||||
const u8* data = m_buffer.begin_dequeue(size);
|
||||
u8 const* data = m_buffer.begin_dequeue(size);
|
||||
// If we want to write, the buffer must have something in it!
|
||||
VERIFY(size);
|
||||
|
||||
|
@ -180,7 +180,7 @@ size_t FILE::read(u8* data, size_t size)
|
|||
if (m_buffer.may_use()) {
|
||||
// Let's see if the buffer has something queued for us.
|
||||
size_t queued_size;
|
||||
const u8* queued_data = m_buffer.begin_dequeue(queued_size);
|
||||
u8 const* queued_data = m_buffer.begin_dequeue(queued_size);
|
||||
if (queued_size == 0) {
|
||||
// Nothing buffered; we're going to have to read some.
|
||||
bool read_some_more = read_into_buffer();
|
||||
|
@ -209,7 +209,7 @@ size_t FILE::read(u8* data, size_t size)
|
|||
return total_read;
|
||||
}
|
||||
|
||||
size_t FILE::write(const u8* data, size_t size)
|
||||
size_t FILE::write(u8 const* data, size_t size)
|
||||
{
|
||||
size_t total_written = 0;
|
||||
|
||||
|
@ -426,7 +426,7 @@ size_t FILE::Buffer::buffered_size() const
|
|||
return m_capacity - (m_begin - m_end);
|
||||
}
|
||||
|
||||
const u8* FILE::Buffer::begin_dequeue(size_t& available_size) const
|
||||
u8 const* FILE::Buffer::begin_dequeue(size_t& available_size) const
|
||||
{
|
||||
if (m_ungotten != 0u) {
|
||||
auto available_bytes = count_trailing_zeroes(m_ungotten) + 1;
|
||||
|
@ -743,19 +743,19 @@ int putchar(int ch)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/fputs.html
|
||||
int fputs(const char* s, FILE* stream)
|
||||
int fputs(char const* s, FILE* stream)
|
||||
{
|
||||
VERIFY(stream);
|
||||
size_t len = strlen(s);
|
||||
ScopedFileLock lock(stream);
|
||||
size_t nwritten = stream->write(reinterpret_cast<const u8*>(s), len);
|
||||
size_t nwritten = stream->write(reinterpret_cast<u8 const*>(s), len);
|
||||
if (nwritten < len)
|
||||
return EOF;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/puts.html
|
||||
int puts(const char* s)
|
||||
int puts(char const* s)
|
||||
{
|
||||
int rc = fputs(s, stdout);
|
||||
if (rc == EOF)
|
||||
|
@ -799,13 +799,13 @@ size_t fread(void* ptr, size_t size, size_t nmemb, FILE* stream)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/fwrite.html
|
||||
size_t fwrite(const void* ptr, size_t size, size_t nmemb, FILE* stream)
|
||||
size_t fwrite(void const* ptr, size_t size, size_t nmemb, FILE* stream)
|
||||
{
|
||||
VERIFY(stream);
|
||||
VERIFY(!Checked<size_t>::multiplication_would_overflow(size, nmemb));
|
||||
|
||||
ScopedFileLock lock(stream);
|
||||
size_t nwritten = stream->write(reinterpret_cast<const u8*>(ptr), size * nmemb);
|
||||
size_t nwritten = stream->write(reinterpret_cast<u8 const*>(ptr), size * nmemb);
|
||||
if (!nwritten)
|
||||
return 0;
|
||||
return nwritten / size;
|
||||
|
@ -859,7 +859,7 @@ int fgetpos(FILE* stream, fpos_t* pos)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/fsetpos.html
|
||||
int fsetpos(FILE* stream, const fpos_t* pos)
|
||||
int fsetpos(FILE* stream, fpos_t const* pos)
|
||||
{
|
||||
VERIFY(stream);
|
||||
VERIFY(pos);
|
||||
|
@ -881,13 +881,13 @@ ALWAYS_INLINE void stdout_putch(char*&, char ch)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/vfprintf.html
|
||||
int vfprintf(FILE* stream, const char* fmt, va_list ap)
|
||||
int vfprintf(FILE* stream, char const* fmt, va_list ap)
|
||||
{
|
||||
return printf_internal([stream](auto, char ch) { fputc(ch, stream); }, nullptr, fmt, ap);
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/fprintf.html
|
||||
int fprintf(FILE* stream, const char* fmt, ...)
|
||||
int fprintf(FILE* stream, char const* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
|
@ -897,13 +897,13 @@ int fprintf(FILE* stream, const char* fmt, ...)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/vprintf.html
|
||||
int vprintf(const char* fmt, va_list ap)
|
||||
int vprintf(char const* fmt, va_list ap)
|
||||
{
|
||||
return printf_internal(stdout_putch, nullptr, fmt, ap);
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/printf.html
|
||||
int printf(const char* fmt, ...)
|
||||
int printf(char const* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
|
@ -913,7 +913,7 @@ int printf(const char* fmt, ...)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/vasprintf.html
|
||||
int vasprintf(char** strp, const char* fmt, va_list ap)
|
||||
int vasprintf(char** strp, char const* fmt, va_list ap)
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.appendvf(fmt, ap);
|
||||
|
@ -924,7 +924,7 @@ int vasprintf(char** strp, const char* fmt, va_list ap)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/asprintf.html
|
||||
int asprintf(char** strp, const char* fmt, ...)
|
||||
int asprintf(char** strp, char const* fmt, ...)
|
||||
{
|
||||
StringBuilder builder;
|
||||
va_list ap;
|
||||
|
@ -943,7 +943,7 @@ static void buffer_putch(char*& bufptr, char ch)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/vsprintf.html
|
||||
int vsprintf(char* buffer, const char* fmt, va_list ap)
|
||||
int vsprintf(char* buffer, char const* fmt, va_list ap)
|
||||
{
|
||||
int ret = printf_internal(buffer_putch, buffer, fmt, ap);
|
||||
buffer[ret] = '\0';
|
||||
|
@ -951,7 +951,7 @@ int vsprintf(char* buffer, const char* fmt, va_list ap)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/sprintf.html
|
||||
int sprintf(char* buffer, const char* fmt, ...)
|
||||
int sprintf(char* buffer, char const* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
|
@ -961,7 +961,7 @@ int sprintf(char* buffer, const char* fmt, ...)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/vsnprintf.html
|
||||
int vsnprintf(char* buffer, size_t size, const char* fmt, va_list ap)
|
||||
int vsnprintf(char* buffer, size_t size, char const* fmt, va_list ap)
|
||||
{
|
||||
size_t space_remaining = 0;
|
||||
if (size) {
|
||||
|
@ -985,7 +985,7 @@ int vsnprintf(char* buffer, size_t size, const char* fmt, va_list ap)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/snprintf.html
|
||||
int snprintf(char* buffer, size_t size, const char* fmt, ...)
|
||||
int snprintf(char* buffer, size_t size, char const* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
|
@ -995,14 +995,14 @@ int snprintf(char* buffer, size_t size, const char* fmt, ...)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/perror.html
|
||||
void perror(const char* s)
|
||||
void perror(char const* s)
|
||||
{
|
||||
int saved_errno = errno;
|
||||
dbgln("perror(): {}: {}", s, strerror(saved_errno));
|
||||
warnln("{}: {}", s, strerror(saved_errno));
|
||||
}
|
||||
|
||||
static int parse_mode(const char* mode)
|
||||
static int parse_mode(char const* mode)
|
||||
{
|
||||
int flags = 0;
|
||||
|
||||
|
@ -1040,7 +1040,7 @@ static int parse_mode(const char* mode)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/fopen.html
|
||||
FILE* fopen(const char* pathname, const char* mode)
|
||||
FILE* fopen(char const* pathname, char const* mode)
|
||||
{
|
||||
int flags = parse_mode(mode);
|
||||
int fd = open(pathname, flags, 0666);
|
||||
|
@ -1050,7 +1050,7 @@ FILE* fopen(const char* pathname, const char* mode)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/freopen.html
|
||||
FILE* freopen(const char* pathname, const char* mode, FILE* stream)
|
||||
FILE* freopen(char const* pathname, char const* mode, FILE* stream)
|
||||
{
|
||||
VERIFY(stream);
|
||||
if (!pathname) {
|
||||
|
@ -1068,7 +1068,7 @@ FILE* freopen(const char* pathname, const char* mode, FILE* stream)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdopen.html
|
||||
FILE* fdopen(int fd, const char* mode)
|
||||
FILE* fdopen(int fd, char const* mode)
|
||||
{
|
||||
int flags = parse_mode(mode);
|
||||
// FIXME: Verify that the mode matches how fd is already open.
|
||||
|
@ -1078,7 +1078,7 @@ FILE* fdopen(int fd, const char* mode)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/fmemopen.html
|
||||
FILE* fmemopen(void*, size_t, const char*)
|
||||
FILE* fmemopen(void*, size_t, char const*)
|
||||
{
|
||||
// FIXME: Implement me :^)
|
||||
TODO();
|
||||
|
@ -1113,7 +1113,7 @@ int fclose(FILE* stream)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html
|
||||
int rename(const char* oldpath, const char* newpath)
|
||||
int rename(char const* oldpath, char const* newpath)
|
||||
{
|
||||
if (!oldpath || !newpath) {
|
||||
errno = EFAULT;
|
||||
|
@ -1124,7 +1124,7 @@ int rename(const char* oldpath, const char* newpath)
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
void dbgputstr(const char* characters, size_t length)
|
||||
void dbgputstr(char const* characters, size_t length)
|
||||
{
|
||||
syscall(SC_dbgputstr, characters, length);
|
||||
}
|
||||
|
@ -1137,7 +1137,7 @@ char* tmpnam(char*)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/popen.html
|
||||
FILE* popen(const char* command, const char* type)
|
||||
FILE* popen(char const* command, char const* type)
|
||||
{
|
||||
if (!type || (*type != 'r' && *type != 'w')) {
|
||||
errno = EINVAL;
|
||||
|
@ -1208,7 +1208,7 @@ int pclose(FILE* stream)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/remove.html
|
||||
int remove(const char* pathname)
|
||||
int remove(char const* pathname)
|
||||
{
|
||||
if (unlink(pathname) < 0) {
|
||||
if (errno == EISDIR)
|
||||
|
@ -1219,7 +1219,7 @@ int remove(const char* pathname)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/scanf.html
|
||||
int scanf(const char* fmt, ...)
|
||||
int scanf(char const* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
|
@ -1229,7 +1229,7 @@ int scanf(const char* fmt, ...)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/fscanf.html
|
||||
int fscanf(FILE* stream, const char* fmt, ...)
|
||||
int fscanf(FILE* stream, char const* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
|
@ -1239,7 +1239,7 @@ int fscanf(FILE* stream, const char* fmt, ...)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/sscanf.html
|
||||
int sscanf(const char* buffer, const char* fmt, ...)
|
||||
int sscanf(char const* buffer, char const* fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
|
@ -1249,7 +1249,7 @@ int sscanf(const char* buffer, const char* fmt, ...)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/vfscanf.html
|
||||
int vfscanf(FILE* stream, const char* fmt, va_list ap)
|
||||
int vfscanf(FILE* stream, char const* fmt, va_list ap)
|
||||
{
|
||||
char buffer[BUFSIZ];
|
||||
if (!fgets(buffer, sizeof(buffer) - 1, stream))
|
||||
|
@ -1258,7 +1258,7 @@ int vfscanf(FILE* stream, const char* fmt, va_list ap)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/vscanf.html
|
||||
int vscanf(const char* fmt, va_list ap)
|
||||
int vscanf(char const* fmt, va_list ap)
|
||||
{
|
||||
return vfscanf(stdin, fmt, ap);
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ typedef off_t fpos_t;
|
|||
int fseek(FILE*, long offset, int whence);
|
||||
int fseeko(FILE*, off_t offset, int whence);
|
||||
int fgetpos(FILE*, fpos_t*);
|
||||
int fsetpos(FILE*, const fpos_t*);
|
||||
int fsetpos(FILE*, fpos_t const*);
|
||||
long ftell(FILE*);
|
||||
off_t ftello(FILE*);
|
||||
char* fgets(char* buffer, int size, FILE*);
|
||||
|
@ -53,11 +53,11 @@ int getchar(void);
|
|||
ssize_t getdelim(char**, size_t*, int, FILE*);
|
||||
ssize_t getline(char**, size_t*, FILE*);
|
||||
int ungetc(int c, FILE*);
|
||||
int remove(const char* pathname);
|
||||
FILE* fdopen(int fd, const char* mode);
|
||||
FILE* fopen(const char* pathname, const char* mode);
|
||||
FILE* freopen(const char* pathname, const char* mode, FILE*);
|
||||
FILE* fmemopen(void* buf, size_t size, const char* mode);
|
||||
int remove(char const* pathname);
|
||||
FILE* fdopen(int fd, char const* mode);
|
||||
FILE* fopen(char const* pathname, char const* mode);
|
||||
FILE* freopen(char const* pathname, char const* mode, FILE*);
|
||||
FILE* fmemopen(void* buf, size_t size, char const* mode);
|
||||
void flockfile(FILE* filehandle);
|
||||
void funlockfile(FILE* filehandle);
|
||||
int fclose(FILE*);
|
||||
|
@ -68,36 +68,36 @@ int feof(FILE*);
|
|||
int fflush(FILE*);
|
||||
size_t fread(void* ptr, size_t size, size_t nmemb, FILE*);
|
||||
size_t fread_unlocked(void* ptr, size_t size, size_t nmemb, FILE*);
|
||||
size_t fwrite(const void* ptr, size_t size, size_t nmemb, FILE*);
|
||||
int vprintf(const char* fmt, va_list) __attribute__((format(printf, 1, 0)));
|
||||
int vfprintf(FILE*, const char* fmt, va_list) __attribute__((format(printf, 2, 0)));
|
||||
int vasprintf(char** strp, const char* fmt, va_list) __attribute__((format(printf, 2, 0)));
|
||||
int vsprintf(char* buffer, const char* fmt, va_list) __attribute__((format(printf, 2, 0)));
|
||||
int vsnprintf(char* buffer, size_t, const char* fmt, va_list) __attribute__((format(printf, 3, 0)));
|
||||
int fprintf(FILE*, const char* fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||
int printf(const char* fmt, ...) __attribute__((format(printf, 1, 2)));
|
||||
void dbgputstr(const char*, size_t);
|
||||
int sprintf(char* buffer, const char* fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||
int asprintf(char** strp, const char* fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||
int snprintf(char* buffer, size_t, const char* fmt, ...) __attribute__((format(printf, 3, 4)));
|
||||
size_t fwrite(void const* ptr, size_t size, size_t nmemb, FILE*);
|
||||
int vprintf(char const* fmt, va_list) __attribute__((format(printf, 1, 0)));
|
||||
int vfprintf(FILE*, char const* fmt, va_list) __attribute__((format(printf, 2, 0)));
|
||||
int vasprintf(char** strp, char const* fmt, va_list) __attribute__((format(printf, 2, 0)));
|
||||
int vsprintf(char* buffer, char const* fmt, va_list) __attribute__((format(printf, 2, 0)));
|
||||
int vsnprintf(char* buffer, size_t, char const* fmt, va_list) __attribute__((format(printf, 3, 0)));
|
||||
int fprintf(FILE*, char const* fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||
int printf(char const* fmt, ...) __attribute__((format(printf, 1, 2)));
|
||||
void dbgputstr(char const*, size_t);
|
||||
int sprintf(char* buffer, char const* fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||
int asprintf(char** strp, char const* fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||
int snprintf(char* buffer, size_t, char const* fmt, ...) __attribute__((format(printf, 3, 4)));
|
||||
int putchar(int ch);
|
||||
int putc(int ch, FILE*);
|
||||
int puts(const char*);
|
||||
int fputs(const char*, FILE*);
|
||||
void perror(const char*);
|
||||
int scanf(const char* fmt, ...) __attribute__((format(scanf, 1, 2)));
|
||||
int sscanf(const char* str, const char* fmt, ...) __attribute__((format(scanf, 2, 3)));
|
||||
int fscanf(FILE*, const char* fmt, ...) __attribute__((format(scanf, 2, 3)));
|
||||
int vscanf(const char*, va_list) __attribute__((format(scanf, 1, 0)));
|
||||
int vfscanf(FILE*, const char*, va_list) __attribute__((format(scanf, 2, 0)));
|
||||
int vsscanf(const char*, const char*, va_list) __attribute__((format(scanf, 2, 0)));
|
||||
int puts(char const*);
|
||||
int fputs(char const*, FILE*);
|
||||
void perror(char const*);
|
||||
int scanf(char const* fmt, ...) __attribute__((format(scanf, 1, 2)));
|
||||
int sscanf(char const* str, char const* fmt, ...) __attribute__((format(scanf, 2, 3)));
|
||||
int fscanf(FILE*, char const* fmt, ...) __attribute__((format(scanf, 2, 3)));
|
||||
int vscanf(char const*, va_list) __attribute__((format(scanf, 1, 0)));
|
||||
int vfscanf(FILE*, char const*, va_list) __attribute__((format(scanf, 2, 0)));
|
||||
int vsscanf(char const*, char const*, va_list) __attribute__((format(scanf, 2, 0)));
|
||||
int setvbuf(FILE*, char* buf, int mode, size_t);
|
||||
void setbuf(FILE*, char* buf);
|
||||
void setlinebuf(FILE*);
|
||||
int rename(const char* oldpath, const char* newpath);
|
||||
int rename(char const* oldpath, char const* newpath);
|
||||
FILE* tmpfile(void);
|
||||
char* tmpnam(char*);
|
||||
FILE* popen(const char* command, const char* type);
|
||||
FILE* popen(char const* command, char const* type);
|
||||
int pclose(FILE*);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include <unistd.h>
|
||||
#include <wchar.h>
|
||||
|
||||
static void strtons(const char* str, char** endptr)
|
||||
static void strtons(char const* str, char** endptr)
|
||||
{
|
||||
assert(endptr);
|
||||
char* ptr = const_cast<char*>(str);
|
||||
|
@ -49,7 +49,7 @@ enum Sign {
|
|||
Positive,
|
||||
};
|
||||
|
||||
static Sign strtosign(const char* str, char** endptr)
|
||||
static Sign strtosign(char const* str, char** endptr)
|
||||
{
|
||||
assert(endptr);
|
||||
if (*str == '+') {
|
||||
|
@ -128,7 +128,7 @@ public:
|
|||
private:
|
||||
bool can_append_digit(int digit)
|
||||
{
|
||||
const bool is_below_cutoff = positive() ? (m_num < m_cutoff) : (m_num > m_cutoff);
|
||||
bool const is_below_cutoff = positive() ? (m_num < m_cutoff) : (m_num > m_cutoff);
|
||||
|
||||
if (is_below_cutoff) {
|
||||
return true;
|
||||
|
@ -232,7 +232,7 @@ void abort()
|
|||
|
||||
static HashTable<FlatPtr> s_malloced_environment_variables;
|
||||
|
||||
static void free_environment_variable_if_needed(const char* var)
|
||||
static void free_environment_variable_if_needed(char const* var)
|
||||
{
|
||||
if (!s_malloced_environment_variables.contains((FlatPtr)var))
|
||||
return;
|
||||
|
@ -240,11 +240,11 @@ static void free_environment_variable_if_needed(const char* var)
|
|||
s_malloced_environment_variables.remove((FlatPtr)var);
|
||||
}
|
||||
|
||||
char* getenv(const char* name)
|
||||
char* getenv(char const* name)
|
||||
{
|
||||
size_t vl = strlen(name);
|
||||
for (size_t i = 0; environ[i]; ++i) {
|
||||
const char* decl = environ[i];
|
||||
char const* decl = environ[i];
|
||||
char* eq = strchr(decl, '=');
|
||||
if (!eq)
|
||||
continue;
|
||||
|
@ -258,7 +258,7 @@ char* getenv(const char* name)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
char* secure_getenv(const char* name)
|
||||
char* secure_getenv(char const* name)
|
||||
{
|
||||
if (getauxval(AT_SECURE))
|
||||
return nullptr;
|
||||
|
@ -266,7 +266,7 @@ char* secure_getenv(const char* name)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/unsetenv.html
|
||||
int unsetenv(const char* name)
|
||||
int unsetenv(char const* name)
|
||||
{
|
||||
auto new_var_len = strlen(name);
|
||||
size_t environ_size = 0;
|
||||
|
@ -307,12 +307,12 @@ int clearenv()
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/setenv.html
|
||||
int setenv(const char* name, const char* value, int overwrite)
|
||||
int setenv(char const* name, char const* value, int overwrite)
|
||||
{
|
||||
return serenity_setenv(name, strlen(name), value, strlen(value), overwrite);
|
||||
}
|
||||
|
||||
int serenity_setenv(const char* name, ssize_t name_length, const char* value, ssize_t value_length, int overwrite)
|
||||
int serenity_setenv(char const* name, ssize_t name_length, char const* value, ssize_t value_length, int overwrite)
|
||||
{
|
||||
if (!overwrite && getenv(name))
|
||||
return 0;
|
||||
|
@ -374,14 +374,14 @@ int putenv(char* new_var)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const char* __progname = NULL;
|
||||
static char const* __progname = NULL;
|
||||
|
||||
const char* getprogname()
|
||||
char const* getprogname()
|
||||
{
|
||||
return __progname;
|
||||
}
|
||||
|
||||
void setprogname(const char* progname)
|
||||
void setprogname(char const* progname)
|
||||
{
|
||||
for (int i = strlen(progname) - 1; i >= 0; i--) {
|
||||
if (progname[i] == '/') {
|
||||
|
@ -394,7 +394,7 @@ void setprogname(const char* progname)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtod.html
|
||||
double strtod(const char* str, char** endptr)
|
||||
double strtod(char const* str, char** endptr)
|
||||
{
|
||||
// Parse spaces, sign, and base
|
||||
char* parse_ptr = const_cast<char*>(str);
|
||||
|
@ -451,7 +451,7 @@ double strtod(const char* str, char** endptr)
|
|||
char exponent_upper;
|
||||
int base = 10;
|
||||
if (*parse_ptr == '0') {
|
||||
const char base_ch = *(parse_ptr + 1);
|
||||
char const base_ch = *(parse_ptr + 1);
|
||||
if (base_ch == 'x' || base_ch == 'X') {
|
||||
base = 16;
|
||||
parse_ptr += 2;
|
||||
|
@ -676,26 +676,26 @@ double strtod(const char* str, char** endptr)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtold.html
|
||||
long double strtold(const char* str, char** endptr)
|
||||
long double strtold(char const* str, char** endptr)
|
||||
{
|
||||
assert(sizeof(double) == sizeof(long double));
|
||||
return strtod(str, endptr);
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtof.html
|
||||
float strtof(const char* str, char** endptr)
|
||||
float strtof(char const* str, char** endptr)
|
||||
{
|
||||
return strtod(str, endptr);
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/atof.html
|
||||
double atof(const char* str)
|
||||
double atof(char const* str)
|
||||
{
|
||||
return strtod(str, nullptr);
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/atoi.html
|
||||
int atoi(const char* str)
|
||||
int atoi(char const* str)
|
||||
{
|
||||
long value = strtol(str, nullptr, 10);
|
||||
if (value > INT_MAX) {
|
||||
|
@ -705,13 +705,13 @@ int atoi(const char* str)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/atol.html
|
||||
long atol(const char* str)
|
||||
long atol(char const* str)
|
||||
{
|
||||
return strtol(str, nullptr, 10);
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/atoll.html
|
||||
long long atoll(const char* str)
|
||||
long long atoll(char const* str)
|
||||
{
|
||||
return strtoll(str, nullptr, 10);
|
||||
}
|
||||
|
@ -808,13 +808,13 @@ void srandom(unsigned seed)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/system.html
|
||||
int system(const char* command)
|
||||
int system(char const* command)
|
||||
{
|
||||
if (!command)
|
||||
return 1;
|
||||
|
||||
pid_t child;
|
||||
const char* argv[] = { "sh", "-c", command, nullptr };
|
||||
char const* argv[] = { "sh", "-c", command, nullptr };
|
||||
if ((errno = posix_spawn(&child, "/bin/sh", nullptr, nullptr, const_cast<char**>(argv), environ)))
|
||||
return -1;
|
||||
int wstatus;
|
||||
|
@ -872,7 +872,7 @@ char* mkdtemp(char* pattern)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/bsearch.html
|
||||
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*))
|
||||
void* bsearch(void const* key, void const* base, size_t nmemb, size_t size, int (*compar)(void const*, void const*))
|
||||
{
|
||||
char* start = static_cast<char*>(const_cast<void*>(base));
|
||||
while (nmemb > 0) {
|
||||
|
@ -956,14 +956,14 @@ int mblen(char const* s, size_t n)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/mbstowcs.html
|
||||
size_t mbstowcs(wchar_t* pwcs, const char* s, size_t n)
|
||||
size_t mbstowcs(wchar_t* pwcs, char const* s, size_t n)
|
||||
{
|
||||
static mbstate_t state = {};
|
||||
return mbsrtowcs(pwcs, &s, n, &state);
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/mbtowc.html
|
||||
int mbtowc(wchar_t* pwc, const char* s, size_t n)
|
||||
int mbtowc(wchar_t* pwc, char const* s, size_t n)
|
||||
{
|
||||
static mbstate_t internal_state = {};
|
||||
|
||||
|
@ -998,11 +998,11 @@ int wctomb(char* s, wchar_t wc)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/wcstombs.html
|
||||
size_t wcstombs(char* dest, const wchar_t* src, size_t max)
|
||||
size_t wcstombs(char* dest, wchar_t const* src, size_t max)
|
||||
{
|
||||
char* original_dest = dest;
|
||||
while ((size_t)(dest - original_dest) < max) {
|
||||
StringView v { (const char*)src, sizeof(wchar_t) };
|
||||
StringView v { (char const*)src, sizeof(wchar_t) };
|
||||
|
||||
// FIXME: dependent on locale, for now utf-8 is supported.
|
||||
Utf8View utf8 { v };
|
||||
|
@ -1021,7 +1021,7 @@ size_t wcstombs(char* dest, const wchar_t* src, size_t max)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtol.html
|
||||
long strtol(const char* str, char** endptr, int base)
|
||||
long strtol(char const* str, char** endptr, int base)
|
||||
{
|
||||
long long value = strtoll(str, endptr, base);
|
||||
if (value < LONG_MIN) {
|
||||
|
@ -1035,7 +1035,7 @@ long strtol(const char* str, char** endptr, int base)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtoul.html
|
||||
unsigned long strtoul(const char* str, char** endptr, int base)
|
||||
unsigned long strtoul(char const* str, char** endptr, int base)
|
||||
{
|
||||
unsigned long long value = strtoull(str, endptr, base);
|
||||
if (value > ULONG_MAX) {
|
||||
|
@ -1046,7 +1046,7 @@ unsigned long strtoul(const char* str, char** endptr, int base)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtoll.html
|
||||
long long strtoll(const char* str, char** endptr, int base)
|
||||
long long strtoll(char const* str, char** endptr, int base)
|
||||
{
|
||||
// Parse spaces and sign
|
||||
char* parse_ptr = const_cast<char*>(str);
|
||||
|
@ -1124,7 +1124,7 @@ long long strtoll(const char* str, char** endptr, int base)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtoull.html
|
||||
unsigned long long strtoull(const char* str, char** endptr, int base)
|
||||
unsigned long long strtoull(char const* str, char** endptr, int base)
|
||||
{
|
||||
// Parse spaces and sign
|
||||
char* parse_ptr = const_cast<char*>(str);
|
||||
|
@ -1257,7 +1257,7 @@ uint32_t arc4random_uniform(uint32_t max_bounds)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html
|
||||
char* realpath(const char* pathname, char* buffer)
|
||||
char* realpath(char const* pathname, char* buffer)
|
||||
{
|
||||
if (!pathname) {
|
||||
errno = EFAULT;
|
||||
|
|
|
@ -27,27 +27,27 @@ void free(void*);
|
|||
__attribute__((alloc_size(2))) void* realloc(void* ptr, size_t);
|
||||
__attribute__((malloc, alloc_size(1), alloc_align(2))) void* _aligned_malloc(size_t size, size_t alignment);
|
||||
void _aligned_free(void* memblock);
|
||||
char* getenv(const char* name);
|
||||
char* secure_getenv(const char* name);
|
||||
char* getenv(char const* name);
|
||||
char* secure_getenv(char const* name);
|
||||
int putenv(char*);
|
||||
int unsetenv(const char*);
|
||||
int unsetenv(char const*);
|
||||
int clearenv(void);
|
||||
int setenv(const char* name, const char* value, int overwrite);
|
||||
int serenity_setenv(const char* name, ssize_t name_length, const char* value, ssize_t value_length, int overwrite);
|
||||
const char* getprogname(void);
|
||||
void setprogname(const char*);
|
||||
int atoi(const char*);
|
||||
long atol(const char*);
|
||||
long long atoll(const char*);
|
||||
double strtod(const char*, char** endptr);
|
||||
long double strtold(const char*, char** endptr);
|
||||
float strtof(const char*, char** endptr);
|
||||
long strtol(const char*, char** endptr, int base);
|
||||
long long strtoll(const char*, char** endptr, int base);
|
||||
unsigned long long strtoull(const char*, char** endptr, int base);
|
||||
unsigned long strtoul(const char*, char** endptr, int base);
|
||||
void qsort(void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*));
|
||||
void qsort_r(void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*, void*), void* arg);
|
||||
int setenv(char const* name, char const* value, int overwrite);
|
||||
int serenity_setenv(char const* name, ssize_t name_length, char const* value, ssize_t value_length, int overwrite);
|
||||
char const* getprogname(void);
|
||||
void setprogname(char const*);
|
||||
int atoi(char const*);
|
||||
long atol(char const*);
|
||||
long long atoll(char const*);
|
||||
double strtod(char const*, char** endptr);
|
||||
long double strtold(char const*, char** endptr);
|
||||
float strtof(char const*, char** endptr);
|
||||
long strtol(char const*, char** endptr, int base);
|
||||
long long strtoll(char const*, char** endptr, int base);
|
||||
unsigned long long strtoull(char const*, char** endptr, int base);
|
||||
unsigned long strtoul(char const*, char** endptr, int base);
|
||||
void qsort(void* base, size_t nmemb, size_t size, int (*compar)(void const*, void const*));
|
||||
void qsort_r(void* base, size_t nmemb, size_t size, int (*compar)(void const*, void const*, void*), void* arg);
|
||||
int atexit(void (*function)(void));
|
||||
__attribute__((noreturn)) void exit(int status);
|
||||
__attribute__((noreturn)) void abort(void);
|
||||
|
@ -56,18 +56,18 @@ int ptsname_r(int fd, char* buffer, size_t);
|
|||
int abs(int);
|
||||
long labs(long);
|
||||
long long int llabs(long long int);
|
||||
double atof(const char*);
|
||||
int system(const char* command);
|
||||
double atof(char const*);
|
||||
int system(char const* command);
|
||||
char* mktemp(char*);
|
||||
int mkstemp(char*);
|
||||
char* mkdtemp(char*);
|
||||
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*));
|
||||
void* bsearch(void const* key, void const* base, size_t nmemb, size_t size, int (*compar)(void const*, void const*));
|
||||
int mblen(char const*, size_t);
|
||||
size_t mbstowcs(wchar_t*, const char*, size_t);
|
||||
int mbtowc(wchar_t*, const char*, size_t);
|
||||
size_t mbstowcs(wchar_t*, char const*, size_t);
|
||||
int mbtowc(wchar_t*, char const*, size_t);
|
||||
int wctomb(char*, wchar_t);
|
||||
size_t wcstombs(char*, const wchar_t*, size_t);
|
||||
char* realpath(const char* pathname, char* buffer);
|
||||
size_t wcstombs(char*, wchar_t const*, size_t);
|
||||
char* realpath(char const* pathname, char* buffer);
|
||||
__attribute__((noreturn)) void _Exit(int status);
|
||||
|
||||
#define RAND_MAX 32767
|
||||
|
|
|
@ -22,13 +22,13 @@
|
|||
extern "C" {
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strspn.html
|
||||
size_t strspn(const char* s, const char* accept)
|
||||
size_t strspn(char const* s, char const* accept)
|
||||
{
|
||||
const char* p = s;
|
||||
char const* p = s;
|
||||
cont:
|
||||
char ch = *p++;
|
||||
char ac;
|
||||
for (const char* ap = accept; (ac = *ap++) != '\0';) {
|
||||
for (char const* ap = accept; (ac = *ap++) != '\0';) {
|
||||
if (ac == ch)
|
||||
goto cont;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ cont:
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strcspn.html
|
||||
size_t strcspn(const char* s, const char* reject)
|
||||
size_t strcspn(char const* s, char const* reject)
|
||||
{
|
||||
for (auto* p = s;;) {
|
||||
char c = *p++;
|
||||
|
@ -50,7 +50,7 @@ size_t strcspn(const char* s, const char* reject)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strlen.html
|
||||
size_t strlen(const char* str)
|
||||
size_t strlen(char const* str)
|
||||
{
|
||||
size_t len = 0;
|
||||
while (*(str++))
|
||||
|
@ -59,7 +59,7 @@ size_t strlen(const char* str)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strnlen.html
|
||||
size_t strnlen(const char* str, size_t maxlen)
|
||||
size_t strnlen(char const* str, size_t maxlen)
|
||||
{
|
||||
size_t len = 0;
|
||||
for (; len < maxlen && *str; str++)
|
||||
|
@ -68,7 +68,7 @@ size_t strnlen(const char* str, size_t maxlen)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strdup.html
|
||||
char* strdup(const char* str)
|
||||
char* strdup(char const* str)
|
||||
{
|
||||
size_t len = strlen(str);
|
||||
char* new_str = (char*)malloc(len + 1);
|
||||
|
@ -78,7 +78,7 @@ char* strdup(const char* str)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strndup.html
|
||||
char* strndup(const char* str, size_t maxlen)
|
||||
char* strndup(char const* str, size_t maxlen)
|
||||
{
|
||||
size_t len = strnlen(str, maxlen);
|
||||
char* new_str = (char*)malloc(len + 1);
|
||||
|
@ -88,22 +88,22 @@ char* strndup(const char* str, size_t maxlen)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strcmp.html
|
||||
int strcmp(const char* s1, const char* s2)
|
||||
int strcmp(char const* s1, char const* s2)
|
||||
{
|
||||
while (*s1 == *s2++)
|
||||
if (*s1++ == 0)
|
||||
return 0;
|
||||
return *(const unsigned char*)s1 - *(const unsigned char*)--s2;
|
||||
return *(unsigned char const*)s1 - *(unsigned char const*)--s2;
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strncmp.html
|
||||
int strncmp(const char* s1, const char* s2, size_t n)
|
||||
int strncmp(char const* s1, char const* s2, size_t n)
|
||||
{
|
||||
if (!n)
|
||||
return 0;
|
||||
do {
|
||||
if (*s1 != *s2++)
|
||||
return *(const unsigned char*)s1 - *(const unsigned char*)--s2;
|
||||
return *(unsigned char const*)s1 - *(unsigned char const*)--s2;
|
||||
if (*s1++ == 0)
|
||||
break;
|
||||
} while (--n);
|
||||
|
@ -111,10 +111,10 @@ int strncmp(const char* s1, const char* s2, size_t n)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/memcmp.html
|
||||
int memcmp(const void* v1, const void* v2, size_t n)
|
||||
int memcmp(void const* v1, void const* v2, size_t n)
|
||||
{
|
||||
auto* s1 = (const uint8_t*)v1;
|
||||
auto* s2 = (const uint8_t*)v2;
|
||||
auto* s1 = (uint8_t const*)v1;
|
||||
auto* s2 = (uint8_t const*)v2;
|
||||
while (n-- > 0) {
|
||||
if (*s1++ != *s2++)
|
||||
return s1[-1] < s2[-1] ? -1 : 1;
|
||||
|
@ -122,13 +122,13 @@ int memcmp(const void* v1, const void* v2, size_t n)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int timingsafe_memcmp(const void* b1, const void* b2, size_t len)
|
||||
int timingsafe_memcmp(void const* b1, void const* b2, size_t len)
|
||||
{
|
||||
return AK::timing_safe_compare(b1, b2, len) ? 1 : 0;
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/memcpy.html
|
||||
void* memcpy(void* dest_ptr, const void* src_ptr, size_t n)
|
||||
void* memcpy(void* dest_ptr, void const* src_ptr, size_t n)
|
||||
{
|
||||
void* original_dest = dest_ptr;
|
||||
asm volatile(
|
||||
|
@ -171,25 +171,25 @@ void* memset(void* dest_ptr, int c, size_t n)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/memmove.html
|
||||
void* memmove(void* dest, const void* src, size_t n)
|
||||
void* memmove(void* dest, void const* src, size_t n)
|
||||
{
|
||||
if (((FlatPtr)dest - (FlatPtr)src) >= n)
|
||||
return memcpy(dest, src, n);
|
||||
|
||||
u8* pd = (u8*)dest;
|
||||
const u8* ps = (const u8*)src;
|
||||
u8 const* ps = (u8 const*)src;
|
||||
for (pd += n, ps += n; n--;)
|
||||
*--pd = *--ps;
|
||||
return dest;
|
||||
}
|
||||
|
||||
const void* memmem(const void* haystack, size_t haystack_length, const void* needle, size_t needle_length)
|
||||
void const* memmem(void const* haystack, size_t haystack_length, void const* needle, size_t needle_length)
|
||||
{
|
||||
return AK::memmem(haystack, haystack_length, needle, needle_length);
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strcpy.html
|
||||
char* strcpy(char* dest, const char* src)
|
||||
char* strcpy(char* dest, char const* src)
|
||||
{
|
||||
char* original_dest = dest;
|
||||
while ((*dest++ = *src++) != '\0')
|
||||
|
@ -198,7 +198,7 @@ char* strcpy(char* dest, const char* src)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strncpy.html
|
||||
char* strncpy(char* dest, const char* src, size_t n)
|
||||
char* strncpy(char* dest, char const* src, size_t n)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < n && src[i] != '\0'; ++i)
|
||||
|
@ -208,7 +208,7 @@ char* strncpy(char* dest, const char* src, size_t n)
|
|||
return dest;
|
||||
}
|
||||
|
||||
size_t strlcpy(char* dest, const char* src, size_t n)
|
||||
size_t strlcpy(char* dest, char const* src, size_t n)
|
||||
{
|
||||
size_t i;
|
||||
// Would like to test i < n - 1 here, but n might be 0.
|
||||
|
@ -222,7 +222,7 @@ size_t strlcpy(char* dest, const char* src, size_t n)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strchr.html
|
||||
char* strchr(const char* str, int c)
|
||||
char* strchr(char const* str, int c)
|
||||
{
|
||||
char ch = c;
|
||||
for (;; ++str) {
|
||||
|
@ -234,12 +234,12 @@ char* strchr(const char* str, int c)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699959399/functions/index.html
|
||||
char* index(const char* str, int c)
|
||||
char* index(char const* str, int c)
|
||||
{
|
||||
return strchr(str, c);
|
||||
}
|
||||
|
||||
char* strchrnul(const char* str, int c)
|
||||
char* strchrnul(char const* str, int c)
|
||||
{
|
||||
char ch = c;
|
||||
for (;; ++str) {
|
||||
|
@ -249,10 +249,10 @@ char* strchrnul(const char* str, int c)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/memchr.html
|
||||
void* memchr(const void* ptr, int c, size_t size)
|
||||
void* memchr(void const* ptr, int c, size_t size)
|
||||
{
|
||||
char ch = c;
|
||||
auto* cptr = (const char*)ptr;
|
||||
auto* cptr = (char const*)ptr;
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
if (cptr[i] == ch)
|
||||
return const_cast<char*>(cptr + i);
|
||||
|
@ -261,7 +261,7 @@ void* memchr(const void* ptr, int c, size_t size)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strrchr.html
|
||||
char* strrchr(const char* str, int ch)
|
||||
char* strrchr(char const* str, int ch)
|
||||
{
|
||||
char* last = nullptr;
|
||||
char c;
|
||||
|
@ -273,13 +273,13 @@ char* strrchr(const char* str, int ch)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699959399/functions/rindex.html
|
||||
char* rindex(const char* str, int ch)
|
||||
char* rindex(char const* str, int ch)
|
||||
{
|
||||
return strrchr(str, ch);
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strcat.html
|
||||
char* strcat(char* dest, const char* src)
|
||||
char* strcat(char* dest, char const* src)
|
||||
{
|
||||
size_t dest_length = strlen(dest);
|
||||
size_t i;
|
||||
|
@ -290,7 +290,7 @@ char* strcat(char* dest, const char* src)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strncat.html
|
||||
char* strncat(char* dest, const char* src, size_t n)
|
||||
char* strncat(char* dest, char const* src, size_t n)
|
||||
{
|
||||
size_t dest_length = strlen(dest);
|
||||
size_t i;
|
||||
|
@ -300,7 +300,7 @@ char* strncat(char* dest, const char* src, size_t n)
|
|||
return dest;
|
||||
}
|
||||
|
||||
const char* const sys_errlist[] = {
|
||||
char const* const sys_errlist[] = {
|
||||
#define __ENUMERATE_ERRNO_CODE(c, s) s,
|
||||
ENUMERATE_ERRNO_CODES(__ENUMERATE_ERRNO_CODE)
|
||||
#undef __ENUMERATE_ERRNO_CODE
|
||||
|
@ -350,7 +350,7 @@ char* strsignal(int signum)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strstr.html
|
||||
char* strstr(const char* haystack, const char* needle)
|
||||
char* strstr(char const* haystack, char const* needle)
|
||||
{
|
||||
char nch;
|
||||
char hch;
|
||||
|
@ -369,7 +369,7 @@ char* strstr(const char* haystack, const char* needle)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strpbrk.html
|
||||
char* strpbrk(const char* s, const char* accept)
|
||||
char* strpbrk(char const* s, char const* accept)
|
||||
{
|
||||
while (*s)
|
||||
if (strchr(accept, *s++))
|
||||
|
@ -378,7 +378,7 @@ char* strpbrk(const char* s, const char* accept)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtok_r.html
|
||||
char* strtok_r(char* str, const char* delim, char** saved_str)
|
||||
char* strtok_r(char* str, char const* delim, char** saved_str)
|
||||
{
|
||||
if (!str) {
|
||||
if (!saved_str || *saved_str == nullptr)
|
||||
|
@ -433,20 +433,20 @@ char* strtok_r(char* str, const char* delim, char** saved_str)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtok.html
|
||||
char* strtok(char* str, const char* delim)
|
||||
char* strtok(char* str, char const* delim)
|
||||
{
|
||||
static char* saved_str;
|
||||
return strtok_r(str, delim, &saved_str);
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strcoll.html
|
||||
int strcoll(const char* s1, const char* s2)
|
||||
int strcoll(char const* s1, char const* s2)
|
||||
{
|
||||
return strcmp(s1, s2);
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strxfrm.html
|
||||
size_t strxfrm(char* dest, const char* src, size_t n)
|
||||
size_t strxfrm(char* dest, char const* src, size_t n)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < n && src[i] != '\0'; ++i)
|
||||
|
|
|
@ -17,50 +17,50 @@ __BEGIN_DECLS
|
|||
// do the same here to maintain compatibility
|
||||
#include <strings.h>
|
||||
|
||||
size_t strlen(const char*);
|
||||
size_t strnlen(const char*, size_t maxlen);
|
||||
size_t strlen(char const*);
|
||||
size_t strnlen(char const*, size_t maxlen);
|
||||
|
||||
int strcmp(const char*, const char*);
|
||||
int strncmp(const char*, const char*, size_t);
|
||||
int strcmp(char const*, char const*);
|
||||
int strncmp(char const*, char const*, size_t);
|
||||
|
||||
int memcmp(const void*, const void*, size_t);
|
||||
int timingsafe_memcmp(const void*, const void*, size_t);
|
||||
void* memcpy(void*, const void*, size_t);
|
||||
void* memmove(void*, const void*, size_t);
|
||||
void* memchr(const void*, int c, size_t);
|
||||
const void* memmem(const void* haystack, size_t, const void* needle, size_t);
|
||||
int memcmp(void const*, void const*, size_t);
|
||||
int timingsafe_memcmp(void const*, void const*, size_t);
|
||||
void* memcpy(void*, void const*, size_t);
|
||||
void* memmove(void*, void const*, size_t);
|
||||
void* memchr(void const*, int c, size_t);
|
||||
void const* memmem(void const* haystack, size_t, void const* needle, size_t);
|
||||
|
||||
void* memset(void*, int, size_t);
|
||||
void explicit_bzero(void*, size_t) __attribute__((nonnull(1)));
|
||||
|
||||
__attribute__((malloc)) char* strdup(const char*);
|
||||
__attribute__((malloc)) char* strndup(const char*, size_t);
|
||||
__attribute__((malloc)) char* strdup(char const*);
|
||||
__attribute__((malloc)) char* strndup(char const*, size_t);
|
||||
|
||||
char* strcpy(char* dest, const char* src);
|
||||
char* strncpy(char* dest, const char* src, size_t);
|
||||
__attribute__((warn_unused_result)) size_t strlcpy(char* dest, const char* src, size_t);
|
||||
char* strcpy(char* dest, char const* src);
|
||||
char* strncpy(char* dest, char const* src, size_t);
|
||||
__attribute__((warn_unused_result)) size_t strlcpy(char* dest, char const* src, size_t);
|
||||
|
||||
char* strchr(const char*, int c);
|
||||
char* strchrnul(const char*, int c);
|
||||
char* strstr(const char* haystack, const char* needle);
|
||||
char* strrchr(const char*, int c);
|
||||
char* strchr(char const*, int c);
|
||||
char* strchrnul(char const*, int c);
|
||||
char* strstr(char const* haystack, char const* needle);
|
||||
char* strrchr(char const*, int c);
|
||||
|
||||
char* index(const char* str, int ch);
|
||||
char* rindex(const char* str, int ch);
|
||||
char* index(char const* str, int ch);
|
||||
char* rindex(char const* str, int ch);
|
||||
|
||||
char* strcat(char* dest, const char* src);
|
||||
char* strncat(char* dest, const char* src, size_t);
|
||||
char* strcat(char* dest, char const* src);
|
||||
char* strncat(char* dest, char const* src, size_t);
|
||||
|
||||
size_t strspn(const char*, const char* accept);
|
||||
size_t strcspn(const char*, const char* reject);
|
||||
size_t strspn(char const*, char const* accept);
|
||||
size_t strcspn(char const*, char const* reject);
|
||||
int strerror_r(int, char*, size_t);
|
||||
char* strerror(int errnum);
|
||||
char* strsignal(int signum);
|
||||
char* strpbrk(const char*, const char* accept);
|
||||
char* strtok_r(char* str, const char* delim, char** saved_str);
|
||||
char* strtok(char* str, const char* delim);
|
||||
int strcoll(const char* s1, const char* s2);
|
||||
size_t strxfrm(char* dest, const char* src, size_t n);
|
||||
char* strpbrk(char const*, char const* accept);
|
||||
char* strtok_r(char* str, char const* delim, char** saved_str);
|
||||
char* strtok(char* str, char const* delim);
|
||||
int strcoll(char const* s1, char const* s2);
|
||||
size_t strxfrm(char* dest, char const* src, size_t n);
|
||||
char* strsep(char** str, char const* delim);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -16,7 +16,7 @@ void bzero(void* dest, size_t n)
|
|||
memset(dest, 0, n);
|
||||
}
|
||||
|
||||
void bcopy(const void* src, void* dest, size_t n)
|
||||
void bcopy(void const* src, void* dest, size_t n)
|
||||
{
|
||||
memmove(dest, src, n);
|
||||
}
|
||||
|
@ -29,23 +29,23 @@ static char foldcase(char ch)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strcasecmp.html
|
||||
int strcasecmp(const char* s1, const char* s2)
|
||||
int strcasecmp(char const* s1, char const* s2)
|
||||
{
|
||||
for (; foldcase(*s1) == foldcase(*s2); ++s1, ++s2) {
|
||||
if (*s1 == 0)
|
||||
return 0;
|
||||
}
|
||||
return foldcase(*(const unsigned char*)s1) < foldcase(*(const unsigned char*)s2) ? -1 : 1;
|
||||
return foldcase(*(unsigned char const*)s1) < foldcase(*(unsigned char const*)s2) ? -1 : 1;
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/strncasecmp.html
|
||||
int strncasecmp(const char* s1, const char* s2, size_t n)
|
||||
int strncasecmp(char const* s1, char const* s2, size_t n)
|
||||
{
|
||||
if (!n)
|
||||
return 0;
|
||||
do {
|
||||
if (foldcase(*s1) != foldcase(*s2++))
|
||||
return foldcase(*(const unsigned char*)s1) - foldcase(*(const unsigned char*)--s2);
|
||||
return foldcase(*(unsigned char const*)s1) - foldcase(*(unsigned char const*)--s2);
|
||||
if (*s1++ == 0)
|
||||
break;
|
||||
} while (--n);
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
int strcasecmp(const char*, const char*);
|
||||
int strncasecmp(const char*, const char*, size_t);
|
||||
int strcasecmp(char const*, char const*);
|
||||
int strncasecmp(char const*, char const*, size_t);
|
||||
void bzero(void*, size_t);
|
||||
void bcopy(const void*, void*, size_t);
|
||||
void bcopy(void const*, void*, size_t);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
extern "C" {
|
||||
|
||||
void* serenity_mmap(void* addr, size_t size, int prot, int flags, int fd, off_t offset, size_t alignment, const char* name)
|
||||
void* serenity_mmap(void* addr, size_t size, int prot, int flags, int fd, off_t offset, size_t alignment, char const* name)
|
||||
{
|
||||
Syscall::SC_mmap_params params { addr, size, alignment, prot, flags, fd, offset, { name, name ? strlen(name) : 0 } };
|
||||
ptrdiff_t rc = syscall(SC_mmap, ¶ms);
|
||||
|
@ -30,7 +30,7 @@ void* mmap(void* addr, size_t size, int prot, int flags, int fd, off_t offset)
|
|||
return serenity_mmap(addr, size, prot, flags, fd, offset, PAGE_SIZE, nullptr);
|
||||
}
|
||||
|
||||
void* mmap_with_name(void* addr, size_t size, int prot, int flags, int fd, off_t offset, const char* name)
|
||||
void* mmap_with_name(void* addr, size_t size, int prot, int flags, int fd, off_t offset, char const* name)
|
||||
{
|
||||
return serenity_mmap(addr, size, prot, flags, fd, offset, PAGE_SIZE, name);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ int mprotect(void* addr, size_t size, int prot)
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int set_mmap_name(void* addr, size_t size, const char* name)
|
||||
int set_mmap_name(void* addr, size_t size, char const* name)
|
||||
{
|
||||
if (!name) {
|
||||
errno = EFAULT;
|
||||
|
@ -83,7 +83,7 @@ int posix_madvise(void* address, size_t len, int advice)
|
|||
return madvise(address, len, advice);
|
||||
}
|
||||
|
||||
void* allocate_tls(const char* initial_data, size_t size)
|
||||
void* allocate_tls(char const* initial_data, size_t size)
|
||||
{
|
||||
ptrdiff_t rc = syscall(SC_allocate_tls, initial_data, size);
|
||||
if (rc < 0 && rc > -EMAXERRNO) {
|
||||
|
@ -94,14 +94,14 @@ void* allocate_tls(const char* initial_data, size_t size)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/mlock.html
|
||||
int mlock(const void*, size_t)
|
||||
int mlock(void const*, size_t)
|
||||
{
|
||||
dbgln("FIXME: Implement mlock()");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/munlock.html
|
||||
int munlock(const void*, size_t)
|
||||
int munlock(void const*, size_t)
|
||||
{
|
||||
dbgln("FIXME: Implement munlock()");
|
||||
return 0;
|
||||
|
|
|
@ -11,17 +11,17 @@
|
|||
__BEGIN_DECLS
|
||||
|
||||
void* mmap(void* addr, size_t, int prot, int flags, int fd, off_t);
|
||||
void* mmap_with_name(void* addr, size_t, int prot, int flags, int fd, off_t, const char* name);
|
||||
void* serenity_mmap(void* addr, size_t, int prot, int flags, int fd, off_t, size_t alignment, const char* name);
|
||||
void* mmap_with_name(void* addr, size_t, int prot, int flags, int fd, off_t, char const* name);
|
||||
void* serenity_mmap(void* addr, size_t, int prot, int flags, int fd, off_t, size_t alignment, char const* name);
|
||||
void* mremap(void* old_address, size_t old_size, size_t new_size, int flags);
|
||||
int munmap(void*, size_t);
|
||||
int mprotect(void*, size_t, int prot);
|
||||
int set_mmap_name(void*, size_t, const char*);
|
||||
int set_mmap_name(void*, size_t, char const*);
|
||||
int madvise(void*, size_t, int advice);
|
||||
int posix_madvise(void*, size_t, int advice);
|
||||
void* allocate_tls(const char* initial_data, size_t);
|
||||
int mlock(const void*, size_t);
|
||||
int munlock(const void*, size_t);
|
||||
void* allocate_tls(char const* initial_data, size_t);
|
||||
int mlock(void const*, size_t);
|
||||
int munlock(void const*, size_t);
|
||||
int msync(void*, size_t, int flags);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -28,7 +28,7 @@ int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, timev
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/pselect.html
|
||||
int pselect(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, const timespec* timeout, const sigset_t* sigmask)
|
||||
int pselect(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, timespec const* timeout, sigset_t const* sigmask)
|
||||
{
|
||||
Vector<pollfd, FD_SETSIZE> fds;
|
||||
|
||||
|
|
|
@ -16,6 +16,6 @@
|
|||
__BEGIN_DECLS
|
||||
|
||||
int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, struct timeval* timeout);
|
||||
int pselect(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, const struct timespec* timeout, const sigset_t* sigmask);
|
||||
int pselect(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, const struct timespec* timeout, sigset_t const* sigmask);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -22,7 +22,7 @@ int socket(int domain, int type, int protocol)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html
|
||||
int bind(int sockfd, const sockaddr* addr, socklen_t addrlen)
|
||||
int bind(int sockfd, sockaddr const* addr, socklen_t addrlen)
|
||||
{
|
||||
int rc = syscall(SC_bind, sockfd, addr, addrlen);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
|
@ -49,7 +49,7 @@ int accept4(int sockfd, sockaddr* addr, socklen_t* addrlen, int flags)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html
|
||||
int connect(int sockfd, const sockaddr* addr, socklen_t addrlen)
|
||||
int connect(int sockfd, sockaddr const* addr, socklen_t addrlen)
|
||||
{
|
||||
int rc = syscall(SC_connect, sockfd, addr, addrlen);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
|
@ -70,7 +70,7 @@ ssize_t sendmsg(int sockfd, const struct msghdr* msg, int flags)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html
|
||||
ssize_t sendto(int sockfd, const void* data, size_t data_length, int flags, const struct sockaddr* addr, socklen_t addr_length)
|
||||
ssize_t sendto(int sockfd, void const* data, size_t data_length, int flags, const struct sockaddr* addr, socklen_t addr_length)
|
||||
{
|
||||
iovec iov = { const_cast<void*>(data), data_length };
|
||||
msghdr msg = { const_cast<struct sockaddr*>(addr), addr_length, &iov, 1, nullptr, 0, 0 };
|
||||
|
@ -78,7 +78,7 @@ ssize_t sendto(int sockfd, const void* data, size_t data_length, int flags, cons
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html
|
||||
ssize_t send(int sockfd, const void* data, size_t data_length, int flags)
|
||||
ssize_t send(int sockfd, void const* data, size_t data_length, int flags)
|
||||
{
|
||||
return sendto(sockfd, data, data_length, flags, nullptr, 0);
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ int getsockopt(int sockfd, int level, int option, void* value, socklen_t* value_
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
|
||||
int setsockopt(int sockfd, int level, int option, const void* value, socklen_t value_size)
|
||||
int setsockopt(int sockfd, int level, int option, void const* value, socklen_t value_size)
|
||||
{
|
||||
Syscall::SC_setsockopt_params params { value, sockfd, level, option, value_size };
|
||||
int rc = syscall(SC_setsockopt, ¶ms);
|
||||
|
|
|
@ -18,14 +18,14 @@ int accept(int sockfd, struct sockaddr*, socklen_t*);
|
|||
int accept4(int sockfd, struct sockaddr*, socklen_t*, int);
|
||||
int connect(int sockfd, const struct sockaddr*, socklen_t);
|
||||
int shutdown(int sockfd, int how);
|
||||
ssize_t send(int sockfd, const void*, size_t, int flags);
|
||||
ssize_t send(int sockfd, void const*, size_t, int flags);
|
||||
ssize_t sendmsg(int sockfd, const struct msghdr*, int flags);
|
||||
ssize_t sendto(int sockfd, const void*, size_t, int flags, const struct sockaddr*, socklen_t);
|
||||
ssize_t sendto(int sockfd, void const*, size_t, int flags, const struct sockaddr*, socklen_t);
|
||||
ssize_t recv(int sockfd, void*, size_t, int flags);
|
||||
ssize_t recvmsg(int sockfd, struct msghdr*, int flags);
|
||||
ssize_t recvfrom(int sockfd, void*, size_t, int flags, struct sockaddr*, socklen_t*);
|
||||
int getsockopt(int sockfd, int level, int option, void*, socklen_t*);
|
||||
int setsockopt(int sockfd, int level, int option, const void*, socklen_t);
|
||||
int setsockopt(int sockfd, int level, int option, void const*, socklen_t);
|
||||
int getsockname(int sockfd, struct sockaddr*, socklen_t*);
|
||||
int getpeername(int sockfd, struct sockaddr*, socklen_t*);
|
||||
int socketpair(int domain, int type, int protocol, int sv[2]);
|
||||
|
|
|
@ -14,14 +14,14 @@
|
|||
__BEGIN_DECLS
|
||||
|
||||
mode_t umask(mode_t);
|
||||
int chmod(const char* pathname, mode_t);
|
||||
int chmod(char const* pathname, mode_t);
|
||||
int fchmodat(int fd, char const* path, mode_t mode, int flag);
|
||||
int fchmod(int fd, mode_t);
|
||||
int mkdir(const char* pathname, mode_t);
|
||||
int mkfifo(const char* pathname, mode_t);
|
||||
int mkdir(char const* pathname, mode_t);
|
||||
int mkfifo(char const* pathname, mode_t);
|
||||
int fstat(int fd, struct stat* statbuf);
|
||||
int lstat(const char* path, struct stat* statbuf);
|
||||
int stat(const char* path, struct stat* statbuf);
|
||||
int fstatat(int fd, const char* path, struct stat* statbuf, int flags);
|
||||
int lstat(char const* path, struct stat* statbuf);
|
||||
int stat(char const* path, struct stat* statbuf);
|
||||
int fstatat(int fd, char const* path, struct stat* statbuf, int flags);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
extern "C" {
|
||||
|
||||
int statvfs(const char* path, struct statvfs* buf)
|
||||
int statvfs(char const* path, struct statvfs* buf)
|
||||
{
|
||||
Syscall::SC_statvfs_params params { { path, strlen(path) }, buf };
|
||||
int rc = syscall(SC_statvfs, ¶ms);
|
||||
|
|
|
@ -19,7 +19,7 @@ struct timezone {
|
|||
int adjtime(const struct timeval* delta, struct timeval* old_delta);
|
||||
int gettimeofday(struct timeval* __restrict__, void* __restrict__);
|
||||
int settimeofday(struct timeval* __restrict__, void* __restrict__);
|
||||
int utimes(const char* pathname, const struct timeval[2]);
|
||||
int utimes(char const* pathname, const struct timeval[2]);
|
||||
|
||||
static inline void timeradd(const struct timeval* a, const struct timeval* b, struct timeval* out)
|
||||
{
|
||||
|
|
|
@ -7,49 +7,49 @@
|
|||
#include <AK/Format.h>
|
||||
#include <sys/xattr.h>
|
||||
|
||||
ssize_t getxattr(const char*, const char*, void*, size_t)
|
||||
ssize_t getxattr(char const*, char const*, void*, size_t)
|
||||
{
|
||||
dbgln("FIXME: Implement getxattr()");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ssize_t lgetxattr(const char*, const char*, void*, size_t)
|
||||
ssize_t lgetxattr(char const*, char const*, void*, size_t)
|
||||
{
|
||||
dbgln("FIXME: Implement lgetxattr()");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ssize_t fgetxattr(int, const char*, void*, size_t)
|
||||
ssize_t fgetxattr(int, char const*, void*, size_t)
|
||||
{
|
||||
dbgln("FIXME: Implement fgetxattr()");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int setxattr(const char*, const char*, const void*, size_t, int)
|
||||
int setxattr(char const*, char const*, void const*, size_t, int)
|
||||
{
|
||||
dbgln("FIXME: Implement setxattr()");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lsetxattr(const char*, const char*, const void*, size_t, int)
|
||||
int lsetxattr(char const*, char const*, void const*, size_t, int)
|
||||
{
|
||||
dbgln("FIXME: Implement lsetxattr()");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fsetxattr(int, const char*, const void*, size_t, int)
|
||||
int fsetxattr(int, char const*, void const*, size_t, int)
|
||||
{
|
||||
dbgln("FIXME: Implement fsetxattr()");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ssize_t listxattr(const char*, char*, size_t)
|
||||
ssize_t listxattr(char const*, char*, size_t)
|
||||
{
|
||||
dbgln("FIXME: Implement listxattr()");
|
||||
return 0;
|
||||
}
|
||||
|
||||
ssize_t llistxattr(const char*, char*, size_t)
|
||||
ssize_t llistxattr(char const*, char*, size_t)
|
||||
{
|
||||
dbgln("FIXME: Implement llistxattr()");
|
||||
return 0;
|
||||
|
|
|
@ -10,16 +10,16 @@
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
ssize_t getxattr(const char* path, const char* name, void* value, size_t size);
|
||||
ssize_t lgetxattr(const char* path, const char* name, void* value, size_t size);
|
||||
ssize_t fgetxattr(int fd, const char* name, void* value, size_t size);
|
||||
ssize_t getxattr(char const* path, char const* name, void* value, size_t size);
|
||||
ssize_t lgetxattr(char const* path, char const* name, void* value, size_t size);
|
||||
ssize_t fgetxattr(int fd, char const* name, void* value, size_t size);
|
||||
|
||||
int setxattr(const char* path, const char* name, const void* value, size_t size, int flags);
|
||||
int lsetxattr(const char* path, const char* name, const void* value, size_t size, int flags);
|
||||
int fsetxattr(int fd, const char* name, const void* value, size_t size, int flags);
|
||||
int setxattr(char const* path, char const* name, void const* value, size_t size, int flags);
|
||||
int lsetxattr(char const* path, char const* name, void const* value, size_t size, int flags);
|
||||
int fsetxattr(int fd, char const* name, void const* value, size_t size, int flags);
|
||||
|
||||
ssize_t listxattr(const char* path, char* list, size_t size);
|
||||
ssize_t llistxattr(const char* path, char* list, size_t size);
|
||||
ssize_t listxattr(char const* path, char* list, size_t size);
|
||||
ssize_t llistxattr(char const* path, char* list, size_t size);
|
||||
ssize_t flistxattr(int fd, char* list, size_t size);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -36,7 +36,7 @@ static bool program_name_set = false;
|
|||
|
||||
// Convenience function for initialization and checking what string to use
|
||||
// for the program name.
|
||||
static const char* get_syslog_ident(struct syslog_data* data)
|
||||
static char const* get_syslog_ident(struct syslog_data* data)
|
||||
{
|
||||
if (!program_name_set && data->ident == nullptr)
|
||||
program_name_set = get_process_name(program_name_buffer, sizeof(program_name_buffer)) >= 0;
|
||||
|
@ -49,7 +49,7 @@ static const char* get_syslog_ident(struct syslog_data* data)
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void openlog_r(const char* ident, int logopt, int facility, struct syslog_data* data)
|
||||
void openlog_r(char const* ident, int logopt, int facility, struct syslog_data* data)
|
||||
{
|
||||
data->ident = ident;
|
||||
data->logopt = logopt;
|
||||
|
@ -59,7 +59,7 @@ void openlog_r(const char* ident, int logopt, int facility, struct syslog_data*
|
|||
// would be where we connect to a daemon
|
||||
}
|
||||
|
||||
void openlog(const char* ident, int logopt, int facility)
|
||||
void openlog(char const* ident, int logopt, int facility)
|
||||
{
|
||||
openlog_r(ident, logopt, facility, &global_log_data);
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ int setlogmask(int maskpri)
|
|||
return setlogmask_r(maskpri, &global_log_data);
|
||||
}
|
||||
|
||||
void syslog_r(int priority, struct syslog_data* data, const char* message, ...)
|
||||
void syslog_r(int priority, struct syslog_data* data, char const* message, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, message);
|
||||
|
@ -100,7 +100,7 @@ void syslog_r(int priority, struct syslog_data* data, const char* message, ...)
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
void syslog(int priority, const char* message, ...)
|
||||
void syslog(int priority, char const* message, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, message);
|
||||
|
@ -108,7 +108,7 @@ void syslog(int priority, const char* message, ...)
|
|||
va_end(ap);
|
||||
}
|
||||
|
||||
void vsyslog_r(int priority, struct syslog_data* data, const char* message, va_list args)
|
||||
void vsyslog_r(int priority, struct syslog_data* data, char const* message, va_list args)
|
||||
{
|
||||
StringBuilder combined;
|
||||
|
||||
|
@ -132,7 +132,7 @@ void vsyslog_r(int priority, struct syslog_data* data, const char* message, va_l
|
|||
fputs(combined_string.characters(), stderr);
|
||||
}
|
||||
|
||||
void vsyslog(int priority, const char* message, va_list args)
|
||||
void vsyslog(int priority, char const* message, va_list args)
|
||||
{
|
||||
vsyslog_r(priority, &global_log_data, message, args);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
__BEGIN_DECLS
|
||||
|
||||
struct syslog_data {
|
||||
const char* ident;
|
||||
char const* ident;
|
||||
int logopt;
|
||||
int facility;
|
||||
int maskpri;
|
||||
|
@ -95,7 +95,7 @@ typedef struct _code {
|
|||
* Most Unices define this as char*, but in C++, we have to define it as a
|
||||
* const char* if we want to use string constants.
|
||||
*/
|
||||
const char* c_name;
|
||||
char const* c_name;
|
||||
int c_val;
|
||||
} CODE;
|
||||
|
||||
|
@ -146,12 +146,12 @@ CODE facilitynames[] = {
|
|||
#endif
|
||||
|
||||
/* The re-entrant versions are an OpenBSD extension we also implement. */
|
||||
void syslog(int, const char*, ...);
|
||||
void syslog_r(int, struct syslog_data*, const char*, ...);
|
||||
void vsyslog(int, const char* message, va_list);
|
||||
void vsyslog_r(int, struct syslog_data* data, const char* message, va_list);
|
||||
void openlog(const char*, int, int);
|
||||
void openlog_r(const char*, int, int, struct syslog_data*);
|
||||
void syslog(int, char const*, ...);
|
||||
void syslog_r(int, struct syslog_data*, char const*, ...);
|
||||
void vsyslog(int, char const* message, va_list);
|
||||
void vsyslog_r(int, struct syslog_data* data, char const* message, va_list);
|
||||
void openlog(char const*, int, int);
|
||||
void openlog_r(char const*, int, int, struct syslog_data*);
|
||||
void closelog(void);
|
||||
void closelog_r(struct syslog_data*);
|
||||
int setlogmask(int);
|
||||
|
|
|
@ -18,7 +18,7 @@ char PC;
|
|||
char* UP;
|
||||
char* BC;
|
||||
|
||||
int __attribute__((weak)) tgetent([[maybe_unused]] char* bp, [[maybe_unused]] const char* name)
|
||||
int __attribute__((weak)) tgetent([[maybe_unused]] char* bp, [[maybe_unused]] char const* name)
|
||||
{
|
||||
warnln_if(TERMCAP_DEBUG, "tgetent: bp={:p}, name='{}'", bp, name);
|
||||
PC = '\0';
|
||||
|
@ -27,13 +27,13 @@ int __attribute__((weak)) tgetent([[maybe_unused]] char* bp, [[maybe_unused]] co
|
|||
return 1;
|
||||
}
|
||||
|
||||
static HashMap<String, const char*>* caps = nullptr;
|
||||
static HashMap<String, char const*>* caps = nullptr;
|
||||
|
||||
static void ensure_caps()
|
||||
{
|
||||
if (caps)
|
||||
return;
|
||||
caps = new HashMap<String, const char*>;
|
||||
caps = new HashMap<String, char const*>;
|
||||
caps->set("DC", "\033[%p1%dP");
|
||||
caps->set("IC", "\033[%p1%d@");
|
||||
caps->set("ce", "\033[K");
|
||||
|
@ -75,14 +75,14 @@ static void ensure_caps()
|
|||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
char* __attribute__((weak)) tgetstr(const char* id, char** area)
|
||||
char* __attribute__((weak)) tgetstr(char const* id, char** area)
|
||||
{
|
||||
ensure_caps();
|
||||
warnln_if(TERMCAP_DEBUG, "tgetstr: id='{}'", id);
|
||||
auto it = caps->find(id);
|
||||
if (it != caps->end()) {
|
||||
char* ret = *area;
|
||||
const char* val = (*it).value;
|
||||
char const* val = (*it).value;
|
||||
strcpy(*area, val);
|
||||
*area += strlen(val) + 1;
|
||||
return ret;
|
||||
|
@ -93,7 +93,7 @@ char* __attribute__((weak)) tgetstr(const char* id, char** area)
|
|||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
int __attribute__((weak)) tgetflag([[maybe_unused]] const char* id)
|
||||
int __attribute__((weak)) tgetflag([[maybe_unused]] char const* id)
|
||||
{
|
||||
warnln_if(TERMCAP_DEBUG, "tgetflag: '{}'", id);
|
||||
auto it = caps->find(id);
|
||||
|
@ -102,7 +102,7 @@ int __attribute__((weak)) tgetflag([[maybe_unused]] const char* id)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int __attribute__((weak)) tgetnum(const char* id)
|
||||
int __attribute__((weak)) tgetnum(char const* id)
|
||||
{
|
||||
warnln_if(TERMCAP_DEBUG, "tgetnum: '{}'", id);
|
||||
auto it = caps->find(id);
|
||||
|
@ -112,7 +112,7 @@ int __attribute__((weak)) tgetnum(const char* id)
|
|||
}
|
||||
|
||||
static Vector<char> s_tgoto_buffer;
|
||||
char* __attribute__((weak)) tgoto([[maybe_unused]] const char* cap, [[maybe_unused]] int col, [[maybe_unused]] int row)
|
||||
char* __attribute__((weak)) tgoto([[maybe_unused]] char const* cap, [[maybe_unused]] int col, [[maybe_unused]] int row)
|
||||
{
|
||||
auto cap_str = StringView(cap).replace("%p1%d", String::number(col)).replace("%p2%d", String::number(row));
|
||||
|
||||
|
@ -122,7 +122,7 @@ char* __attribute__((weak)) tgoto([[maybe_unused]] const char* cap, [[maybe_unus
|
|||
return s_tgoto_buffer.data();
|
||||
}
|
||||
|
||||
int __attribute__((weak)) tputs(const char* str, [[maybe_unused]] int affcnt, int (*putc)(int))
|
||||
int __attribute__((weak)) tputs(char const* str, [[maybe_unused]] int affcnt, int (*putc)(int))
|
||||
{
|
||||
size_t len = strlen(str);
|
||||
for (size_t i = 0; i < len; ++i)
|
||||
|
|
|
@ -14,11 +14,11 @@ extern char PC;
|
|||
extern char* UP;
|
||||
extern char* BC;
|
||||
|
||||
int tgetent(char* bp, const char* name);
|
||||
int tgetflag(const char* id);
|
||||
int tgetnum(const char* id);
|
||||
char* tgetstr(const char* id, char** area);
|
||||
char* tgoto(const char* cap, int col, int row);
|
||||
int tputs(const char* str, int affcnt, int (*putc)(int));
|
||||
int tgetent(char* bp, char const* name);
|
||||
int tgetflag(char const* id);
|
||||
int tgetnum(char const* id);
|
||||
char* tgetstr(char const* id, char** area);
|
||||
char* tgoto(char const* cap, int col, int row);
|
||||
int tputs(char const* str, int affcnt, int (*putc)(int));
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -68,7 +68,7 @@ int settimeofday(struct timeval* __restrict__ tv, void* __restrict__)
|
|||
return clock_settime(CLOCK_REALTIME, &ts);
|
||||
}
|
||||
|
||||
int utimes(const char* pathname, const struct timeval times[2])
|
||||
int utimes(char const* pathname, const struct timeval times[2])
|
||||
{
|
||||
if (!times) {
|
||||
return utime(pathname, nullptr);
|
||||
|
@ -78,18 +78,18 @@ int utimes(const char* pathname, const struct timeval times[2])
|
|||
return utime(pathname, &buf);
|
||||
}
|
||||
|
||||
char* ctime(const time_t* t)
|
||||
char* ctime(time_t const* t)
|
||||
{
|
||||
return asctime(localtime(t));
|
||||
}
|
||||
|
||||
char* ctime_r(const time_t* t, char* buf)
|
||||
char* ctime_r(time_t const* t, char* buf)
|
||||
{
|
||||
struct tm tm_buf;
|
||||
return asctime_r(localtime_r(t, &tm_buf), buf);
|
||||
}
|
||||
|
||||
static const int __seconds_per_day = 60 * 60 * 24;
|
||||
static int const __seconds_per_day = 60 * 60 * 24;
|
||||
|
||||
static void time_to_tm(struct tm* tm, time_t t)
|
||||
{
|
||||
|
@ -150,7 +150,7 @@ time_t mktime(struct tm* tm)
|
|||
return tm_to_time(tm, daylight ? altzone : timezone);
|
||||
}
|
||||
|
||||
struct tm* localtime(const time_t* t)
|
||||
struct tm* localtime(time_t const* t)
|
||||
{
|
||||
tzset();
|
||||
|
||||
|
@ -158,7 +158,7 @@ struct tm* localtime(const time_t* t)
|
|||
return localtime_r(t, &tm_buf);
|
||||
}
|
||||
|
||||
struct tm* localtime_r(const time_t* t, struct tm* tm)
|
||||
struct tm* localtime_r(time_t const* t, struct tm* tm)
|
||||
{
|
||||
if (!t)
|
||||
return nullptr;
|
||||
|
@ -172,13 +172,13 @@ time_t timegm(struct tm* tm)
|
|||
return tm_to_time(tm, 0);
|
||||
}
|
||||
|
||||
struct tm* gmtime(const time_t* t)
|
||||
struct tm* gmtime(time_t const* t)
|
||||
{
|
||||
static struct tm tm_buf;
|
||||
return gmtime_r(t, &tm_buf);
|
||||
}
|
||||
|
||||
struct tm* gmtime_r(const time_t* t, struct tm* tm)
|
||||
struct tm* gmtime_r(time_t const* t, struct tm* tm)
|
||||
{
|
||||
if (!t)
|
||||
return nullptr;
|
||||
|
@ -205,13 +205,13 @@ char* asctime_r(const struct tm* tm, char* buffer)
|
|||
}
|
||||
|
||||
// FIXME: Some formats are not supported.
|
||||
size_t strftime(char* destination, size_t max_size, const char* format, const struct tm* tm)
|
||||
size_t strftime(char* destination, size_t max_size, char const* format, const struct tm* tm)
|
||||
{
|
||||
tzset();
|
||||
|
||||
StringBuilder builder { max_size };
|
||||
|
||||
const int format_len = strlen(format);
|
||||
int const format_len = strlen(format);
|
||||
for (int i = 0; i < format_len; ++i) {
|
||||
if (format[i] != '%') {
|
||||
builder.append(format[i]);
|
||||
|
@ -287,20 +287,20 @@ size_t strftime(char* destination, size_t max_size, const char* format, const st
|
|||
builder.appendff("{}", tm->tm_wday ? tm->tm_wday : 7);
|
||||
break;
|
||||
case 'U': {
|
||||
const int wday_of_year_beginning = (tm->tm_wday + 6 * tm->tm_yday) % 7;
|
||||
const int week_number = (tm->tm_yday + wday_of_year_beginning) / 7;
|
||||
int const wday_of_year_beginning = (tm->tm_wday + 6 * tm->tm_yday) % 7;
|
||||
int const week_number = (tm->tm_yday + wday_of_year_beginning) / 7;
|
||||
builder.appendff("{:02}", week_number);
|
||||
break;
|
||||
}
|
||||
case 'V': {
|
||||
const int wday_of_year_beginning = (tm->tm_wday + 6 + 6 * tm->tm_yday) % 7;
|
||||
int const wday_of_year_beginning = (tm->tm_wday + 6 + 6 * tm->tm_yday) % 7;
|
||||
int week_number = (tm->tm_yday + wday_of_year_beginning) / 7 + 1;
|
||||
if (wday_of_year_beginning > 3) {
|
||||
if (tm->tm_yday >= 7 - wday_of_year_beginning)
|
||||
--week_number;
|
||||
else {
|
||||
const int days_of_last_year = days_in_year(tm->tm_year + 1900 - 1);
|
||||
const int wday_of_last_year_beginning = (wday_of_year_beginning + 6 * days_of_last_year) % 7;
|
||||
int const days_of_last_year = days_in_year(tm->tm_year + 1900 - 1);
|
||||
int const wday_of_last_year_beginning = (wday_of_year_beginning + 6 * days_of_last_year) % 7;
|
||||
week_number = (days_of_last_year + wday_of_last_year_beginning) / 7 + 1;
|
||||
if (wday_of_last_year_beginning > 3)
|
||||
--week_number;
|
||||
|
@ -313,8 +313,8 @@ size_t strftime(char* destination, size_t max_size, const char* format, const st
|
|||
builder.appendff("{}", tm->tm_wday);
|
||||
break;
|
||||
case 'W': {
|
||||
const int wday_of_year_beginning = (tm->tm_wday + 6 + 6 * tm->tm_yday) % 7;
|
||||
const int week_number = (tm->tm_yday + wday_of_year_beginning) / 7;
|
||||
int const wday_of_year_beginning = (tm->tm_wday + 6 + 6 * tm->tm_yday) % 7;
|
||||
int const week_number = (tm->tm_yday + wday_of_year_beginning) / 7;
|
||||
builder.appendff("{:02}", week_number);
|
||||
break;
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ size_t strftime(char* destination, size_t max_size, const char* format, const st
|
|||
|
||||
static char __tzname_standard[TZNAME_MAX];
|
||||
static char __tzname_daylight[TZNAME_MAX];
|
||||
constexpr const char* __utc = "UTC";
|
||||
constexpr char const* __utc = "UTC";
|
||||
|
||||
long timezone = 0;
|
||||
long altzone = 0;
|
||||
|
|
|
@ -30,13 +30,13 @@ extern int daylight;
|
|||
typedef uint32_t clock_t;
|
||||
typedef int64_t time_t;
|
||||
|
||||
struct tm* localtime(const time_t*);
|
||||
struct tm* gmtime(const time_t*);
|
||||
struct tm* localtime(time_t const*);
|
||||
struct tm* gmtime(time_t const*);
|
||||
time_t mktime(struct tm*);
|
||||
time_t timegm(struct tm*);
|
||||
time_t time(time_t*);
|
||||
char* ctime(const time_t*);
|
||||
char* ctime_r(const time_t* tm, char* buf);
|
||||
char* ctime(time_t const*);
|
||||
char* ctime_r(time_t const* tm, char* buf);
|
||||
void tzset(void);
|
||||
char* asctime(const struct tm*);
|
||||
char* asctime_r(const struct tm*, char* buf);
|
||||
|
@ -48,10 +48,10 @@ int clock_settime(clockid_t, struct timespec*);
|
|||
int clock_nanosleep(clockid_t, int flags, const struct timespec* requested_sleep, struct timespec* remaining_sleep);
|
||||
int clock_getres(clockid_t, struct timespec* result);
|
||||
int nanosleep(const struct timespec* requested_sleep, struct timespec* remaining_sleep);
|
||||
struct tm* gmtime_r(const time_t* timep, struct tm* result);
|
||||
struct tm* localtime_r(const time_t* timep, struct tm* result);
|
||||
struct tm* gmtime_r(time_t const* timep, struct tm* result);
|
||||
struct tm* localtime_r(time_t const* timep, struct tm* result);
|
||||
|
||||
double difftime(time_t, time_t);
|
||||
size_t strftime(char* s, size_t max, const char* format, const struct tm*) __attribute__((format(strftime, 3, 0)));
|
||||
size_t strftime(char* s, size_t max, char const* format, const struct tm*) __attribute__((format(strftime, 3, 0)));
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -44,7 +44,7 @@ static __thread int s_cached_tid = 0;
|
|||
static int s_cached_pid = 0;
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/lchown.html
|
||||
int lchown(const char* pathname, uid_t uid, gid_t gid)
|
||||
int lchown(char const* pathname, uid_t uid, gid_t gid)
|
||||
{
|
||||
if (!pathname) {
|
||||
errno = EFAULT;
|
||||
|
@ -56,7 +56,7 @@ int lchown(const char* pathname, uid_t uid, gid_t gid)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html
|
||||
int chown(const char* pathname, uid_t uid, gid_t gid)
|
||||
int chown(char const* pathname, uid_t uid, gid_t gid)
|
||||
{
|
||||
if (!pathname) {
|
||||
errno = EFAULT;
|
||||
|
@ -74,7 +74,7 @@ int fchown(int fd, uid_t uid, gid_t gid)
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int fchownat(int fd, const char* pathname, uid_t uid, gid_t gid, int flags)
|
||||
int fchownat(int fd, char const* pathname, uid_t uid, gid_t gid, int flags)
|
||||
{
|
||||
if (!pathname) {
|
||||
errno = EFAULT;
|
||||
|
@ -141,13 +141,13 @@ int daemon(int nochdir, int noclose)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/execv.html
|
||||
int execv(const char* path, char* const argv[])
|
||||
int execv(char const* path, char* const argv[])
|
||||
{
|
||||
return execve(path, argv, environ);
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/execve.html
|
||||
int execve(const char* filename, char* const argv[], char* const envp[])
|
||||
int execve(char const* filename, char* const argv[], char* const envp[])
|
||||
{
|
||||
size_t arg_count = 0;
|
||||
for (size_t i = 0; argv[i]; ++i)
|
||||
|
@ -177,7 +177,7 @@ int execve(const char* filename, char* const argv[], char* const envp[])
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int execvpe(const char* filename, char* const argv[], char* const envp[])
|
||||
int execvpe(char const* filename, char* const argv[], char* const envp[])
|
||||
{
|
||||
if (strchr(filename, '/'))
|
||||
return execve(filename, argv, envp);
|
||||
|
@ -202,7 +202,7 @@ int execvpe(const char* filename, char* const argv[], char* const envp[])
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/execvp.html
|
||||
int execvp(const char* filename, char* const argv[])
|
||||
int execvp(char const* filename, char* const argv[])
|
||||
{
|
||||
int rc = execvpe(filename, argv, environ);
|
||||
int saved_errno = errno;
|
||||
|
@ -212,15 +212,15 @@ int execvp(const char* filename, char* const argv[])
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/execl.html
|
||||
int execl(const char* filename, const char* arg0, ...)
|
||||
int execl(char const* filename, char const* arg0, ...)
|
||||
{
|
||||
Vector<const char*, 16> args;
|
||||
Vector<char const*, 16> args;
|
||||
args.append(arg0);
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, arg0);
|
||||
for (;;) {
|
||||
const char* arg = va_arg(ap, const char*);
|
||||
char const* arg = va_arg(ap, char const*);
|
||||
if (!arg)
|
||||
break;
|
||||
args.append(arg);
|
||||
|
@ -252,15 +252,15 @@ int execle(char const* filename, char const* arg0, ...)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/execlp.html
|
||||
int execlp(const char* filename, const char* arg0, ...)
|
||||
int execlp(char const* filename, char const* arg0, ...)
|
||||
{
|
||||
Vector<const char*, 16> args;
|
||||
Vector<char const*, 16> args;
|
||||
args.append(arg0);
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, arg0);
|
||||
for (;;) {
|
||||
const char* arg = va_arg(ap, const char*);
|
||||
char const* arg = va_arg(ap, char const*);
|
||||
if (!arg)
|
||||
break;
|
||||
args.append(arg);
|
||||
|
@ -386,14 +386,14 @@ ssize_t pread(int fd, void* buf, size_t count, off_t offset)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html
|
||||
ssize_t write(int fd, const void* buf, size_t count)
|
||||
ssize_t write(int fd, void const* buf, size_t count)
|
||||
{
|
||||
int rc = syscall(SC_write, fd, buf, count);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html
|
||||
ssize_t pwrite(int fd, const void* buf, size_t count, off_t offset)
|
||||
ssize_t pwrite(int fd, void const* buf, size_t count, off_t offset)
|
||||
{
|
||||
// FIXME: This is not thread safe and should be implemented in the kernel instead.
|
||||
off_t old_offset = lseek(fd, 0, SEEK_CUR);
|
||||
|
@ -404,7 +404,7 @@ ssize_t pwrite(int fd, const void* buf, size_t count, off_t offset)
|
|||
}
|
||||
|
||||
// Note: Be sure to send to directory_name parameter a directory name ended with trailing slash.
|
||||
static int ttyname_r_for_directory(const char* directory_name, dev_t device_mode, ino_t inode_number, char* buffer, size_t size)
|
||||
static int ttyname_r_for_directory(char const* directory_name, dev_t device_mode, ino_t inode_number, char* buffer, size_t size)
|
||||
{
|
||||
DIR* dirstream = opendir(directory_name);
|
||||
if (!dirstream) {
|
||||
|
@ -489,7 +489,7 @@ int close(int fd)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/chdir.html
|
||||
int chdir(const char* path)
|
||||
int chdir(char const* path)
|
||||
{
|
||||
if (!path) {
|
||||
errno = EFAULT;
|
||||
|
@ -608,14 +608,14 @@ int gethostname(char* buffer, size_t size)
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int sethostname(const char* hostname, ssize_t size)
|
||||
int sethostname(char const* hostname, ssize_t size)
|
||||
{
|
||||
int rc = syscall(SC_sethostname, hostname, size);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html
|
||||
ssize_t readlink(const char* path, char* buffer, size_t size)
|
||||
ssize_t readlink(char const* path, char* buffer, size_t size)
|
||||
{
|
||||
Syscall::SC_readlink_params params { { path, strlen(path) }, { buffer, size } };
|
||||
int rc = syscall(SC_readlink, ¶ms);
|
||||
|
@ -630,7 +630,7 @@ off_t lseek(int fd, off_t offset, int whence)
|
|||
__RETURN_WITH_ERRNO(rc, offset, -1);
|
||||
}
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html
|
||||
int link(const char* old_path, const char* new_path)
|
||||
int link(char const* old_path, char const* new_path)
|
||||
{
|
||||
if (!old_path || !new_path) {
|
||||
errno = EFAULT;
|
||||
|
@ -642,14 +642,14 @@ int link(const char* old_path, const char* new_path)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/unlink.html
|
||||
int unlink(const char* pathname)
|
||||
int unlink(char const* pathname)
|
||||
{
|
||||
int rc = syscall(SC_unlink, pathname, strlen(pathname));
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html
|
||||
int symlink(const char* target, const char* linkpath)
|
||||
int symlink(char const* target, char const* linkpath)
|
||||
{
|
||||
if (!target || !linkpath) {
|
||||
errno = EFAULT;
|
||||
|
@ -661,7 +661,7 @@ int symlink(const char* target, const char* linkpath)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/rmdir.html
|
||||
int rmdir(const char* pathname)
|
||||
int rmdir(char const* pathname)
|
||||
{
|
||||
if (!pathname) {
|
||||
errno = EFAULT;
|
||||
|
@ -690,7 +690,7 @@ int dup2(int old_fd, int new_fd)
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int setgroups(size_t size, const gid_t* list)
|
||||
int setgroups(size_t size, gid_t const* list)
|
||||
{
|
||||
int rc = syscall(SC_setgroups, size, list);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
|
@ -763,7 +763,7 @@ int setresgid(gid_t rgid, gid_t egid, gid_t sgid)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/access.html
|
||||
int access(const char* pathname, int mode)
|
||||
int access(char const* pathname, int mode)
|
||||
{
|
||||
if (!pathname) {
|
||||
errno = EFAULT;
|
||||
|
@ -774,7 +774,7 @@ int access(const char* pathname, int mode)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/mknod.html
|
||||
int mknod(const char* pathname, mode_t mode, dev_t dev)
|
||||
int mknod(char const* pathname, mode_t mode, dev_t dev)
|
||||
{
|
||||
if (!pathname) {
|
||||
errno = EFAULT;
|
||||
|
@ -803,7 +803,7 @@ long fpathconf([[maybe_unused]] int fd, int name)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/pathconf.html
|
||||
long pathconf([[maybe_unused]] const char* path, int name)
|
||||
long pathconf([[maybe_unused]] char const* path, int name)
|
||||
{
|
||||
switch (name) {
|
||||
case _PC_NAME_MAX:
|
||||
|
@ -853,7 +853,7 @@ int ftruncate(int fd, off_t length)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html
|
||||
int truncate(const char* path, off_t length)
|
||||
int truncate(char const* path, off_t length)
|
||||
{
|
||||
int fd = open(path, O_RDWR | O_CREAT, 0666);
|
||||
if (fd < 0)
|
||||
|
@ -889,7 +889,7 @@ int fsync(int fd)
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int mount(int source_fd, const char* target, const char* fs_type, int flags)
|
||||
int mount(int source_fd, char const* target, char const* fs_type, int flags)
|
||||
{
|
||||
if (!target || !fs_type) {
|
||||
errno = EFAULT;
|
||||
|
@ -906,7 +906,7 @@ int mount(int source_fd, const char* target, const char* fs_type, int flags)
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int umount(const char* mountpoint)
|
||||
int umount(char const* mountpoint)
|
||||
{
|
||||
int rc = syscall(SC_umount, mountpoint, strlen(mountpoint));
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
|
@ -923,13 +923,13 @@ int get_process_name(char* buffer, int buffer_size)
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int set_process_name(const char* name, size_t name_length)
|
||||
int set_process_name(char const* name, size_t name_length)
|
||||
{
|
||||
int rc = syscall(SC_set_process_name, name, name_length);
|
||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int pledge(const char* promises, const char* execpromises)
|
||||
int pledge(char const* promises, char const* execpromises)
|
||||
{
|
||||
Syscall::SC_pledge_params params {
|
||||
{ promises, promises ? strlen(promises) : 0 },
|
||||
|
@ -939,7 +939,7 @@ int pledge(const char* promises, const char* execpromises)
|
|||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||
}
|
||||
|
||||
int unveil(const char* path, const char* permissions)
|
||||
int unveil(char const* path, char const* permissions)
|
||||
{
|
||||
Syscall::SC_unveil_params params {
|
||||
{ path, path ? strlen(path) : 0 },
|
||||
|
@ -950,7 +950,7 @@ int unveil(const char* path, const char* permissions)
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpass.html
|
||||
char* getpass(const char* prompt)
|
||||
char* getpass(char const* prompt)
|
||||
{
|
||||
dbgln("FIXME: getpass('{}')", prompt);
|
||||
TODO();
|
||||
|
@ -976,7 +976,7 @@ int pause()
|
|||
}
|
||||
|
||||
// https://pubs.opengroup.org/onlinepubs/9699919799/functions/chroot.html
|
||||
int chroot(const char* path)
|
||||
int chroot(char const* path)
|
||||
{
|
||||
dbgln("FIXME: chroot(\"{}\")", path);
|
||||
return -1;
|
||||
|
|
|
@ -31,7 +31,7 @@ __BEGIN_DECLS
|
|||
extern char** environ;
|
||||
|
||||
int get_process_name(char* buffer, int buffer_size);
|
||||
int set_process_name(const char* name, size_t name_length);
|
||||
int set_process_name(char const* name, size_t name_length);
|
||||
void dump_backtrace(void);
|
||||
int fsync(int fd);
|
||||
int sysbeep(void);
|
||||
|
@ -40,13 +40,13 @@ int getpagesize(void);
|
|||
pid_t fork(void);
|
||||
pid_t vfork(void);
|
||||
int daemon(int nochdir, int noclose);
|
||||
int execv(const char* path, char* const argv[]);
|
||||
int execve(const char* filename, char* const argv[], char* const envp[]);
|
||||
int execvpe(const char* filename, char* const argv[], char* const envp[]);
|
||||
int execvp(const char* filename, char* const argv[]);
|
||||
int execl(const char* filename, const char* arg, ...);
|
||||
int execle(const char* filename, const char* arg, ...);
|
||||
int execlp(const char* filename, const char* arg, ...);
|
||||
int execv(char const* path, char* const argv[]);
|
||||
int execve(char const* filename, char* const argv[], char* const envp[]);
|
||||
int execvpe(char const* filename, char* const argv[], char* const envp[]);
|
||||
int execvp(char const* filename, char* const argv[]);
|
||||
int execl(char const* filename, char const* arg, ...);
|
||||
int execle(char const* filename, char const* arg, ...);
|
||||
int execlp(char const* filename, char const* arg, ...);
|
||||
void sync(void);
|
||||
__attribute__((noreturn)) void _exit(int status);
|
||||
pid_t getsid(pid_t);
|
||||
|
@ -63,7 +63,7 @@ pid_t getppid(void);
|
|||
int getresuid(uid_t*, uid_t*, uid_t*);
|
||||
int getresgid(gid_t*, gid_t*, gid_t*);
|
||||
int getgroups(int size, gid_t list[]);
|
||||
int setgroups(size_t, const gid_t*);
|
||||
int setgroups(size_t, gid_t const*);
|
||||
int seteuid(uid_t);
|
||||
int setegid(gid_t);
|
||||
int setuid(uid_t);
|
||||
|
@ -75,49 +75,49 @@ pid_t tcgetpgrp(int fd);
|
|||
int tcsetpgrp(int fd, pid_t pgid);
|
||||
ssize_t read(int fd, void* buf, size_t count);
|
||||
ssize_t pread(int fd, void* buf, size_t count, off_t);
|
||||
ssize_t write(int fd, const void* buf, size_t count);
|
||||
ssize_t pwrite(int fd, const void* buf, size_t count, off_t);
|
||||
ssize_t write(int fd, void const* buf, size_t count);
|
||||
ssize_t pwrite(int fd, void const* buf, size_t count, off_t);
|
||||
int close(int fd);
|
||||
int chdir(const char* path);
|
||||
int chdir(char const* path);
|
||||
int fchdir(int fd);
|
||||
char* getcwd(char* buffer, size_t size);
|
||||
char* getwd(char* buffer);
|
||||
unsigned int sleep(unsigned int seconds);
|
||||
int usleep(useconds_t);
|
||||
int gethostname(char*, size_t);
|
||||
int sethostname(const char*, ssize_t);
|
||||
ssize_t readlink(const char* path, char* buffer, size_t);
|
||||
int sethostname(char const*, ssize_t);
|
||||
ssize_t readlink(char const* path, char* buffer, size_t);
|
||||
char* ttyname(int fd);
|
||||
int ttyname_r(int fd, char* buffer, size_t);
|
||||
off_t lseek(int fd, off_t, int whence);
|
||||
int link(const char* oldpath, const char* newpath);
|
||||
int unlink(const char* pathname);
|
||||
int symlink(const char* target, const char* linkpath);
|
||||
int rmdir(const char* pathname);
|
||||
int link(char const* oldpath, char const* newpath);
|
||||
int unlink(char const* pathname);
|
||||
int symlink(char const* target, char const* linkpath);
|
||||
int rmdir(char const* pathname);
|
||||
int dup(int old_fd);
|
||||
int dup2(int old_fd, int new_fd);
|
||||
int pipe(int pipefd[2]);
|
||||
int pipe2(int pipefd[2], int flags);
|
||||
unsigned int alarm(unsigned int seconds);
|
||||
int access(const char* pathname, int mode);
|
||||
int access(char const* pathname, int mode);
|
||||
int isatty(int fd);
|
||||
int mknod(const char* pathname, mode_t, dev_t);
|
||||
int mknod(char const* pathname, mode_t, dev_t);
|
||||
long fpathconf(int fd, int name);
|
||||
long pathconf(const char* path, int name);
|
||||
long pathconf(char const* path, int name);
|
||||
char* getlogin(void);
|
||||
int lchown(const char* pathname, uid_t uid, gid_t gid);
|
||||
int chown(const char* pathname, uid_t, gid_t);
|
||||
int lchown(char const* pathname, uid_t uid, gid_t gid);
|
||||
int chown(char const* pathname, uid_t, gid_t);
|
||||
int fchown(int fd, uid_t, gid_t);
|
||||
int fchownat(int fd, const char* pathname, uid_t uid, gid_t gid, int flags);
|
||||
int fchownat(int fd, char const* pathname, uid_t uid, gid_t gid, int flags);
|
||||
int ftruncate(int fd, off_t length);
|
||||
int truncate(const char* path, off_t length);
|
||||
int mount(int source_fd, const char* target, const char* fs_type, int flags);
|
||||
int umount(const char* mountpoint);
|
||||
int pledge(const char* promises, const char* execpromises);
|
||||
int unveil(const char* path, const char* permissions);
|
||||
char* getpass(const char* prompt);
|
||||
int truncate(char const* path, off_t length);
|
||||
int mount(int source_fd, char const* target, char const* fs_type, int flags);
|
||||
int umount(char const* mountpoint);
|
||||
int pledge(char const* promises, char const* execpromises);
|
||||
int unveil(char const* path, char const* permissions);
|
||||
char* getpass(char const* prompt);
|
||||
int pause(void);
|
||||
int chroot(const char*);
|
||||
int chroot(char const*);
|
||||
int getdtablesize(void);
|
||||
|
||||
enum {
|
||||
|
@ -155,6 +155,6 @@ extern int optreset;
|
|||
// value.
|
||||
extern char* optarg;
|
||||
|
||||
int getopt(int argc, char* const* argv, const char* short_options);
|
||||
int getopt(int argc, char* const* argv, char const* short_options);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
extern "C" {
|
||||
|
||||
int utime(const char* pathname, const struct utimbuf* buf)
|
||||
int utime(char const* pathname, const struct utimbuf* buf)
|
||||
{
|
||||
if (!pathname) {
|
||||
errno = EFAULT;
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
|
||||
__BEGIN_DECLS
|
||||
|
||||
int utime(const char* pathname, const struct utimbuf*);
|
||||
int utime(char const* pathname, const struct utimbuf*);
|
||||
|
||||
__END_DECLS
|
||||
|
|
|
@ -29,47 +29,47 @@ typedef struct {
|
|||
|
||||
struct tm;
|
||||
|
||||
size_t wcslen(const wchar_t*);
|
||||
wchar_t* wcscpy(wchar_t*, const wchar_t*);
|
||||
wchar_t* wcsdup(const wchar_t*);
|
||||
wchar_t* wcsncpy(wchar_t*, const wchar_t*, size_t);
|
||||
__attribute__((warn_unused_result)) size_t wcslcpy(wchar_t*, const wchar_t*, size_t);
|
||||
int wcscmp(const wchar_t*, const wchar_t*);
|
||||
int wcsncmp(const wchar_t*, const wchar_t*, size_t);
|
||||
wchar_t* wcschr(const wchar_t*, int);
|
||||
wchar_t* wcsrchr(const wchar_t*, wchar_t);
|
||||
wchar_t* wcscat(wchar_t*, const wchar_t*);
|
||||
wchar_t* wcsncat(wchar_t*, const wchar_t*, size_t);
|
||||
wchar_t* wcstok(wchar_t*, const wchar_t*, wchar_t**);
|
||||
long wcstol(const wchar_t*, wchar_t**, int);
|
||||
long long wcstoll(const wchar_t*, wchar_t**, int);
|
||||
size_t wcslen(wchar_t const*);
|
||||
wchar_t* wcscpy(wchar_t*, wchar_t const*);
|
||||
wchar_t* wcsdup(wchar_t const*);
|
||||
wchar_t* wcsncpy(wchar_t*, wchar_t const*, size_t);
|
||||
__attribute__((warn_unused_result)) size_t wcslcpy(wchar_t*, wchar_t const*, size_t);
|
||||
int wcscmp(wchar_t const*, wchar_t const*);
|
||||
int wcsncmp(wchar_t const*, wchar_t const*, size_t);
|
||||
wchar_t* wcschr(wchar_t const*, int);
|
||||
wchar_t* wcsrchr(wchar_t const*, wchar_t);
|
||||
wchar_t* wcscat(wchar_t*, wchar_t const*);
|
||||
wchar_t* wcsncat(wchar_t*, wchar_t const*, size_t);
|
||||
wchar_t* wcstok(wchar_t*, wchar_t const*, wchar_t**);
|
||||
long wcstol(wchar_t const*, wchar_t**, int);
|
||||
long long wcstoll(wchar_t const*, wchar_t**, int);
|
||||
wint_t btowc(int c);
|
||||
size_t mbrtowc(wchar_t*, const char*, size_t, mbstate_t*);
|
||||
size_t mbrlen(const char*, size_t, mbstate_t*);
|
||||
size_t mbrtowc(wchar_t*, char const*, size_t, mbstate_t*);
|
||||
size_t mbrlen(char const*, size_t, mbstate_t*);
|
||||
size_t wcrtomb(char*, wchar_t, mbstate_t*);
|
||||
int wcscoll(const wchar_t*, const wchar_t*);
|
||||
size_t wcsxfrm(wchar_t*, const wchar_t*, size_t);
|
||||
int wcscoll(wchar_t const*, wchar_t const*);
|
||||
size_t wcsxfrm(wchar_t*, wchar_t const*, size_t);
|
||||
int wctob(wint_t);
|
||||
int mbsinit(const mbstate_t*);
|
||||
wchar_t* wcspbrk(const wchar_t*, const wchar_t*);
|
||||
wchar_t* wcsstr(const wchar_t*, const wchar_t*);
|
||||
wchar_t* wmemchr(const wchar_t*, wchar_t, size_t);
|
||||
wchar_t* wmemcpy(wchar_t*, const wchar_t*, size_t);
|
||||
int mbsinit(mbstate_t const*);
|
||||
wchar_t* wcspbrk(wchar_t const*, wchar_t const*);
|
||||
wchar_t* wcsstr(wchar_t const*, wchar_t const*);
|
||||
wchar_t* wmemchr(wchar_t const*, wchar_t, size_t);
|
||||
wchar_t* wmemcpy(wchar_t*, wchar_t const*, size_t);
|
||||
wchar_t* wmemset(wchar_t*, wchar_t, size_t);
|
||||
wchar_t* wmemmove(wchar_t*, const wchar_t*, size_t);
|
||||
unsigned long wcstoul(const wchar_t*, wchar_t**, int);
|
||||
unsigned long long wcstoull(const wchar_t*, wchar_t**, int);
|
||||
float wcstof(const wchar_t*, wchar_t**);
|
||||
double wcstod(const wchar_t*, wchar_t**);
|
||||
long double wcstold(const wchar_t*, wchar_t**);
|
||||
wchar_t* wmemmove(wchar_t*, wchar_t const*, size_t);
|
||||
unsigned long wcstoul(wchar_t const*, wchar_t**, int);
|
||||
unsigned long long wcstoull(wchar_t const*, wchar_t**, int);
|
||||
float wcstof(wchar_t const*, wchar_t**);
|
||||
double wcstod(wchar_t const*, wchar_t**);
|
||||
long double wcstold(wchar_t const*, wchar_t**);
|
||||
int wcwidth(wchar_t);
|
||||
size_t wcsrtombs(char*, const wchar_t**, size_t, mbstate_t*);
|
||||
size_t mbsrtowcs(wchar_t*, const char**, size_t, mbstate_t*);
|
||||
int wmemcmp(const wchar_t*, const wchar_t*, size_t);
|
||||
size_t wcsnrtombs(char*, const wchar_t**, size_t, size_t, mbstate_t*);
|
||||
size_t mbsnrtowcs(wchar_t*, const char**, size_t, size_t, mbstate_t*);
|
||||
size_t wcscspn(const wchar_t* wcs, const wchar_t* reject);
|
||||
size_t wcsspn(const wchar_t* wcs, const wchar_t* accept);
|
||||
size_t wcsrtombs(char*, wchar_t const**, size_t, mbstate_t*);
|
||||
size_t mbsrtowcs(wchar_t*, char const**, size_t, mbstate_t*);
|
||||
int wmemcmp(wchar_t const*, wchar_t const*, size_t);
|
||||
size_t wcsnrtombs(char*, wchar_t const**, size_t, size_t, mbstate_t*);
|
||||
size_t mbsnrtowcs(wchar_t*, char const**, size_t, size_t, mbstate_t*);
|
||||
size_t wcscspn(wchar_t const* wcs, wchar_t const* reject);
|
||||
size_t wcsspn(wchar_t const* wcs, wchar_t const* accept);
|
||||
|
||||
wint_t fgetwc(FILE* stream);
|
||||
wint_t getwc(FILE* stream);
|
||||
|
@ -78,24 +78,24 @@ wint_t fputwc(wchar_t wc, FILE* stream);
|
|||
wint_t putwc(wchar_t wc, FILE* stream);
|
||||
wint_t putwchar(wchar_t wc);
|
||||
wchar_t* fgetws(wchar_t* __restrict ws, int n, FILE* __restrict stream);
|
||||
int fputws(const wchar_t* __restrict ws, FILE* __restrict stream);
|
||||
int fputws(wchar_t const* __restrict ws, FILE* __restrict stream);
|
||||
wint_t ungetwc(wint_t wc, FILE* stream);
|
||||
int fwide(FILE* stream, int mode);
|
||||
|
||||
int wprintf(const wchar_t* __restrict format, ...);
|
||||
int fwprintf(FILE* __restrict stream, const wchar_t* __restrict format, ...);
|
||||
int swprintf(wchar_t* __restrict wcs, size_t maxlen, const wchar_t* __restrict format, ...);
|
||||
int vwprintf(const wchar_t* __restrict format, va_list args);
|
||||
int vfwprintf(FILE* __restrict stream, const wchar_t* __restrict format, va_list args);
|
||||
int vswprintf(wchar_t* __restrict wcs, size_t maxlen, const wchar_t* __restrict format, va_list args);
|
||||
int wprintf(wchar_t const* __restrict format, ...);
|
||||
int fwprintf(FILE* __restrict stream, wchar_t const* __restrict format, ...);
|
||||
int swprintf(wchar_t* __restrict wcs, size_t maxlen, wchar_t const* __restrict format, ...);
|
||||
int vwprintf(wchar_t const* __restrict format, va_list args);
|
||||
int vfwprintf(FILE* __restrict stream, wchar_t const* __restrict format, va_list args);
|
||||
int vswprintf(wchar_t* __restrict wcs, size_t maxlen, wchar_t const* __restrict format, va_list args);
|
||||
|
||||
int fwscanf(FILE* __restrict stream, const wchar_t* __restrict format, ...);
|
||||
int swscanf(const wchar_t* __restrict ws, const wchar_t* __restrict format, ...);
|
||||
int wscanf(const wchar_t* __restrict format, ...);
|
||||
int vfwscanf(FILE* __restrict stream, const wchar_t* __restrict format, va_list arg);
|
||||
int vswscanf(const wchar_t* __restrict ws, const wchar_t* __restrict format, va_list arg);
|
||||
int vwscanf(const wchar_t* __restrict format, va_list arg);
|
||||
int fwscanf(FILE* __restrict stream, wchar_t const* __restrict format, ...);
|
||||
int swscanf(wchar_t const* __restrict ws, wchar_t const* __restrict format, ...);
|
||||
int wscanf(wchar_t const* __restrict format, ...);
|
||||
int vfwscanf(FILE* __restrict stream, wchar_t const* __restrict format, va_list arg);
|
||||
int vswscanf(wchar_t const* __restrict ws, wchar_t const* __restrict format, va_list arg);
|
||||
int vwscanf(wchar_t const* __restrict format, va_list arg);
|
||||
|
||||
size_t wcsftime(wchar_t* __restrict wcs, size_t maxsize, const wchar_t* __restrict format, const struct tm* __restrict timeptr);
|
||||
size_t wcsftime(wchar_t* __restrict wcs, size_t maxsize, wchar_t const* __restrict format, const struct tm* __restrict timeptr);
|
||||
|
||||
__END_DECLS
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue