Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libc: arcmwdt: library integration fixes #82137

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/libc/arcmwdt/libc-hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static inline int z_vrfy_zephyr_write_stdout(const void *buf, int nbytes)
#include <zephyr/syscalls/zephyr_write_stdout_mrsh.c>
#endif

#ifndef CONFIG_POSIX_API
#ifndef CONFIG_POSIX_DEVICE_IO_ALIAS_WRITE
int _write(int fd, const char *buf, unsigned int nbytes)
{
ARG_UNUSED(fd);
Expand Down
6 changes: 4 additions & 2 deletions lib/libc/arcmwdt/threading.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,24 @@

#ifdef CONFIG_MULTITHREADING

#include <stdio.h>
#include <zephyr/init.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/__assert.h>
#include <zephyr/sys/mutex.h>
#include <zephyr/logging/log.h>
#include <../lib/src/c/inc/internal/thread.h>

#ifndef CONFIG_USERSPACE
#define ARCMWDT_DYN_LOCK_SZ (sizeof(struct k_mutex))
#define ARCMWDT_MAX_DYN_LOCKS 10
#define ARCMWDT_MAX_DYN_LOCKS (FOPEN_MAX * 2 + 10)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we can lower down this '10' as file locks were previously used from this pool.

And it is worth adding a comment here about

The library wants to have 2 locks per each available FILE entry

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know the exact number on top of the file locks? I've seen 3, but there may be more. Will 5 be enough?


K_MEM_SLAB_DEFINE(z_arcmwdt_lock_slab, ARCMWDT_DYN_LOCK_SZ, ARCMWDT_MAX_DYN_LOCKS, sizeof(void *));
#endif /* !CONFIG_USERSPACE */

LOG_MODULE_DECLARE(os, CONFIG_KERNEL_LOG_LEVEL);

typedef void *_lock_t;

void _mwmutex_create(_lock_t *mutex_ptr)
{
bool alloc_fail;
Expand Down
Loading