diff options
author | njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2009-06-10 23:26:13 +0000 |
---|---|---|
committer | njn <njn@a5019735-40e9-0310-863c-91ae7b9d1cf9> | 2009-06-10 23:26:13 +0000 |
commit | 631b819596d389e9ad8ea0a0b5926f6107d7b1e0 (patch) | |
tree | 81bfa172a839e7409dad0cda5d22f06948a4dfa9 /coregrind | |
parent | 2c7e5ca3d43afda2060c4f3a1ad43d945c05ff71 (diff) | |
download | valgrind-631b819596d389e9ad8ea0a0b5926f6107d7b1e0.tar.gz |
Add wrappers for shmat() and shmdt() on Darwin. Fixes bug 191271.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10297 a5019735-40e9-0310-863c-91ae7b9d1cf9
Diffstat (limited to 'coregrind')
-rw-r--r-- | coregrind/m_syswrap/priv_syswrap-darwin.h | 4 | ||||
-rw-r--r-- | coregrind/m_syswrap/syswrap-amd64-linux.c | 2 | ||||
-rw-r--r-- | coregrind/m_syswrap/syswrap-darwin.c | 40 |
3 files changed, 38 insertions, 8 deletions
diff --git a/coregrind/m_syswrap/priv_syswrap-darwin.h b/coregrind/m_syswrap/priv_syswrap-darwin.h index 7b8642c0f..840fd0819 100644 --- a/coregrind/m_syswrap/priv_syswrap-darwin.h +++ b/coregrind/m_syswrap/priv_syswrap-darwin.h @@ -317,9 +317,9 @@ DECL_TEMPLATE(darwin, semop); // 256 // NYI msgget 259 // NYI msgsnd 260 // NYI msgrcv 261 -// NYI shmat 262 +DECL_TEMPLATE(darwin, shmat); // 262 DECL_TEMPLATE(darwin, shmctl); // 263 -// NYI shmdt 264 +DECL_TEMPLATE(darwin, shmdt); // 264 DECL_TEMPLATE(darwin, shmget); // 265 DECL_TEMPLATE(darwin, shm_open); // 266 // NYI shm_unlink 267 diff --git a/coregrind/m_syswrap/syswrap-amd64-linux.c b/coregrind/m_syswrap/syswrap-amd64-linux.c index d11dc2fdc..b3de9e526 100644 --- a/coregrind/m_syswrap/syswrap-amd64-linux.c +++ b/coregrind/m_syswrap/syswrap-amd64-linux.c @@ -906,7 +906,7 @@ PRE(wrap_sys_shmat) if (arg2tmp == 0) SET_STATUS_Failure( VKI_EINVAL ); else - ARG2 = arg2tmp; + ARG2 = arg2tmp; // used in POST } POST(wrap_sys_shmat) { diff --git a/coregrind/m_syswrap/syswrap-darwin.c b/coregrind/m_syswrap/syswrap-darwin.c index b1289b5c6..6189ce05f 100644 --- a/coregrind/m_syswrap/syswrap-darwin.c +++ b/coregrind/m_syswrap/syswrap-darwin.c @@ -1780,10 +1780,22 @@ POST(flistxattr) POST_MEM_WRITE( ARG2, (vki_ssize_t)RES ); } -PRE(shmget) + +PRE(shmat) { - PRINT("shmget ( %ld, %ld, %ld )",ARG1,ARG2,ARG3); - PRE_REG_READ3(long, "shmget", vki_key_t, key, vki_size_t, size, int, shmflg); + UWord arg2tmp; + PRINT("shmat ( %ld, %#lx, %ld )",ARG1,ARG2,ARG3); + PRE_REG_READ3(long, "shmat", + int, shmid, const void *, shmaddr, int, shmflg); + arg2tmp = ML_(generic_PRE_sys_shmat)(tid, ARG1,ARG2,ARG3); + if (arg2tmp == 0) + SET_STATUS_Failure( VKI_EINVAL ); + else + ARG2 = arg2tmp; // used in POST +} +POST(shmat) +{ + ML_(generic_POST_sys_shmat)(tid, RES,ARG1,ARG2,ARG3); } PRE(shmctl) @@ -1798,6 +1810,24 @@ POST(shmctl) ML_(generic_POST_sys_shmctl)(tid, RES,ARG1,ARG2,ARG3); } +PRE(shmdt) +{ + PRINT("shmdt ( %#lx )",ARG1); + PRE_REG_READ1(long, "shmdt", const void *, shmaddr); + if (!ML_(generic_PRE_sys_shmdt)(tid, ARG1)) + SET_STATUS_Failure( VKI_EINVAL ); +} +POST(shmdt) +{ + ML_(generic_POST_sys_shmdt)(tid, RES,ARG1); +} + +PRE(shmget) +{ + PRINT("shmget ( %ld, %ld, %ld )",ARG1,ARG2,ARG3); + PRE_REG_READ3(long, "shmget", vki_key_t, key, vki_size_t, size, int, shmflg); +} + PRE(shm_open) { PRINT("shm_open(%#lx(%s), %ld, %ld)", ARG1, (char *)ARG1, ARG2, ARG3); @@ -7216,9 +7246,9 @@ const SyscallTableEntry ML_(syscall_table)[] = { // _____(__NR_msgget), // _____(__NR_msgsnd), // 260 // _____(__NR_msgrcv), -// _____(__NR_shmat), + MACXY(__NR_shmat, shmat), MACXY(__NR_shmctl, shmctl), -// _____(__NR_shmdt), + MACXY(__NR_shmdt, shmdt), MACX_(__NR_shmget, shmget), MACXY(__NR_shm_open, shm_open), // _____(__NR_shm_unlink), |