1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "apr_strings.h"
18 #include "apr_arch_file_io.h"
20 /* A file to put ALL of the accessor functions for apr_file_t types. */
22 APR_DECLARE(apr_status_t) apr_file_name_get(const char **fname,
25 *fname = thefile->fname;
29 APR_DECLARE(apr_int32_t) apr_file_flags_get(apr_file_t *f)
34 #if !defined(OS2) && !defined(WIN32)
35 mode_t apr_unix_perms2mode(apr_fileperms_t perms)
39 if (perms & APR_USETID)
41 if (perms & APR_UREAD)
43 if (perms & APR_UWRITE)
45 if (perms & APR_UEXECUTE)
48 if (perms & APR_GSETID)
50 if (perms & APR_GREAD)
52 if (perms & APR_GWRITE)
54 if (perms & APR_GEXECUTE)
58 if (perms & APR_WSTICKY)
61 if (perms & APR_WREAD)
63 if (perms & APR_WWRITE)
65 if (perms & APR_WEXECUTE)
71 apr_fileperms_t apr_unix_mode2perms(mode_t mode)
73 apr_fileperms_t perms = 0;
82 perms |= APR_UEXECUTE;
91 perms |= APR_GEXECUTE;
102 perms |= APR_WEXECUTE;
108 APR_DECLARE(apr_status_t) apr_file_data_get(void **data, const char *key,
111 return apr_pool_userdata_get(data, key, file->pool);
114 APR_DECLARE(apr_status_t) apr_file_data_set(apr_file_t *file, void *data,
116 apr_status_t (*cleanup)(void *))
118 return apr_pool_userdata_set(data, key, cleanup, file->pool);