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 29int isrmt(int); 30int rmtaccess(const char *, int); 31int rmtclose(int); 32int rmtcreat(const char *, mode_t); 33int rmtdup(int); 34int rmtfcntl(int, int, ...); 35int rmtfstat(int, struct stat *); 36int rmtioctl(int, unsigned long, ...); 37int rmtisatty(int); 38off_t rmtlseek(int, off_t, int); 39int rmtlstat(const char *, struct stat *); 40int rmtopen(const char *, int, ...); 41ssize_t rmtread(int, void *, size_t); 42int rmtstat(const char *, struct stat *); 43ssize_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_ */ 66