off_t offset;
};
-static hash_table *hash = NULL;
+static hash_table *hash = nullptr;
static pid_t mypid;
static char *shmbuf;
static int DebugLevel = 0;
file_state *fs;
fs = (file_state *) hash_lookup(hash, &r->id);
- if (NULL == fs) {
+ if (nullptr == fs) {
errno = EBADF;
DEBUG(1) {
fprintf(stderr, "%d CLOSE id %d: ", (int) mypid, r->id);
file_state *fs;
fs = (file_state *) hash_lookup(hash, &r->id);
- if (NULL == fs) {
+ if (nullptr == fs) {
errno = EBADF;
DEBUG(1) {
fprintf(stderr, "%d READ id %d: ", (int) mypid, r->id);
file_state *fs;
fs = (file_state *) hash_lookup(hash, &r->id);
- if (NULL == fs) {
+ if (nullptr == fs) {
errno = EBADF;
DEBUG(1) {
fprintf(stderr, "%d WRITE id %d: ", (int) mypid, r->id);
static void
msg_handle(diomsg * r, int rl, diomsg * s)
{
- char *buf = NULL;
+ char *buf = nullptr;
s->mtype = r->mtype;
s->id = r->id;
s->seq_no = r->seq_no; /* optional, debugging */
char rbuf[512];
struct sigaction sa;
- setbuf(stdout, NULL);
- setbuf(stderr, NULL);
+ setbuf(stdout, nullptr);
+ setbuf(stderr, nullptr);
mypid = getpid();
assert(4 == argc);
key = atoi(argv[1]);
exit(EXIT_FAILURE);
}
- shmbuf = (char *)shmat(shmid, NULL, 0);
+ shmbuf = (char *)shmat(shmid, nullptr, 0);
if (shmbuf == (void *) -1) {
perror("shmat");
memset(&sa, '\0', sizeof(sa));
sa.sa_handler = alarm_handler;
sa.sa_flags = SA_RESTART;
- sigaction(SIGALRM, &sa, NULL);
+ sigaction(SIGALRM, &sa, nullptr);
for (;;) {
alarm(1);
fprintf(stderr, "%d diskd exiting\n", (int) mypid);
}
- if (msgctl(rmsgid, IPC_RMID, 0) < 0)
+ if (msgctl(rmsgid, IPC_RMID, nullptr) < 0)
perror("msgctl IPC_RMID");
- if (msgctl(smsgid, IPC_RMID, 0) < 0)
+ if (msgctl(smsgid, IPC_RMID, nullptr) < 0)
perror("msgctl IPC_RMID");
if (shmdt(shmbuf) < 0)
perror("shmdt");
- if (shmctl(shmid, IPC_RMID, 0) < 0)
+ if (shmctl(shmid, IPC_RMID, nullptr) < 0)
perror("shmctl IPC_RMID");
return EXIT_SUCCESS;