+++ /dev/null
-/** @file\r
-\r
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
- This program and the accompanying materials are licensed and made available under\r
- the terms and conditions of the BSD License that accompanies this distribution.\r
- The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-#ifndef _UNISTD_H_\r
-#define _UNISTD_H_\r
-\r
-//#include <machine/ansi.h>\r
-//#include <machine/int_types.h>\r
-//#include <sys/featuretest.h>\r
-//#include <sys/types.h>\r
-#include <sys/unistd.h>\r
-#include <sys/EfiSysCall.h>\r
-\r
-#define F_ULOCK 0\r
-#define F_LOCK 1\r
-#define F_TLOCK 2\r
-#define F_TEST 3\r
-\r
-/* access function */\r
-#define F_OK 0 /* test for existence of file */\r
-#define X_OK 0x01 /* test for execute or search permission */\r
-#define W_OK 0x02 /* test for write permission */\r
-#define R_OK 0x04 /* test for read permission */\r
-\r
-\r
-__BEGIN_DECLS\r
-int dup(int);\r
-int rename(const char *, const char *);\r
-\r
-/* Functions implemented for compatibility. */\r
-int getopt(int, char * const [], const char *);\r
-extern char *optarg; /* getopt(3) external variables */\r
-extern int optind;\r
-pid_t getpgrp(void);\r
-pid_t tcgetpgrp(int);\r
-char *getpass(const char *);\r
-int usleep(useconds_t);\r
-unsigned int sleep(unsigned int);\r
-char *basename(char *path);\r
-\r
-#ifndef GETCWD_DECLARED\r
- /** Gets the current working directory.\r
-\r
- The getcwd() function shall place an absolute pathname of the current\r
- working directory in the array pointed to by buf, and return buf. The\r
- pathname copied to the array shall contain no components that are\r
- symbolic links. The size argument is the size in bytes of the character\r
- array pointed to by the buf argument.\r
-\r
- @param[in,out] Buf The buffer to fill.\r
- @param[in] BufSize The number of bytes in buffer.\r
-\r
- @retval NULL The function failed.\r
- @retval NULL Buf was NULL.\r
- @retval NULL Size was 0.\r
- @return buf The function completed successfully. See errno for info.\r
- **/\r
- char *getcwd(char *Buf, size_t BufSize);\r
- #define GETCWD_DECLARED\r
-#endif\r
-\r
-#ifndef CHDIR_DECLARED\r
- /** Change the current working directory.\r
-\r
- The chdir() function shall cause the directory named by the pathname\r
- pointed to by the path argument to become the current working directory;\r
- that is, the starting point for path searches for pathnames not beginning\r
- with '/'.\r
-\r
- @param[in] Path The new path to set.\r
-\r
- @todo Add non-shell CWD changing.\r
- **/\r
- int chdir(const char *Path);\r
-#define CHDIR_DECLARED\r
-#endif\r
-\r
-/** Determine accessibility of a file.\r
- The access() function checks the file, named by the pathname pointed to by\r
- the Path argument, for accessibility according to the bit pattern contained\r
- in Mode.\r
-\r
- The value of Mode is either the bitwise-inclusive OR of the access\r
- permissions to be checked (R_OK, W_OK, X_OK) or the existence test (F_OK).\r
-\r
- If Path ends in '/' or '\\', the target must be a directory, otherwise it doesn't matter.\r
- A file is executable if it is NOT a directory and it ends in ".efi".\r
-\r
- @param[in] Path Path or name of the file to be checked.\r
- @param[in] Mode Access permissions to check for.\r
-\r
- @retval 0 Successful completion.\r
- @retval -1 File is not accessible with the given Mode. The error condition\r
- is indicated by errno. Values of errno specific to the access\r
- function include: EACCES, ENOENT, ENOTDIR, ENAMETOOLONG\r
-**/\r
-int access(const char *Path, int Mode);\r
-pid_t getpid(void);\r
-\r
-// Networking\r
-long gethostid(void);\r
-int gethostname(char *, size_t);\r
-int getdomainname(char *, size_t);\r
-int setdomainname(const char *, size_t);\r
-int sethostid(long);\r
-int sethostname(const char *, size_t);\r
-\r
-/* Stub functions implemented for porting ease.\r
- These functions always fail or return NULL.\r
-*/\r
-__aconst char *getlogin(void);\r
-pid_t fork(void);\r
-uid_t getuid(void);\r
-\r
-// For Future implementation\r
-ssize_t pread(int, void *, size_t, off_t);\r
-ssize_t pwrite(int, const void *, size_t, off_t);\r
-int syscall(int, ...);\r
-\r
-#if 0 // The following functions are not implemented\r
-__dead void _exit(int) __attribute__((__noreturn__));\r
-unsigned int alarm(unsigned int);\r
-int chown(const char *, uid_t, gid_t);\r
-size_t confstr(int, char *, size_t);\r
-int execl(const char *, const char *, ...);\r
-int execle(const char *, const char *, ...);\r
-int execlp(const char *, const char *, ...);\r
-int execv(const char *, char * const *);\r
-int execve(const char *, char * const *, char * const *);\r
-int execvp(const char *, char * const *);\r
-long fpathconf(int, int);\r
-gid_t getegid(void);\r
-uid_t geteuid(void);\r
-gid_t getgid(void);\r
-int getgroups(int, gid_t []);\r
-pid_t getppid(void);\r
-int link(const char *, const char *);\r
-long pathconf(const char *, int);\r
-int pause(void);\r
-int pipe(int *);\r
-int setgid(gid_t);\r
-int setpgid(pid_t, pid_t);\r
-pid_t setsid(void);\r
-int setuid(uid_t);\r
-long sysconf(int);\r
-\r
-int tcsetpgrp(int, pid_t);\r
-__aconst char *ttyname(int);\r
-\r
-extern int opterr;\r
-extern int optopt;\r
-extern int optreset;\r
-extern char *suboptarg;\r
-\r
-int setegid(gid_t);\r
-int seteuid(uid_t);\r
-int fdatasync(int);\r
-int fsync(int);\r
-int ttyname_r(int, char *, size_t);\r
-int chroot(const char *);\r
-int nice(int);\r
-__aconst char *crypt(const char *, const char *);\r
-int encrypt(char *, int);\r
-pid_t getsid(pid_t);\r
-\r
-#ifndef intptr_t\r
-typedef __intptr_t intptr_t;\r
-#define intptr_t __intptr_t\r
-#endif\r
-\r
-int brk(void *);\r
-int fchdir(int);\r
-int fchown(int, uid_t, gid_t);\r
-int getdtablesize(void);\r
-__pure int getpagesize(void); /* legacy */\r
-pid_t getpgid(pid_t);\r
-int lchown(const char *, uid_t, gid_t);\r
-int lockf(int, int, off_t);\r
-ssize_t readlink(const char * __restrict, char * __restrict, size_t);\r
-void *sbrk(intptr_t);\r
-int setregid(gid_t, gid_t);\r
-int setreuid(uid_t, uid_t);\r
-void swab(const void *, void *, size_t);\r
-int symlink(const char *, const char *);\r
-void sync(void);\r
-useconds_t ualarm(useconds_t, useconds_t);\r
-pid_t vfork(void) __RENAME(__vfork14);\r
-\r
-/*\r
- * Implementation-defined extensions\r
- */\r
-int acct(const char *);\r
-int closefrom(int);\r
-int des_cipher(const char *, char *, long, int);\r
-int des_setkey(const char *);\r
-void endusershell(void);\r
-int exect(const char *, char * const *, char * const *);\r
-int fchroot(int);\r
-int fsync_range(int, int, off_t, off_t);\r
-int getgrouplist(const char *, gid_t, gid_t *, int *);\r
-int getgroupmembership(const char *, gid_t, gid_t *, int, int *);\r
-mode_t getmode(const void *, mode_t);\r
-int getsubopt(char **, char * const *, char **);\r
-__aconst char *getusershell(void);\r
-int initgroups(const char *, gid_t);\r
-int iruserok(uint32_t, int, const char *, const char *);\r
-int issetugid(void);\r
-int nfssvc(int, void *);\r
-int profil(char *, size_t, u_long, u_int);\r
-void psignal(unsigned int, const char *);\r
-int rcmd(char **, int, const char *, const char *, const char *, int *);\r
-int revoke(const char *);\r
-int rresvport(int *);\r
-int ruserok(const char *, int, const char *, const char *);\r
-int setgroups(int, const gid_t *);\r
-int setlogin(const char *);\r
-void *setmode(const char *);\r
-int setrgid(gid_t);\r
-int setruid(uid_t);\r
-void setusershell(void);\r
-void strmode(mode_t, char *);\r
-__aconst char *strsignal(int);\r
-int swapctl(int, void *, int);\r
-quad_t __syscall(quad_t, ...);\r
-int undelete(const char *);\r
-int rcmd_af(char **, int, const char *, const char *, const char *, int *, int);\r
-int rresvport_af(int *, int);\r
-int iruserok_sa(const void *, int, int, const char *, const char *);\r
-#endif /* Unimplemented functions. */\r
-\r
-__END_DECLS\r
-\r
-#endif /* !_UNISTD_H_ */\r