Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 51 for readdirent (0.16 sec)

  1. src/cmd/vendor/golang.org/x/sys/unix/readdirent_getdents.go

    // license that can be found in the LICENSE file.
    
    //go:build aix || dragonfly || freebsd || linux || netbsd || openbsd
    
    package unix
    
    // ReadDirent reads directory entries from fd and writes them into buf.
    func ReadDirent(fd int, buf []byte) (n int, err error) {
    	return Getdents(fd, buf)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 23:33:33 UTC 2023
    - 401 bytes
    - Viewed (0)
  2. src/syscall/dirent_test.go

    	}
    	defer syscall.Close(fd)
    
    	buf := bytes.Repeat([]byte{0xCD}, direntBufSize)
    	for {
    		n, err := syscall.ReadDirent(fd, buf)
    		if err == syscall.EINVAL {
    			// On linux, 'man getdents64' says that EINVAL indicates “result buffer is too small”.
    			// Try a bigger buffer.
    			t.Logf("ReadDirent: %v; retrying with larger buffer", err)
    			buf = bytes.Repeat([]byte{0xCD}, len(buf)*2)
    			continue
    		}
    		if err != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 3.4K bytes
    - Viewed (0)
  3. src/internal/poll/fd_unixjs.go

    	defer fd.decref()
    	return syscall.Fchdir(fd.Sysfd)
    }
    
    // ReadDirent wraps syscall.ReadDirent.
    // We treat this like an ordinary system call rather than a call
    // that tries to fill the buffer.
    func (fd *FD) ReadDirent(buf []byte) (int, error) {
    	if err := fd.incref(); err != nil {
    		return 0, err
    	}
    	defer fd.decref()
    	for {
    		n, err := ignoringEINTRIO(syscall.ReadDirent, fd.Sysfd, buf)
    		if err != nil {
    			n = 0
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 25 00:12:41 UTC 2023
    - 2K bytes
    - Viewed (0)
  4. src/cmd/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    //go:build darwin || zos
    
    package unix
    
    import "unsafe"
    
    // ReadDirent reads directory entries from fd and writes them into buf.
    func ReadDirent(fd int, buf []byte) (n int, err error) {
    	// Final argument is (basep *uintptr) and the syscall doesn't take nil.
    	// 64 bits should be enough. (32 bits isn't even on 386). Since the
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 08 16:12:58 UTC 2024
    - 705 bytes
    - Viewed (0)
  5. src/os/dir_unix.go

    		n = -1
    	}
    
    	for n != 0 {
    		// Refill the buffer if necessary
    		if d.bufp >= d.nbuf {
    			d.bufp = 0
    			var errno error
    			d.nbuf, errno = f.pfd.ReadDirent(*d.buf)
    			runtime.KeepAlive(f)
    			if errno != nil {
    				return names, dirents, infos, &PathError{Op: "readdirent", Path: f.name, Err: errno}
    			}
    			if d.nbuf <= 0 {
    				// Optimization: we can return the buffer to the pool, there is nothing else to read.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 14 20:11:45 UTC 2024
    - 4.8K bytes
    - Viewed (0)
  6. src/internal/poll/fd_wasip1.go

    		// Do not call eofError; caller does not expect to see io.EOF.
    		return n, err
    	}
    }
    
    func (fd *FD) ReadDirent(buf []byte) (int, error) {
    	n, err := fd.ReadDir(buf, fd.Dircookie)
    	if err != nil {
    		return 0, err
    	}
    	if n <= 0 {
    		return n, nil // EOF
    	}
    
    	// We assume that the caller of ReadDirent will consume the entire buffer
    	// up to the last full entry, so we scan through the buffer looking for the
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 14 20:14:02 UTC 2024
    - 6.7K bytes
    - Viewed (0)
  7. cmd/os_unix.go

    	if err != nil {
    		return consumed, nil, typ, err
    	}
    
    	return consumed, nameBuf[:nameLen], typ, nil
    }
    
    // readDirFn applies the fn() function on each entries at dirPath, doesn't recurse into
    // the directory itself, if the dirPath doesn't exist this function doesn't return
    // an error.
    func readDirFn(dirPath string, fn func(name string, typ os.FileMode) error) error {
    	fd, err := openFileWithFD(dirPath, readMode, 0o666)
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Thu Jan 18 07:03:17 UTC 2024
    - 9.3K bytes
    - Viewed (0)
  8. src/syscall/fs_js.go

    	nodeAPPEND = constants.Get("O_APPEND").Int()
    	nodeEXCL   = constants.Get("O_EXCL").Int()
    )
    
    type jsFile struct {
    	path    string
    	entries []string
    	dirIdx  int // entries[:dirIdx] have already been returned in ReadDirent
    	pos     int64
    	seeked  bool
    }
    
    var filesMu sync.Mutex
    var files = map[int]*jsFile{
    	0: {},
    	1: {},
    	2: {},
    }
    
    func fdToFile(fd int) (*jsFile, error) {
    	filesMu.Lock()
    	f, ok := files[fd]
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 11 18:19:17 UTC 2023
    - 10.8K bytes
    - Viewed (0)
  9. src/syscall/syscall_darwin.go

    	// We store the number of entries to skip in the seek
    	// offset of fd. See issue #31368.
    	// It's not the full required semantics, but should handle the case
    	// of calling Getdirentries or ReadDirent repeatedly.
    	// It won't handle assigning the results of lseek to *basep, or handle
    	// the directory being edited underfoot.
    	skip, err := Seek(fd, 0, 1 /* SEEK_CUR */)
    	if err != nil {
    		return 0, err
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:16:50 UTC 2024
    - 11K bytes
    - Viewed (0)
  10. src/syscall/syscall_bsd.go

    	if len(gids) == 0 {
    		return setgroups(0, nil)
    	}
    
    	a := make([]_Gid_t, len(gids))
    	for i, v := range gids {
    		a[i] = _Gid_t(v)
    	}
    	return setgroups(len(a), &a[0])
    }
    
    func ReadDirent(fd int, buf []byte) (n int, err error) {
    	// Final argument is (basep *uintptr) and the syscall doesn't take nil.
    	// 64 bits should be enough. (32 bits isn't even on 386). Since the
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Nov 07 10:34:48 UTC 2023
    - 13.6K bytes
    - Viewed (0)
Back to top