xsi_message_queue & xsi_semaphore: Downgrade a lot of traces.
Reduces syslog spam.
This commit is contained in:
@@ -491,11 +491,11 @@ _user_xsi_msgctl(int messageQueueID, int command, struct msqid_ds *buffer)
|
|||||||
MutexLocker messageQueueHashLocker(sXsiMessageQueueLock);
|
MutexLocker messageQueueHashLocker(sXsiMessageQueueLock);
|
||||||
XsiMessageQueue *messageQueue = sMessageQueueHashTable.Lookup(messageQueueID);
|
XsiMessageQueue *messageQueue = sMessageQueueHashTable.Lookup(messageQueueID);
|
||||||
if (messageQueue == NULL) {
|
if (messageQueue == NULL) {
|
||||||
TRACE_ERROR(("xsi_msgctl: message queue id %d not valid\n", messageQueueID));
|
TRACE(("xsi_msgctl: message queue id %d not valid\n", messageQueueID));
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
if (buffer != NULL && !IS_USER_ADDRESS(buffer)) {
|
if (buffer != NULL && !IS_USER_ADDRESS(buffer)) {
|
||||||
TRACE_ERROR(("xsi_msgctl: buffer address is not valid\n"));
|
TRACE(("xsi_msgctl: buffer address is not valid\n"));
|
||||||
return B_BAD_ADDRESS;
|
return B_BAD_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -517,7 +517,7 @@ _user_xsi_msgctl(int messageQueueID, int command, struct msqid_ds *buffer)
|
|||||||
switch (command) {
|
switch (command) {
|
||||||
case IPC_STAT: {
|
case IPC_STAT: {
|
||||||
if (!messageQueue->HasReadPermission()) {
|
if (!messageQueue->HasReadPermission()) {
|
||||||
TRACE_ERROR(("xsi_msgctl: calling process has not read "
|
TRACE(("xsi_msgctl: calling process has not read "
|
||||||
"permission on message queue %d, key %d\n", messageQueueID,
|
"permission on message queue %d, key %d\n", messageQueueID,
|
||||||
(int)messageQueue->IpcKey()));
|
(int)messageQueue->IpcKey()));
|
||||||
return EACCES;
|
return EACCES;
|
||||||
@@ -532,7 +532,7 @@ _user_xsi_msgctl(int messageQueueID, int command, struct msqid_ds *buffer)
|
|||||||
|
|
||||||
case IPC_SET: {
|
case IPC_SET: {
|
||||||
if (!messageQueue->HasPermission()) {
|
if (!messageQueue->HasPermission()) {
|
||||||
TRACE_ERROR(("xsi_msgctl: calling process has not permission "
|
TRACE(("xsi_msgctl: calling process has not permission "
|
||||||
"on message queue %d, key %d\n", messageQueueID,
|
"on message queue %d, key %d\n", messageQueueID,
|
||||||
(int)messageQueue->IpcKey()));
|
(int)messageQueue->IpcKey()));
|
||||||
return EPERM;
|
return EPERM;
|
||||||
@@ -543,12 +543,12 @@ _user_xsi_msgctl(int messageQueueID, int command, struct msqid_ds *buffer)
|
|||||||
return B_BAD_ADDRESS;
|
return B_BAD_ADDRESS;
|
||||||
}
|
}
|
||||||
if (msg.msg_qbytes > messageQueue->MaxBytes() && getuid() != 0) {
|
if (msg.msg_qbytes > messageQueue->MaxBytes() && getuid() != 0) {
|
||||||
TRACE_ERROR(("xsi_msgctl: user does not have permission to "
|
TRACE(("xsi_msgctl: user does not have permission to "
|
||||||
"increase the maximum number of bytes allowed on queue\n"));
|
"increase the maximum number of bytes allowed on queue\n"));
|
||||||
return EPERM;
|
return EPERM;
|
||||||
}
|
}
|
||||||
if (msg.msg_qbytes == 0) {
|
if (msg.msg_qbytes == 0) {
|
||||||
TRACE_ERROR(("xsi_msgctl: can't set msg_qbytes to 0!\n"));
|
TRACE(("xsi_msgctl: can't set msg_qbytes to 0!\n"));
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -562,7 +562,7 @@ _user_xsi_msgctl(int messageQueueID, int command, struct msqid_ds *buffer)
|
|||||||
// message queue lock itself. This prevents other process
|
// message queue lock itself. This prevents other process
|
||||||
// to try and acquire a destroyed mutex
|
// to try and acquire a destroyed mutex
|
||||||
if (!messageQueue->HasPermission()) {
|
if (!messageQueue->HasPermission()) {
|
||||||
TRACE_ERROR(("xsi_msgctl: calling process has not permission "
|
TRACE(("xsi_msgctl: calling process has not permission "
|
||||||
"on message queue %d, key %d\n", messageQueueID,
|
"on message queue %d, key %d\n", messageQueueID,
|
||||||
(int)messageQueue->IpcKey()));
|
(int)messageQueue->IpcKey()));
|
||||||
return EPERM;
|
return EPERM;
|
||||||
@@ -610,14 +610,14 @@ _user_xsi_msgget(key_t key, int flags)
|
|||||||
ipcKey = sIpcHashTable.Lookup(key);
|
ipcKey = sIpcHashTable.Lookup(key);
|
||||||
if (ipcKey == NULL || ipcKey->MessageQueueID() == -1) {
|
if (ipcKey == NULL || ipcKey->MessageQueueID() == -1) {
|
||||||
if (!(flags & IPC_CREAT)) {
|
if (!(flags & IPC_CREAT)) {
|
||||||
TRACE_ERROR(("xsi_msgget: key %d does not exist, but the "
|
TRACE(("xsi_msgget: key %d does not exist, but the "
|
||||||
"caller did not ask for creation\n", (int)key));
|
"caller did not ask for creation\n", (int)key));
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
}
|
}
|
||||||
if (ipcKey == NULL) {
|
if (ipcKey == NULL) {
|
||||||
ipcKey = new(std::nothrow) Ipc(key);
|
ipcKey = new(std::nothrow) Ipc(key);
|
||||||
if (ipcKey == NULL) {
|
if (ipcKey == NULL) {
|
||||||
TRACE_ERROR(("xsi_msgget: failed to create new Ipc object "
|
TRACE(("xsi_msgget: failed to create new Ipc object "
|
||||||
"for key %d\n", (int)key));
|
"for key %d\n", (int)key));
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
@@ -634,7 +634,7 @@ _user_xsi_msgget(key_t key, int flags)
|
|||||||
MutexLocker _(sXsiMessageQueueLock);
|
MutexLocker _(sXsiMessageQueueLock);
|
||||||
messageQueue = sMessageQueueHashTable.Lookup(messageQueueID);
|
messageQueue = sMessageQueueHashTable.Lookup(messageQueueID);
|
||||||
if (!messageQueue->HasPermission()) {
|
if (!messageQueue->HasPermission()) {
|
||||||
TRACE_ERROR(("xsi_msgget: calling process has not permission "
|
TRACE(("xsi_msgget: calling process has not permission "
|
||||||
"on message queue %d, key %d\n", messageQueue->ID(),
|
"on message queue %d, key %d\n", messageQueue->ID(),
|
||||||
(int)key));
|
(int)key));
|
||||||
return EACCES;
|
return EACCES;
|
||||||
@@ -683,7 +683,7 @@ _user_xsi_msgrcv(int messageQueueID, void *messagePointer,
|
|||||||
MutexLocker messageQueueHashLocker(sXsiMessageQueueLock);
|
MutexLocker messageQueueHashLocker(sXsiMessageQueueLock);
|
||||||
XsiMessageQueue *messageQueue = sMessageQueueHashTable.Lookup(messageQueueID);
|
XsiMessageQueue *messageQueue = sMessageQueueHashTable.Lookup(messageQueueID);
|
||||||
if (messageQueue == NULL) {
|
if (messageQueue == NULL) {
|
||||||
TRACE_ERROR(("xsi_msgrcv: message queue id %d not valid\n",
|
TRACE(("xsi_msgrcv: message queue id %d not valid\n",
|
||||||
messageQueueID));
|
messageQueueID));
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
@@ -695,13 +695,13 @@ _user_xsi_msgrcv(int messageQueueID, void *messagePointer,
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
if (!messageQueue->HasPermission()) {
|
if (!messageQueue->HasPermission()) {
|
||||||
TRACE_ERROR(("xsi_msgrcv: calling process has not permission "
|
TRACE(("xsi_msgrcv: calling process has not permission "
|
||||||
"on message queue id %d, key %d\n", messageQueueID,
|
"on message queue id %d, key %d\n", messageQueueID,
|
||||||
(int)messageQueue->IpcKey()));
|
(int)messageQueue->IpcKey()));
|
||||||
return EACCES;
|
return EACCES;
|
||||||
}
|
}
|
||||||
if (!IS_USER_ADDRESS(messagePointer)) {
|
if (!IS_USER_ADDRESS(messagePointer)) {
|
||||||
TRACE_ERROR(("xsi_msgrcv: message address is not valid\n"));
|
TRACE(("xsi_msgrcv: message address is not valid\n"));
|
||||||
return B_BAD_ADDRESS;
|
return B_BAD_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -781,7 +781,7 @@ _user_xsi_msgsnd(int messageQueueID, const void *messagePointer,
|
|||||||
MutexLocker messageQueueHashLocker(sXsiMessageQueueLock);
|
MutexLocker messageQueueHashLocker(sXsiMessageQueueLock);
|
||||||
XsiMessageQueue *messageQueue = sMessageQueueHashTable.Lookup(messageQueueID);
|
XsiMessageQueue *messageQueue = sMessageQueueHashTable.Lookup(messageQueueID);
|
||||||
if (messageQueue == NULL) {
|
if (messageQueue == NULL) {
|
||||||
TRACE_ERROR(("xsi_msgsnd: message queue id %d not valid\n",
|
TRACE(("xsi_msgsnd: message queue id %d not valid\n",
|
||||||
messageQueueID));
|
messageQueueID));
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
@@ -793,13 +793,13 @@ _user_xsi_msgsnd(int messageQueueID, const void *messagePointer,
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
if (!messageQueue->HasPermission()) {
|
if (!messageQueue->HasPermission()) {
|
||||||
TRACE_ERROR(("xsi_msgsnd: calling process has not permission "
|
TRACE(("xsi_msgsnd: calling process has not permission "
|
||||||
"on message queue id %d, key %d\n", messageQueueID,
|
"on message queue id %d, key %d\n", messageQueueID,
|
||||||
(int)messageQueue->IpcKey()));
|
(int)messageQueue->IpcKey()));
|
||||||
return EACCES;
|
return EACCES;
|
||||||
}
|
}
|
||||||
if (!IS_USER_ADDRESS(messagePointer)) {
|
if (!IS_USER_ADDRESS(messagePointer)) {
|
||||||
TRACE_ERROR(("xsi_msgsnd: message address is not valid\n"));
|
TRACE(("xsi_msgsnd: message address is not valid\n"));
|
||||||
return B_BAD_ADDRESS;
|
return B_BAD_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -699,7 +699,7 @@ _user_xsi_semget(key_t key, int numberOfSemaphores, int flags)
|
|||||||
if (ipcKey == NULL) {
|
if (ipcKey == NULL) {
|
||||||
// The ipc key does not exist. Create it and add it to the system
|
// The ipc key does not exist. Create it and add it to the system
|
||||||
if (!(flags & IPC_CREAT)) {
|
if (!(flags & IPC_CREAT)) {
|
||||||
TRACE_ERROR(("xsi_semget: key %d does not exist, but the "
|
TRACE(("xsi_semget: key %d does not exist, but the "
|
||||||
"caller did not ask for creation\n",(int)key));
|
"caller did not ask for creation\n",(int)key));
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
}
|
}
|
||||||
@@ -712,7 +712,7 @@ _user_xsi_semget(key_t key, int numberOfSemaphores, int flags)
|
|||||||
} else {
|
} else {
|
||||||
// The IPC key exist and it already has a semaphore
|
// The IPC key exist and it already has a semaphore
|
||||||
if ((flags & IPC_CREAT) && (flags & IPC_EXCL)) {
|
if ((flags & IPC_CREAT) && (flags & IPC_EXCL)) {
|
||||||
TRACE_ERROR(("xsi_semget: key %d already exist\n", (int)key));
|
TRACE(("xsi_semget: key %d already exist\n", (int)key));
|
||||||
return EEXIST;
|
return EEXIST;
|
||||||
}
|
}
|
||||||
int semaphoreSetID = ipcKey->SemaphoreSetID();
|
int semaphoreSetID = ipcKey->SemaphoreSetID();
|
||||||
@@ -720,19 +720,19 @@ _user_xsi_semget(key_t key, int numberOfSemaphores, int flags)
|
|||||||
MutexLocker semaphoreSetLocker(sXsiSemaphoreSetLock);
|
MutexLocker semaphoreSetLocker(sXsiSemaphoreSetLock);
|
||||||
semaphoreSet = sSemaphoreHashTable.Lookup(semaphoreSetID);
|
semaphoreSet = sSemaphoreHashTable.Lookup(semaphoreSetID);
|
||||||
if (semaphoreSet == NULL) {
|
if (semaphoreSet == NULL) {
|
||||||
TRACE_ERROR(("xsi_semget: calling process has no semaphore, "
|
TRACE(("xsi_semget: calling process has no semaphore, "
|
||||||
"key %d\n", (int)key));
|
"key %d\n", (int)key));
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
if (!semaphoreSet->HasPermission()) {
|
if (!semaphoreSet->HasPermission()) {
|
||||||
TRACE_ERROR(("xsi_semget: calling process has no permission "
|
TRACE(("xsi_semget: calling process has no permission "
|
||||||
"on semaphore %d, key %d\n", semaphoreSet->ID(),
|
"on semaphore %d, key %d\n", semaphoreSet->ID(),
|
||||||
(int)key));
|
(int)key));
|
||||||
return EACCES;
|
return EACCES;
|
||||||
}
|
}
|
||||||
if (numberOfSemaphores > semaphoreSet->NumberOfSemaphores()
|
if (numberOfSemaphores > semaphoreSet->NumberOfSemaphores()
|
||||||
&& numberOfSemaphores != 0) {
|
&& numberOfSemaphores != 0) {
|
||||||
TRACE_ERROR(("xsi_semget: numberOfSemaphores greater than the "
|
TRACE(("xsi_semget: numberOfSemaphores greater than the "
|
||||||
"one associated with semaphore %d, key %d\n",
|
"one associated with semaphore %d, key %d\n",
|
||||||
semaphoreSet->ID(), (int)key));
|
semaphoreSet->ID(), (int)key));
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
@@ -744,21 +744,20 @@ _user_xsi_semget(key_t key, int numberOfSemaphores, int flags)
|
|||||||
|
|
||||||
// Create a new sempahore set for this key
|
// Create a new sempahore set for this key
|
||||||
if (numberOfSemaphores <= 0
|
if (numberOfSemaphores <= 0
|
||||||
|| numberOfSemaphores >= MAX_XSI_SEMS_PER_TEAM) {
|
|| numberOfSemaphores >= MAX_XSI_SEMS_PER_TEAM) {
|
||||||
TRACE_ERROR(("xsi_semget: numberOfSemaphores out of range\n"));
|
TRACE_ERROR(("xsi_semget: numberOfSemaphores out of range\n"));
|
||||||
delete ipcKey;
|
delete ipcKey;
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
if (sXsiSemaphoreCount >= MAX_XSI_SEMAPHORE
|
if (sXsiSemaphoreCount >= MAX_XSI_SEMAPHORE
|
||||||
|| sXsiSemaphoreSetCount >= MAX_XSI_SEMAPHORE_SET) {
|
|| sXsiSemaphoreSetCount >= MAX_XSI_SEMAPHORE_SET) {
|
||||||
TRACE_ERROR(("xsi_semget: reached limit of maximum number of "
|
TRACE_ERROR(("xsi_semget: reached limit of maximum number of "
|
||||||
"semaphores allowed\n"));
|
"semaphores allowed\n"));
|
||||||
delete ipcKey;
|
delete ipcKey;
|
||||||
return ENOSPC;
|
return ENOSPC;
|
||||||
}
|
}
|
||||||
|
|
||||||
semaphoreSet = new(std::nothrow) XsiSemaphoreSet(numberOfSemaphores,
|
semaphoreSet = new(std::nothrow) XsiSemaphoreSet(numberOfSemaphores, flags);
|
||||||
flags);
|
|
||||||
if (semaphoreSet == NULL || !semaphoreSet->InitOK()) {
|
if (semaphoreSet == NULL || !semaphoreSet->InitOK()) {
|
||||||
TRACE_ERROR(("xsi_semget: failed to allocate a new xsi "
|
TRACE_ERROR(("xsi_semget: failed to allocate a new xsi "
|
||||||
"semaphore set\n"));
|
"semaphore set\n"));
|
||||||
@@ -805,13 +804,13 @@ _user_xsi_semctl(int semaphoreID, int semaphoreNumber, int command,
|
|||||||
MutexLocker setHashLocker(sXsiSemaphoreSetLock);
|
MutexLocker setHashLocker(sXsiSemaphoreSetLock);
|
||||||
XsiSemaphoreSet *semaphoreSet = sSemaphoreHashTable.Lookup(semaphoreID);
|
XsiSemaphoreSet *semaphoreSet = sSemaphoreHashTable.Lookup(semaphoreID);
|
||||||
if (semaphoreSet == NULL) {
|
if (semaphoreSet == NULL) {
|
||||||
TRACE_ERROR(("xsi_semctl: semaphore set id %d not valid\n",
|
TRACE(("xsi_semctl: semaphore set id %d not valid\n",
|
||||||
semaphoreID));
|
semaphoreID));
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
if (semaphoreNumber < 0
|
if (semaphoreNumber < 0
|
||||||
|| semaphoreNumber > semaphoreSet->NumberOfSemaphores()) {
|
|| semaphoreNumber > semaphoreSet->NumberOfSemaphores()) {
|
||||||
TRACE_ERROR(("xsi_semctl: semaphore number %d not valid for "
|
TRACE(("xsi_semctl: semaphore number %d not valid for "
|
||||||
"semaphore %d\n", semaphoreNumber, semaphoreID));
|
"semaphore %d\n", semaphoreNumber, semaphoreID));
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
@@ -838,7 +837,7 @@ _user_xsi_semctl(int semaphoreID, int semaphoreNumber, int command,
|
|||||||
switch (command) {
|
switch (command) {
|
||||||
case GETVAL: {
|
case GETVAL: {
|
||||||
if (!semaphoreSet->HasReadPermission()) {
|
if (!semaphoreSet->HasReadPermission()) {
|
||||||
TRACE_ERROR(("xsi_semctl: calling process has not permission "
|
TRACE(("xsi_semctl: calling process has not permission "
|
||||||
"on semaphore %d, key %d\n", semaphoreSet->ID(),
|
"on semaphore %d, key %d\n", semaphoreSet->ID(),
|
||||||
(int)semaphoreSet->IpcKey()));
|
(int)semaphoreSet->IpcKey()));
|
||||||
result = EACCES;
|
result = EACCES;
|
||||||
@@ -849,13 +848,13 @@ _user_xsi_semctl(int semaphoreID, int semaphoreNumber, int command,
|
|||||||
|
|
||||||
case SETVAL: {
|
case SETVAL: {
|
||||||
if (!semaphoreSet->HasPermission()) {
|
if (!semaphoreSet->HasPermission()) {
|
||||||
TRACE_ERROR(("xsi_semctl: calling process has not permission "
|
TRACE(("xsi_semctl: calling process has not permission "
|
||||||
"on semaphore %d, key %d\n", semaphoreSet->ID(),
|
"on semaphore %d, key %d\n", semaphoreSet->ID(),
|
||||||
(int)semaphoreSet->IpcKey()));
|
(int)semaphoreSet->IpcKey()));
|
||||||
result = EACCES;
|
result = EACCES;
|
||||||
} else {
|
} else {
|
||||||
if (args.val > USHRT_MAX) {
|
if (args.val > USHRT_MAX) {
|
||||||
TRACE_ERROR(("xsi_semctl: value %d out of range\n", args.val));
|
TRACE(("xsi_semctl: value %d out of range\n", args.val));
|
||||||
result = ERANGE;
|
result = ERANGE;
|
||||||
} else {
|
} else {
|
||||||
semaphore->SetValue(args.val);
|
semaphore->SetValue(args.val);
|
||||||
@@ -867,7 +866,7 @@ _user_xsi_semctl(int semaphoreID, int semaphoreNumber, int command,
|
|||||||
|
|
||||||
case GETPID: {
|
case GETPID: {
|
||||||
if (!semaphoreSet->HasReadPermission()) {
|
if (!semaphoreSet->HasReadPermission()) {
|
||||||
TRACE_ERROR(("xsi_semctl: calling process has not permission "
|
TRACE(("xsi_semctl: calling process has not permission "
|
||||||
"on semaphore %d, key %d\n", semaphoreSet->ID(),
|
"on semaphore %d, key %d\n", semaphoreSet->ID(),
|
||||||
(int)semaphoreSet->IpcKey()));
|
(int)semaphoreSet->IpcKey()));
|
||||||
result = EACCES;
|
result = EACCES;
|
||||||
@@ -878,7 +877,7 @@ _user_xsi_semctl(int semaphoreID, int semaphoreNumber, int command,
|
|||||||
|
|
||||||
case GETNCNT: {
|
case GETNCNT: {
|
||||||
if (!semaphoreSet->HasReadPermission()) {
|
if (!semaphoreSet->HasReadPermission()) {
|
||||||
TRACE_ERROR(("xsi_semctl: calling process has not permission "
|
TRACE(("xsi_semctl: calling process has not permission "
|
||||||
"on semaphore %d, key %d\n", semaphoreSet->ID(),
|
"on semaphore %d, key %d\n", semaphoreSet->ID(),
|
||||||
(int)semaphoreSet->IpcKey()));
|
(int)semaphoreSet->IpcKey()));
|
||||||
result = EACCES;
|
result = EACCES;
|
||||||
@@ -889,7 +888,7 @@ _user_xsi_semctl(int semaphoreID, int semaphoreNumber, int command,
|
|||||||
|
|
||||||
case GETZCNT: {
|
case GETZCNT: {
|
||||||
if (!semaphoreSet->HasReadPermission()) {
|
if (!semaphoreSet->HasReadPermission()) {
|
||||||
TRACE_ERROR(("xsi_semctl: calling process has not permission "
|
TRACE(("xsi_semctl: calling process has not permission "
|
||||||
"on semaphore %d, key %d\n", semaphoreSet->ID(),
|
"on semaphore %d, key %d\n", semaphoreSet->ID(),
|
||||||
(int)semaphoreSet->IpcKey()));
|
(int)semaphoreSet->IpcKey()));
|
||||||
result = EACCES;
|
result = EACCES;
|
||||||
@@ -900,7 +899,7 @@ _user_xsi_semctl(int semaphoreID, int semaphoreNumber, int command,
|
|||||||
|
|
||||||
case GETALL: {
|
case GETALL: {
|
||||||
if (!semaphoreSet->HasReadPermission()) {
|
if (!semaphoreSet->HasReadPermission()) {
|
||||||
TRACE_ERROR(("xsi_semctl: calling process has not read "
|
TRACE(("xsi_semctl: calling process has not read "
|
||||||
"permission on semaphore %d, key %d\n", semaphoreSet->ID(),
|
"permission on semaphore %d, key %d\n", semaphoreSet->ID(),
|
||||||
(int)semaphoreSet->IpcKey()));
|
(int)semaphoreSet->IpcKey()));
|
||||||
result = EACCES;
|
result = EACCES;
|
||||||
@@ -920,7 +919,7 @@ _user_xsi_semctl(int semaphoreID, int semaphoreNumber, int command,
|
|||||||
|
|
||||||
case SETALL: {
|
case SETALL: {
|
||||||
if (!semaphoreSet->HasPermission()) {
|
if (!semaphoreSet->HasPermission()) {
|
||||||
TRACE_ERROR(("xsi_semctl: calling process has not permission "
|
TRACE(("xsi_semctl: calling process has not permission "
|
||||||
"on semaphore %d, key %d\n", semaphoreSet->ID(),
|
"on semaphore %d, key %d\n", semaphoreSet->ID(),
|
||||||
(int)semaphoreSet->IpcKey()));
|
(int)semaphoreSet->IpcKey()));
|
||||||
result = EACCES;
|
result = EACCES;
|
||||||
@@ -946,7 +945,7 @@ _user_xsi_semctl(int semaphoreID, int semaphoreNumber, int command,
|
|||||||
|
|
||||||
case IPC_STAT: {
|
case IPC_STAT: {
|
||||||
if (!semaphoreSet->HasReadPermission()) {
|
if (!semaphoreSet->HasReadPermission()) {
|
||||||
TRACE_ERROR(("xsi_semctl: calling process has not read "
|
TRACE(("xsi_semctl: calling process has not read "
|
||||||
"permission on semaphore %d, key %d\n", semaphoreSet->ID(),
|
"permission on semaphore %d, key %d\n", semaphoreSet->ID(),
|
||||||
(int)semaphoreSet->IpcKey()));
|
(int)semaphoreSet->IpcKey()));
|
||||||
result = EACCES;
|
result = EACCES;
|
||||||
@@ -967,7 +966,7 @@ _user_xsi_semctl(int semaphoreID, int semaphoreNumber, int command,
|
|||||||
|
|
||||||
case IPC_SET: {
|
case IPC_SET: {
|
||||||
if (!semaphoreSet->HasPermission()) {
|
if (!semaphoreSet->HasPermission()) {
|
||||||
TRACE_ERROR(("xsi_semctl: calling process has not "
|
TRACE(("xsi_semctl: calling process has not "
|
||||||
"permission on semaphore %d, key %d\n",
|
"permission on semaphore %d, key %d\n",
|
||||||
semaphoreSet->ID(), (int)semaphoreSet->IpcKey()));
|
semaphoreSet->ID(), (int)semaphoreSet->IpcKey()));
|
||||||
result = EACCES;
|
result = EACCES;
|
||||||
@@ -990,7 +989,7 @@ _user_xsi_semctl(int semaphoreID, int semaphoreNumber, int command,
|
|||||||
// itself, this way we are sure there is not
|
// itself, this way we are sure there is not
|
||||||
// one waiting in the queue of the mutex.
|
// one waiting in the queue of the mutex.
|
||||||
if (!semaphoreSet->HasPermission()) {
|
if (!semaphoreSet->HasPermission()) {
|
||||||
TRACE_ERROR(("xsi_semctl: calling process has not "
|
TRACE(("xsi_semctl: calling process has not "
|
||||||
"permission on semaphore %d, key %d\n",
|
"permission on semaphore %d, key %d\n",
|
||||||
semaphoreSet->ID(), (int)semaphoreSet->IpcKey()));
|
semaphoreSet->ID(), (int)semaphoreSet->IpcKey()));
|
||||||
return EACCES;
|
return EACCES;
|
||||||
@@ -1037,7 +1036,7 @@ _user_xsi_semop(int semaphoreID, struct sembuf *ops, size_t numOps)
|
|||||||
MutexLocker setHashLocker(sXsiSemaphoreSetLock);
|
MutexLocker setHashLocker(sXsiSemaphoreSetLock);
|
||||||
XsiSemaphoreSet *semaphoreSet = sSemaphoreHashTable.Lookup(semaphoreID);
|
XsiSemaphoreSet *semaphoreSet = sSemaphoreHashTable.Lookup(semaphoreID);
|
||||||
if (semaphoreSet == NULL) {
|
if (semaphoreSet == NULL) {
|
||||||
TRACE_ERROR(("xsi_semop: semaphore set id %d not valid\n",
|
TRACE(("xsi_semop: semaphore set id %d not valid\n",
|
||||||
semaphoreID));
|
semaphoreID));
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
@@ -1045,12 +1044,12 @@ _user_xsi_semop(int semaphoreID, struct sembuf *ops, size_t numOps)
|
|||||||
setHashLocker.Unlock();
|
setHashLocker.Unlock();
|
||||||
|
|
||||||
if (!IS_USER_ADDRESS(ops)) {
|
if (!IS_USER_ADDRESS(ops)) {
|
||||||
TRACE_ERROR(("xsi_semop: sembuf address is not valid\n"));
|
TRACE(("xsi_semop: sembuf address is not valid\n"));
|
||||||
return B_BAD_ADDRESS;
|
return B_BAD_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numOps < 0 || numOps >= MAX_XSI_SEMS_PER_TEAM) {
|
if (numOps < 0 || numOps >= MAX_XSI_SEMS_PER_TEAM) {
|
||||||
TRACE_ERROR(("xsi_semop: numOps out of range\n"));
|
TRACE(("xsi_semop: numOps out of range\n"));
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1085,7 +1084,7 @@ _user_xsi_semop(int semaphoreID, struct sembuf *ops, size_t numOps)
|
|||||||
for (; i < numOps; i++) {
|
for (; i < numOps; i++) {
|
||||||
short semaphoreNumber = operations[i].sem_num;
|
short semaphoreNumber = operations[i].sem_num;
|
||||||
if (semaphoreNumber >= numberOfSemaphores) {
|
if (semaphoreNumber >= numberOfSemaphores) {
|
||||||
TRACE_ERROR(("xsi_semop: %" B_PRIu32 " invalid semaphore number"
|
TRACE(("xsi_semop: %" B_PRIu32 " invalid semaphore number"
|
||||||
"\n", i));
|
"\n", i));
|
||||||
result = EINVAL;
|
result = EINVAL;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user