Print this page
4770 soconfig(1M) needs an option to print the in-kernel socket configuration table


   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 /* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */



  27 
  28 #include <sys/types.h>
  29 #include <sys/t_lock.h>
  30 #include <sys/param.h>
  31 #include <sys/systm.h>
  32 #include <sys/buf.h>
  33 #include <sys/conf.h>
  34 #include <sys/cred.h>
  35 #include <sys/kmem.h>
  36 #include <sys/sysmacros.h>
  37 #include <sys/vfs.h>
  38 #include <sys/vnode.h>
  39 #include <sys/debug.h>
  40 #include <sys/errno.h>
  41 #include <sys/time.h>
  42 #include <sys/file.h>
  43 #include <sys/user.h>
  44 #include <sys/stream.h>
  45 #include <sys/strsubr.h>
  46 #include <sys/strsun.h>


1845         if (sockfs_defer_nl7c_init) {
1846                 nl7c_init();
1847                 sockfs_defer_nl7c_init = 0;
1848         }
1849 
1850         switch (cmd) {
1851         case SOCKCONFIG_ADD_SOCK:
1852                 error = sockconf_add_sock((int)(uintptr_t)arg1,
1853                     (int)(uintptr_t)arg2, (int)(uintptr_t)arg3, arg4);
1854                 break;
1855         case SOCKCONFIG_REMOVE_SOCK:
1856                 error = sockconf_remove_sock((int)(uintptr_t)arg1,
1857                     (int)(uintptr_t)arg2, (int)(uintptr_t)arg3);
1858                 break;
1859         case SOCKCONFIG_ADD_FILTER:
1860                 error = sockconfig_add_filter((const char *)arg1, arg2);
1861                 break;
1862         case SOCKCONFIG_REMOVE_FILTER:
1863                 error = sockconfig_remove_filter((const char *)arg1);
1864                 break;



1865         default:
1866 #ifdef  DEBUG
1867                 cmn_err(CE_NOTE, "sockconfig: unkonwn subcommand %d", cmd);
1868 #endif
1869                 error = EINVAL;
1870                 break;
1871         }
1872 
1873         if (error != 0) {
1874                 eprintline(error);
1875                 return (set_errno(error));
1876         }
1877         return (0);
1878 }
1879 
1880 
1881 /*
1882  * Sendfile is implemented through two schemes, direct I/O or by
1883  * caching in the filesystem page cache. We cache the input file by
1884  * default and use direct I/O only if sendfile_max_size is set




   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
  24  */
  25 
  26 /* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */
  27 /*
  28  * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
  29  */
  30 
  31 #include <sys/types.h>
  32 #include <sys/t_lock.h>
  33 #include <sys/param.h>
  34 #include <sys/systm.h>
  35 #include <sys/buf.h>
  36 #include <sys/conf.h>
  37 #include <sys/cred.h>
  38 #include <sys/kmem.h>
  39 #include <sys/sysmacros.h>
  40 #include <sys/vfs.h>
  41 #include <sys/vnode.h>
  42 #include <sys/debug.h>
  43 #include <sys/errno.h>
  44 #include <sys/time.h>
  45 #include <sys/file.h>
  46 #include <sys/user.h>
  47 #include <sys/stream.h>
  48 #include <sys/strsubr.h>
  49 #include <sys/strsun.h>


1848         if (sockfs_defer_nl7c_init) {
1849                 nl7c_init();
1850                 sockfs_defer_nl7c_init = 0;
1851         }
1852 
1853         switch (cmd) {
1854         case SOCKCONFIG_ADD_SOCK:
1855                 error = sockconf_add_sock((int)(uintptr_t)arg1,
1856                     (int)(uintptr_t)arg2, (int)(uintptr_t)arg3, arg4);
1857                 break;
1858         case SOCKCONFIG_REMOVE_SOCK:
1859                 error = sockconf_remove_sock((int)(uintptr_t)arg1,
1860                     (int)(uintptr_t)arg2, (int)(uintptr_t)arg3);
1861                 break;
1862         case SOCKCONFIG_ADD_FILTER:
1863                 error = sockconfig_add_filter((const char *)arg1, arg2);
1864                 break;
1865         case SOCKCONFIG_REMOVE_FILTER:
1866                 error = sockconfig_remove_filter((const char *)arg1);
1867                 break;
1868         case SOCKCONFIG_GET_SOCKTABLE:
1869                 error = sockparams_copyout_socktable((int)(uintptr_t)arg1);
1870                 break;
1871         default:
1872 #ifdef  DEBUG
1873                 cmn_err(CE_NOTE, "sockconfig: unkonwn subcommand %d", cmd);
1874 #endif
1875                 error = EINVAL;
1876                 break;
1877         }
1878 
1879         if (error != 0) {
1880                 eprintline(error);
1881                 return (set_errno(error));
1882         }
1883         return (0);
1884 }
1885 
1886 
1887 /*
1888  * Sendfile is implemented through two schemes, direct I/O or by
1889  * caching in the filesystem page cache. We cache the input file by
1890  * default and use direct I/O only if sendfile_max_size is set