Questions tagged [api]
83 questions
51
votes
8 answers
On Unix systems, why do we have to explicitly `open()` and `close()` files to be able to `read()` or `write()` them?
Why do open() and close() exist in the Unix filesystem design?
Couldn't the OS just detect the first time read() or write() was called and do whatever open() would normally do?
user5977637
- 645
- 5
- 7
26
votes
4 answers
After fork(), where does the child begin its execution?
I'm trying to learn UNIX programming and came across a question regarding fork(). I understand that fork() creates an identical process of the currently running process, but where does it start? For example, if I have code
int main (int argc, char…
thomas1234
20
votes
6 answers
How stable are Unix shell "stdin/stdout APIs"?
grepping, awking, sedding, and piping are day-to-day routine of a user of any Unix-like operating system, may it be on the command line or inside a shell script (collectively called filters from now on).
At their essence, when working with…
Abdull
- 665
- 1
- 7
- 13
13
votes
4 answers
Why does *BSD uses driver specific names for network interfaces? Does it imply limitations?
I notice that depending on the brand of the network card, interface names differ (driver dependent I suppose).
Why does *BSD uses driver specific names for network interfaces?
Does it mean there is no abstraction layer describing "a generic network…
Totor
- 19,302
- 17
- 75
- 102
9
votes
1 answer
On what UNIX-like system / filesystem is the st_blocks field returned by stat() not a number of 512-byte units?
I always assumed the st_blocks field returned by stat()/lstat()... system calls and which du uses to get the disk usage of files was expressed in 512 bytes units.
Checking the POSIX specification, I now see POSIX makes no guarantee for that. The…
Stéphane Chazelas
- 522,931
- 91
- 1,010
- 1,501
9
votes
2 answers
What is the meaning of "curl -k -i -X" in Linux?
I have read the man pages of Curl, but I can't understand what those parameters (k, i and X) mean. I see it used in a REST API call, but can someone please explain what those three parameters do? It's not clear in the documentation.
Thank you in…
Zac
- 237
- 1
- 2
- 5
8
votes
2 answers
Is there a faster interface for info from /proc/net/tcp?
Given a linux TCP socket's inode (obtained via /proc//fd), is there a faster way to look up the information that I can get from /proc/net/tcp about this socket?
I have written a troubleshooting tool which monitors processes and prints…
ntnt
- 81
- 1
- 2
6
votes
1 answer
Can I read and write to alternate HFS+ file forks or NTFS data streams from Linux?
It's possible to mount both Apple HFS+ and Microsoft NTFS filesystems under Linux.
Both filesystems support multiple content streams per file, though this is not widely used.
Apple uses the term fork.
Microsoft uses the term Alternate Data…
hippietrail
- 350
- 1
- 2
- 14
5
votes
3 answers
What is the relation between SIGCHLD and `waitpid()` or`wait()`?
If I am correct, a process waits for its children to terminate or stop by calling the waitpid() or wait() function.
What is the relation between SIGCHLD signal and the waitpid() orwait() functions?
Is it correct that when a process calls the…
Tim
- 98,580
- 191
- 570
- 977
5
votes
1 answer
Why is st_blocks always reported in 512-byte blocks?
I was debugging a fuse filesystem that was reporting wrong sizes for du. It turned out that it was putting st_size / st_blksize [*] into st_blocks of the stat structure. The Linux manual page for stat(2) says:
struct stat {
…
off_t …
liori
- 612
- 4
- 12
4
votes
1 answer
Use case of providing file-like API to terminal/console
It was explained in this Stack Overflow thread that each logical terminal has a "pseudo-terminal", and that writing to one:
$ cat some-file.txt > /dev/ttys002
will cause the data to appear in that terminal window. What's the reason for providing a…
Bleeding Fingers
- 971
- 3
- 12
- 23
4
votes
1 answer
How can I observer the desktop GUI interacting with the shell?
For example, if I change the sound volume by the ubuntu desktop widget, I think it will issue some commands to the shell or run a script.
Is it possible to see what it runs?
user17
- 141
- 1
4
votes
1 answer
TWAIN API support on FreeBSD
Does FreeBSD support in any way the TWAIN API? If not, what is the API that could be used to read data from imaging devices (webcams) - preferably in a portable way.
WebMonster
- 215
- 1
- 2
4
votes
4 answers
What is "fs" short for in kernel function "get_fs()"?
There are two Linux kernel functions:
get_ds() and get_fs()
According to this article, I know ds is short for data segment.
However, I cannot guess what "fs" is short for.
Any explanations?
xmllmx
- 1,750
- 2
- 19
- 29
4
votes
2 answers
API Monitoring and Hooking
I am currently reading the "Malware Analyst's Cookbook and DVD". There is a chapter "Dynamic Analysis" and there are also some recipes about hooking and monitoring API calls of process but it is for Windows.
I want to do the same thing like recipe…
Greeneco
- 391
- 1
- 3
- 11