Rev 37 | Rev 103 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 37 | Rev 39 | ||
---|---|---|---|
Line 544... | Line 544... | ||
544 | }
|
544 | }
|
545 | 545 | ||
546 | IN_WRITE_END |
546 | IN_WRITE_END |
547 | }
|
547 | }
|
548 | 548 | ||
- | 549 | void Inotify::SetCloseOnExec(bool fClOnEx) throw (InotifyException) |
|
- | 550 | {
|
|
- | 551 | IN_WRITE_BEGIN |
|
- | 552 | ||
- | 553 | if (m_fd == -1) { |
|
- | 554 | IN_WRITE_END_NOTHROW |
|
- | 555 | throw InotifyException(IN_EXC_MSG("invalid file descriptor"), EBUSY, this); |
|
- | 556 | }
|
|
- | 557 | ||
- | 558 | int res = fcntl(m_fd, F_GETFD); |
|
- | 559 | if (res == -1) { |
|
- | 560 | IN_WRITE_END_NOTHROW |
|
- | 561 | throw InotifyException(IN_EXC_MSG("cannot get inotify flags"), errno, this); |
|
- | 562 | }
|
|
- | 563 | ||
- | 564 | if (fClOnEx) { |
|
- | 565 | res |= FD_CLOEXEC; |
|
- | 566 | }
|
|
- | 567 | else { |
|
- | 568 | res &= ~FD_CLOEXEC; |
|
- | 569 | }
|
|
- | 570 | ||
- | 571 | if (fcntl(m_fd, F_SETFD, res) == -1) { |
|
- | 572 | IN_WRITE_END_NOTHROW |
|
- | 573 | throw InotifyException(IN_EXC_MSG("cannot set inotify flags"), errno, this); |
|
- | 574 | }
|
|
- | 575 | ||
- | 576 | IN_WRITE_END |
|
- | 577 | }
|
|
- | 578 | ||
549 | uint32_t Inotify::GetCapability(InotifyCapability_t cap) throw (InotifyException) |
579 | uint32_t Inotify::GetCapability(InotifyCapability_t cap) throw (InotifyException) |
550 | {
|
580 | {
|
551 | FILE* f = fopen(GetCapabilityPath(cap).c_str(), "r"); |
581 | FILE* f = fopen(GetCapabilityPath(cap).c_str(), "r"); |
552 | if (f == NULL) |
582 | if (f == NULL) |
553 | throw InotifyException(IN_EXC_MSG("cannot get capability"), errno, NULL); |
583 | throw InotifyException(IN_EXC_MSG("cannot get capability"), errno, NULL); |