aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2011-01-29 14:53:21 -0500
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2011-02-03 17:40:16 -0500
commitc4128b99e1206d03d15c5d2e1b6af164bf261c40 (patch)
tree80e092481285313e1f284bd03d1a0a03ea1f28a0
parent86b445e39c3c7eed076b01795b17f34481517288 (diff)
switch to generic locking system calls
The new generic lock layer in LITMUS^RT does away with per-protocol system calls. Change accordingly.
-rw-r--r--include/litmus.h10
-rw-r--r--src/syscalls.c18
-rw-r--r--tests/fdso.c20
3 files changed, 17 insertions, 31 deletions
diff --git a/include/litmus.h b/include/litmus.h
index 3b762db..52435d8 100644
--- a/include/litmus.h
+++ b/include/litmus.h
@@ -60,13 +60,9 @@ static inline int od_open(int fd, obj_type_t type, int obj_id)
60 return od_openx(fd, type, obj_id, 0); 60 return od_openx(fd, type, obj_id, 0);
61} 61}
62 62
63/* FMLP binary semaphore support */ 63/* real-time locking protocol support */
64int fmlp_down(int od); 64int litmus_lock(int od);
65int fmlp_up(int od); 65int litmus_unlock(int od);
66
67/* SRP binary semaphore support */
68int srp_down(int od);
69int srp_up(int od);
70 66
71/* job control*/ 67/* job control*/
72int get_job_no(unsigned int* job_no); 68int get_job_no(unsigned int* job_no);
diff --git a/src/syscalls.c b/src/syscalls.c
index c738ac4..d800141 100644
--- a/src/syscalls.c
+++ b/src/syscalls.c
@@ -44,24 +44,14 @@ int od_close(int od)
44 return syscall(__NR_od_close, od); 44 return syscall(__NR_od_close, od);
45} 45}
46 46
47int fmlp_down(int od) 47int litmus_lock(int od)
48{ 48{
49 return syscall(__NR_fmlp_down, od); 49 return syscall(__NR_litmus_lock, od);
50} 50}
51 51
52int fmlp_up(int od) 52int litmus_unlock(int od)
53{ 53{
54 return syscall(__NR_fmlp_up, od); 54 return syscall(__NR_litmus_unlock, od);
55}
56
57int srp_down(int od)
58{
59 return syscall(__NR_srp_down, od);
60}
61
62int srp_up(int od)
63{
64 return syscall(__NR_srp_up, od);
65} 55}
66 56
67int get_job_no(unsigned int *job_no) 57int get_job_no(unsigned int *job_no)
diff --git a/tests/fdso.c b/tests/fdso.c
index d60e9ef..1e2ab29 100644
--- a/tests/fdso.c
+++ b/tests/fdso.c
@@ -31,16 +31,16 @@ TESTCASE(fmlp_not_active, C_EDF | PFAIR | LINUX,
31TESTCASE(invalid_od, ALL, 31TESTCASE(invalid_od, ALL,
32 "reject invalid object descriptors") 32 "reject invalid object descriptors")
33{ 33{
34 SYSCALL_FAILS( EINVAL, fmlp_down(3) ); 34 SYSCALL_FAILS( EINVAL, litmus_lock(3) );
35 35
36 SYSCALL_FAILS( EINVAL, fmlp_up(3) ); 36 SYSCALL_FAILS( EINVAL, litmus_unlock(3) );
37 37
38 SYSCALL_FAILS( EINVAL, od_close(3) ); 38 SYSCALL_FAILS( EINVAL, od_close(3) );
39 39
40 40
41 SYSCALL_FAILS( EINVAL, fmlp_down(-1) ); 41 SYSCALL_FAILS( EINVAL, litmus_lock(-1) );
42 42
43 SYSCALL_FAILS( EINVAL, fmlp_up(-1) ); 43 SYSCALL_FAILS( EINVAL, litmus_unlock(-1) );
44 44
45 SYSCALL_FAILS( EINVAL, od_close(-1) ); 45 SYSCALL_FAILS( EINVAL, od_close(-1) );
46} 46}
@@ -61,9 +61,9 @@ TESTCASE(not_inherit_od, GSN_EDF | PSN_EDF,
61 61
62 SYSCALL( od = open_fmlp_sem(fd, 0) ); 62 SYSCALL( od = open_fmlp_sem(fd, 0) );
63 63
64 SYSCALL( fmlp_down(od) ); 64 SYSCALL( litmus_lock(od) );
65 65
66 SYSCALL( fmlp_up(od) ); 66 SYSCALL( litmus_unlock(od) );
67 67
68 pid = fork(); 68 pid = fork();
69 69
@@ -71,12 +71,12 @@ TESTCASE(not_inherit_od, GSN_EDF | PSN_EDF,
71 71
72 if (pid == 0) { 72 if (pid == 0) {
73 /* child */ 73 /* child */
74 SYSCALL_FAILS(EINVAL, fmlp_down(od) ); 74 SYSCALL_FAILS(EINVAL, litmus_lock(od) );
75 SYSCALL_FAILS(EINVAL, fmlp_up(od) ); 75 SYSCALL_FAILS(EINVAL, litmus_unlock(od) );
76 exit(0); 76 exit(0);
77 } else { 77 } else {
78 SYSCALL( fmlp_down(od) ); 78 SYSCALL( litmus_lock(od) );
79 SYSCALL( fmlp_up(od) ); 79 SYSCALL( litmus_unlock(od) );
80 SYSCALL( waitpid(pid, &status, 0) ); 80 SYSCALL( waitpid(pid, &status, 0) );
81 ASSERT(WEXITSTATUS(status) == 0); 81 ASSERT(WEXITSTATUS(status) == 0);
82 } 82 }