Sponsored Content
Top Forums Programming mknod system call to clone /dev/null Post 302089367 by blowtorch on Tuesday 19th of September 2006 12:56:32 AM
Old 09-19-2006
nathan,
You are referencing the wrong struct member to get device numbers. You should be referring to st_rdev and not st_dev.

From man stat:
Code:
dev_t    st_dev;      /* ID of device containing */
                           /* a directory entry for this file */
     dev_t    st_rdev;     /* ID of device */
                           /* This entry is defined only for */
                           /* char special or block special files */

Also, if you know the major and the minor device numbers, you can use the makedevice macro to create the device number. The makedevice macro is defined in /usr/include/sys/sysmacros.h. Maybe you could take a look at that file as well.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Q1 :/dev/null Q2 -A

Hi, Q1-What does nroff -ms > /dev/null Q2- What does mean -A under STAT column : ps aux |head -20 UTIL PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND root 516 93,0 0,0 12 12 - A 04 nov 3906:51 wait Thank you. (4 Replies)
Discussion started by: big123456
4 Replies

2. Shell Programming and Scripting

> /dev/null

hello all, In many shell scripts i found '> /dev/null' , i am not able to get this, will any one please explain why we are using this. thanks sudha (2 Replies)
Discussion started by: rrs
2 Replies

3. Solaris

What is /dev/tty /dev/null and /dev/console

Hi, Anyone can help My solaris 8 system has the following /dev/null , /dev/tty and /dev/console All permission are lrwxrwxrwx Can this be change to a non-world write ?? any impact ?? (12 Replies)
Discussion started by: civic2005
12 Replies

4. Shell Programming and Scripting

/dev/null

Hi expert, May I know what is the difference between below cron tab entry ? 0,12 * * * * /abc/myscript.sh > /dev/null 2>&1 0,12 * * * * /abc/myscript.sh (7 Replies)
Discussion started by: olaris
7 Replies

5. Shell Programming and Scripting

/dev/null what is the use of it?

when do you use the path /dev/null (3 Replies)
Discussion started by: webmunkey23
3 Replies

6. UNIX for Dummies Questions & Answers

/dev/null 2>&1 Versus /dev/null 2>1

How are these two different? They both prevent output and error from being displayed. I don't see the use of the "&" echo "hello" > /dev/null 2>&1 echo "hello" > /dev/null 2>1 (3 Replies)
Discussion started by: glev2005
3 Replies

7. Solaris

Canīt open /dev/dsk/c1t0d0s0 Clone/mirror

Hello friends, I Working with Solaris 8 on a SunFireV890, 150 GB SCSI HD's in Raid 1 (mirroring), my problem is that the master disk failed and going to put the slave (mirror) as a Master in the slot 0 (SCSI) will not start. The original mounting this, mirror in Raid 0: c1t0d0s0 (master)... (10 Replies)
Discussion started by: grymorum
10 Replies

8. Shell Programming and Scripting

Redirecting standard out to /dev/null goes to file "/dev/null" instead

I apologize if this question has been answered else where or is too elementary. I ran across a KSH script (long unimportant story) that does this: if ; then CAS_SRC_LOG="/var/log/cas_src.log 2>&1" else CAS_SRC_LOG="/dev/null 2>&1" fithen does this: /usr/bin/echo "heartbeat:... (5 Replies)
Discussion started by: jbmorrisonjr
5 Replies

9. Shell Programming and Scripting

Help with /dev/null Please

Hello All and a Happy New year to yous guys. I'm running the below command on my AIX box and it keeps giving me the message that the file doesn't exist. I know the file don't exist, but I don't want to see the error. 2>/dev/null doesn't work. bash-3.00$ ls -l C* | wc -l 2>/dev/null ls:... (2 Replies)
Discussion started by: bbbngowc
2 Replies

10. Shell Programming and Scripting

2>/dev/null

Friends have the following problem a search may not find anything which would correct example: ls -ltr *prueba.txt | nawk '{ print $9 }' > Procesar.dat 2>/dev/null When he finds nothing gives me the following error ls: prueba.txt: No such file or directory because 2> / dev / null... (4 Replies)
Discussion started by: tricampeon81
4 Replies
mknod(5)							File Formats Manual							  mknod(5)

NAME
mknod.h - header file of macros for handling device numbers SYNOPSIS
DESCRIPTION
The header file defines macros to create and interpret device identification numbers for use with the system call (see mknod(2)). The use of these macros is architecture-dependent. See the System Administration Manual for your system for information on how to select major and minor device numbers. contains the macro which packs the major and minor components into a device identification number suitable for the dev argument of and the two macros: which extract the major and minor number components, respectively, from a device identification number, dev. The macro is a specification (see printf(3S)) that prints the minor number in the format best suited to the particular implementation; it is used by the long format of the command (see ls(1)) to show the minor numbers for device files. The base of the number is indicated in the same way as in the C programming language: no leading zero for decimal, leading zero for octal, and leading for hexadecimal. SEE ALSO
ls(1), mknod(1M), mknod(2), printf(3S). mknod(5)
All times are GMT -4. The time now is 07:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy