OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uC-libc/] [sysdeps/] [readdir.i] - Blame information for rev 1775

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
# 1 "readdir.c"
2
# 1 "../include/dirent.h" 1
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
# 1 "../include/features.h" 1
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
# 1 "../include/sys/cdefs.h" 1
64
 
65
 
66
 
67
# 1 "../include/features.h" 1
68
 
69
# 38 "../include/features.h"
70
 
71
 
72
# 4 "../include/sys/cdefs.h" 2
73
 
74
 
75
 
76
 
77
 
78
 
79
 
80
 
81
 
82
typedef long double __long_double_t;
83
 
84
# 26 "../include/sys/cdefs.h"
85
 
86
 
87
 
88
 
89
 
90
 
91
 
92
 
93
 
94
 
95
 
96
# 35 "../include/features.h" 2
97
 
98
 
99
 
100
 
101
 
102
# 26 "../include/dirent.h" 2
103
 
104
 
105
 
106
 
107
# 1 "../include/gnu/types.h" 1
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
typedef unsigned char __u_char;
133
typedef unsigned short __u_short;
134
typedef unsigned int __u_int;
135
typedef unsigned long __u_long;
136
typedef struct
137
{
138
  long val[2];
139
} __quad;
140
typedef struct
141
{
142
  __u_long val[2];
143
} __u_quad;
144
 
145
 
146
typedef unsigned short __dev_t;
147
typedef unsigned short __gid_t;
148
typedef unsigned short __uid_t;
149
typedef unsigned short __mode_t;
150
typedef long    __daddr_t;
151
typedef long    __off_t;
152
 
153
typedef long long __loff_t;
154
 
155
typedef unsigned long __ino_t;
156
typedef unsigned short __nlink_t;
157
typedef long    __time_t;
158
# 61 "../include/gnu/types.h"
159
 
160
 
161
typedef int __pid_t;
162
typedef int __ssize_t;
163
typedef __quad __fsid_t;
164
 
165
 
166
typedef char *__caddr_t;
167
typedef long int __swblk_t;
168
 
169
 
170
 
171
 
172
 
173
 
174
 
175
 
176
# 1 "../include/linux/posix_types.h" 1
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
 
209
 
210
 
211
 
212
 
213
 
214
 
215
 
216
 
217
 
218
 
219
 
220
 
221
 
222
 
223
 
224
 
225
typedef struct {
226
        unsigned long fds_bits [(1024 / (8 * sizeof(unsigned long)) ) ];
227
} __kernel_fd_set;
228
 
229
# 1 "../include/asm/posix_types.h" 1
230
 
231
 
232
 
233
 
234
 
235
 
236
 
237
 
238
 
239
typedef unsigned short  __kernel_dev_t;
240
typedef unsigned long   __kernel_ino_t;
241
typedef unsigned short  __kernel_mode_t;
242
typedef unsigned short  __kernel_nlink_t;
243
typedef long            __kernel_off_t;
244
typedef int             __kernel_pid_t;
245
typedef unsigned short  __kernel_uid_t;
246
typedef unsigned short  __kernel_gid_t;
247
typedef unsigned long   __kernel_size_t;
248
typedef int             __kernel_ssize_t;
249
typedef int             __kernel_ptrdiff_t;
250
typedef long            __kernel_time_t;
251
typedef long            __kernel_clock_t;
252
typedef int             __kernel_daddr_t;
253
typedef char *          __kernel_caddr_t;
254
 
255
 
256
 
257
 
258
 
259
 
260
typedef long       __kernel_loff_t;
261
 
262
typedef struct {
263
 
264
 
265
 
266
        int     __val[2];
267
 
268
} __kernel_fsid_t;
269
 
270
 
271
 
272
 
273
 
274
 
275
 
276
 
277
 
278
 
279
 
280
 
281
 
282
 
283
# 53 "../include/linux/posix_types.h" 2
284
 
285
 
286
 
287
# 78 "../include/gnu/types.h" 2
288
 
