proc.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. /* SCTP kernel implementation
  2. * Copyright (c) 2003 International Business Machines, Corp.
  3. *
  4. * This file is part of the SCTP kernel implementation
  5. *
  6. * This SCTP implementation is free software;
  7. * you can redistribute it and/or modify it under the terms of
  8. * the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2, or (at your option)
  10. * any later version.
  11. *
  12. * This SCTP implementation is distributed in the hope that it
  13. * will be useful, but WITHOUT ANY WARRANTY; without even the implied
  14. * ************************
  15. * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16. * See the GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with GNU CC; see the file COPYING. If not, see
  20. * <http://www.gnu.org/licenses/>.
  21. *
  22. * Please send any bug reports or fixes you make to the
  23. * email address(es):
  24. * lksctp developers <linux-sctp@vger.kernel.org>
  25. *
  26. * Written or modified by:
  27. * Sridhar Samudrala <sri@us.ibm.com>
  28. */
  29. #include <linux/types.h>
  30. #include <linux/seq_file.h>
  31. #include <linux/init.h>
  32. #include <linux/export.h>
  33. #include <net/sctp/sctp.h>
  34. #include <net/ip.h> /* for snmp_fold_field */
  35. static const struct snmp_mib sctp_snmp_list[] = {
  36. SNMP_MIB_ITEM("SctpCurrEstab", SCTP_MIB_CURRESTAB),
  37. SNMP_MIB_ITEM("SctpActiveEstabs", SCTP_MIB_ACTIVEESTABS),
  38. SNMP_MIB_ITEM("SctpPassiveEstabs", SCTP_MIB_PASSIVEESTABS),
  39. SNMP_MIB_ITEM("SctpAborteds", SCTP_MIB_ABORTEDS),
  40. SNMP_MIB_ITEM("SctpShutdowns", SCTP_MIB_SHUTDOWNS),
  41. SNMP_MIB_ITEM("SctpOutOfBlues", SCTP_MIB_OUTOFBLUES),
  42. SNMP_MIB_ITEM("SctpChecksumErrors", SCTP_MIB_CHECKSUMERRORS),
  43. SNMP_MIB_ITEM("SctpOutCtrlChunks", SCTP_MIB_OUTCTRLCHUNKS),
  44. SNMP_MIB_ITEM("SctpOutOrderChunks", SCTP_MIB_OUTORDERCHUNKS),
  45. SNMP_MIB_ITEM("SctpOutUnorderChunks", SCTP_MIB_OUTUNORDERCHUNKS),
  46. SNMP_MIB_ITEM("SctpInCtrlChunks", SCTP_MIB_INCTRLCHUNKS),
  47. SNMP_MIB_ITEM("SctpInOrderChunks", SCTP_MIB_INORDERCHUNKS),
  48. SNMP_MIB_ITEM("SctpInUnorderChunks", SCTP_MIB_INUNORDERCHUNKS),
  49. SNMP_MIB_ITEM("SctpFragUsrMsgs", SCTP_MIB_FRAGUSRMSGS),
  50. SNMP_MIB_ITEM("SctpReasmUsrMsgs", SCTP_MIB_REASMUSRMSGS),
  51. SNMP_MIB_ITEM("SctpOutSCTPPacks", SCTP_MIB_OUTSCTPPACKS),
  52. SNMP_MIB_ITEM("SctpInSCTPPacks", SCTP_MIB_INSCTPPACKS),
  53. SNMP_MIB_ITEM("SctpT1InitExpireds", SCTP_MIB_T1_INIT_EXPIREDS),
  54. SNMP_MIB_ITEM("SctpT1CookieExpireds", SCTP_MIB_T1_COOKIE_EXPIREDS),
  55. SNMP_MIB_ITEM("SctpT2ShutdownExpireds", SCTP_MIB_T2_SHUTDOWN_EXPIREDS),
  56. SNMP_MIB_ITEM("SctpT3RtxExpireds", SCTP_MIB_T3_RTX_EXPIREDS),
  57. SNMP_MIB_ITEM("SctpT4RtoExpireds", SCTP_MIB_T4_RTO_EXPIREDS),
  58. SNMP_MIB_ITEM("SctpT5ShutdownGuardExpireds", SCTP_MIB_T5_SHUTDOWN_GUARD_EXPIREDS),
  59. SNMP_MIB_ITEM("SctpDelaySackExpireds", SCTP_MIB_DELAY_SACK_EXPIREDS),
  60. SNMP_MIB_ITEM("SctpAutocloseExpireds", SCTP_MIB_AUTOCLOSE_EXPIREDS),
  61. SNMP_MIB_ITEM("SctpT3Retransmits", SCTP_MIB_T3_RETRANSMITS),
  62. SNMP_MIB_ITEM("SctpPmtudRetransmits", SCTP_MIB_PMTUD_RETRANSMITS),
  63. SNMP_MIB_ITEM("SctpFastRetransmits", SCTP_MIB_FAST_RETRANSMITS),
  64. SNMP_MIB_ITEM("SctpInPktSoftirq", SCTP_MIB_IN_PKT_SOFTIRQ),
  65. SNMP_MIB_ITEM("SctpInPktBacklog", SCTP_MIB_IN_PKT_BACKLOG),
  66. SNMP_MIB_ITEM("SctpInPktDiscards", SCTP_MIB_IN_PKT_DISCARDS),
  67. SNMP_MIB_ITEM("SctpInDataChunkDiscards", SCTP_MIB_IN_DATA_CHUNK_DISCARDS),
  68. SNMP_MIB_SENTINEL
  69. };
  70. /* Display sctp snmp mib statistics(/proc/net/sctp/snmp). */
  71. static int sctp_snmp_seq_show(struct seq_file *seq, void *v)
  72. {
  73. struct net *net = seq->private;
  74. int i;
  75. for (i = 0; sctp_snmp_list[i].name != NULL; i++)
  76. seq_printf(seq, "%-32s\t%ld\n", sctp_snmp_list[i].name,
  77. snmp_fold_field(net->sctp.sctp_statistics,
  78. sctp_snmp_list[i].entry));
  79. return 0;
  80. }
  81. /* Initialize the seq file operations for 'snmp' object. */
  82. static int sctp_snmp_seq_open(struct inode *inode, struct file *file)
  83. {
  84. return single_open_net(inode, file, sctp_snmp_seq_show);
  85. }
  86. static const struct file_operations sctp_snmp_seq_fops = {
  87. .owner = THIS_MODULE,
  88. .open = sctp_snmp_seq_open,
  89. .read = seq_read,
  90. .llseek = seq_lseek,
  91. .release = single_release_net,
  92. };
  93. /* Set up the proc fs entry for 'snmp' object. */
  94. int __net_init sctp_snmp_proc_init(struct net *net)
  95. {
  96. struct proc_dir_entry *p;
  97. p = proc_create("snmp", S_IRUGO, net->sctp.proc_net_sctp,
  98. &sctp_snmp_seq_fops);
  99. if (!p)
  100. return -ENOMEM;
  101. return 0;
  102. }
  103. /* Cleanup the proc fs entry for 'snmp' object. */
  104. void sctp_snmp_proc_exit(struct net *net)
  105. {
  106. remove_proc_entry("snmp", net->sctp.proc_net_sctp);
  107. }
  108. /* Dump local addresses of an association/endpoint. */
  109. static void sctp_seq_dump_local_addrs(struct seq_file *seq, struct sctp_ep_common *epb)
  110. {
  111. struct sctp_association *asoc;
  112. struct sctp_sockaddr_entry *laddr;
  113. struct sctp_transport *peer;
  114. union sctp_addr *addr, *primary = NULL;
  115. struct sctp_af *af;
  116. if (epb->type == SCTP_EP_TYPE_ASSOCIATION) {
  117. asoc = sctp_assoc(epb);
  118. peer = asoc->peer.primary_path;
  119. if (unlikely(peer == NULL)) {
  120. WARN(1, "Association %p with NULL primary path!\n", asoc);
  121. return;
  122. }
  123. primary = &peer->saddr;
  124. }
  125. rcu_read_lock();
  126. list_for_each_entry_rcu(laddr, &epb->bind_addr.address_list, list) {
  127. if (!laddr->valid)
  128. continue;
  129. addr = &laddr->a;
  130. af = sctp_get_af_specific(addr->sa.sa_family);
  131. if (primary && af->cmp_addr(addr, primary)) {
  132. seq_printf(seq, "*");
  133. }
  134. af->seq_dump_addr(seq, addr);
  135. }
  136. rcu_read_unlock();
  137. }
  138. /* Dump remote addresses of an association. */
  139. static void sctp_seq_dump_remote_addrs(struct seq_file *seq, struct sctp_association *assoc)
  140. {
  141. struct sctp_transport *transport;
  142. union sctp_addr *addr, *primary;
  143. struct sctp_af *af;
  144. primary = &assoc->peer.primary_addr;
  145. rcu_read_lock();
  146. list_for_each_entry_rcu(transport, &assoc->peer.transport_addr_list,
  147. transports) {
  148. addr = &transport->ipaddr;
  149. af = sctp_get_af_specific(addr->sa.sa_family);
  150. if (af->cmp_addr(addr, primary)) {
  151. seq_printf(seq, "*");
  152. }
  153. af->seq_dump_addr(seq, addr);
  154. }
  155. rcu_read_unlock();
  156. }
  157. static void *sctp_eps_seq_start(struct seq_file *seq, loff_t *pos)
  158. {
  159. if (*pos >= sctp_ep_hashsize)
  160. return NULL;
  161. if (*pos < 0)
  162. *pos = 0;
  163. if (*pos == 0)
  164. seq_printf(seq, " ENDPT SOCK STY SST HBKT LPORT UID INODE LADDRS\n");
  165. return (void *)pos;
  166. }
  167. static void sctp_eps_seq_stop(struct seq_file *seq, void *v)
  168. {
  169. }
  170. static void *sctp_eps_seq_next(struct seq_file *seq, void *v, loff_t *pos)
  171. {
  172. if (++*pos >= sctp_ep_hashsize)
  173. return NULL;
  174. return pos;
  175. }
  176. /* Display sctp endpoints (/proc/net/sctp/eps). */
  177. static int sctp_eps_seq_show(struct seq_file *seq, void *v)
  178. {
  179. struct sctp_hashbucket *head;
  180. struct sctp_ep_common *epb;
  181. struct sctp_endpoint *ep;
  182. struct sock *sk;
  183. int hash = *(loff_t *)v;
  184. if (hash >= sctp_ep_hashsize)
  185. return -ENOMEM;
  186. head = &sctp_ep_hashtable[hash];
  187. local_bh_disable();
  188. read_lock(&head->lock);
  189. sctp_for_each_hentry(epb, &head->chain) {
  190. ep = sctp_ep(epb);
  191. sk = epb->sk;
  192. if (!net_eq(sock_net(sk), seq_file_net(seq)))
  193. continue;
  194. seq_printf(seq, "%8pK %8pK %-3d %-3d %-4d %-5d %5u %5lu ", ep, sk,
  195. sctp_sk(sk)->type, sk->sk_state, hash,
  196. epb->bind_addr.port,
  197. from_kuid_munged(seq_user_ns(seq), sock_i_uid(sk)),
  198. sock_i_ino(sk));
  199. sctp_seq_dump_local_addrs(seq, epb);
  200. seq_printf(seq, "\n");
  201. }
  202. read_unlock(&head->lock);
  203. local_bh_enable();
  204. return 0;
  205. }
  206. static const struct seq_operations sctp_eps_ops = {
  207. .start = sctp_eps_seq_start,
  208. .next = sctp_eps_seq_next,
  209. .stop = sctp_eps_seq_stop,
  210. .show = sctp_eps_seq_show,
  211. };
  212. /* Initialize the seq file operations for 'eps' object. */
  213. static int sctp_eps_seq_open(struct inode *inode, struct file *file)
  214. {
  215. return seq_open_net(inode, file, &sctp_eps_ops,
  216. sizeof(struct seq_net_private));
  217. }
  218. static const struct file_operations sctp_eps_seq_fops = {
  219. .open = sctp_eps_seq_open,
  220. .read = seq_read,
  221. .llseek = seq_lseek,
  222. .release = seq_release_net,
  223. };
  224. /* Set up the proc fs entry for 'eps' object. */
  225. int __net_init sctp_eps_proc_init(struct net *net)
  226. {
  227. struct proc_dir_entry *p;
  228. p = proc_create("eps", S_IRUGO, net->sctp.proc_net_sctp,
  229. &sctp_eps_seq_fops);
  230. if (!p)
  231. return -ENOMEM;
  232. return 0;
  233. }
  234. /* Cleanup the proc fs entry for 'eps' object. */
  235. void sctp_eps_proc_exit(struct net *net)
  236. {
  237. remove_proc_entry("eps", net->sctp.proc_net_sctp);
  238. }
  239. struct sctp_ht_iter {
  240. struct seq_net_private p;
  241. struct rhashtable_iter hti;
  242. };
  243. static struct sctp_transport *sctp_transport_get_next(struct seq_file *seq)
  244. {
  245. struct sctp_ht_iter *iter = seq->private;
  246. struct sctp_transport *t;
  247. t = rhashtable_walk_next(&iter->hti);
  248. for (; t; t = rhashtable_walk_next(&iter->hti)) {
  249. if (IS_ERR(t)) {
  250. if (PTR_ERR(t) == -EAGAIN)
  251. continue;
  252. break;
  253. }
  254. if (net_eq(sock_net(t->asoc->base.sk), seq_file_net(seq)) &&
  255. t->asoc->peer.primary_path == t)
  256. break;
  257. }
  258. return t;
  259. }
  260. static struct sctp_transport *sctp_transport_get_idx(struct seq_file *seq,
  261. loff_t pos)
  262. {
  263. void *obj = SEQ_START_TOKEN;
  264. while (pos && (obj = sctp_transport_get_next(seq)) && !IS_ERR(obj))
  265. pos--;
  266. return obj;
  267. }
  268. static int sctp_transport_walk_start(struct seq_file *seq)
  269. {
  270. struct sctp_ht_iter *iter = seq->private;
  271. int err;
  272. err = rhashtable_walk_init(&sctp_transport_hashtable, &iter->hti);
  273. if (err)
  274. return err;
  275. err = rhashtable_walk_start(&iter->hti);
  276. return err == -EAGAIN ? 0 : err;
  277. }
  278. static void sctp_transport_walk_stop(struct seq_file *seq)
  279. {
  280. struct sctp_ht_iter *iter = seq->private;
  281. rhashtable_walk_stop(&iter->hti);
  282. rhashtable_walk_exit(&iter->hti);
  283. }
  284. static void *sctp_assocs_seq_start(struct seq_file *seq, loff_t *pos)
  285. {
  286. int err = sctp_transport_walk_start(seq);
  287. if (err)
  288. return ERR_PTR(err);
  289. return sctp_transport_get_idx(seq, *pos);
  290. }
  291. static void sctp_assocs_seq_stop(struct seq_file *seq, void *v)
  292. {
  293. sctp_transport_walk_stop(seq);
  294. }
  295. static void *sctp_assocs_seq_next(struct seq_file *seq, void *v, loff_t *pos)
  296. {
  297. ++*pos;
  298. return sctp_transport_get_next(seq);
  299. }
  300. /* Display sctp associations (/proc/net/sctp/assocs). */
  301. static int sctp_assocs_seq_show(struct seq_file *seq, void *v)
  302. {
  303. struct sctp_transport *transport;
  304. struct sctp_association *assoc;
  305. struct sctp_ep_common *epb;
  306. struct sock *sk;
  307. if (v == SEQ_START_TOKEN) {
  308. seq_printf(seq, " ASSOC SOCK STY SST ST HBKT "
  309. "ASSOC-ID TX_QUEUE RX_QUEUE UID INODE LPORT "
  310. "RPORT LADDRS <-> RADDRS "
  311. "HBINT INS OUTS MAXRT T1X T2X RTXC "
  312. "wmema wmemq sndbuf rcvbuf\n");
  313. return 0;
  314. }
  315. transport = (struct sctp_transport *)v;
  316. if (!sctp_transport_hold(transport))
  317. return 0;
  318. assoc = transport->asoc;
  319. epb = &assoc->base;
  320. sk = epb->sk;
  321. seq_printf(seq,
  322. "%8pK %8pK %-3d %-3d %-2d %-4d "
  323. "%4d %8d %8d %7u %5lu %-5d %5d ",
  324. assoc, sk, sctp_sk(sk)->type, sk->sk_state,
  325. assoc->state, 0,
  326. assoc->assoc_id,
  327. assoc->sndbuf_used,
  328. atomic_read(&assoc->rmem_alloc),
  329. from_kuid_munged(seq_user_ns(seq), sock_i_uid(sk)),
  330. sock_i_ino(sk),
  331. epb->bind_addr.port,
  332. assoc->peer.port);
  333. seq_printf(seq, " ");
  334. sctp_seq_dump_local_addrs(seq, epb);
  335. seq_printf(seq, "<-> ");
  336. sctp_seq_dump_remote_addrs(seq, assoc);
  337. seq_printf(seq, "\t%8lu %5d %5d %4d %4d %4d %8d "
  338. "%8d %8d %8d %8d",
  339. assoc->hbinterval, assoc->c.sinit_max_instreams,
  340. assoc->c.sinit_num_ostreams, assoc->max_retrans,
  341. assoc->init_retries, assoc->shutdown_retries,
  342. assoc->rtx_data_chunks,
  343. atomic_read(&sk->sk_wmem_alloc),
  344. sk->sk_wmem_queued,
  345. sk->sk_sndbuf,
  346. sk->sk_rcvbuf);
  347. seq_printf(seq, "\n");
  348. sctp_transport_put(transport);
  349. return 0;
  350. }
  351. static const struct seq_operations sctp_assoc_ops = {
  352. .start = sctp_assocs_seq_start,
  353. .next = sctp_assocs_seq_next,
  354. .stop = sctp_assocs_seq_stop,
  355. .show = sctp_assocs_seq_show,
  356. };
  357. /* Initialize the seq file operations for 'assocs' object. */
  358. static int sctp_assocs_seq_open(struct inode *inode, struct file *file)
  359. {
  360. return seq_open_net(inode, file, &sctp_assoc_ops,
  361. sizeof(struct sctp_ht_iter));
  362. }
  363. static const struct file_operations sctp_assocs_seq_fops = {
  364. .open = sctp_assocs_seq_open,
  365. .read = seq_read,
  366. .llseek = seq_lseek,
  367. .release = seq_release_net,
  368. };
  369. /* Set up the proc fs entry for 'assocs' object. */
  370. int __net_init sctp_assocs_proc_init(struct net *net)
  371. {
  372. struct proc_dir_entry *p;
  373. p = proc_create("assocs", S_IRUGO, net->sctp.proc_net_sctp,
  374. &sctp_assocs_seq_fops);
  375. if (!p)
  376. return -ENOMEM;
  377. return 0;
  378. }
  379. /* Cleanup the proc fs entry for 'assocs' object. */
  380. void sctp_assocs_proc_exit(struct net *net)
  381. {
  382. remove_proc_entry("assocs", net->sctp.proc_net_sctp);
  383. }
  384. static void *sctp_remaddr_seq_start(struct seq_file *seq, loff_t *pos)
  385. {
  386. int err = sctp_transport_walk_start(seq);
  387. if (err)
  388. return ERR_PTR(err);
  389. return sctp_transport_get_idx(seq, *pos);
  390. }
  391. static void *sctp_remaddr_seq_next(struct seq_file *seq, void *v, loff_t *pos)
  392. {
  393. ++*pos;
  394. return sctp_transport_get_next(seq);
  395. }
  396. static void sctp_remaddr_seq_stop(struct seq_file *seq, void *v)
  397. {
  398. sctp_transport_walk_stop(seq);
  399. }
  400. static int sctp_remaddr_seq_show(struct seq_file *seq, void *v)
  401. {
  402. struct sctp_association *assoc;
  403. struct sctp_transport *tsp;
  404. if (v == SEQ_START_TOKEN) {
  405. seq_printf(seq, "ADDR ASSOC_ID HB_ACT RTO MAX_PATH_RTX "
  406. "REM_ADDR_RTX START STATE\n");
  407. return 0;
  408. }
  409. tsp = (struct sctp_transport *)v;
  410. if (!sctp_transport_hold(tsp))
  411. return 0;
  412. assoc = tsp->asoc;
  413. list_for_each_entry_rcu(tsp, &assoc->peer.transport_addr_list,
  414. transports) {
  415. /*
  416. * The remote address (ADDR)
  417. */
  418. tsp->af_specific->seq_dump_addr(seq, &tsp->ipaddr);
  419. seq_printf(seq, " ");
  420. /*
  421. * The association ID (ASSOC_ID)
  422. */
  423. seq_printf(seq, "%d ", tsp->asoc->assoc_id);
  424. /*
  425. * If the Heartbeat is active (HB_ACT)
  426. * Note: 1 = Active, 0 = Inactive
  427. */
  428. seq_printf(seq, "%d ", timer_pending(&tsp->hb_timer));
  429. /*
  430. * Retransmit time out (RTO)
  431. */
  432. seq_printf(seq, "%lu ", tsp->rto);
  433. /*
  434. * Maximum path retransmit count (PATH_MAX_RTX)
  435. */
  436. seq_printf(seq, "%d ", tsp->pathmaxrxt);
  437. /*
  438. * remote address retransmit count (REM_ADDR_RTX)
  439. * Note: We don't have a way to tally this at the moment
  440. * so lets just leave it as zero for the moment
  441. */
  442. seq_puts(seq, "0 ");
  443. /*
  444. * remote address start time (START). This is also not
  445. * currently implemented, but we can record it with a
  446. * jiffies marker in a subsequent patch
  447. */
  448. seq_puts(seq, "0 ");
  449. /*
  450. * The current state of this destination. I.e.
  451. * SCTP_ACTIVE, SCTP_INACTIVE, ...
  452. */
  453. seq_printf(seq, "%d", tsp->state);
  454. seq_printf(seq, "\n");
  455. }
  456. sctp_transport_put(tsp);
  457. return 0;
  458. }
  459. static const struct seq_operations sctp_remaddr_ops = {
  460. .start = sctp_remaddr_seq_start,
  461. .next = sctp_remaddr_seq_next,
  462. .stop = sctp_remaddr_seq_stop,
  463. .show = sctp_remaddr_seq_show,
  464. };
  465. /* Cleanup the proc fs entry for 'remaddr' object. */
  466. void sctp_remaddr_proc_exit(struct net *net)
  467. {
  468. remove_proc_entry("remaddr", net->sctp.proc_net_sctp);
  469. }
  470. static int sctp_remaddr_seq_open(struct inode *inode, struct file *file)
  471. {
  472. return seq_open_net(inode, file, &sctp_remaddr_ops,
  473. sizeof(struct sctp_ht_iter));
  474. }
  475. static const struct file_operations sctp_remaddr_seq_fops = {
  476. .open = sctp_remaddr_seq_open,
  477. .read = seq_read,
  478. .llseek = seq_lseek,
  479. .release = seq_release_net,
  480. };
  481. int __net_init sctp_remaddr_proc_init(struct net *net)
  482. {
  483. struct proc_dir_entry *p;
  484. p = proc_create("remaddr", S_IRUGO, net->sctp.proc_net_sctp,
  485. &sctp_remaddr_seq_fops);
  486. if (!p)
  487. return -ENOMEM;
  488. return 0;
  489. }