diff options
Diffstat (limited to 'apt-pkg/contrib/fileutl.h')
-rw-r--r-- | apt-pkg/contrib/fileutl.h | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index f80457cd3..dd16aa754 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -35,7 +35,7 @@ #define APT_HAS_GZIP 1 class FileFdPrivate; -class FileFd +class APT_PUBLIC FileFd { friend class FileFdPrivate; friend class GzipFileFdPrivate; @@ -174,29 +174,29 @@ class FileFd APT_HIDDEN bool FileFdError(const char* Description,...) APT_PRINTF(2) APT_COLD; }; -bool RunScripts(const char *Cnf); -bool CopyFile(FileFd &From,FileFd &To); -bool RemoveFile(char const * const Function, std::string const &FileName); -bool RemoveFileAt(char const * const Function, int const dirfd, std::string const &FileName); -int GetLock(std::string File,bool Errors = true); -bool FileExists(std::string File); -bool RealFileExists(std::string File); -bool DirectoryExists(std::string const &Path); -bool CreateDirectory(std::string const &Parent, std::string const &Path); -time_t GetModificationTime(std::string const &Path); -bool Rename(std::string From, std::string To); +APT_PUBLIC bool RunScripts(const char *Cnf); +APT_PUBLIC bool CopyFile(FileFd &From,FileFd &To); +APT_PUBLIC bool RemoveFile(char const * const Function, std::string const &FileName); +APT_PUBLIC bool RemoveFileAt(char const * const Function, int const dirfd, std::string const &FileName); +APT_PUBLIC int GetLock(std::string File,bool Errors = true); +APT_PUBLIC bool FileExists(std::string File); +APT_PUBLIC bool RealFileExists(std::string File); +APT_PUBLIC bool DirectoryExists(std::string const &Path); +APT_PUBLIC bool CreateDirectory(std::string const &Parent, std::string const &Path); +APT_PUBLIC time_t GetModificationTime(std::string const &Path); +APT_PUBLIC bool Rename(std::string From, std::string To); -std::string GetTempDir(); -std::string GetTempDir(std::string const &User); -FileFd* GetTempFile(std::string const &Prefix = "", +APT_PUBLIC std::string GetTempDir(); +APT_PUBLIC std::string GetTempDir(std::string const &User); +APT_PUBLIC FileFd* GetTempFile(std::string const &Prefix = "", bool ImmediateUnlink = true, FileFd * const TmpFd = NULL); // FIXME: GetTempFile should always return a buffered file -FileFd* GetTempFile(std::string const &Prefix, +APT_HIDDEN FileFd* GetTempFile(std::string const &Prefix, bool ImmediateUnlink , FileFd * const TmpFd, - bool Buffered) APT_HIDDEN; + bool Buffered); /** \brief Ensure the existence of the given Path * @@ -204,24 +204,24 @@ FileFd* GetTempFile(std::string const &Prefix, * /apt/ will be removed before CreateDirectory call. * \param Path which should exist after (successful) call */ -bool CreateAPTDirectoryIfNeeded(std::string const &Parent, std::string const &Path); +APT_PUBLIC bool CreateAPTDirectoryIfNeeded(std::string const &Parent, std::string const &Path); -std::vector<std::string> GetListOfFilesInDir(std::string const &Dir, std::string const &Ext, +APT_PUBLIC std::vector<std::string> GetListOfFilesInDir(std::string const &Dir, std::string const &Ext, bool const &SortList, bool const &AllowNoExt=false); -std::vector<std::string> GetListOfFilesInDir(std::string const &Dir, std::vector<std::string> const &Ext, +APT_PUBLIC std::vector<std::string> GetListOfFilesInDir(std::string const &Dir, std::vector<std::string> const &Ext, bool const &SortList); -std::vector<std::string> GetListOfFilesInDir(std::string const &Dir, bool SortList); -std::string SafeGetCWD(); -void SetCloseExec(int Fd,bool Close); -void SetNonBlock(int Fd,bool Block); -bool WaitFd(int Fd,bool write = false,unsigned long timeout = 0); -pid_t ExecFork(); -pid_t ExecFork(std::set<int> keep_fds); -void MergeKeepFdsFromConfiguration(std::set<int> &keep_fds); -bool ExecWait(pid_t Pid,const char *Name,bool Reap = false); +APT_PUBLIC std::vector<std::string> GetListOfFilesInDir(std::string const &Dir, bool SortList); +APT_PUBLIC std::string SafeGetCWD(); +APT_PUBLIC void SetCloseExec(int Fd,bool Close); +APT_PUBLIC void SetNonBlock(int Fd,bool Block); +APT_PUBLIC bool WaitFd(int Fd,bool write = false,unsigned long timeout = 0); +APT_PUBLIC pid_t ExecFork(); +APT_PUBLIC pid_t ExecFork(std::set<int> keep_fds); +APT_PUBLIC void MergeKeepFdsFromConfiguration(std::set<int> &keep_fds); +APT_PUBLIC bool ExecWait(pid_t Pid,const char *Name,bool Reap = false); // check if the given file starts with a PGP cleartext signature -bool StartsWithGPGClearTextSignature(std::string const &FileName); +APT_PUBLIC bool StartsWithGPGClearTextSignature(std::string const &FileName); /** change file attributes to requested known good values * @@ -233,7 +233,7 @@ bool StartsWithGPGClearTextSignature(std::string const &FileName); * @param group is the (new) group owning the file, e.g. root * @param mode is the access mode of the file, e.g. 0644 */ -bool ChangeOwnerAndPermissionOfFile(char const * const requester, char const * const file, char const * const user, char const * const group, mode_t const mode); +APT_PUBLIC bool ChangeOwnerAndPermissionOfFile(char const * const requester, char const * const file, char const * const user, char const * const group, mode_t const mode); /** * \brief Drop privileges @@ -246,23 +246,23 @@ bool ChangeOwnerAndPermissionOfFile(char const * const requester, char const * c * * \return true on success, false on failure with _error set */ -bool DropPrivileges(); +APT_PUBLIC bool DropPrivileges(); // File string manipulators -std::string flNotDir(std::string File); -std::string flNotFile(std::string File); -std::string flNoLink(std::string File); -std::string flExtension(std::string File); -std::string flCombine(std::string Dir,std::string File); +APT_PUBLIC std::string flNotDir(std::string File); +APT_PUBLIC std::string flNotFile(std::string File); +APT_PUBLIC std::string flNoLink(std::string File); +APT_PUBLIC std::string flExtension(std::string File); +APT_PUBLIC std::string flCombine(std::string Dir,std::string File); /** \brief Takes a file path and returns the absolute path */ -std::string flAbsPath(std::string File); +APT_PUBLIC std::string flAbsPath(std::string File); /** \brief removes superfluous /./ and // from path */ APT_HIDDEN std::string flNormalize(std::string file); // simple c++ glob -std::vector<std::string> Glob(std::string const &pattern, int flags=0); +APT_PUBLIC std::vector<std::string> Glob(std::string const &pattern, int flags=0); /** \brief Popen() implementation that execv() instead of using a shell * @@ -276,7 +276,7 @@ std::vector<std::string> Glob(std::string const &pattern, int flags=0); * \param Sandbox True if this should run sandboxed * \return true on success, false on failure with _error set */ -bool Popen(const char *Args[], FileFd &Fd, pid_t &Child, FileFd::OpenMode Mode, bool CaptureStderr = true, bool Sandbox = false); +APT_PUBLIC bool Popen(const char *Args[], FileFd &Fd, pid_t &Child, FileFd::OpenMode Mode, bool CaptureStderr = true, bool Sandbox = false); APT_HIDDEN bool OpenConfigurationFileFd(std::string const &File, FileFd &Fd); |