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

Feature request. #13

Open
twaik opened this issue Mar 9, 2023 · 6 comments
Open

Feature request. #13

twaik opened this issue Mar 9, 2023 · 6 comments

Comments

@twaik
Copy link
Member

twaik commented Mar 9, 2023

Sometimes termux programs are launched inside proot environment, and sometimes happens they run on devices with sysvipc support enabled in kernel. It would be nice to make libandroid-shmem detect if device/environment has shmat/shmget/shmdt syscalls support and use them. It will be usefull, i.e. when user runs Xwayland/Xvfb/other X server inside proot and MIT-SHM extension works as expected. Reverse case is also possible, i.e. when user runs proot's Xvfb server and runs termux's x11vnc there.
Thank you.

@Et7f3
Copy link

Et7f3 commented Nov 7, 2023

Can't you use this symbol for example ?

void* shmat(int shmid, void const* shmaddr, int shmflg)

@twaik
Copy link
Member Author

twaik commented Nov 7, 2023

Of course I can. But it does not fallback to regular linux shmat syscalls. That is the reason I opened this issue...

@Et7f3
Copy link

Et7f3 commented Nov 7, 2023

I am not a android user so won't be able to test it. However I would do something similar to https://stackoverflow.com/q/4861621/7227940 for the three syscall and if return value is -ENOSYS it would mean the syscall is not available in your linux version so I would fallback to existant code. If available I would return the value of the syscall.

Also since syscall is expensive I would remember it so in the negative case I could avoid a failing syscall. In the positive case since it would be first code path and return no special treatment is needed.

@Et7f3
Copy link

Et7f3 commented Nov 7, 2023

You also asked shmat twice. Did you mean shmdt or shmctl ?

@twaik
Copy link
Member Author

twaik commented Nov 7, 2023

You also asked shmat twice

It was a typo.

@twaik
Copy link
Member Author

twaik commented Nov 7, 2023

I am not a android user so won't be able to test it. However I would do something similar to https://stackoverflow.com/q/4861621/7227940 for the three syscall and if return value is -ENOSYS it would mean the syscall is not available in your linux version so I would fallback to existant code. If available I would return the value of the syscall.

I've already implemented it in termux-x11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants