Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 581826 Details for
Bug 817785
The posix xlator does not fill d_type for READDIRP replies
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
Little test program taken from 'man 2 getdents'
check-dirent-d_type.c (text/plain), 1.85 KB, created by
Niels de Vos
on 2012-05-03 10:49:51 UTC
(
hide
)
Description:
Little test program taken from 'man 2 getdents'
Filename:
MIME Type:
Creator:
Niels de Vos
Created:
2012-05-03 10:49:51 UTC
Size:
1.85 KB
patch
obsolete
>/* example program from 'man 2 getdents' */ > >#define _GNU_SOURCE >#include <dirent.h> /* Defines DT_* constants */ >#include <fcntl.h> >#include <stdio.h> >#include <unistd.h> >#include <stdlib.h> >#include <sys/stat.h> >#include <sys/syscall.h> > >#define handle_error(msg) \ > do { perror(msg); exit(EXIT_FAILURE); } while (0) > >struct linux_dirent { > long d_ino; > off_t d_off; > unsigned short d_reclen; > char d_name[]; >}; > >#define BUF_SIZE 1024 > >int >main(int argc, char *argv[]) >{ > int fd, nread; > char buf[BUF_SIZE]; > struct linux_dirent *d; > int bpos; > char d_type; > > fd = open(argc > 1 ? argv[1] : ".", O_RDONLY | O_DIRECTORY); > if (fd == -1) > handle_error("open"); > > for ( ; ; ) { > nread = syscall(SYS_getdents, fd, buf, BUF_SIZE); > if (nread == -1) > handle_error("getdents"); > > if (nread == 0) > break; > > printf("--------------- nread=%d ---------------\n", nread); > printf("i-node# file type d_reclen d_off d_name\n"); > for (bpos = 0; bpos < nread;) { > d = (struct linux_dirent *) (buf + bpos); > printf("%8ld ", d->d_ino); > d_type = *(buf + bpos + d->d_reclen - 1); > printf("%-10s ", (d_type == DT_REG) ? "regular" : > (d_type == DT_DIR) ? "directory" : > (d_type == DT_FIFO) ? "FIFO" : > (d_type == DT_SOCK) ? "socket" : > (d_type == DT_LNK) ? "symlink" : > (d_type == DT_BLK) ? "block dev" : > (d_type == DT_CHR) ? "char dev" : "???"); > printf("%4d %10lld %s\n", d->d_reclen, > (long long) d->d_off, (char *) d->d_name); > bpos += d->d_reclen; > } > } > > exit(EXIT_SUCCESS); >} >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 817785
: 581826