You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by aa...@apache.org on 2001/10/20 01:32:43 UTC
cvs commit: httpd-2.0/os/unix unixd.c unixd.h
aaron 01/10/19 16:32:43
Modified: os/unix unixd.c unixd.h
Log:
Use the APR's new OS-specific proc mutex accessors -- they are used
here to set permissions on SysV Semaphores. MPMs will be modified to
call this new function as they are ported to the new APR lock API.
Revision Changes Path
1.41 +33 -1 httpd-2.0/os/unix/unixd.c
Index: unixd.c
===================================================================
RCS file: /home/cvs/httpd-2.0/os/unix/unixd.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- unixd.c 2001/08/23 00:15:37 1.40
+++ unixd.c 2001/10/19 23:32:43 1.41
@@ -390,7 +390,7 @@
long val;
struct semid_ds *buf;
ushort *array;
-};
+ };
#endif
union semun ick;
struct semid_ds buf;
@@ -402,6 +402,38 @@
buf.sem_perm.mode = 0600;
ick.buf = &buf;
if (semctl(oslock.crossproc, 0, IPC_SET, ick) < 0) {
+ return errno;
+ }
+ }
+#endif
+ return APR_SUCCESS;
+}
+
+AP_DECLARE(apr_status_t) unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex)
+{
+/* MPM shouldn't call us unless we're actually using a SysV sem;
+ * this is just to avoid compile issues on systems without that
+ * feature
+ */
+#if APR_HAS_SYSVSEM_SERIALIZE
+ apr_os_proc_mutex_t ospmutex;
+#if !APR_HAVE_UNION_SEMUN
+ union semun {
+ long val;
+ struct semid_ds *buf;
+ ushort *array;
+ };
+#endif
+ union semun ick;
+ struct semid_ds buf;
+
+ if (!geteuid()) {
+ apr_os_proc_mutex_get(&ospmutex, pmutex);
+ buf.sem_perm.uid = unixd_config.user_id;
+ buf.sem_perm.gid = unixd_config.group_id;
+ buf.sem_perm.mode = 0600;
+ ick.buf = &buf;
+ if (semctl(ospmutex.crossproc, 0, IPC_SET, ick) < 0) {
return errno;
}
}
1.29 +2 -0 httpd-2.0/os/unix/unixd.h
Index: unixd.h
===================================================================
RCS file: /home/cvs/httpd-2.0/os/unix/unixd.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- unixd.h 2001/09/13 20:41:15 1.28
+++ unixd.h 2001/10/19 23:32:43 1.29
@@ -70,6 +70,7 @@
#include "apr_hooks.h"
#include "apr_thread_proc.h"
#include "apr_lock.h"
+#include "apr_proc_mutex.h"
#include <pwd.h>
#include <grp.h>
@@ -118,6 +119,7 @@
const char *arg, const char * arg2, int type);
#endif
AP_DECLARE(apr_status_t) unixd_set_lock_perms(apr_lock_t *lock);
+AP_DECLARE(apr_status_t) unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex);
#ifdef HAVE_KILLPG
#define unixd_killpg(x, y) (killpg ((x), (y)))