fsctl.2 (2010 09)
f
fsctl(2) fsctl(2)
with a NULL character. The maximum size of the volume set ID is 128 bytes, so
a length of 129 can be used for outlen and the size of outbuf .
EXAMPLES
The following code fragment gets the extended attribute record for a file on a CDFS volume. The
filename is passed in as the first argument to the routine. Note that error checking is omitted for brevity.
#include <sys/types.h>
#include <sys/vfs.h>
#include <fcntl.h>
#include <sys/cdfsdir.h>
main(argc, argv)
int argc;
char *argv[];
{
int fildes, size = 0;
char *malloc(), *outbuf;
struct statfs buf;
struct cddir cdrec;
struct cdxar_iso *xar;
.
.
.
statfs(argv[1], &buf); /* get logical block size */
fildes = open(argv[1], O_RDONLY); /* open file arg */
/* get directory record for file arg */
fsctl(fildes, CDFS_DIR_REC, &cdrec, sizeof(cdrec));
size = buf.f_bsize * cdrec.cdd_min.mincdd_xar_len; /* compute size */
if(size) { /* if size != 0 then there is an xar */
outbuf = malloc(size); /* malloc sufficient memory */
fsctl(fildes, CDFS_XAR, outbuf, size); /* get xar */
xar = (struct cdxar_iso *)outbuf; /* cast outbuf to access fields */
.
.
.
}
.
.
.
}
RETURN VALUE
fsctl() returns the number of bytes read if successful. If an error occurs, − 1 is returned and errno
is set to indicate the error.
ERRORS
fsctl() fails if any of the following conditions are encountered:
[EBADF] fildes is not a valid open file descriptor.
[EFAULT] outbuf points to an invalid address.
[ENOENT] The requested information does not exist.
[EINVAL] command is not a valid command.
[EINVAL] fildes does not refer to a CDFS file system.
SEE ALSO
statfs(2), cdnode(4), cdrom(4).
2 Hewlett-Packard Company − 2 − HP-UX 11i Version 3: September 2010