289
 
290
 
291
 
292
 
293
 
294
typedef struct __fd_set {
295
        unsigned long fds_bits [(1024 / (8 * sizeof(unsigned long)) ) ];
296
} __fd_set;
297
 
298
# 128 "../include/gnu/types.h"
299
 
300
 
301
# 152 "../include/gnu/types.h"
302
 
303
 
304
 
305
# 30 "../include/dirent.h" 2
306
 
307
 
308
 
309
# 1 "../include/stddef.h" 1
310
 
311
 
312
 
313
 
314
 
315
 
316
 
317
 
318
 
319
 
320
 
321
 
322
 
323
 
324
 
325
 
326
 
327
 
328
 
329
typedef unsigned long size_t;
330
 
331
 
332
 
333
 
334
 
335
 
336
 
337
 
338
# 33 "../include/dirent.h" 2
339
 
340
 
341
# 1 "../include/sys/types.h" 1
342
# 1 "../include/stddef.h" 1
343
 
344
 
345
 
346
 
347
 
348
 
349
 
350
 
351
 
352
 
353
 
354
 
355
 
356
 
357
# 27 "../include/stddef.h"
358
 
359
 
360
# 1 "../include/sys/types.h" 2
361
 
362
# 1 "../include/sys/bitypes.h" 1
363
 
364
 
365
 
366
 
367
 
368
 
369
 
370
 
371
 
372
 
373
 
374
 
375
 
376
 
377
 
378
 
379
 
380
 
381
 
382
 
383
 
384
 
385
 
386
 
387
 
388
 
389
 
390
 
391
 
392
 
393
 
394
 
395
 
396
 
397
 
398
 
399
 
400
 
401
 
402
 
403
 
404
 
405
 
406
 
407
 
408
 
409
 
410
 
411
 
412
 
413
 
414
 
415
 
416
 
417
 
418
 
419
 
420
 
421
 
422
 
423
 
424
 
425
 
426
 
427
 
428
 
429
 
430
 
431
 
432
 
433
 
434
 
435
 
436
 
437
 
438
 
439
 
440
 
441
 
442
        typedef   char            int8_t;
443
        typedef unsigned char            u_int8_t;
444
        typedef short                     int16_t;
445
        typedef unsigned short          u_int16_t;
446
        typedef int                       int32_t;
447
        typedef unsigned int            u_int32_t;
448
 
449
 
450
        typedef long long                 int64_t;
451
        typedef unsigned long long      u_int64_t;
452
 
453
 
454
 
455
 
456
 
457
# 2 "../include/sys/types.h" 2
458
 
459
# 1 "../include/linux/types.h" 1
460
 
461
 
462
 
463
# 14 "../include/linux/types.h"
464
 
465
 
466
 
467
# 1 "../include/asm/types.h" 1
468
 
469
 
470
 
471
 
472
 
473
 
474
 
475
 
476
 
477
 
478
 
479
typedef unsigned short umode_t;
480
 
481
 
482
 
483
 
484
 
485
 
486
typedef __signed__ char __s8;
487
typedef unsigned char __u8;
488
 
489
typedef __signed__ short __s16;
490
typedef unsigned short __u16;
491
 
492
typedef __signed__ int __s32;
493
typedef unsigned int __u32;
494
 
495
 
496
typedef __signed__ long long __s64;
497
typedef unsigned long long __u64;
498
 
499
 
500
 
501
 
502
 
503
# 50 "../include/asm/types.h"
504
 
505
 
506
 
507
# 17 "../include/linux/types.h" 2
508
 
509
 
510
 
511
 
512
typedef __kernel_fd_set         fd_set;
513
typedef __kernel_dev_t          dev_t;
514
typedef __kernel_ino_t          ino_t;
515
typedef __kernel_mode_t         mode_t;
516
typedef __kernel_nlink_t        nlink_t;
517
typedef __kernel_off_t          off_t;
518
typedef __kernel_pid_t          pid_t;
519
typedef __kernel_uid_t          uid_t;
520
typedef __kernel_gid_t          gid_t;
521
typedef __kernel_daddr_t        daddr_t;
522
 
