Project

General

Profile

Statistics
| Revision:

root / lab4 / .minix-src / include / rmt.h @ 13

History | View | Annotate | Download (1.55 KB)

1
/*        $NetBSD: rmt.h,v 1.7 2011/02/16 19:29:35 christos Exp $        */
2

    
3
/*
4
 *        rmt.h
5
 *
6
 *        Added routines to replace open(), close(), lseek(), ioctl(), etc.
7
 *        The preprocessor can be used to remap these the rmtopen(), etc
8
 *        thus minimizing source changes.
9
 *
10
 *        This file must be included before <sys/stat.h>, since it redefines
11
 *        stat to be rmtstat, so that struct stat xyzzy; declarations work
12
 *        properly.
13
 *
14
 *        -- Fred Fish (w/some changes by Arnold Robbins)
15
 */
16

    
17
#ifndef _RMT_H_
18
#define _RMT_H_
19

    
20
#include <sys/cdefs.h>
21

    
22
#if _FORTIFY_SOURCE > 0
23
#define __ssp_weak_name(x)        rmt ## x
24
#include <ssp/unistd.h>
25
#endif 
26

    
27
__BEGIN_DECLS
28
int        isrmt(int);
29
int        rmtaccess(const char *, int);
30
int        rmtclose(int);
31
int        rmtcreat(const char *, mode_t);
32
int        rmtdup(int);
33
int        rmtfcntl(int, int, ...);
34
int        rmtfstat(int, struct stat *);
35
int        rmtioctl(int, unsigned long, ...);
36
int        rmtisatty(int);
37
off_t        rmtlseek(int, off_t, int);
38
int        rmtlstat(const char *, struct stat *);
39
int        rmtopen(const char *, int, ...);
40
ssize_t        rmtread(int, void *, size_t);
41
int        rmtstat(const char *, struct stat *);
42
ssize_t        rmtwrite(int, const void *, size_t);
43
__END_DECLS
44

    
45
#ifndef __RMTLIB_PRIVATE        /* don't remap if building librmt */
46
#define access rmtaccess
47
#define close rmtclose
48
#define creat rmtcreat
49
#define dup rmtdup
50
#define fcntl rmtfcntl
51
#define fstat rmtfstat
52
#define ioctl rmtioctl
53
#define isatty rmtisatty
54
#define lseek rmtlseek
55
#define lstat rmtlstat
56
#define open rmtopen
57
#if __SSP_FORTIFY_LEVEL == 0
58
#define read rmtread
59
#endif
60
#define stat rmtstat
61
#define write rmtwrite
62
#endif /* __RMTLIB_PRIVATE */
63

    
64
#endif /* _RMT_H_ */