2005-07-21 20:29:52 +02:00
|
|
|
/* Includes. */
|
2010-03-22 22:25:22 +01:00
|
|
|
#include <minix/drivers.h>
|
|
|
|
#include <minix/driver.h>
|
2005-07-21 20:29:52 +02:00
|
|
|
#include <minix/type.h>
|
|
|
|
#include <minix/const.h>
|
|
|
|
#include <minix/com.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <minix/ipc.h>
|
|
|
|
|
|
|
|
/* Constants and types. */
|
|
|
|
|
2005-08-30 18:56:46 +02:00
|
|
|
#define LOG_SIZE (50*1024)
|
2005-07-21 20:29:52 +02:00
|
|
|
#define SUSPENDABLE 1
|
|
|
|
|
|
|
|
struct logdevice {
|
|
|
|
char log_buffer[LOG_SIZE];
|
|
|
|
int log_size, /* no. of bytes in log buffer */
|
|
|
|
log_read, /* read mark */
|
|
|
|
log_write; /* write mark */
|
|
|
|
#if SUSPENDABLE
|
Server/driver protocols: no longer allow third-party copies.
Before safecopies, the IO_ENDPT and DL_ENDPT message fields were needed
to know which actual process to copy data from/to, as that process may
not always be the caller. Now that we have full safecopy support, these
fields have become useless for that purpose: the owner of the grant is
*always* the caller. Allowing the caller to supply another endpoint is
in fact dangerous, because the callee may then end up using a grant
from a third party. One could call this a variant of the confused
deputy problem.
From now on, safecopy calls should always use the caller's endpoint as
grant owner. This fully obsoletes the DL_ENDPT field in the
inet/ethernet protocol. IO_ENDPT has other uses besides identifying the
grant owner though. This patch renames IO_ENDPT to USER_ENDPT, not only
because that is a more fitting name (it should never be used for I/O
after all), but also in order to intentionally break any old system
source code outside the base system. If this patch breaks your code,
fixing it is fairly simple:
- DL_ENDPT should be replaced with m_source;
- IO_ENDPT should be replaced with m_source when used for safecopies;
- IO_ENDPT should be replaced with USER_ENDPT for any other use, e.g.
when setting REP_ENDPT, matching requests in CANCEL calls, getting
DEV_SELECT flags, and retrieving of the real user process's endpoint
in DEV_OPEN.
The changes in this patch are binary backward compatible.
2011-04-11 19:35:05 +02:00
|
|
|
endpoint_t log_proc_nr,
|
|
|
|
log_source;
|
|
|
|
int log_iosize,
|
2005-07-27 15:11:03 +02:00
|
|
|
log_revive_alerted,
|
Server/driver protocols: no longer allow third-party copies.
Before safecopies, the IO_ENDPT and DL_ENDPT message fields were needed
to know which actual process to copy data from/to, as that process may
not always be the caller. Now that we have full safecopy support, these
fields have become useless for that purpose: the owner of the grant is
*always* the caller. Allowing the caller to supply another endpoint is
in fact dangerous, because the callee may then end up using a grant
from a third party. One could call this a variant of the confused
deputy problem.
From now on, safecopy calls should always use the caller's endpoint as
grant owner. This fully obsoletes the DL_ENDPT field in the
inet/ethernet protocol. IO_ENDPT has other uses besides identifying the
grant owner though. This patch renames IO_ENDPT to USER_ENDPT, not only
because that is a more fitting name (it should never be used for I/O
after all), but also in order to intentionally break any old system
source code outside the base system. If this patch breaks your code,
fixing it is fairly simple:
- DL_ENDPT should be replaced with m_source;
- IO_ENDPT should be replaced with m_source when used for safecopies;
- IO_ENDPT should be replaced with USER_ENDPT for any other use, e.g.
when setting REP_ENDPT, matching requests in CANCEL calls, getting
DEV_SELECT flags, and retrieving of the real user process's endpoint
in DEV_OPEN.
The changes in this patch are binary backward compatible.
2011-04-11 19:35:05 +02:00
|
|
|
log_status;
|
2011-03-25 11:43:24 +01:00
|
|
|
cp_grant_id_t log_user_grant;
|
|
|
|
vir_bytes log_user_offset;
|
2005-07-21 20:29:52 +02:00
|
|
|
#endif
|
2005-07-27 15:11:03 +02:00
|
|
|
int log_selected, log_select_proc,
|
|
|
|
log_select_alerted, log_select_ready_ops;
|
2005-07-21 20:29:52 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Function prototypes. */
|
2011-03-25 11:43:24 +01:00
|
|
|
_PROTOTYPE( void do_new_kmess, (void) );
|
|
|
|
_PROTOTYPE( void log_append, (char *buf, int len) );
|
2005-07-21 20:29:52 +02:00
|
|
|
|