Newer
Older
ubixos / src / bin / init / main.c
@fsdfs fsdfs on 8 Aug 2005 5 KB new scheduler!
/*****************************************************************************************
 Copyright (c) 2002-2004 The UbixOS Project
 All rights reserved.

 Redistribution and use in source and binary forms, with or without modification, are
 permitted provided that the following conditions are met:

 Redistributions of source code must retain the above copyright notice, this list of
 conditions, the following disclaimer and the list of authors.  Redistributions in binary
 form must reproduce the above copyright notice, this list of conditions, the following
 disclaimer and the list of authors in the documentation and/or other materials provided
 with the distribution. Neither the name of the UbixOS Project nor the names of its
 contributors may be used to endorse or promote products derived from this software
 without specific prior written permission.

 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
 THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
 OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
 TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 $Id$

*****************************************************************************************/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/sys.h>
#include <sys/sched.h>

int main(int argc,char **argv) {
  int i=0x0;

  /* Make sure we have superuser permissions if not exit */
  if ((getuid() != 0x0) && (getgid() != 0x0)) {
    printf("Error: This program must be run by root.\n");
    exit(0x1);
    }

  printf("INIT: Loading System Processes and configuration\n");

  /* Start TTYD */
  //i = fork();

  //if (0x0 == i) {
 //  printf("ttyd: Starting ... ");
  //  exec("sys:/ttyd",0x0,0x0);
  //  printf("OK\n");
   // printf("Error: Could not start TTYD\n");
   // exit(0x0);
    

  //i = fork();
  //if (0x0 == i) {
    printf("ubistry: Starting ... ");
    exec("sys:/ubistry",0x0,0x0);
    printf("OK\n");
   //printf("Error: Error Starting ubistry\n");
   // exit(0x0);
   // }

  //while (pidStatus(i) > 0x0) {
  //  sched_yield();
  //  } 

  startup:
  //i = fork();
  //if (0 == i) {
    printf("Starting Login Daemon... ");
    exec("sys:/login",0x0,0x0);
    printf("OK\n");
   // printf("Error Starting System\n");
   // exit(0x0);
   // }

 
  return(0x0);
  }

/***
 $Log$
 Revision 1.27  2004/09/11 12:26:07  reddawg
 We now initialize all needed daemons

 Revision 1.26  2004/09/11 12:11:11  reddawg
 Cleaning up the VFS more changes to follow...

 Revision 1.25  2004/09/08 23:19:58  reddawg
 hmm

 Revision 1.24  2004/08/25 22:02:41  reddawg
 task switching - We now are using software switching to be consistant with the rest of the world because all of this open source freaks gave me a hard time about something I liked. There doesn't seem to be any gain in performance but it is working fine and flawlessly

 Revision 1.23  2004/08/24 23:33:45  reddawg
 Fixed

 Revision 1.22  2004/08/24 05:24:36  reddawg
 TCA Is A BONER!!!!

 Revision 1.21  2004/08/21 23:47:50  reddawg
 *** empty log message ***

 Revision 1.20  2004/08/21 20:21:20  reddawg
 *** empty log message ***

 Revision 1.19  2004/08/14 11:29:42  reddawg
 ok

 Revision 1.17  2004/08/14 11:23:02  reddawg
 Changes

 Revision 1.16  2004/08/01 20:47:59  reddawg
 Minor changes

 Revision 1.15  2004/07/28 17:07:25  reddawg
 MPI: moved the syscalls

 Revision 1.14  2004/07/28 00:17:05  reddawg
 Major:
   Disconnected page 0x0 from the system... Unfortunately this broke many things
   all of which have been fixed. This was good because nothing deferences NULL
   any more.

 Things affected:
   malloc,kmalloc,getfreepage,getfreevirtualpage,pagefault,fork,exec,ld,ld.so,exec,file

 Revision 1.13  2004/07/17 18:16:45  reddawg
 Hmm

 Revision 1.12  2004/06/28 23:12:59  reddawg
 file format now container:/path/to/file

 Revision 1.11  2004/06/04 13:29:56  reddawg
 libc: modified mkdir(); interface
 kpanic: kPanic(); now says kPanic: %s
 system: now reboots when receives message for reboot
         also when command start sde is received by system the STD is started

 Revision 1.10  2004/05/26 13:11:41  reddawg
 Makefile: adjust all the Makefile to strip binaries to conserve floppy space

 Revision 1.9  2004/05/26 12:19:19  reddawg
 init: init now starts the ubix registry system

 Revision 1.8  2004/05/25 22:44:59  reddawg
 Test code

 Revision 1.7  2004/05/25 22:32:58  reddawg
 We turned back on GUI

 Revision 1.6  2004/05/25 18:38:00  reddawg
 The system INIT task now responds to messages it is the root process for the OS

 Revision 1.5  2004/05/25 15:43:44  reddawg
 Tests for MPI

 Revision 1.4  2004/05/23 23:40:37  reddawg
 Cleanup

 Revision 1.3  2004/05/21 21:15:56  reddawg
 Cleaned up initialized program

 Revision 1.2  2004/05/21 15:43:58  reddawg
 Fixed the the bootup ordering in userland initialization

 END
 ***/