]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/Include/sys/EfiSysCall.h
StdLib: Add multi-byte character support. The normal "narrow" character set is now...
[mirror_edk2.git] / StdLib / Include / sys / EfiSysCall.h
index 1d013286091c6d580b5d3a29f8d8fd4824d7edf2..6f4742875edac4335186e534bef7e5f2e0d42988 100644 (file)
@@ -6,10 +6,6 @@
       STDIN_FILENO      0     standard input file descriptor\r
       STDOUT_FILENO     1     standard output file descriptor\r
       STDERR_FILENO     2     standard error file descriptor\r
-      F_OK              0     test for existence of file\r
-      X_OK           0x01     test for execute or search permission\r
-      W_OK           0x02     test for write permission\r
-      R_OK           0x04     test for read permission\r
       SEEK_SET          0     set file offset to offset\r
       SEEK_CUR          1     set file offset to current plus offset\r
       SEEK_END          2     set file offset to EOF plus offset\r
       int       DeleteOnClose (int fd);    Mark an open file to be deleted when closed.\r
       int       FindFreeFD    (int MinFd);\r
       BOOLEAN   ValidateFD    (int fd, int IsOpen);\r
-\r
-      ###############  Functions added for compatibility.\r
-      char     *getcwd    (char *, size_t);\r
-      int       chdir     (const char *);\r
 @endverbatim\r
 \r
-  Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2012, 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
@@ -82,12 +74,6 @@ struct stat;  /* Structure declared in <sys/stat.h> */
 #define STDOUT_FILENO 1 /**< standard output file descriptor */\r
 #define STDERR_FILENO 2 /**< standard error file descriptor */\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
 /* whence values for lseek(2)\r
    Always ensure that these are consistent with <stdio.h> and <unistd.h>!\r
 */\r
@@ -238,115 +224,100 @@ __BEGIN_DECLS
         - stdout:       Standard Output       (from the System Table)\r
         - stderr:       Standard Error Output (from the System Table)\r
 \r
-    @param[in]  name\r
-    @param[in]  oflags\r
-    @param[in]  mode\r
+    @param[in]  name      Name of file to open.\r
+    @param[in]  oflags    Flags as defined in fcntl.h.\r
+    @param[in]  mode      Access mode to use if creating the file.\r
 \r
-    @return\r
+    @return   Returns -1 on failure, otherwise the file descriptor for the open file.\r
   **/\r
   int     open      (const char *name, int oflags, int mode);\r
 \r
-  /**\r
-    @param[in]\r
+  /** Create a new file or rewrite an existing one.\r
+\r
+      The creat() function behaves as if it is implemented as follows:\r
 \r
-    @return\r
+        int creat(const char *path, mode_t mode)\r
+        {\r
+            return open(path, O_WRONLY|O_CREAT|O_TRUNC, mode);\r
+        }\r
+\r
+    @param[in]    Path    The name of the file to create.\r
+    @param[in]    Mode    Access mode (permissions) for the new file.\r
+\r
+    @return   Returns -1 on failure, otherwise the file descriptor for the open file.\r
   **/\r
-  int     creat     (const char *, mode_t);\r
+  int     creat     (const char *Path, mode_t Mode);\r
+\r
+  /** File control\r
 \r
-  /**\r
-    @param[in]\r
+      This function performs the operations described below and defined in <fcntl.h>.\r
 \r
-    @return\r
+        - F_DUPFD: Return the lowest numbered file descriptor available that is >= the third argument.\r
+                   The new file descriptor refers to the same open file as Fd.\r
+\r
+        - F_SETFD: Set the file descriptor flags to the value specified by the third argument.\r
+        - F_GETFD: Get the file descriptor flags associated with Fd.\r
+        - F_SETFL: Set the file status flags based upon the value of the third argument.\r
+        - F_GETFL: Get the file status flags and access modes for file Fd.\r
+\r
+    @param[in]  Fd      File descriptor associated with the file to be controlled.\r
+    @param[in]  Cmd     Command to execute.\r
+    @param[in]  ...     Additional arguments, as needed by Cmd.\r
+\r
+    @return   A -1 is returned to indicate failure, otherwise the value\r
+              returned is positive and depends upon Cmd as follows:\r
+                - F_DUPFD: A new file descriptor.\r
+                - F_SETFD: files previous file descriptor flags.\r
+                - F_GETFD: The files file descriptor flags.\r
+                - F_SETFL: The old status flags and access mode of the file.\r
+                - F_GETFL: The status flags and access mode of the file.\r
   **/\r
