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