00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef _NIO_H
00020 #define _NIO_H
00021
00022 #include <sys/ipc.h>
00023 #include <sys/shm.h>
00024 #include <sys/types.h>
00025 #include <sys/stat.h>
00026 #include <dirent.h>
00027 #include <fcntl.h>
00028
00035
00036 enum nio_op {
00037 NIO_INVALID = 0,
00038
00039
00040 NIO_OPEN,
00041 NIO_CLOSE,
00042 NIO_READ,
00043 NIO_WRITE,
00044 NIO_LSEEK,
00045 NIO_OPENDIR,
00046 NIO_CLOSEDIR,
00047 NIO_REWINDDIR,
00048 NIO_READDIR,
00049 NIO_TELLDIR,
00050 NIO_LINK,
00051 NIO_SYMLINK,
00052 NIO_UNLINK,
00053 NIO_RENAME,
00054 NIO_FCNTL,
00055 NIO_STAT,
00056 NIO_FSTAT,
00057 NIO_LSTAT,
00058 NIO_FDATASYNC,
00059 NIO_FSYNC,
00060 NIO_TRUNCATE,
00061 NIO_FTRUNCATE,
00062
00063
00064 NIO_GETADDRINFO,
00065 NIO_GETNAMEINFO,
00066 };
00067
00068
00069
00070
00072 struct niocb {
00073
00074
00075
00076 enum nio_op req_op;
00077 int req_fd;
00078 off_t req_offset;
00079 size_t req_len;
00080 mode_t req_mode;
00081 char *req_path;
00082 int req_flags;
00084
00085
00086 union {
00087 struct stat st;
00088 struct dirent ent;
00089 int fd;
00090 size_t len;
00091 DIR *dirh;
00092 off_t offset;
00093 } res_data;
00094 int res_errno;
00095 int res_retval;
00096 int res_shmid;
00097 };
00098
00099
00100
00101
00102 int nio_open(struct niocb *cb, const char *path, int flags, mode_t mode);
00103 int nio_close(struct niocb *cb, int fd);
00104 int nio_read(struct niocb *cb, int fd, size_t count);
00105 int nio_write(struct niocb *cb, int fd, const void *buf, size_t count);
00106 int nio_lseek(struct niocb *cb, int fd, off_t offset, int whence);
00107
00108
00109
00110 int nio_opendir(struct niocb *cb, const char *name);
00111 int nio_closedir(struct niocb *cb, DIR *dir);
00112 int nio_rewinddir(struct niocb *cb, DIR *dir);
00113 int nio_readdir(struct niocb *cb, DIR *dir);
00114 int nio_telldir(struct niocb *cb, DIR *dir);
00115
00116
00117
00118 int nio_link(struct niocb *cb, const char *oldpath, const char *newpath);
00119 int nio_symlink(struct niocb *cb, const char *oldpath, const char *newpath);
00120 int nio_unlink(struct niocb *cb, const char *path);
00121 int nio_rename(struct niocb *cb, const char *oldpath, const char *newpath);
00122
00123
00124
00125 int nio_fcntl(struct niocb *cb, int fd, int op, const struct flock *fl);
00126
00127
00128
00129 int nio_stat(struct niocb *cb, const char *path);
00130 int nio_fstat(struct niocb *cb, int fd);
00131 int nio_lstat(struct niocb *cb, const char *path);
00132
00133
00134
00135 int nio_fdatasync(struct niocb *cb, int fd);
00136 int nio_fsync(struct niocb *cb, int fd);
00137
00138
00139
00140 int nio_truncate(struct niocb *cb, const char *path, off_t length);
00141 int nio_ftruncate(struct niocb *cb, int fd, off_t length);
00142
00143
00144
00145 int nio_getaddrinfo(struct niocb *cb,
00146 const char *node,
00147 const char *service,
00148 const struct addrinfo *hints,
00149 struct addrinfo **res);
00150
00151 int nio_getnameinfo(struct niocb *cb,
00152 const struct sockaddr *sa,
00153 socklen_t salen,
00154 char *host,
00155 size_t hostlen,
00156 char *serv,
00157 size_t servlen,
00158 int flags);
00159
00160 #endif