sys_socket.c (1a8d176432e76d7725ed1ac0b44f63ac6cc82397) sys_socket.c (bfd03046d18776ea70785ca1ef36dfc60822de3b)
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1982, 1986, 1990, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 76 unchanged lines hidden (view full) ---

85
86static fo_rdwr_t soo_read;
87static fo_rdwr_t soo_write;
88static fo_ioctl_t soo_ioctl;
89static fo_poll_t soo_poll;
90extern fo_kqfilter_t soo_kqfilter;
91static fo_stat_t soo_stat;
92static fo_close_t soo_close;
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 1982, 1986, 1990, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 76 unchanged lines hidden (view full) ---

85
86static fo_rdwr_t soo_read;
87static fo_rdwr_t soo_write;
88static fo_ioctl_t soo_ioctl;
89static fo_poll_t soo_poll;
90extern fo_kqfilter_t soo_kqfilter;
91static fo_stat_t soo_stat;
92static fo_close_t soo_close;
93static fo_chmod_t soo_chmod;
93static fo_fill_kinfo_t soo_fill_kinfo;
94static fo_aio_queue_t soo_aio_queue;
95
96static void soo_aio_cancel(struct kaiocb *job);
97
98struct fileops socketops = {
99 .fo_read = soo_read,
100 .fo_write = soo_write,
101 .fo_truncate = invfo_truncate,
102 .fo_ioctl = soo_ioctl,
103 .fo_poll = soo_poll,
104 .fo_kqfilter = soo_kqfilter,
105 .fo_stat = soo_stat,
106 .fo_close = soo_close,
94static fo_fill_kinfo_t soo_fill_kinfo;
95static fo_aio_queue_t soo_aio_queue;
96
97static void soo_aio_cancel(struct kaiocb *job);
98
99struct fileops socketops = {
100 .fo_read = soo_read,
101 .fo_write = soo_write,
102 .fo_truncate = invfo_truncate,
103 .fo_ioctl = soo_ioctl,
104 .fo_poll = soo_poll,
105 .fo_kqfilter = soo_kqfilter,
106 .fo_stat = soo_stat,
107 .fo_close = soo_close,
107 .fo_chmod = invfo_chmod,
108 .fo_chmod = soo_chmod,
108 .fo_chown = invfo_chown,
109 .fo_sendfile = invfo_sendfile,
110 .fo_fill_kinfo = soo_fill_kinfo,
111 .fo_aio_queue = soo_aio_queue,
112 .fo_cmp = file_kcmp_generic,
113 .fo_flags = DFLAG_PASSABLE
114};
115

--- 233 unchanged lines hidden (view full) ---

349 fp->f_data = NULL;
350
351 if (so)
352 error = soclose(so);
353 return (error);
354}
355
356static int
109 .fo_chown = invfo_chown,
110 .fo_sendfile = invfo_sendfile,
111 .fo_fill_kinfo = soo_fill_kinfo,
112 .fo_aio_queue = soo_aio_queue,
113 .fo_cmp = file_kcmp_generic,
114 .fo_flags = DFLAG_PASSABLE
115};
116

--- 233 unchanged lines hidden (view full) ---

350 fp->f_data = NULL;
351
352 if (so)
353 error = soclose(so);
354 return (error);
355}
356
357static int
358soo_chmod(struct file *fp, mode_t mode, struct ucred *cred, struct thread *td)
359{
360 struct socket *so;
361 int error;
362
363 so = fp->f_data;
364 if (so->so_proto->pr_chmod != NULL)
365 error = so->so_proto->pr_chmod(so, mode, cred, td);
366 else
367 error = EINVAL;
368 return (error);
369}
370
371static int
357soo_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp)
358{
359 struct sockaddr_storage ss = { .ss_len = sizeof(ss) };
360 struct unpcb *unpcb;
361 struct socket *so;
362 int error;
363
364 kif->kf_type = KF_TYPE_SOCKET;

--- 468 unchanged lines hidden ---
372soo_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp)
373{
374 struct sockaddr_storage ss = { .ss_len = sizeof(ss) };
375 struct unpcb *unpcb;
376 struct socket *so;
377 int error;
378
379 kif->kf_type = KF_TYPE_SOCKET;

--- 468 unchanged lines hidden ---