Memory and Signal Management Functions in C

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/19

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

20 Terms

1
New cards

mmap

Maps a file/device into memory. Args: addr (hint for mapping location), length (bytes to map), prot (PROT_READ/PROT_WRITE), flags (MAP_SHARED/MAP_PRIVATE), fd (file descriptor), offset (file offset). Returns mapped address.

2
New cards

munmap

Unmaps a memory region. Args: addr (from mmap), length (bytes to unmap). Returns 0/-1.

3
New cards

kill

Sends signal sig to process pid. Returns 0/-1.

4
New cards

sigemptyset

Initializes empty signal set set. Returns 0/-1.

5
New cards

sigfillset

Fills set with all signals. Returns 0/-1.

6
New cards

sigaddset

Adds signal signum to set set. Returns 0/-1.

7
New cards

sigdelset

Removes signal signum from set set. Returns 0/-1.

8
New cards

sigismember

Checks if signum is in set. Returns 1 (yes)/0 (no)/-1 (error).

9
New cards

sigprocmask

Modifies blocked signals. how: SIG_BLOCK/SIG_UNBLOCK/SIG_SETMASK. set/oldset input/output sets. Returns 0/-1.

10
New cards

sigaction

Sets handler for signal sig. act (new settings), oact (old settings). Returns 0/-1.

11
New cards

pause

Waits for any signal. Always returns -1 (interrupted by signal).

12
New cards

sigsuspend

Temporarily replaces signal mask with sigmask and waits. Returns -1 (interrupted).

13
New cards

sigwait

Blocks until signal in sigmask arrives. Stores signal in signo. Returns 0/-1.

14
New cards

pipe

Creates pipe. filedes[0] (read end), filedes[1] (write end). Returns 0/-1.

15
New cards

poll

Monitors multiple file descriptors. fds (array of structs), nfds (count), timeout (ms). Returns # ready FDs/-1.

16
New cards

shmget

Allocates shared memory segment. key (identifier), size (bytes), shmflg (IPC_CREAT|permissions). Returns shmid/-1.

17
New cards

shmat

Attaches shared memory. shmid (from shmget), shmaddr (hint, usually NULL), shmflg (flags). Returns mapped address/(void*)-1.

18
New cards

shmdt

Detaches shared memory at shmaddr. Returns 0/-1.

19
New cards

shmctl

Controls shared memory. shmid, cmd (IPC_RMID to delete), buf (struct for info). Returns 0/-1.

20
New cards

ftok

Generates key for IPC. pathname (existing file), proj_id (unique byte). Returns key/-1.