[LIBS] Add generic last-in-first-out queue APIs

Signed-off-by: Anup Patel <anup@brainfault.org>