On 02/07/2009 10:05 AM, [email protected] wrote: > Author: mturk > Date: Sat Feb 7 09:05:54 2009 > New Revision: 741862 > > URL: http://svn.apache.org/viewvc?rev=741862&view=rev > Log: > Add object perms set macros and implement them for shm and mutex > > Added: > apr/apr/trunk/include/apr_perms_set.h (with props) > Modified: > apr/apr/trunk/CHANGES > apr/apr/trunk/include/apr_global_mutex.h > apr/apr/trunk/include/apr_proc_mutex.h > apr/apr/trunk/include/apr_shm.h > apr/apr/trunk/include/apr_thread_proc.h > apr/apr/trunk/include/arch/unix/apr_arch_proc_mutex.h > apr/apr/trunk/include/arch/unix/apr_arch_shm.h > apr/apr/trunk/include/arch/unix/apr_arch_threadproc.h > apr/apr/trunk/locks/beos/proc_mutex.c > apr/apr/trunk/locks/netware/proc_mutex.c > apr/apr/trunk/locks/os2/proc_mutex.c > apr/apr/trunk/locks/unix/global_mutex.c > apr/apr/trunk/locks/unix/proc_mutex.c > apr/apr/trunk/locks/win32/proc_mutex.c > apr/apr/trunk/shmem/beos/shm.c > apr/apr/trunk/shmem/os2/shm.c > apr/apr/trunk/shmem/unix/shm.c > apr/apr/trunk/shmem/win32/shm.c > apr/apr/trunk/threadproc/beos/proc.c > apr/apr/trunk/threadproc/netware/proc.c > apr/apr/trunk/threadproc/os2/proc.c > apr/apr/trunk/threadproc/unix/proc.c > apr/apr/trunk/threadproc/win32/proc.c >
> Modified: apr/apr/trunk/locks/unix/global_mutex.c > URL: > http://svn.apache.org/viewvc/apr/apr/trunk/locks/unix/global_mutex.c?rev=741862&r1=741861&r2=741862&view=diff > ============================================================================== > --- apr/apr/trunk/locks/unix/global_mutex.c (original) > +++ apr/apr/trunk/locks/unix/global_mutex.c Sat Feb 7 09:05:54 2009 > @@ -175,4 +175,13 @@ > return apr_pool_cleanup_run(mutex->pool, mutex, global_mutex_cleanup); > } > > +APR_PERMS_SET_IMPLEMENT(global_mutex) > +{ > + apr_status_t rv; > + apr_global_mutex_t *mutex = (apr_global_mutex_t *)theglobal_mutex; > + > + rv = apr_proc_mutex_set_perms(mutex->proc_mutex, perms, uid, gid); apr_proc_mutex_set_perms is not implemented anywhere. Thus compilation fails. > + return rv; > +} > + > APR_POOL_IMPLEMENT_ACCESSOR(global_mutex) > > Modified: apr/apr/trunk/shmem/unix/shm.c > URL: > http://svn.apache.org/viewvc/apr/apr/trunk/shmem/unix/shm.c?rev=741862&r1=741861&r2=741862&view=diff > ============================================================================== > --- apr/apr/trunk/shmem/unix/shm.c (original) > +++ apr/apr/trunk/shmem/unix/shm.c Sat Feb 7 09:05:54 2009 if ((new_m->base = shmat(new_m->shmid, NULL, 0)) == (void *)-1) { > @@ -590,6 +588,28 @@ > return m->reqsize; > } > > +APR_PERMS_SET_IMPLEMENT(shm) > +{ > +#if APR_USE_SHMEM_SHMGET || APR_USE_SHMEM_SHMGET_ANON > + struct shmid_ds shmbuf; > + int shmid; > + apr_shm_t *m = (apr_shm_t *)theshm; > + > + if ((shmid = shmget(m->shmkey, 0, SHM_R | SHM_W)) == -1) { > + return errno; > + } > + shmbuf.shm_perm.uid = uid; > + shmbuf.shm_perm.gid = gid; > + shmbuf.shm_perm.mode = apr_unix_perms2mode(perms); The include for apr_unix_perms2mode is missing (arch/unix/apr_arch_file_io.h) > + if (shmctl(shmid, IPC_SET, &shmbuf) == -1) { > + return errno; > + } > + return APR_SUCCESS; > +#else > + return APR_ENOTIMPL; > +#endif > +} > + > APR_POOL_IMPLEMENT_ACCESSOR(shm) > > APR_DECLARE(apr_status_t) apr_os_shm_get(apr_os_shm_t *osshm, > Regards RĂ¼diger
