|
||||
File indexing completed on 2025-01-18 10:13:31
0001 0002 /*--------------------------------------------------------------------*/ 0003 /*--- File/socket-related libc stuff. pub_tool_libcfile.h ---*/ 0004 /*--------------------------------------------------------------------*/ 0005 0006 /* 0007 This file is part of Valgrind, a dynamic binary instrumentation 0008 framework. 0009 0010 Copyright (C) 2000-2017 Julian Seward 0011 jseward@acm.org 0012 0013 This program is free software; you can redistribute it and/or 0014 modify it under the terms of the GNU General Public License as 0015 published by the Free Software Foundation; either version 2 of the 0016 License, or (at your option) any later version. 0017 0018 This program is distributed in the hope that it will be useful, but 0019 WITHOUT ANY WARRANTY; without even the implied warranty of 0020 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0021 General Public License for more details. 0022 0023 You should have received a copy of the GNU General Public License 0024 along with this program; if not, see <http://www.gnu.org/licenses/>. 0025 0026 The GNU General Public License is contained in the file COPYING. 0027 */ 0028 0029 #ifndef __PUB_TOOL_LIBCFILE_H 0030 #define __PUB_TOOL_LIBCFILE_H 0031 0032 #include "pub_tool_basics.h" // VG_ macro 0033 #include "pub_tool_vki.h" // vki_dirent et al. 0034 0035 /* --------------------------------------------------------------------- 0036 File-related functions. 0037 ------------------------------------------------------------------ */ 0038 0039 /* To use this file you must first include pub_tool_vki.h. */ 0040 0041 /* Note that VG_(stat) and VG_(fstat) write to a 'struct vg_stat*' and 0042 not a 'struct vki_stat*' or a 'struct vki_stat64*'. 'struct 0043 vg_stat*' is not the same as either of the vki_ versions. No 0044 specific vki_stat{,64} kernel structure will work and is 0045 consistently available on different architectures on Linux, so we 0046 have to use this 'struct vg_stat' impedance-matching type 0047 instead. 0048 0049 Also note that the fieldnames aren't prefixed with "st_". This is because 0050 st_atime et al are macros in sys/stat.h on Darwin, and using those names 0051 screws things up. 0052 */ 0053 struct vg_stat { 0054 ULong dev; 0055 ULong ino; 0056 ULong nlink; 0057 UInt mode; 0058 UInt uid; 0059 UInt gid; 0060 ULong rdev; 0061 Long size; 0062 ULong blksize; 0063 ULong blocks; 0064 ULong atime; 0065 ULong atime_nsec; 0066 ULong mtime; 0067 ULong mtime_nsec; 0068 ULong ctime; 0069 ULong ctime_nsec; 0070 }; 0071 0072 extern SysRes VG_(mknod) ( const HChar* pathname, Int mode, UWord dev ); 0073 extern SysRes VG_(open) ( const HChar* pathname, Int flags, Int mode ); 0074 /* fd_open words like the open(2) system call: 0075 returns fd if success, -1 otherwise */ 0076 extern Int VG_(fd_open) (const HChar* pathname, Int flags, Int mode); 0077 extern void VG_(close) ( Int fd ); 0078 extern Int VG_(read) ( Int fd, void* buf, Int count); 0079 extern Int VG_(write) ( Int fd, const void* buf, Int count); 0080 extern Int VG_(pipe) ( Int fd[2] ); 0081 extern Off64T VG_(lseek) ( Int fd, Off64T offset, Int whence ); 0082 0083 extern SysRes VG_(stat) ( const HChar* file_name, struct vg_stat* buf ); 0084 extern Int VG_(fstat) ( Int fd, struct vg_stat* buf ); 0085 extern SysRes VG_(dup) ( Int oldfd ); 0086 extern SysRes VG_(dup2) ( Int oldfd, Int newfd ); 0087 extern Int VG_(rename) ( const HChar* old_name, const HChar* new_name ); 0088 extern Int VG_(unlink) ( const HChar* file_name ); 0089 0090 extern SysRes VG_(poll) (struct vki_pollfd *fds, Int nfds, Int timeout); 0091 0092 extern SSizeT VG_(readlink)( const HChar* path, HChar* buf, SizeT bufsiz); 0093 0094 #if defined(VGO_linux) || defined(VGO_solaris) 0095 extern Int VG_(getdents64)( Int fd, struct vki_dirent64 *dirp, UInt count ); 0096 #endif 0097 0098 extern const HChar* VG_(basename)( const HChar* path ); 0099 extern const HChar* VG_(dirname) ( const HChar* path ); 0100 0101 /* Return the name of a directory for temporary files. */ 0102 extern const HChar* VG_(tmpdir)(void); 0103 0104 /* Return the working directory at startup. The returned string is 0105 persistent. Might be NULL if the current working directory doesn't 0106 exist. */ 0107 extern const HChar *VG_(get_startup_wd) ( void ); 0108 0109 #endif // __PUB_TOOL_LIBCFILE_H 0110 0111 /*--------------------------------------------------------------------*/ 0112 /*--- end ---*/ 0113 /*--------------------------------------------------------------------*/
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |