Signed-Off-By: Subrata Modak<[email protected]>,
--
diff -uprN
ltp-intermediate-20090121.orig/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c
ltp-intermediate-20090121/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c
---
ltp-intermediate-20090121.orig/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c
2009-01-23 11:40:25.000000000 +0530
+++
ltp-intermediate-20090121/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c
2009-01-23 11:42:27.000000000 +0530
@@ -52,12 +52,14 @@
#include "ipcshm.h"
#include <pwd.h>
+#include "system_specific_hugepages_info.h"
char *TCID = "hugeshmat02";
int TST_TOTAL = 2;
extern int Tst_count;
char nobody_uid[] = "nobody";
struct passwd *ltpuser;
+unsigned long huge_pages_shm_to_be_allocated;
int exp_enos[] = {EINVAL, EACCES, 0}; /* 0 terminated list of */
@@ -99,6 +101,11 @@ int main(int ac, char **av)
tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
}
+ if ( get_no_of_hugepages() <= 0 || hugepages_size() <= 0 )
+ tst_brkm(TBROK, cleanup, "Test cannot be continued owning
to sufficient availability of Hugepages on the system");
+ else
+ huge_pages_shm_to_be_allocated = ( get_no_of_hugepages() *
hugepages_size() * 1024) / 2 ;
+
setup(); /* global setup */
/* The following loop checks looping state if -i option given */
@@ -171,14 +178,14 @@ setup(void)
/* create a shared memory resource with read and write permissions */
/* also post increment the shmkey for the next shmget call */
- if ((shm_id_2 = shmget(shmkey++, HUGE_SHM_SIZE, SHM_HUGETLB | SHM_RW |
IPC_CREAT |
+ if ((shm_id_2 = shmget(shmkey++, huge_pages_shm_to_be_allocated,
SHM_HUGETLB | SHM_RW | IPC_CREAT |
IPC_EXCL)) == -1) {
tst_brkm(TBROK, cleanup, "Failed to create shared memory "
"resource #1 in setup()");
}
/* create a shared memory resource without read and write permissions */
- if ((shm_id_3 = shmget(shmkey, HUGE_SHM_SIZE, SHM_HUGETLB | IPC_CREAT
| IPC_EXCL)) == -1) {
+ if ((shm_id_3 = shmget(shmkey, huge_pages_shm_to_be_allocated,
SHM_HUGETLB | IPC_CREAT | IPC_EXCL)) == -1) {
tst_brkm(TBROK, cleanup, "Failed to create shared memory "
"resource #2 in setup()");
}
Regards--
Subrata
diff -uprN ltp-intermediate-20090121.orig/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c ltp-intermediate-20090121/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c
--- ltp-intermediate-20090121.orig/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c 2009-01-23 11:40:25.000000000 +0530
+++ ltp-intermediate-20090121/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat02.c 2009-01-23 11:42:27.000000000 +0530
@@ -52,12 +52,14 @@
#include "ipcshm.h"
#include <pwd.h>
+#include "system_specific_hugepages_info.h"
char *TCID = "hugeshmat02";
int TST_TOTAL = 2;
extern int Tst_count;
char nobody_uid[] = "nobody";
struct passwd *ltpuser;
+unsigned long huge_pages_shm_to_be_allocated;
int exp_enos[] = {EINVAL, EACCES, 0}; /* 0 terminated list of */
@@ -99,6 +101,11 @@ int main(int ac, char **av)
tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
}
+ if ( get_no_of_hugepages() <= 0 || hugepages_size() <= 0 )
+ tst_brkm(TBROK, cleanup, "Test cannot be continued owning to sufficient availability of Hugepages on the system");
+ else
+ huge_pages_shm_to_be_allocated = ( get_no_of_hugepages() * hugepages_size() * 1024) / 2 ;
+
setup(); /* global setup */
/* The following loop checks looping state if -i option given */
@@ -171,14 +178,14 @@ setup(void)
/* create a shared memory resource with read and write permissions */
/* also post increment the shmkey for the next shmget call */
- if ((shm_id_2 = shmget(shmkey++, HUGE_SHM_SIZE, SHM_HUGETLB | SHM_RW | IPC_CREAT |
+ if ((shm_id_2 = shmget(shmkey++, huge_pages_shm_to_be_allocated, SHM_HUGETLB | SHM_RW | IPC_CREAT |
IPC_EXCL)) == -1) {
tst_brkm(TBROK, cleanup, "Failed to create shared memory "
"resource #1 in setup()");
}
/* create a shared memory resource without read and write permissions */
- if ((shm_id_3 = shmget(shmkey, HUGE_SHM_SIZE, SHM_HUGETLB | IPC_CREAT | IPC_EXCL)) == -1) {
+ if ((shm_id_3 = shmget(shmkey, huge_pages_shm_to_be_allocated, SHM_HUGETLB | IPC_CREAT | IPC_EXCL)) == -1) {
tst_brkm(TBROK, cleanup, "Failed to create shared memory "
"resource #2 in setup()");
}
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list