geom_gate userland utility improvements
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

105 lines
3.5 KiB

  1. .TH libssh2_sftp_fstat_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
  2. .SH NAME
  3. libssh2_sftp_fstat_ex - get or set attributes on an SFTP file handle
  4. .SH SYNOPSIS
  5. .nf
  6. #include <libssh2.h>
  7. #include <libssh2_sftp.h>
  8. int
  9. libssh2_sftp_fstat_ex(LIBSSH2_SFTP_HANDLE *handle,
  10. LIBSSH2_SFTP_ATTRIBUTES *attrs, int setstat)
  11. #define libssh2_sftp_fstat(handle, attrs) \\
  12. libssh2_sftp_fstat_ex((handle), (attrs), 0)
  13. #define libssh2_sftp_fsetstat(handle, attrs) \\
  14. libssh2_sftp_fstat_ex((handle), (attrs), 1)
  15. .fi
  16. .SH DESCRIPTION
  17. \fIhandle\fP - SFTP File Handle as returned by
  18. .BR libssh2_sftp_open_ex(3)
  19. \fIattrs\fP - Pointer to an LIBSSH2_SFTP_ATTRIBUTES structure to set file
  20. metadata from or into depending on the value of setstat.
  21. \fIsetstat\fP - When non-zero, the file's metadata will be updated
  22. with the data found in attrs according to the values of attrs->flags
  23. and other relevant member attributes.
  24. Get or Set statbuf type data for a given LIBSSH2_SFTP_HANDLE instance.
  25. .SH DATA TYPES
  26. LIBSSH2_SFTP_ATTRIBUTES is a typedefed struct that is defined as below
  27. .nf
  28. struct _LIBSSH2_SFTP_ATTRIBUTES {
  29. /* If flags & ATTR_* bit is set, then the value in this
  30. * struct will be meaningful Otherwise it should be ignored
  31. */
  32. unsigned long flags;
  33. /* size of file, in bytes */
  34. libssh2_uint64_t filesize;
  35. /* numerical representation of the user and group owner of
  36. * the file
  37. */
  38. unsigned long uid, gid;
  39. /* bitmask of permissions */
  40. unsigned long permissions;
  41. /* access time and modified time of file */
  42. unsigned long atime, mtime;
  43. };
  44. .fi
  45. You will find a full set of defines and macros to identify flags and
  46. permissions on the \fBlibssh2_sftp.h\fP header file, but some of the
  47. most common ones are:
  48. To check for specific user permissions, the set of defines are in the
  49. pattern LIBSSH2_SFTP_S_I<action><who> where <action> is R, W or X for
  50. read, write and executable and <who> is USR, GRP and OTH for user,
  51. group and other. So, you check for a user readable file, use the bit
  52. \fILIBSSH2_SFTP_S_IRUSR\fP while you want to see if it is executable
  53. for other, you use \fILIBSSH2_SFTP_S_IXOTH\fP and so on.
  54. To check for specific file types, you would previously (before libssh2
  55. 1.2.5) use the standard posix S_IS***() macros, but since 1.2.5
  56. libssh2 offers its own set of macros for this functionality:
  57. .IP LIBSSH2_SFTP_S_ISLNK
  58. Test for a symbolic link
  59. .IP LIBSSH2_SFTP_S_ISREG
  60. Test for a regular file
  61. .IP LIBSSH2_SFTP_S_ISDIR
  62. Test for a directory
  63. .IP LIBSSH2_SFTP_S_ISCHR
  64. Test for a character special file
  65. .IP LIBSSH2_SFTP_S_ISBLK
  66. Test for a block special file
  67. .IP LIBSSH2_SFTP_S_ISFIFO
  68. Test for a pipe or FIFO special file
  69. .IP LIBSSH2_SFTP_S_ISSOCK
  70. Test for a socket
  71. .SH RETURN VALUE
  72. Return 0 on success or negative on failure. It returns
  73. LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
  74. LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
  75. .SH ERRORS
  76. \fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
  77. \fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.
  78. \fILIBSSH2_ERROR_SOCKET_TIMEOUT\fP -
  79. \fILIBSSH2_ERROR_SFTP_PROTOCOL\fP - An invalid SFTP protocol response was
  80. received on the socket, or an SFTP operation caused an errorcode to
  81. be returned by the server.
  82. .SH AVAILABILITY
  83. This function has been around since forever, but most of the
  84. LIBSSH2_SFTP_S_* defines were introduced in libssh2 0.14 and the
  85. LIBSSH2_SFTP_S_IS***() macros were introduced in libssh2 1.2.5.
  86. .SH SEE ALSO
  87. .BR libssh2_sftp_open_ex(3)