aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/os_defs.h
blob: 923a362b41381d5405b24fd32dd5961eea5ef9b7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef NVIM_OS_OS_DEFS_H
#define NVIM_OS_OS_DEFS_H

#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>

#ifdef WIN32
# include "nvim/os/win_defs.h"
#else
# include "nvim/os/unix_defs.h"
#endif

/// File descriptor number used for standard IO streams
enum {
  OS_STDIN_FILENO = STDIN_FILENO,
  OS_STDOUT_FILENO = STDOUT_FILENO,
  OS_STDERR_FILENO = STDERR_FILENO,
};

#define BASENAMELEN (NAME_MAX - 5)

// Use the system path length if it makes sense.
#if defined(PATH_MAX) && (PATH_MAX > 1024)
# define MAXPATHL PATH_MAX
#else
# define MAXPATHL 1024
#endif

// Command-processing buffer. Use large buffers for all platforms.
#define CMDBUFFSIZE 1024

// Use up to 5 Mbyte for a buffer.
#ifndef DFLT_MAXMEM
# define DFLT_MAXMEM (5 * 1024)
#endif
// use up to 10 Mbyte for Vim.
#ifndef DFLT_MAXMEMTOT
# define DFLT_MAXMEMTOT (10 * 1024)
#endif

// Note: Some systems need both string.h and strings.h (Savage).  However,
// some systems can't handle both, only use string.h in that case.
#include <string.h>
#if defined(HAVE_STRINGS_H) && !defined(NO_STRINGS_WITH_STRING_H)
# include <strings.h>
#endif

/// Function to convert libuv error to char * error description
///
/// negative libuv error codes are returned by a number of os functions.
#define os_strerror uv_strerror

#ifdef WIN32
# define os_strtok strtok_s
#else
# define os_strtok strtok_r
#endif

#endif  // NVIM_OS_OS_DEFS_H