]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/Include/sys/EfiSysCall.h
Standard Libraries for EDK II.
[mirror_edk2.git] / StdLib / Include / sys / EfiSysCall.h
CommitLineData
2aa62f2b 1/** @file\r
2 Function declarations for UEFI "system calls".\r
3\r
4 Concept derived from NetBSD's unistd.h file.\r
5\r
6 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
7 This program and the accompanying materials are licensed and made available under\r
8 the terms and conditions of the BSD License that accompanies this distribution.\r
9 The full text of the license may be found at\r
10 http://opensource.org/licenses/bsd-license.php.\r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16#ifndef _EFI_SYS_CALL_H\r
17#define _EFI_SYS_CALL_H\r
18\r
19#include <sys/EfiCdefs.h>\r
20#include <sys/types.h>\r
21\r
22struct stat; // Structure declared in <sys/stat.h>\r
23\r
24#define STDIN_FILENO 0 /* standard input file descriptor */\r
25#define STDOUT_FILENO 1 /* standard output file descriptor */\r
26#define STDERR_FILENO 2 /* standard error file descriptor */\r
27\r
28/* access function */\r
29#define F_OK 0 /* test for existence of file */\r
30#define X_OK 0x01 /* test for execute or search permission */\r
31#define W_OK 0x02 /* test for write permission */\r
32#define R_OK 0x04 /* test for read permission */\r
33\r
34/* whence values for lseek(2) */\r
35#define SEEK_SET 0 /* set file offset to offset */\r
36#define SEEK_CUR 1 /* set file offset to current plus offset */\r
37#define SEEK_END 2 /* set file offset to EOF plus offset */\r
38\r
39__BEGIN_DECLS\r
40\r
41/* EFI versions of BSD system calls used in stdio */\r
42extern int close (int fd);\r
43extern ssize_t read (int fd, void *buf, size_t n);\r
44extern ssize_t write (int fd, const void *buf, size_t n);\r
45extern int unlink (const char *name);\r
46extern int dup2 (int, int);\r
47extern int rmdir (const char *);\r
48extern int isatty (int);\r
49\r
50/* These system calls are also declared in sys/fcntl.h */\r
51#ifndef __FCNTL_SYSCALLS_DECLARED\r
52 #define __FCNTL_SYSCALLS_DECLARED\r
53 extern int open (const char *name, int oflags, int mode);\r
54 extern int creat (const char *, mode_t);\r
55 extern int fcntl (int, int, ...);\r
56#endif // __FCNTL_SYSCALLS_DECLARED\r
57\r
58/* These system calls are also declared in stat.h */\r
59#ifndef __STAT_SYSCALLS_DECLARED\r
60 #define __STAT_SYSCALLS_DECLARED\r
61 extern int mkdir (const char *, mode_t);\r
62 extern int fstat (int, struct stat *);\r
63 extern int lstat (const char *, struct stat *);\r
64 extern int stat (const char *, void *);\r
65// extern int chmod (const char *, mode_t);\r
66#endif // __STAT_SYSCALLS_DECLARED\r
67\r
68// These are also declared in sys/types.h\r
69#ifndef __OFF_T_SYSCALLS_DECLARED\r
70 #define __OFF_T_SYSCALLS_DECLARED\r
71 extern off_t lseek (int, off_t, int);\r
72 extern int truncate (const char *, off_t);\r
73 extern int ftruncate (int, off_t); // IEEE Std 1003.1b-93\r
74#endif /* __OFF_T_SYSCALLS_DECLARED */\r
75\r
76/* These system calls don't YET have EFI implementations. */\r
77extern int access (const char *path, int amode);\r
78extern int chdir (const char *);\r
79extern char *getcwd (char *, size_t);\r
80extern int reboot (int, char *);\r
81\r
82__END_DECLS\r
83\r
84#endif /* _EFI_SYS_CALL_H */\r