-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunixdos.h
109 lines (91 loc) · 3.43 KB
/
unixdos.h
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
/*
* @(#)unixdos.h 1.1 98/10/26 Connectathon Testsuite
*
* typedefs used in the DOSorWIN version only
*/
#if ! defined(_WINSOCKAPI_)
struct timeval
{
long tv_sec; /* seconds since midnight for DOS */
long tv_usec; /* and microseconds */
};
#endif
typedef unsigned char u_char;
#define MAXPATHLEN 256 /* tune later */
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
void gettimeofday(struct timeval *TV, struct timezone *TimeZone);
int unix_chdir(char * path);
int lstat(char *path, struct stat *buf);
/************************************************************
statfs stuff
************************************************************/
typedef struct {
long val[2];
} fsid_t;
struct statfs {
long f_type; /* type of info, zero for now */
long f_bsize; /* fundamental file system block size */
long f_blocks; /* total blocks in file system */
long f_bfree; /* free blocks */
long f_bavail; /* free blocks available to non-super-user */
long f_files; /* total file nodes in file system */
long f_ffree; /* free file nodes in fs */
fsid_t f_fsid; /* file system id */
long f_spare[7]; /* spare for later */
};
int statfs(char *path, struct statfs *buf);
/************************************************************
From /usr/include/directory.h, simplified:
************************************************************/
#ifndef __dirent_h
#define __dirent_h
/*
* Definitions for library routines operating on directories.
*/
typedef int DIR; /* just a dummy */
DIR *opendir(char *dirname);
struct dirent *readdir(DIR *dirp);
void rewinddir(DIR *dirp);
void closedir(DIR *dirp);
#ifndef _POSIX_SOURCE
void seekdir(DIR *dirp, long loc);
long telldir(DIR *dirp);
#endif /* POSIX_SOURCE */
#endif /* !__dirent_h */
/*************************************************************
From /usr/include/sys/dirent.h:
*************************************************************/
/*
* Filesystem-independent directory information.
* Directory entry structures are of variable length.
* Each directory entry is a struct dirent containing its file number, the
* offset of the next entry (a cookie interpretable only the filesystem
* type that generated it), the length of the entry, and the length of the
* name contained in the entry. These are followed by the name. The
* entire entry is padded with null bytes to a 4 byte boundary. All names
* are guaranteed null terminated. The maximum length of a name in a
* directory is MAXNAMLEN, plus a null byte.
*/
#ifndef __sys_dirent_h
#define __sys_dirent_h
struct dirent {
/* just need d_name field for Cthon tests */
char d_name[13]; /* name (up to MAXNAMLEN + 1) */
};
#ifndef _POSIX_SOURCE
/*
* It's unlikely to change, but make sure that sizeof d_name above is
* at least MAXNAMLEN + 1 (more may be added for padding).
*/
#define MAXNAMLEN 255
/*
* The macro DIRSIZ(dp) gives the minimum amount of space required to represent
* a directory entry. For any directory entry dp->d_reclen >= DIRSIZ(dp).
* Specific filesystem types may use this macro to construct the value
* for d_reclen.
*/
#undef DIRSIZ
#define DIRSIZ(dp) \
(((sizeof(struct dirent) - (MAXNAMLEN+1) + ((dp)->d_namlen+1)) +3) & ~3)
#endif /* !_POSIX_SOURCE */
#endif /* !__sys_dirent_h */