1*f14fb602SLionel Sambuc /* $NetBSD: rmt.h,v 1.7 2011/02/16 19:29:35 christos Exp $ */ 22fe8fb19SBen Gras 32fe8fb19SBen Gras /* 42fe8fb19SBen Gras * rmt.h 52fe8fb19SBen Gras * 62fe8fb19SBen Gras * Added routines to replace open(), close(), lseek(), ioctl(), etc. 72fe8fb19SBen Gras * The preprocessor can be used to remap these the rmtopen(), etc 82fe8fb19SBen Gras * thus minimizing source changes. 92fe8fb19SBen Gras * 102fe8fb19SBen Gras * This file must be included before <sys/stat.h>, since it redefines 112fe8fb19SBen Gras * stat to be rmtstat, so that struct stat xyzzy; declarations work 122fe8fb19SBen Gras * properly. 132fe8fb19SBen Gras * 142fe8fb19SBen Gras * -- Fred Fish (w/some changes by Arnold Robbins) 152fe8fb19SBen Gras */ 162fe8fb19SBen Gras 172fe8fb19SBen Gras #ifndef _RMT_H_ 182fe8fb19SBen Gras #define _RMT_H_ 192fe8fb19SBen Gras 202fe8fb19SBen Gras #include <sys/cdefs.h> 212fe8fb19SBen Gras 22*f14fb602SLionel Sambuc #if _FORTIFY_SOURCE > 0 23*f14fb602SLionel Sambuc #define __ssp_weak_name(x) rmt ## x 24*f14fb602SLionel Sambuc #include <ssp/unistd.h> 25*f14fb602SLionel Sambuc #endif 26*f14fb602SLionel Sambuc 272fe8fb19SBen Gras __BEGIN_DECLS 282fe8fb19SBen Gras int isrmt(int); 292fe8fb19SBen Gras int rmtaccess(const char *, int); 302fe8fb19SBen Gras int rmtclose(int); 312fe8fb19SBen Gras int rmtcreat(const char *, mode_t); 322fe8fb19SBen Gras int rmtdup(int); 332fe8fb19SBen Gras int rmtfcntl(int, int, ...); 342fe8fb19SBen Gras int rmtfstat(int, struct stat *); 352fe8fb19SBen Gras int rmtioctl(int, unsigned long, ...); 362fe8fb19SBen Gras int rmtisatty(int); 372fe8fb19SBen Gras off_t rmtlseek(int, off_t, int); 382fe8fb19SBen Gras int rmtlstat(const char *, struct stat *); 392fe8fb19SBen Gras int rmtopen(const char *, int, ...); 402fe8fb19SBen Gras ssize_t rmtread(int, void *, size_t); 412fe8fb19SBen Gras int rmtstat(const char *, struct stat *); 422fe8fb19SBen Gras ssize_t rmtwrite(int, const void *, size_t); 432fe8fb19SBen Gras __END_DECLS 442fe8fb19SBen Gras 452fe8fb19SBen Gras #ifndef __RMTLIB_PRIVATE /* don't remap if building librmt */ 462fe8fb19SBen Gras #define access rmtaccess 472fe8fb19SBen Gras #define close rmtclose 482fe8fb19SBen Gras #define creat rmtcreat 492fe8fb19SBen Gras #define dup rmtdup 502fe8fb19SBen Gras #define fcntl rmtfcntl 512fe8fb19SBen Gras #define fstat rmtfstat 522fe8fb19SBen Gras #define ioctl rmtioctl 532fe8fb19SBen Gras #define isatty rmtisatty 542fe8fb19SBen Gras #define lseek rmtlseek 552fe8fb19SBen Gras #define lstat rmtlstat 562fe8fb19SBen Gras #define open rmtopen 57*f14fb602SLionel Sambuc #if __SSP_FORTIFY_LEVEL == 0 582fe8fb19SBen Gras #define read rmtread 59*f14fb602SLionel Sambuc #endif 602fe8fb19SBen Gras #define stat rmtstat 612fe8fb19SBen Gras #define write rmtwrite 622fe8fb19SBen Gras #endif /* __RMTLIB_PRIVATE */ 632fe8fb19SBen Gras 642fe8fb19SBen Gras #endif /* _RMT_H_ */ 65