LSTAT(2) UNIX Programmer's Manual LSTAT(2) NAME lstat, lfstat - get extended file status SYNOPSIS #include #include lstat(name, buf) char *name; struct lstat *buf; lfstat(fildes, buf) struct lstat *buf; DESCRIPTION _L_s_t_a_t obtains detailed information about a named file. _L_f_s_t_a_t obtains the same information about an open file known by the file descriptor from a successful _o_p_e_n, _c_r_e_a_t, _d_u_p or _p_i_p_e(2) call. _N_a_m_e points to a null-terminated string naming a file; _b_u_f is the address of a buffer into which information is placed concerning the file. It is unnecessary to have any permis- sions at all with respect to the file, but all directories leading to the file must be searchable. The layout of the structure pointed to by buf as defined in <_l_s_t_a_t._h> is given below. struct lstat { char ls_flag; char ls_count; /* reference count */ dev_t ls_dev; /* device where inode resides */ ino_t ls_number; /* i number, 1-to-1 with device address */ u_short ls_mode; short ls_nlink; /* directory entries */ short ls_uid; /* owner */ short ls_gid; /* group of owner */ off_t ls_size; /* size of file */ union { struct { daddr_t ls_addr[NADDR]; /* if normal file/directory */ daddr_t ls_lastr; /* last logical block read */ }; struct { daddr_t ls_rdev; /* ls_addr[0] */ #ifdef MPX_FILS struct group ls_group; /* multiplexer group file */ #endif }; #ifdef UCB_QUOTAS struct { Printed 12/10/82 1 LSTAT(2) UNIX Programmer's Manual LSTAT(2) daddr_t ls_qused; daddr_t ls_qmax; }; #endif } ls_un; time_t ls_atime; /* access time */ time_t ls_mtime; /* modification time */ time_t ls_ctime; /* creation time */ }; _L_s__m_o_d_e is encoded according to the `#define' statements in . The mode bits 0000070 and 0000007 encode group and others permissions (see _c_h_m_o_d(2)). The defined types, _d_a_d_d_r__t, _i_n_o__t, _o_f_f__t, and _t_i_m_e__t name various width values; _d_e_v__t encodes major and minor device numbers. Their exact definitions are in the include file (see _t_y_p_e_s(5)). When _f_i_l_d_e_s is associated with a pipe, _l_f_s_t_a_t reports an ordinary file with restricted permissions. The size is the number of bytes queued in the pipe. _l_s__a_t_i_m_e is the time the file was last read. For reasons of efficiency, it is not set when a directory is searched, although this would be more logical. _l_s__m_t_i_m_e is the time the file was last written or created. It is not set by changes of owner, group, link count, or mode. _l_s__c_t_i_m_e is set both both by writing and changing the i-node. SEE ALSO ls(1), pq(1), quota(2), stat(2), filsys(5) DIAGNOSTICS Zero is returned if a status is available; -1 if the file cannot be found. ASSEMBLER (local = 58., lfstat = 11.) sys local; 9f . . . .data 9: sys lfstat; fildes; buf (local = 58. lfstat = 12.) sys local; 9f . . . .data 9: sys lstat; name; buf Printed 12/10/82 2