523
 
524
typedef __kernel_loff_t         loff_t;
525
 
526
 
527
 
528
 
529
 
530
 
531
 
532
 
533
 
534
 
535
 
536
 
537
 
538
typedef __kernel_ssize_t        ssize_t;
539
 
540
 
541
 
542
 
543
typedef __kernel_ptrdiff_t      ptrdiff_t;
544
 
545
 
546
 
547
 
548
typedef __kernel_time_t         time_t;
549
 
550
 
551
 
552
 
553
typedef __kernel_clock_t        clock_t;
554
 
555
 
556
 
557
 
558
typedef __kernel_caddr_t        caddr_t;
559
 
560
 
561
 
562
typedef unsigned char           u_char;
563
typedef unsigned short          u_short;
564
typedef unsigned int            u_int;
565
typedef unsigned long           u_long;
566
 
567
 
568
typedef unsigned char           unchar;
569
typedef unsigned short          ushort;
570
typedef unsigned int            uint;
571
typedef unsigned long           ulong;
572
 
573
 
574
 
575
 
576
 
577
 
578
 
579
 
580
struct ustat {
581
        __kernel_daddr_t        f_tfree;
582
        __kernel_ino_t          f_tinode;
583
        char                    f_fname[6];
584
        char                    f_fpack[6];
585
};
586
 
587
 
588
# 3 "../include/sys/types.h" 2
589
 
590
# 35 "../include/dirent.h" 2
591
 
592
# 1 "../include/linux/limits.h" 1
593
 
594
 
595
 
596
# 1 "../include/linux/config.h" 1
597
 
598
 
599
 
600
# 1 "../include/linux/autoconf.h" 1
601
 
602
 
603
 
604
 
605
 
606
 
607
 
608
 
609
 
610
 
611
 
612
 
613
 
614
 
615
 
616
 
617
 
618
 
619
 
620
 
621
 
622
 
623
 
624
 
625
 
626
 
627
 
628
 
629
 
630
 
631
 
632
 
633
 
634
 
635
 
636
 
637
 
638
 
639
 
640
 
641
 
642
 
643
 
644
 
645
 
646
 
647
 
648
 
649
 
650
 
651
 
652
 
653
 
654
 
655
 
656
 
657
 
658
 
659
 
660
 
661
 
662
 
663
 
664
 
665
 
666
 
667
 
668
 
669
 
670
 
671
 
672
 
673
 
674
 
675
 
676
 
677
 
678
 
679
 
680
 
681
 
682
# 4 "../include/linux/config.h" 2
683
 
684
 
685
 
686
 
687
 
688
 
689
 
690
 
691
 
692
 
693
 
694
 
695
 
696
 
697
 
698
 
699
 
700
 
701
 
702
 
703
 
704
 
705
 
706
 
707
 
708
 
709
 
710
 
711
 
712
 
713
 
714
 
715
 
716
 
717
 
718
 
719
 
720
 
721
 
722
 
723
# 4 "../include/linux/limits.h" 2
724
 
725
 
726
 
727
 
728
 
729
 
730
 
731
 
732
 
733
 
734
 
735
 
736
 
737
 
738
 
739
 
740
 
741
 
742
 
743
 
744
 
745
 
746
 
747
 
748
 
749
 
750
 
751
# 36 "../include/dirent.h" 2
752
 
753
# 1 "../include/linux/dirent.h" 1
754
 
755
 
756
 
757
struct dirent {
758
        long            d_ino;
759
        __kernel_off_t  d_off;
760
        unsigned short  d_reclen;
761
        char            d_name[256];
762
};
763
 
764
 
765
# 37 "../include/dirent.h" 2
766
 
767
 
768
 
769
 
770
 
771
 
772
 
773
 
774
 
775
# 65 "../include/dirent.h"
776
 
777
 
778
 
