diff options
Diffstat (limited to '')
-rw-r--r-- | libc-top-half/musl/src/internal/procfdname.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/internal/procfdname.c b/libc-top-half/musl/src/internal/procfdname.c new file mode 100644 index 0000000..fd7306a --- /dev/null +++ b/libc-top-half/musl/src/internal/procfdname.c @@ -0,0 +1,15 @@ +#include "syscall.h" + +void __procfdname(char *buf, unsigned fd) +{ + unsigned i, j; + for (i=0; (buf[i] = "/proc/self/fd/"[i]); i++); + if (!fd) { + buf[i] = '0'; + buf[i+1] = 0; + return; + } + for (j=fd; j; j/=10, i++); + buf[i] = 0; + for (; fd; fd/=10) buf[--i] = '0' + fd%10; +} |