| 1 | /*	$NetBSD: rmt.h,v 1.8 2016/01/22 23:15:58 dholland 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 | #include <sys/types.h> |
| 22 | |
| 23 | #if _FORTIFY_SOURCE > 0 |
| 24 | #define __ssp_weak_name(x)	rmt ## x |
| 25 | #include <ssp/unistd.h> |
| 26 | #endif |
| 27 | |
| 28 | __BEGIN_DECLS |
| 29 | int	isrmt(int); |
| 30 | int	rmtaccess(const char *, int); |
| 31 | int	rmtclose(int); |
| 32 | int	rmtcreat(const char *, mode_t); |
| 33 | int	rmtdup(int); |
| 34 | int	rmtfcntl(int, int, ...); |
| 35 | int	rmtfstat(int, struct stat *); |
| 36 | int	rmtioctl(int, unsigned long, ...); |
| 37 | int	rmtisatty(int); |
| 38 | off_t	rmtlseek(int, off_t, int); |
| 39 | int	rmtlstat(const char *, struct stat *); |
| 40 | int	rmtopen(const char *, int, ...); |
| 41 | ssize_t	rmtread(int, void *, size_t); |
| 42 | int	rmtstat(const char *, struct stat *); |
| 43 | ssize_t	rmtwrite(int, const void *, size_t); |
| 44 | __END_DECLS |
| 45 | |
| 46 | #ifndef __RMTLIB_PRIVATE	/* don't remap if building librmt */ |
| 47 | #define access rmtaccess |
| 48 | #define close rmtclose |
| 49 | #define creat rmtcreat |
| 50 | #define dup rmtdup |
| 51 | #define fcntl rmtfcntl |
| 52 | #define fstat rmtfstat |
| 53 | #define ioctl rmtioctl |
| 54 | #define isatty rmtisatty |
| 55 | #define lseek rmtlseek |
| 56 | #define lstat rmtlstat |
| 57 | #define open rmtopen |
| 58 | #if __SSP_FORTIFY_LEVEL == 0 |
| 59 | #define read rmtread |
| 60 | #endif |
| 61 | #define stat rmtstat |
| 62 | #define write rmtwrite |
| 63 | #endif /* __RMTLIB_PRIVATE */ |
| 64 | |
| 65 | #endif /* _RMT_H_ */ |