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/08/22 10:58:11 UTC
svn commit: r806815 - in /commons/sandbox/runtime/trunk/src/main/native/os:
darwin/pmutex.c hpux/pshm.c unix/pmutex.c win32/pmutex.c win32/pshm.c
Author: mturk
Date: Sat Aug 22 08:58:11 2009
New Revision: 806815
URL: http://svn.apache.org/viewvc?rev=806815&view=rev
Log:
More EFTYPE/EBADF retvals
Modified:
commons/sandbox/runtime/trunk/src/main/native/os/darwin/pmutex.c
commons/sandbox/runtime/trunk/src/main/native/os/hpux/pshm.c
commons/sandbox/runtime/trunk/src/main/native/os/unix/pmutex.c
commons/sandbox/runtime/trunk/src/main/native/os/win32/pmutex.c
commons/sandbox/runtime/trunk/src/main/native/os/win32/pshm.c
Modified: commons/sandbox/runtime/trunk/src/main/native/os/darwin/pmutex.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/darwin/pmutex.c?rev=806815&r1=806814&r2=806815&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/darwin/pmutex.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/darwin/pmutex.c Sat Aug 22 08:58:11 2009
@@ -65,7 +65,7 @@
static int mutex_owner_cleanup(void *mutex, int type, unsigned int flags)
{
if (type == ACR_DT_MUTEX) {
- int rc = ACR_SUCCESS;
+ int rc = ACR_EBADF;
acr_pmutex_t *m = (acr_pmutex_t *)mutex;
if (m->filedes > 0) {
union semun ick;
@@ -81,12 +81,11 @@
}
ick.val = 0;
semctl(m->filedes, 0, IPC_RMID, ick);
+ rc = ACR_SUCCESS;
}
if (m->filename) {
- if (access(m->filename, F_OK)) {
- rc = ACR_SUCCESS;
- }
- else {
+ if (access(m->filename, F_OK) == 0) {
+ /* File exists. Remove it */
if (unlink(m->filename))
rc = ACR_GET_OS_ERROR();
}
@@ -95,13 +94,13 @@
free(m);
return rc;
}
- return ACR_EBADF;
+ return ACR_EFTYPE;
}
static int mutex_child_cleanup(void *mutex, int type, unsigned int flags)
{
if (type == ACR_DT_MUTEX) {
- int rc;
+ int rc = ACR_EBADF;
acr_pmutex_t *m = (acr_pmutex_t *)mutex;
if (m->filedes > 0) {
if (m->locked) {
@@ -114,9 +113,10 @@
rc = semop(m->filedes, &op, 1);
} while (rc < 0 && errno == EINTR);
}
+ rc = ACR_SUCCESS;
}
free(m);
- return ACR_SUCCESS;
+ return rc;
}
return ACR_EBADF;
}
@@ -269,9 +269,11 @@
struct sembuf op;
acr_pmutex_t *m = (acr_pmutex_t *)ACR_IOH(mutex);
- if (IS_INVALID_HANDLE(m) || ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
- ACR_SET_OS_ERROR(ACR_EINVAL);
- return -1;
+ if (ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
+ return ACR_EFTYPE;
+ }
+ if (IS_INVALID_HANDLE(m)) {
+ return ACR_EINVAL;
}
op.sem_num = 0;
op.sem_op = -1;
@@ -294,7 +296,10 @@
struct sembuf op;
acr_pmutex_t *m = (acr_pmutex_t *)ACR_IOH(mutex);
- if (IS_INVALID_HANDLE(m) || ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
+ if (ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
+ return ACR_EFTYPE;
+ }
+ if (IS_INVALID_HANDLE(m)) {
return ACR_EINVAL;
}
op.sem_num = 0;
@@ -324,10 +329,12 @@
struct sembuf op;
acr_pmutex_t *m = (acr_pmutex_t *)ACR_IOH(mutex);
- if (IS_INVALID_HANDLE(m) || ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
+ if (ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
+ return ACR_EFTYPE;
+ }
+ if (IS_INVALID_HANDLE(m)) {
return ACR_EINVAL;
}
-
m->locked = 0;
op.sem_num = 0;
op.sem_op = 1;
@@ -349,7 +356,10 @@
struct semid_ds buf;
acr_pmutex_t *m = (acr_pmutex_t *)ACR_IOH(mutex);
- if (IS_INVALID_HANDLE(m) || ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
+ if (ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
+ return ACR_EFTYPE;
+ }
+ if (IS_INVALID_HANDLE(m)) {
return ACR_EINVAL;
}
buf.sem_perm.uid = uid;
@@ -414,31 +424,37 @@
static int mutex_cleanup(void *mutex, int type, unsigned int flags)
{
if (type == ACR_DT_MUTEX) {
- int rc = 0;
+ int rc = ACR_EBADF;
acr_pmutex_t *m = (acr_pmutex_t *)mutex;
- if (m->filedes > 0 && m->locked) {
- struct flock op;
+ if (m->filedes > 0) {
+ if (m->locked) {
+ struct flock op;
- op.l_whence = SEEK_SET; /* from current point */
- op.l_start = 0; /* -"- */
- op.l_len = 0; /* until end of file */
- op.l_type = F_UNLCK; /* unlock */
- op.l_pid = 0; /* pid not actually interesting */
- do {
- rc = fcntl(m->filedes, F_SETLKW, &op);
- } while (rc < 0 && errno == EINTR);
+ op.l_whence = SEEK_SET; /* from current point */
+ op.l_start = 0; /* -"- */
+ op.l_len = 0; /* until end of file */
+ op.l_type = F_UNLCK; /* unlock */
+ op.l_pid = 0; /* pid not actually interesting */
+ do {
+ rc = fcntl(m->filedes, F_SETLKW, &op);
+ } while (rc < 0 && errno == EINTR);
- }
- if (m->filedes > 0)
+ }
close(m->filedes);
+ rc = ACR_SUCCESS;
+ }
if (m->filename) {
- unlink(m->filename);
+ if (access(m->filename, F_OK) == 0) {
+ /* File exists. Remove it */
+ if (unlink(m->filename))
+ rc = ACR_GET_OS_ERROR();
+ }
free((void *)(m->filename));
}
free(m);
return rc;
}
- return ACR_EBADF;
+ return ACR_EFTYPE;
}
ACR_DECLARE(int) ACR_ProcMutexCreate(JNIEnv *_E, const acr_pchar_t *fname)
@@ -524,10 +540,12 @@
struct flock op;
acr_pmutex_t *m = (acr_pmutex_t *)ACR_IOH(mutex);
- if (IS_INVALID_HANDLE(m) || ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
- return ACR_EINVAL;
+ if (ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
+ return ACR_EFTYPE;
+ }
+ if (IS_INVALID_HANDLE(m)) {
+ return ACR_EBADF;
}
-
op.l_whence = SEEK_SET; /* from current point */
op.l_start = 0; /* -"- */
op.l_len = 0; /* until end of file */
@@ -552,8 +570,11 @@
struct flock op;
acr_pmutex_t *m = (acr_pmutex_t *)ACR_IOH(mutex);
- if (IS_INVALID_HANDLE(m) || ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
- return ACR_EINVAL;
+ if (ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
+ return ACR_EFTYPE;
+ }
+ if (IS_INVALID_HANDLE(m)) {
+ return ACR_EBADF;
}
op.l_whence = SEEK_SET; /* from current point */
op.l_start = 0; /* -"- */
@@ -582,10 +603,12 @@
struct flock op;
acr_pmutex_t *m = (acr_pmutex_t *)ACR_IOH(mutex);
- if (IS_INVALID_HANDLE(m) || ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
- return ACR_EINVAL;
+ if (ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
+ return ACR_EFTYPE;
+ }
+ if (IS_INVALID_HANDLE(m)) {
+ return ACR_EBADF;
}
-
m->locked = 0;
op.l_whence = SEEK_SET; /* from current point */
op.l_start = 0; /* -"- */
@@ -607,8 +630,11 @@
{
acr_pmutex_t *m = (acr_pmutex_t *)ACR_IOH(mutex);
- if (IS_INVALID_HANDLE(m) || ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
- return ACR_EINVAL;
+ if (ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
+ return ACR_EFTYPE;
+ }
+ if (IS_INVALID_HANDLE(m)) {
+ return ACR_EBADF;
}
if (!(perms & ACR_FPROT_GSETID))
gid = -1;
@@ -634,10 +660,15 @@
ACR_DECLARE(int) ACR_ProcMutexClose(JNIEnv *_E, int mutex)
{
+ int rc;
- /* Close will call the cleanup function
- */
- return acr_ioh_close(mutex);
+ if (ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
+ ACR_THROW_EX_IF_ERR(ACR_EX_EINVAL, ACR_EFTYPE);
+ return ACR_EFTYPE;
+ }
+ rc = acr_ioh_close(mutex);
+ ACR_THROW_IO_IF_ERR(rc);
+ return rc;
}
ACR_CLASS_LDEF(Mutex)
Modified: commons/sandbox/runtime/trunk/src/main/native/os/hpux/pshm.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/hpux/pshm.c?rev=806815&r1=806814&r2=806815&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/hpux/pshm.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/hpux/pshm.c Sat Aug 22 08:58:11 2009
@@ -75,7 +75,7 @@
acr_shm_t *m = (acr_shm_t *)shm;
if (type != ACR_DT_SHM) {
- return ACR_EINVAL;
+ return ACR_EFTYPE;
}
/* Anonymous shared memory or
* we are calling this from forked child.
@@ -99,10 +99,8 @@
rc = ACR_GET_OS_ERROR();
goto finally;
}
- if (access(m->filename, F_OK)) {
- rc = ACR_SUCCESS;
- }
- else {
+ if (access(m->filename, F_OK) == 0) {
+ /* File exists. Remove it */
if (unlink(m->filename))
rc = ACR_GET_OS_ERROR();
}
@@ -119,7 +117,7 @@
acr_shm_t *m = (acr_shm_t *)shm;
if (type != ACR_DT_SHM) {
- return ACR_EINVAL;
+ return ACR_EFTYPE;
}
if (m->filename == NULL) {
@@ -140,11 +138,15 @@
ACR_DECLARE(int) ACR_ShmClose(JNIEnv *_E, int shm)
{
- int rv;
+ int rc;
- rv = acr_ioh_close(shm);
- ACR_THROW_IO_IF_ERR(rv);
- return rv;
+ if (ACR_IOH_TYPE(shm) != ACR_DT_SHM) {
+ ACR_THROW_EX_IF_ERR(ACR_EX_EINVAL, ACR_EFTYPE);
+ return ACR_EFTYPE;
+ }
+ rc = acr_ioh_close(shm);
+ ACR_THROW_IO_IF_ERR(rc);
+ return rc;
}
ACR_DECLARE(int) ACR_ShmRemove(JNIEnv *_E, const acr_pchar_t *filename)
@@ -424,8 +426,12 @@
int rc = 0;
acr_shm_t *m = (acr_shm_t *)ACR_IOH(shm);
- if (IS_INVALID_HANDLE(m) || ACR_IOH_TYPE(shm) != ACR_DT_SHM) {
- rc = ACR_EINVAL;
+ if (ACR_IOH_TYPE(shm) != ACR_DT_SHM) {
+ rc = ACR_EFTYPE;
+ goto finally;
+ }
+ if (IS_INVALID_HANDLE(m)) {
+ rc = ACR_EBADF;
goto finally;
}
x_free((void *)(m->filename));
@@ -445,12 +451,12 @@
int shmid;
acr_shm_t *m = (acr_shm_t *)ACR_IOH(shm);
- if (IS_INVALID_HANDLE(m) || ACR_IOH_TYPE(shm) != ACR_DT_SHM) {
- rc = ACR_EINVAL;
+ if (ACR_IOH_TYPE(shm) != ACR_DT_SHM) {
+ rc = ACR_EFTYPE;
goto finally;
}
- if ((shmid = shmget(m->shmkey, 0, SHM_R | SHM_W)) == -1) {
- rc = ACR_GET_OS_ERROR();
+ if (IS_INVALID_HANDLE(m)) {
+ rc = ACR_EBADF;
goto finally;
}
shmbuf.shm_perm.uid = uid;
@@ -470,8 +476,12 @@
{
acr_shm_t *m = (acr_shm_t *)ACR_IOH(shm);
- if (IS_INVALID_HANDLE(m) || ACR_IOH_TYPE(shm) != ACR_DT_SHM) {
- ACR_SET_OS_ERROR(ACR_EINVAL);
+ if (ACR_IOH_TYPE(shm) != ACR_DT_SHM) {
+ ACR_SET_OS_ERROR(ACR_EFTYPE);
+ return NULL;
+ }
+ else if (IS_INVALID_HANDLE(m)) {
+ ACR_SET_OS_ERROR(ACR_EBADF);
return NULL;
}
else
@@ -481,8 +491,12 @@
ACR_DECLARE(acr_size_t) ACR_ShmGetSize(int shm)
{
acr_shm_t *m = (acr_shm_t *)ACR_IOH(shm);
- if (IS_INVALID_HANDLE(m) || ACR_IOH_TYPE(shm) != ACR_DT_SHM) {
- ACR_SET_OS_ERROR(ACR_EINVAL);
+ if (ACR_IOH_TYPE(shm) != ACR_DT_SHM) {
+ ACR_SET_OS_ERROR(ACR_EFTYPE);
+ return 0;
+ }
+ else if (IS_INVALID_HANDLE(m)) {
+ ACR_SET_OS_ERROR(ACR_EBADF);
return 0;
}
else
Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/pmutex.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/pmutex.c?rev=806815&r1=806814&r2=806815&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/pmutex.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/pmutex.c Sat Aug 22 08:58:11 2009
@@ -84,28 +84,26 @@
static int mutex_owner_cleanup(void *mutex, int type, unsigned int flags)
{
if (type == ACR_DT_MUTEX) {
- int rc = ACR_SUCCESS;
+ int rc = ACR_EBADF;
acr_pmutex_t *m = (acr_pmutex_t *)mutex;
if (m->filedes > 0) {
union semun ick;
if (m->locked) {
- int rr;
struct sembuf op;
/* Unlock our instance */
op.sem_num = 0;
op.sem_op = 1;
op.sem_flg = SEM_UNDO;
do {
- rr = semop(m->filedes, &op, 1);
- } while (rr < 0 && errno == EINTR);
+ rc = semop(m->filedes, &op, 1);
+ } while (rc < 0 && errno == EINTR);
}
ick.val = 0;
semctl(m->filedes, 0, IPC_RMID, ick);
+ rc = ACR_SUCCESS;
}
- else
- rc = ACR_EBADF;
if (m->filename) {
- if (!access(m->filename, F_OK)) {
+ if (access(m->filename, F_OK) == 0) {
/* File exists. Remove it */
if (unlink(m->filename))
rc = ACR_GET_OS_ERROR();
@@ -121,7 +119,7 @@
static int mutex_child_cleanup(void *mutex, int type, unsigned int flags)
{
if (type == ACR_DT_MUTEX) {
- int rc = ACR_SUCCESS;
+ int rc = ACR_EBADF;
acr_pmutex_t *m = (acr_pmutex_t *)mutex;
if (m->filedes > 0) {
if (m->locked) {
@@ -134,9 +132,8 @@
rc = semop(m->filedes, &op, 1);
} while (rc < 0 && errno == EINTR);
}
+ rc = ACR_SUCCESS;
}
- else
- rc = ACR_EBADF;
free(m);
return rc;
}
@@ -295,7 +292,7 @@
return ACR_EFTYPE;
}
if (IS_INVALID_HANDLE(m)) {
- return ACR_EINVAL;
+ return ACR_EBADF;
}
op.sem_num = 0;
op.sem_op = -1;
@@ -322,7 +319,7 @@
return ACR_EFTYPE;
}
if (IS_INVALID_HANDLE(m)) {
- return ACR_EINVAL;
+ return ACR_EBADF;
}
op.sem_num = 0;
op.sem_op = -1;
@@ -355,7 +352,7 @@
return ACR_EFTYPE;
}
if (IS_INVALID_HANDLE(m)) {
- return ACR_EINVAL;
+ return ACR_EBADF;
}
m->locked = 0;
@@ -383,7 +380,7 @@
return ACR_EFTYPE;
}
if (IS_INVALID_HANDLE(m)) {
- return ACR_EINVAL;
+ return ACR_EBADF;
}
buf.sem_perm.uid = uid;
buf.sem_perm.gid = gid;
@@ -570,7 +567,7 @@
return ACR_EFTYPE;
}
if (IS_INVALID_HANDLE(m)) {
- return ACR_EINVAL;
+ return ACR_EBADF;
}
do {
rc = sem_wait(m->sem);
@@ -592,7 +589,7 @@
return ACR_EFTYPE;
}
if (IS_INVALID_HANDLE(m)) {
- return ACR_EINVAL;
+ return ACR_EBADF;
}
do {
rc = sem_trywait(m->sem);
@@ -617,7 +614,7 @@
return ACR_EFTYPE;
}
if (IS_INVALID_HANDLE(m)) {
- return ACR_EINVAL;
+ return ACR_EBADF;
}
m->locked = 0;
@@ -640,7 +637,7 @@
return ACR_EFTYPE;
}
if (IS_INVALID_HANDLE(m)) {
- return ACR_EINVAL;
+ return ACR_EBADF;
}
return ACR_ENOTIMPL;
}
@@ -692,10 +689,15 @@
ACR_DECLARE(int) ACR_ProcMutexClose(JNIEnv *_E, int mutex)
{
+ int rc;
- /* Close will call the cleanup function
- */
- return acr_ioh_close(mutex);
+ if (ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
+ ACR_THROW_EX_IF_ERR(ACR_EX_EINVAL, ACR_EFTYPE);
+ return ACR_EFTYPE;
+ }
+ rc = acr_ioh_close(mutex);
+ ACR_THROW_IO_IF_ERR(rc);
+ return rc;
}
ACR_DECLARE(jobject) ACR_ProcMutexObjectCreate(JNIEnv *_E,
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/pmutex.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/pmutex.c?rev=806815&r1=806814&r2=806815&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/pmutex.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/pmutex.c Sat Aug 22 08:58:11 2009
@@ -40,11 +40,14 @@
static int mutex_cleanup(void *mutex, int type, unsigned int flags)
{
if (type == ACR_DT_MUTEX) {
- if (IS_VALID_HANDLE(mutex))
+ if (IS_VALID_HANDLE(mutex)) {
CloseHandle(mutex);
- return ACR_SUCCESS;
+ return ACR_SUCCESS;
+ }
+ else
+ return ACR_EBADF;
}
- return ACR_EBADF;
+ return ACR_EFTYPE;
}
ACR_DECLARE(int) ACR_ProcMutexCreate(JNIEnv *_E, const acr_pchar_t *fname)
@@ -118,8 +121,11 @@
wh[0] = (HANDLE)ACR_IOH(mutex);
wh[1] = dll_psig_handle;
- if (IS_INVALID_HANDLE(wh[0]) || ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
- return ACR_EINVAL;
+ if (ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
+ return ACR_EFTYPE;
+ }
+ if (IS_INVALID_HANDLE(m)) {
+ return ACR_EBADF;
}
do {
rc = 0;
@@ -153,8 +159,11 @@
int rc;
HANDLE m = (HANDLE)ACR_IOH(mutex);
- if (IS_INVALID_HANDLE(m) || ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
- return ACR_EINVAL;
+ if (ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
+ return ACR_EFTYPE;
+ }
+ if (IS_INVALID_HANDLE(m)) {
+ return ACR_EBADF;
}
rc = WaitForSingleObject(m, 0);
@@ -171,10 +180,12 @@
{
HANDLE m = (HANDLE)ACR_IOH(mutex);
- if (IS_INVALID_HANDLE(m) || ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
- return ACR_EINVAL;
+ if (ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
+ return ACR_EFTYPE;
+ }
+ if (IS_INVALID_HANDLE(m)) {
+ return ACR_EBADF;
}
-
if (ReleaseMutex(m) == 0) {
return ACR_GET_OS_ERROR();
}
@@ -186,18 +197,26 @@
{
HANDLE m = (HANDLE)ACR_IOH(mutex);
- if (IS_INVALID_HANDLE(m) || ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
- return ACR_EINVAL;
+ if (ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
+ return ACR_EFTYPE;
+ }
+ if (IS_INVALID_HANDLE(m)) {
+ return ACR_EBADF;
}
return ACR_ENOTIMPL;
}
ACR_DECLARE(int) ACR_ProcMutexClose(JNIEnv *_E, int mutex)
{
+ int rc;
- /* Close will call the cleanup function
- */
- return acr_ioh_close(mutex);
+ if (ACR_IOH_TYPE(mutex) != ACR_DT_MUTEX) {
+ ACR_THROW_EX_IF_ERR(ACR_EX_EINVAL, ACR_EFTYPE);
+ return ACR_EINVAL;
+ }
+ rc = acr_ioh_close(mutex);
+ ACR_THROW_IO_IF_ERR(rc);
+ return rc;
}
ACR_CLASS_LDEF(Mutex)
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/pshm.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/pshm.c?rev=806815&r1=806814&r2=806815&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/pshm.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/pshm.c Sat Aug 22 08:58:11 2009
@@ -85,15 +85,15 @@
ACR_DECLARE(int) ACR_ShmClose(JNIEnv *_E, int shm)
{
- int rv;
+ int rc;
if (ACR_IOH_TYPE(dso) != ACR_DT_SHM) {
ACR_THROW_EX_IF_ERR(ACR_EX_EINVAL, ACR_EFTYPE);
- return ACR_EINVAL;
+ return ACR_EFTYPE;
}
- rv = acr_ioh_close(shm);
- ACR_THROW_IO_IF_ERR(rv);
- return rv;
+ rc = acr_ioh_close(shm);
+ ACR_THROW_IO_IF_ERR(rc);
+ return rc;
}
ACR_DECLARE(int) ACR_ShmRemove(JNIEnv *_E, const acr_pchar_t *filename)
@@ -320,7 +320,7 @@
goto finally;
}
if (IS_INVALID_HANDLE(m)) {
- rc = ACR_EINVAL;
+ rc = ACR_EBADF;
goto finally;
}
x_free((void *)(m->filename));
@@ -344,7 +344,7 @@
goto finally;
}
if (IS_INVALID_HANDLE(m)) {
- rc = ACR_EINVAL;
+ rc = ACR_EBADF;
goto finally;
}
@@ -362,7 +362,7 @@
return NULL;
}
else if (IS_INVALID_HANDLE(m)) {
- ACR_SET_OS_ERROR(ACR_EINVAL);
+ ACR_SET_OS_ERROR(ACR_EBADF);
return NULL;
}
else
@@ -377,7 +377,7 @@
return 0;
}
else if (IS_INVALID_HANDLE(m)) {
- ACR_SET_OS_ERROR(ACR_EINVAL);
+ ACR_SET_OS_ERROR(ACR_EBADF);
return 0;
}
else