00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
#ifndef DAZUKO_XP_H
00036
#define DAZUKO_XP_H
00037
00038 #define VERSION "2.0.2"
00039
00040
#include "dazukoio_xp.h"
00041
00042
00043 #define SET_ACCESS_MASK 0
00044 #define ADD_INCLUDE_PATH 1
00045 #define ADD_EXCLUDE_PATH 2
00046 #define REGISTER 3
00047 #define REMOVE_ALL_PATHS 4
00048 #define UNREGISTER 5
00049 #define GET_AN_ACCESS 6
00050 #define RETURN_AN_ACCESS 7
00051
00052
00053 #define DAZUKO_FREE 0
00054 #define DAZUKO_READY 1
00055 #define DAZUKO_WAITING 2
00056 #define DAZUKO_WORKING 3
00057 #define DAZUKO_DONE 4
00058 #define DAZUKO_BROKEN 5
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 struct event_properties
00081 {
00082 int thrown;
00083
00084 int flags;
00085 char set_flags;
00086 int mode;
00087 char set_mode;
00088 int uid;
00089 char set_uid;
00090 int pid;
00091 char set_pid;
00092 };
00093
00094 struct file_properties
00095 {
00096 unsigned long size;
00097 char set_size;
00098 int uid;
00099 char set_uid;
00100 int gid;
00101 char set_gid;
00102 int mode;
00103 char set_mode;
00104 int device_type;
00105 char set_device_type;
00106 };
00107
00108 struct dazuko_file_struct
00109 {
00110
00111
00112
00113
00114 int should_scan;
00115 char *
filename;
00116 int filename_length;
00117 struct file_properties file_p;
00118 struct xp_file_struct *
extra_data;
00119 };
00120
00121
00122
00123
00124
00125
00126
00127
int xp_init_mutex(
struct xp_mutex *mutex);
00128
int xp_down(
struct xp_mutex *mutex);
00129
int xp_up(
struct xp_mutex *mutex);
00130
int xp_destroy_mutex(
struct xp_mutex *mutex);
00131
00132
00133
int xp_init_rwlock(
struct xp_rwlock *rwlock);
00134
int xp_write_lock(
struct xp_rwlock *rwlock);
00135
int xp_write_unlock(
struct xp_rwlock *rwlock);
00136
int xp_read_lock(
struct xp_rwlock *rlock);
00137
int xp_read_unlock(
struct xp_rwlock *rlock);
00138
int xp_destroy_rwlock(
struct xp_rwlock *rwlock);
00139
00140
00141
int xp_init_queue(
struct xp_queue *queue);
00142
int xp_wait_until_condition(
struct xp_queue *queue,
int (*cfunction)(
void *),
void *cparam,
int allow_interrupt);
00143
int xp_notify(
struct xp_queue *queue);
00144
int xp_destroy_queue(
struct xp_queue *queue);
00145
00146
00147
void*
xp_malloc(size_t size);
00148
int xp_free(
void *ptr);
00149
int xp_copyin(
const void *user_src,
void *kernel_dest, size_t size);
00150
int xp_copyout(
const void *kernel_src,
void *user_dest, size_t size);
00151
int xp_verify_user_writable(
const void *user_ptr, size_t size);
00152
int xp_verify_user_readable(
const void *user_ptr, size_t size);
00153
00154
00155
int xp_is_absolute_path(
const char *
path);
00156
00157
00158
int xp_atomic_set(
struct xp_atomic *atomic,
int value);
00159
int xp_atomic_inc(
struct xp_atomic *atomic);
00160
int xp_atomic_dec(
struct xp_atomic *atomic);
00161
int xp_atomic_read(
struct xp_atomic *atomic);
00162
00163
00164
int xp_copy_file(
struct xp_file *dest,
struct xp_file *src);
00165
int xp_compare_file(
struct xp_file *file1,
struct xp_file *file2);
00166
00167
00168
int xp_sys_hook(
void);
00169
int xp_sys_unhook(
void);
00170
00171
00172
int xp_file_struct_check(
struct dazuko_file_struct *dfs);
00173
int xp_file_struct_check_cleanup(
struct dazuko_file_struct *dfs);
00174
00175
00176
int xp_id_compare(
struct xp_daemon_id *id1,
struct xp_daemon_id *id2);
00177
int xp_id_free(
struct xp_daemon_id *
id);
00178
struct xp_daemon_id*
xp_id_copy(
struct xp_daemon_id *
id);
00179
00180
00181
int xp_print(
const char *fmt, ...);
00182
00183
00184
#ifdef DEBUG
00185
#define DPRINT(fmt) xp_print fmt
00186
#else
00187 #define DPRINT(fmt)
00188
#endif
00189
00190
00191
00192
00193
00194
00195
int dazuko_vsnprintf(
char *str, size_t size,
const char *format, va_list ap);
00196
int dazuko_snprintf(
char *str, size_t size,
const char *format, ...);
00197
int dazuko_is_our_daemon(
struct xp_daemon_id *xp_id);
00198
int dazuko_get_value(
const char *key,
const char *string,
char **value);
00199
int dazuko_unregister_daemon(
struct xp_daemon_id *xp_id);
00200
int dazuko_handle_user_request(
struct dazuko_request *user_request,
struct xp_daemon_id *xp_id);
00201
int dazuko_handle_user_request_compat12(
void *ptr,
int cmd,
struct xp_daemon_id *xp_id);
00202
int dazuko_get_filename_length(
char *filename);
00203
void dazuko_bzero(
void *p,
int len);
00204
int dazuko_sys_check(
unsigned long event,
int daemon_is_allowed,
struct xp_daemon_id *xp_id);
00205
int dazuko_sys_pre(
unsigned long event,
struct dazuko_file_struct *kfs,
struct event_properties *event_p);
00206
int dazuko_sys_post(
unsigned long event,
struct dazuko_file_struct *kfs,
struct xp_file *file,
struct event_properties *event_p);
00207
int dazuko_init(
void);
00208
int dazuko_exit(
void);
00209
00210
#endif