OSS on the Bay of Rum

Check-in [ad269d7cbc]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Replace removed timeout with callout functions
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ad269d7cbc02bf3867d1ed0fa8ba308174924ed0bb24daac81824fb8964a6dbc
User & Date: crees 2020-01-02 22:46:27
Context
2020-01-04
21:10
Put some mutexes in and move the inits check-in: 418af28deb user: crees tags: trunk
2020-01-02
22:46
Replace removed timeout with callout functions check-in: ad269d7cbc user: crees tags: trunk
22:41
Initial import check-in: ae2a86d1f1 user: crees tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to kernel/OS/FreeBSD/os_freebsd.c.

469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
typedef struct tmout_desc
{
  volatile int active;
  int timestamp;
  void (*func) (void *);
  void *arg;

  struct callout_handle timer;
} tmout_desc_t;

static volatile int next_id = 0;
#define MAX_TMOUTS 128

tmout_desc_t tmouts[MAX_TMOUTS] = { {0} };








|







469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
typedef struct tmout_desc
{
  volatile int active;
  int timestamp;
  void (*func) (void *);
  void *arg;

  struct callout timer;
} tmout_desc_t;

static volatile int next_id = 0;
#define MAX_TMOUTS 128

tmout_desc_t tmouts[MAX_TMOUTS] = { {0} };

531
532
533
534
535
536
537

538

539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
      return 0;
    }

  tmout->func = func;
  tmout->arg = arg;
  tmout->timestamp = id | (timeout_random & ~0xff);


  tmout->timer = timeout (oss_timer_callback, tmout, ticks);


  return id | (timeout_random & ~0xff);
}

void
oss_untimeout (timeout_id_t id)
{
  tmout_desc_t *tmout;
  int ix;

  ix = id & 0xff;
  if (ix < 0 || ix >= MAX_TMOUTS)
    return;

  timeout_random++;
  tmout = &tmouts[ix];

  if (tmout->timestamp != id)	/* Expired timer */
    return;
  if (tmout->active)
    untimeout (oss_timer_callback, tmout, tmout->timer);
  tmout->active = 0;
  tmout->timestamp = 0;
}

int
oss_get_procinfo (int what)
{







>
|
>




















|







531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
      return 0;
    }

  tmout->func = func;
  tmout->arg = arg;
  tmout->timestamp = id | (timeout_random & ~0xff);

                           /* Assume not MP safe */
  callout_init(&tmout->timer, 0);
  callout_reset(&tmout->timer, ticks, oss_timer_callback, tmout);

  return id | (timeout_random & ~0xff);
}

void
oss_untimeout (timeout_id_t id)
{
  tmout_desc_t *tmout;
  int ix;

  ix = id & 0xff;
  if (ix < 0 || ix >= MAX_TMOUTS)
    return;

  timeout_random++;
  tmout = &tmouts[ix];

  if (tmout->timestamp != id)	/* Expired timer */
    return;
  if (tmout->active)
    callout_stop(&tmout->timer);
  tmout->active = 0;
  tmout->timestamp = 0;
}

int
oss_get_procinfo (int what)
{