MiniOB 1
MiniOB is one mini database, helping developers to learn how database works.
载入中...
搜索中...
未找到
defs.h
1/* Copyright (c) 2021 OceanBase and/or its affiliates. All rights reserved.
2miniob is licensed under Mulan PSL v2.
3You can use this software according to the terms and conditions of the Mulan PSL v2.
4You may obtain a copy of Mulan PSL v2 at:
5 http://license.coscl.org.cn/MulanPSL2
6THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
7EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
8MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
9See the Mulan PSL v2 for more details. */
10
11//
12// Created by Longda on 2010
13//
14
15#pragma once
16
17#include <errno.h>
18#include <fstream>
19#include <iostream>
20#include <memory>
21#include <string>
22#include <sys/syscall.h>
23#include <sys/types.h>
24#include <unistd.h>
25
26namespace common {
27
28#ifndef gettid
29#if defined(__MACH__)
30#define gettid() ((long long)pthread_self())
31#elif defined(LINUX)
32#define gettid() ((long long)pthread_self())
33#endif
34
35#endif
36
37enum
38{
39 // General Error Codes
40 STATUS_SUCCESS = 0,
41 STATUS_INVALID_PARAM,
42 STATUS_FAILED_INIT,
43 STATUS_PROPERTY_ERR,
44 STATUS_INIT_LOG,
45 STATUS_INIT_THREAD,
46 STATUS_FAILED_JOB,
47 STATUS_FAILED_NETWORK,
48
49 STATUS_UNKNOW_ERROR,
50 STATUS_LAST_ERR
51};
52
53static const char FILE_PATH_SPLIT = '/';
54static const char FILE_PATH_SPLIT_STR[] = "/";
55
56#define EPSILON (1E-6)
57
58} // namespace common