Prex Home > Document Index > Prex POSIX Compliance

Prex POSIX Compliance

For Prex version 0.9.0, 2009/10/01


Table of Contents

Introduction

In order to reduce the development time of mobilie applications, Prex is providing developers with POSIX system call interface and standard C libraries.

POSIX APIs

File and Directories - <unistd.h>

Name Synopsis Description Support?
getcwd char *getcwd(char *buf, size_t size); get current working directory Yes
mkdir int mkdir(const char *pathname, mode_t mode); create a directory Yes
rmdir int rmdir(const char *pathname); delete a directory Yes
chdir int chdir(const char *path); change working directory Yes
link int link(const char *oldpath, const char *newpath); make a new name for a file X
unlink int unlink(const char *pathname); delete a name and possibly the file it refers to Yes
rename int rename(const char *oldpath, const char *newpath); change the name or location of a file Yes
stat int stat(const char *file_name, struct stat *buf); get file status Yes
chmod int chmod(const char *path, mode_t mode); change permissions of a file X
chown int chown(const char *path, uid_t owner, gid_t group); change ownership of a file X
utime int utime(const char *filename, struct utimbuf *buf); change access and/or modification times of an inode X
opendir DIR *opendir(const char *name); open a directory Yes
readdir struct dirent *readdir(DIR *dir); read directory entry Yes
closedir int closedir(DIR *dir); close a directory Yes
rewinddir void rewinddir(DIR *dir); reset directory stream Yes

Advanced File Operations - <unistd.h>

Name Synopsis Description Support?
access int access(const char *pathname, int mode); check user's permissions for a file Yes
open int open(const char *pathname, int flags); open and possibly create a file or device Yes
creat int creat(const char *pathname, mode_t mode); open and possibly create a file or device Yes
close int close(int fd); close a file descriptor Yes
read ssize_t read(int fd, void *buf, size_t count); read from a file descriptor Yes
write ssize_t write(int fd, const void *buf, size_t count); write to a file descriptor Yes
fcntl int fcntl(int fd, int cmd); manipulate file descriptor Yes
fstat int fstat(int filedes, struct stat *buf); get file status Yes
lseek off_t lseek(int fildes, off_t offset, int whence); reposition read/write file offset Yes
dup int dup(int oldfd); duplicate a file descriptor Yes
dup2 int dup2(int oldfd, int newfd); duplicate a file descriptor Yes
pipe int pipe(int filedes[2]); create pipe Yes
mkfifo int mkfifo(const char *pathname, mode_t mode); make a FIFO special file (a named pipe) plan
umask mode_t umask(mode_t mask); set file creation mask X
fdopen FILE *fdopen(int fildes, const char *mode); associate a stream with an existing file descriptor Yes
fileno int fileno(FILE *stream); return file descriptor of stream Yes

Processes - <unistd.h>

Name Synopsis Description Support?
fork pid_t fork(void); create a child process Yes
execl int execl(const char *path, const char *arg, ...); execute a file Yes
execle int execle(const char *path, const char *arg, ...) execute a file Yes
execlp int execlp(const char *file, const char *arg, ...); execute a file Yes
execv int execv(const char *path, char *const argv[]); execute a file Yes
execve int execve(const char *path, char *const argv[], char *const envp[])) execute program Yes
execvp int execvp(const char *file, char *const argv[]); execute a file Yes
wait pid_t wait(int *status); wait for process termination Yes
waitpid pid_t waitpid(pid_t pid, int *status, int options); wait for process termination Yes
_exit void _exit(int status); terminate the current process Yes
kill int kill(pid_t pid, int sig); send signal to a process Yes
sleep unsigned int sleep(unsigned int seconds); Sleep for the specified number of seconds Yes
pause int pause(void); wait for signal Yes
alarm unsigned int alarm(unsigned int seconds); set an alarm clock for delivery of a signal Yes
setuid int setuid(uid_t uid); set user identity Yes(Limited Support)
setgid int setgid(gid_t gid); set group identity Yes(Limited Support)

Long Jumps - <setjmp.h>

Name Synopsis Description Support?
setjmp int setjmp(jmp_buf env); save stack context for non-local goto Yes
sigsetjmp int sigsetjmp(sigjmp_buf env, int savesigs); save stack context for non-local goto X
longjmp void longjmp(jmp_buf env, int val); non-local jump to a saved stack context Yes
siglongjmp void siglongjmp(sigjmp_buf env, int val); non-local jump to a saved stack context X

