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 mkdirat VSF_LINUX_WRAPPER(mkdirat)
120# define rmdir VSF_LINUX_WRAPPER(rmdir)
121# define close VSF_LINUX_WRAPPER(close)
122# define lseek VSF_LINUX_WRAPPER(lseek)
123# define read VSF_LINUX_WRAPPER(read)
124# define write VSF_LINUX_WRAPPER(write)
125# define readv VSF_LINUX_WRAPPER(readv)
126# define writev VSF_LINUX_WRAPPER(writev)
127# define pread VSF_LINUX_WRAPPER(pread)
128# define pwrite VSF_LINUX_WRAPPER(pwrite)
129# define preadv VSF_LINUX_WRAPPER(preadv)
130# define pwritev VSF_LINUX_WRAPPER(pwritev)
131# define chdir VSF_LINUX_WRAPPER(chdir)
132# define fchdir VSF_LINUX_WRAPPER(fchdir)
133# define getcwd VSF_LINUX_WRAPPER(getcwd)
134# define fsync VSF_LINUX_WRAPPER(fsync)
135# define fdatasync VSF_LINUX_WRAPPER(fdatasync)
137#elif defined(__WIN__) && !defined(__VSF_APPLET__)
138#define _exit VSF_LINUX_WRAPPER(_exit)
143#define __NR_close close
145#define __NR_dup2 dup2
146#define __NR_dup3 dup3
147#define __NR_access access
148#define __NR_write write
149#define __NR_writev writev
150#define __NR_read read
151#define __NR_readv readv
152#define __NR_truncate truncate
153#define __NR_rtruncate ftruncate
154#define __NR_faccessat faccessat
155#define __NR_unlink unlink
156#define __NR_unlinkat unlinkat
157#define __NR_sync sync
158#define __NR_fsync fsync
159#define __NR_chdir chdir
160#define __NR_fchdir fchdir
161#define __NR_chown chown
162#define __NR_fchown fchown
163#define __NR_fchownat fchownat
164#define __NR_chroot chroot
165#define __NR_pipe pipe
166#define __NR_pipe2 pipe2
167#define __NR_alarm alarm
168#define __NR_execve execve
169#define __NR_wait4 wait4
170#define __NR_gettid gettid
171#define SYS_gettid __NR_gettid
173#define __NR_preadv(__fd, __vec, __vlen, __pos_l, __pos_h) \
174 preadv64((__fd), (__vec), (__vlen), ((off64_t)(__pos_l) << 32) + (__pos_h))
175#define __NR_pwritev(__fd, __vec, __vlen, __pos_l, __pos_h) \
176 pwritev64((__fd), (__vec), (__vlen), ((off64_t)(__pos_l) << 32) + (__pos_h))
178#define _POSIX_VERSION 200112L
180#define STDIN_FILENO 0
181#define STDOUT_FILENO 1
182#define STDERR_FILENO 2
184#define environ (vsf_linux_get_cur_process()->__environ)
190#define _CS_PATH _CS_PATH
192#define _CS_GNU_LIBC_VERSION _CS_GNU_LIBC_VERSION
194#define _CS_GNU_LIBPTHREAD_VERSION _CS_GNU_LIBPTHREAD_VERSION
240#if VSF_LINUX_APPLET_USE_UNISTD == ENABLED
357# ifndef __VSF_APPLET__
362#if defined(__VSF_APPLET__) && (defined(__VSF_APPLET_LIB__) || defined(__VSF_APPLET_LINUX_UNISTD_LIB__))\
363 && VSF_APPLET_CFG_ABI_PATCH != ENABLED && VSF_LINUX_APPLET_USE_UNISTD == ENABLED
365#ifndef VSF_LINUX_APPLET_UNISTD_VPLT
366# if VSF_LINUX_USE_APPLET == ENABLED
367# define VSF_LINUX_APPLET_UNISTD_VPLT \
368 ((vsf_linux_unistd_vplt_t *)(VSF_LINUX_APPLET_VPLT->unistd_vplt))
370# define VSF_LINUX_APPLET_UNISTD_VPLT \
371 ((vsf_linux_unistd_vplt_t *)vsf_vplt((void *)0))
375#define VSF_LINUX_APPLET_UNISTD_ENTRY(__NAME) \
376 VSF_APPLET_VPLT_ENTRY_FUNC_ENTRY(VSF_LINUX_APPLET_UNISTD_VPLT, __NAME)
377#define VSF_LINUX_APPLET_UNISTD_IMP(...) \
378 VSF_APPLET_VPLT_ENTRY_FUNC_IMP(VSF_LINUX_APPLET_UNISTD_VPLT, __VA_ARGS__)
380VSF_LINUX_APPLET_UNISTD_IMP(
__execl_va,
exec_ret_t,
const char *pathname,
const char *arg, va_list ap,
bool has_env) {
382 return VSF_LINUX_APPLET_UNISTD_ENTRY(
__execl_va)(pathname, arg, ap, has_env);
384VSF_LINUX_APPLET_UNISTD_IMP(
__execlp_va,
exec_ret_t,
const char *pathname,
const char *arg, va_list ap) {
386 return VSF_LINUX_APPLET_UNISTD_ENTRY(
__execlp_va)(pathname, arg, ap);
388VSF_LINUX_APPLET_UNISTD_IMP(
confstr,
size_t,
int name,
char *buf,
size_t len) {
390 return VSF_LINUX_APPLET_UNISTD_ENTRY(
confstr)(name, buf, len);
392VSF_LINUX_APPLET_UNISTD_IMP(
usleep,
int,
int micro_seconds) {
394 return VSF_LINUX_APPLET_UNISTD_ENTRY(
usleep)(micro_seconds);
396VSF_LINUX_APPLET_UNISTD_IMP(
sleep,
unsigned,
unsigned seconds) {
398 return VSF_LINUX_APPLET_UNISTD_ENTRY(
sleep)(seconds);
400VSF_LINUX_APPLET_UNISTD_IMP(
pause,
int,
void) {
402 return VSF_LINUX_APPLET_UNISTD_ENTRY(
pause)();
404VSF_LINUX_APPLET_UNISTD_IMP(
alarm,
unsigned int,
unsigned int seconds) {
406 return VSF_LINUX_APPLET_UNISTD_ENTRY(
alarm)(seconds);
410 return VSF_LINUX_APPLET_UNISTD_ENTRY(
ualarm)(usecs, interval);
412VSF_LINUX_APPLET_UNISTD_IMP(
getlogin,
char *,
void) {
414 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getlogin)();
416VSF_LINUX_APPLET_UNISTD_IMP(
getlogin_r,
int,
char *buf,
size_t bufsize) {
418 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getlogin_r)(buf, bufsize);
420VSF_LINUX_APPLET_UNISTD_IMP(
setuid,
int,
uid_t uid) {
422 return VSF_LINUX_APPLET_UNISTD_ENTRY(
setuid)(uid);
426 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getuid)();
430 return VSF_LINUX_APPLET_UNISTD_ENTRY(
seteuid)(euid);
434 return VSF_LINUX_APPLET_UNISTD_ENTRY(
geteuid)();
436VSF_LINUX_APPLET_UNISTD_IMP(
setgid,
int,
gid_t gid) {
438 return VSF_LINUX_APPLET_UNISTD_ENTRY(
setgid)(gid);
442 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getgid)();
446 return VSF_LINUX_APPLET_UNISTD_ENTRY(
setegid)(egid);
450 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getegid)();
454 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getpid)();
458 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getppid)();
462 return VSF_LINUX_APPLET_UNISTD_ENTRY(
gettid)();
466 return VSF_LINUX_APPLET_UNISTD_ENTRY(
setsid)();
470 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getsid)(pid);
474 return VSF_LINUX_APPLET_UNISTD_ENTRY(
setpgid)(pid, pgid);
478 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getpgid)(pid);
480VSF_LINUX_APPLET_UNISTD_IMP(
setpgrp,
int,
void) {
482 return VSF_LINUX_APPLET_UNISTD_ENTRY(
setpgrp)();
486 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getpgrp)();
490 return VSF_LINUX_APPLET_UNISTD_ENTRY(
setresuid)(ruid, euid, suid);
494 return VSF_LINUX_APPLET_UNISTD_ENTRY(
setresgid)(rgid, egid, sgid);
496VSF_LINUX_APPLET_UNISTD_IMP(
execv,
exec_ret_t,
const char *pathname,
char *
const * argv) {
498 return VSF_LINUX_APPLET_UNISTD_ENTRY(
execv)(pathname, argv);
500VSF_LINUX_APPLET_UNISTD_IMP(
execve,
exec_ret_t,
const char *pathname,
char *
const * argv,
char *
const * envp) {
502 return VSF_LINUX_APPLET_UNISTD_ENTRY(
execve)(pathname, argv, envp);
504VSF_LINUX_APPLET_UNISTD_IMP(
execvp,
exec_ret_t,
const char *file,
char *
const * argv) {
506 return VSF_LINUX_APPLET_UNISTD_ENTRY(
execvp)(file, argv);
508VSF_LINUX_APPLET_UNISTD_IMP(
execvpe,
exec_ret_t,
const char *file,
char *
const * argv,
char *
const * envp) {
510 return VSF_LINUX_APPLET_UNISTD_ENTRY(
execvpe)(file, argv, envp);
512VSF_LINUX_APPLET_UNISTD_IMP(
daemon,
int,
int nochdir,
int noclose) {
514 return VSF_LINUX_APPLET_UNISTD_ENTRY(
daemon)(nochdir, noclose);
516VSF_LINUX_APPLET_UNISTD_IMP(
sysconf,
long,
int name) {
518 return VSF_LINUX_APPLET_UNISTD_ENTRY(
sysconf)(name);
520VSF_LINUX_APPLET_UNISTD_IMP(
pathconf,
long,
const char *path,
int name) {
522 return VSF_LINUX_APPLET_UNISTD_ENTRY(
pathconf)(path, name);
524VSF_LINUX_APPLET_UNISTD_IMP(
fpathconf,
long,
int fd,
int name) {
526 return VSF_LINUX_APPLET_UNISTD_ENTRY(
fpathconf)(fd, name);
528VSF_LINUX_APPLET_UNISTD_IMP(
pipe,
int,
int pipefd[2]) {
530 return VSF_LINUX_APPLET_UNISTD_ENTRY(
pipe)(pipefd);
532VSF_LINUX_APPLET_UNISTD_IMP(
pipe2,
int,
int pipefd[2],
int flags) {
534 return VSF_LINUX_APPLET_UNISTD_ENTRY(
pipe2)(pipefd, flags);
536VSF_LINUX_APPLET_UNISTD_IMP(
access,
int,
const char *pathname,
int mode) {
538 return VSF_LINUX_APPLET_UNISTD_ENTRY(
access)(pathname, mode);
540VSF_LINUX_APPLET_UNISTD_IMP(
unlink,
int,
const char *pathname) {
542 return VSF_LINUX_APPLET_UNISTD_ENTRY(
unlink)(pathname);
544VSF_LINUX_APPLET_UNISTD_IMP(
unlinkat,
int,
int dirfd,
const char *pathname,
int flags) {
546 return VSF_LINUX_APPLET_UNISTD_ENTRY(
unlinkat)(dirfd, pathname, flags);
548VSF_LINUX_APPLET_UNISTD_IMP(
link,
int,
const char *oldpath,
const char *newpath) {
550 return VSF_LINUX_APPLET_UNISTD_ENTRY(
link)(oldpath, newpath);
552VSF_LINUX_APPLET_UNISTD_IMP(
mkdirat,
int,
int dirfd,
const char *pathname,
mode_t mode) {
554 return VSF_LINUX_APPLET_UNISTD_ENTRY(
mkdirat)(dirfd, pathname, mode);
556VSF_LINUX_APPLET_UNISTD_IMP(
rmdir,
int,
const char *pathname) {
558 return VSF_LINUX_APPLET_UNISTD_ENTRY(
rmdir)(pathname);
560VSF_LINUX_APPLET_UNISTD_IMP(
dup,
int,
int oldfd) {
562 return VSF_LINUX_APPLET_UNISTD_ENTRY(
dup)(oldfd);
564VSF_LINUX_APPLET_UNISTD_IMP(
dup2,
int,
int oldfd,
int newfd) {
566 return VSF_LINUX_APPLET_UNISTD_ENTRY(
dup2)(oldfd, newfd);
568VSF_LINUX_APPLET_UNISTD_IMP(
dup3,
int,
int oldfd,
int newfd,
int flags) {
570 return VSF_LINUX_APPLET_UNISTD_ENTRY(
dup3)(oldfd, newfd, flags);
572VSF_LINUX_APPLET_UNISTD_IMP(
chroot,
int,
const char *path) {
574 return VSF_LINUX_APPLET_UNISTD_ENTRY(
chroot)(path);
576VSF_LINUX_APPLET_UNISTD_IMP(
chdir,
int,
const char *pathname) {
578 return VSF_LINUX_APPLET_UNISTD_ENTRY(
chdir)(pathname);
580VSF_LINUX_APPLET_UNISTD_IMP(
fchdir,
int,
int fd) {
582 return VSF_LINUX_APPLET_UNISTD_ENTRY(
fchdir)(fd);
584VSF_LINUX_APPLET_UNISTD_IMP(
getcwd,
char *,
char *buffer,
size_t maxlen) {
586 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getcwd)(buffer, maxlen);
588VSF_LINUX_APPLET_UNISTD_IMP(
close,
int,
int fd) {
590 return VSF_LINUX_APPLET_UNISTD_ENTRY(
close)(fd);
594 return VSF_LINUX_APPLET_UNISTD_ENTRY(
lseek)(fd,
offset, whence);
596VSF_LINUX_APPLET_UNISTD_IMP(
read,
ssize_t,
int fd,
void *buf,
size_t count) {
598 return VSF_LINUX_APPLET_UNISTD_ENTRY(
read)(fd, buf, count);
600VSF_LINUX_APPLET_UNISTD_IMP(
write,
ssize_t,
int fd,
const void *buf,
size_t count) {
602 return VSF_LINUX_APPLET_UNISTD_ENTRY(
write)(fd, buf, count);
604VSF_LINUX_APPLET_UNISTD_IMP(
readv,
ssize_t,
int fd,
const struct iovec *iov,
int iovcnt) {
606 return VSF_LINUX_APPLET_UNISTD_ENTRY(
readv)(fd, iov, iovcnt);
608VSF_LINUX_APPLET_UNISTD_IMP(
writev,
ssize_t,
int fd,
const struct iovec *iov,
int iovcnt) {
610 return VSF_LINUX_APPLET_UNISTD_ENTRY(
writev)(fd, iov, iovcnt);
614 return VSF_LINUX_APPLET_UNISTD_ENTRY(
pread)(fd, buf, count,
offset);
618 return VSF_LINUX_APPLET_UNISTD_ENTRY(
pwrite)(fd, buf, count,
offset);
622 return VSF_LINUX_APPLET_UNISTD_ENTRY(
preadv)(fd, iov, iovcnt,
offset);
626 return VSF_LINUX_APPLET_UNISTD_ENTRY(
pwritev)(fd, iov, iovcnt,
offset);
628VSF_LINUX_APPLET_UNISTD_IMP(
sync,
void,
void) {
630 VSF_LINUX_APPLET_UNISTD_ENTRY(
sync)();
632VSF_LINUX_APPLET_UNISTD_IMP(
syncfs,
int,
int fd) {
634 return VSF_LINUX_APPLET_UNISTD_ENTRY(
syncfs)(fd);
636VSF_LINUX_APPLET_UNISTD_IMP(
fsync,
int,
int fd) {
638 return VSF_LINUX_APPLET_UNISTD_ENTRY(
fsync)(fd);
640VSF_LINUX_APPLET_UNISTD_IMP(
fdatasync,
int,
int fd) {
642 return VSF_LINUX_APPLET_UNISTD_ENTRY(
fdatasync)(fd);
644VSF_LINUX_APPLET_UNISTD_IMP(
isatty,
int,
int fd) {
646 return VSF_LINUX_APPLET_UNISTD_ENTRY(
isatty)(fd);
648VSF_LINUX_APPLET_UNISTD_IMP(
getpagesize,
size_t,
void) {
650 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getpagesize)();
652VSF_LINUX_APPLET_UNISTD_IMP(
symlink,
int,
const char *target,
const char *linkpath) {
654 return VSF_LINUX_APPLET_UNISTD_ENTRY(
symlink)(target, linkpath);
672VSF_LINUX_APPLET_UNISTD_IMP(
readlink,
ssize_t,
const char *pathname,
char *buf,
size_t bufsiz) {
674 return VSF_LINUX_APPLET_UNISTD_ENTRY(
readlink)(pathname, buf, bufsiz);
678 return VSF_LINUX_APPLET_UNISTD_ENTRY(
tcgetpgrp)(fd);
682 return VSF_LINUX_APPLET_UNISTD_ENTRY(
tcsetpgrp)(fd, pgrp);
684VSF_LINUX_APPLET_UNISTD_IMP(
getpass,
char *,
const char *prompt) {
686 return VSF_LINUX_APPLET_UNISTD_ENTRY(
getpass)(prompt);
688VSF_LINUX_APPLET_UNISTD_IMP(
gethostname,
int,
char *name,
size_t len) {
690 return VSF_LINUX_APPLET_UNISTD_ENTRY(
gethostname)(name, len);
692VSF_LINUX_APPLET_UNISTD_IMP(
sethostname,
int,
const char *name,
size_t len) {
694 return VSF_LINUX_APPLET_UNISTD_ENTRY(
sethostname)(name, len);
698 return VSF_LINUX_APPLET_UNISTD_ENTRY(
chown)(pathname, owner,
group);
702 return VSF_LINUX_APPLET_UNISTD_ENTRY(
fchown)(fd, owner,
group);
706 return VSF_LINUX_APPLET_UNISTD_ENTRY(
lchown)(pathname, owner,
group);
708VSF_LINUX_APPLET_UNISTD_IMP(
fchownat,
int,
int dirfd,
const char *pathname,
uid_t owner,
gid_t group,
int flags) {
710 return VSF_LINUX_APPLET_UNISTD_ENTRY(
fchownat)(dirfd, pathname, owner,
group, flags);
716VSF_LINUX_APPLET_UNISTD_IMP(
gethostid,
long,
void) {
718 return VSF_LINUX_APPLET_UNISTD_ENTRY(
gethostid)();
720VSF_LINUX_APPLET_UNISTD_IMP(
sethostid,
int,
long hostid) {
722 return VSF_LINUX_APPLET_UNISTD_ENTRY(
sethostid)(hostid);
726 return VSF_LINUX_APPLET_UNISTD_ENTRY(
lseek64)(fd,
offset, whence);
728VSF_LINUX_APPLET_UNISTD_IMP(
ttyname,
char *,
int fd) {
730 return VSF_LINUX_APPLET_UNISTD_ENTRY(
ttyname)(fd);
732VSF_LINUX_APPLET_UNISTD_IMP(
ttyname_r,
int,
int fd,
char *buf,
size_t buflen) {
734 return VSF_LINUX_APPLET_UNISTD_ENTRY(
ttyname_r)(fd, buf, buflen);
736VSF_LINUX_APPLET_UNISTD_IMP(
_exit,
void,
int status) {
740VSF_LINUX_APPLET_UNISTD_IMP(
acct,
int,
const char *filename) {
742 return VSF_LINUX_APPLET_UNISTD_ENTRY(
acct)(filename);
748VSF_LINUX_APPLET_UNISTD_IMP(
mkdirs,
int,
const char *pathname,
mode_t mode) {
750 return VSF_LINUX_APPLET_UNISTD_ENTRY(
mkdirs)(pathname, mode);
762 ret = VSF_LINUX_APPLET_UNISTD_ENTRY(
__execl_va)(pathname, arg, ap,
false);
771 ret = VSF_LINUX_APPLET_UNISTD_ENTRY(
__execl_va)(pathname, arg, ap,
true);
780 ret = VSF_LINUX_APPLET_UNISTD_ENTRY(
__execlp_va)(file, arg, ap);
787size_t confstr(
int name,
char *buf,
size_t len);
789int usleep(
int micro_seconds);
790unsigned sleep(
unsigned seconds);
793unsigned int alarm(
unsigned int seconds);
824exec_ret_t execve(
const char *pathname,
char *
const * argv,
char *
const * envp);
827int daemon(
int nochdir,
int noclose);
832long pathconf(
const char *path,
int name);
834int pipe(
int pipefd[2]);
835int pipe2(
int pipefd[2],
int flags);
837int access(
const char *pathname,
int mode);
838int unlink(
const char *pathname);
839int unlinkat(
int dirfd,
const char *pathname,
int flags);
840int link(
const char *oldpath,
const char *newpath);
843int rmdir(
const char *pathname);
845int dup2(
int oldfd,
int newfd);
846int dup3(
int oldfd,
int newfd,
int flags);
848int chroot(
const char *path);
849int chdir(
const char *pathname);
851char *
getcwd(
char *buffer,
size_t maxlen);
874int ttyname_r(
int fd,
char *buf,
size_t buflen);
876int symlink(
const char *target,
const char *linkpath);
884char *
getpass(
const char *prompt);
900int acct(
const char *filename);
902#if VSF_LINUX_USE_VFORK == ENABLED
908#if VSF_LINUX_USE_VFORK == ENABLED
910 vsf_linux_process_t *parent_process = vsf_linux_get_cur_process(); \
911 pid_t result = (pid_t)-1, child_pid = __vsf_linux_vfork_prepare(parent_process);\
912 if (child_pid >= 0) { \
913 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:231
size_t iov_len
Definition unistd.h:232
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:242
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(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:5050
int lchown(const char *pathname, uid_t owner, gid_t group)
Definition vsf_linux.c:3071
#define sethostid
Definition unistd.h:111
#define lseek
Definition unistd.h:122
#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:3066
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 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:128
#define getpass
Definition unistd.h:104
#define writev
Definition unistd.h:126
#define _CS_PATH
Definition unistd.h:190
#define getpgid
Definition unistd.h:71
#define ftruncate64
Definition unistd.h:99
#define pread
Definition unistd.h:127
#define fchdir
Definition unistd.h:132
#define execvpe
Definition unistd.h:82
#define gethostid
Definition unistd.h:110
#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:3076
#define getpgrp
Definition unistd.h:73
#define tcgetpgrp
Definition unistd.h:102
#define getcwd
Definition unistd.h:133
#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:2457
#define readv
Definition unistd.h:125
#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:2031
#define ualarm
Definition unistd.h:89
#define pipe
Definition unistd.h:86
#define seteuid
Definition unistd.h:63
#define read
Definition unistd.h:123
#define rmdir
Definition unistd.h:120
#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:135
#define unlinkat
Definition unistd.h:117
#define setpgrp
Definition unistd.h:72
#define preadv
Definition unistd.h:129
int chown(const char *pathname, uid_t owner, gid_t group)
Definition vsf_linux.c:3061
#define getuid
Definition unistd.h:62
off64_t lseek64(int fd, off64_t offset, int whence)
Definition vsf_linux_fs.c:2113
char * ttyname(int fd)
Definition vsf_linux.c:1106
@ DT_REG
Definition unistd.h:199
@ DT_CHR
Definition unistd.h:203
@ DT_DIR
Definition unistd.h:200
@ DT_FIFO
Definition unistd.h:201
@ DT_LNK
Definition unistd.h:205
@ DT_SOCK
Definition unistd.h:202
@ DT_BLK
Definition unistd.h:204
@ DT_UNKNOWN
Definition unistd.h:198
@ DT_EXE
Definition unistd.h:206
#define pwritev
Definition unistd.h:130
#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:1084
#define sysconf
Definition unistd.h:83
#define close
Definition unistd.h:121
#define chdir
Definition unistd.h:131
#define getgid
Definition unistd.h:58
#define usleep
Definition unistd.h:50
#define mkdirat
Definition unistd.h:119
#define gethostname
Definition unistd.h:105
#define fork
Definition unistd.h:90
#define getentropy
Definition unistd.h:108
@ _SC_PAGE_SIZE
Definition unistd.h:217
@ _SC_SYMLOOP_MAX
Definition unistd.h:214
@ _SC_OPEN_MAX
Definition unistd.h:211
@ _SC_GETGR_R_SIZE_MAX
Definition unistd.h:213
@ _SC_PAGESIZE
Definition unistd.h:210
@ _SC_CLK_TCK
Definition unistd.h:212
@ _SC_NPROCESSORS_ONLN
Definition unistd.h:215
#define _exit
Definition unistd.h:91
#define geteuid
Definition unistd.h:64
#define write
Definition unistd.h:124
void sync(void)
Definition vsf_linux_fs.c:2140
#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:3921
int syncfs(int fd)
Definition vsf_linux_fs.c:2144
#define fsync
Definition unistd.h:134
#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:192
#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:2067
#define getppid
Definition unistd.h:66
#define tcsetpgrp
Definition unistd.h:103
@ _PC_MAX_CANON
Definition unistd.h:222
@ _PC_LINK_MAX
Definition unistd.h:221
@ _PC_MAX_INPUT
Definition unistd.h:223
@ _PC_NAME_MAX
Definition unistd.h:224
@ _PC_PATH_MAX
Definition unistd.h:225
int getdtablesize(void)
Definition vsf_linux.c:3915
#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:1904
#define _CS_GNU_LIBPTHREAD_VERSION
Definition unistd.h:194
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:2420
exec_ret_t __execlp_va(const char *pathname, const char *arg, va_list ap)
Definition vsf_linux.c:2383
#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:144