779
typedef struct DIR DIR;
780
 
781
 
782
 
783
 
784
 
785
 
786
extern DIR *opendir  (const  char *__name)  ;
787
 
788
 
789
 
790
extern int closedir  (DIR * __dirp)  ;
791
 
792
 
793
 
794
 
795
 
796
extern struct dirent *readdir  (DIR * __dirp)  ;
797
 
798
 
799
extern void rewinddir  (DIR * __dirp)  ;
800
 
801
# 146 "../include/dirent.h"
802
 
803
 
804
 
805
extern int readdir_r  (DIR *__dirp, struct dirent *__entry,
806
                struct dirent **__result)  ;
807
 
808
 
809
 
810
 
811
 
812
# 1 "readdir.c" 2
813
 
814
# 1 "../include/errno.h" 1
815
 
816
 
817
 
818
 
819
# 1 "../include/linux/errno.h" 1
820
 
821
 
822
 
823
# 1 "../include/asm/errno.h" 1
824
 
825
 
826
 
827
 
828
 
829
 
830
 
831
 
832
 
833
 
834
 
835
 
836
 
837
 
838
 
839
 
840
 
841
 
842
 
843
 
844
 
845
 
846
 
847
 
848
 
849
 
850
 
851
 
852
 
853
 
854
 
855
 
856
 
857
 
858
 
859
 
860
 
861
 
862
 
863
 
864
 
865
 
866
 
867
 
868
 
869
 
870
 
871
 
872
 
873
 
874
 
875
 
876
 
877
 
878
 
879
 
880
 
881
 
882
 
883
 
884
 
885
 
886
 
887
 
888
 
889
 
890
 
891
 
892
 
893
 
894
 
895
 
896
 
897
 
898
 
899
 
900
 
901
 
902
 
903
 
904
 
905
 
906
 
907
 
908
 
909
 
910
 
911
 
912
 
913
 
914
 
915
 
916
 
917
 
918
 
919
 
920
 
921
 
922
 
923
 
924
 
925
 
926
 
927
 
928
 
929
 
930
 
931
 
932
 
933
 
934
 
935
 
936
 
937
 
938
 
939
 
940
 
941
 
942
 
943
 
944
 
945
 
946
 
947
 
948
 
949
 
950
 
951
 
952
 
953
 
954
 
955
 
956
 
957
 
958
# 4 "../include/linux/errno.h" 2
959
 
960
 
961
# 14 "../include/linux/errno.h"
962
 
963
 
964
 
965
# 5 "../include/errno.h" 2
966
 
967
 
968
 
969
 
970
 
971
 
972
 
973
 
974
 
975
 
976
 
977
extern int      errno;
978
 
979
 
980
 
981
extern void     perror  (const  char* __s)  ;
982
extern char*    strerror  (int __errno)  ;
983
 
984
 
985
 
986
 
987
# 2 "readdir.c" 2
988
 
989
# 1 "../include/sys/syscall.h" 1
990
 
991
 
992
 
993
 
994
 
995
 
996
 
997
 
998
 
999
 
1000
 
1001
 
1002
 
1003
 
1004
 
1005
 
1006
 
1007
 
1008
 
1009
 
1010
 
1011
 
1012
 
1013
 
1014
 
1015
 
1016
 
1017
 
1018
 
1019
 
1020
 
1021
 
1022
 
1023
 
1024
 
1025
 
1026
 
1027
 
1028
 
1029
 
1030
 
1031
 
1032
 
1033
 
1034
 
1035
 
1036
 
1037
 
1038
 
1039
 
1040
 
1041
 
1042
 
1043
 
1044
 
1045
 
1046
 
1047
 
1048
 
1049
 
1050
 
1051
 
1052
 
1053
 
1054
 
1055
 
1056
 
1057
 
1058
 
1059
 
1060
 
1061
 
1062
 
1063
 
1064
 
1065
 
1066
 
1067
 
1068
 
1069
 
1070
 
1071
 
1072
 
1073
 
1074
 
