Sha256: e447aced6aee16f633b01d87bd8a5282eea75727339afff6d00403b840b16280

Contents?: true

Size: 1.05 KB

Versions: 16

Compression:

Stored size: 1.05 KB

Contents

//go:build go1.18 && (linux || darwin || freebsd || openbsd || netbsd || solaris)
// +build go1.18
// +build linux darwin freebsd openbsd netbsd solaris

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

package blockblob

import (
	"fmt"
	"os"
	"syscall"
)

// mmb is a memory mapped buffer
type mmb []byte

// newMMB creates a new memory mapped buffer with the specified size
func newMMB(size int64) (mmb, error) {
	prot, flags := syscall.PROT_READ|syscall.PROT_WRITE, syscall.MAP_ANON|syscall.MAP_PRIVATE
	addr, err := syscall.Mmap(-1, 0, int(size), prot, flags)
	if err != nil {
		return nil, os.NewSyscallError("Mmap", err)
	}
	return mmb(addr), nil
}

// delete cleans up the memory mapped buffer
func (m *mmb) delete() {
	err := syscall.Munmap(*m)
	*m = nil
	if err != nil {
		// if we get here, there is likely memory corruption.
		// please open an issue https://github.com/Azure/azure-sdk-for-go/issues
		panic(fmt.Sprintf("Munmap error: %v", err))
	}
}

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ruby_snowflake_client-1.3.7 ext/vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/mmf_unix.go
ruby_snowflake_client-1.3.6 ext/vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/mmf_unix.go
ruby_snowflake_client-1.3.5 ext/vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/mmf_unix.go
ruby_snowflake_client-1.3.4 ext/vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/mmf_unix.go
ruby_snowflake_client-1.3.4.pre.debug ext/vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/mmf_unix.go
ruby_snowflake_client-1.3.3.pre.debug ext/vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/mmf_unix.go
ruby_snowflake_client-1.3.2 ext/vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/mmf_unix.go
ruby_snowflake_client-1.3.1 ext/vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/mmf_unix.go
ruby_snowflake_client-1.3.0 ext/vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/mmf_unix.go
ruby_snowflake_client-1.2.1 ext/vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/mmf_unix.go
ruby_snowflake_client-1.2.0 ext/vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/mmf_unix.go
ruby_snowflake_client-1.1.1 ext/vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/mmf_unix.go
ruby_snowflake_client-1.1.0 ext/vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/mmf_unix.go
ruby_snowflake_client-1.0.2 ext/vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/mmf_unix.go
ruby_snowflake_client-1.0.1 ext/vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/mmf_unix.go
ruby_snowflake_client-1.0.0 ext/vendor/github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blockblob/mmf_unix.go