1libssh2_sftp_stat_ex(3) libssh2 manual 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 libssh2_sftp_stat_ex(LIBSSH2_SFTP *sftp, const char *path,
13 unsigned int path_len, int stat_type,
14 LIBSSH2_SFTP_ATTRIBUTES *attrs);
15
17 sftp - SFTP instance as returned by libssh2_sftp_init(3)
18
19 path - Remote filesystem object to stat/lstat/setstat.
20
21 path_len - Length of the name of the remote filesystem object to
22 stat/lstat/setstat.
23
24 stat_type - One of the three constants specifying the type of stat
25 operation to perform:
26
27 LIBSSH2_SFTP_STAT: performs stat(2) operation
28 LIBSSH2_SFTP_LSTAT: performs lstat(2) operation
29 LIBSSH2_SFTP_SETSTAT: performs operation to set stat info on file
30
31 attrs - Pointer to a LIBSSH2_SFTP_ATTRIBUTES structure to set file
32 metadata from or into depending on the value of stat_type.
33
34 Get or Set statbuf type data on a remote filesystem object. When get‐
35 ting statbuf data, libssh2_sftp_stat(3) will follow all symlinks, while
36 libssh2_sftp_lstat(3) will return data about the object encountered,
37 even if that object happens to be a symlink.
38
39 The LIBSSH2_SFTP_ATTRIBUTES struct looks like this:
40
41 struct LIBSSH2_SFTP_ATTRIBUTES {
42 /* If flags & ATTR_* bit is set, then the value in this struct will be
43 * meaningful Otherwise it should be ignored
44 */
45 unsigned long flags;
46
47 libssh2_uint64_t filesize;
48 unsigned long uid;
49 unsigned long gid;
50 unsigned long permissions;
51 unsigned long atime;
52 unsigned long mtime;
53 };
54
56 Returns 0 on success or negative on failure. It returns LIB‐
57 SSH2_ERROR_EAGAIN when it would otherwise block. While LIB‐
58 SSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per
59 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
69 received 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)