APR_DECLARE(apr_status_t) apr_file_perms_set(const char *fname, apr_fileperms_t perms) { mode_t mode = apr_unix_perms2mode(perms); if (chmod(fname, mode) == -1) return errno; return APR_SUCCESS; }
APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *filename, apr_fileperms_t perm, apr_pool_t *pool) { mode_t mode = apr_unix_perms2mode(perm); if (mkfifo(filename, mode) == -1) { return errno; } return APR_SUCCESS; }
static apr_status_t proc_mutex_sysv_perms_set(apr_proc_mutex_t *mutex, apr_fileperms_t perms, apr_uid_t uid, apr_gid_t gid) { union semun ick; struct semid_ds buf; buf.sem_perm.uid = uid; buf.sem_perm.gid = gid; buf.sem_perm.mode = apr_unix_perms2mode(perms); ick.buf = &buf; if (semctl(mutex->os.crossproc, 0, IPC_SET, ick) < 0) { return errno; } return APR_SUCCESS; }