summary refs log tree commit diff stats
path: root/lib/posix/posix.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2015-02-25 22:58:03 +0100
committerAndreas Rumpf <rumpf_a@web.de>2015-02-25 22:58:03 +0100
commit0ff4ed0ff30764dd4792396cd7a9eedfd8d0eee9 (patch)
tree075f6baa13e6250d21e164ba5d25c98740992cbb /lib/posix/posix.nim
parentfce2ff161ea55bb73c076ab20d90730399a4059e (diff)
parent5e8eaa5f9755a6c8ed73ae0e49d399ac2dd3217c (diff)
downloadNim-0ff4ed0ff30764dd4792396cd7a9eedfd8d0eee9.tar.gz
Merge pull request #2208 from def-/walkdir
Speed up walkDir significantly
Diffstat (limited to 'lib/posix/posix.nim')
-rw-r--r--lib/posix/posix.nim14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/posix/posix.nim b/lib/posix/posix.nim
index 845496756..7d3e3ddba 100644
--- a/lib/posix/posix.nim
+++ b/lib/posix/posix.nim
@@ -70,6 +70,16 @@ const
   STDIN_FILENO* = 0  ## File number of stdin;
   STDOUT_FILENO* = 1 ## File number of stdout;
 
+  DT_UNKNOWN* = 0 ## Unknown file type.
+  DT_FIFO* = 1    ## Named pipe, or FIFO.
+  DT_CHR* = 2     ## Character device.
+  DT_DIR* = 4     ## Directory.
+  DT_BLK* = 6     ## Block device.
+  DT_REG* = 8     ## Regular file.
+  DT_LNK* = 10    ## Symbolic link.
+  DT_SOCK* = 12   ## UNIX domain socket.
+  DT_WHT* = 14
+
 type
   TDIR* {.importc: "DIR", header: "<dirent.h>",
           incompleteStruct.} = object
@@ -84,6 +94,10 @@ type
   Tdirent* {.importc: "struct dirent",
              header: "<dirent.h>", final, pure.} = object ## dirent_t struct
     d_ino*: Tino  ## File serial number.
+    d_off*: TOff  ## Not an offset. Value that ``telldir()`` would return.
+    d_reclen*: cshort ## Length of this record. (not POSIX)
+    d_type*: int8 ## Type of file; not supported by all filesystem types.
+                  ## (not POSIX)
     d_name*: array [0..255, char] ## Name of entry.
 
   Tflock* {.importc: "struct flock", final, pure,
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208