Skip to content

Commit

Permalink
Merge pull request #1 from slyphon/master
Browse files Browse the repository at this point in the history
Small fix for compilation on OS-X
  • Loading branch information
edsrzf committed Nov 14, 2011
2 parents fad33f1 + 8c4de94 commit 86e936f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@ include $(GOROOT)/src/Make.inc

TARG=github.com/edsrzf/mmap-go
GOFILES=\
mmap.go\
mmap.go

GOFILES_freebsd=\
mmap_unix.go\
mmap_linux.go\
mmap_unix.go

GOFILES_darwin=\
mmap_unix.go\
mmap_darwin.go\
mmap_unix.go

GOFILES_linux=\
mmap_linux.go\
mmap_unix.go

GOFILES_windows=\
Expand Down
17 changes: 17 additions & 0 deletions mmap_darwin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2011 Evan Shaw. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package mmap

import (
"syscall"
)


const (
MAP_ANONYMOUS = syscall.MAP_ANON
)



15 changes: 15 additions & 0 deletions mmap_linux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright 2011 Evan Shaw. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package mmap

import (
"syscall"
)

const (
MAP_ANONYMOUS = syscall.MAP_ANONYMOUS
)


2 changes: 1 addition & 1 deletion mmap_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func mmap(len int, inprot, inflags, fd uintptr, off int64) ([]byte, os.Error) {
prot |= syscall.PROT_EXEC
}
if inflags&ANON != 0 {
flags |= syscall.MAP_ANONYMOUS
flags |= MAP_ANONYMOUS
}

b, errno := syscall.Mmap(int(fd), off, len, prot, flags)
Expand Down

0 comments on commit 86e936f

Please sign in to comment.