LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-25-2005, 01:56 AM   #1
henryluo
Member
 
Registered: Nov 2003
Posts: 36

Rep: Reputation: 15
why i cant get man major() or minor()


hi,all
i cant use man funciton find help for there function, how can i get there two function's help and why it not man page in the linux, thanks..
 
Old 06-25-2005, 09:03 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
I don't know those functions.
Where did you get the names from?
In other words: which library provides them?
If you know the name of the library, you could try install the development package for that lib. Chances are such a package contains the man pages, or other doc's.
 
Old 06-26-2005, 07:32 PM   #3
henryluo
Member
 
Registered: Nov 2003
Posts: 36

Original Poster
Rep: Reputation: 15
thanks , this function in a example code from<Linux Programming Unleashed>,

Code:
[root@localhost linux]# cat mstat.c
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <time.h>
#include <stdlib.h>
#include <stdio.h>

int
main(int argc, char **argv)
{
        struct stat buf;
        mode_t mode;
        char type[80];
        int fd;


        if (argc !=2) {
                puts("USEAGE: mstat {file}");
                exit(EXIT_FAILURE);
        }

        if ((fd = open(argv[1],O_RDONLY)) < 0) {
                perror("open");
                exit(EXIT_FAILURE);
        }

        if ((fstat(fd,&buf)) < 0) {
                perror("fstat");
                exit(EXIT_FAILURE);
        }
        mode = buf.st_mode;
        printf("   FILE: %s\n",argv[1]);
        printf("  INODE: %ld\n",buf.st_ino);
        printf(" DEVICE: %d,%d\n",major(buf.st_dev),
                                  minor(buf.st_dev));
        printf("   MODE: %#o\n",mode & ~(S_IFMT));
        printf("  LINKS: %d\n",buf.st_nlink);
        printf("    UID: %d\n",buf.st_uid);
        printf("    GID: %d\n",buf.st_gid);

        if (S_ISLNK(mode))
                strcpy(type,"Symbolic line");
        else if (S_ISREG(mode))
                strcpy(type,"Regular file");
        else if (S_ISDIR(mode))
                strcpy(type,"Directory");
        else if (S_ISCHR(mode))
                strcpy(type,"Character device");
        else if (S_ISBLK(mode))
                strcpy(type,"Block device");
        else if (S_ISFIFO(mode))
                strcpy(type,"FIFO");
        else if (S_ISSOCK(mode))
                strcpy(type,"Socket");
        else
                strcpy(type,"Unknow type");

        printf("    TYPE: %s\n",type);
        printf("    SIZE: %ld\n",buf.st_size);
        printf("BLK SIZE: %ld\n",buf.st_blksize);
        printf("  BLOCKS: %d\n",(int)buf.st_blocks);
        printf("ACCESSED: %s",ctime(&buf.st_atime));
        printf("MODIFIED: %s",ctime(&buf.st_mtime));
        printf(" CHANGED: %s",ctime(&buf.st_ctime));

        if(close(fd) < 0){
                perror("close");
                exit(EXIT_FAILURE);

        }
        exit(EXIT_SUCCESS);
}
 
Old 06-26-2005, 10:21 PM   #4
Dave Kelly
Member
 
Registered: Aug 2004
Location: Todd Mission Texas
Distribution: Linspire
Posts: 215

Rep: Reputation: 31
Look and see if they are not in the manual for 'mknode'? I believe they are sometimes used in USB drivers.
 
Old 06-27-2005, 02:36 AM   #5
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
These are not functions but convenience macros defined in /usr/include/sys/sysmacros.h

They are documented in "man MAJOR".
 
Old 06-27-2005, 02:39 AM   #6
henryluo
Member
 
Registered: Nov 2003
Posts: 36

Original Poster
Rep: Reputation: 15
thanks, i'll get it see detail..
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to determine major, minor programatically markjuggles Programming 1 04-15-2005 01:09 PM
major and minor vendors of linux Barati Linux - General 9 03-19-2005 03:29 AM
Mouse mknod major/minor numbers? BlurredWeasel Linux - Hardware 2 11-06-2003 02:22 PM
major/minor number zyan Linux - Newbie 2 06-25-2001 06:57 PM
major /minor number zyan Linux - General 0 06-22-2001 02:26 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration