Fix pthread & lrmi segfault issue. ("Oleg I. Vdovikin" <vdovikin@jscc.ru>)
[mplayer/greg.git] / fibmap_mplayer.c
blob75395a90a811df52bbe92dbac7b6ccf0dab61cc7
1 /* (C)2001,2002 by LGB (Gábor Lénárt), lgb@lgb.hu
2 Part of MPlayer project, this source is copyrighted according to GNU/GPL. */
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <string.h>
7 #include <unistd.h>
8 #include <fcntl.h>
9 #include <errno.h>
10 #include <sys/types.h>
11 #include <sys/ioctl.h>
12 #include <sys/stat.h>
14 #ifndef FIBMAP
15 #define FIBMAP 1
16 #endif
18 int main ( int argc , char ** argv )
20 int fd,lba=0;
21 if (argc!=2) {
22 fprintf(stderr,"Bad usage.\n");
23 return 1;
25 if ((fd = open(argv[1], O_RDONLY)) == -1) {
26 fprintf(stderr,"Cannot open file %s: %s\n",
27 argv[1] ? argv[1] : "(NULL)", strerror(errno));
28 return 1;
30 if (ioctl(fd, FIBMAP, &lba) != 0) {
31 fprintf(stderr,"fibmap ioctl: %s (Hint: %s is not suid root?)\n",strerror(errno),argv[0]);
32 close(fd);
33 return 1;
35 close(fd);
36 printf("%d\n",lba);
37 return 0;