Signal Handling - <signal.h>

Name Synopsis Description Support?
sigaction int sigaction(int sig, const struct sigaction *act, struct sigaction *oldact); examine and change signal action Yes
sigemptyset int sigemptyset(sigset_t *set); create an empty signal set X
sigfillset int sigfillset(sigset_t *set); create a full set of signals X
sigaddset int sigaddset(sigset_t *set, int signum); add a signal to a signal set X
sigdelset int sigdelset(sigset_t *set, int signum); remove a signal from a signal set X
sigismember int sigismember(const sigset_t *set, int signum); test a signal set for a selected member X
sigprocmask int sigprocmask(int how, const sigset_t *set, sigset_t *oset); examine and change blocked signals Yes
sigpending int sigpending(sigset_t *set); examine pending signals Yes
sigsuspend int sigsuspend(const sigset_t *mask); wait for a signal Yes

Obtaining Information at Runtime - <unistd.h><pwd.h><grp.h>

Name Synopsis Description Support?
getpid pid_t getpid(void); get process identification Yes
getppid pid_t getppid(void); get parent process identification Yes
getlogin char * getlogin(void); get user name X
getuid uid_t getuid(void); get user identity Yes(Limited Support)
geteuid uid_t geteuid(void); get effective user identity Yes(Limited Support)
cuserrid char * cuserid(char *string); get user name plan
getgid gid_t getgid(void); get group identity Yes(Limited Support)
getegid gid_t getegid(void); get effective group identity Yes(Limited Support)
getpwuid struct passwd *getpwuid(uid_t uid); get password file entry based on user id X
getpwnam struct passwd *getpwnam(const char * name); get password file entry based on user name X
getgrgid struct group *getgrgid(gid_t gid); get group file entry based on group id X
getgrnam struct group *getgrnam(const char *name); get group file entry baes on group name X
getgroups int getgroups(int size, gid_t list[]); get list of supplementary group IDs X
ctermid char *ctermid(char *s); get controlling terminal name plan
uname int uname(struct utsname *buf); get name and information about current kernel Yes
getenv char *getenv(const char *name); get an environment variable Yes
sysconf long sysconf(int name); get configuration information at runtime plan
fpathconf long fpathconf(int filedes, int name); get configuration values for files plan
isatty int isatty(int desc); does this descriptor refer to a terminal Yes
ttyname char *ttyname(int desc); return name of a terminal plan
times clock_t times(struct tms *buf); get process times plan
tzset void tzset(void); initialize time conversion information plan

Terminal I/O - <termios.h>

Name Synopsis Description Support?
getpid pid_t getpid(void); get process identification Yes
tcgetattr int tcgetattr(int fd, struct termios *termios_p); get terminal attributes Yes
tcsetattr int tcsetattr(int fd, int optional_actions, struct termios *termios_p); set terminal attributes Yes
tcdrain int tcdrain(int fd); wait for all output to be transmitted to the terminal Yes
tcflow int tcflow(int fd, int action); suspend/restart terminal output Yes
tcflush int tcflush(int fd, int queue_selector); discard terminal data Yes
tcsendbreak int tcsendbreak(int fd, int duration); send a break to a terminal Yes
cfgetispeed speed_t cfgetispeed(struct termios *termios_p); get input baud rate Yes
cfgetospeed speed_t cfgetospeed(struct termios *termios_p); get output baud rate Yes
cfsetispeed int cfsetispeed(struct termios *termios_p, speed_t speed); set input baud rate Yes
cfsetospeed speed_t cfsetospeed(const struct termios *termios_p); set output baud rate Yes
tcgetpgrp pid_t tcgetpgrp(int fd); get terminal foreground process group ID Yes
tcsetpgrp int tcsetpgrp(int fd, pid_t pgrpid); set terminal foreground process group ID Yes

Process Groups and Job Control - <unistd.h>

Name Synopsis Description Support?
setsid pid_t setsid(void); creates a session and sets the process group ID plan
setpgid int setpgid(pid_t pid, pid_t pgid); set process group Yes
getpgrp pid_t getpgrp(void); get process group Yes