diff options
Diffstat (limited to 'file_io/beos')
-rw-r--r-- | file_io/beos/Makefile.in | 78 | ||||
-rw-r--r-- | file_io/beos/dir.c | 220 | ||||
-rw-r--r-- | file_io/beos/fileacc.c | 164 | ||||
-rw-r--r-- | file_io/beos/filedup.c | 82 | ||||
-rw-r--r-- | file_io/beos/fileio.h | 100 | ||||
-rw-r--r-- | file_io/beos/filestat.c | 99 | ||||
-rw-r--r-- | file_io/beos/open.c | 166 | ||||
-rw-r--r-- | file_io/beos/pipe.c | 94 | ||||
-rw-r--r-- | file_io/beos/readwrite.c | 112 | ||||
-rw-r--r-- | file_io/beos/seek.c | 74 |
10 files changed, 0 insertions, 1189 deletions
diff --git a/file_io/beos/Makefile.in b/file_io/beos/Makefile.in deleted file mode 100644 index dc09ff79f..000000000 --- a/file_io/beos/Makefile.in +++ /dev/null @@ -1,78 +0,0 @@ -#CFLAGS=$(OPTIM) $(CFLAGS1) $(EXTRA_CFLAGS) -#LIBS=$(EXTRA_LIBS) $(LIBS1) -#INCLUDES=$(INCLUDES1) $(INCLUDES0) $(EXTRA_INCLUDES) -#LDFLAGS=$(LDFLAGS1) $(EXTRA_LDFLAGS) - -CC=@CC@ -RANLIB=@RANLIB@ -CFLAGS=@CFLAGS@ @OPTIM@ -LIBS=@LIBS@ -LDFLAGS=@LDFLAGS@ $(LIBS) -INCDIR=../../inc -INCDIR1=../../include -INCLUDES=-I$(INCDIR) -I$(INCDIR1) -I. - -LIB=../libfile.a - -OBJS=dir.o \ - fileacc.o \ - filedup.o \ - filestat.o \ - open.o \ - pipe.o \ - readwrite.o \ - seek.o - -.c.o: - $(CC) $(CFLAGS) -c $(INCLUDES) $< - -all: $(LIB) - -clean: - $(RM) -f *.o *.a *.so - -distclean: clean - -$(RM) -f Makefile - -$(OBJS): Makefile - -$(LIB): $(OBJS) - $(RM) -f $@ - $(AR) cr $@ $(OBJS) - $(RANLIB) $@ - -# -# We really don't expect end users to use this rule. It works only with -# gcc, and rebuilds Makefile.tmpl. You have to re-run Configure after -# using it. -# -depend: - cp Makefile.in Makefile.in.bak \ - && sed -ne '1,/^# DO NOT REMOVE/p' Makefile.in > Makefile.new \ - && gcc -MM $(INCLUDES) $(CFLAGS) *.c >> Makefile.new \ - && sed -e '1,$$s: $(INCDIR)/: $$(INCDIR)/:g' \ - -e '1,$$s: $(OSDIR)/: $$(OSDIR)/:g' Makefile.new \ - > Makefile.in \ - && rm Makefile.new - -# DO NOT REMOVE -dir.o: dir.c fileio.h ../../include/apr_general.h \ - ../../include/apr_errno.h ../../include/apr_file_io.h \ - $(INCDIR)/apr_lib.h $(INCDIR)/apr_config.h \ - $(INCDIR)/hsregex.h -fileacc.o: fileacc.c fileio.h ../../include/apr_general.h \ - ../../include/apr_errno.h ../../include/apr_file_io.h -filedup.o: filedup.c fileio.h ../../include/apr_general.h \ - ../../include/apr_errno.h ../../include/apr_file_io.h -filestat.o: filestat.c fileio.h ../../include/apr_general.h \ - ../../include/apr_errno.h ../../include/apr_file_io.h -open.o: open.c fileio.h ../../include/apr_general.h \ - ../../include/apr_errno.h ../../include/apr_file_io.h \ - $(INCDIR)/apr_lib.h $(INCDIR)/apr_config.h \ - $(INCDIR)/hsregex.h -pipe.o: pipe.c fileio.h ../../include/apr_general.h \ - ../../include/apr_errno.h ../../include/apr_file_io.h -readwrite.o: readwrite.c fileio.h ../../include/apr_general.h \ - ../../include/apr_errno.h ../../include/apr_file_io.h -seek.o: seek.c fileio.h ../../include/apr_general.h \ - ../../include/apr_errno.h ../../include/apr_file_io.h diff --git a/file_io/beos/dir.c b/file_io/beos/dir.c deleted file mode 100644 index 43d35ad20..000000000 --- a/file_io/beos/dir.c +++ /dev/null @@ -1,220 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include <errno.h> -#include <string.h> -#include <dirent.h> -#include <sys/stat.h> -#include "fileio.h" -#include "apr_file_io.h" -#include "apr_lib.h" - -ap_status_t dir_cleanup(void *thedir) -{ - struct dir_t *dir = thedir; - if (closedir(dir->dirstruct) ==0) { - return APR_SUCCESS; - } - else { - return errno; - } -} - -ap_status_t ap_opendir(ap_context_t *cont, const char *dirname, ap_dir_t ** new) -{ - (*new) = (struct dir_t *)ap_palloc(cont,sizeof(struct dir_t)); - - (*new)->cntxt = cont; - (*new)->dirname = strdup(dirname); - (*new)->dirstruct = opendir(dirname); - (*new)->entry = NULL; - - if ((*new)->dirstruct == NULL) { - (*new)->dirstruct = NULL; - return errno; - } - else { - ap_register_cleanup((*new)->cntxt, (void*)(*new), dir_cleanup, NULL); - return APR_SUCCESS; - } -} - -ap_status_t ap_closedir(struct dir_t *thedir) -{ - if (dir_cleanup(thedir) == APR_SUCCESS) { - ap_kill_cleanup(thedir->cntxt, thedir, dir_cleanup); - return APR_SUCCESS; - } - else { - return errno; - } -} - -ap_status_t ap_readdir(struct dir_t *thedir) -{ - thedir->entry = readdir(thedir->dirstruct); - if (thedir->entry == NULL){ - return errno; - } - return APR_SUCCESS; -} - -ap_status_t ap_rewinddir(struct dir_t *thedir) -{ - rewinddir(thedir->dirstruct); - return APR_SUCCESS; -} - -ap_status_t ap_make_dir(ap_context_t *cont, const char *path, ap_fileperms_t mode) -{ - if (mkdir(path, mode) == 0) { - return APR_SUCCESS; - } - else { - return errno; - } -} - -ap_status_t ap_remove_dir(ap_context_t *cont, const char *path) -{ - if (rmdir(path) == 0) { - return APR_SUCCESS; - } - else { - return errno; - } -} - -ap_status_t ap_dir_entry_size(struct dir_t *thedir, ap_ssize_t *size) -{ - struct stat filestat; - char *fname = NULL; - - if (thedir->entry == NULL) { - *size = -1; - return APR_ENOFILE; - } - fname = ap_pstrcat(thedir->cntxt, thedir->dirname, "/", - thedir->entry->d_name, NULL); - if (stat(fname, &filestat) == -1) { - *size = -1; - return APR_ENOSTAT; - } - - *size = filestat.st_size; - return APR_SUCCESS; -} - -ap_status_t ap_dir_entry_mtime(struct dir_t *thedir, time_t *time) -{ - struct stat filestat; - char *fname = NULL; - - if (thedir->entry == NULL) { - *time = -1; - return APR_ENOFILE; - } - - fname = ap_pstrcat(thedir->cntxt, thedir->dirname, "/", - thedir->entry->d_name, NULL); - if (stat(fname, &filestat) == -1) { - *time = -1; - return APR_ENOSTAT; - } - - *time = filestat.st_mtime; - return APR_SUCCESS; -} - -ap_status_t ap_dir_entry_ftype(struct dir_t *thedir, ap_filetype_e *type) -{ - struct stat filestat; - char *fname = NULL; - - if (thedir->entry == NULL) { - *type = APR_REG; - return APR_ENOFILE; - } - - fname = ap_pstrcat(thedir->cntxt, thedir->dirname, "/", - thedir->entry->d_name, NULL); - if (stat(fname, &filestat) == -1) { - *type = APR_REG; - return APR_ENOSTAT; - } - - if (S_ISREG(filestat.st_mode)) - *type = APR_REG; - if (S_ISDIR(filestat.st_mode)) - *type = APR_DIR; - if (S_ISCHR(filestat.st_mode)) - *type = APR_CHR; - if (S_ISBLK(filestat.st_mode)) - *type = APR_BLK; - if (S_ISFIFO(filestat.st_mode)) - *type = APR_PIPE; - if (S_ISLNK(filestat.st_mode)) - *type = APR_LNK; - /*if (S_ISSOCK(filestat.st_mode)) - *type = APR_SOCK; */ - return APR_SUCCESS; -} - -ap_status_t ap_get_dir_filename(struct dir_t *thedir, char **new) -{ - (*new) = ap_pstrdup(thedir->cntxt, thedir->entry->d_name); - return APR_SUCCESS; -} - diff --git a/file_io/beos/fileacc.c b/file_io/beos/fileacc.c deleted file mode 100644 index 901d2edc5..000000000 --- a/file_io/beos/fileacc.c +++ /dev/null @@ -1,164 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include <errno.h> -#include <string.h> -#include "fileio.h" -#include "apr_file_io.h" -#include "apr_general.h" - -/* A file to put ALL of the accessor functions for struct file_t types. */ - -ap_status_t ap_get_filename(struct file_t *thefile, char **new) -{ - if (thefile != NULL) { - *new = (char*)ap_pstrdup(thefile->cntxt, thefile->fname); - return APR_SUCCESS; - } - else { - *new = NULL; - return APR_ENOFILE; - } -} - -mode_t get_fileperms(ap_fileperms_t mode) -{ - mode_t rv = 0; - - if (mode & APR_UREAD) - rv |= S_IRUSR; - if (mode & APR_UWRITE) - rv |= S_IWUSR; - if (mode & APR_UEXECUTE) - rv |= S_IXUSR; - - if (mode & APR_GREAD) - rv |= S_IRGRP; - if (mode & APR_GWRITE) - rv |= S_IWGRP; - if (mode & APR_GEXECUTE) - rv |= S_IXGRP; - - if (mode & APR_WREAD) - rv |= S_IROTH; - if (mode & APR_WWRITE) - rv |= S_IWOTH; - if (mode & APR_WEXECUTE) - rv |= S_IXOTH; - - return rv; -} - - -ap_status_t ap_get_filesize(struct file_t *file, ap_ssize_t *size) -{ - if (file != NULL) { - *size = file->size; - return APR_SUCCESS; - } - else { - *size = -1; - return APR_ENOFILE; - } -} - -ap_status_t ap_get_fileperms(struct file_t *file, ap_fileperms_t *perm) -{ - if (file != NULL) { - *perm = file->protection; - return APR_SUCCESS; - } - else { - *perm = -1; - return APR_ENOFILE; - } -} - -ap_status_t ap_get_fileatime(struct file_t *file, time_t *time) -{ - if (file != NULL) { - *time = file->atime; - return APR_SUCCESS; - } - else { - *time = -1; - return APR_ENOFILE; - } -} - -ap_status_t ap_get_filectime(struct file_t *file, time_t *time) -{ - if (file != NULL) { - *time = file->ctime; - return APR_SUCCESS; - } - else { - *time = -1; - return APR_ENOFILE; - } -} - -ap_status_t ap_get_filemtime(struct file_t *file, time_t *time) -{ - if (file != NULL) { - *time = file->mtime; - return APR_SUCCESS; - } - else { - *time = -1; - return APR_ENOFILE; - } -} - diff --git a/file_io/beos/filedup.c b/file_io/beos/filedup.c deleted file mode 100644 index eaf465197..000000000 --- a/file_io/beos/filedup.c +++ /dev/null @@ -1,82 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include <strings.h> -#include "fileio.h" -#include "apr_file_io.h" -#include "apr_general.h" - -ap_status_t ap_dupfile(struct file_t *old_file, struct file_t **new_file) -{ - (*new_file) = (struct file_t *)ap_palloc(old_file->cntxt, - sizeof(struct file_t)); - - if ((*new_file) == NULL) { - return APR_ENOMEM; - } - (*new_file)->cntxt = old_file->cntxt; - (*new_file)->filedes = dup(old_file->filedes); - (*new_file)->fname = (char*)ap_pstrdup(old_file->cntxt, old_file->fname); - (*new_file)->buffered = old_file->buffered; - (*new_file)->protection = old_file->protection; - (*new_file)->user = old_file->user; - (*new_file)->group = old_file->group; - (*new_file)->size = old_file->size; - (*new_file)->atime = old_file->atime; - (*new_file)->mtime = old_file->mtime; - (*new_file)->ctime = old_file->ctime; - ap_register_cleanup((*new_file)->cntxt, (void *)(*new_file), file_cleanup, NULL); - return APR_SUCCESS; -} diff --git a/file_io/beos/fileio.h b/file_io/beos/fileio.h deleted file mode 100644 index 6c1e11dc3..000000000 --- a/file_io/beos/fileio.h +++ /dev/null @@ -1,100 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#ifndef FILE_IO_H -#define FILE_IO_H - -#include <sys/stat.h> -#include <sys/types.h> -#include <fcntl.h> -#include <time.h> -#include <dirent.h> -#include <sys/uio.h> -#include "apr_general.h" -#include "apr_file_io.h" -#include "apr_errno.h" - -#define ENOFILE B_ENTRY_NOT_FOUND - -struct file_t { - ap_context_t *cntxt; - int filedes; - char * fname; - int buffered; - mode_t protection; - uid_t user; - gid_t group; - off_t size; - time_t atime; - time_t mtime; - time_t ctime; -}; - -struct dir_t { - ap_context_t *cntxt; - char *dirname; - DIR *dirstruct; - struct dirent *entry; -}; - -struct iovec_t { - ap_context_t *cntxt; - struct iovec *iovec; -}; - -ap_status_t file_cleanup(void*); -mode_t get_fileperms(ap_fileperms_t); - -#endif /* ! FILE_IO_H */ diff --git a/file_io/beos/filestat.c b/file_io/beos/filestat.c deleted file mode 100644 index 0dba48711..000000000 --- a/file_io/beos/filestat.c +++ /dev/null @@ -1,99 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include "fileio.h" -#include "apr_general.h" -#include "apr_file_io.h" -#include "apr_errno.h" - -ap_status_t ap_getfileinfo(struct file_t *thefile) -{ - struct stat info; - int rv = stat(thefile->fname, &info); - - if (rv == 0) { - thefile->protection = info.st_mode; - thefile->user = info.st_uid; - thefile->group = info.st_gid; - thefile->size = info.st_size; - thefile->atime = info.st_atime; - thefile->mtime = info.st_mtime; - thefile->ctime = info.st_ctime; - return APR_SUCCESS; - } - else { - return APR_ENOSTAT; - } -} - -ap_status_t ap_updatefileinfo(struct file_t *thefile) -{ - struct stat info; - int rv = fstat(thefile->filedes, &info); - - if (rv == 0) { - thefile->protection = info.st_mode; - thefile->user = info.st_uid; - thefile->group = info.st_gid; - thefile->size = info.st_size; - thefile->atime = info.st_atime; - thefile->mtime = info.st_mtime; - thefile->ctime = info.st_ctime; - return APR_SUCCESS; - } - else { - return APR_ENOSTAT; - } -} diff --git a/file_io/beos/open.c b/file_io/beos/open.c deleted file mode 100644 index a8ccabfc8..000000000 --- a/file_io/beos/open.c +++ /dev/null @@ -1,166 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - - -// BeOS port by David Reid 23 Feb 1999 - -#include <errno.h> -#include <support/SupportDefs.h> -#include <kernel/OS.h> -#include <stdlib.h> -#include <unistd.h> -#include <stdio.h> -#include "fileio.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_lib.h" - -ap_status_t file_cleanup(void *thefile) -{ - struct file_t *file = thefile; - if (close(file->filedes) == 0) { - file->filedes = -1; - return APR_SUCCESS; - } - else { - return errno; - /* Are there any error conditions other than EINTR or EBADF? */ - } -} - -ap_status_t ap_open(ap_context_t *cont, char *fname, ap_int32_t flag, ap_fileperms_t perm, struct file_t **new) -{ - int oflags = 0; - struct stat info; - mode_t mode = get_fileperms(perm); - - (*new) = (struct file_t *)ap_palloc(cont, sizeof(struct file_t)); - - (*new)->cntxt = cont; - - if ((flag & APR_READ) && (flag & APR_WRITE)) { - oflags = B_READ_WRITE; - } - else if (flag & APR_READ) { - oflags = B_READ_ONLY; - } - else if (flag & APR_WRITE) { - oflags = B_WRITE_ONLY; - } - else { - (*new)->filedes = -1; - return APR_EACCES; - } - if (flag & APR_BUFFERED) { - (*new)->buffered = TRUE; - } - - (*new)->fname = (char*)strdup(fname); - if (flag & APR_CREATE) { - oflags |= B_CREATE_FILE; - if (flag & APR_EXCL) { - oflags |= B_FAIL_IF_EXISTS; - } - } - if ((flag & APR_EXCL) && !(flag & APR_CREATE)) { - (*new)->filedes = -1; - return APR_EACCES; - } - - if (flag & APR_APPEND) { - oflags |= B_OPEN_AT_END; - } - if (flag & APR_TRUNCATE) { - oflags |= B_ERASE_FILE; - } - - (*new)->filedes = open(fname, oflags, mode); - - if ((*new)->filedes < 0) { - (*new)->filedes = -1; - return errno; - } - if (ap_updatefileinfo(*new) == APR_SUCCESS) { - ap_register_cleanup((*new)->cntxt, (void *)(*new), - file_cleanup, NULL); - return APR_SUCCESS; - } - else { - (*new)->filedes = -1; - return APR_ENOSTAT; - } -} - -ap_status_t ap_close(struct file_t * file) -{ - if (file_cleanup(file) == APR_SUCCESS) { - ap_kill_cleanup(file->cntxt, file, file_cleanup); - return APR_SUCCESS; - } - else { - return errno; - /* Are there any error conditions other than EINTR or EBADF? */ - } -} - -ap_status_t ap_remove_file(ap_context_t *cont, char *path) -{ - if (unlink(path) == 0) { - return APR_SUCCESS; - } - else { - return errno; - } -} diff --git a/file_io/beos/pipe.c b/file_io/beos/pipe.c deleted file mode 100644 index 3641e7895..000000000 --- a/file_io/beos/pipe.c +++ /dev/null @@ -1,94 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include <errno.h> -#include <string.h> -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -#include "fileio.h" -#include "apr_file_io.h" -#include "apr_general.h" - -ap_status_t ap_create_pipe(ap_context_t *cont, struct file_t **in, struct file_t **out) -{ - int filedes[2]; - - if (pipe(filedes) == -1) { - return errno; - } - (*in) = (struct file_t *)ap_palloc(cont, sizeof(struct file_t)); - (*in)->cntxt = cont; - (*in)->filedes = filedes[0]; - (*in)->fname = (char*)ap_pstrdup(cont, "PIPE"); - - (*out) = (struct file_t *)ap_palloc(cont, sizeof(struct file_t)); - (*out)->cntxt = cont; - (*out)->filedes = filedes[1]; - (*out)->fname = (char*)ap_pstrdup(cont, "PIPE"); - - return APR_SUCCESS; -} - -ap_status_t ap_create_namedpipe(ap_context_t *cont, char *dirpath, ap_fileperms_t perm, char **new) -{ - mode_t mode = get_fileperms(perm); - - *new = tempnam(dirpath, NULL); - if (mkfifo((*new), mode) == -1) { - return errno; - } - return APR_SUCCESS; -} diff --git a/file_io/beos/readwrite.c b/file_io/beos/readwrite.c deleted file mode 100644 index 17cc15182..000000000 --- a/file_io/beos/readwrite.c +++ /dev/null @@ -1,112 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include <errno.h> -#include <unistd.h> -#include "fileio.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_errno.h" - -ap_status_t ap_read(const struct file_t *thefile, void *buf, ap_ssize_t *nbytes) -{ - ap_size_t rv; - - if (thefile->filedes < 0) { - *nbytes = -1; - return APR_EBADF; - } - - rv = read(thefile->filedes, buf, *nbytes); - - *nbytes = rv; - return APR_SUCCESS; -} - -ap_status_t ap_write(struct file_t *thefile, void * buf, ap_ssize_t *nbytes) -{ - ap_size_t rv; - struct stat info; - - if (thefile->filedes < 0) { - *nbytes = -1; - return APR_EBADF; - } - - rv = write(thefile->filedes, buf, *nbytes); - - if (stat(thefile->fname, &info) == 0) { - thefile->size = info.st_size; - thefile->atime = info.st_atime; - thefile->mtime = info.st_mtime; - thefile->ctime = info.st_ctime; - } - - *nbytes = rv; - return APR_SUCCESS; -} - -ap_status_t ap_writev(struct file_t *thefile, const struct iovec_t *vec, ap_ssize_t *iocnt) -{ - ap_ssize_t bytes; - if ((bytes = writev(thefile->filedes, vec->iovec, *iocnt)) < 0){ - *iocnt = bytes; - return errno; - } - else { - *iocnt = bytes; - return APR_SUCCESS; - } -} diff --git a/file_io/beos/seek.c b/file_io/beos/seek.c deleted file mode 100644 index 76772658f..000000000 --- a/file_io/beos/seek.c +++ /dev/null @@ -1,74 +0,0 @@ -/* ==================================================================== - * Copyright (c) 1999 The Apache Group. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * 4. The names "Apache Server" and "Apache Group" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the Apache Group - * for use in the Apache HTTP server project (http://www.apache.org/)." - * - * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Group. - * For more information on the Apache Group and the Apache HTTP server - * project, please see <http://www.apache.org/>. - * - */ - -#include <errno.h> -#include <string.h> -#include "fileio.h" -#include "apr_file_io.h" - -ap_status_t ap_seek(struct file_t *thefile, ap_seek_where_t where, ap_off_t *offset) -{ - ap_off_t rv; - rv = lseek(thefile->filedes, *offset, where); - if (rv == -1) { - *offset = -1; - return errno; - } - else { - *offset = rv; - return APR_SUCCESS; - } - -} |