github.com/zuoyebang/bitalostable@v1.0.1-0.20240229032404-e3b99a834294/vfs/errors_unix.go (about)

     1  // Copyright 2020 The LevelDB-Go and Pebble Authors. All rights reserved. Use
     2  // of this source code is governed by a BSD-style license that can be found in
     3  // the LICENSE file.
     4  
     5  //go:build darwin || dragonfly || freebsd || linux || openbsd
     6  // +build darwin dragonfly freebsd linux openbsd
     7  
     8  package vfs
     9  
    10  import (
    11  	"syscall"
    12  
    13  	"github.com/cockroachdb/errors"
    14  	"golang.org/x/sys/unix"
    15  )
    16  
    17  var errNotEmpty = syscall.ENOTEMPTY
    18  
    19  // IsNoSpaceError returns true if the given error indicates that the disk is
    20  // out of space.
    21  func IsNoSpaceError(err error) bool {
    22  	return errors.Is(err, unix.ENOSPC)
    23  }