1075
 
1076
 
1077
 
1078
 
1079
 
1080
 
1081
 
1082
 
1083
 
1084
 
1085
 
1086
 
1087
 
1088
 
1089
 
1090
 
1091
 
1092
 
1093
 
1094
 
1095
 
1096
 
1097
 
1098
 
1099
 
1100
 
1101
 
1102
 
1103
 
1104
 
1105
 
1106
 
1107
 
1108
 
1109
 
1110
 
1111
 
1112
 
1113
 
1114
 
1115
 
1116
 
1117
 
1118
 
1119
 
1120
 
1121
 
1122
 
1123
 
1124
 
1125
 
1126
 
1127
 
1128
 
1129
 
1130
 
1131
 
1132
 
1133
 
1134
 
1135
 
1136
 
1137
 
1138
 
1139
 
1140
 
1141
 
1142
 
1143
 
1144
 
1145
 
1146
 
1147
 
1148
 
1149
 
1150
 
1151
 
1152
 
1153
 
1154
 
1155
 
1156
 
1157
 
1158
 
1159
 
1160
 
1161
 
1162
 
1163
 
1164
 
1165
 
1166
 
1167
 
1168
 
1169
 
1170
 
1171
 
1172
# 3 "readdir.c" 2
1173
 
1174
 
1175
# 1 "dirstream.h" 1
1176
 
1177
 
1178
 
1179
 
1180
 
1181
 
1182
 
1183
 
1184
 
1185
 
1186
 
1187
 
1188
 
1189
 
1190
 
1191
 
1192
 
1193
 
1194
 
1195
 
1196
 
1197
 
1198
 
1199
 
1200
 
1201
 
1202
 
1203
 
1204
 
1205
 
1206
 
1207
 
1208
 
1209
 
1210
 
1211
 
1212
 
1213
 
1214
 
1215
 
1216
 
1217
 
1218
 
1219
 
1220
struct DIR {
1221
 
1222
  int dd_fd;
1223
 
1224
 
1225
  off_t dd_nextloc;
1226
 
1227
 
1228
  size_t dd_size;
1229
 
1230
 
1231
  struct dirent *dd_buf;
1232
 
1233
 
1234
  off_t dd_nextoff;
1235
 
1236
 
1237
  size_t dd_max;
1238
 
1239
  enum {unknown, have_getdents, no_getdents} dd_getdents;
1240
 
1241
 
1242
 
1243
 
1244
 
1245
  void *dd_lock;
1246
 
1247
};
1248
 
1249
 
1250
# 5 "readdir.c" 2
1251
 
1252
 
1253
static inline
1254
_syscall3(int, getdents, int, __fildes, struct dirent *, __buf, size_t, __nbyte);
1255
 
1256
struct dirent *
1257
readdir (DIR *dir)
1258
{
1259
  int result;
1260
  struct dirent *de;
1261
 
1262
  if (!dir)
1263
    {
1264
      errno = 9 ;
1265
      return ((void *) 0) ;
1266
    }
1267
 
1268
  if (dir->dd_size <= dir->dd_nextloc)
1269
    {
1270
 
1271
      result = getdents(dir->dd_fd, dir->dd_buf, dir->dd_max);
1272
 
1273
 
1274
 
1275
 
1276
 
1277
 
1278
 
1279
 
1280
 
1281
 
1282
 
1283
 
1284
      dir->dd_getdents = have_getdents;
1285
      if (result <= 0)
1286
        {
1287
          errno = -result;
1288
          return ((void *) 0) ;
1289
        }
1290
 
1291
      dir->dd_size = result;
1292
      dir->dd_nextloc = 0;
1293
    }
1294
 
1295
  de = (struct dirent *) ((char *) dir->dd_buf + dir->dd_nextloc);
1296
 
1297
 
1298
  dir->dd_nextloc += de->d_reclen;
1299
 
1300
 
1301
  dir->dd_nextoff = de->d_off;
1302
 
1303
  return de;
1304
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.