1
/* Copyright (C) 2010 PrimeBase Technologies GmbH, Germany
3
* PrimeBase Media Stream for MySQL
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
* Author: Barry Leslie
24
* Basic system specific file I/O classes.
25
* The classes in this header are defined in CSSys_unix.cc and CSSys_win.cc
30
#ifndef __CSSYSFILE_H__
31
#define __CSSYSFILE_H__
34
#define INVALID_DIR_HANDLE (INVALID_HANDLE_VALUE)
35
#define INVALID_FILE_HANDLE (INVALID_HANDLE_VALUE)
38
#define INVALID_DIR_HANDLE (NULL)
39
#define INVALID_FILE_HANDLE (-1)
43
#include "CSException.h"
51
sd_dir(INVALID_DIR_HANDLE){}
60
const char *entryName();
61
void getEntryPath(char *path, size_t size);
66
CSStringBuffer *sd_filter;
68
WIN32_FIND_DATAA sd_entry;
71
struct dirent sd_entry;
80
static bool isDirNotFound(CSException *e);
81
static bool isFileNotFound(CSException *e);
82
static bool isDirExists(CSException *e);
84
CSSysFile(): sf_path(NULL), sf_fh(INVALID_FILE_HANDLE){}
86
~CSSysFile(){ sf_close();}
88
bool fs_isOpen() { return ( sf_fh != INVALID_FILE_HANDLE);}
90
void sf_open(const char *path, bool readonly, bool create);
93
size_t sf_pread(void *data, size_t size, off64_t offset);
94
void sf_pwrite(const void *data, size_t size, off64_t offset);
97
void sf_setEOF(off64_t offset);
101
void sf_lock(bool shared);
116
static bool sys_exists(const char *path);
117
static void sys_makeDir(const char *path);
118
static void sys_removeDir(const char *path);
119
static void sys_removeFile(const char *path);
120
static void sys_rename(const char *old_path, const char *new_path);
121
static void sys_stat(const char *path, bool *is_dir, off64_t *size, CSTime *mod_time);
122
static bool sys_isLink(const char *path);
123
static void sys_getcwd(char *path, size_t size);
124
static void sys_setcwd(const char *path);
125
static uint32_t sys_getpid();
126
static bool sys_isAlive(uint32_t pid);