Bug in Semget system call

44 views
Skip to first unread message

karamsetty vishnu

unread,
Oct 20, 2025, 3:46:59 AMOct 20
to XOS Users
Hi Team,
SemGet syscall .png

In the above implementation of the semget system call, we initialize the Resource Identifier field of the per-process resource table entry to 1 before acquiring a semaphore.

This causes an issue where, if no semaphores are available, the function returns -2, but the resource identifier remains set to 1. As a result, the process ends up holding an unused and inconsistent resource identifier.

Proposed Solution:
Move the initialization of the Resource Identifier field to after successfully acquiring a semaphore.

This change ensures that the resource identifier is assigned only when a semaphore has been successfully allocated, maintaining consistency in the resource table.

Best regards,
K. Vishnu Vardhan

Reply all
Reply to author
Forward
0 new messages