home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / sys / kern / kern_xxx.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-04-20  |  3.2 KB  |  128 lines

  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.  *
  33.  *    @(#)kern_xxx.c    7.17 (Berkeley) 4/20/91
  34.  */
  35.  
  36. #include "param.h"
  37. #include "systm.h"
  38. #include "kernel.h"
  39. #include "proc.h"
  40. #include "reboot.h"
  41.  
  42. /* ARGSUSED */
  43. gethostid(p, uap, retval)
  44.     struct proc *p;
  45.     void *uap;
  46.     long *retval;
  47. {
  48.  
  49.     *retval = hostid;
  50.     return (0);
  51. }
  52.  
  53. /* ARGSUSED */
  54. sethostid(p, uap, retval)
  55.     struct proc *p;
  56.     struct args {
  57.         long    hostid;
  58.     } *uap;
  59.     int *retval;
  60. {
  61.     int error;
  62.  
  63.     if (error = suser(p->p_ucred, &p->p_acflag))
  64.         return (error);
  65.     hostid = uap->hostid;
  66.     return (0);
  67. }
  68.  
  69. /* ARGSUSED */
  70. gethostname(p, uap, retval)
  71.     struct proc *p;
  72.     struct args {
  73.         char    *hostname;
  74.         u_int    len;
  75.     } *uap;
  76.     int *retval;
  77. {
  78.  
  79.     if (uap->len > hostnamelen + 1)
  80.         uap->len = hostnamelen + 1;
  81.     return (copyout((caddr_t)hostname, (caddr_t)uap->hostname, uap->len));
  82. }
  83.  
  84. /* ARGSUSED */
  85. sethostname(p, uap, retval)
  86.     struct proc *p;
  87.     register struct args {
  88.         char    *hostname;
  89.         u_int    len;
  90.     } *uap;
  91.     int *retval;
  92. {
  93.     int error;
  94.  
  95.     if (error = suser(p->p_ucred, &p->p_acflag))
  96.         return (error);
  97.     if (uap->len > sizeof (hostname) - 1)
  98.         return (EINVAL);
  99.     hostnamelen = uap->len;
  100.     error = copyin((caddr_t)uap->hostname, hostname, uap->len);
  101.     hostname[hostnamelen] = 0;
  102.     return (error);
  103. }
  104.  
  105. /* ARGSUSED */
  106. reboot(p, uap, retval)
  107.     struct proc *p;
  108.     struct args {
  109.         int    opt;
  110.     } *uap;
  111.     int *retval;
  112. {
  113.     int error;
  114.  
  115.     if (error = suser(p->p_ucred, &p->p_acflag))
  116.         return (error);
  117.     boot(uap->opt);
  118.     return (0);
  119. }
  120.  
  121. #ifdef COMPAT_43
  122. oquota()
  123. {
  124.  
  125.     return (ENOSYS);
  126. }
  127. #endif
  128.