Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 60 for Fd (0.13 sec)

  1. tensorflow/c/experimental/filesystem/plugins/posix/copy_file_portable.cc

    #include "tensorflow/c/experimental/filesystem/plugins/posix/copy_file.h"
    
    namespace tf_posix_filesystem {
    
    // Transfers up to `size` bytes from `dst_fd` to `src_fd`.
    //
    // This method uses a temporary buffer to hold contents.
    int CopyFileContents(int dst_fd, int src_fd, off_t size) {
      // Use a copy buffer of 128KB but don't store it on the stack.
      constexpr static size_t kPosixCopyFileBufferSize = 128 * 1024;
    C++
    - Registered: Tue Apr 23 12:39:09 GMT 2024
    - Last Modified: Fri Nov 22 21:23:55 GMT 2019
    - 1.9K bytes
    - Viewed (0)
  2. okhttp/src/test/java/okhttp3/RequestBodyTest.kt

      @Test
      fun testFileDescriptor() {
        assertOnFileDescriptor { fd ->
          val requestBody = fd.toRequestBody()
    
          assertThat(requestBody.contentLength()).isEqualTo(-1L)
          assertThat(requestBody.isOneShot()).isEqualTo(true)
        }
      }
    
      @Test
      fun testFileDescriptorRead() {
        assertOnFileDescriptor(content = "Hello") { fd ->
          val requestBody = fd.toRequestBody()
    
          val buffer = Buffer()
    Plain Text
    - Registered: Fri Apr 26 11:42:10 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 3.6K bytes
    - Viewed (1)
  3. cni/pkg/nodeagent/fakes_test.go

    type fakeNs struct {
    	closed *atomic.Bool
    	fd     uintptr
    	inode  uint64
    }
    
    func newFakeNs(fd uintptr) *fakeNs {
    	// the fake inode is the fd! magic.
    	return &fakeNs{closed: &atomic.Bool{}, fd: fd, inode: uint64(fd)}
    }
    
    func newFakeNsInode(fd uintptr, inode uint64) *fakeNs {
    	return &fakeNs{closed: &atomic.Bool{}, fd: fd, inode: inode}
    }
    
    // Fd returns the file descriptor
    func (f *fakeNs) Fd() uintptr {
    Go
    - Registered: Wed Apr 24 22:53:08 GMT 2024
    - Last Modified: Fri Apr 12 21:47:31 GMT 2024
    - 3.9K bytes
    - Viewed (0)
  4. tensorflow/c/experimental/filesystem/plugins/posix/posix_filesystem_helper.cc

        close(src_fd);
        return -1;
      }
    
      // Both files have been opened, do the transfer.
      // Since errno would be overridden by `close` below, save it here.
      int error_code = 0;
      if (CopyFileContents(dst_fd, src_fd, size) < 0) error_code = errno;
    
      close(src_fd);
      close(dst_fd);
      if (error_code != 0) {
        errno = error_code;
        return -1;
      } else {
        return 0;
      }
    }
    
    C++
    - Registered: Tue Apr 23 12:39:09 GMT 2024
    - Last Modified: Thu Jan 16 05:36:52 GMT 2020
    - 2.1K bytes
    - Viewed (1)
  5. internal/http/dial_linux.go

    		c.Control(func(fdPtr uintptr) {
    			// got socket file descriptor to set parameters.
    			fd := int(fdPtr)
    
    			_ = unix.SetsockoptInt(fd, unix.SOL_SOCKET, unix.SO_REUSEADDR, 1)
    
    			_ = unix.SetsockoptInt(fd, unix.SOL_SOCKET, unix.SO_REUSEPORT, 1)
    
    			// Enable TCP open
    			// https://lwn.net/Articles/508865/ - 16k queue size.
    			_ = syscall.SetsockoptInt(fd, syscall.SOL_TCP, unix.TCP_FASTOPEN, 16*1024)
    
    			// Enable TCP fast connect
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Wed Jun 07 16:53:05 GMT 2023
    - 4.4K bytes
    - Viewed (3)
  6. cni/pkg/nodeagent/netns.go

    import "io"
    
    type NetnsFd interface {
    	Fd() uintptr
    }
    
    type Netns interface {
    	NetnsFd
    	Inode() uint64
    }
    type NetnsCloser interface {
    	io.Closer
    	Netns
    }
    
    type NetnsWithFd struct {
    	netns io.Closer
    	fd    uintptr
    	inode uint64
    }
    
    func (n *NetnsWithFd) Close() error {
    	if n.netns == nil {
    		return nil
    	}
    
    	ret := n.netns.Close()
    Go
    - Registered: Wed Apr 24 22:53:08 GMT 2024
    - Last Modified: Fri Jan 26 20:34:28 GMT 2024
    - 1.2K bytes
    - Viewed (0)
  7. cni/pkg/nodeagent/ztunnelserver.go

    	data, err := proto.Marshal(msg)
    	if err != nil {
    		return nil, err
    	}
    	return z.sendDataAndWaitForAck(data, fd)
    }
    
    func (z *ZtunnelConnection) sendDataAndWaitForAck(data []byte, fd *int) (*zdsapi.WorkloadResponse, error) {
    	var rights []byte
    	if fd != nil {
    		rights = unix.UnixRights(*fd)
    	}
    Go
    - Registered: Wed Apr 24 22:53:08 GMT 2024
    - Last Modified: Fri Apr 12 21:47:31 GMT 2024
    - 12.4K bytes
    - Viewed (0)
  8. cmd/os_unix.go

    	}
    	return nil
    }
    
    // openFileWithFD return 'fd' based file descriptor
    func openFileWithFD(name string, flag int, perm os.FileMode) (fd int, err error) {
    	switch flag & writeMode {
    	case writeMode:
    		defer updateOSMetrics(osMetricOpenFileWFd, name)(err)
    	default:
    		defer updateOSMetrics(osMetricOpenFileRFd, name)(err)
    	}
    	var e error
    	fd, e = syscall.Open(name, flag|syscall.O_CLOEXEC, uint32(perm))
    	if e != nil {
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Thu Jan 18 07:03:17 GMT 2024
    - 9.3K bytes
    - Viewed (0)
  9. cni/pkg/repair/netns.go

    	for _, p := range procs {
    		ns := getPidNamespace(p.PID)
    		fd, err := unix.Open(ns, unix.O_RDONLY, 0)
    		if err != nil {
    			// Not uncommon, many processes are transient and we have a TOCTOU here.
    			// No problem, must not be the one we are after.
    			log.Debugf("failed to open pid %v: %v", p.PID, err)
    			continue
    		}
    		id, err := netlink.GetNetNsIdByFd(fd)
    		_ = unix.Close(fd)
    		if err != nil {
    Go
    - Registered: Wed Apr 24 22:53:08 GMT 2024
    - Last Modified: Wed Dec 20 22:14:13 GMT 2023
    - 4.8K bytes
    - Viewed (0)
  10. cni/pkg/nodeagent/netns_linux.go

    	}
    	return &NetnsWrapper{innerNetns: n, inode: i}, nil
    }
    
    func NetnsSet(n NetnsFd) error {
    	if err := unix.Setns(int(n.Fd()), unix.CLONE_NEWNET); err != nil {
    		return fmt.Errorf("Error switching to ns fd %v: %v", n.Fd(), err)
    	}
    	return nil
    }
    
    // inspired by netns.Do() but with an existing fd.
    func NetnsDo(fdable NetnsFd, toRun func() error) error {
    	containedCall := func() error {
    		threadNS, err := netns.GetCurrentNS()
    Go
    - Registered: Wed Apr 24 22:53:08 GMT 2024
    - Last Modified: Wed Jan 31 10:05:36 GMT 2024
    - 2.7K bytes
    - Viewed (0)
Back to top