Isn't there a function like sem_wait in System V Semaphore?
Yes, there is... but it happens when you decrement a semaphore under 0. Sys V semaphores are a variant of Dijkstra semaphores in which you can order a set of operations to be made in order on a set of semaphores atomically, so you will wait if any of them blocks on the operations you requested. As you will probably know, a semaphore waits(blocks) when you decrement it's valuee below 0, and only when it goes above again it allows blocked processes to pass. In SysV you order increments or decrements to the individual semaphores (in case you are handling only one, and decrement only by one, the operation will be equivalent to a P() Dijkstra's call, while if you do it by N, the operation will be equal to N calls to P() in sequence (and atomically, as warranted by Unix kernel) the increment operations are equivalent to V() Dijkstra's calls, and are also done in an atomic way. The kernel also maintains the net amount a process has done to a semaphore, in order to undo all the operations done by this process to the semaphores, in case this process dies.
I expect this has answered your question.