]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/Include/unistd.h
StdLib: Removing ipf which is no longer supported from edk2.
[mirror_edk2.git] / StdLib / Include / unistd.h
index 4d738c64b61656df9e4e1995ed2df1a1f7db3e30..b2fd92358a401d745e28a4b59ede33088ef08a8a 100644 (file)
 #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
@@ -41,6 +47,65 @@ int             usleep(useconds_t);
 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
@@ -77,7 +142,6 @@ gid_t           getegid(void);
 uid_t           geteuid(void);\r
 gid_t           getgid(void);\r
 int             getgroups(int, gid_t []);\r
-pid_t           getpid(void);\r
 pid_t           getppid(void);\r
 int             link(const char *, const char *);\r
 long            pathconf(const char *, int);\r