Skip to content

Impossible to override syscalls #21429

Closed
@pavlohamov

Description

@pavlohamov

Can't override System V syscalls by my own implementation

  1. Configure project: CONFIG_NEWLIB_LIBC=y
  2. add trace into:zephyr/lib/libc/newlib/libc-hooks.c
 int _open(const char *name, int mode)
 {
+       printk(" %s '%s' %d\n", __FUNCTION__, name, mode);
  1. add into main()
    FILE *f = fopen("file", "r+");
  2. run it.
    So far so good
  3. try implement your own "open"
  4. lib/libc/newlib/libc-hooks.c:190: multiple definition of `_open';

Expected behavior
libc-hooks.c expected to have weak aliases

Impact
All syscall users

Environment (please complete the following information):

  • Ubuntu 18 x64
  • Toolchain: Zephyr
  • Commit SHA f95a7fa

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: Minimal libcMinimal C Standard LibrarybugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bug

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions