File: zlibc.h

package info (click to toggle)
zlibc 0.9k-4.3
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 624 kB
  • ctags: 461
  • sloc: sh: 3,195; ansic: 3,077; csh: 128; makefile: 60; sed: 4
file content (288 lines) | stat: -rw-r--r-- 5,901 bytes parent folder | download | duplicates (3)
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
/*
 * zlibc.h
 *
 * Copyright (C) 1993 Alain Knaff
 */

#ifndef ZLIBC_H
#define ZLIBC_H

#define FA_ALL	    0

#define FA_DIR      1
#define FA_SUBDIR   2
/* FA_DIR and FA_SUBDIR should be specified with their trailing slash */

#define FA_BASENAME 3
#define FA_SUFFIX   4
#define FA_FILENAME 5
#define FA_ALL2     6
#define FA_FS	    7

#define PM_NONE    0

#define PM_USE_TMP_FILE 1
#define PM_HIDE_PIPE	2
#define PM_SHOW_PIPE	3
#define PM_DIR_LEAVE_COMPR	4
#define PM_LEAVE_COMPR 	5
#define PM_READ_MASK    7

#define PM_CREATE_COMPR 0x8
#define PM_NOCREATE_COMPR 0x10
#define PM_CREATE_MASK 0x18

#define PM_APPEND_COMPR 0x20
#define PM_NOAPPEND_COMPR 0x40
#define PM_APPEND_MASK 0x60

#define PM_UNCOMPR_BEFORE_WRITE 0x80
#define PM_NO_UNCOMPR_BEFORE_WRITE 0x100
#define PM_UNCOMPR_MASK 0x180

#define PM_SIZE_COMPR 0x200
#define PM_SIZE_UNCOMPR 0x400
#define PM_SIZE_COMPR_MASK 0x600

typedef struct FilenameActions {
    /* initialized elements.
       MUST be in this order in order to support compiled-in defaults */
    int fa_type;
    char *name;
    int namelength;
    int pipe_mode;

    /* elements that are computed at runtime */
    dev_t dev;
    ino_t ino;
    int is_initialized;
} FilenameActions;

int _zlibc_init(void);

/* the file actions have been read */
#define CM_HAVE_FA 0x1

/* disable package altogether */
#define CM_DISAB 0x2

/* readdir lists compressed files */
#define CM_READDIR_COMPR 0x4

/* print comments for each intercepted syscall */
#define CM_VERBOSE 0x8

/* unlinks compressed files when user programs asks to unlink 
 * uncompressed file */
#define CM_UNLINK 0x10

/* doesn't read run time configuration file */
#define CM_NORTCONF 0x20

/* doesn't read run time configuration file */
#define CM_DISAB_CHILD 0x40

/* all available file-settable modes or'ed together, except NORTCONF */
#define CM_ALL_MODES 0x5f

/* none of these flags */
#define CM_NONE 0

typedef struct CommandActions {
  char *name;
  int cm_type;  
  FilenameActions *actions;
} CommandActions;


extern CommandActions zlib_commandActions[];

#define FREC(a,b,c) { a, b, sizeof(b) - 1, c }

#if 0

#ifdef HAVE___ACCESS
#define access __access
#endif

#ifdef HAVE___CHMOD
#define chmod __chmod
#endif

#ifdef HAVE___CHOWN
#define chown __chown
#endif

#ifdef HAVE___LSTAT
#define lstat __lstat
#endif

#ifdef HAVE___STAT
#define lstat __stat
#endif

#if 0
#ifdef HAVE___OPEN
#define open __open
#endif

#ifdef HAVE___READLINK
#define readlink __readlink
#endif

#ifdef HAVE___UNLINK
#define unlink __unlink
#endif

#ifdef HAVE___LINK
#define link __link
#endif

#ifdef HAVE___SYMLINK
#define symlink __symlink
#endif
#endif

#endif

