You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/09/07 16:33:17 UTC

svn commit: r812155 - in /commons/sandbox/runtime/trunk/src/main/native/os: darwin/mutex.c hpux/shm.c unix/file.c unix/mutex.c unix/sema.c unix/shm.c win32/mutex.c win32/sema.c win32/shm.c

Author: mturk
Date: Mon Sep  7 14:33:17 2009
New Revision: 812155

URL: http://svn.apache.org/viewvc?rev=812155&view=rev
Log:
Implement perm setter API for mutex, shm and semaphore

Modified:
    commons/sandbox/runtime/trunk/src/main/native/os/darwin/mutex.c
    commons/sandbox/runtime/trunk/src/main/native/os/hpux/shm.c
    commons/sandbox/runtime/trunk/src/main/native/os/unix/file.c
    commons/sandbox/runtime/trunk/src/main/native/os/unix/mutex.c
    commons/sandbox/runtime/trunk/src/main/native/os/unix/sema.c
    commons/sandbox/runtime/trunk/src/main/native/os/unix/shm.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/mutex.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/sema.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c

Modified: commons/sandbox/runtime/trunk/src/main/native/os/darwin/mutex.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/darwin/mutex.c?rev=812155&r1=812154&r2=812155&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/darwin/mutex.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/darwin/mutex.c Mon Sep  7 14:33:17 2009
@@ -794,3 +794,22 @@
     return rc;
 }
 
+ACR_JNI_EXPORT_DECLARE(jboolean, Mutex, chown0)(ACR_JNISTDARGS,
+                                                jobject mtxd, jint perms,
+                                                jobject usr, jobject grp)
+{
+    int ex = ACR_EINVAL;
+    int mutex;
+
+    UNREFERENCED_O;
+    mutex = ACR_DescriptorGetInt(_E, mtxd);
+    if (mutex > 0) {
+        uid_t susr = ACR_DescriptorGetInt(_E, usr);
+        gid_t sgrp = ACR_DescriptorGetInt(_E, grp);
+        ex = ACR_ProcMutexPermSet(_E, mutex, perms, susr, sgrp);
+    }
+    if (ex != ACR_ENOTIMPL) {
+        ACR_THROW_IO_IF_ERR(ex);
+    }
+    return ex == 0 ? JNI_TRUE : JNI_FALSE;
+}

Modified: commons/sandbox/runtime/trunk/src/main/native/os/hpux/shm.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/hpux/shm.c?rev=812155&r1=812154&r2=812155&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/hpux/shm.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/hpux/shm.c Mon Sep  7 14:33:17 2009
@@ -624,3 +624,22 @@
     return rc;
 }
 
+ACR_JNI_EXPORT_DECLARE(jboolean, SharedMemory, chown0)(ACR_JNISTDARGS,
+                                                       jobject shmd, jint perms,
+                                                       jobject usr, jobject grp)
+{
+    int ex = ACR_EINVAL;
+    int shm;
+
+    UNREFERENCED_O;
+    shm = ACR_DescriptorGetInt(_E, shmd);
+    if (shm > 0) {
+        uid_t susr = ACR_DescriptorGetInt(_E, usr);
+        gid_t sgrp = ACR_DescriptorGetInt(_E, grp);
+        ex = ACR_ShmPermSet(_E, shm, perms, susr, sgrp);
+    }
+    if (ex != ACR_ENOTIMPL) {
+        ACR_THROW_IO_IF_ERR(ex);
+    }
+    return ex == 0 ? JNI_TRUE : JNI_FALSE;
+}

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/file.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/file.c?rev=812155&r1=812154&r2=812155&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/file.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/file.c Mon Sep  7 14:33:17 2009
@@ -345,7 +345,7 @@
 ACR_IO_EXPORT_DECLARE(jboolean, File, fprot2)(ACR_JNISTDARGS, jstring pathname,
                                               jobject usr, jobject grp)
 {
-    int ex = EINVAL;
+    int ex = ACR_EINVAL;
 
     UNREFERENCED_O;
     WITH_CSTR(pathname) {

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/mutex.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/mutex.c?rev=812155&r1=812154&r2=812155&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/mutex.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/mutex.c Mon Sep  7 14:33:17 2009
@@ -785,3 +785,22 @@
     return rc;
 }
 
+ACR_JNI_EXPORT_DECLARE(jboolean, Mutex, chown0)(ACR_JNISTDARGS,
+                                                jobject mtxd, jint perms,
+                                                jobject usr, jobject grp)
+{
+    int ex = ACR_EINVAL;
+    int mutex;
+
+    UNREFERENCED_O;
+    mutex = ACR_DescriptorGetInt(_E, mtxd);
+    if (mutex > 0) {
+        uid_t susr = ACR_DescriptorGetInt(_E, usr);
+        gid_t sgrp = ACR_DescriptorGetInt(_E, grp);
+        ex = ACR_ProcMutexPermSet(_E, mutex, perms, susr, sgrp);
+    }
+    if (ex != ACR_ENOTIMPL) {
+        ACR_THROW_IO_IF_ERR(ex);
+    }
+    return ex == 0 ? JNI_TRUE : JNI_FALSE;
+}

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/sema.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/sema.c?rev=812155&r1=812154&r2=812155&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/sema.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/sema.c Mon Sep  7 14:33:17 2009
@@ -447,3 +447,23 @@
     return rc;
 }
 
