proc_create_net_data_write(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… proc_create_net_data_write(9) β€” a Kernel API Manual kiki ✨

okay bestie, welcome to the Kernel API Manual corner of the kernel. this page is about proc_create_net_data_write, and it's giving β€œmake me a writable proc file that's net_ns-specific” energy. let's get into it πŸ’–

🌸 NAME 🌸

proc_create_net_data_write β€” create a writable net_ns-specific proc file, periodt. πŸ’…

✨ SYNOPSIS ✨

struct proc_dir_entry * proc_create_net_data_write (const char *name ,
       umode_t mode , struct proc_dir_entry *parent , const struct
       seq_operations *ops , proc_write_t write , unsigned int state_size ,
       void *data );

πŸŽ€ ARGUMENTS πŸŽ€

  • name β€” the name of the file. like its whole label, no cap.
  • mode β€” the file's access mode. the mode bits vibe, iykyk.
  • parent β€” the parent directory in which to create. where the file lives.
  • ops β€” the seq_file ops with which to read the file. these do the reading magic.
  • write β€” the write method with which to 'modify' the file. yes, 'modify' in quotes.
  • state_size β€” the size of the per-file private state to allocate. allocate that private state, bestie.
  • data β€” data for retrieval by pde_data. it's giving payload.

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so the whole point: create a network namespaced proc file in the parent directory, with the specified name and mode. it allows reading of a file that displays a series of elements, and it also provides for the file accepting writes that have some arbitrary effect. main character behavior, honestly.

the functions in the ops table are used to iterate over items to be presented and extract the readable content using the seq_file interface. that's the reading pipeline, slay.

the write function is called with the data copied into a kernel space scratch buffer and has a NUL appended for convenience. the buffer may be modified by the write function. write should return 0 on success. that's the success vibe check: 0.

the data value is accessible from the show and write functions by calling pde_data on the file inode. and the network namespace must be accessed by calling seq_file_net on the seq_file struct. not optional, bestie β€” that's the rule.

🌈 SEE ALSO 🌈


πŸ’Œ and that's a wrap! source/version: ./fs/proc Β· date: October 2026 Β· page: proc_create_net_data_write(9) Β· mwah, bye bestie πŸ’‹

πŸ“¦ where this page comes from