shmid, _, err := syscall.Syscall(syscall.SYS_SHMGET, uintptr(10001), 1<<32, 
IpcCreate|0600)
data_shmaddr, _, _ := syscall.Syscall(syscall.SYS_SHMAT, shmid, 0, 0)
C.memcpy(unsafe.Pointer(data_shmaddr+uintptr(per_offs)), unsafe.Pointer((C.
CString)(string(*data))), C.ulong(len(*data)))

I'm trying to use syscall shmat/shmget, but it seems like i can't map all 
the address that i wanted.
'per_offs' is a int value far less than 1<<32, below is what i got.

fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x7fe3502cca80 
pc=0x7fe34d9320b4]

runtime stack:
runtime.throw(0x552be5, 0x2a)
/data1/user1/go_env/go/src/runtime/panic.go:619 +0x81
runtime.sigpanic()
/data1/user1/go_env/go/src/runtime/signal_unix.go:372 +0x28e

goroutine 1 [syscall]:
runtime.cgocall(0x4fe960, 0xc4200edd40, 0x29)
/data1/user1/go_env/go/src/runtime/cgocall.go:128 +0x64 fp=0xc4200edd00 
sp=0xc4200edcc8 pc=0x403034
main._Cfunc_memcpy(0x7fe3502cca80, 0x7fe3440008c0, 0x1, 0x0)
_cgo_gotypes.go:78 +0x4e fp=0xc4200edd40 sp=0xc4200edd00 pc=0x4fdb7e
main.(*MemPoolMng).PutData.func1(0x7fe3502cca80, 0x7fe3440008c0, 0x1, 0x1)
/data1/user2/GoServer/mempool_go/mempool_mgr.go:107 +0x99 fp=0xc4200edd78 
sp=0xc4200edd40 pc=0x4fe7a9
main.(*MemPoolMng).PutData(0xc4200182d0, 0xc420158000, 0xf4240)
/data1/user2/GoServer/mempool_go/mempool_mgr.go:107 +0x1da fp=0xc4200ede58 
sp=0xc4200edd78 pc=0x4fe37a
main.handleProtoClient(0x565720, 0xc42000e060)
/data1/user2/GoServer/mempool_go/server.go:58 +0x16f fp=0xc4200eded0 
sp=0xc4200ede58 pc=0x4fcf8f
main.main()
/data1/user2/GoServer/mempool_go/server.go:39 +0x261 fp=0xc4200edf88 
sp=0xc4200eded0 pc=0x4fcca1
runtime.main()
/data1/user1/go_env/go/src/runtime/proc.go:198 +0x212 fp=0xc4200edfe0 
sp=0xc4200edf88 pc=0x42b772
runtime.goexit()
/data1/user1/go_env/go/src/runtime/asm_amd64.s:2361 +0x1 fp=0xc4200edfe8 
sp=0xc4200edfe0 pc=0x455601
exit status 2

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to