Annotation of Net2/kern/kern_xxx.c, revision 1.1.1.3

1.1       root        1: /*
                      2:  * Copyright (c) 1982, 1986, 1989 Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * Redistribution and use in source and binary forms, with or without
                      6:  * modification, are permitted provided that the following conditions
                      7:  * are met:
                      8:  * 1. Redistributions of source code must retain the above copyright
                      9:  *    notice, this list of conditions and the following disclaimer.
                     10:  * 2. Redistributions in binary form must reproduce the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer in the
                     12:  *    documentation and/or other materials provided with the distribution.
                     13:  * 3. All advertising materials mentioning features or use of this software
                     14:  *    must display the following acknowledgement:
                     15:  *     This product includes software developed by the University of
                     16:  *     California, Berkeley and its contributors.
                     17:  * 4. Neither the name of the University nor the names of its contributors
                     18:  *    may be used to endorse or promote products derived from this software
                     19:  *    without specific prior written permission.
                     20:  *
                     21:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     22:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     23:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     24:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     25:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     26:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     27:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     28:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     29:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     30:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     31:  * SUCH DAMAGE.
                     32:  *
1.1.1.3 ! root       33:  *     from: @(#)kern_xxx.c    7.17 (Berkeley) 4/20/91
        !            34:  *     kern_xxx.c,v 1.6 1993/07/17 15:24:37 mycroft Exp
1.1       root       35:  */
                     36: 
                     37: #include "param.h"
                     38: #include "systm.h"
                     39: #include "kernel.h"
                     40: #include "proc.h"
                     41: #include "reboot.h"
1.1.1.3 ! root       42: #include "utsname.h"
1.1       root       43: 
                     44: /* ARGSUSED */
1.1.1.3 ! root       45: int
1.1       root       46: gethostid(p, uap, retval)
                     47:        struct proc *p;
                     48:        void *uap;
                     49:        long *retval;
                     50: {
                     51: 
                     52:        *retval = hostid;
                     53:        return (0);
                     54: }
                     55: 
1.1.1.3 ! root       56: struct sethostid_args {
        !            57:        long    hostid;
        !            58: };
        !            59: 
1.1       root       60: /* ARGSUSED */
1.1.1.3 ! root       61: int
1.1       root       62: sethostid(p, uap, retval)
                     63:        struct proc *p;
1.1.1.3 ! root       64:        struct sethostid_args *uap;
1.1       root       65:        int *retval;
                     66: {
                     67:        int error;
                     68: 
                     69:        if (error = suser(p->p_ucred, &p->p_acflag))
                     70:                return (error);
                     71:        hostid = uap->hostid;
                     72:        return (0);
                     73: }
                     74: 
1.1.1.3 ! root       75: struct gethostname_args {
        !            76:        char    *hostname;
        !            77:        u_int   len;
        !            78: };
        !            79: 
1.1       root       80: /* ARGSUSED */
1.1.1.3 ! root       81: int
1.1       root       82: gethostname(p, uap, retval)
                     83:        struct proc *p;
1.1.1.3 ! root       84:        struct gethostname_args *uap;
1.1       root       85:        int *retval;
                     86: {
                     87: 
                     88:        if (uap->len > hostnamelen + 1)
                     89:                uap->len = hostnamelen + 1;
                     90:        return (copyout((caddr_t)hostname, (caddr_t)uap->hostname, uap->len));
                     91: }
                     92: 
1.1.1.3 ! root       93: struct sethostname_args {
        !            94:        char    *hostname;
        !            95:        u_int   len;
        !            96: };
        !            97: 
1.1       root       98: /* ARGSUSED */
1.1.1.3 ! root       99: int
1.1       root      100: sethostname(p, uap, retval)
                    101:        struct proc *p;
1.1.1.3 ! root      102:        register struct sethostname_args *uap;
1.1       root      103:        int *retval;
                    104: {
                    105:        int error;
                    106: 
                    107:        if (error = suser(p->p_ucred, &p->p_acflag))
                    108:                return (error);
                    109:        if (uap->len > sizeof (hostname) - 1)
                    110:                return (EINVAL);
                    111:        hostnamelen = uap->len;
                    112:        error = copyin((caddr_t)uap->hostname, hostname, uap->len);
                    113:        hostname[hostnamelen] = 0;
                    114:        return (error);
                    115: }
                    116: 
1.1.1.3 ! root      117: struct getdomainname_args {
        !           118:        char    *domainname;
        !           119:        u_int   len;
        !           120: };
        !           121: 
1.1       root      122: /* ARGSUSED */
1.1.1.3 ! root      123: int
1.1.1.2   root      124: getdomainname(p, uap, retval)
                    125:        struct proc *p;
1.1.1.3 ! root      126:        struct getdomainname_args *uap;
1.1.1.2   root      127:        int *retval;
                    128: {
                    129:        if (uap->len > domainnamelen + 1)
                    130:                uap->len = domainnamelen + 1;
                    131:        return (copyout((caddr_t)domainname, (caddr_t)uap->domainname, uap->len));
                    132: }
                    133: 
1.1.1.3 ! root      134: struct setdomainname_args {
        !           135:        char    *domainname;
        !           136:        u_int   len;
        !           137: };
        !           138: 
1.1.1.2   root      139: /* ARGSUSED */
1.1.1.3 ! root      140: int
1.1.1.2   root      141: setdomainname(p, uap, retval)
                    142:        struct proc *p;
1.1.1.3 ! root      143:        struct setdomainname_args *uap;
1.1.1.2   root      144:        int *retval;
                    145: {
                    146:        int error;
                    147: 
                    148:        if (error = suser(p->p_ucred, &p->p_acflag))
                    149:                return (error);
                    150:        if (uap->len > sizeof (domainname) - 1)
                    151:                return EINVAL;
                    152:        domainnamelen = uap->len;
                    153:        error = copyin((caddr_t)uap->domainname, domainname, uap->len);
                    154:        domainname[domainnamelen] = 0;
                    155:        return (error);
                    156: }
                    157: 
1.1.1.3 ! root      158: struct uname_args {
        !           159:        struct utsname  *name;
        !           160: };
        !           161: 
        !           162: /* ARGSUSED */
        !           163: int
        !           164: uname(p, uap, retval)
        !           165:        struct proc *p;
        !           166:        struct uname_args *uap;
        !           167:        int *retval;
        !           168: {
        !           169:        bcopy(hostname, utsname.nodename, sizeof(utsname.nodename));
        !           170:        utsname.nodename[sizeof(utsname.nodename)-1] = '\0';
        !           171:        return (copyout((caddr_t)&utsname, (caddr_t)uap->name, sizeof(struct utsname)));
        !           172: }
        !           173: 
        !           174: struct reboot_args {
        !           175:        int     opt;
        !           176: };
        !           177: 
1.1.1.2   root      178: /* ARGSUSED */
1.1.1.3 ! root      179: int
1.1       root      180: reboot(p, uap, retval)
                    181:        struct proc *p;
1.1.1.3 ! root      182:        struct reboot_args *uap;
1.1       root      183:        int *retval;
                    184: {
                    185:        int error;
                    186: 
                    187:        if (error = suser(p->p_ucred, &p->p_acflag))
                    188:                return (error);
                    189:        boot(uap->opt);
                    190:        return (0);
                    191: }
                    192: 
                    193: #ifdef COMPAT_43
1.1.1.3 ! root      194: int
1.1       root      195: oquota()
                    196: {
                    197: 
                    198:        return (ENOSYS);
                    199: }
                    200: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.