Systems programming

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/19

encourage image

There's no tags or description

Looks like no tags are added yet.

20 Terms

1
New cards

File descriptor

A small non-negative integer a process uses to refer to an open file

2
New cards

stdin / stdout / stderr

File descriptors 0, 1, and 2, opened automatically for every process

3
New cards

open()

Opens or creates a file and returns a file descriptor, or -1 on failure

4
New cards

O_RDONLY / O_WRONLY / O_RDWR

Open for reading only, writing only, or reading and writing

5
New cards

O_CREAT

Create the file if it doesn't exist (needs a mode argument)

6
New cards

O_TRUNC

Erase the file's contents if it already exists

7
New cards

O_APPEND

Every write goes to the end of the file

8
New cards

mode

The permissions for a newly created file, such as 0600

9
New cards

close()

Releases a file descriptor; returns 0 on success, -1 on error

10
New cards

read()

Reads up to count bytes; returns bytes read, 0 at end of file, -1 on error

11
New cards

write()

Writes count bytes from a buffer; returns bytes written or -1

12
New cards

lseek()

Moves the file pointer; returns the new offset from the start, or -1

13
New cards

SEEK_SET / SEEK_CUR / SEEK_END

Offset measured from the start, the current position, or the end of the file

14
New cards

File pointer (offset)

The current position in an open file, advanced automatically by read and write

15
New cards

creat / unlink / fcntl

Create an empty file / remove a file / control a file's attributes

16
New cards
17
New cards

IPC

Interprocess communication meaning communication between processes

18
New cards

Signal

An asynchronous event delivered to a process which can occur at any time

19
New cards

Signal handler

A function that runs when a signal arrives; afterward the process resumes where it left off

20
New cards

signal()

Installs a handler for a signal