|
|
|
|
|
|
#ifndef FILE_H |
#define FILE_H |
|
#ifdef HAVE_NETINET_IN_H |
#include <netinet/in.h> |
#endif |
|
#ifdef HAVE_ARPA_INET_H |
#ifndef ARPA_INET_H |
#include <arpa/inet.h> |
#define ARPA_INET_H |
|
|
#ifdef LITTLE_ENDIAN |
#undef LITTLE_ENDIAN |
#endif |
|
#endif |
#endif |
|
#include "pike_netlib.h" |
#include "backend.h" |
|
struct my_file |
{ |
struct fd_callback_box box; |
|
|
struct svalue event_cbs[6]; |
|
|
|
short open_mode; |
short flags; |
int my_errno; |
|
#ifdef HAVE_PIKE_SEND_FD |
int *fd_info; |
|
|
|
|
|
|
|
|
|
|
#endif |
|
#if defined(HAVE_FD_FLOCK) || defined(HAVE_FD_LOCKF) |
struct object *key; |
#endif |
}; |
|
#ifdef _REENTRANT |
|
struct pike_sendfile |
{ |
struct object *self; |
|
struct array *headers; |
struct array *trailers; |
|
struct object *from_file; |
struct object *to_file; |
|
struct callback *backend_callback; |
struct svalue callback; |
struct array *args; |
|
int from_fd; |
int to_fd; |
|
struct my_file *from; |
struct my_file *to; |
|
LONGEST sent; |
|
LONGEST offset; |
LONGEST len; |
|
struct iovec *hd_iov; |
struct iovec *tr_iov; |
|
int hd_cnt; |
int tr_cnt; |
|
struct iovec *iovs; |
char *buffer; |
ptrdiff_t buf_size; |
}; |
|
#endif /* _REENTRANT */ |
|
extern struct program *file_program; |
extern struct program *file_ref_program; |
|
|
extern int get_inet_addr(PIKE_SOCKADDR *addr,char *name,char *service, |
INT_TYPE port, int inet_flags); |
#define PIKE_INET_FLAG_UDP 1 |
#define PIKE_INET_FLAG_IPV6 2 |
#define PIKE_INET_FLAG_NB 4 |
|
#ifdef _REENTRANT |
void low_do_sendfile(struct pike_sendfile *); |
#endif /* _REENTRANT */ |
|
|
void my_set_close_on_exec(int fd, int to); |
void do_set_close_on_exec(void); |
|
void init_stdio_efuns(void); |
void exit_stdio_efuns(void); |
|
void init_stdio_stat(void); |
void exit_stdio_stat(void); |
|
void init_stdio_port(void); |
void exit_stdio_port(void); |
|
void init_stdio_sendfile(void); |
void exit_stdio_sendfile(void); |
|
void init_stdio_udp(void); |
void exit_stdio_udp(void); |
|
#define CBFUNCS(X) \ |
static void PIKE_CONCAT(file_set_,X) (INT32 args); \ |
static void PIKE_CONCAT(file_query_,X) (INT32 args); |
CBFUNCS(read_callback) |
CBFUNCS(write_callback) |
CBFUNCS(read_oob_callback) |
CBFUNCS(write_oob_callback) |
CBFUNCS(fs_event_callback) |
|
static void file_query_fs_event_flags(INT32 args); |
|
static void file_write(INT32 args); |
PMOD_EXPORT struct object *file_make_object_from_fd(int fd, int mode, int guess); |
PMOD_EXPORT void push_new_fd_object(int factory_fun_num, |
int fd, int mode, int guess); |
int my_socketpair(int family, int type, int protocol, int sv[2]); |
int socketpair_ultra(int family, int type, int protocol, int sv[2]); |
struct new_thread_data; |
void file_proxy(INT32 args); |
PMOD_EXPORT void create_proxy_pipe(struct object *o, int for_reading); |
struct file_lock_key_storage; |
void mark_ids(struct callback *foo, void *bar, void *gazonk); |
PMOD_EXPORT int pike_make_pipe(int *fds); |
PMOD_EXPORT int fd_from_object(struct object *o); |
void f_strerror(INT32 args); |
void push_stat(PIKE_STAT_T *s); |
|
|
|
#ifdef FILE_CREATE |
#undef FILE_CREATE |
#endif |
|
|
|
|
|
|
#define FILE_READ 0x1000 |
#define FILE_WRITE 0x2000 |
#define FILE_APPEND 0x4000 |
#define FILE_CREATE 0x8000 |
|
#define FILE_TRUNC 0x0100 |
#define FILE_EXCLUSIVE 0x0200 |
#define FILE_NONBLOCKING 0x0400 |
#define FILE_SET_CLOSE_ON_EXEC 0x0800 |
|
|
#define FILE_NO_CLOSE_ON_DESTRUCT 0x0002 |
#define FILE_LOCK_FD 0x0004 |
#define FILE_NOT_OPENED 0x0010 |
#define FILE_HAVE_RECV_FD 0x0020 |
|
#endif |
|
|