-  int     fcntl     (int, int, ...);\r
+  int     fcntl     (int Fd, int Cmd, ...);\r
 #endif  // __FCNTL_SYSCALLS_DECLARED\r
 \r
 /* These system calls are also declared in stat.h */\r
 #ifndef __STAT_SYSCALLS_DECLARED\r
   #define __STAT_SYSCALLS_DECLARED\r
 \r
-  /**\r
-    @param[in]\r
-\r
-    @return\r
-  **/\r
   int     mkdir     (const char *, mode_t);\r
-\r
-  /**\r
-    @param[in]\r
-\r
-    @return\r
-  **/\r
   int     fstat     (int, struct stat *);\r
-\r
-  /**\r
-    @param[in]\r
-\r
-    @return\r
-  **/\r
   int     lstat     (const char *, struct stat *);\r
-\r
-  /**\r
-    @param[in]\r
-\r
-    @return\r
-  **/\r
   int     stat      (const char *, struct stat *);\r
-\r
-  /**\r
-    @param[in]\r
-\r
-    @return\r
-  **/\r
   int     chmod     (const char *, mode_t);\r
+  mode_t  umask     (mode_t cmask);\r
+\r
 #endif  // __STAT_SYSCALLS_DECLARED\r
 \r
 // These are also declared in sys/types.h\r
 #ifndef __OFF_T_SYSCALLS_DECLARED\r
   #define __OFF_T_SYSCALLS_DECLARED\r
-\r
-  /**\r
-    @param[in]\r
-\r
-    @return\r
-  **/\r
   off_t   lseek     (int, off_t, int);\r
-\r
-  /**\r
-    @param[in]\r
-\r
-    @return\r
-  **/\r
   int     truncate  (const char *, off_t);\r
-\r
-  /**\r
-    @param[in]\r
-\r
-    @return\r
-  **/\r
   int     ftruncate (int, off_t);   //  IEEE Std 1003.1b-93\r
 #endif /* __OFF_T_SYSCALLS_DECLARED */\r
 \r
 /* EFI-specific Functions. */\r
 \r
-  /**\r
-    @param[in]\r
+  /** Mark an open file to be deleted when it is closed.\r
 \r
-    @return\r
+    @param[in]  fd    File descriptor for the open file.\r
+\r
+    @retval   0   The flag was set successfully.\r
+    @retval  -1   An invalid fd was specified.\r
   **/\r
-  int       DeleteOnClose(int fd);    /* Mark an open file to be deleted when closed. */\r
+  int       DeleteOnClose(int fd);\r
 \r
-/* Find and reserve a free File Descriptor.\r
+  /** Find and reserve a free File Descriptor.\r
 \r
   Returns the first free File Descriptor greater than or equal to the,\r
   already validated, fd specified by Minfd.\r
 \r
   @return   Returns -1 if there are no free FDs.  Otherwise returns the\r
             found fd.\r
-*/\r
+  */\r
   int       FindFreeFD  (int MinFd);\r
 \r
-/*  Validate that fd refers to a valid file descriptor.\r
+  /** Validate that fd refers to a valid file descriptor.\r
     IsOpen is interpreted as follows:\r
       - Positive  fd must be OPEN\r
       - Zero      fd must be CLOSED\r
@@ -354,27 +325,26 @@ __BEGIN_DECLS
 \r
     @retval TRUE  fd is VALID\r
     @retval FALSE fd is INVALID\r
-*/\r
+  */\r
   BOOLEAN   ValidateFD (int fd, int IsOpen);\r
 \r
 \r
-  /**\r
-    @param[in]\r
-\r
-    @return\r
-  **/\r
-  char     *getcwd    (char *, size_t);\r
-\r
-  /**\r
-    @param[in]\r
-\r
-    @return\r
-  **/\r
-  int       chdir     (const char *);\r
-\r
 /* These system calls don't YET have EFI implementations. */\r
-  int       access    (const char *path, int amode);\r
   int       reboot    (int, char *);\r
 __END_DECLS\r
 \r
+/*  The console output stream, stdout, supports cursor positioning via the\r
+    lseek() function call.  The following entities facilitate packing the\r
+    X and Y coordinates into the offset parameter of the lseek call.\r
+*/\r
+typedef struct {\r
+  UINT32    Column;\r
+  UINT32    Row;\r
+} CURSOR_XY;\r
+\r
+typedef union {\r
+  UINT64      Offset;\r
+  CURSOR_XY   XYpos;\r
+} XY_OFFSET;\r
+\r
 #endif  /* _EFI_SYS_CALL_H */\r