1#ifndef __VSF_LINUX_UNISTD_H__
2#define __VSF_LINUX_UNISTD_H__
6#if VSF_LINUX_CFG_RELATIVE_PATH == ENABLED
14# define __USE_LOCAL_LIBC__
15# define __USE_LOCAL_STDIO__
27#define __SIMPLE_LIBC_SETJMP_VPLT_ONLY__
33#include "../vsf_linux.h"
34#include "../port/busybox/busybox.h"
41#if defined(__WIN__) && defined(__CPU_X64__)
42# define exec_ret_t intptr_t
44# define exec_ret_t int
47#if VSF_LINUX_CFG_WRAPPER == ENABLED
48#define confstr VSF_LINUX_WRAPPER(confstr)
50#define usleep VSF_LINUX_WRAPPER(usleep)
51#define sleep VSF_LINUX_WRAPPER(sleep)
52#define pause VSF_LINUX_WRAPPER(pause)
54#define getlogin VSF_LINUX_WRAPPER(getlogin)
55#define getlogin_r VSF_LINUX_WRAPPER(getlogin_r)
57#define setgid VSF_LINUX_WRAPPER(setgid)
58#define getgid VSF_LINUX_WRAPPER(getgid)
59#define setegid VSF_LINUX_WRAPPER(setegid)
60#define getegid VSF_LINUX_WRAPPER(getegid)
61#define setuid VSF_LINUX_WRAPPER(setuid)
62#define getuid VSF_LINUX_WRAPPER(getuid)
63#define seteuid VSF_LINUX_WRAPPER(seteuid)
64#define geteuid VSF_LINUX_WRAPPER(geteuid)
65#define getpid VSF_LINUX_WRAPPER(getpid)
66#define getppid VSF_LINUX_WRAPPER(getppid)
67#define gettid VSF_LINUX_WRAPPER(gettid)
68#define setsid VSF_LINUX_WRAPPER(setsid)
69#define getsid VSF_LINUX_WRAPPER(getsid)
70#define setpgid VSF_LINUX_WRAPPER(setpgid)
71#define getpgid VSF_LINUX_WRAPPER(getpgid)
72#define setpgrp VSF_LINUX_WRAPPER(setpgrp)
73#define getpgrp VSF_LINUX_WRAPPER(getpgrp)
74#define setresuid VSF_LINUX_WRAPPER(setresuid)
75#define setresgid VSF_LINUX_WRAPPER(setresgid)
77#define execl VSF_LINUX_WRAPPER(execl)
78#define execlp VSF_LINUX_WRAPPER(execlp)
79#define execv VSF_LINUX_WRAPPER(execv)
80#define execve VSF_LINUX_WRAPPER(execve)
81#define execvp VSF_LINUX_WRAPPER(execvp)
82#define execvpe VSF_LINUX_WRAPPER(execvpe)
83#define sysconf VSF_LINUX_WRAPPER(sysconf)
84#define pathconf VSF_LINUX_WRAPPER(pathconf)
85#define fpathconf VSF_LINUX_WRAPPER(fpathconf)
86#define pipe VSF_LINUX_WRAPPER(pipe)
87#define pipe2 VSF_LINUX_WRAPPER(pipe2)
88#define alarm VSF_LINUX_WRAPPER(alarm)
89#define ualarm VSF_LINUX_WRAPPER(ualarm)
90#define fork VSF_LINUX_WRAPPER(fork)
91#define _exit VSF_LINUX_WRAPPER(_exit)
92#define acct VSF_LINUX_WRAPPER(acct)
94#define isatty VSF_LINUX_WRAPPER(isatty)
95#define symlink VSF_LINUX_WRAPPER(symlink)
96#define getpagesize VSF_LINUX_WRAPPER(getpagesize)
97#define ftruncate VSF_LINUX_WRAPPER(ftruncate)
98#define truncate VSF_LINUX_WRAPPER(truncate)
99#define ftruncate64 VSF_LINUX_WRAPPER(ftruncate64)
100#define truncate64 VSF_LINUX_WRAPPER(truncate64)
101#define readlink VSF_LINUX_WRAPPER(readlink)
102#define tcgetpgrp VSF_LINUX_WRAPPER(tcgetpgrp)
103#define tcsetpgrp VSF_LINUX_WRAPPER(tcsetpgrp)
104#define getpass VSF_LINUX_WRAPPER(getpass)
105#define gethostname VSF_LINUX_WRAPPER(gethostname)
106#define sethostname VSF_LINUX_WRAPPER(sethostname)
108#define getentropy VSF_LINUX_WRAPPER(getentropy)
110#define gethostid VSF_LINUX_WRAPPER(gethostid)
111#define sethostid VSF_LINUX_WRAPPER(sethostid)
113#if __IS_COMPILER_IAR__
115# define access VSF_LINUX_WRAPPER(access)
116# define unlink VSF_LINUX_WRAPPER(unlink)
117# define unlinkat VSF_LINUX_WRAPPER(unlinkat)
118# define link VSF_LINUX_WRAPPER(link)
119# define mkdir VSF_LINUX_WRAPPER(mkdir)
120# define mkdirat VSF_LINUX_WRAPPER(mkdirat)
121# define rmdir VSF_LINUX_WRAPPER(rmdir)
122# define close VSF_LINUX_WRAPPER(close)
123# define lseek VSF_LINUX_WRAPPER(lseek)
124# define read VSF_LINUX_WRAPPER(read)
125# define write VSF_LINUX_WRAPPER(write)
126# define readv VSF_LINUX_WRAPPER(readv)
127# define writev VSF_LINUX_WRAPPER(writev)
128# define pread VSF_LINUX_WRAPPER(pread)
129# define pwrite VSF_LINUX_WRAPPER(pwrite)
130# define preadv VSF_LINUX_WRAPPER(preadv)
131# define pwritev VSF_LINUX_WRAPPER(pwritev)
132# define chdir VSF_LINUX_WRAPPER(chdir)
133# define fchdir VSF_LINUX_WRAPPER(fchdir)
134# define getcwd VSF_LINUX_WRAPPER(getcwd)
135# define fsync VSF_LINUX_WRAPPER(fsync)
136# define fdatasync VSF_LINUX_WRAPPER(fdatasync)
138#elif defined(__WIN__) && !defined(__VSF_APPLET__)
139#define _exit VSF_LINUX_WRAPPER(_exit)
144#define __NR_close close
146#define __NR_dup2 dup2
147#define __NR_dup3 dup3
148#define __NR_access access
149#define __NR_write write
150#define __NR_writev writev
151#define __NR_read read
152#define __NR_readv readv
153#define __NR_truncate truncate
154#define __NR_rtruncate ftruncate
155#define __NR_faccessat faccessat
156#define __NR_unlink unlink
157#define __NR_unlinkat unlinkat
158#define __NR_sync sync
159#define __NR_fsync fsync
160#define __NR_chdir chdir
161#define __NR_fchdir fchdir
162#define __NR_chown chown
163#define __NR_fchown fchown
164#define __NR_fchownat fchownat
165#define __NR_chroot chroot
166#define __NR_pipe pipe
167#define __NR_pipe2 pipe2
168#define __NR_alarm alarm
169#define __NR_execve execve
170#define __NR_wait4 wait4
171#define __NR_gettid gettid
172#define SYS_gettid __NR_gettid
174#define __NR_preadv(__fd, __vec, __vlen, __pos_l, __pos_h) \
175 preadv64((__fd), (__vec), (__vlen), ((off64_t)(__pos_l) << 32) + (__pos_h))
176#define __NR_pwritev(__fd, __vec, __vlen, __pos_l, __pos_h) \
177 pwritev64((__fd), (__vec), (__vlen), ((off64_t)(__pos_l) << 32) + (__pos_h))
179#define _POSIX_VERSION 200112L
181#define STDIN_FILENO 0
182#define STDOUT_FILENO 1
183#define STDERR_FILENO 2
185#define environ (vsf_linux_get_cur_process()->__environ)
191#define _CS_PATH _CS_PATH
193#define _CS_GNU_LIBC_VERSION _CS_GNU_LIBC_VERSION
195#define _CS_GNU_LIBPTHREAD_VERSION _CS_GNU_LIBPTHREAD_VERSION
241#if VSF_LINUX_APPLET_USE_UNISTD == ENABLED
359# ifndef __VSF_APPLET__
364#if defined(__VSF_APPLET__) && (defined(__VSF_APPLET_LIB__) || defined(__VSF_APPLET_LINUX_UNISTD_LIB__))\
365 && VSF_APPLET_CFG_ABI_PATCH != ENABLED && VSF_LINUX_APPLET_USE_UNISTD == ENABLED
367#ifndef VSF_LINUX_APPLET_UNISTD_VPLT
368# if VSF_LINUX_USE_APPLET == ENABLED
369# define VSF_LINUX_APPLET_UNISTD_VPLT \
370 ((vsf_linux_unistd_vplt_t *)(VSF_LINUX_APPLET_VPLT->unistd_vplt))
372# define VSF_LINUX_APPLET_UNISTD_VPLT \
373 ((vsf_linux_unistd_vplt_t *)vsf_vplt((void *)0))
377#define VSF_LINUX_APPLET_UNISTD_ENTRY(__NAME) \
378 VSF_APPLET_VPLT_ENTRY_FUNC_ENTRY(VSF_LINUX_APPLET_UNISTD_VPLT, __NAME)
379#define VSF_LINUX_APPLET_UNISTD_IMP(...) \
380 VSF_APPLET_VPLT_ENTRY_FUNC_IMP(VSF_LINUX_APPLET_UNISTD_VPLT, __VA_ARGS__)
382VSF_LINUX_APPLET_UNISTD_IMP(
__execl_va,
exec_ret_t,
const char *pathname,
const char *arg, va_list ap,
bool has_env) {
384 return VSF_LINUX_APPLET_UNISTD_ENTRY(
__execl_va)(pathname, arg, ap, has_env);
386VSF_LINUX_APPLET_UNISTD_IMP(
__execlp_va,
exec_ret_t,
const char *pathname,
const char *arg, va_list ap) {
388 return VSF_LINUX_APPLET_UNISTD_ENTRY(
__execlp_va)(pathname, arg, ap);
390VSF_LINUX_APPLET_UNISTD_IMP(
confstr,
size_t,
int name,
char *buf,
size_t len) {
392 return VSF_LINUX_APPLET_UNISTD_ENTRY(
confstr)(name, buf, len);
394VSF_LINUX_APPLET_UNISTD_IMP(
usleep,
int,
int micro_seconds) {
396 return VSF_LINUX_APPLET_UNISTD_ENTRY(
usleep)(micro_seconds);
398VSF_LINUX_APPLET_UNISTD_IMP(
sleep,
unsigned,
unsigned seconds) {
400 return VSF_LINUX_APPLET_UNISTD_ENTRY(
sleep)(seconds);
402VSF_LINUX_APPLET_UNISTD_IMP(
pause,
int,
void) {
404 return VSF_LINUX_APPLET_UNISTD_ENTRY(
pause)();
406VSF_LINUX_APPLET_UNISTD_IMP(
alarm,
unsigned int,
unsigned int seconds) {
408 return VSF_LINUX_APPLET_UNISTD_ENTRY(
alarm)(seconds);
412 return VSF_LINUX_APPLET_UNISTD_ENTRY(
ualarm)(usecs, interval);
414VSF_LINUX_APPLET_UNISTD_IMP(
getlogin,
char *,
void) {
416 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getlogin)();
418VSF_LINUX_APPLET_UNISTD_IMP(
getlogin_r,
int,
char *buf,
size_t bufsize) {
420 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getlogin_r)(buf, bufsize);
422VSF_LINUX_APPLET_UNISTD_IMP(
setuid,
int,
uid_t uid) {
424 return VSF_LINUX_APPLET_UNISTD_ENTRY(
setuid)(uid);
428 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getuid)();
432 return VSF_LINUX_APPLET_UNISTD_ENTRY(
seteuid)(euid);
436 return VSF_LINUX_APPLET_UNISTD_ENTRY(
geteuid)();
438VSF_LINUX_APPLET_UNISTD_IMP(
setgid,
int,
gid_t gid) {
440 return VSF_LINUX_APPLET_UNISTD_ENTRY(
setgid)(gid);
444 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getgid)();
448 return VSF_LINUX_APPLET_UNISTD_ENTRY(
setegid)(egid);
452 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getegid)();
456 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getpid)();
460 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getppid)();
464 return VSF_LINUX_APPLET_UNISTD_ENTRY(
gettid)();
468 return VSF_LINUX_APPLET_UNISTD_ENTRY(
setsid)();
472 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getsid)(pid);
476 return VSF_LINUX_APPLET_UNISTD_ENTRY(
setpgid)(pid, pgid);
480 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getpgid)(pid);
482VSF_LINUX_APPLET_UNISTD_IMP(
setpgrp,
int,
void) {
484 return VSF_LINUX_APPLET_UNISTD_ENTRY(
setpgrp)();
488 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getpgrp)();
492 return VSF_LINUX_APPLET_UNISTD_ENTRY(
setresuid)(ruid, euid, suid);
496 return VSF_LINUX_APPLET_UNISTD_ENTRY(
setresgid)(rgid, egid, sgid);
498VSF_LINUX_APPLET_UNISTD_IMP(
execv,
exec_ret_t,
const char *pathname,
char *
const * argv) {
500 return VSF_LINUX_APPLET_UNISTD_ENTRY(
execv)(pathname, argv);
502VSF_LINUX_APPLET_UNISTD_IMP(
execve,
exec_ret_t,
const char *pathname,
char *
const * argv,
char *
const * envp) {
504 return VSF_LINUX_APPLET_UNISTD_ENTRY(
execve)(pathname, argv, envp);
506VSF_LINUX_APPLET_UNISTD_IMP(
execvp,
exec_ret_t,
const char *file,
char *
const * argv) {
508 return VSF_LINUX_APPLET_UNISTD_ENTRY(
execvp)(file, argv);
510VSF_LINUX_APPLET_UNISTD_IMP(
execvpe,
exec_ret_t,
const char *file,
char *
const * argv,
char *
const * envp) {
512 return VSF_LINUX_APPLET_UNISTD_ENTRY(
execvpe)(file, argv, envp);
514VSF_LINUX_APPLET_UNISTD_IMP(
daemon,
int,
int nochdir,
int noclose) {
516 return VSF_LINUX_APPLET_UNISTD_ENTRY(
daemon)(nochdir, noclose);
518VSF_LINUX_APPLET_UNISTD_IMP(
sysconf,
long,
int name) {
520 return VSF_LINUX_APPLET_UNISTD_ENTRY(
sysconf)(name);
522VSF_LINUX_APPLET_UNISTD_IMP(
pathconf,
long,
const char *path,
int name) {
524 return VSF_LINUX_APPLET_UNISTD_ENTRY(
pathconf)(path, name);
526VSF_LINUX_APPLET_UNISTD_IMP(
fpathconf,
long,
int fd,
int name) {
528 return VSF_LINUX_APPLET_UNISTD_ENTRY(
fpathconf)(fd, name);
530VSF_LINUX_APPLET_UNISTD_IMP(
pipe,
int,
int pipefd[2]) {
532 return VSF_LINUX_APPLET_UNISTD_ENTRY(
pipe)(pipefd);
534VSF_LINUX_APPLET_UNISTD_IMP(
pipe2,
int,
int pipefd[2],
int flags) {
536 return VSF_LINUX_APPLET_UNISTD_ENTRY(
pipe2)(pipefd, flags);
538VSF_LINUX_APPLET_UNISTD_IMP(
access,
int,
const char *pathname,
int mode) {
540 return VSF_LINUX_APPLET_UNISTD_ENTRY(
access)(pathname, mode);
542VSF_LINUX_APPLET_UNISTD_IMP(
unlink,
int,
const char *pathname) {
544 return VSF_LINUX_APPLET_UNISTD_ENTRY(
unlink)(pathname);
546VSF_LINUX_APPLET_UNISTD_IMP(
unlinkat,
int,
int dirfd,
const char *pathname,
int flags) {
548 return VSF_LINUX_APPLET_UNISTD_ENTRY(
unlinkat)(dirfd, pathname, flags);
550VSF_LINUX_APPLET_UNISTD_IMP(
link,
int,
const char *oldpath,
const char *newpath) {
552 return VSF_LINUX_APPLET_UNISTD_ENTRY(
link)(oldpath, newpath);
554VSF_LINUX_APPLET_UNISTD_IMP(
mkdir,
int,
const char *pathname,
mode_t mode) {
556 return VSF_LINUX_APPLET_UNISTD_ENTRY(
mkdir)(pathname, mode);
558VSF_LINUX_APPLET_UNISTD_IMP(
mkdirat,
int,
int dirfd,
const char *pathname,
mode_t mode) {
560 return VSF_LINUX_APPLET_UNISTD_ENTRY(
mkdirat)(dirfd, pathname, mode);
562VSF_LINUX_APPLET_UNISTD_IMP(
rmdir,
int,
const char *pathname) {
564 return VSF_LINUX_APPLET_UNISTD_ENTRY(
rmdir)(pathname);
566VSF_LINUX_APPLET_UNISTD_IMP(
dup,
int,
int oldfd) {
568 return VSF_LINUX_APPLET_UNISTD_ENTRY(
dup)(oldfd);
570VSF_LINUX_APPLET_UNISTD_IMP(
dup2,
int,
int oldfd,
int newfd) {
572 return VSF_LINUX_APPLET_UNISTD_ENTRY(
dup2)(oldfd, newfd);
574VSF_LINUX_APPLET_UNISTD_IMP(
dup3,
int,
int oldfd,
int newfd,
int flags) {
576 return VSF_LINUX_APPLET_UNISTD_ENTRY(
dup3)(oldfd, newfd, flags);
578VSF_LINUX_APPLET_UNISTD_IMP(
chroot,
int,
const char *path) {
580 return VSF_LINUX_APPLET_UNISTD_ENTRY(
chroot)(path);
582VSF_LINUX_APPLET_UNISTD_IMP(
chdir,
int,
const char *pathname) {
584 return VSF_LINUX_APPLET_UNISTD_ENTRY(
chdir)(pathname);
586VSF_LINUX_APPLET_UNISTD_IMP(
fchdir,
int,
int fd) {
588 return VSF_LINUX_APPLET_UNISTD_ENTRY(
fchdir)(fd);
590VSF_LINUX_APPLET_UNISTD_IMP(
getcwd,
char *,
char *buffer,
size_t maxlen) {
592 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getcwd)(buffer, maxlen);
594VSF_LINUX_APPLET_UNISTD_IMP(
close,
int,
int fd) {
596 return VSF_LINUX_APPLET_UNISTD_ENTRY(
close)(fd);
600 return VSF_LINUX_APPLET_UNISTD_ENTRY(
lseek)(fd,
offset, whence);
602VSF_LINUX_APPLET_UNISTD_IMP(
read,
ssize_t,
int fd,
void *buf,
size_t count) {
604 return VSF_LINUX_APPLET_UNISTD_ENTRY(
read)(fd, buf, count);
606VSF_LINUX_APPLET_UNISTD_IMP(
write,
ssize_t,
int fd,
const void *buf,
size_t count) {
608 return VSF_LINUX_APPLET_UNISTD_ENTRY(
write)(fd, buf, count);
610VSF_LINUX_APPLET_UNISTD_IMP(
readv,
ssize_t,
int fd,
const struct iovec *iov,
int iovcnt) {
612 return VSF_LINUX_APPLET_UNISTD_ENTRY(
readv)(fd, iov, iovcnt);
614VSF_LINUX_APPLET_UNISTD_IMP(
writev,
ssize_t,
int fd,
const struct iovec *iov,
int iovcnt) {
616 return VSF_LINUX_APPLET_UNISTD_ENTRY(
writev)(fd, iov, iovcnt);
620 return VSF_LINUX_APPLET_UNISTD_ENTRY(
pread)(fd, buf, count,
offset);
624 return VSF_LINUX_APPLET_UNISTD_ENTRY(
pwrite)(fd, buf, count,
offset);
628 return VSF_LINUX_APPLET_UNISTD_ENTRY(
preadv)(fd, iov, iovcnt,
offset);
632 return VSF_LINUX_APPLET_UNISTD_ENTRY(
pwritev)(fd, iov, iovcnt,
offset);
634VSF_LINUX_APPLET_UNISTD_IMP(
sync,
void,
void) {
636 VSF_LINUX_APPLET_UNISTD_ENTRY(
sync)();
638VSF_LINUX_APPLET_UNISTD_IMP(
syncfs,
int,
int fd) {
640 return VSF_LINUX_APPLET_UNISTD_ENTRY(
syncfs)(fd);
642VSF_LINUX_APPLET_UNISTD_IMP(
fsync,
int,
int fd) {
644 return VSF_LINUX_APPLET_UNISTD_ENTRY(
fsync)(fd);
646VSF_LINUX_APPLET_UNISTD_IMP(
fdatasync,
int,
int fd) {
648 return VSF_LINUX_APPLET_UNISTD_ENTRY(
fdatasync)(fd);
650VSF_LINUX_APPLET_UNISTD_IMP(
isatty,
int,
int fd) {
652 return VSF_LINUX_APPLET_UNISTD_ENTRY(
isatty)(fd);
654VSF_LINUX_APPLET_UNISTD_IMP(
getpagesize,
size_t,
void) {
656 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getpagesize)();
658VSF_LINUX_APPLET_UNISTD_IMP(
symlink,
int,
const char *target,
const char *linkpath) {
660 return VSF_LINUX_APPLET_UNISTD_ENTRY(
symlink)(target, linkpath);
678VSF_LINUX_APPLET_UNISTD_IMP(
readlink,
ssize_t,
const char *pathname,
char *buf,
size_t bufsiz) {
680 return VSF_LINUX_APPLET_UNISTD_ENTRY(
readlink)(pathname, buf, bufsiz);
684 return VSF_LINUX_APPLET_UNISTD_ENTRY(
tcgetpgrp)(fd);
688 return VSF_LINUX_APPLET_UNISTD_ENTRY(
tcsetpgrp)(fd, pgrp);
690VSF_LINUX_APPLET_UNISTD_IMP(
getpass,
char *,
const char *prompt) {
692 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getpass)(prompt);
694VSF_LINUX_APPLET_UNISTD_IMP(
gethostname,
int,
char *name,
size_t len) {
696 return VSF_LINUX_APPLET_UNISTD_ENTRY(
gethostname)(name, len);
698VSF_LINUX_APPLET_UNISTD_IMP(
sethostname,
int,
const char *name,
size_t len) {
700 return VSF_LINUX_APPLET_UNISTD_ENTRY(
sethostname)(name, len);
704 return VSF_LINUX_APPLET_UNISTD_ENTRY(
chown)(pathname, owner,
group);
708 return VSF_LINUX_APPLET_UNISTD_ENTRY(
fchown)(fd, owner,
group);
712 return VSF_LINUX_APPLET_UNISTD_ENTRY(
lchown)(pathname, owner,
group);
714VSF_LINUX_APPLET_UNISTD_IMP(
fchownat,
int,
int dirfd,
const char *pathname,
uid_t owner,
gid_t group,
int flags) {
716 return VSF_LINUX_APPLET_UNISTD_ENTRY(
fchownat)(dirfd, pathname, owner,
group, flags);
722VSF_LINUX_APPLET_UNISTD_IMP(
gethostid,
long,
void) {
724 return VSF_LINUX_APPLET_UNISTD_ENTRY(
gethostid)();
726VSF_LINUX_APPLET_UNISTD_IMP(
sethostid,
int,
long hostid) {
728 return VSF_LINUX_APPLET_UNISTD_ENTRY(
sethostid)(hostid);
732 return VSF_LINUX_APPLET_UNISTD_ENTRY(
lseek64)(fd,
offset, whence);
734VSF_LINUX_APPLET_UNISTD_IMP(
ttyname,
char *,
int fd) {
736 return VSF_LINUX_APPLET_UNISTD_ENTRY(
ttyname)(fd);
738VSF_LINUX_APPLET_UNISTD_IMP(
ttyname_r,
int,
int fd,
char *buf,
size_t buflen) {
740 return VSF_LINUX_APPLET_UNISTD_ENTRY(
ttyname_r)(fd, buf, buflen);
742VSF_LINUX_APPLET_UNISTD_IMP(
_exit,
void,
int status) {
746VSF_LINUX_APPLET_UNISTD_IMP(
acct,
int,
const char *filename) {
748 return VSF_LINUX_APPLET_UNISTD_ENTRY(
acct)(filename);
754VSF_LINUX_APPLET_UNISTD_IMP(
mkdirs,
int,
const char *pathname,
mode_t mode) {
756 return VSF_LINUX_APPLET_UNISTD_ENTRY(
mkdirs)(pathname, mode);
768 ret = VSF_LINUX_APPLET_UNISTD_ENTRY(
__execl_va)(pathname, arg, ap,
false);
777 ret = VSF_LINUX_APPLET_UNISTD_ENTRY(
__execl_va)(pathname, arg, ap,
true);
786 ret = VSF_LINUX_APPLET_UNISTD_ENTRY(
__execlp_va)(file, arg, ap);
793size_t confstr(
int name,
char *buf,
size_t len);
795int usleep(
int micro_seconds);
796unsigned sleep(
unsigned seconds);
799unsigned int alarm(
unsigned int seconds);
830exec_ret_t execve(
const char *pathname,
char *
const * argv,
char *
const * envp);
833int daemon(
int nochdir,
int noclose);
838long pathconf(
const char *path,
int name);
840int pipe(
int pipefd[2]);
841int pipe2(
int pipefd[2],
int flags);
843int access(
const char *pathname,
int mode);
844int unlink(
const char *pathname);
845int unlinkat(
int dirfd,
const char *pathname,
int flags);
846int link(
const char *oldpath,
const char *newpath);
850int rmdir(
const char *pathname);
852int dup2(
int oldfd,
int newfd);
853int dup3(
int oldfd,
int newfd,
int flags);
855int chroot(
const char *path);
856int chdir(
const char *pathname);
858char *
getcwd(
char *buffer,
size_t maxlen);
881int ttyname_r(
int fd,
char *buf,
size_t buflen);
883int symlink(
const char *target,
const char *linkpath);
891char *
getpass(
const char *prompt);
907int acct(
const char *filename);
909#if VSF_LINUX_USE_VFORK == ENABLED
915#if VSF_LINUX_USE_VFORK == ENABLED
917 vsf_linux_process_t *parent_process = vsf_linux_get_cur_process(); \
918 pid_t result = (pid_t)-1, child_pid = __vsf_linux_vfork_prepare(parent_process);\
919 if (child_pid >= 0) { \
920 result = !setjmp(parent_process->__vfork_jmpbuf) ? (pid_t)0 : child_pid;\
Definition vsf_linux.h:278
int pid_t
Definition types.h:85
__USECONDS_T useconds_t
Definition types.h:136
unsigned int uid_t
Definition types.h:90
unsigned int gid_t
Definition types.h:91
long long off64_t
Definition types.h:97
unsigned int mode_t
Definition types.h:87
int ssize_t
Definition types.h:68
long off_t
Definition types.h:95
#define realpath
Definition stdlib.h:44
void * iov_base
Definition unistd.h:232
size_t iov_len
Definition unistd.h:233
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(fpathconf)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(dup3)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(ualarm)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(alarm)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(sync)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(unlink)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(truncate)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(getdtablesize)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(sleep)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(lseek)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(pathconf)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(setresuid)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(pause)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(execlp)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(rmdir)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(gettid)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(acct)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(getpagesize)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(pwritev)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(setsid)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(daemon)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(syncfs)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(unlinkat)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(setegid)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(fchdir)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(close)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(getppid)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(__vsf_linux_vfork_prepare)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(chroot)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(execl)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(getpgid)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(ttyname_r)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(tcsetpgrp)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(readlink)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(gethostid)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(execv)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(setpgrp)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(setgid)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(truncate64)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(preadv)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(ftruncate64)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(pread)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(pipe2)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(gethostname)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(chdir)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(usleep)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(execle)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(realpath)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(getcwd)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(dup)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(writev)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(dup2)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(access)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(read)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(execvp)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(write)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(setpgid)
vsf_vplt_info_t info
Definition unistd.h:243
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(fchown)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(seteuid)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(fsync)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(pwrite)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(mkdirs)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(symlink)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(mkdirat)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(getpgrp)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(ttyname)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(fdatasync)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(_exit)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(pipe)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(getgid)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(mkdir)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(getpid)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(ftruncate)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(getlogin)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(chown)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(getpass)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(getegid)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(__execl_va)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(sethostname)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(setresgid)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(__execlp_va)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(getlogin_r)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(sysconf)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(lchown)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(geteuid)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(getsid)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(tcgetpgrp)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(confstr)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(lseek64)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(sethostid)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(execvpe)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(execve)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(getentropy)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(getuid)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(setuid)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(isatty)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(fchownat)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(readv)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(link)
#define fpathconf
Definition unistd.h:85
#define pathconf
Definition unistd.h:84
#define pause
Definition unistd.h:52
#define link
Definition unistd.h:118
int dup2(int oldfd, int newfd)
Definition vsf_linux_fs.c:1582
#define exec_ret_t
Definition unistd.h:44
__VSF_VPLT_DECORATOR__ vsf_linux_unistd_vplt_t vsf_linux_unistd_vplt
Definition vsf_linux.c:5013
int lchown(const char *pathname, uid_t owner, gid_t group)
Definition vsf_linux.c:3058
#define sethostid
Definition unistd.h:111
#define lseek
Definition unistd.h:123
#define unlink
Definition unistd.h:116
#define access
Definition unistd.h:115
#define setresuid
Definition unistd.h:74
int fchown(int fd, uid_t owner, gid_t group)
Definition vsf_linux.c:3053
int dup(int oldfd)
Definition vsf_linux_fs.c:1577
#define setgid
Definition unistd.h:57
int mkdirs(const char *pathname, mode_t mode)
Definition vsf_linux_fs.c:1559
#define mkdir
Definition unistd.h:119
#define execv
Definition unistd.h:79
#define getpagesize
Definition unistd.h:96
#define execlp
Definition unistd.h:78
#define alarm
Definition unistd.h:88
#define confstr
Definition unistd.h:48
#define setegid
Definition unistd.h:59
#define pwrite
Definition unistd.h:129
#define getpass
Definition unistd.h:104
#define writev
Definition unistd.h:127
#define _CS_PATH
Definition unistd.h:191
#define getpgid
Definition unistd.h:71
@ DT_REG
Definition unistd.h:200
@ DT_CHR
Definition unistd.h:204
@ DT_DIR
Definition unistd.h:201
@ DT_FIFO
Definition unistd.h:202
@ DT_LNK
Definition unistd.h:206
@ DT_SOCK
Definition unistd.h:203
@ DT_BLK
Definition unistd.h:205
@ DT_UNKNOWN
Definition unistd.h:199
@ DT_EXE
Definition unistd.h:207
#define ftruncate64
Definition unistd.h:99
#define pread
Definition unistd.h:128
#define fchdir
Definition unistd.h:133
#define execvpe
Definition unistd.h:82
#define gethostid
Definition unistd.h:110
@ _SC_PAGE_SIZE
Definition unistd.h:218
@ _SC_SYMLOOP_MAX
Definition unistd.h:215
@ _SC_OPEN_MAX
Definition unistd.h:212
@ _SC_GETGR_R_SIZE_MAX
Definition unistd.h:214
@ _SC_PAGESIZE
Definition unistd.h:211
@ _SC_CLK_TCK
Definition unistd.h:213
@ _SC_NPROCESSORS_ONLN
Definition unistd.h:216
#define getlogin
Definition unistd.h:54
int fchownat(int dirfd, const char *pathname, uid_t owner, gid_t group, int flags)
Definition vsf_linux.c:3063
#define getpgrp
Definition unistd.h:73
#define tcgetpgrp
Definition unistd.h:102
#define getcwd
Definition unistd.h:134
#define pipe2
Definition unistd.h:87
#define truncate
Definition unistd.h:98
exec_ret_t execle(const char *pathname, const char *arg,...)
Definition vsf_linux.c:2444
#define readv
Definition unistd.h:126
#define truncate64
Definition unistd.h:100
ssize_t preadv64(int fd, const struct iovec *vector, int iovcnt, off64_t offset)
Definition vsf_linux_fs.c:2028
#define ualarm
Definition unistd.h:89
#define pipe
Definition unistd.h:86
#define seteuid
Definition unistd.h:63
#define read
Definition unistd.h:124
#define rmdir
Definition unistd.h:121
#define execl
Definition unistd.h:77
#define acct
Definition unistd.h:92
#define execvp
Definition unistd.h:81
#define setsid
Definition unistd.h:68
#define fdatasync
Definition unistd.h:136
#define unlinkat
Definition unistd.h:117
#define setpgrp
Definition unistd.h:72
#define preadv
Definition unistd.h:130
int chown(const char *pathname, uid_t owner, gid_t group)
Definition vsf_linux.c:3048
#define getuid
Definition unistd.h:62
off64_t lseek64(int fd, off64_t offset, int whence)
Definition vsf_linux_fs.c:2110
char * ttyname(int fd)
Definition vsf_linux.c:1104
#define pwritev
Definition unistd.h:131
#define symlink
Definition unistd.h:95
#define ftruncate
Definition unistd.h:97
int ttyname_r(int fd, char *buf, size_t buflen)
Definition vsf_linux.c:1082
#define sysconf
Definition unistd.h:83
#define close
Definition unistd.h:122
#define chdir
Definition unistd.h:132
#define getgid
Definition unistd.h:58
#define usleep
Definition unistd.h:50
#define mkdirat
Definition unistd.h:120
#define gethostname
Definition unistd.h:105
#define fork
Definition unistd.h:90
#define getentropy
Definition unistd.h:108
#define _exit
Definition unistd.h:91
#define geteuid
Definition unistd.h:64
#define write
Definition unistd.h:125
void sync(void)
Definition vsf_linux_fs.c:2137
#define setresgid
Definition unistd.h:75
#define setuid
Definition unistd.h:61
#define sleep
Definition unistd.h:51
#define getlogin_r
Definition unistd.h:55
#define getegid
Definition unistd.h:60
pid_t __vsf_linux_vfork_prepare(vsf_linux_process_t *parent_process)
Definition vsf_linux.c:3892
int syncfs(int fd)
Definition vsf_linux_fs.c:2141
#define fsync
Definition unistd.h:135
#define sethostname
Definition unistd.h:106
#define getsid
Definition unistd.h:69
#define getpid
Definition unistd.h:65
#define setpgid
Definition unistd.h:70
#define gettid
Definition unistd.h:67
#define _CS_GNU_LIBC_VERSION
Definition unistd.h:193
#define execve
Definition unistd.h:80
ssize_t pwritev64(int fd, const struct iovec *vector, int iovcnt, off64_t offset)
Definition vsf_linux_fs.c:2064
#define getppid
Definition unistd.h:66
#define tcsetpgrp
Definition unistd.h:103
int getdtablesize(void)
Definition vsf_linux.c:3886
#define isatty
Definition unistd.h:94
int dup3(int oldfd, int newfd, int flags)
Definition vsf_linux_fs.c:1587
int daemon(int nochdir, int noclose)
Definition vsf_linux.c:1900
@ _PC_MAX_CANON
Definition unistd.h:223
@ _PC_LINK_MAX
Definition unistd.h:222
@ _PC_MAX_INPUT
Definition unistd.h:224
@ _PC_NAME_MAX
Definition unistd.h:225
@ _PC_PATH_MAX
Definition unistd.h:226
#define _CS_GNU_LIBPTHREAD_VERSION
Definition unistd.h:195
int chroot(const char *path)
Definition vsf_linux_fs.c:1633
#define readlink
Definition unistd.h:101
#define __VSF_VPLT_DECORATOR__
Definition vsf_cfg.h:93
#define VSF_APPLET_VPLT_ENTRY_FUNC_TRACE()
Definition vsf_cfg.h:165
exec_ret_t __execl_va(const char *pathname, const char *arg, va_list ap, bool has_env)
Definition vsf_linux.c:2407
exec_ret_t __execlp_va(const char *pathname, const char *arg, va_list ap)
Definition vsf_linux.c:2370
#define VSF_APPLET_VPLT_FUNC_DECORATOR(__NAME)
Definition vsf_linux_applet_lib.c:1
uint64_t offset
Definition vsf_memfs.h:49
uint_fast8_t length
Definition vsf_pbuf.c:38
uint8_t status
Definition vsf_tgui.h:139