static void domsr(int cpu, int msr, int bit) { char fpath[32]; unsigned long long data; int fd; sprintf(fpath, "/dev/cpu/%d/msr", cpu); fd = open(fpath, O_RDWR); if (fd == -1) { switch (errno) { case ENOENT: SYSERRprintf("Warning: cpu %d offline?, imc_log not set\n", cpu); return; default: SYSERRprintf("Cannot open %s to set imc_log\n", fpath); exit(1); } } if (pread(fd, &data, sizeof data, msr) != sizeof data) { SYSERRprintf("Cannot read MSR_ERROR_CONTROL from %s\n", fpath); exit(1); } data |= bit; if (pwrite(fd, &data, sizeof data, msr) != sizeof data) { SYSERRprintf("Cannot write MSR_ERROR_CONTROL to %s\n", fpath); exit(1); } if (pread(fd, &data, sizeof data, msr) != sizeof data) { SYSERRprintf("Cannot re-read MSR_ERROR_CONTROL from %s\n", fpath); exit(1); } if ((data & bit) == 0) Lprintf("No DIMM detection available on cpu %d (normal in virtual environments)\n", cpu); close(fd); }
int LogOpen(void) { #ifdef MAXSNOOP if(!pipe) SnSetPipeName("\\pipe\\maxsnoop"); SnoopOpen(pipe, &hsnoop, xfer_id, NullNotify); #endif if (!logfile && log_name && log_name[0]) { log_written=TRUE; Convert_Star_To_Task(log_name); if ((logfile=sfopen(log_name, fopen_append, O_APPEND | O_TEXT | O_WRONLY | O_CREAT | O_NOINHERIT, SH_DENYWR))==NULL) { Lprintf(copen_log, log_name); vbuf_flush(); } return (logfile != NULL); } else return TRUE; }
int MprToNet::writeRtp(int payloadType, UtlBoolean markerState, unsigned char* payloadData, int payloadOctets, unsigned int timestamp, void* csrcList) { struct rtpHeader* ph; int pad, l; int sendret; int len; ph = (struct rtpHeader*) (payloadData - sizeof(struct rtpHeader));//$$$ //$$$ Line above will need to adjust for CSRC list someday... len = payloadOctets; Lprintf("Enter rW: %d, %d\n", len, timestamp, 0,0,0,0); if (NULL == mpRtpSocket) {return 0;} mSeqNum++; #ifdef DEBUG /* [ */ if (NumberOfRtpWrites++ < 10) Zprintf("rW: %d, %d, %d\n", len, ts, h->mpt, 0,0,0); #endif /* DEBUG ] */ ph->vpxcc = 2<<6; // h->vpxcc; ph->mpt = (payloadType & 0x7f) | (markerState ? 0x80 : 0); ph->seq = htons(0xffff&mSeqNum); ph->timestamp = htonl(mTimestampDelta + timestamp); ph->ssrc = mSSRC; #ifdef ENABLE_PACKET_HACKING /* [ */ adjustRtpPacket(ph); #endif /* ENABLE_PACKET_HACKING ] */ pad = doPadRtp ? ((4 - (3 & len)) & 3) : 0; switch (pad) { case 3: payloadData[len+1] = 0; /* fall through */ case 2: payloadData[len] = 0; /* fall through */ case 1: payloadData[len+pad-1] = pad; ph->vpxcc |= (1<<5); Lprintf("writeRtp: adding %d pad bytes\n", pad, 0,0,0,0,0); /* fall through */ case 0: break; } #ifdef INCLUDE_RTCP /* [ */ // Update the Accumulated statistics kept for an inbound RTP packet. // These statistics comprise a Sender Report that is sent out periodically // to the originating site mpiRTPAccumulator->IncrementCounts(len); #endif /* INCLUDE_RTCP ] */ l = sizeof(struct rtpHeader) + len + pad; #ifdef DROP_SOME_PACKETS /* [ */ if (dropCount++ == dropLimit) { dropCount = 0; sendret = l; } else { sendret = mpRtpSocket->write((char *) ph, l); } #else /* DROP_SOME_PACKETS ] [*/ sendret = mpRtpSocket->write((char *) ph, l); #endif /* DROP_SOME_PACKETS ] */ if (l != sendret) { if (5 > mNumRtpWriteErrors++) { Zprintf("Exit rW: send(0x%p 0x%p %d) returned %d," " errno=%d (at %d)\n", mpRtpSocket, ph, l, sendret, errno, *pOsTC); } switch (errno) { /* insert other benign errno values here */ case 0: case 55: // Network disconnected, continue and hope it comes back break; default: // close(fd); MAYBE: mpRtpSocket->close() ? // mpRtpSocket = NULL; break; } } return (l == sendret) ? len : sendret; }