#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 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
-__dead void _exit(int) __attribute__((__noreturn__));\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
-int dup(int);\r
-pid_t fork(void);\r
\r
-// The following *nix functions are not implemented\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
uid_t geteuid(void);\r
gid_t getgid(void);\r
int getgroups(int, gid_t []);\r
-__aconst char *getlogin(void);\r
-pid_t getpgrp(void);\r
-pid_t getpid(void);\r
pid_t getppid(void);\r
-uid_t getuid(void);\r
int link(const char *, const char *);\r
long pathconf(const char *, int);\r
int pause(void);\r
int setpgid(pid_t, pid_t);\r
pid_t setsid(void);\r
int setuid(uid_t);\r
-unsigned int sleep(unsigned int);\r
long sysconf(int);\r
-pid_t tcgetpgrp(int);\r
+\r
int tcsetpgrp(int, pid_t);\r
__aconst char *ttyname(int);\r
\r
-int getopt(int, char * const [], const char *);\r
-\r
-extern char *optarg; /* getopt(3) external variables */\r
extern int opterr;\r
-extern int optind;\r
extern int optopt;\r
-extern int optreset; /* getopt(3) external variable */\r
-extern char *suboptarg; /* getsubopt(3) external variable */\r
+extern int optreset;\r
+extern char *suboptarg;\r
\r
int setegid(gid_t);\r
int seteuid(uid_t);\r
int nice(int);\r
__aconst char *crypt(const char *, const char *);\r
int encrypt(char *, int);\r
-char *getpass(const char *);\r
pid_t getsid(pid_t);\r
\r
#ifndef intptr_t\r
int symlink(const char *, const char *);\r
void sync(void);\r
useconds_t ualarm(useconds_t, useconds_t);\r
-int usleep(useconds_t);\r
pid_t vfork(void) __RENAME(__vfork14);\r
\r
/*\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