Changeset d32af35 in mainline


Ignore:
Timestamp:
2006-06-04T17:56:05Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a8b2b5b
Parents:
74ebc64
Message:

Don't let processes connect to kernel console.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • console/console.c

    r74ebc64 rd32af35  
    7979 *
    8080 */
    81 static int find_free_connection()
     81static int find_free_connection(void)
    8282{
    8383        int i = 0;
    8484       
    85         while (i < CONSOLE_COUNT) {
    86                 if (connections[i].used == 0)
     85        for (i=0; i < CONSOLE_COUNT; i++) {
     86                if (!connections[i].used)
    8787                        return i;
    88                 ++i;
    89         }
    90         return CONSOLE_COUNT;
    91 }
    92 
    93 /** Find index of virtual console used by client with given phone.
    94  *
    95  */
    96 static int find_connection(int client_phone)
    97 {
    98         int i = 0;
    99        
    100         while (i < CONSOLE_COUNT) {
    101                 if (connections[i].client_phone == client_phone)
    102                         return i;
    103                 ++i;
    104         }
    105         return  CONSOLE_COUNT;
     88        }
     89        return -1;
    10690}
    10791
     
    340324        ipcarg_t arg1, arg2;
    341325
    342         if ((consnum = find_free_connection()) == CONSOLE_COUNT) {
     326        if ((consnum = find_free_connection()) == -1) {
    343327                ipc_answer_fast(iid,ELIMIT,0,0);
    344328                return;
     
    449433        gcons_init(fb_info.phone);
    450434        /* Synchronize, the gcons can have something in queue */
    451         sync_send_2(fb_info.phone, FB_GET_CSIZE, 0, 0, NULL, NULL);
     435        sync_send(fb_info.phone, FB_FLUSH, 0, NULL);
    452436
    453437       
     
    470454                }
    471455        }
     456        connections[KERNEL_CONSOLE].used = 1;
    472457       
    473458        if ((interbuffer = mmap(NULL, sizeof(keyfield_t) * fb_info.cols * fb_info.rows , PROTO_READ|PROTO_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, 0 ,0 )) != NULL) {
Note: See TracChangeset for help on using the changeset viewer.