Aloa,
APR should support those POSIX bits on systems where it makes sense. Attached
is a patch for file_io/unix, which seems to used for netware and OS/2 as
well (but seems to be ok in the first glance).
What do you think about it? If it's cool, I'd like to get it backported to 0.9
as well so we can use it (also in httpd ;)
nd
diff -Nur apr~/file_io/unix/fileacc.c apr/file_io/unix/fileacc.c
--- apr~/file_io/unix/fileacc.c
+++ apr/file_io/unix/fileacc.c
@@ -35,6 +35,8 @@
{
mode_t mode = 0;
+ if (perms & APR_USETID)
+ mode |= S_ISUID;
if (perms & APR_UREAD)
mode |= S_IRUSR;
if (perms & APR_UWRITE)
@@ -42,6 +44,8 @@
if (perms & APR_UEXECUTE)
mode |= S_IXUSR;
+ if (perms & APR_GSETID)
+ mode |= S_ISGID;
if (perms & APR_GREAD)
mode |= S_IRGRP;
if (perms & APR_GWRITE)
@@ -49,6 +53,8 @@
if (perms & APR_GEXECUTE)
mode |= S_IXGRP;
+ if (perms & APR_WSTICKY)
+ mode |= S_ISVTX;
if (perms & APR_WREAD)
mode |= S_IROTH;
if (perms & APR_WWRITE)
@@ -63,6 +69,8 @@
{
apr_fileperms_t perms = 0;
+ if (mode & S_ISUID)
+ perms |= APR_USETID;
if (mode & S_IRUSR)
perms |= APR_UREAD;
if (mode & S_IWUSR)
@@ -70,6 +78,8 @@
if (mode & S_IXUSR)
perms |= APR_UEXECUTE;
+ if (mode & S_ISGID)
+ perms |= APR_GSETID;
if (mode & S_IRGRP)
perms |= APR_GREAD;
if (mode & S_IWGRP)
@@ -77,6 +87,8 @@
if (mode & S_IXGRP)
perms |= APR_GEXECUTE;
+ if (mode & S_ISVTX)
+ perms |= APR_WSTICKY;
if (mode & S_IROTH)
perms |= APR_WREAD;
if (mode & S_IWOTH)
diff -Nur apr~/include/apr_file_info.h apr/include/apr_file_info.h
--- apr~/include/apr_file_info.h
+++ apr/include/apr_file_info.h
@@ -75,14 +75,17 @@
* @{
*/
+#define APR_USETID 0x0800 /**< set user id */
#define APR_UREAD 0x0400 /**< Read by user */
#define APR_UWRITE 0x0200 /**< Write by user */
#define APR_UEXECUTE 0x0100 /**< Execute by user */
+#define APR_GSETID 0x0080 /**< set group id */
#define APR_GREAD 0x0040 /**< Read by group */
#define APR_GWRITE 0x0020 /**< Write by group */
#define APR_GEXECUTE 0x0010 /**< Execute by group */
+#define APR_WSTICKY 0x0008 /**< Sticky bit */
#define APR_WREAD 0x0004 /**< Read by others */
#define APR_WWRITE 0x0002 /**< Write by others */
#define APR_WEXECUTE 0x0001 /**< Execute by others */