+ACR_JNI_EXPORT_DECLARE(jboolean, Semaphore, chown0)(ACR_JNISTDARGS,
+                                                    jobject semd, jint perms,
+                                                    jobject usr, jobject grp)
+{
+    int ex = ACR_EINVAL;
+    int sema;
+
+    UNREFERENCED_O;
+    sema = ACR_DescriptorGetInt(_E, semd);
+    if (sema > 0) {
+        uid_t susr = ACR_DescriptorGetInt(_E, usr);
+        gid_t sgrp = ACR_DescriptorGetInt(_E, grp);
+        ex = ACR_SemaphorePermSet(_E, sema, perms, susr, sgrp);
+    }
+    if (ex != ACR_ENOTIMPL) {
+        ACR_THROW_IO_IF_ERR(ex);
+    }
+    return ex == 0 ? JNI_TRUE : JNI_FALSE;
+}
+

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/shm.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/shm.c?rev=812155&r1=812154&r2=812155&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/shm.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/shm.c Mon Sep  7 14:33:17 2009
@@ -604,3 +604,22 @@
     return rc;
 }
 
+ACR_JNI_EXPORT_DECLARE(jboolean, SharedMemory, chown0)(ACR_JNISTDARGS,
+                                                       jobject shmd, jint perms,
+                                                       jobject usr, jobject grp)
+{
+    int ex = ACR_EINVAL;
+    int shm;
+
+    UNREFERENCED_O;
+    shm = ACR_DescriptorGetInt(_E, shmd);
+    if (shm > 0) {
+        uid_t susr = ACR_DescriptorGetInt(_E, usr);
+        gid_t sgrp = ACR_DescriptorGetInt(_E, grp);
+        ex = ACR_ShmPermSet(_E, shm, perms, susr, sgrp);
+    }
+    if (ex != ACR_ENOTIMPL) {
+        ACR_THROW_IO_IF_ERR(ex);
+    }
+    return ex == 0 ? JNI_TRUE : JNI_FALSE;
+}

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/mutex.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/mutex.c?rev=812155&r1=812154&r2=812155&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/mutex.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/mutex.c Mon Sep  7 14:33:17 2009
@@ -340,3 +340,22 @@
     return ACR_ENOTIMPL;
 }
 
+ACR_JNI_EXPORT_DECLARE(jboolean, Mutex, chown0)(ACR_JNISTDARGS,
+                                                jobject mtxd, jint perms,
+                                                jobject usr, jobject grp)
+{
+    int ex = ACR_EINVAL;
+    int mutex;
+
+    UNREFERENCED_O;
+    mutex = ACR_DescriptorGetInt(_E, mtxd);
+    if (mutex > 0) {
+        PSID susr = ACR_DescriptorGetPtr(_E, usr);
+        PSID sgrp = ACR_DescriptorGetPtr(_E, grp);
+        ex = ACR_ProcMutexPermSet(_E, mutex, perms, susr, sgrp);
+    }
+    if (ex != ACR_ENOTIMPL) {
+        ACR_THROW_IO_IF_ERR(ex);
+    }
+    return ex == 0 ? JNI_TRUE : JNI_FALSE;
+}

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/sema.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/sema.c?rev=812155&r1=812154&r2=812155&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/sema.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/sema.c Mon Sep  7 14:33:17 2009
@@ -396,3 +396,23 @@
     return rc;
 }
 
+ACR_JNI_EXPORT_DECLARE(jboolean, Semaphore, chown0)(ACR_JNISTDARGS,
+                                                    jobject semd, jint perms,
+                                                    jobject usr, jobject grp)
+{
+    int ex = ACR_EINVAL;
+    int sema;
+
+    UNREFERENCED_O;
+    sema = ACR_DescriptorGetInt(_E, semd);
+    if (sema > 0) {
+        PSID susr = ACR_DescriptorGetPtr(_E, usr);
+        PSID sgrp = ACR_DescriptorGetPtr(_E, grp);
+        ex = ACR_SemaphorePermSet(_E, sema, perms, susr, sgrp);
+    }
+    if (ex != ACR_ENOTIMPL) {
+        ACR_THROW_IO_IF_ERR(ex);
+    }
+    return ex == 0 ? JNI_TRUE : JNI_FALSE;
+}
+

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c?rev=812155&r1=812154&r2=812155&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c Mon Sep  7 14:33:17 2009
@@ -506,3 +506,22 @@
     return rc;
 }
 
+ACR_JNI_EXPORT_DECLARE(jboolean, SharedMemory, chown0)(ACR_JNISTDARGS,
+                                                       jobject shmd, jint perms,
+                                                       jobject usr, jobject grp)
+{
+    int ex = ACR_EINVAL;
+    int shm;
+
+    UNREFERENCED_O;
+    shm = ACR_DescriptorGetInt(_E, shmd);
+    if (shm > 0) {
+        PSID susr = ACR_DescriptorGetPtr(_E, usr);
+        PSID sgrp = ACR_DescriptorGetPtr(_E, grp);
+        ex = ACR_ShmPermSet(_E, shm, perms, susr, sgrp);
+    }
+    if (ex != ACR_ENOTIMPL) {
+        ACR_THROW_IO_IF_ERR(ex);
+    }
+    return ex == 0 ? JNI_TRUE : JNI_FALSE;
+}