|
| static int | check_and_increment_rate (pid_t child_pid) |
| static int | serialize_hint (char *buf, const struct hint_entry *e) |
| | Serialize a hint_entry to IPC wire format.
|
| static int | ipc_kill_token (struct ipc_header *ipc, server_child_t *children) |
| | Pass afp_socket to old disconnected session if one has a matching token.
|
| static int | ipc_get_session (struct ipc_header *ipc, server_child_t *children) |
| static int | ipc_login_done (const struct ipc_header *ipc, server_child_t *children) |
| static int | ipc_set_session_token (const struct ipc_header *ipc, server_child_t *children) |
| static int | ipc_set_state (struct ipc_header *ipc, server_child_t *children) |
| static int | ipc_set_volumes (struct ipc_header *ipc, server_child_t *children) |
| static int | ipc_relay_cache_hint (struct ipc_header *ipc, server_child_t *children) |
| | Buffer a dircache hint for batched relay to siblings.
|
| int | ipc_server_read (server_child_t *children, int fd) |
| | Read a IPC message from a child.
|
| int | ipc_child_write (AFPObj *obj, uint16_t command, size_t len, void *msg) |
| int | ipc_child_state (AFPObj *obj, uint16_t state) |
| int | hint_buf_count (void) |
| | Return current number of buffered hints.
|
| void | hint_flush_pending (server_child_t *children) |
| | Flush all buffered hints to sibling children.
|
| unsigned long long | ipc_get_hints_sent (void) |
| unsigned long long | ipc_get_hints_dropped (void) |
| int | ipc_send_cache_hint (const AFPObj *obj, uint16_t vid, cnid_t cnid, uint8_t event) |
| | Send a dircache invalidation hint from child to parent.
|
IPC over socketpair between parent and children.
Flush all buffered hints to sibling children.
Called from the parent main event loop when:
- The 50ms poll timeout expires and hint_buf.count > 0
- hint_buf.count reaches HINT_BUF_SIZE after ipc_server_read
Iterates the child table directly:
- Signals are blocked (no SIGCHLD can modify table)
- SIGCHLD already processed before flush (dead children removed)
- No other thread modifies the table
Performs priority sorting, PIPE_BUF-safe chunked writes.
While this function writes to child pipes, new IPC messages from children accumulate in the kernel socket buffer and are read on the next poll() iteration.
| int ipc_send_cache_hint |
( |
const AFPObj * | obj, |
|
|
uint16_t | vid, |
|
|
cnid_t | cnid, |
|
|
uint8_t | event ) |
Send a dircache invalidation hint from child to parent.
Called directly from AFP command handlers that modify dircache state. Independent of the external FCE system — always active when IPC is available.
Uses a direct non-blocking write() to the IPC socketpair instead of ipc_child_write()/writet() — this ensures the AFP command handler is never blocked waiting for IPC buffer space. If the kernel socket buffer is full (parent not draining fast enough), the hint is silently dropped. Hints are best-effort optimizations, and the dircache validation mechanism & graceful fail-on-use detection makes drops safe.
The 22-byte message (14-byte IPC header + 8-byte payload) is well under the kernel socket buffer size, so partial writes cannot occur when space is available.
- Parameters
-
| [in] | obj | AFPObj with ipc_fd |
| [in] | vid | Volume ID (network byte order, matches vol->v_vid) |
| [in] | cnid | CNID of affected file/dir (network byte order) |
| [in] | event | Hint type: CACHE_HINT_REFRESH, CACHE_HINT_DELETE, or CACHE_HINT_DELETE_CHILDREN |
- Returns
- 0 on success (or graceful drop), -1 on fatal error