Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 16 for mmapFile (0.12 sec)

  1. src/cmd/go/internal/mmap/mmap_other.go

    // license that can be found in the LICENSE file.
    
    //go:build (js && wasm) || wasip1 || plan9
    
    package mmap
    
    import (
    	"io"
    	"os"
    )
    
    // mmapFile on other systems doesn't mmap the file. It just reads everything.
    func mmapFile(f *os.File) (Data, error) {
    	b, err := io.ReadAll(f)
    	if err != nil {
    		return Data{}, err
    	}
    	return Data{f, b}, nil
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Dec 15 21:57:36 UTC 2023
    - 454 bytes
    - Viewed (0)
  2. src/cmd/vendor/golang.org/x/telemetry/internal/mmap/mmap_other.go

    // license that can be found in the LICENSE file.
    
    //go:build (js && wasm) || wasip1 || plan9 || (solaris && !go1.20)
    
    package mmap
    
    import (
    	"io"
    	"os"
    )
    
    // mmapFile on other systems doesn't mmap the file. It just reads everything.
    func mmapFile(f *os.File, _ *Data) (Data, error) {
    	b, err := io.ReadAll(f)
    	if err != nil {
    		return Data{}, err
    	}
    	return Data{f, b, nil}, nil
    }
    
    func munmapFile(d Data) error {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 30 21:40:49 UTC 2024
    - 540 bytes
    - Viewed (0)
  3. src/cmd/vendor/golang.org/x/telemetry/internal/mmap/mmap.go

    	// Some windows magic
    	Windows interface{}
    }
    
    // Mmap maps the given file into memory.
    // When remapping a file, pass the most recently returned Data.
    func Mmap(f *os.File, data *Data) (Data, error) {
    	return mmapFile(f, data)
    }
    
    // Munmap unmaps the given file from memory.
    func Munmap(d *Data) error {
    	// d.f.Close() on Windows still gets an error
    	return munmapFile(*d)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 30 21:40:49 UTC 2024
    - 1002 bytes
    - Viewed (0)
  4. src/cmd/go/internal/mmap/mmap.go

    type Data struct {
    	f    *os.File
    	Data []byte
    }
    
    // Mmap maps the given file into memory.
    func Mmap(file string) (Data, error) {
    	f, err := os.Open(file)
    	if err != nil {
    		return Data{}, err
    	}
    	return mmapFile(f)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Dec 15 21:57:36 UTC 2023
    - 754 bytes
    - Viewed (0)
  5. src/cmd/go/internal/mmap/mmap_unix.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    //go:build unix
    
    package mmap
    
    import (
    	"fmt"
    	"io/fs"
    	"os"
    	"syscall"
    )
    
    func mmapFile(f *os.File) (Data, error) {
    	st, err := f.Stat()
    	if err != nil {
    		return Data{}, err
    	}
    	size := st.Size()
    	pagesize := int64(os.Getpagesize())
    	if int64(int(size+(pagesize-1))) != size+(pagesize-1) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Dec 15 21:57:36 UTC 2023
    - 886 bytes
    - Viewed (0)
  6. src/cmd/go/internal/mmap/mmap_windows.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package mmap
    
    import (
    	"fmt"
    	"os"
    	"syscall"
    	"unsafe"
    
    	"internal/syscall/windows"
    )
    
    func mmapFile(f *os.File) (Data, error) {
    	st, err := f.Stat()
    	if err != nil {
    		return Data{}, err
    	}
    	size := st.Size()
    	if size == 0 {
    		return Data{f, nil}, nil
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Dec 15 21:57:36 UTC 2023
    - 1K bytes
    - Viewed (0)
  7. src/cmd/vendor/golang.org/x/telemetry/internal/mmap/mmap_unix.go

    // license that can be found in the LICENSE file.
    
    //go:build unix && (!solaris || go1.20)
    
    package mmap
    
    import (
    	"fmt"
    	"io/fs"
    	"os"
    	"syscall"
    )
    
    func mmapFile(f *os.File, _ *Data) (Data, error) {
    	st, err := f.Stat()
    	if err != nil {
    		return Data{}, err
    	}
    	size := st.Size()
    	pagesize := int64(os.Getpagesize())
    	if int64(int(size+(pagesize-1))) != size+(pagesize-1) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 30 21:40:49 UTC 2024
    - 1.1K bytes
    - Viewed (0)
  8. src/cmd/vendor/golang.org/x/telemetry/internal/mmap/mmap_windows.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package mmap
    
    import (
    	"fmt"
    	"os"
    	"syscall"
    	"unsafe"
    
    	"golang.org/x/sys/windows"
    )
    
    func mmapFile(f *os.File, previous *Data) (Data, error) {
    	if previous != nil {
    		munmapFile(*previous)
    	}
    	st, err := f.Stat()
    	if err != nil {
    		return Data{}, err
    	}
    	size := st.Size()
    	if size == 0 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Mar 04 17:10:54 UTC 2024
    - 1.5K bytes
    - Viewed (0)
  9. src/testing/fstest/mapfs_test.go

    	}
    	if err := TestFS(m, "hello", "fortune", "fortune/k", "fortune/k/ken.txt"); err != nil {
    		t.Fatal(err)
    	}
    }
    
    func TestMapFSChmodDot(t *testing.T) {
    	m := MapFS{
    		"a/b.txt": &MapFile{Mode: 0666},
    		".":       &MapFile{Mode: 0777 | fs.ModeDir},
    	}
    	buf := new(strings.Builder)
    	fs.WalkDir(m, ".", func(path string, d fs.DirEntry, err error) error {
    		fi, err := d.Info()
    		if err != nil {
    			return err
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Feb 20 14:59:55 UTC 2024
    - 1.3K bytes
    - Viewed (0)
  10. src/testing/fstest/mapfs.go

    // iterating over the entire map, so a MapFS should typically be used with not more
    // than a few hundred entries or directory reads.
    type MapFS map[string]*MapFile
    
    // A MapFile describes a single file in a [MapFS].
    type MapFile struct {
    	Data    []byte      // file content
    	Mode    fs.FileMode // fs.FileInfo.Mode
    	ModTime time.Time   // fs.FileInfo.ModTime
    	Sys     any         // fs.FileInfo.Sys
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 7.1K bytes
    - Viewed (0)
Back to top