net/can/j1939/socket.c
Source file repositories/reference/linux-study-clean/net/can/j1939/socket.c
File Facts
- System
- Linux kernel
- Corpus path
net/can/j1939/socket.c- Extension
.c- Size
- 34204 bytes
- Lines
- 1407
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/can/can-ml.hlinux/can/core.hlinux/can/skb.hlinux/errqueue.hlinux/if_arp.hnet/can.hj1939-priv.h
Detected Declarations
function j1939_priofunction j1939_to_sk_priorityfunction j1939_pgn_is_validfunction j1939_pgn_is_clean_pdufunction j1939_sock_pending_addfunction j1939_sock_pending_getfunction j1939_sock_pending_delfunction j1939_jsk_addfunction j1939_jsk_delfunction j1939_sk_queue_sessionfunction j1939_sk_queue_drop_allfunction j1939_sk_queue_activate_next_lockedfunction j1939_sk_queue_activate_nextfunction j1939_sk_match_dstfunction j1939_sk_match_filterfunction j1939_sk_recv_match_onefunction j1939_sk_recv_onefunction j1939_sk_recv_matchfunction j1939_sk_recvfunction j1939_sk_sock_destructfunction closedfunction j1939_sk_initfunction j1939_sk_sanity_checkfunction j1939_sk_bindfunction j1939_sk_connectfunction j1939_sk_sock2sockaddr_canfunction j1939_sk_getnamefunction j1939_sk_releasefunction j1939_sk_setsockopt_flagfunction j1939_sk_setsockoptfunction j1939_sk_getsockoptfunction j1939_sk_recvmsgfunction j1939_sk_opt_stats_get_sizefunction j1939_sk_get_timestamping_opt_statsfunction __j1939_sk_errqueuefunction j1939_sk_errqueuefunction j1939_sk_send_loop_abortfunction j1939_sk_send_loopfunction j1939_sk_sendmsgfunction j1939_sk_netdev_event_netdownfunction j1939_sk_netdev_event_unregisterfunction j1939_sk_no_ioctlcmd
Annotated Snippet
static const struct proto_ops j1939_ops = {
.family = PF_CAN,
.release = j1939_sk_release,
.bind = j1939_sk_bind,
.connect = j1939_sk_connect,
.socketpair = sock_no_socketpair,
.accept = sock_no_accept,
.getname = j1939_sk_getname,
.poll = datagram_poll,
.ioctl = j1939_sk_no_ioctlcmd,
.listen = sock_no_listen,
.shutdown = sock_no_shutdown,
.setsockopt = j1939_sk_setsockopt,
.getsockopt = j1939_sk_getsockopt,
.sendmsg = j1939_sk_sendmsg,
.recvmsg = j1939_sk_recvmsg,
.mmap = sock_no_mmap,
};
static struct proto j1939_proto __read_mostly = {
.name = "CAN_J1939",
.owner = THIS_MODULE,
.obj_size = sizeof(struct j1939_sock),
.init = j1939_sk_init,
};
const struct can_proto j1939_can_proto = {
.type = SOCK_DGRAM,
.protocol = CAN_J1939,
.ops = &j1939_ops,
.prot = &j1939_proto,
};
Annotation
- Immediate include surface: `linux/can/can-ml.h`, `linux/can/core.h`, `linux/can/skb.h`, `linux/errqueue.h`, `linux/if_arp.h`, `net/can.h`, `j1939-priv.h`.
- Detected declarations: `function j1939_prio`, `function j1939_to_sk_priority`, `function j1939_pgn_is_valid`, `function j1939_pgn_is_clean_pdu`, `function j1939_sock_pending_add`, `function j1939_sock_pending_get`, `function j1939_sock_pending_del`, `function j1939_jsk_add`, `function j1939_jsk_del`, `function j1939_sk_queue_session`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.