1libssh2_sftp_stat_ex(3) libssh2 libssh2_sftp_stat_ex(3)
2
3
4
6 libssh2_sftp_stat_ex - get status about an SFTP file
7
9 #include <libssh2.h>
10 #include <libssh2_sftp.h>
11
12 int
13 libssh2_sftp_stat_ex(LIBSSH2_SFTP *sftp, const char *path,
14 unsigned int path_len, int stat_type,
15 LIBSSH2_SFTP_ATTRIBUTES *attrs);
16
18 sftp - SFTP instance as returned by libssh2_sftp_init(3)
19
20 path - Remote filesystem object to stat/lstat/setstat.
21
22 path_len - Length of the name of the remote filesystem object to
23 stat/lstat/setstat.
24
25 stat_type - One of the three constants specifying the type of stat op‐
26 eration to perform:
27
28 LIBSSH2_SFTP_STAT: performs stat(2) operation
29 LIBSSH2_SFTP_LSTAT: performs lstat(2) operation
30 LIBSSH2_SFTP_SETSTAT: performs operation to set stat info on file
31
32 attrs - Pointer to a LIBSSH2_SFTP_ATTRIBUTES structure to set file
33 metadata from or into depending on the value of stat_type.
34
35 Get or Set statbuf type data on a remote filesystem object. When get‐
36 ting statbuf data, libssh2_sftp_stat(3) will follow all symlinks, while
37 libssh2_sftp_lstat(3) will return data about the object encountered,
38 even if that object happens to be a symlink.
39
40 The LIBSSH2_SFTP_ATTRIBUTES struct looks like this:
41
42 struct LIBSSH2_SFTP_ATTRIBUTES {
43 /* If flags & ATTR_* bit is set, then the value in this struct will be
44 * meaningful Otherwise it should be ignored
45 */
46 unsigned long flags;
47
48 libssh2_uint64_t filesize;
49 unsigned long uid;
50 unsigned long gid;
51 unsigned long permissions;
52 unsigned long atime;
53 unsigned long mtime;
54 };
55
57 Returns 0 on success or negative on failure. It returns LIBSSH2_ER‐
58 ROR_EAGAIN when it would otherwise block. While LIBSSH2_ERROR_EAGAIN is
59 a negative number, it is not really a failure per se.
60
62 LIBSSH2_ERROR_ALLOC - An internal memory allocation call failed.
63
64 LIBSSH2_ERROR_SOCKET_SEND - Unable to send data on socket.
65
66 LIBSSH2_ERROR_SOCKET_TIMEOUT -
67
68 LIBSSH2_ERROR_SFTP_PROTOCOL - An invalid SFTP protocol response was re‐
69 ceived on the socket, or an SFTP operation caused an errorcode to be
70 returned by the server.
71
73 libssh2_sftp_init(3)
74
75
76
77libssh2 0.15 1 Jun 2007 libssh2_sftp_stat_ex(3)