LLDB mainline
windows/PosixApi.h
Go to the documentation of this file.
1//===-- windows/PosixApi.h --------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef liblldb_Host_windows_PosixApi_h
10#define liblldb_Host_windows_PosixApi_h
11
12#include "lldb/Host/Config.h"
13#include "llvm/Support/Compiler.h"
14#if !defined(_WIN32)
15#error "windows/PosixApi.h being #included on non Windows system!"
16#endif
17
18// va_start, va_end, etc macros.
19#include <cstdarg>
20
21// time_t, timespec, etc.
22#include <ctime>
23
24#include <sys/types.h>
25
26#ifndef PATH_MAX
27#define PATH_MAX 32768
28#endif
29
30#define O_NOCTTY 0
31#define O_NONBLOCK 0
32#define SIGTRAP 5
33#define SIGKILL 9
34#define SIGSTOP 20
35
36#ifndef S_IRUSR
37#define S_IRUSR S_IREAD /* read, user */
38#define S_IWUSR S_IWRITE /* write, user */
39#define S_IXUSR 0 /* execute, user */
40#endif
41#ifndef S_IRGRP
42#define S_IRGRP 0 /* read, group */
43#define S_IWGRP 0 /* write, group */
44#define S_IXGRP 0 /* execute, group */
45#endif
46#ifndef S_IROTH
47#define S_IROTH 0 /* read, others */
48#define S_IWOTH 0 /* write, others */
49#define S_IXOTH 0 /* execute, others */
50#endif
51#ifndef S_IRWXU
52#define S_IRWXU 0
53#endif
54#ifndef S_IRWXG
55#define S_IRWXG 0
56#endif
57#ifndef S_IRWXO
58#define S_IRWXO 0
59#endif
60
61#ifdef _MSC_VER
62
63// PRIxxx format macros for printf()
64#include <cinttypes>
65
66// open(), close(), creat(), etc.
67#include <io.h>
68
69typedef unsigned short mode_t;
70
71// Match the `typedef int pid_t;` in Python's pyconfig.h on Windows. Using an
72// identical underlying type lets this header coexist with Python headers in
73// any include order.
74typedef int pid_t;
75
76#define STDIN_FILENO 0
77#define STDOUT_FILENO 1
78#define STDERR_FILENO 2
79
80#endif // _MSC_VER
81
82// empty functions
83inline int posix_openpt(int flag) { LLVM_BUILTIN_UNREACHABLE; }
84
85inline int unlockpt(int fd) { LLVM_BUILTIN_UNREACHABLE; }
86inline int grantpt(int fd) { LLVM_BUILTIN_UNREACHABLE; }
87inline char *ptsname(int fd) { LLVM_BUILTIN_UNREACHABLE; }
88
89inline pid_t fork(void) { LLVM_BUILTIN_UNREACHABLE; }
90inline pid_t setsid(void) { LLVM_BUILTIN_UNREACHABLE; }
91
92#endif
char * ptsname(int fd)
int grantpt(int fd)
pid_t setsid(void)
int posix_openpt(int flag)
pid_t fork(void)
int unlockpt(int fd)