#ifndef __STDC__
#define signed /**/
int fprintf();
int printf();
int _flsbuf();
int syscall();
int wait4();
int fclose();
int perror();
int getdents();
#endif


void zlib_initialise(void);
int zlib_getfiletype(__const char *name, int fd);
void zlib_getuserconf(char *progname, 
		      FilenameActions **filenameActions, 
		      int *mode, int *modemask);

extern char *zlib_ext;
extern int zlib_extlen;
extern int zlib_mode;
extern char *zlib_tmp;
extern char **zlib_uncompressor;




#ifdef CONFIG_COMPILER
extern char *err_strings[];
extern int generation;

/* configuration file compiler */
typedef struct commands_line {
  char *name;
  int mode, modemask;
  struct commands_line *globalnext, *localnext;
  int generation;
  char class[16];
  int defined;
} commands_line;

int add_prog(commands_line **cmd, char *name);
int add_default(commands_line **cmd);

void print_class(FilenameActions *fa, char *name, int line);
int parse_file(char *progname, 
	       FILE *f,
	       int *line,
	       int *mode,
	       int *modemask,
	       char *classname);
#endif

/**
 * Stat calling stubs.  These stubs are used to allow zlibc to call the
 * libc's original stat functions
 */
#ifdef HAVE___XSTAT
# include <sys/stat.h>
# include "direct_sys.h"

/* 32 bit versions */
# define STAT(x) x ## stat
# define STATTYPE struct stat
# define USE_XSTAT 1
# include "stat_tmpl.h"
# undef USE_XSTAT
# undef STATTYPE
# undef STAT

#else
# include "direct_sys.h"
# define ___zlibc_stat(ver,name,buf) (zlib_real_stat((name), (buf)))
# define ___zlibc_lstat(ver,name,buf) (zlib_real_lstat((name), (buf)))
#endif


/* 64 bit versions */
#ifdef HAVE_STAT64
# define STATTYPE struct stat64
# define STAT(x) x ## stat64
# ifdef HAVE___XSTAT64
#  define USE_XSTAT 1
# endif
# include "stat_tmpl.h"
# undef USE_XSTAT
# undef STAT
# undef STATTYPE
#endif


#ifndef DEFUN
#define AND ,
#define DEFUN(name, arglist, args) name(args)
#endif


#ifndef function_alias
#if defined(linux) || defined(__GLIBC__)
#define	function_alias(alias, name, type, args, defun) \
__asm__(".globl " #alias "; " #alias " = " #name);
#else
#define	function_alias(alias, name, type, args, defun) \
type defun { return name args; }
#endif
#endif

#if (defined __ELF__ && defined elf_alias)
#undef function_alias
#define function_alias(alias, name, type, vars, defun) elf_alias(name, alias)
#endif

#define ALIAS1(name, alias, rtype, type1) \
  function_alias(name, alias, rtype, \
		 (var1), \
		 DEFUN(alias, (var1), \
		       type1 var1))

#define ALIAS2(name, alias, rtype, type1, type2) \
  function_alias(alias, name, rtype, \
		 (var1, var2), \
		 DEFUN(alias, (var1, var2), \
		       type1 var1 AND type2 var2))

#define ALIAS3(name, alias, rtype, type1, type2, type3) \
  function_alias(alias, name, rtype, \
		 (var1, var2, var3), \
		 DEFUN(alias, (var1, var2, var3), \
		       type1 var1 AND type2 var2 AND type3 var3))

#define ALIASF0(name, alias) ALIAS1(name, alias, int, CONST char *)
#define ALIASF1(name, alias, type2) \
  ALIAS2(name, alias, int, CONST char *, type2)
#define ALIASF2(name, alias, type2, type3) \
  ALIAS3(name, alias, int, CONST char *, type2, type3)

#define ALIAS2F(name, alias) \
  ALIAS2(name, alias, int, CONST char *, CONST char *)

#endif