本文整理汇总了C++中dsyslog函数的典型用法代码示例。如果您正苦于以下问题:C++ dsyslog函数的具体用法?C++ dsyslog怎么用?C++ dsyslog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dsyslog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dsyslog
void LG::InitSerial(const char *device)
{
ssize_t r = 0;
if (fd != -1) return;
dsyslog("lgcontrol: open: %s\n", device);
fd = open(device, O_RDWR | O_NOCTTY | O_NONBLOCK);
if (fd < 0) {
dsyslog("lgcontrol: Cannot open: %s\n", device);
return;
}
tcflush(fd, TCIOFLUSH);
struct termios tios;
memset(&tios, 0, sizeof(tios));
cfsetispeed(&tios, baudrate);
cfsetospeed(&tios, baudrate);
tios.c_cflag = CS8 | CLOCAL | CREAD;
tios.c_iflag = IGNPAR | IGNBRK | IXANY;
tios.c_lflag = ISIG;
tios.c_cc[VMIN] = 0;
tios.c_cc[VTIME] = 0;
tcsetattr(fd, TCSANOW, &tios);
tcflush(fd, TCIOFLUSH);
r=write(fd, "\r", 1);
r=r;
}
示例2: I18nInitialize
void I18nInitialize(const char *LocaleDir)
{
I18nLocaleDir = LocaleDir;
LanguageLocales.Append(strdup(I18N_DEFAULT_LOCALE));
LanguageNames.Append(strdup(SkipContext(LanguageName)));
LanguageCodes.Append(strdup(LanguageCodeList[0]));
textdomain("vdr");
bindtextdomain("vdr", I18nLocaleDir);
cFileNameList Locales(I18nLocaleDir, true);
if (Locales.Size() > 0) {
char *OldLocale = strdup(setlocale(LC_MESSAGES, NULL));
for (int i = 0; i < Locales.Size(); i++) {
cString FileName = cString::sprintf("%s/%s/LC_MESSAGES/vdr.mo", *I18nLocaleDir, Locales[i]);
if (access(FileName, F_OK) == 0) { // found a locale with VDR texts
if (NumLocales < I18N_MAX_LANGUAGES - 1) {
SetEnvLanguage(Locales[i]);
const char *TranslatedLanguageName = gettext(LanguageName);
if (TranslatedLanguageName != LanguageName) {
NumLocales++;
if (strstr(OldLocale, Locales[i]) == OldLocale)
CurrentLanguage = LanguageLocales.Size();
LanguageLocales.Append(strdup(Locales[i]));
LanguageNames.Append(strdup(TranslatedLanguageName));
const char *Code = gettext(LanguageCode);
for (const char **lc = LanguageCodeList; *lc; lc++) {
if (ContainsCode(*lc, Code)) {
Code = *lc;
break;
}
}
LanguageCodes.Append(strdup(Code));
}
}
else {
esyslog("ERROR: too many locales - increase I18N_MAX_LANGUAGES!");
break;
}
}
}
SetEnvLanguage(LanguageLocales[CurrentLanguage]);
free(OldLocale);
dsyslog("found %d locales in %s", NumLocales - 1, *I18nLocaleDir);
}
// Prepare any known language codes for which there was no locale:
for (const char **lc = LanguageCodeList; *lc; lc++) {
bool Found = false;
for (int i = 0; i < LanguageCodes.Size(); i++) {
if (strcmp(*lc, LanguageCodes[i]) == 0) {
Found = true;
break;
}
}
if (!Found) {
dsyslog("no locale for language code '%s'", *lc);
LanguageLocales.Append(strdup(I18N_DEFAULT_LOCALE));
LanguageNames.Append(strdup(*lc));
LanguageCodes.Append(strdup(*lc));
}
}
}
示例3: ntlm_gss_inquire_cred
OM_uint32
ntlm_gss_inquire_cred(
OM_uint32 *minor_status,
gss_cred_id_t cred_handle,
gss_name_t *name,
OM_uint32 *lifetime,
int *cred_usage,
gss_OID_set *mechanisms)
{
OM_uint32 status = 0;
ntlm_gss_cred_id_t ntlm_cred_handle = NULL;
gss_name_t ret_name = NULL;
dsyslog("Entering inquire_cred\n");
ntlm_cred_handle = (ntlm_gss_cred_id_t) cred_handle;
if (ntlm_cred_handle && ntlm_cred_handle->name && name)
{
status = gss_duplicate_name(
minor_status,
ntlm_cred_handle->name,
&ret_name);
if (status == 0)
{
*name = ret_name;
}
}
dsyslog("Leaving inquire_cred\n");
return (status);
}
示例4: CheckDevice
bool cServerConnection::ProvidesChannel(const cChannel *Channel, int Priority)
{
cDevice *device = CheckDevice(Channel, Priority, false);
if (!device || (StreamdevServerSetup.SuspendMode != smAlways
&& !device->IsTunedToTransponder(Channel)
&& UsedByLiveTV(device))) {
// no device available or the device is in use for live TV and suspend mode doesn't allow us to switch it:
// maybe a device would be free if THIS connection did turn off its streams?
Detach();
device = CheckDevice(Channel, Priority, false);
Attach();
if (device && StreamdevServerSetup.SuspendMode != smAlways
&& !device->IsTunedToTransponder(Channel)
&& UsedByLiveTV(device)) {
// now we would have to switch away live tv...let's see if live tv
// can be handled by another device
const cChannel *current = Channels.GetByNumber(cDevice::CurrentChannel());
cDevice *newdev = current ? CheckDevice(current, 0, true, device) : NULL;
if (newdev) {
dsyslog("streamdev: Providing channel %d (%s) at priority %d requires moving live TV to device %d (PrimaryDevice=%d, ActualDevice=%d)", Channel->Number(), Channel->Name(), Priority, newdev->CardIndex(), cDevice::PrimaryDevice()->CardIndex(), cDevice::ActualDevice()->CardIndex());
}
else {
device = NULL;
dsyslog("streamdev: Not providing channel %d (%s) at priority %d - live TV not suspended", Channel->Number(), Channel->Name(), Priority);
}
}
else if (!device)
dsyslog("streamdev: No device provides channel %d (%s) at priority %d", Channel->Number(), Channel->Name(), Priority);
}
return device;
}
示例5: mailfor
void
mailfor(char *name)
{
struct utmp *utp = &utmp[nutmp];
char utname[UT_NAMESIZE+1];
const char *errstr;
char *cp;
off_t offset;
dsyslog(LOG_DEBUG, "mail for '%s'", name);
if (!(cp = strchr(name, '@')))
return;
*cp++ = '\0';
cp[strcspn(cp, " \t\n")] = '\0';
offset = strtonum(cp, 0, LLONG_MAX, &errstr);
if (errstr) {
syslog(LOG_ERR, "'%s' is %s", cp + 1, errstr);
return;
}
while (--utp >= utmp) {
memcpy(utname, utp->ut_name, UT_NAMESIZE);
utname[UT_NAMESIZE] = '\0';
dsyslog(LOG_DEBUG, "check %s against %s", name, utname);
if (!strncmp(utname, name, UT_NAMESIZE))
notify(utp, offset);
}
}
示例6: dsyslog
void cGlobals::ListCustomTokens(void) {
for (map<string, string>::iterator it = customStringTokens.begin(); it != customStringTokens.end(); it++) {
dsyslog("skindesigner: custom string token \"%s\" = \"%s\"", (it->first).c_str(), (it->second).c_str());
}
for (map<string, int>::iterator it = customIntTokens.begin(); it != customIntTokens.end(); it++) {
dsyslog("skindesigner: custom int token \"%s\" = \"%d\"", (it->first).c_str(), it->second);
}
}
示例7: ReportEpgBugFixStats
void ReportEpgBugFixStats(bool Force)
{
if (Setup.EPGBugfixLevel > 0) {
static time_t LastReport = 0;
time_t now = time(NULL);
if (now - LastReport > 3600 || Force) {
LastReport = now;
struct tm tm_r;
struct tm *ptm = localtime_r(&now, &tm_r);
if (ptm->tm_hour != 5)
return;
}
else
return;
bool GotHits = false;
char buffer[1024];
for (int i = 0; i < MAXEPGBUGFIXSTATS; i++) {
const char *delim = " ";
tEpgBugFixStats *p = &EpgBugFixStats[i];
if (p->hits) {
bool PrintedStats = false;
char *q = buffer;
*buffer = 0;
for (int c = 0; c < p->n; c++) {
cChannel *channel = Channels.GetByChannelID(p->channelIDs[c], true);
if (channel) {
if (!GotHits) {
dsyslog("=====================");
dsyslog("EPG bugfix statistics");
dsyslog("=====================");
dsyslog("IF SOMEBODY WHO IS IN CHARGE OF THE EPG DATA FOR ONE OF THE LISTED");
dsyslog("CHANNELS READS THIS: PLEASE TAKE A LOOK AT THE FUNCTION cEvent::FixEpgBugs()");
dsyslog("IN VDR/epg.c TO LEARN WHAT'S WRONG WITH YOUR DATA, AND FIX IT!");
dsyslog("=====================");
dsyslog("Fix Hits Channels");
GotHits = true;
}
if (!PrintedStats) {
q += snprintf(q, sizeof(buffer) - (q - buffer), "%-3d %-4d", i, p->hits);
PrintedStats = true;
}
q += snprintf(q, sizeof(buffer) - (q - buffer), "%s%s", delim, channel->Name());
delim = ", ";
if (q - buffer > 80) {
q += snprintf(q, sizeof(buffer) - (q - buffer), "%s...", delim);
break;
}
}
}
if (*buffer)
dsyslog("%s", buffer);
}
p->hits = p->n = 0;
}
if (GotHits)
dsyslog("=====================");
}
}
示例8: while
void cTransfer::Action(void)
{
int PollTimeouts = 0;
uchar *p = NULL;
int Result = 0;
while (Running()) {
int Count;
uchar *b = ringBuffer->Get(Count);
if (b) {
if (ringBuffer->Available() > TRANSFERBUFSIZE * 9 / 10) {
// If the buffer runs full, we have no chance of ever catching up
// since the data comes in at the same rate as it goes out (it's "live").
// So let's clear the buffer instead of suffering from permanent
// overflows.
dsyslog("clearing transfer buffer to avoid overflows");
DeviceClear();
ringBuffer->Clear();
remux->Clear();
PlayPes(NULL, 0);
p = NULL;
continue;
}
Count = remux->Put(b, Count);
if (Count)
ringBuffer->Del(Count);
}
if (!p)
p = remux->Get(Result);
if (p) {
cPoller Poller;
if (DevicePoll(Poller, 100)) {
PollTimeouts = 0;
int w = PlayPes(p, Result);
if (w > 0) {
p += w;
Result -= w;
remux->Del(w);
if (Result <= 0)
p = NULL;
}
else if (w < 0 && FATALERRNO)
LOG_ERROR;
}
else {
PollTimeouts++;
if (PollTimeouts == POLLTIMEOUTS_BEFORE_DEVICECLEAR) {
dsyslog("clearing device because of consecutive poll timeouts");
DeviceClear();
ringBuffer->Clear();
remux->Clear();
PlayPes(NULL, 0);
p = NULL;
}
}
}
}
}
示例9: dsyslog
void cExtRecInfo::Debug(void) {
dsyslog("skindesigner: extRecInfo xml: %s", xml.c_str());
dsyslog("skindesigner: : res_width %d, res_height %d, res %s, aspectratio %s, codec %s, format %s, framerate %s, interlace %s, hd %s, widescreen %s",
resWidth, resHeight, resString.c_str(), aspectratio.c_str(), codec.c_str(), format.c_str(), framerate.c_str(), interlace.c_str(),
isHD ? "true": "false", isWideScreen ? "true" : "false");
int numTrack = 1;
for (vector<tAudioTrack>::iterator it = tracks.begin(); it != tracks.end(); it++) {
dsyslog("skindesigner: audio track %d, codec %s, bitrate %s, language: %s", numTrack++, (*it).codec.c_str(), (*it).bitrate.c_str(), (*it).language.c_str());
}
}
示例10: dsyslog
int cSkins::QueueMessage(eMessageType Type, const char *s, int Seconds, int Timeout)
{
if (Type == mtStatus) {
dsyslog("cSkins::QueueMessage() called with mtStatus - ignored!");
return kNone;
}
if (isempty(s)) {
if (!cThread::IsMainThread()) {
queueMessageMutex.Lock();
for (cSkinQueuedMessage *m = SkinQueuedMessages.Last(); m; m = SkinQueuedMessages.Prev(m)) {
if (m->threadId == cThread::ThreadId() && m->state == 0)
m->state = 2; // done
}
queueMessageMutex.Unlock();
}
else
dsyslog("cSkins::QueueMessage() called with empty message from main thread - ignored!");
return kNone;
}
int k = kNone;
if (Timeout > 0) {
if (cThread::IsMainThread()) {
dsyslog("cSkins::QueueMessage() called from main thread with Timeout = %d - ignored!", Timeout);
return k;
}
cSkinQueuedMessage *m = new cSkinQueuedMessage(Type, s, Seconds, Timeout);
queueMessageMutex.Lock();
SkinQueuedMessages.Add(m);
m->mutex.Lock();
queueMessageMutex.Unlock();
if (m->condVar.TimedWait(m->mutex, Timeout * 1000))
k = m->key;
else
k = -1; // timeout, nothing has been displayed
m->state = 2; // done
m->mutex.Unlock();
}
else {
queueMessageMutex.Lock();
// Check if there is a waiting message w/o timeout for this thread:
if (Timeout == -1) {
for (cSkinQueuedMessage *m = SkinQueuedMessages.Last(); m; m = SkinQueuedMessages.Prev(m)) {
if (m->threadId == cThread::ThreadId()) {
if (m->state == 0 && m->timeout == -1)
m->state = 2; // done
break;
}
}
}
// Add the new message:
SkinQueuedMessages.Add(new cSkinQueuedMessage(Type, s, Seconds, Timeout));
queueMessageMutex.Unlock();
}
return k;
}
示例11: dsyslog
void *cThread::StartThread(cThread *Thread)
{
if (Thread->description)
dsyslog("%s thread started (pid=%d, tid=%ld)", Thread->description, getpid(), pthread_self());
Thread->Action();
if (Thread->description)
dsyslog("%s thread ended (pid=%d, tid=%ld)", Thread->description, getpid(), pthread_self());
Thread->running = false;
Thread->active = false;
return NULL;
}
示例12: dsyslog
void cStatusTest::OsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle)
{
char buffer[25];
struct tm tm_r;
dsyslog("status: cStatusTest::OsdProgramme");
strftime(buffer, sizeof(buffer), "%R", localtime_r(&PresentTime, &tm_r));
dsyslog("%5s %s", buffer, PresentTitle);
dsyslog("%5s %s", "", PresentSubtitle);
strftime(buffer, sizeof(buffer), "%R", localtime_r(&FollowingTime, &tm_r));
dsyslog("%5s %s", buffer, FollowingTitle);
dsyslog("%5s %s", "", FollowingSubtitle);
}
示例13: sem_wait_timeout
static int sem_wait_timeout(sem_t *sem,int timeout)
{
int i;
dsyslog(LOG_INFO,"sem_wait_timeout: timeout=%d\n",timeout);
for (i = 0; i < timeout; i++) {
if (sem_trywait(sem) != 0)
return 0;
usleep(1000);
}
dsyslog(LOG_INFO,"timeout waiting for transmitter\n",timeout);
return 1;
}
示例14: waitforack
// returns ack if received before timeout
// returns 0 if timeout
static int waitforack(int timeout)
{
int i;
dsyslog(LOG_INFO,"waitforack: timeout %d\n",timeout);
for (i = 0; i < timeout; i++){
if (sem_trywait(&sem_ack) == 0){
dsyslog(LOG_INFO,"received ACK/NAK\n");
return ack;
}
usleep(1000);
}
return 0;
}
示例15: ntlm_gss_release_name
/*ARGSUSED*/
OM_uint32
ntlm_gss_release_name(
OM_uint32 *minor_status,
gss_name_t *input_name)
{
OM_uint32 status = 0;
dsyslog("Entering release_name\n");
status = gss_release_name(minor_status, input_name);
dsyslog("Leaving release_name\n");
return (status);
}