Questions tagged [character-special-files]
18 questions
10
votes
3 answers
Is it possible to expose TCP tunnel in Linux as special character device?
Recently I found in QNX documentation that it allows to set up message based IPC between processes on separate physical machines by using serial device (dev/serX) and it made me wonder:
Is it possible in Linux to create system-wide special device…
Lapsio
- 1,283
- 2
- 18
- 27
9
votes
1 answer
Which Unix-like system really provides the /dev/tcp special file?
I know /dev/tcp// is a magic path handled specifically by some shells in redirections. But according to man bash:
If the operating system on which bash is running provides these special files, bash will use them; otherwise it will…
Sylvain Leroux
- 649
- 4
- 13
6
votes
1 answer
Is there a difference between u and c in mknod
From man mknod on Linux:
c, u create a character (unbuffered) special file
Why are there 2 letters for the same function? Is there any subtle difference, or they are completely alike?
user123456
- 4,758
- 11
- 52
- 78
6
votes
3 answers
How to tell if a character special file would block if read from
I would like to be able to tell if a character special file would block if a character were read from it without actually reading a character from it. Can this be done?
Charles Stewart
- 502
- 1
- 5
- 18
5
votes
1 answer
How to prevent /dev/null file's permission change or corrupted?
I use this command to check whether gpg password is valid or not:
gpg -o /dev/null --local-user $KEY_ID -as <(echo 1234)
This is a hacked command to check gpg password that I posted here. I can see that the /dev/null file permission changed from…
MaXi32
- 403
- 2
- 12
4
votes
1 answer
Does a Linux block special file have a corresponding character special file
Simple codger question from the days of UNIX... Does Linux have character special files which correspond directly to a block special file? Back in my day each disk in UNIX had both a block special and a character special file. Also, these special…
Andrew Wolfe
- 143
- 4
4
votes
2 answers
Use character device over ssh
I have been looking for a good answer to this question for some time now.
I am trying to remotely control a robot with an Xbox controller. The challenge is that the controller is to be connected to a control station and not to the on-board computer…
Slippers
- 143
- 4
4
votes
2 answers
Character devices for disks on Linux
Why do other UNIX systems need character devices for storage devices when Linux does not?
Other UNIX OSes (AIX, HPUX, Solaris and macOS) use something like '/dev/rdisk#' and '/dev/disk#' for storage devices.
user14755
3
votes
0 answers
Why can't I open a character special file created on my ext4 partition?
As a test, I did sudo mknod test c 5 2 in my Downloads folder, which had the effect of creating a file like /dev/ptmx. However, cat test gives me No such file or directory. However, sudo mknod /dev/test c 5 2 and subsequently cat /dev/test works as…
DrownedSuccess
- 93
- 5
3
votes
2 answers
What do device type numbers mean?
file /dev/* prints the description of a bunch of files as "block special (M/N)" and "character special (M/N)", where M and N are numbers. For example:
$ file /dev/null
/dev/null: character special (1/3)
man file doesn't seem to document these, but…
l0b0
- 50,672
- 41
- 197
- 360
2
votes
4 answers
Char devices and filesystem nodes
I've been reading this book: https://lwn.net/Kernel/LDD3/. Here, the authors distinguish between 3 types of device files, namely char, block, and network devices. In page 6 of the first chapter, I find this:
Character devices
A character (char)…
Suraaj K S
- 224
- 1
- 9
2
votes
1 answer
what will the kernel do when an USB mouse inserted in Linux PC?
I am trying to write a kernel module which loads upon detection of USB Mouse.
I am new to this stuff, I googled for this issue but couldn't find any appropriate solution.
can anyone please explain flow of this?
Desarrollador Rucha
- 43
- 3
2
votes
1 answer
How do I read USB data from a character device
I need to write a "character device" that reads data from an arduino and writes that data to a log file. I have been searching this subject for hours and I have seen a couple of ways to make this work, but they don't use a character device.
I know…
acon__
- 21
- 1
2
votes
1 answer
How to write to a character special device?
Due to a broken udev setup on a machine from which I'm trying to rescue data (see this post of mine) I'm trying to write to a "character special" device corresponding to a USB flash drive, but am encountering difficulty.
What I would expect is that…
Josh Hansen
- 173
- 8
2
votes
1 answer
Create a file whose content is handled by a program
I want to create a special file, of which the content will be generated upon reading from, and processed upon writing to. There should be a background process handling the file. A pipe is not preferred as it never allows dual-band (r/w…
iBug
- 3,428
- 1
- 24
- 57