> On Wed, Jun 7, 2023, at 11:46, Zhangjin Wu wrote: > >> On Wed, Jun 7, 2023, at 07:19, Zhangjin Wu wrote: > > > > Ok, agree, as the 64bit version of lseek may be enough for nolibc, if a target > > application really require, they can add the alias themselves. > > > >> Are there any examples of functions where we actually want mulitple > >> versions? > >> > > > > For example, the following ones are related to the syscalls being added, > > all of them have similar library routines in current sys.h: > > > > * waitid, https://linux.die.net/man/2/waitid > > * ppoll, https://linux.die.net/man/2/ppoll > > * pselect, https://linux.die.net/man/2/pselect6 > > * clock_gettime, https://linux.die.net/man/2/clock_gettime > > > > The similar routines are put in right side: > > > > * waitid --> waitpid, wait, wait4 > > * ppoll --> poll > > * pselect --> select > > * clock_gettime --> gettimeofday > > Ok, I think these are all useful to have in both versions. > > All four of these examples are old enough that I think it's > sufficient just expose them to userspace as the bare system > calls, and have the older library calls be implemented using > them without a fallback to the native syscalls of the same > name on architectures that have both, newer architectures > would only have the latest version anyway. > Ok, Thanks, I have already added parts of them, will send waitid and 64bit lseek at first. > > For the clock_gettime, it may also let us think about if we need to add > > its friends (clock_getres, clock_settime) together. > > Yes, I think that makes sense. We also need clock_settime() > to implement settimeofday() on rv32. > Ok. > Ideally, I'd love to extend the tooling around system calls > in the kernel so we can automatically generate the low-level > wrapper functions from syscall.tbl, That's cool. BTW, I did something on dead syscall elimination [1] (DSE, RFC patchset), a v1 has been prepared locally, but not sent out yet. It also requires to work with the syscall.tbl or the generic include/uapi/asm-generic/unistd.h, welcome your feedback on the RFC patchset [1] and you should be the right reviewer of the coming v1 ;-) The left issue of RFC version is finding a way to not KEEP the exception entries (in ld script) added by get_user/put_user() if the corresponding syscalls are not really used, such KEEPs of exception entries reverts the ownership from "syscalls -> get_user/put_user" to "get_user/put_user -> syscalls" and blocks the gc'ing of the sections of such syscalls. In the coming v1, I used a script trick to drop the wrongly KEPT exception entries to allow drop all of the unused syscalls at last. Will clean up them asap. But it is a little slow and looks ugly, it is only for a further demo of the possibility. In v2 of DSE, I'm wondering whether it is possible to drop all of the manually added KEEP operations from ld scripts and use some conditional attributes (for the sections added by get_user/put_user) to build the 'used' references from "syscalls" to "sections created by get_user/put_user", this may need support from gcc and ld, welcome your suggestions too, thanks. And that RFC patchset added a patch to record the used 'syscalls' in nolibc automatically ;-) [1]: https://lore.kernel.org/linux-riscv/cover.1676594211.git.falcon@xxxxxxxxxxx/ [2]: https://reviews.llvm.org/D96838 > but this needs a lot of > other work that you should not need to depend on for what > you are doing right now. Ok, welcome to share any progress. Thanks, Zhangjin > > Arnd