Sponsored Content
Top Forums Programming which head file for major and minor function? Post 302319284 by konvalo on Monday 25th of May 2009 01:18:55 AM
Old 05-25-2009
Question which head file for major and minor function?

Code:
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/termios.h>
#include <stdio.h>
#include <stdlib.h>		
#include <stddef.h>		
#include <string.h>		
#include <unistd.h>		
#include <signal.h>	
#include <sys/mkdev.h>

int
main(int argc, char *argv[])
{
  int	i;
  struct stat	buf;

  for (i = 1; i < argc; i++) {
	printf("%s: ", argv[i]);
	if (stat(argv[i], &buf) < 0) {
		err_ret("stat error");
		continue;
	}

	printf("dev = %d/%d", major(buf.st_dev),  minor(buf.st_dev));

	if (S_ISCHR(buf.st_mode) || S_ISBLK(buf.st_mode)) {
		printf(" (%s) rdev = %d/%d",(S_ISCHR(buf.st_mode)) ? "character" : "block",
		major(buf.st_rdev), minor(buf.st_rdev));
	}
	printf("\n");
  }

  exit(0);
}

when I compile above code,it raise following error:
Undefined first referenced
symbol in file
major /var/tmp/ccwkRAdK.o
minor /var/tmp/ccwkRAdK.o
ld: fatal: Symbol referencing errors. No output written to a.out

What raise above error? which head file include major and minor function? How to correct my above code?

Thanks!
 

9 More Discussions You Might Find Interesting

1. Programming

Device Major/Minor numbers

To further my fledgling knowledge of C, I am re-writing some of the Unix command set. My current command is an ls-style command. All works well, except for device files. How do I get the major/minor numbers for the dev files? I see from the stat struct there are st_rdev and st_dev members. Do... (1 Reply)
Discussion started by: zazzybob
1 Replies

2. Solaris

major & minor number

Hi Can anyone tell me what is major number and minor number in the mknod command. Also what these numbers mean. I have gone through the man pages but still I couldn't understand. Regards (3 Replies)
Discussion started by: RajaRC
3 Replies

3. Shell Programming and Scripting

sort major.minor.release_build_x

would like to order this input based on major.minor.release AND build number Label abc_def_0.0.3_build_999 2008/08/01 'Created by me.' Label abc_def_0.0.9_build_1000 2008/08/01 'Created by me.' Label abc_def_9.0.9_build_10001 2008/08/01 'Created by me.' Label abc_def_10.9.100_build_2... (4 Replies)
Discussion started by: gurpal2000
4 Replies

4. Solaris

Help with Major and minor number

Hi Does anyone know what the major and minor numbers are in Solaris? (2 Replies)
Discussion started by: wisdom
2 Replies

5. AIX

how do I change major-minor numbers of disk devices

Good evening ... does anyone of you know how to change major/minor numbers of disk devices ? I had to migrate from raid1 to raid5 and this messed up my ASM cluster - I know which devices should have which IDs to match the content - but I have no idea how to change it. Any help would be... (2 Replies)
Discussion started by: zxmaus
2 Replies

6. AIX

Difference between Major and Minor in AIX

Difference between Major and Minor in AIX (5 Replies)
Discussion started by: AIXlearner
5 Replies

7. Shell Programming and Scripting

How to filter out major and minor?

Hi, I have line like this : proj_name/module/trunk/module_1_0 where the first "1" refers to major version and second "0" refers to minor version. any AWK or command like that so that I can filter out the major and minor ? like major= command | input line minor= command |... (4 Replies)
Discussion started by: bhaskar_m
4 Replies

8. Solaris

Major and Minor number of Virtual File System

Hi friends, Please let me know if there is any way to find out Major and Minor numbers of virtual file system like below: /devices 0K 0K 0K 0% /devices ctfs 0K 0K 0K 0% /system/contract proc 0K 0K ... (8 Replies)
Discussion started by: nitj
8 Replies

9. Shell Programming and Scripting

Filtering my major and minor values

I want to remove all rows with a minor repeating count less than 30% compared to the major repeating count from my table. The values of a col(starting col 2) can assume is A,T,G,C and N. Each row has at least 2 values and at most 4 repeating values(out of ATGC). N is considered a missing value... (12 Replies)
Discussion started by: newbie83
12 Replies
GLXQUERYVERSION(3G)						   OpenGL Manual					       GLXQUERYVERSION(3G)

NAME
glXQueryVersion - return the version numbers of the GLX extension C SPECIFICATION
Bool glXQueryVersion(Display * dpy, int * major, int * minor); PARAMETERS
dpy Specifies the connection to the X server. major Returns the major version number of the GLX server extension. minor Returns the minor version number of the GLX server extension. DESCRIPTION
glXQueryVersion returns the major and minor version numbers of the GLX extension implemented by the server associated with connection dpy. Implementations with the same major version number are upward compatible, meaning that the implementation with the higher minor number is a superset of the version with the lower minor number. major and minor do not return values if they are specified as NULL. ERRORS
glXQueryVersion returns False if it fails, True otherwise. major and minor are not updated when False is returned. SEE ALSO
glXQueryExtension() COPYRIGHT
Copyright (C) 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/. AUTHORS
opengl.org opengl.org 06/10/2014 GLXQUERYVERSION(3G)
All times are GMT -4. The time now is 07:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy