From da927ba5e2dc0a83c42bc796459d573d510439ff Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Mon, 29 Aug 2016 14:21:06 +1000 Subject: [PATCH] shiny/driver/x11driver: fix ipcCreat constant. That constant value had a typo. Its value (defined in /usr/include/linux/ipc.h) is in octal, not hexadecimal. "man shmget" suggests that the IPC_CREAT flag isn't necessary if the key is IPC_PRIVATE, as has proven in practice by the current code passing the wrong flag bit all along. The best fix, for the Go code, is to delete all mentions of ipcCreat. Change-Id: I1ec701b3069c35445058c1149f2e9d15bbf4cf4c Reviewed-on: https://go-review.googlesource.com/28012 Reviewed-by: David Crawshaw --- shiny/driver/x11driver/shm_linux_amd64.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/shiny/driver/x11driver/shm_linux_amd64.go b/shiny/driver/x11driver/shm_linux_amd64.go index 62e91d3..eda5ce7 100644 --- a/shiny/driver/x11driver/shm_linux_amd64.go +++ b/shiny/driver/x11driver/shm_linux_amd64.go @@ -13,12 +13,11 @@ import ( // These constants are from /usr/include/linux/ipc.h const ( ipcPrivate = 0 - ipcCreat = 0x1000 ipcRmID = 0 ) func shmOpen(size int) (shmid uintptr, addr unsafe.Pointer, err error) { - shmid, _, errno0 := syscall.RawSyscall(syscall.SYS_SHMGET, ipcPrivate, uintptr(size), ipcCreat|0600) + shmid, _, errno0 := syscall.RawSyscall(syscall.SYS_SHMGET, ipcPrivate, uintptr(size), 0600) if errno0 != 0 { return 0, unsafe.Pointer(uintptr(0)), fmt.Errorf("shmget: %v", errno0) }