Be more generous with the semaphore name array size. Large enough PIDs would
lead to overwriting its bounds. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36084 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+4
-4
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2002, Intel Corporation. All rights reserved.
|
Copyright (c) 2002, Intel Corporation. All rights reserved.
|
||||||
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
||||||
This file is licensed under the GPL license. For the full content
|
This file is licensed under the GPL license. For the full content
|
||||||
of this license, see the COPYING file at the top level of this
|
of this license, see the COPYING file at the top level of this
|
||||||
source tree.
|
source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -28,12 +28,12 @@
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
sem_t *mysemp;
|
sem_t *mysemp;
|
||||||
char semname[20];
|
char semname[50];
|
||||||
|
|
||||||
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
||||||
|
|
||||||
mysemp = sem_open(semname, O_CREAT, 0700, 1) ;
|
mysemp = sem_open(semname, O_CREAT, 0700, 1) ;
|
||||||
if (mysemp == SEM_FAILED) {
|
if (mysemp == SEM_FAILED) {
|
||||||
perror(ERROR_PREFIX "sem_open");
|
perror(ERROR_PREFIX "sem_open");
|
||||||
return PTS_UNRESOLVED;
|
return PTS_UNRESOLVED;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -1,7 +1,7 @@
|
|||||||
/* Copyright (c) 2002, Intel Corporation. All rights reserved.
|
/* Copyright (c) 2002, Intel Corporation. All rights reserved.
|
||||||
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
||||||
This file is licensed under the GPL license. For the full content
|
This file is licensed under the GPL license. For the full content
|
||||||
of this license, see the COPYING file at the top level of this
|
of this license, see the COPYING file at the top level of this
|
||||||
source tree.
|
source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -28,13 +28,13 @@
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
sem_t *mysemp;
|
sem_t *mysemp;
|
||||||
char semname[20];
|
char semname[50];
|
||||||
|
|
||||||
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
||||||
|
|
||||||
mysemp = sem_open(semname, O_CREAT, 0777, 1);
|
mysemp = sem_open(semname, O_CREAT, 0777, 1);
|
||||||
|
|
||||||
if (mysemp == SEM_FAILED ) {
|
if (mysemp == SEM_FAILED ) {
|
||||||
perror(ERROR_PREFIX "sem_open");
|
perror(ERROR_PREFIX "sem_open");
|
||||||
return PTS_UNRESOLVED;
|
return PTS_UNRESOLVED;
|
||||||
}
|
}
|
||||||
@@ -47,12 +47,12 @@ int main()
|
|||||||
/* Make mysemp available for reuse */
|
/* Make mysemp available for reuse */
|
||||||
mysemp = sem_open(semname, O_CREAT, 0777, 1);
|
mysemp = sem_open(semname, O_CREAT, 0777, 1);
|
||||||
|
|
||||||
if (mysemp == SEM_FAILED ) {
|
if (mysemp == SEM_FAILED ) {
|
||||||
perror(ERROR_PREFIX "sem_open");
|
perror(ERROR_PREFIX "sem_open");
|
||||||
return PTS_UNRESOLVED;
|
return PTS_UNRESOLVED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((sem_close(mysemp)) == 0) {
|
if ((sem_close(mysemp)) == 0) {
|
||||||
puts("TEST PASSED");
|
puts("TEST PASSED");
|
||||||
sem_unlink(semname);
|
sem_unlink(semname);
|
||||||
|
|||||||
+6
-6
@@ -1,13 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2002, Intel Corporation. All rights reserved.
|
Copyright (c) 2002, Intel Corporation. All rights reserved.
|
||||||
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
||||||
This file is licensed under the GPL license. For the full content
|
This file is licensed under the GPL license. For the full content
|
||||||
of this license, see the COPYING file at the top level of this
|
of this license, see the COPYING file at the top level of this
|
||||||
source tree.
|
source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
sem_close will have no effect on the state of the semaphore if
|
sem_close will have no effect on the state of the semaphore if
|
||||||
sem_unlink has been unsuccessful.
|
sem_unlink has been unsuccessful.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -30,12 +30,12 @@
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
sem_t *mysemp;
|
sem_t *mysemp;
|
||||||
char semname[20];
|
char semname[50];
|
||||||
|
|
||||||
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
||||||
|
|
||||||
mysemp = sem_open(semname, O_CREAT, 0444, 1) ;
|
mysemp = sem_open(semname, O_CREAT, 0444, 1) ;
|
||||||
if (mysemp == SEM_FAILED) {
|
if (mysemp == SEM_FAILED) {
|
||||||
perror(ERROR_PREFIX "sem_open");
|
perror(ERROR_PREFIX "sem_open");
|
||||||
return PTS_UNRESOLVED;
|
return PTS_UNRESOLVED;
|
||||||
}
|
}
|
||||||
@@ -47,7 +47,7 @@ int main()
|
|||||||
}
|
}
|
||||||
puts("TEST PASSED");
|
puts("TEST PASSED");
|
||||||
return PTS_PASS;
|
return PTS_PASS;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
puts("TEST FAILED");
|
puts("TEST FAILED");
|
||||||
return PTS_FAIL;
|
return PTS_FAIL;
|
||||||
|
|||||||
+5
-5
@@ -1,14 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2003, Intel Corporation. All rights reserved.
|
Copyright (c) 2003, Intel Corporation. All rights reserved.
|
||||||
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
||||||
This file is licensed under the GPL license. For the full content
|
This file is licensed under the GPL license. For the full content
|
||||||
of this license, see the COPYING file at the top level of this
|
of this license, see the COPYING file at the top level of this
|
||||||
source tree.
|
source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This test case will call sem_getvalue to update the location referenced
|
* This test case will call sem_getvalue to update the location referenced
|
||||||
* by the semaphpre without effecting the state of the semaphore. The
|
* by the semaphpre without effecting the state of the semaphore. The
|
||||||
* updated value represents the actual semaphore value when it was called.
|
* updated value represents the actual semaphore value when it was called.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
||||||
char semname[20];
|
char semname[50];
|
||||||
sem_t *mysemp;
|
sem_t *mysemp;
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ int main() {
|
|||||||
|
|
||||||
if( sem_getvalue(mysemp, &val) == -1 ) {
|
if( sem_getvalue(mysemp, &val) == -1 ) {
|
||||||
perror(ERROR_PREFIX "sem_getvalue");
|
perror(ERROR_PREFIX "sem_getvalue");
|
||||||
return PTS_UNRESOLVED;
|
return PTS_UNRESOLVED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
+4
-4
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2003, Intel Corporation. All rights reserved.
|
Copyright (c) 2003, Intel Corporation. All rights reserved.
|
||||||
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
||||||
This file is licensed under the GPL license. For the full content
|
This file is licensed under the GPL license. For the full content
|
||||||
of this license, see the COPYING file at the top level of this
|
of this license, see the COPYING file at the top level of this
|
||||||
source tree.
|
source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
||||||
char semname[20];
|
char semname[50];
|
||||||
sem_t *mysemp;
|
sem_t *mysemp;
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ int main() {
|
|||||||
|
|
||||||
if( sem_getvalue(mysemp, &val) < 0 ) {
|
if( sem_getvalue(mysemp, &val) < 0 ) {
|
||||||
perror(ERROR_PREFIX "sem_getvalue");
|
perror(ERROR_PREFIX "sem_getvalue");
|
||||||
return PTS_UNRESOLVED;
|
return PTS_UNRESOLVED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2003, Intel Corporation. All rights reserved.
|
Copyright (c) 2003, Intel Corporation. All rights reserved.
|
||||||
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
||||||
This file is licensed under the GPL license. For the full content
|
This file is licensed under the GPL license. For the full content
|
||||||
of this license, see the COPYING file at the top level of this
|
of this license, see the COPYING file at the top level of this
|
||||||
source tree.
|
source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
||||||
char semname[20];
|
char semname[50];
|
||||||
sem_t *mysemp;
|
sem_t *mysemp;
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -1,13 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2003, Intel Corporation. All rights reserved.
|
Copyright (c) 2003, Intel Corporation. All rights reserved.
|
||||||
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
||||||
This file is licensed under the GPL license. For the full content
|
This file is licensed under the GPL license. For the full content
|
||||||
of this license, see the COPYING file at the top level of this
|
of this license, see the COPYING file at the top level of this
|
||||||
source tree.
|
source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This test case verifies that calling sem_getvalue doesn't change the
|
* This test case verifies that calling sem_getvalue doesn't change the
|
||||||
* state of the semaphore.
|
* state of the semaphore.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
||||||
char semname[20];
|
char semname[50];
|
||||||
sem_t *mysemp;
|
sem_t *mysemp;
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ int main() {
|
|||||||
|
|
||||||
if( sem_getvalue(mysemp, &val) == -1 ) {
|
if( sem_getvalue(mysemp, &val) == -1 ) {
|
||||||
perror(ERROR_PREFIX "sem_getvalue");
|
perror(ERROR_PREFIX "sem_getvalue");
|
||||||
return PTS_UNRESOLVED;
|
return PTS_UNRESOLVED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( sem_trywait(mysemp) == -1 ) {
|
if ( sem_trywait(mysemp) == -1 ) {
|
||||||
@@ -53,7 +53,7 @@ int main() {
|
|||||||
|
|
||||||
if( sem_getvalue(mysemp, &val) == -1 ) {
|
if( sem_getvalue(mysemp, &val) == -1 ) {
|
||||||
perror(ERROR_PREFIX "sem_getvalue");
|
perror(ERROR_PREFIX "sem_getvalue");
|
||||||
return PTS_UNRESOLVED;
|
return PTS_UNRESOLVED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2002-2003, Intel Corporation. All rights reserved.
|
Copyright (c) 2002-2003, Intel Corporation. All rights reserved.
|
||||||
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
||||||
This file is licensed under the GPL license. For the full content
|
This file is licensed under the GPL license. For the full content
|
||||||
of this license, see the COPYING file at the top level of this
|
of this license, see the COPYING file at the top level of this
|
||||||
source tree.
|
source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
sem_open test case that attempts to open a new semaphoree, and then
|
sem_open test case that attempts to open a new semaphoree, and then
|
||||||
try to un-lock it with sem_post. Making sure the semaphore is not locked.
|
try to un-lock it with sem_post. Making sure the semaphore is not locked.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
sem_t *mysemp;
|
sem_t *mysemp;
|
||||||
char semname[20];
|
char semname[50];
|
||||||
|
|
||||||
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2002-2003, Intel Corporation. All rights reserved.
|
Copyright (c) 2002-2003, Intel Corporation. All rights reserved.
|
||||||
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
||||||
This file is licensed under the GPL license. For the full content
|
This file is licensed under the GPL license. For the full content
|
||||||
of this license, see the COPYING file at the top level of this
|
of this license, see the COPYING file at the top level of this
|
||||||
source tree.
|
source tree.
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2002-2003, Intel Corporation. All rights reserved.
|
Copyright (c) 2002-2003, Intel Corporation. All rights reserved.
|
||||||
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
||||||
This file is licensed under the GPL license. For the full content
|
This file is licensed under the GPL license. For the full content
|
||||||
of this license, see the COPYING file at the top level of this
|
of this license, see the COPYING file at the top level of this
|
||||||
source tree.
|
source tree.
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2003, Intel Corporation. All rights reserved.
|
Copyright (c) 2003, Intel Corporation. All rights reserved.
|
||||||
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
||||||
This file is licensed under the GPL license. For the full content
|
This file is licensed under the GPL license. For the full content
|
||||||
of this license, see the COPYING file at the top level of this
|
of this license, see the COPYING file at the top level of this
|
||||||
source tree.
|
source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
sem_t *mysemp;
|
sem_t *mysemp;
|
||||||
char semname[20];
|
char semname[50];
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
||||||
@@ -44,7 +44,7 @@ int main() {
|
|||||||
|
|
||||||
if( sem_post(mysemp) == -1 ) {
|
if( sem_post(mysemp) == -1 ) {
|
||||||
perror(ERROR_PREFIX "sem_post");
|
perror(ERROR_PREFIX "sem_post");
|
||||||
return PTS_UNRESOLVED;
|
return PTS_UNRESOLVED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ int main() {
|
|||||||
sem_close(mysemp);
|
sem_close(mysemp);
|
||||||
sem_unlink(semname);
|
sem_unlink(semname);
|
||||||
return PTS_PASS;
|
return PTS_PASS;
|
||||||
} else {
|
} else {
|
||||||
puts("TEST FAILED");
|
puts("TEST FAILED");
|
||||||
return PTS_FAIL;
|
return PTS_FAIL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2003, Intel Corporation. All rights reserved.
|
Copyright (c) 2003, Intel Corporation. All rights reserved.
|
||||||
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
||||||
This file is licensed under the GPL license. For the full content
|
This file is licensed under the GPL license. For the full content
|
||||||
of this license, see the COPYING file at the top level of this
|
of this license, see the COPYING file at the top level of this
|
||||||
source tree.
|
source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
sem_t *mysemp;
|
sem_t *mysemp;
|
||||||
char semname[20];
|
char semname[50];
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
||||||
@@ -44,7 +44,7 @@ int main() {
|
|||||||
|
|
||||||
if( sem_post(mysemp) == -1 ) {
|
if( sem_post(mysemp) == -1 ) {
|
||||||
perror(ERROR_PREFIX "sem_post");
|
perror(ERROR_PREFIX "sem_post");
|
||||||
return PTS_UNRESOLVED;
|
return PTS_UNRESOLVED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ int main() {
|
|||||||
sem_close(mysemp);
|
sem_close(mysemp);
|
||||||
sem_unlink(semname);
|
sem_unlink(semname);
|
||||||
return PTS_PASS;
|
return PTS_PASS;
|
||||||
} else {
|
} else {
|
||||||
puts("TEST FAILED");
|
puts("TEST FAILED");
|
||||||
return PTS_FAIL;
|
return PTS_FAIL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2003, Intel Corporation. All rights reserved.
|
Copyright (c) 2003, Intel Corporation. All rights reserved.
|
||||||
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
||||||
This file is licensed under the GPL license. For the full content
|
This file is licensed under the GPL license. For the full content
|
||||||
of this license, see the COPYING file at the top level of this
|
of this license, see the COPYING file at the top level of this
|
||||||
source tree.
|
source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
sem_t *mysemp;
|
sem_t *mysemp;
|
||||||
char semname[20];
|
char semname[50];
|
||||||
|
|
||||||
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ int main() {
|
|||||||
|
|
||||||
if( sem_wait(mysemp) == -1 ) {
|
if( sem_wait(mysemp) == -1 ) {
|
||||||
perror(ERROR_PREFIX "sem_post");
|
perror(ERROR_PREFIX "sem_post");
|
||||||
return PTS_UNRESOLVED;
|
return PTS_UNRESOLVED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(( sem_post(mysemp)) == 0 ) {
|
if(( sem_post(mysemp)) == 0 ) {
|
||||||
@@ -50,7 +50,7 @@ int main() {
|
|||||||
sem_close(mysemp);
|
sem_close(mysemp);
|
||||||
sem_unlink(semname);
|
sem_unlink(semname);
|
||||||
return PTS_PASS;
|
return PTS_PASS;
|
||||||
} else {
|
} else {
|
||||||
puts("TEST FAILED: value of sem_post is not zero");
|
puts("TEST FAILED: value of sem_post is not zero");
|
||||||
return PTS_FAIL;
|
return PTS_FAIL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2003, Intel Corporation. All rights reserved.
|
Copyright (c) 2003, Intel Corporation. All rights reserved.
|
||||||
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
||||||
This file is licensed under the GPL license. For the full content
|
This file is licensed under the GPL license. For the full content
|
||||||
of this license, see the COPYING file at the top level of this
|
of this license, see the COPYING file at the top level of this
|
||||||
source tree.
|
source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
sem_t *mysemp;
|
sem_t *mysemp;
|
||||||
char semname[20];
|
char semname[50];
|
||||||
|
|
||||||
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ int main() {
|
|||||||
sem_close(mysemp);
|
sem_close(mysemp);
|
||||||
sem_unlink(semname);
|
sem_unlink(semname);
|
||||||
return PTS_PASS;
|
return PTS_PASS;
|
||||||
} else {
|
} else {
|
||||||
puts("TEST FAILED: value of sem_post is not returning zero");
|
puts("TEST FAILED: value of sem_post is not returning zero");
|
||||||
return PTS_FAIL;
|
return PTS_FAIL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ void sighdl(int sig)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
char semname[20];
|
char semname[50];
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
||||||
@@ -59,7 +59,7 @@ int main() {
|
|||||||
|
|
||||||
if( sem_post(gsemp) == -1 ) {
|
if( sem_post(gsemp) == -1 ) {
|
||||||
perror(ERROR_PREFIX "sem_post");
|
perror(ERROR_PREFIX "sem_post");
|
||||||
exit(PTS_UNRESOLVED);
|
exit(PTS_UNRESOLVED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Checking if the value of the Semaphore incremented by one */
|
/* Checking if the value of the Semaphore incremented by one */
|
||||||
|
|||||||
@@ -40,12 +40,12 @@ void handler(int signo)
|
|||||||
{
|
{
|
||||||
if( sem_post(gsemp) == -1 ) {
|
if( sem_post(gsemp) == -1 ) {
|
||||||
perror(ERROR_PREFIX "sem_post");
|
perror(ERROR_PREFIX "sem_post");
|
||||||
exit(PTS_UNRESOLVED);
|
exit(PTS_UNRESOLVED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
char semname[20];
|
char semname[50];
|
||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2003, Intel Corporation. All rights reserved.
|
Copyright (c) 2003, Intel Corporation. All rights reserved.
|
||||||
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
||||||
This file is licensed under the GPL license. For the full content
|
This file is licensed under the GPL license. For the full content
|
||||||
of this license, see the COPYING file at the top level of this
|
of this license, see the COPYING file at the top level of this
|
||||||
source tree.
|
source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
sem_t *mysemp;
|
sem_t *mysemp;
|
||||||
char semname[20];
|
char semname[50];
|
||||||
|
|
||||||
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2003, Intel Corporation. All rights reserved.
|
Copyright (c) 2003, Intel Corporation. All rights reserved.
|
||||||
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
Created by: majid.awad REMOVE-THIS AT intel DOT com
|
||||||
This file is licensed under the GPL license. For the full content
|
This file is licensed under the GPL license. For the full content
|
||||||
of this license, see the COPYING file at the top level of this
|
of this license, see the COPYING file at the top level of this
|
||||||
source tree.
|
source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
sem_t *mysemp;
|
sem_t *mysemp;
|
||||||
char semname[20];
|
char semname[50];
|
||||||
|
|
||||||
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, Intel Corporation. All rights reserved.
|
* Copyright (c) 2003, Intel Corporation. All rights reserved.
|
||||||
* Created by: majid.awad REMOVE-THIS AT intel DOT com
|
* Created by: majid.awad REMOVE-THIS AT intel DOT com
|
||||||
* This file is licensed under the GPL license. For the full content
|
* This file is licensed under the GPL license. For the full content
|
||||||
* of this license, see the COPYING file at the top level of this
|
* of this license, see the COPYING file at the top level of this
|
||||||
* source tree.
|
* source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
sem_t *mysemp;
|
sem_t *mysemp;
|
||||||
char semname[20];
|
char semname[50];
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
||||||
@@ -45,7 +45,7 @@ int main() {
|
|||||||
/* Lock Semaphore */
|
/* Lock Semaphore */
|
||||||
if( sem_wait(mysemp) == -1 ) {
|
if( sem_wait(mysemp) == -1 ) {
|
||||||
perror(ERROR_PREFIX "sem_wait");
|
perror(ERROR_PREFIX "sem_wait");
|
||||||
return PTS_UNRESOLVED;
|
return PTS_UNRESOLVED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ int main() {
|
|||||||
sem_close(mysemp);
|
sem_close(mysemp);
|
||||||
sem_unlink(semname);
|
sem_unlink(semname);
|
||||||
return PTS_PASS;
|
return PTS_PASS;
|
||||||
} else {
|
} else {
|
||||||
puts("TEST FAILED");
|
puts("TEST FAILED");
|
||||||
return PTS_FAIL;
|
return PTS_FAIL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, Intel Corporation. All rights reserved.
|
* Copyright (c) 2003, Intel Corporation. All rights reserved.
|
||||||
* Created by: majid.awad REMOVE-THIS AT intel DOT com
|
* Created by: majid.awad REMOVE-THIS AT intel DOT com
|
||||||
* This file is licensed under the GPL license. For the full content
|
* This file is licensed under the GPL license. For the full content
|
||||||
* of this license, see the COPYING file at the top level of this
|
* of this license, see the COPYING file at the top level of this
|
||||||
* source tree.
|
* source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Keep calling sem_wait until the sempahore is locked. That is
|
* Keep calling sem_wait until the sempahore is locked. That is
|
||||||
* decrementing the semaphore value by one until its zero or locked.
|
* decrementing the semaphore value by one until its zero or locked.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
sem_t *mysemp;
|
sem_t *mysemp;
|
||||||
char semname[20];
|
char semname[50];
|
||||||
int value = 10;
|
int value = 10;
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ int main() {
|
|||||||
perror(ERROR_PREFIX "sem_getvalue");
|
perror(ERROR_PREFIX "sem_getvalue");
|
||||||
return PTS_UNRESOLVED;
|
return PTS_UNRESOLVED;
|
||||||
} else {
|
} else {
|
||||||
value--;
|
value--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ int main() {
|
|||||||
sem_unlink(semname);
|
sem_unlink(semname);
|
||||||
sem_close(mysemp);
|
sem_close(mysemp);
|
||||||
return PTS_PASS;
|
return PTS_PASS;
|
||||||
} else {
|
} else {
|
||||||
puts("TEST FAILED: Semaphore is not locked");
|
puts("TEST FAILED: Semaphore is not locked");
|
||||||
return PTS_FAIL;
|
return PTS_FAIL;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -1,13 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, Intel Corporation. All rights reserved.
|
* Copyright (c) 2003, Intel Corporation. All rights reserved.
|
||||||
* Created by: majid.awad REMOVE-THIS AT intel DOT com
|
* Created by: majid.awad REMOVE-THIS AT intel DOT com
|
||||||
* This file is licensed under the GPL license. For the full content
|
* This file is licensed under the GPL license. For the full content
|
||||||
* of this license, see the COPYING file at the top level of this
|
* of this license, see the COPYING file at the top level of this
|
||||||
* source tree.
|
* source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* sem_trywait shall try to lock the unlocked semaphore and decrement
|
* sem_trywait shall try to lock the unlocked semaphore and decrement
|
||||||
* the semaphore value by one.
|
* the semaphore value by one.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
sem_t *mysemp;
|
sem_t *mysemp;
|
||||||
char semname[20];
|
char semname[50];
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
||||||
@@ -45,7 +45,7 @@ int main() {
|
|||||||
/* Lock Semaphore by sem_trywait*/
|
/* Lock Semaphore by sem_trywait*/
|
||||||
if( sem_trywait(mysemp) == -1 ) {
|
if( sem_trywait(mysemp) == -1 ) {
|
||||||
perror(ERROR_PREFIX "sem_wait");
|
perror(ERROR_PREFIX "sem_wait");
|
||||||
return PTS_UNRESOLVED;
|
return PTS_UNRESOLVED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ int main() {
|
|||||||
sem_unlink(semname);
|
sem_unlink(semname);
|
||||||
sem_close(mysemp);
|
sem_close(mysemp);
|
||||||
return PTS_PASS;
|
return PTS_PASS;
|
||||||
} else {
|
} else {
|
||||||
puts("TEST FAILED");
|
puts("TEST FAILED");
|
||||||
return PTS_FAIL;
|
return PTS_FAIL;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -1,13 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, Intel Corporation. All rights reserved.
|
* Copyright (c) 2003, Intel Corporation. All rights reserved.
|
||||||
* Created by: majid.awad REMOVE-THIS AT intel DOT com
|
* Created by: majid.awad REMOVE-THIS AT intel DOT com
|
||||||
* This file is licensed under the GPL license. For the full content
|
* This file is licensed under the GPL license. For the full content
|
||||||
* of this license, see the COPYING file at the top level of this
|
* of this license, see the COPYING file at the top level of this
|
||||||
* source tree.
|
* source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* sem_trywait shall try to lock the locked semaphore and decrement
|
* sem_trywait shall try to lock the locked semaphore and decrement
|
||||||
* the semaphore value by one.
|
* the semaphore value by one.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
sem_t *mysemp;
|
sem_t *mysemp;
|
||||||
char semname[20];
|
char semname[50];
|
||||||
|
|
||||||
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, Intel Corporation. All rights reserved.
|
* Copyright (c) 2003, Intel Corporation. All rights reserved.
|
||||||
* Created by: majid.awad REMOVE-THIS AT intel DOT com
|
* Created by: majid.awad REMOVE-THIS AT intel DOT com
|
||||||
* This file is licensed under the GPL license. For the full content
|
* This file is licensed under the GPL license. For the full content
|
||||||
* of this license, see the COPYING file at the top level of this
|
* of this license, see the COPYING file at the top level of this
|
||||||
* source tree.
|
* source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* This test case verifies that the semaphore shall be locked until the
|
/* This test case verifies that the semaphore shall be locked until the
|
||||||
* sem_post is executed and returns successfully.
|
* sem_post is executed and returns successfully.
|
||||||
* Lines: 39056-39057
|
* Lines: 39056-39057
|
||||||
*/
|
*/
|
||||||
@@ -28,9 +28,9 @@
|
|||||||
|
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
sem_t *mysemp;
|
sem_t *mysemp;
|
||||||
char semname[20];
|
char semname[50];
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, Intel Corporation. All rights reserved.
|
* Copyright (c) 2003, Intel Corporation. All rights reserved.
|
||||||
* Created by: majid.awad REMOVE-THIS AT intel DOT com
|
* Created by: majid.awad REMOVE-THIS AT intel DOT com
|
||||||
* This file is licensed under the GPL license. For the full content
|
* This file is licensed under the GPL license. For the full content
|
||||||
* of this license, see the COPYING file at the top level of this
|
* of this license, see the COPYING file at the top level of this
|
||||||
* source tree.
|
* source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* errno return EAGAIN: The semaphore can't be immediately locked by
|
* errno return EAGAIN: The semaphore can't be immediately locked by
|
||||||
* sem_trywait when its already locked.
|
* sem_trywait when its already locked.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
sem_t *mysemp;
|
sem_t *mysemp;
|
||||||
char semname[20];
|
char semname[50];
|
||||||
|
|
||||||
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ void handler(int signo)
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
sem_t *mysemp;
|
sem_t *mysemp;
|
||||||
char semname[20];
|
char semname[50];
|
||||||
int pid, status;
|
int pid, status;
|
||||||
|
|
||||||
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
sprintf(semname, "/" FUNCTION "_" TEST "_%ld", (long)getpid());
|
||||||
|
|||||||
Reference in New Issue
Block a user