#include <stdint.h>
#include <atalk/cnid.h>
#include <atalk/globals.h>
#include <atalk/server_child.h>
Go to the source code of this file.
◆ CACHE_HINT_DELETE
| #define CACHE_HINT_DELETE 1 |
◆ CACHE_HINT_DELETE_CHILDREN
| #define CACHE_HINT_DELETE_CHILDREN 2 |
◆ CACHE_HINT_REFRESH
| #define CACHE_HINT_REFRESH 0 |
ostat + dir_modify(DCMOD_STAT)
◆ HINT_BUF_SIZE
| #define HINT_BUF_SIZE 128 |
◆ HINT_FLUSH_INTERVAL_MS
| #define HINT_FLUSH_INTERVAL_MS 50 |
◆ IPC_CACHE_HINT
Cross-process dircache invalidation hint
◆ IPC_DISCOLDSESSION
| #define IPC_DISCOLDSESSION 0 |
◆ IPC_GETSESSION
◆ IPC_HEADERLEN
◆ IPC_LOGINDONE
◆ IPC_MAXMSGSIZE
| #define IPC_MAXMSGSIZE 90 |
◆ IPC_SESSIONTOKEN
| #define IPC_SESSIONTOKEN 6 |
pass opaque reconnect token
◆ IPC_STATE
◆ IPC_VOLUMES
pass list of open volumes
◆ hint_buf_count()
| int hint_buf_count |
( |
void |
| ) |
|
|
extern |
Return current number of buffered hints.
Used by main event loop to decide poll timeout:
- count > 0: use HINT_FLUSH_INTERVAL_MS timeout
- count == 0: use -1 (infinite, block until event)
◆ hint_flush_pending()
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.
◆ ipc_child_state()
| int ipc_child_state |
( |
AFPObj * |
obj, |
|
|
uint16_t |
state |
|
) |
| |
|
extern |
◆ ipc_child_write()
| int ipc_child_write |
( |
AFPObj * |
obj, |
|
|
uint16_t |
command, |
|
|
size_t |
len, |
|
|
void * |
token |
|
) |
| |
|
extern |
◆ ipc_get_hints_dropped()
| unsigned long long ipc_get_hints_dropped |
( |
void |
| ) |
|
|
extern |
◆ ipc_get_hints_sent()
| unsigned long long ipc_get_hints_sent |
( |
void |
| ) |
|
|
extern |
◆ ipc_send_cache_hint()
| int ipc_send_cache_hint |
( |
const AFPObj * |
obj, |
|
|
uint16_t |
vid, |
|
|
cnid_t |
cnid, |
|
|
uint8_t |
event |
|
) |
| |
|
extern |
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
◆ ipc_server_read()
Read a IPC message from a child.
This is using an fd with non-blocking IO, so EAGAIN is not an error
- Parameters
-
| [in,out] | children | pointer to our structure with all childs |
| [in] | fd | IPC socket with child |
- Returns
- -1 on error, 0 on success