本文整理汇总了C++中LogEvent函数的典型用法代码示例。如果您正苦于以下问题:C++ LogEvent函数的具体用法?C++ LogEvent怎么用?C++ LogEvent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LogEvent函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: LogEvent
void Logger::LogFinishEvent(const NMEA_INFO &gps_info) {
LogEvent(gps_info, "FIN");
}
开发者ID:joachimwieland,项目名称:xcsoar-jwieland,代码行数:3,代码来源:Logger.cpp
示例2: nfs_Read
//.........这里部分代码省略.........
NULL, NULL, NULL, NULL, NULL, NULL);
rc = NFS_REQ_OK;
goto out;
}
/* Extract the argument from the request */
switch (preq->rq_vers)
{
case NFS_V2:
offset = parg->arg_read2.offset; /* beginoffset is obsolete */
size = parg->arg_read2.count; /* totalcount is obsolete */
break;
case NFS_V3:
offset = parg->arg_read3.offset;
size = parg->arg_read3.count;
break;
}
/*
* do not exceed maxium READ offset if set
*/
if((pexport->options & EXPORT_OPTION_MAXOFFSETREAD) == EXPORT_OPTION_MAXOFFSETREAD)
{
LogFullDebug(COMPONENT_NFSPROTO,
"-----> Read offset=%llu count=%llu MaxOffSet=%llu",
(unsigned long long) offset,
(unsigned long long) size,
(unsigned long long) pexport->MaxOffsetRead);
if((fsal_off_t) (offset + size) > pexport->MaxOffsetRead)
{
LogEvent(COMPONENT_NFSPROTO,
"NFS READ: A client tryed to violate max file size %llu for exportid #%hu",
(unsigned long long) pexport->MaxOffsetRead, pexport->id);
switch (preq->rq_vers)
{
case NFS_V2:
pres->res_attr2.status = NFSERR_DQUOT;
break;
case NFS_V3:
pres->res_read3.status = NFS3ERR_INVAL;
break;
}
nfs_SetFailedStatus(pcontext, pexport,
preq->rq_vers,
cache_status,
&pres->res_read2.status,
&pres->res_read3.status,
pentry,
&(pres->res_read3.READ3res_u.resfail.file_attributes),
NULL, NULL, NULL, NULL, NULL, NULL);
rc = NFS_REQ_OK;
goto out;
}
}
/*
* We should not exceed the FSINFO rtmax field for
* the size
*/
开发者ID:ShyamsundarR,项目名称:nfs-ganesha,代码行数:67,代码来源:nfs_Read.c
示例3: nfs4_op_open_downgrade
int nfs4_op_open_downgrade(struct nfs_argop4 *op, compound_data_t *data,
struct nfs_resop4 *resp)
{
OPEN_DOWNGRADE4args * const arg_OPEN_DOWNGRADE4 =
&op->nfs_argop4_u.opopen_downgrade;
OPEN_DOWNGRADE4res * const res_OPEN_DOWNGRADE4 =
&resp->nfs_resop4_u.opopen_downgrade;
OPEN_DOWNGRADE4resok *resok =
&res_OPEN_DOWNGRADE4->OPEN_DOWNGRADE4res_u.resok4;
state_t *state_found = NULL;
state_owner_t *open_owner;
int rc;
const char *tag = "OPEN_DOWNGRADE";
char *cause = "";
resp->resop = NFS4_OP_OPEN_DOWNGRADE;
res_OPEN_DOWNGRADE4->status = NFS4_OK;
/* Do basic checks on a filehandle */
res_OPEN_DOWNGRADE4->status =
nfs4_sanity_check_FH(data, NO_FILE_TYPE, false);
if (res_OPEN_DOWNGRADE4->status != NFS4_OK)
return res_OPEN_DOWNGRADE4->status;
/* Open downgrade is done only on a file */
if (data->current_filetype != REGULAR_FILE) {
res_OPEN_DOWNGRADE4->status = NFS4ERR_INVAL;
return res_OPEN_DOWNGRADE4->status;
}
/* Check stateid correctness and get pointer to state */
rc = nfs4_Check_Stateid(&arg_OPEN_DOWNGRADE4->open_stateid,
data->current_obj,
&state_found,
data,
STATEID_SPECIAL_FOR_LOCK,
arg_OPEN_DOWNGRADE4->seqid,
data->minorversion == 0,
tag);
if (rc != NFS4_OK && rc != NFS4ERR_REPLAY) {
res_OPEN_DOWNGRADE4->status = rc;
LogDebug(COMPONENT_STATE,
"OPEN_DOWNGRADE failed nfs4_Check_Stateid");
return res_OPEN_DOWNGRADE4->status;
}
open_owner = get_state_owner_ref(state_found);
if (open_owner == NULL) {
/* Unexpected, but something just went stale. */
res_OPEN_DOWNGRADE4->status = NFS4ERR_STALE;
goto out2;
}
PTHREAD_MUTEX_lock(&open_owner->so_mutex);
/* Check seqid */
if (data->minorversion == 0 &&
!Check_nfs4_seqid(open_owner,
arg_OPEN_DOWNGRADE4->seqid,
op,
data->current_obj,
resp,
tag)) {
/* Response is all setup for us and LogDebug told what was wrong
*/
PTHREAD_MUTEX_unlock(&open_owner->so_mutex);
goto out;
}
PTHREAD_MUTEX_unlock(&open_owner->so_mutex);
/* What kind of open is it ? */
LogFullDebug(COMPONENT_STATE,
"OPEN_DOWNGRADE: Share Deny = %d Share Access = %d ",
arg_OPEN_DOWNGRADE4->share_deny,
arg_OPEN_DOWNGRADE4->share_access);
res_OPEN_DOWNGRADE4->status = nfs4_do_open_downgrade(op,
data,
open_owner,
state_found,
&cause);
if (res_OPEN_DOWNGRADE4->status != NFS4_OK) {
LogEvent(COMPONENT_STATE,
"Failed to open downgrade: %s",
cause);
goto out;
}
/* Successful exit */
res_OPEN_DOWNGRADE4->status = NFS4_OK;
/* Handle stateid/seqid for success */
update_stateid(state_found, &resok->open_stateid, data, tag);
/* Save the response in the open owner */
//.........这里部分代码省略.........
开发者ID:dotbugfix,项目名称:nfs-ganesha,代码行数:101,代码来源:nfs4_op_open_downgrade.c
示例4: SSFMuxCreate
int CStreamMuxerImp1::DoCreateStreamMuxer(BOOL fLive)
{
//fLive = FALSE;
m_bLive = fLive;
if(!GetWritter())
{
return -1;
}
HRESULT hr = S_OK;
//////////////////////////////////////////////////
hr = SSFMuxCreate( &m_hSSFMux );
if( FAILED(hr) )
{
char buf[1024];
sprintf_s(buf, "Error 0x%08x: Failed to create SSF muxer\n", hr );
LogEvent(buf);
goto done;
}
hr = SSFMuxSetOption( m_hSSFMux, SSF_MUX_OPTION_LIVE_MODE, &fLive, sizeof(fLive) );
if( FAILED(hr) )
{
char buf[1024];
sprintf_s(buf, "Error 0x%08x: Failed to set SSF_MUX_OPTION_LIVE_MODE\n", hr );
LogEvent(buf);
goto done;
}
UINT64 timeScale = 10000000; // time scale in HNS means 10000000 HNS units in one second
hr = SSFMuxSetOption( m_hSSFMux, SSF_MUX_OPTION_TIME_SCALE, &timeScale, sizeof(timeScale) );
if( FAILED(hr) )
{
char buf[1024];
sprintf_s( buf,"Error 0x%08x: Failed to set SSF_MUX_OPTION_TIME_SCALE\n", hr );
LogEvent(buf);
goto done;
}
BOOL fVariableBitRate = TRUE;
hr = SSFMuxSetOption( m_hSSFMux, SSF_MUX_OPTION_VARIABLE_RATE, &fVariableBitRate, sizeof(fVariableBitRate) );
if( FAILED(hr) )
{
char buf[1024];
sprintf_s(buf, "Error 0x%08x: Failed to set SSF_MUX_OPTION_VARIABLE_RATE\n", hr );
LogEvent(buf);
goto done;
}
//////////////////////////////////
return 0;
//////////////////////////////////
done:
if( NULL != m_hSSFMux )
{
SSFMuxDestroy( m_hSSFMux );
m_hSSFMux = NULL;
}
return -1;
}
开发者ID:pruginkad,项目名称:webinterest,代码行数:66,代码来源:StreamMuxerImp1.cpp
示例5: snprintf
void *_9p_socket_thread(void *Arg)
{
long int tcp_sock = (long int)Arg;
int rc = -1;
struct pollfd fds[1];
int fdcount = 1;
static char my_name[MAXNAMLEN + 1];
char strcaller[INET6_ADDRSTRLEN];
request_data_t *req = NULL;
int tag;
unsigned long sequence = 0;
unsigned int i = 0;
char *_9pmsg = NULL;
uint32_t msglen;
struct _9p_conn _9p_conn;
socklen_t addrpeerlen;
int readlen = 0;
int total_readlen = 0;
snprintf(my_name, MAXNAMLEN, "9p_sock_mgr#fd=%ld", tcp_sock);
SetNameFunction(my_name);
/* Init the struct _9p_conn structure */
memset(&_9p_conn, 0, sizeof(_9p_conn));
PTHREAD_MUTEX_init(&_9p_conn.sock_lock, NULL);
_9p_conn.trans_type = _9P_TCP;
_9p_conn.trans_data.sockfd = tcp_sock;
for (i = 0; i < FLUSH_BUCKETS; i++) {
PTHREAD_MUTEX_init(&_9p_conn.flush_buckets[i].lock, NULL);
glist_init(&_9p_conn.flush_buckets[i].list);
}
atomic_store_uint32_t(&_9p_conn.refcount, 0);
/* Init the fids pointers array */
memset(&_9p_conn.fids, 0, _9P_FID_PER_CONN * sizeof(struct _9p_fid *));
/* Set initial msize.
* Client may request a lower value during TVERSION */
_9p_conn.msize = _9p_param._9p_tcp_msize;
if (gettimeofday(&_9p_conn.birth, NULL) == -1)
LogFatal(COMPONENT_9P, "Cannot get connection's time of birth");
addrpeerlen = sizeof(_9p_conn.addrpeer);
rc = getpeername(tcp_sock, (struct sockaddr *)&_9p_conn.addrpeer,
&addrpeerlen);
if (rc == -1) {
LogMajor(COMPONENT_9P,
"Cannot get peername to tcp socket for 9p, error %d (%s)",
errno, strerror(errno));
/* XXX */
strncpy(strcaller, "(unresolved)", INET6_ADDRSTRLEN);
strcaller[12] = '\0';
} else {
switch (_9p_conn.addrpeer.ss_family) {
case AF_INET:
inet_ntop(_9p_conn.addrpeer.ss_family,
&((struct sockaddr_in *)&_9p_conn.addrpeer)->
sin_addr, strcaller, INET6_ADDRSTRLEN);
break;
case AF_INET6:
inet_ntop(_9p_conn.addrpeer.ss_family,
&((struct sockaddr_in6 *)&_9p_conn.addrpeer)->
sin6_addr, strcaller, INET6_ADDRSTRLEN);
break;
default:
snprintf(strcaller, INET6_ADDRSTRLEN, "BAD ADDRESS");
break;
}
LogEvent(COMPONENT_9P, "9p socket #%ld is connected to %s",
tcp_sock, strcaller);
}
_9p_conn.client = get_gsh_client(&_9p_conn.addrpeer, false);
/* Set up the structure used by poll */
memset((char *)fds, 0, sizeof(struct pollfd));
fds[0].fd = tcp_sock;
fds[0].events =
POLLIN | POLLPRI | POLLRDBAND | POLLRDNORM | POLLRDHUP | POLLHUP |
POLLERR | POLLNVAL;
for (;;) {
total_readlen = 0; /* new message */
rc = poll(fds, fdcount, -1);
if (rc == -1) {
/* timeout = -1 => Wait indefinitely for events */
/* Interruption if not an issue */
if (errno == EINTR)
continue;
LogCrit(COMPONENT_9P,
"Got error %u (%s) on fd %ld connect to %s while polling on socket",
errno, strerror(errno), tcp_sock, strcaller);
}
if (fds[0].revents & POLLNVAL) {
LogEvent(COMPONENT_9P,
//.........这里部分代码省略.........
开发者ID:Anuradha-Talur,项目名称:nfs-ganesha,代码行数:101,代码来源:9p_dispatcher.c
示例6: nfs_ip_name_add
int nfs_ip_name_add(sockaddr_t *ipaddr, char *hostname, size_t size)
{
struct gsh_buffdesc buffkey;
struct gsh_buffdesc buffdata;
nfs_ip_name_t *nfs_ip_name = NULL;
sockaddr_t *pipaddr = NULL;
struct timeval tv0, tv1, dur;
int rc;
char ipstring[SOCK_NAME_MAX + 1];
nfs_ip_name = gsh_malloc(sizeof(nfs_ip_name_t));
pipaddr = gsh_malloc(sizeof(sockaddr_t));
/* I have to keep an integer as key, I wil use the pointer buffkey->addr
* for this, this also means that buffkey->len will be 0
*/
memcpy(pipaddr, ipaddr, sizeof(sockaddr_t));
buffkey.addr = pipaddr;
buffkey.len = sizeof(sockaddr_t);
gettimeofday(&tv0, NULL);
rc = getnameinfo((struct sockaddr *)pipaddr, sizeof(sockaddr_t),
nfs_ip_name->hostname, sizeof(nfs_ip_name->hostname),
NULL, 0, 0);
gettimeofday(&tv1, NULL);
timersub(&tv1, &tv0, &dur);
sprint_sockip(pipaddr, ipstring, sizeof(ipstring));
/* display warning if DNS resolution took more that 1.0s */
if (dur.tv_sec >= 1) {
LogEvent(COMPONENT_DISPATCH,
"Warning: long DNS query for %s: %u.%06u sec",
ipstring, (unsigned int)dur.tv_sec,
(unsigned int)dur.tv_usec);
}
/* Ask for the name to be cached */
if (rc != 0) {
strmaxcpy(nfs_ip_name->hostname, ipstring,
sizeof(nfs_ip_name->hostname));
LogEvent(COMPONENT_DISPATCH,
"Cannot resolve address %s, error %s, using %s as hostname",
ipstring, gai_strerror(rc), nfs_ip_name->hostname);
}
LogDebug(COMPONENT_DISPATCH, "Inserting %s->%s to addr cache", ipstring,
nfs_ip_name->hostname);
/* I build the data with the request pointer
* that should be in state 'IN USE'
*/
nfs_ip_name->timestamp = time(NULL);
buffdata.addr = nfs_ip_name;
buffdata.len = sizeof(nfs_ip_name_t);
if (HashTable_Set(ht_ip_name, &buffkey, &buffdata) != HASHTABLE_SUCCESS)
return IP_NAME_INSERT_MALLOC_ERROR;
/* Copy the value for the caller */
strmaxcpy(hostname, nfs_ip_name->hostname, size);
return IP_NAME_SUCCESS;
} /* nfs_ip_name_add */
开发者ID:dotbugfix,项目名称:nfs-ganesha,代码行数:67,代码来源:nfs_ip_name.c
示例7: sizeof
BOOL CNTService::Install()
{
// Open the Service Control Manager
SC_HANDLE hSCM = ::OpenSCManager( NULL, // local machine
NULL, // ServicesActive database
SC_MANAGER_ALL_ACCESS); // full access
if ( !hSCM ) {
return FALSE;
}
// Get the executable file path
WCHAR szFilePath[_MAX_PATH];
::GetModuleFileName(NULL, szFilePath, sizeof(szFilePath));
// Create the service
SC_HANDLE hService = ::CreateService( hSCM,
m_szServiceName,
m_szServiceName,
SERVICE_ALL_ACCESS,
SERVICE_WIN32_OWN_PROCESS,
SERVICE_DEMAND_START, // start condition
SERVICE_ERROR_NORMAL,
szFilePath,
NULL,
NULL,
NULL,
NULL,
NULL );
if ( !hService ) {
::CloseServiceHandle(hSCM);
return FALSE;
}
// make registry entries to support logging messages
// Add the source name as a subkey under the Application
// key in the EventLog service portion of the registry.
WCHAR szKey[256];
HKEY hKey = NULL;
wcscpy( szKey, _("SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\") );
wcscpy( szKey, m_szServiceName );
if ( ::RegCreateKey(HKEY_LOCAL_MACHINE, szKey, &hKey) != ERROR_SUCCESS ) {
::CloseServiceHandle( hService );
::CloseServiceHandle( hSCM );
return FALSE;
}
// Add the Event ID message-file name to the 'EventMessageFile' subkey.
::RegSetValueEx( hKey,
_("EventMessageFile"),
0,
REG_EXPAND_SZ,
(CONST BYTE*)szFilePath,
wcslen(szFilePath) + 1 );
// Set the supported types flags.
DWORD dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE;
::RegSetValueEx( hKey,
_("TypesSupported"),
0,
REG_DWORD,
(CONST BYTE*)&dwData,
sizeof(DWORD) );
::RegCloseKey(hKey);
LogEvent( EVENTLOG_INFORMATION_TYPE, EVMSG_INSTALLED, m_szServiceName );
// tidy up
::CloseServiceHandle( hService );
::CloseServiceHandle( hSCM );
return TRUE;
}
开发者ID:ajje,项目名称:vscp,代码行数:72,代码来源:ntservice.cpp
示例8: LogEvent
void MyListCtrl::OnDeselected(wxListEvent& event)
{
LogEvent(event, wxT("OnDeselected"));
}
开发者ID:Bigpet,项目名称:wxWidgets,代码行数:4,代码来源:listtest.cpp
示例9: LogEvent
void CGroupViewTester::HandleContactViewEvent( const CContactViewBase& aView,
const TContactViewEvent& aEvent )
{
// Log events from both underlying view and group view.
LogEvent( const_cast<TContactViewEvent&>( aEvent ) );
switch (iCurrentTest)
{
case ECreateLocalView:
test(iLocalView==&aView);
test(aEvent.iEventType==TContactViewEvent::EReady);
break;
case ECreateGroupOneView:
{
test(iGroupViewOne == &aView);
test(aEvent.iEventType == TContactViewEvent::EReady);
//Reserve the IDs of last three contacts in the group
TInt index = KNumContactsInGroupOne-1;
TRAPD(err, iLastContactID = iGroupViewOne->ContactAtL(index).Id() );
if (err)
{
_LIT(KErrMsg, "Contact view error in CGroupViewTester::HandleContactViewEvent() assigning iLastContactID\n");
test.Printf(KErrMsg);
User::Invariant();
}
--index;
TRAP(err, iSecondLastContactID = iGroupViewOne->ContactAtL(index).Id() );
if (err)
{
_LIT(KErrMsg, "Contact view error in CGroupViewTester::HandleContactViewEvent() assigning iSecondLastContactID\n");
test.Printf(KErrMsg);
User::Invariant();
}
--index;
TRAP(err, iThirdLastContactID = iGroupViewOne->ContactAtL(index).Id() );
if (err)
{
_LIT(KErrMsg, "Contact view error in CGroupViewTester::HandleContactViewEvent() assigning iThirdLastContactID\n");
test.Printf(KErrMsg);
User::Invariant();
}
}
break;
case ECreateGroupTwoView:
test( iGroupViewTwo == &aView );
test( aEvent.iEventType == TContactViewEvent::EReady );
break;
case EDeleteItemsFromView:
{
// Bulk delete complete when the last Ready is received from the
// base view. This comes after the group view ready event. Break to
// run next test.
TBool lastEvent = (aEvent.iEventType == TContactViewEvent::EReady) &&
(&aView == iLocalView);
if (lastEvent)
{
break;
}
if (aEvent.iEventType == TContactViewEvent::EItemRemoved)
{
// Only proces events from group view.
if (&aView == iGroupViewOne)
{
// Ensure that only 1 contact is removed per notification.
iNumRemovedEvents++;
TInt numItemsExpected = KNumContactsInGroupOne - iNumRemovedEvents;
TInt numItems(0);
TRAPD(err, numItems = iGroupViewOne->CountL() );
if (err)
{
_LIT(KErrMsg, "Contact view error in CGroupViewTester::HandleContactViewEvent() assigning numItems\n");
test.Printf(KErrMsg);
User::Invariant();
}
test(numItems == numItemsExpected );
// Verify the contacts were deleted as expected.
TBool testVal(EFalse);
TInt index = numItemsExpected - 1;
TRAP(err, testVal = (iGroupViewOne->ContactAtL(index).Id() == iLastContactID) );
if (err)
{
_LIT(KErrMsg, "Contact view error in CGroupViewTester::HandleContactViewEvent() assigning testVal for iLastContactID\n");
test.Printf(KErrMsg);
User::Invariant();
}
test(testVal);
--index;
TRAP(err, testVal = (iGroupViewOne->ContactAtL(index).Id() == iSecondLastContactID) );
if (err)
//.........这里部分代码省略.........
开发者ID:bavanisp,项目名称:qtmobility-1.1.0,代码行数:101,代码来源:t_groupviewevents.cpp
示例10: LogEvent
/**
* FSAL_proxy_clientid_renewer_thread: this thread is made for refreshing the clientid used by the FSAL, automatically.
*
* This thread is made for refreshing the clientid used by the FSAL, automatically.
*
*
* \return never returns... This is a infinite loop that will die when the daemon stops
*/
void *FSAL_proxy_clientid_renewer_thread(void *Arg)
{
int rc;
COMPOUND4args argnfs4;
COMPOUND4res resnfs4;
struct timeval timeout = TIMEOUTRPC;
fsal_status_t fsal_status;
proxyfsal_op_context_t fsal_context;
proxyfsal_op_context_t *p_context = &fsal_context;
#define FSAL_RENEW_LEASE_NB_OP_ALLOC 1
nfs_argop4 argoparray[FSAL_RENEW_LEASE_NB_OP_ALLOC];
nfs_resop4 resoparray[FSAL_RENEW_LEASE_NB_OP_ALLOC];
#ifndef _NO_BUDDY_SYSTEM
buddy_parameter_t buddy_param = default_buddy_parameter;
#endif
LogEvent(COMPONENT_FSAL, "FSAL_proxy_clientid_refresher_thread: starting...");
sleep(6); /** @todo: use getattr to have an actual value of server's lease duration */
#ifndef _NO_BUDDY_SYSTEM
if((rc = BuddyInit(&buddy_param)) != BUDDY_SUCCESS)
{
/* Failed init */
LogCrit(COMPONENT_FSAL,
"FSAL_proxy_clientid_renewer_thread: Memory manager could not be initialized, exiting...");
exit(1);
}
#endif
memset((char *)&fsal_context, 0, sizeof(proxyfsal_op_context_t));
fsal_status = PROXYFSAL_InitClientContext(p_context);
if(FSAL_IS_ERROR(fsal_status))
{
LogCrit(COMPONENT_FSAL,
"FSAL_proxy_clientid_refresher_thread: FSAL error(%u,%u) during init... exiting",
fsal_status.major, fsal_status.minor);
exit(1);
}
/* Setup results structures */
argnfs4.argarray.argarray_val = argoparray;
resnfs4.resarray.resarray_val = resoparray;
argnfs4.minorversion = 0;
argnfs4.tag.utf8string_val = NULL;
argnfs4.tag.utf8string_len = 0;
argnfs4.argarray.argarray_len = 0;
argnfs4.argarray.argarray_val[0].argop = NFS4_OP_RENEW;
argnfs4.argarray.argarray_val[0].nfs_argop4_u.oprenew.clientid = fsal_clientid;
argnfs4.argarray.argarray_len = 1;
while(1)
{
sleep(60); /** @todo: use getattr to have an actual value of server's lease duration */
/* Call the NFSv4 function */
TakeTokenFSCall();
COMPOUNDV4_EXECUTE(p_context, argnfs4, resnfs4, rc);
if(rc != RPC_SUCCESS)
{
ReleaseTokenFSCall();
LogCrit(COMPONENT_FSAL, "FSAL_PROXY: /!\\ RPC error when connecting to the server");
}
ReleaseTokenFSCall();
if(resnfs4.status != NFS4_OK)
LogCrit(COMPONENT_FSAL,
"FSAL_PROXY: /!\\ NFSv4 error %u occured when trying to new clienitf %llu",
resnfs4.status, (long long unsigned int)fsal_clientid);
} /* while( 1 ) */
} /* FSAL_proxy_clientid_renewer_thread */
开发者ID:ic-hep,项目名称:emi3,代码行数:87,代码来源:fsal_proxy_clientid.c
示例11: FSAL_proxy_setclientid_force
/**
* FSAL_proxy_setclientid_force:
* Client ID negociation
*
* \param p_context (input):
* Authentication context for the operation (user,...).
*
* \return Major error codes :
* - ERR_FSAL_NO_ERROR (no error)
* - ERR_FSAL_FAULT (a NULL pointer was passed as mandatory argument)
* - Other error codes can be returned :
* ERR_FSAL_ACCESS, ERR_FSAL_IO, ...
*/
fsal_status_t FSAL_proxy_setclientid_force(proxyfsal_op_context_t * p_context)
{
int rc;
fsal_status_t fsal_status;
COMPOUND4args argnfs4;
COMPOUND4res resnfs4;
#define FSAL_CLIENTID_NB_OP_ALLOC 1
nfs_argop4 argoparray[FSAL_CLIENTID_NB_OP_ALLOC];
nfs_resop4 resoparray[FSAL_CLIENTID_NB_OP_ALLOC];
nfs_client_id4 nfsclientid;
cb_client4 cbproxy;
char clientid_name[MAXNAMLEN];
char cbaddr[MAXNAMLEN];
char cbnetid[MAXNAMLEN];
clientid4 resultclientid;
struct timeval timeout = TIMEOUTRPC;
LogEvent( COMPONENT_FSAL, "Negociating a new ClientId with the remote server" ) ;
/* sanity checks.
*/
if(!p_context)
Return(ERR_FSAL_FAULT, 0, INDEX_FSAL_InitClientContext);
/* Client id negociation is to be done only one time for the whole FSAL */
P(fsal_clientid_mutex_renew);
/* Setup results structures */
argnfs4.argarray.argarray_val = argoparray;
resnfs4.resarray.resarray_val = resoparray;
argnfs4.minorversion = 0;
argnfs4.tag.utf8string_val = NULL;
argnfs4.tag.utf8string_len = 0;
argnfs4.argarray.argarray_len = 0;
snprintf(clientid_name, MAXNAMLEN, "GANESHA NFSv4 Proxy Pid=%u", getpid());
nfsclientid.id.id_len = strlen(clientid_name);
nfsclientid.id.id_val = clientid_name;
snprintf(nfsclientid.verifier, NFS4_VERIFIER_SIZE, "%x", (int)ServerBootTime);
cbproxy.cb_program = 0;
strncpy(cbnetid, "tcp", MAXNAMLEN);
strncpy(cbaddr, "127.0.0.1", MAXNAMLEN);
#ifdef _USE_NFS4_1
cbproxy.cb_location.na_r_netid = cbnetid;
cbproxy.cb_location.na_r_addr = cbaddr;
#else
cbproxy.cb_location.r_netid = cbnetid;
cbproxy.cb_location.r_addr = cbaddr;
#endif
COMPOUNDV4_ARG_ADD_OP_SETCLIENTID(argnfs4, nfsclientid, cbproxy);
TakeTokenFSCall();
p_context->user_credential.user = 0;
p_context->user_credential.group = 0;
p_context->user_credential.nbgroups = 0;
/* Call the NFSv4 function */
rc = COMPOUNDV4_EXECUTE_SIMPLE(p_context, argnfs4, resnfs4);
if(rc != RPC_SUCCESS)
{
ReleaseTokenFSCall();
V(fsal_clientid_mutex_renew);
Return(ERR_FSAL_IO, rc, INDEX_FSAL_unlink);
}
ReleaseTokenFSCall();
if(resnfs4.status != NFS4_OK)
{
V(fsal_clientid_mutex_renew);
return fsal_internal_proxy_error_convert(resnfs4.status,
INDEX_FSAL_InitClientContext);
}
resultclientid =
resnfs4.resarray.resarray_val[0].nfs_resop4_u.opsetclientid.SETCLIENTID4res_u.
resok4.clientid;
/* Step 2: Confirm the client id */
argnfs4.minorversion = 0;
//.........这里部分代码省略.........
开发者ID:ic-hep,项目名称:emi3,代码行数:101,代码来源:fsal_proxy_clientid.c
示例12: cache_inode_commit
cache_inode_status_t
cache_inode_commit(cache_entry_t * pentry,
uint64_t offset,
fsal_size_t count,
fsal_attrib_list_t * pfsal_attr,
hash_table_t * ht,
cache_inode_client_t * pclient,
fsal_op_context_t * pcontext,
uint64_t typeofcommit,
cache_inode_status_t * pstatus)
{
cache_inode_status_t status;
fsal_seek_t seek_descriptor;
fsal_size_t size_io_done;
fsal_boolean_t eof;
cache_inode_unstable_data_t *udata;
fsal_status_t fsal_status;
/* Do not use this function is Data Cache is used */
if(pentry->object.file.pentry_content != NULL)
{
*pstatus = CACHE_INODE_SUCCESS;
return *pstatus;
}
/* If we aren't using the Ganesha write buffer, then we're using the filesystem
* write buffer so execute a normal fsal_sync() call. */
if (typeofcommit == FSAL_UNSAFE_WRITE_TO_FS_BUFFER)
{
P_w(&pentry->lock);
/* Can't sync a file descriptor if it's currently closed. */
if(cache_inode_open(pentry,
pclient,
FSAL_O_WRONLY, pcontext, pstatus) != CACHE_INODE_SUCCESS)
{
V_w(&pentry->lock);
/* stats */
pclient->stat.func_stats.nb_err_unrecover[CACHE_INODE_COMMIT] += 1;
return *pstatus;
}
#ifdef _USE_MFSL
fsal_status = MFSL_sync(&(pentry->object.file.open_fd.mfsl_fd), NULL);
#else
fsal_status = FSAL_sync(&(pentry->object.file.open_fd.fd));
#endif
if(FSAL_IS_ERROR(fsal_status))
{
LogMajor(COMPONENT_CACHE_INODE,
"cache_inode_rdwr: fsal_sync() failed: fsal_status.major = %d",
fsal_status.major);
/* Close the fd that we just opened before the FSAL_sync(). We are already
* replying with an error. No need to catch an additional error form
* a close? */
cache_inode_close(pentry, pclient, &status);
V_w(&pentry->lock);
/* stats */
pclient->stat.func_stats.nb_err_unrecover[CACHE_INODE_COMMIT] += 1;
*pstatus = CACHE_INODE_FSAL_ERROR;
return *pstatus;
}
*pstatus = CACHE_INODE_SUCCESS;
/* Close the fd that we just opened before the FSAL_sync() */
if(cache_inode_close(pentry, pclient, pstatus) != CACHE_INODE_SUCCESS)
{
LogEvent(COMPONENT_CACHE_INODE,
"cache_inode_rdwr: cache_inode_close = %d",
*pstatus);
V_w(&pentry->lock);
/* stats */
pclient->stat.func_stats.nb_err_unrecover[CACHE_INODE_COMMIT] += 1;
return *pstatus;
}
V_w(&pentry->lock);
return *pstatus;
}
/* Ok, it looks like we're using the Ganesha write buffer. This means we
* will either be writing to the buffer, or writing a stable write to the
* file system if the buffer is already full. */
udata = &pentry->object.file.unstable_data;
if(udata->buffer == NULL)
{
*pstatus = CACHE_INODE_SUCCESS;
return *pstatus;
//.........这里部分代码省略.........
开发者ID:bwelch,项目名称:nfs-ganesha,代码行数:101,代码来源:cache_inode_commit.c
示例13: LogEvent
BOOL CTraceTabBaseDlg::CreateAndPlaceDialogs()
{
m_TabCtrl.ModifyStyle(m_TabStyleRemove, m_TabStyleAdd);
size_t NumDlg = m_TabDlgVec.size();
LONG Width = 0, Height = 0;
for(size_t i = 0 ; i < NumDlg; ++i)
{
m_TabCtrl.InsertItem(m_TabDlgVec[i].DialogId , m_TabDlgVec[i].TabName);
CDialog* pChild = m_TabDlgVec[i].Child;
int DialogId = m_TabDlgVec[i].DialogId;
if (!pChild->Create(DialogId, this))
{
LogEvent(LE_ERROR, "CTraceTabBaseDlg::CreateAndPlaceDialogs: Failed to build dialog. IDD = %d", DialogId);
Assert(false);
return FALSE;
}
CRect ChildRect;
pChild->GetWindowRect(&ChildRect);
Width = max(Width, ChildRect.right - ChildRect.left);
Height = max(Height, ChildRect.bottom - ChildRect.top);
}
CRect TabWindowRect;
m_TabCtrl.GetWindowRect(&TabWindowRect);
LONG TabWidth = TabWindowRect.right - TabWindowRect.left;
LONG TabHeight = TabWindowRect.bottom - TabWindowRect.top;
Width = max(Width+10, TabWidth);
Height = max(Height, TabHeight);
TabWindowRect.right = TabWindowRect.left + Width;
TabWindowRect.bottom = TabWindowRect.top + Height;
LONG TabWindowLeft = TabWindowRect.left;
LONG TabWindowTop = TabWindowRect.top;
ScreenToClient(&TabWindowRect);
m_TabCtrl.MoveWindow(TabWindowRect);
//SetListBoxTopLeft(TabWindowRect.top + 5, 10+Width);
//SetListBoxTopLeft(-1, 10+Width);
SetListBoxTopLeft(-1, Width);
LONG Left = MAXLONG, Top = 0;
for(size_t i = 0 ; i < NumDlg; ++i)
{
CRect ItemRect;
m_TabCtrl.GetItemRect(i, &ItemRect);
Left = min(Left, ItemRect.left);
Top = max(Top, ItemRect.bottom);
}
//Left += TabWindowLeft + 5;
//Top += TabWindowTop + 5;
Left += TabWindowLeft;
Top += TabWindowTop + 2;
for(size_t i = 0 ; i < NumDlg; ++i)
{
CDialog* pChild = m_TabDlgVec[i].Child;
CRect ChildRect;
pChild->GetWindowRect(&ChildRect);
ChildRect.OffsetRect(Left - ChildRect.left, Top - ChildRect.top);
ScreenToClient(ChildRect);
pChild->MoveWindow(ChildRect);
}
if(!m_TabDlgVec.empty())
{
m_TabCtrl.SetCurSel(m_TabItem);
}
else
{
//no dialogs
LogEvent(LE_INFO, "CTraceTabBaseDlg::CreateAndPlaceDialogs() No Dialogs so hide the Tab Control");
m_TabCtrl.ShowWindow(SW_HIDE);
SetListBoxTopLeft(-1, 8);
}
return TRUE;
}
开发者ID:BlueSpells,项目名称:MapGen,代码行数:76,代码来源:TraceTabBaseDlg.cpp
示例14: ZeroMemory
int CStreamMuxerImp1::CloseStream(void)
{
HRESULT hr = S_OK;
SSF_BUFFER outputBuffer;
ZeroMemory(&outputBuffer, sizeof(outputBuffer));
/////////Update the headers for each fMP4 file///////////////
///Video
if(m_pVideoStream)
{
m_pVideoStream->FlushOutput();
hr = SSFMuxGetHeader( m_hSSFMux, m_pVideoStream->GetStreamIndex(), 1, &outputBuffer );
if( FAILED(hr) )
{
char buf[1024];
sprintf_s(buf, "Error 0x%08x: Failed to get FMP4 header\n", hr );
LogEvent(buf);
return FALSE;
}
//////////////////////////////////////////////////
hr = m_pVideoStream->WriteStreamToOutput( outputBuffer.pbBuffer, outputBuffer.cbBuffer, L"r+b");
if( FAILED(hr) )
{
char buf[1024];
sprintf_s(buf, "Error 0x%08x: WriteToSmoothStreamOutput\n", hr );
LogEvent(buf);
return FALSE;
}
}
if(m_pAudioStream)
{ ////Audio
m_pAudioStream->FlushOutput();
hr = SSFMuxGetHeader( m_hSSFMux, m_pAudioStream->GetStreamIndex(), 1, &outputBuffer );
if( FAILED(hr) )
{
char buf[1024];
sprintf_s(buf, "Error 0x%08x: Failed to get FMP4 header\n", hr );
LogEvent(buf);
return FALSE;
}
//////////////////////////////////////////////////
hr = m_pAudioStream->WriteStreamToOutput( outputBuffer.pbBuffer, outputBuffer.cbBuffer, L"r+b");
if( FAILED(hr) )
{
char buf[1024];
sprintf_s(buf, "Error 0x%08x: WriteToSmoothStreamOutput\n", hr );
LogEvent(buf);
return FALSE;
}
}
///////////////////////
int retval = 0;
hr = SSFMuxGetIndex( m_hSSFMux,m_pVideoStream->GetStreamIndex(), 1, &outputBuffer );
if( FAILED(hr) )
{
char buf[1024];
sprintf_s(buf, "Error 0x%08x: Failed to get FMP4 index\n", hr );
LogEvent(buf);
retval = -1;
}
hr = m_pVideoStream->WriteStreamToOutput(
outputBuffer.pbBuffer,
outputBuffer.cbBuffer, L"ab");
if( FAILED(hr) )
{
retval = -1;
}
if(m_pAudioStream)
{
hr = SSFMuxGetIndex( m_hSSFMux,m_pAudioStream->GetStreamIndex(), 1, &outputBuffer );
if( FAILED(hr) )
{
char buf[1024];
sprintf_s(buf, "Error 0x%08x: Failed to get Audio FMP4 index\n", hr );
LogEvent(buf);
retval = -1;
}
hr = m_pAudioStream->WriteStreamToOutput(
outputBuffer.pbBuffer,
outputBuffer.cbBuffer, L"ab");
if( FAILED(hr) )
{
retval = -1;
}
}
WriteManifests();
return retval;
}
开发者ID:pruginkad,项目名称:webinterest,代码行数:95,代码来源:StreamMuxerImp1.cpp
示例15: cache_inode_create
//.........这里部分代码省略.........
name,
&object_attributes,
&object_handle);
break;
case SYMBOLIC_LINK:
fsal_status = dir_handle->ops->symlink(dir_handle, req_ctx,
name,
create_arg->link_content,
&object_attributes,
&object_handle);
break;
case SOCKET_FILE:
case FIFO_FILE:
fsal_status = dir_handle->ops->mknode(dir_handle, req_ctx,
name,
type,
NULL, /* no dev_t needed */
&object_attributes,
&object_handle);
break;
case BLOCK_FILE:
case CHARACTER_FILE:
fsal_status = dir_handle->ops->mknode(dir_handle, req_ctx,
name,
type,
&create_arg->dev_spec,
&object_attributes,
&object_handle);
break;
default:
/* we should never go there */
status = CACHE_INODE_INCONSISTENT_ENTRY;
*entry = NULL;
goto out;
break;
}
cache_inode_refresh_attrs_locked(parent, req_ctx);
/* Check for the result */
if (FSAL_IS_ERROR(fsal_status)) {
if (fsal_status.major == ERR_FSAL_STALE) {
LogEvent(COMPONENT_CACHE_INODE,
"FSAL returned STALE on create type %d", type);
cache_inode_kill_entry(parent);
} else if (fsal_status.major == ERR_FSAL_EXIST) {
/* Already exists. Check if type if correct */
status = cache_inode_lookup(parent,
name,
req_ctx,
entry);
if (*entry != NULL) {
status = CACHE_INODE_ENTRY_EXISTS;
if ((*entry)->type != type) {
/* Incompatible types, returns NULL */
cache_inode_put(*entry);
*entry = NULL;
}
goto out;
}
if (status == CACHE_INODE_NOT_FOUND) {
/* Too bad, FSAL insist the file exists when we try to
* create it, but lookup couldn't find it, retry. */
status = CACHE_INODE_INCONSISTENT_ENTRY;
goto out;
}
}
status = cache_inode_error_convert(fsal_status);
*entry = NULL;
goto out;
}
status = cache_inode_new_entry(object_handle,
CACHE_INODE_FLAG_CREATE,
entry);
if (*entry == NULL) {
goto out;
}
PTHREAD_RWLOCK_wrlock(&parent->content_lock);
/* Add this entry to the directory (also takes an internal ref) */
status = cache_inode_add_cached_dirent(parent,
name,
*entry,
NULL);
PTHREAD_RWLOCK_unlock(&parent->content_lock);
if (status != CACHE_INODE_SUCCESS) {
cache_inode_put(*entry);
*entry = NULL;
goto out;
}
out:
return status;
}
开发者ID:tsunamiwang,项目名称:nfs-ganesha-anand,代码行数:101,代码来源:cache_inode_create.c
示例16: main
void main(int argc,char *argv[]) {
int x;
long tid;
char tellstr[100],*tmppscreen, titel[80], configname[50] = "NiKom:DatoCfg/SerNode.cfg";
if(argc>1) for(x=1;x<argc;x++) {
if(argv[x][0]=='-') {
if(argv[x][1]=='B') dtespeed=atoi(&argv[x][2]);
else if(argv[x][1]=='N') nodnr = atoi(&argv[x][2]);
} else strcpy(configname,argv[x]);
}
if(nodnr==-1) {
printf("NiKomSer måste startas från prenoden.\n");
exit(10);
}
NewList((struct List *)&aliaslist);
NewList((struct List *)&edit_list);
if(!(IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",0)))
cleanup(EXIT_ERROR,"Kunde inte öppna intuition.library\n");
if(!(UtilityBase=OpenLibrary("utility.library",37L)))
cleanup(EXIT_ERROR,"Kunde inte öppna utility.library\n");
if(!(LocaleBase=OpenLibrary("locale.library",38L)))
cleanup(EXIT_ERROR,"Kunde inte öppna locale.library\n");
if(!(NiKomBase=OpenLibrary("nikom.library",0L)))
cleanup(EXIT_ERROR,"Kunde inte öppna nikom.library\n");
initnode(NODSPAWNED);
if(!(nikomnodeport = CreateMsgPort()))
cleanup(EXIT_ERROR,"Kunde inte skapa NiKomNode-porten");
sprintf(nikomnodeportnamn,"NiKomNode%d",nodnr);
nikomnodeport->mp_Node.ln_Name = nikomnodeportnamn;
nikomnodeport->mp_Node.ln_Pri = 1;
AddPort(nikomnodeport);
sprintf(rexxportnamn,"NiKomRexx%d",nodnr);
if(!(rexxport=(struct MsgPort *)CreateMsgPort()))
cleanup(EXIT_ERROR,"Kunde inte öppna RexxPort\n");
rexxport->mp_Node.ln_Name=rexxportnamn;
rexxport->mp_Node.ln_Pri = 50;
AddPort(rexxport);
if(!(RexxSysBase=(struct RsxLib *)OpenLibrary("rexxsyslib.library",0L)))
cleanup(EXIT_ERROR,"Kunde inte öppna rexxsyslib.library\n");
getnodeconfig(configname);
if(pubscreen[0]=='-') tmppscreen=NULL;
else tmppscreen=pubscreen;
if(!(NiKwind=(struct Window *)OpenWindowTags(NULL,WA_Left,xpos,
WA_Top,ypos,
WA_Width,xsize,
WA_Height,ysize,
WA_IDCMP,IDCMP_CLOSEWINDOW,
WA_MinWidth,50,
WA_MinHeight,10,
WA_MaxWidth,~0,
WA_MaxHeight,~0,
WA_SizeGadget,TRUE,
WA_SizeBBottom, TRUE,
WA_DragBar,TRUE,
WA_DepthGadget,TRUE,
WA_CloseGadget,TRUE,
WA_SimpleRefresh,TRUE,
WA_ScreenTitle,"NiKomSer",
WA_AutoAdjust,TRUE,
WA_PubScreenName,tmppscreen,
TAG_DONE)))
cleanup(EXIT_ERROR,"Kunde inte öppna fönstret\n");
if(!OpenIO(NiKwind)) cleanup(EXIT_ERROR,"Kunde inte öppna IO\n");
inloggad=Servermem->inloggad[nodnr];
conreqtkn();
serreqtkn();
UpdateInactive();
sprintf(titel,"Nod #%d SER: %s #%d",nodnr,Servermem->inne[nodnr].namn,inloggad);
SetWindowTitles(NiKwind,titel,(char *)-1L);
if(!ReadUnreadTexts(&Servermem->unreadTexts[nodnr], inloggad)) {
puttekn("Error reading unread text info.\r\n", -1);
LogEvent(SYSTEM_LOG, ERROR,
"Can't read unread text info for user %d", inloggad);
cleanup(EXIT_ERROR, "Error reading unread text info.\n");
}
if(getft("NiKom:Texter/Bulletin.txt")>Servermem->inne[nodnr].senast_in) {
sendfile("NiKom:Texter/Bulletin.txt");
}
connection();
if(nodestate & NIKSTATE_NOCARRIER) {
conputtekn("\nCarrier dropped\n",-1);
if(Servermem->cfg.logmask & LOG_CARDROPPED) {
LogEvent(USAGE_LOG, WARN, "%s släpper carriern (nod %d)",
getusername(inloggad), nodnr);
}
if(Servermem->cfg.ar.cardropped) sendautorexx(Servermem->cfg.ar.cardropped);
} else {
if(nodestate & NIKSTATE_AUTOLOGOUT) {
puttekn("\n\n\r*** Automagisk
|
请发表评论