summaryrefslogtreecommitdiff
path: root/file_io/unix/fileacc.c
diff options
context:
space:
mode:
authorrbb <rbb@13f79535-47bb-0310-9956-ffa450edef68>2000-01-06 14:43:22 +0000
committerrbb <rbb@13f79535-47bb-0310-9956-ffa450edef68>2000-01-06 14:43:22 +0000
commit40de0d02842272180c1150c04345a2ea30aa7088 (patch)
tree1f0104f87e59b692031bbe592e8026b2088df304 /file_io/unix/fileacc.c
parent7a9ce03860a139580710ac5042830ec21dcf5226 (diff)
downloadlibapr-40de0d02842272180c1150c04345a2ea30aa7088.tar.gz
Separate the stat structure from the file structure and use ap_stat and
ap_getfileinfo in apache. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@59574 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io/unix/fileacc.c')
-rw-r--r--file_io/unix/fileacc.c146
1 files changed, 16 insertions, 130 deletions
diff --git a/file_io/unix/fileacc.c b/file_io/unix/fileacc.c
index 1acd7130a..af394ae94 100644
--- a/file_io/unix/fileacc.c
+++ b/file_io/unix/fileacc.c
@@ -104,144 +104,30 @@ mode_t get_fileperms(ap_fileperms_t mode)
}
/* ***APRDOC********************************************************
- * ap_status_t ap_get_filesize(ap_ssize_t *, ap_file_t *)
- * Return the size of the current file.
- * arg 1) The currently open file.
- * arg 2) The size of the file.
- */
-ap_status_t ap_get_filesize(ap_ssize_t *size, struct file_t *file)
-{
- if (file != NULL) {
- if (file->stated == 0) {
- ap_getfileinfo(file);
- }
- *size = file->size;
- return APR_SUCCESS;
- }
- else {
- *size = -1;
- return APR_ENOFILE;
- }
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_get_fileperms(ap_fileperms_t *, ap_file_t *)
- * Return the permissions of the current file.
- * arg 1) The currently open file.
- * arg 2) The permissions of the file.
- */
-ap_status_t ap_get_fileperms(ap_fileperms_t *perm, struct file_t *file)
-{
- if (file != NULL) {
- if (file->stated == 0) {
- ap_getfileinfo(file);
- }
- *perm = file->protection;
- return APR_SUCCESS;
- }
- else {
- *perm = -1;
- return APR_ENOFILE;
- }
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_get_fileatime(time_t *, ap_file_t *)
- * Return the last access time of the current file.
- * arg 1) The currently open file.
- * arg 2) The last access time of the file.
- */
-ap_status_t ap_get_fileatime(time_t *atime, struct file_t *file)
-{
- if (file != NULL) {
- if (file->stated == 0) {
- ap_getfileinfo(file);
- }
- *atime = file->atime;
- return APR_SUCCESS;
- }
- else {
- *atime = -1;
- return APR_ENOFILE;
- }
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_get_filectime(time_t *, ap_file_t *)
- * Return the time of the last change to the current file.
- * arg 1) The currently open file.
- * arg 2) The last change time of the file.
- */
-ap_status_t ap_get_filectime(time_t *ptime, struct file_t *file)
-{
- if (file != NULL) {
- if (file->stated == 0) {
- ap_getfileinfo(file);
- }
- *ptime = file->ctime;
- return APR_SUCCESS;
- }
- else {
- *ptime = -1;
- return APR_ENOFILE;
- }
-}
-
-/* ***APRDOC********************************************************
- * ap_status_t ap_get_filemtime(time_t *, ap_file_t *)
- * Return the last modified time of the current file.
- * arg 1) The currently open file.
- * arg 2) The last modified time of the file.
- */
-ap_status_t ap_get_filemtime(time_t *mtime, struct file_t *file)
-{
- if (file != NULL) {
- if (file->stated == 0) {
- ap_getfileinfo(file);
- }
- *mtime = file->mtime;
- return APR_SUCCESS;
- }
- else {
- *mtime = -1;
- return APR_ENOFILE;
- }
-}
-
-/* ***APRDOC********************************************************
* ap_status_t ap_get_filetype(ap_filetype_e, ap_file_t *)
* Return the type of the current file.
* arg 1) The currently open file.
* arg 2) The file type
*/
-ap_status_t ap_get_filetype(ap_filetype_e *type, struct file_t *file)
+ap_status_t ap_get_filetype(ap_filetype_e *type, ap_fileperms_t perms)
{
- if (file != NULL) {
- if (file->stated == 0) {
- ap_getfileinfo(file);
- }
- if (S_ISREG(file->protection))
- *type = APR_REG;
- if (S_ISDIR(file->protection))
- *type = APR_DIR;
- if (S_ISCHR(file->protection))
- *type = APR_CHR;
- if (S_ISBLK(file->protection))
- *type = APR_BLK;
- if (S_ISFIFO(file->protection))
- *type = APR_PIPE;
- if (S_ISLNK(file->protection))
- *type = APR_LNK;
+ if (S_ISREG(perms))
+ *type = APR_REG;
+ if (S_ISDIR(perms))
+ *type = APR_DIR;
+ if (S_ISCHR(perms))
+ *type = APR_CHR;
+ if (S_ISBLK(perms))
+ *type = APR_BLK;
+ if (S_ISFIFO(perms))
+ *type = APR_PIPE;
+ if (S_ISLNK(perms))
+ *type = APR_LNK;
#ifndef BEOS
- if (S_ISSOCK(file->protection))
- *type = APR_SOCK;
+ if (S_ISSOCK(perms))
+ *type = APR_SOCK;
#endif
- return APR_SUCCESS;
- }
- else {
- *type = APR_REG;
- return APR_ENOFILE;
- }
+ return APR_SUCCESS;
}
/* ***APRDOC********************************************************