rpm  4.5
system.h
Go to the documentation of this file.
1 
5 #ifndef H_SYSTEM
6 #define H_SYSTEM
7 
8 #ifdef HAVE_CONFIG_H
9 #include "config.h"
10 #endif
11 
12 #include <sys/types.h>
13 
14 #if defined(__LCLINT__)
15 /*@-redef@*/
16 typedef unsigned int u_int32_t;
17 typedef unsigned short u_int16_t;
18 typedef unsigned char u_int8_t;
19 /*@-incondefs@*/ /* LCLint 3.0.0.15 */
20 typedef int int32_t;
21 /*@=incondefs@*/
22 /* XXX from /usr/include/bits/sigset.h */
23 /*@-sizeoftype@*/
24 # define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int)))
25 typedef struct
26  {
27  unsigned long int __val[_SIGSET_NWORDS];
28  } __sigset_t;
29 /*@=sizeoftype@*/
30 /*@=redef@*/
31 #endif
32 
33 #include <sys/stat.h>
34 #include <stdio.h>
35 
36 #ifdef HAVE_SYS_PARAM_H
37 #include <sys/param.h>
38 #endif
39 
40 /* <unistd.h> should be included before any preprocessor test
41  of _POSIX_VERSION. */
42 #ifdef HAVE_UNISTD_H
43 #include <unistd.h>
44 #if defined(__LCLINT__)
45 /*@-superuser -declundef -incondefs @*/ /* LCL: modifies clause missing */
46 extern int chroot (const char *__path)
47  /*@globals errno, systemState @*/
48  /*@modifies errno, systemState @*/;
49 /*@=superuser =declundef =incondefs @*/
50 #endif
51 #if !defined(__GLIBC__) && !defined(__LCLINT__)
52 #ifdef __APPLE__
53 #include <crt_externs.h>
54 #define environ (*_NSGetEnviron())
55 #else
56 extern char ** environ;
57 #endif /* __APPLE__ */
58 #endif
59 #endif
60 
61 #if TIME_WITH_SYS_TIME
62 # include <sys/time.h>
63 # include <time.h>
64 #else
65 # if HAVE_SYS_TIME_H
66 # include <sys/time.h>
67 # else
68 # include <time.h>
69 # endif
70 #endif
71 
72 #if NEED_TIMEZONE
73 extern time_t timezone;
74 #endif
75 
76 /* Since major is a function on SVR4, we can't use `ifndef major'. */
77 #if MAJOR_IN_MKDEV
78 #include <sys/mkdev.h>
79 #define HAVE_MAJOR
80 #endif
81 #if MAJOR_IN_SYSMACROS
82 #include <sys/sysmacros.h>
83 #define HAVE_MAJOR
84 #endif
85 #ifdef major /* Might be defined in sys/types.h. */
86 #define HAVE_MAJOR
87 #endif
88 
89 #ifndef HAVE_MAJOR
90 #define major(dev) (((dev) >> 8) & 0xff)
91 #define minor(dev) ((dev) & 0xff)
92 #define makedev(maj, min) (((maj) << 8) | (min))
93 #endif
94 #undef HAVE_MAJOR
95 
96 #ifdef HAVE_UTIME_H
97 #include <utime.h>
98 #endif
99 
100 #ifdef HAVE_STRING_H
101 # if !STDC_HEADERS && HAVE_MEMORY_H
102 # include <memory.h>
103 # endif
104 # include <string.h>
105 #else
106 # include <strings.h>
107 char *memchr ();
108 #endif
109 
110 #if !defined(HAVE_STPCPY)
111 char * stpcpy(/*@out@*/ char * dest, const char * src);
112 #endif
113 
114 #if !defined(HAVE_STPNCPY)
115 char * stpncpy(/*@out@*/ char * dest, const char * src, size_t n);
116 #endif
117 
118 #include <errno.h>
119 #ifndef errno
120 /*@-declundef @*/
121 extern int errno;
122 /*@=declundef @*/
123 #endif
124 
125 #if defined(__LCLINT__)
126 /*@-declundef @*/
127 /*@exits@*/
128 extern void error(int status, int errnum, const char *format, ...)
129  __attribute__ ((__format__ (__printf__, 3, 4)))
130  /*@globals fileSystem @*/
131  /*@modifies fileSystem @*/;
132 /*@=declundef @*/
133 #else
134 #if HAVE_ERROR && HAVE_ERROR_H
135 #include <error.h>
136 #endif
137 #endif
138 
139 #if HAVE___SECURE_GETENV && !defined(__LCLINT__)
140 #define getenv(_s) __secure_getenv(_s)
141 #endif
142 
143 #ifdef STDC_HEADERS
144 /*@-macrounrecog -incondefs -globuse -mustmod @*/ /* FIX: shrug */
145 #define getopt system_getopt
146 /*@=macrounrecog =incondefs =globuse =mustmod @*/
147 /*@-skipansiheaders@*/
148 #include <stdlib.h>
149 /*@=skipansiheaders@*/
150 #undef getopt
151 #if defined(__LCLINT__)
152 /*@-declundef -incondefs @*/ /* LCL: modifies clause missing */
153 extern char * realpath (const char * file_name, /*@out@*/ char * resolved_name)
154  /*@globals errno, fileSystem @*/
155  /*@requires maxSet(resolved_name) >= (PATH_MAX - 1); @*/
156  /*@modifies *resolved_name, errno, fileSystem @*/;
157 /*@=declundef =incondefs @*/
158 #endif
159 #else /* not STDC_HEADERS */
160 char *getenv (const char *name);
161 #if ! HAVE_REALPATH
162 char *realpath(const char *path, char resolved_path []);
163 #endif
164 #endif /* STDC_HEADERS */
165 
166 /* XXX solaris2.5.1 has not */
167 #if !defined(EXIT_FAILURE)
168 #define EXIT_FAILURE 1
169 #endif
170 
171 #ifdef HAVE_FCNTL_H
172 #include <fcntl.h>
173 #else
174 #include <sys/file.h>
175 #endif
176 
177 #if !defined(SEEK_SET) && !defined(__LCLINT__)
178 #define SEEK_SET 0
179 #define SEEK_CUR 1
180 #define SEEK_END 2
181 #endif
182 #if !defined(F_OK) && !defined(__LCLINT__)
183 #define F_OK 0
184 #define X_OK 1
185 #define W_OK 2
186 #define R_OK 4
187 #endif
188 
189 #ifdef HAVE_SIGNAL_H
190 # include <signal.h>
191 #endif
192 
193 #ifdef HAVE_DIRENT_H
194 # include <dirent.h>
195 # define NLENGTH(direct) (strlen((direct)->d_name))
196 #else /* not HAVE_DIRENT_H */
197 # define dirent direct
198 # define NLENGTH(direct) ((direct)->d_namlen)
199 # ifdef HAVE_SYS_NDIR_H
200 # include <sys/ndir.h>
201 # endif /* HAVE_SYS_NDIR_H */
202 # ifdef HAVE_SYS_DIR_H
203 # include <sys/dir.h>
204 # endif /* HAVE_SYS_DIR_H */
205 # ifdef HAVE_NDIR_H
206 # include <ndir.h>
207 # endif /* HAVE_NDIR_H */
208 #endif /* HAVE_DIRENT_H */
209 
210 #if defined(__LCLINT__)
211 /*@-declundef -incondefs @*/ /* LCL: missing annotation */
212 /*@only@*/ /*@out@*/ void * alloca (size_t __size)
213  /*@ensures maxSet(result) == (__size - 1) @*/
214  /*@*/;
215 /*@=declundef =incondefs @*/
216 #endif
217 
218 #ifdef __GNUC__
219 # undef alloca
220 # define alloca __builtin_alloca
221 #else
222 # ifdef HAVE_ALLOCA_H
223 # include <alloca.h>
224 # else
225 # ifndef _AIX
226 /* AIX alloca decl has to be the first thing in the file, bletch! */
227 char *alloca ();
228 # endif
229 # endif
230 #endif
231 
232 #if defined (__GLIBC__) && defined(__LCLINT__)
233 /*@-declundef@*/
234 /*@unchecked@*/
235 extern __const __int32_t *__ctype_tolower;
236 /*@unchecked@*/
237 extern __const __int32_t *__ctype_toupper;
238 /*@=declundef@*/
239 #endif
240 
241 #include <ctype.h>
242 
243 #if defined (__GLIBC__) && defined(__LCLINT__)
244 /*@-exportlocal@*/
245 extern int isalnum(int) __THROW /*@*/;
246 extern int iscntrl(int) __THROW /*@*/;
247 extern int isgraph(int) __THROW /*@*/;
248 extern int islower(int) __THROW /*@*/;
249 extern int ispunct(int) __THROW /*@*/;
250 extern int isxdigit(int) __THROW /*@*/;
251 extern int isascii(int) __THROW /*@*/;
252 extern int toascii(int) __THROW /*@*/;
253 extern int _toupper(int) __THROW /*@*/;
254 extern int _tolower(int) __THROW /*@*/;
255 /*@=exportlocal@*/
256 
257 #endif
258 
259 #if HAVE_SYS_MMAN_H && !defined(__LCLINT__)
260 #include <sys/mman.h>
261 #endif
262 
263 /* XXX FIXME: popt on sunos4.1.3: <sys/resource.h> requires <sys/time.h> */
264 #if HAVE_SYS_RESOURCE_H && HAVE_SYS_TIME_H
265 #include <sys/resource.h>
266 #endif
267 
268 #if HAVE_SYS_UTSNAME_H
269 #include <sys/utsname.h>
270 #endif
271 
272 #if HAVE_SYS_WAIT_H
273 #include <sys/wait.h>
274 #endif
275 
276 #if HAVE_GETOPT_H
277 /*@-noparams@*/
278 #include <getopt.h>
279 /*@=noparams@*/
280 #endif
281 
282 #if HAVE_GRP_H
283 #include <grp.h>
284 #endif
285 
286 #if HAVE_LIMITS_H
287 #include <limits.h>
288 #endif
289 
290 #if HAVE_ERR_H
291 #include <err.h>
292 #endif
293 
294 #if HAVE_MALLOC_H && !defined(__LCLINT__)
295 #include <malloc.h>
296 #endif
297 
298 #if HAVE_LIBGEN_H
299 #include <libgen.h>
300 #endif
301 
302 #if WITH_SELINUX
303 #include <selinux/selinux.h>
304 #else
305 typedef char * security_context_t;
306 
307 #define freecon(_c)
308 
309 #define getfilecon(_fn, _c) (-1)
310 #define lgetfilecon(_fn, _c) (-1)
311 #define fgetfilecon(_fd, _c) (-1)
312 
313 #define setfilecon(_fn, _c) (-1)
314 #define lsetfilecon(_fn, _c) (-1)
315 #define fsetfilecon(_fd, _c) (-1)
316 
317 #define security_check_context(_c) (0)
318 
319 #define is_selinux_enabled() (-1)
320 
321 #define rpm_execcon(_v, _fn, _av, _envp) (0)
322 
323 #define matchpathcon_init(_fn) (-1)
324 #define matchpathcon(_fn, _fmode, _s) (-1)
325 #endif
326 
327 #if defined(WITH_SELINUX) && defined(__LCLINT__)
328 /*@-incondefs@*/
329 extern void freecon(/*@only@*/ security_context_t con)
330  /*@modifies con @*/;
331 
332 extern int getfilecon(const char *path, /*@out@*/ security_context_t *con)
333  /*@modifies *con @*/;
334 extern int lgetfilecon(const char *path, /*@out@*/ security_context_t *con)
335  /*@modifies *con @*/;
336 extern int fgetfilecon(int fd, /*@out@*/ security_context_t *con)
337  /*@modifies *con @*/;
338 
339 extern int setfilecon(const char *path, security_context_t con)
340  /*@globals fileSystem @*/
341  /*@modifies fileSystem @*/;
342 extern int lsetfilecon(const char *path, security_context_t con)
343  /*@globals fileSystem @*/
344  /*@modifies fileSystem @*/;
345 extern int fsetfilecon(int fd, security_context_t con)
346  /*@globals fileSystem @*/
347  /*@modifies fileSystem @*/;
348 
349 extern int getcon(/*@out@*/ security_context_t *con)
350  /*@modifies *con @*/;
351 extern int getexeccon(/*@out@*/ security_context_t *con)
352  /*@modifies *con @*/;
353 extern int setexeccon(security_context_t con)
354  /*@globals fileSystem @*/
355  /*@modifies fileSystem @*/;
356 
357 extern int security_check_context(security_context_t con)
358  /*@globals fileSystem @*/
359  /*@modifies fileSystem @*/;
360 extern int security_getenforce(void)
361  /*@globals fileSystem @*/
362  /*@modifies fileSystem @*/;
363 
364 extern int is_selinux_enabled(void)
365  /*@globals fileSystem @*/
366  /*@modifies fileSystem @*/;
367 /*@=incondefs@*/
368 #endif
369 
370 /*@-declundef -incondefs @*/ /* FIX: these are macros */
373 /*@mayexit@*/ /*@only@*/ /*@out@*/ void * xmalloc (size_t size)
374  /*@globals errno @*/
375  /*@ensures maxSet(result) == (size - 1) @*/
376  /*@modifies errno @*/;
377 
380 /*@mayexit@*/ /*@only@*/ void * xcalloc (size_t nmemb, size_t size)
381  /*@ensures maxSet(result) == (nmemb - 1) @*/
382  /*@*/;
383 
387 /*@mayexit@*/ /*@only@*/ void * xrealloc (/*@null@*/ /*@only@*/ void * ptr,
388  size_t size)
389  /*@ensures maxSet(result) == (size - 1) @*/
390  /*@modifies *ptr @*/;
391 
394 /*@mayexit@*/ /*@only@*/ char * xstrdup (const char *str)
395  /*@*/;
396 /*@=declundef =incondefs @*/
397 
400 /*@unused@*/ /*@exits@*/ /*@only@*/ void * vmefail(size_t size)
401  /*@*/;
402 
403 #if HAVE_MCHECK_H
404 #include <mcheck.h>
405 #if defined(__LCLINT__)
406 /*@-declundef -incondefs @*/ /* LCL: missing annotations */
407 #if 0
408 enum mcheck_status
409  {
410  MCHECK_DISABLED = -1, /* Consistency checking is not turned on. */
411  MCHECK_OK, /* Block is fine. */
412  MCHECK_FREE, /* Block freed twice. */
413  MCHECK_HEAD, /* Memory before the block was clobbered. */
414  MCHECK_TAIL /* Memory after the block was clobbered. */
415  };
416 #endif
417 
418 extern int mcheck (void (*__abortfunc) (enum mcheck_status))
419  /*@globals internalState@*/
420  /*@modifies internalState @*/;
421 extern int mcheck_pedantic (void (*__abortfunc) (enum mcheck_status))
422  /*@globals internalState@*/
423  /*@modifies internalState @*/;
424 extern void mcheck_check_all (void)
425  /*@globals internalState@*/
426  /*@modifies internalState @*/;
427 extern enum mcheck_status mprobe (void *__ptr)
428  /*@globals internalState@*/
429  /*@modifies internalState @*/;
430 extern void mtrace (void)
431  /*@globals internalState@*/
432  /*@modifies internalState @*/;
433 extern void muntrace (void)
434  /*@globals internalState@*/
435  /*@modifies internalState @*/;
436 /*@=declundef =incondefs @*/
437 #endif /* defined(__LCLINT__) */
438 
439 /* Memory allocation via macro defs to get meaningful locations from mtrace() */
440 #if defined(__GNUC__)
441 #define xmalloc(_size) (malloc(_size) ? : vmefail(_size))
442 #define xcalloc(_nmemb, _size) (calloc((_nmemb), (_size)) ? : vmefail(_size))
443 #define xrealloc(_ptr, _size) (realloc((_ptr), (_size)) ? : vmefail(_size))
444 #define xstrdup(_str) (strcpy((malloc(strlen(_str)+1) ? : vmefail(strlen(_str)+1)), (_str)))
445 #endif /* defined(__GNUC__) */
446 #endif /* HAVE_MCHECK_H */
447 
448 /* Retrofit glibc __progname */
449 #if defined __GLIBC__ && __GLIBC__ >= 2
450 #if __GLIBC_MINOR__ >= 1
451 #define __progname __assert_program_name
452 #endif
453 #define setprogname(pn)
454 #else
455 #define __progname program_name
456 #define setprogname(pn) \
457  { if ((__progname = strrchr(pn, '/')) != NULL) __progname++; \
458  else __progname = pn; \
459  }
460 #endif
461 /*@unchecked@*/
462 extern const char *__progname;
463 
464 #if HAVE_NETDB_H
465 #include <netdb.h>
466 #endif
467 
468 #if HAVE_PWD_H
469 #include <pwd.h>
470 #endif
471 
472 /* Take care of NLS matters. */
473 
474 #if HAVE_LOCALE_H
475 # include <locale.h>
476 #endif
477 #if !HAVE_SETLOCALE
478 # define setlocale(Category, Locale) /* empty */
479 #endif
480 
481 #if ENABLE_NLS && !defined(__LCLINT__)
482 # include <libintl.h>
483 # define _(Text) dgettext (PACKAGE, Text)
484 # define D_(Text) Text
485 #else
486 # undef bindtextdomain
487 # define bindtextdomain(Domain, Directory) /* empty */
488 # undef textdomain
489 # define textdomain(Domain) /* empty */
490 # define _(Text) Text
491 # define D_(Text) Text
492 # undef dgettext
493 # define dgettext(DomainName, Text) Text
494 #endif
495 
496 #define N_(Text) Text
497 
498 /* ============== from misc/miscfn.h */
499 
500 #if !defined(USE_GNU_GLOB) || defined(__LCLINT__)
501 #if HAVE_FNMATCH_H
502 /*@-noparams@*/
503 #include <fnmatch.h>
504 /*@=noparams@*/
505 #endif
506 
507 #if HAVE_GLOB_H || defined(__LCLINT__)
508 /*@-noparams@*/
509 #include <glob.h>
510 /*@=noparams@*/
511 #endif
512 #else
513 /*@-noparams@*/
514 #include "misc/glob.h"
515 #include "misc/fnmatch.h"
516 /*@=noparams@*/
517 #endif
518 
519 #if defined(__LCLINT__)
520 /*@-declundef -incondefs @*/ /* LCL: missing annotation */
521 #if 0
522 typedef /*@concrete@*/ struct
523  {
524  size_t gl_pathc;
525  char **gl_pathv;
526  size_t gl_offs;
527  int gl_flags;
528 
529  void (*gl_closedir) (void *);
530 #ifdef _GNU_SOURCE
531  struct dirent *(*gl_readdir) (void *);
532 #else
533  void *(*gl_readdir) (void *);
534 #endif
535  ptr_t (*gl_opendir) (const char *);
536 #ifdef _GNU_SOURCE
537  int (*gl_lstat) (const char *restrict, struct stat *restrict);
538  int (*gl_stat) (const char *restrict, struct stat *restrict);
539 #else
540  int (*gl_lstat) (const char *restrict, void *restrict);
541  int (*gl_stat) (const char *restrict, void *restrict);
542 #endif
543  } glob_t;
544 #endif
545 
546 #if 0
547 /*@-constuse@*/
548 /*@constant int GLOB_ERR@*/
549 /*@constant int GLOB_MARK@*/
550 /*@constant int GLOB_NOSORT@*/
551 /*@constant int GLOB_DOOFFS@*/
552 /*@constant int GLOB_NOCHECK@*/
553 /*@constant int GLOB_APPEND@*/
554 /*@constant int GLOB_NOESCAPE@*/
555 /*@constant int GLOB_PERIOD@*/
556 
557 #ifdef _GNU_SOURCE
558 /*@constant int GLOB_MAGCHAR@*/
559 /*@constant int GLOB_ALTDIRFUNC@*/
560 /*@constant int GLOB_BRACE@*/
561 /*@constant int GLOB_NOMAGIC@*/
562 /*@constant int GLOB_TILDE@*/
563 /*@constant int GLOB_ONLYDIR@*/
564 /*@constant int GLOB_TILDE_CHECK@*/
565 #endif
566 
567 /*@constant int GLOB_FLAGS@*/
568 
569 /*@constant int GLOB_NOSPACE@*/
570 /*@constant int GLOB_ABORTED@*/
571 /*@constant int GLOB_NOMATCH@*/
572 /*@constant int GLOB_NOSYS@*/
573 #ifdef _GNU_SOURCE
574 /*@constant int GLOB_ABEND@*/
575 #endif
576 /*@=constuse@*/
577 #endif
578 
579 /*@-protoparammatch -redecl@*/
580 /*@-type@*/ /* XXX glob64_t */
581 extern int glob (const char *__pattern, int __flags,
582  int (*__errfunc) (const char *, int),
583  /*@out@*/ glob_t *__pglob)
584  /*@globals errno, fileSystem @*/
585  /*@modifies *__pglob, errno, fileSystem @*/;
586  /* XXX only annotation is a white lie */
587 extern void globfree (/*@only@*/ glob_t *__pglob)
588  /*@modifies *__pglob @*/;
589 /*@=type@*/
590 #ifdef _GNU_SOURCE
591 extern int glob_pattern_p (const char *__pattern, int __quote)
592  /*@*/;
593 #endif
594 /*@=protoparammatch =redecl@*/
595 
596 #if 0
597 /*@-constuse@*/
598 /*@constant int FNM_PATHNAME@*/
599 /*@constant int FNM_NOESCAPE@*/
600 /*@constant int FNM_PERIOD@*/
601 
602 #ifdef _GNU_SOURCE
603 /*@constant int FNM_FILE_NAME@*/ /* GNU extension */
604 /*@constant int FNM_LEADING_DIR@*/ /* GNU extension */
605 /*@constant int FNM_CASEFOLD@*/ /* GNU extension */
606 /*@constant int FNM_EXTMATCH@*/ /* GNU extension */
607 #endif
608 
609 /*@constant int FNM_NOMATCH@*/
610 
611 #ifdef _XOPEN_SOURCE
612 /*@constant int FNM_NOSYS@*/ /* X/Open */
613 #endif
614 /*@=constuse@*/
615 #endif
616 
617 extern int fnmatch (const char *__pattern, const char *__name, int __flags)
618  /*@*/;
619 /*@=declundef =incondefs @*/
620 #endif
621 
622 #if ! HAVE_S_IFSOCK
623 #define S_IFSOCK (0xc000)
624 #endif
625 
626 #if ! HAVE_S_ISLNK
627 #define S_ISLNK(mode) ((mode & 0xf000) == S_IFLNK)
628 #endif
629 
630 #if ! HAVE_S_ISSOCK
631 #define S_ISSOCK(mode) ((mode & 0xf000) == S_IFSOCK)
632 #endif
633 
634 #if NEED_STRINGS_H
635 #include <strings.h>
636 #endif
637 
638 #if NEED_MYREALLOC
639 #define realloc(ptr,size) myrealloc(ptr,size)
640 extern void *myrealloc(void *, size_t);
641 #endif
642 
643 #if ! HAVE_SETENV
644 extern int setenv(const char *name, const char *value, int replace);
645 extern void unsetenv(const char *name);
646 #endif
647 
648 #if HAVE_SYS_SOCKET_H
649 #include <sys/types.h>
650 #include <sys/socket.h>
651 #endif
652 
653 #if HAVE_POLL_H
654 #include <poll.h>
655 #else
656 #if HAVE_SYS_SELECT_H && !defined(__LCLINT__)
657 #include <sys/select.h>
658 #endif
659 #endif
660 
661 /* Solaris <= 2.6 limits getpass return to only 8 chars */
662 #if HAVE_GETPASSPHRASE
663 #define getpass getpassphrase
664 #endif
665 
666 #if ! HAVE_LCHOWN
667 #define lchown chown
668 #endif
669 
670 #if HAVE_GETMNTINFO || HAVE_GETMNTINFO_R || HAVE_MNTCTL
671 # define GETMNTENT_ONE 0
672 # define GETMNTENT_TWO 0
673 # if HAVE_SYS_MNTCTL_H
674 # include <sys/mntctl.h>
675 # endif
676 # if HAVE_SYS_VMOUNT_H
677 # include <sys/vmount.h>
678 # endif
679 # if HAVE_SYS_MOUNT_H
680 # include <sys/mount.h>
681 # endif
682 #elif HAVE_MNTENT_H || !(HAVE_GETMNTENT) || HAVE_STRUCT_MNTTAB
683 # if HAVE_MNTENT_H
684 # include <stdio.h>
685 # include <mntent.h>
686 # define our_mntent struct mntent
687 # define our_mntdir mnt_dir
688 # elif HAVE_STRUCT_MNTTAB
689 # include <stdio.h>
690 # include <mnttab.h>
691  struct our_mntent {
692  char * our_mntdir;
693  };
694  struct our_mntent *getmntent(FILE *filep);
695 # define our_mntent struct our_mntent
696 # else
697 # include <stdio.h>
698  struct our_mntent {
699  char * our_mntdir;
700  };
701  struct our_mntent *getmntent(FILE *filep);
702 # define our_mntent struct our_mntent
703 # endif
704 # define GETMNTENT_ONE 1
705 # define GETMNTENT_TWO 0
706 #elif HAVE_SYS_MNTTAB_H
707 # include <stdio.h>
708 # include <sys/mnttab.h>
709 # define GETMNTENT_ONE 0
710 # define GETMNTENT_TWO 1
711 # define our_mntent struct mnttab
712 # define our_mntdir mnt_mountp
713 #else /* if !HAVE_MNTCTL */
714 # error Neither mntent.h, mnttab.h, or mntctl() exists. I cannot build on this system.
715 #endif
716 
717 #ifndef MOUNTED
718 #define MOUNTED "/etc/mnttab"
719 #endif
720 
721 #if defined(__LCLINT__)
722 #define FILE_RCSID(id)
723 #else
724 #define FILE_RCSID(id) \
725 static inline const char *rcsid(const char *p) { \
726  return rcsid(p = id); \
727 }
728 #endif
729 
730 #endif /* H_SYSTEM */