Need separate 'prev_next' pointers for kernel and TTY.
This commit is contained in:
		
							parent
							
								
									830b79f0d5
								
							
						
					
					
						commit
						65df875abb
					
				| @ -26,20 +26,26 @@ message *m;					/* notification message */ | ||||
| /* Notification for a new kernel message. */ | ||||
|   struct kmessages kmess;		/* entire kmess structure */ | ||||
|   char print_buf[KMESS_BUF_SIZE];	/* copy new message here */ | ||||
|   static int prev_next = 0; | ||||
|   int bytes; | ||||
|   int i, r; | ||||
|   int *prev_nextp; | ||||
| 
 | ||||
|   static int kernel_prev_next = 0; | ||||
|   static int tty_prev_next = 0; | ||||
| 
 | ||||
|   if (m->m_source == TTY_PROC_NR) | ||||
|   { | ||||
| 	cp_grant_id_t gid; | ||||
| 	message mess; | ||||
| 
 | ||||
| 	prev_nextp= &tty_prev_next; | ||||
| 	gid= cpf_grant_direct(TTY_PROC_NR, (vir_bytes)&kmess, sizeof(kmess), | ||||
| 		CPF_WRITE); | ||||
| 	if (gid == -1) | ||||
| 	{ | ||||
| #if 0 | ||||
| 		report("LOG","cpf_grant_direct failed for TTY", errno); | ||||
| #endif | ||||
| 		return EDONTREPLY; | ||||
| 	} | ||||
| 
 | ||||
| @ -63,6 +69,7 @@ message *m;					/* notification message */ | ||||
| 		report("LOG","couldn't get copy of kmessages", r); | ||||
| 		return EDONTREPLY; | ||||
| 	} | ||||
| 	prev_nextp= &kernel_prev_next; | ||||
|   } | ||||
| 
 | ||||
|   /* Print only the new part. Determine how many new bytes there are with 
 | ||||
| @ -72,8 +79,9 @@ message *m;					/* notification message */ | ||||
|    * Check for size being positive, the buffer might as well be emptied! | ||||
|    */ | ||||
|   if (kmess.km_size > 0) { | ||||
|       bytes = ((kmess.km_next + KMESS_BUF_SIZE) - prev_next) % KMESS_BUF_SIZE; | ||||
|       r=prev_next;				/* start at previous old */  | ||||
|       bytes = ((kmess.km_next + KMESS_BUF_SIZE) - (*prev_nextp)) % | ||||
| 	KMESS_BUF_SIZE; | ||||
|       r= *prev_nextp;				/* start at previous old */  | ||||
|       i=0; | ||||
|       while (bytes > 0) {			 | ||||
|           print_buf[i] = kmess.km_buf[(r%KMESS_BUF_SIZE)]; | ||||
| @ -89,7 +97,7 @@ message *m;					/* notification message */ | ||||
|   /* Almost done, store 'next' so that we can determine what part of the
 | ||||
|    * kernel messages buffer to print next time a notification arrives. | ||||
|    */ | ||||
|   prev_next = kmess.km_next; | ||||
|   *prev_nextp = kmess.km_next; | ||||
|   return EDONTREPLY; | ||||
| } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Philip Homburg
						Philip Homburg