Skip to content

Commit

Permalink
hdr: remove redundant items from sys/time.h and sys/select.h
Browse files Browse the repository at this point in the history
change implementation comments from public to private
  • Loading branch information
jmalak committed Apr 25, 2024
1 parent df905c5 commit b7587ec
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 24 deletions.
11 changes: 5 additions & 6 deletions bld/hdr/fdset.sp
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,17 @@ typedef struct {
fd_mask fds_bits[FD_SETSIZE / __NFDBITS];
} fd_set;

/* We don't use `memset' because this would require a prototype and
* the array isn't too big.
*/
:: We don't use `memset' because this would require a prototype and
:: the array isn't too big.
#define FD_ZERO(__set) \
do { \
unsigned int __i; \
fd_set *__arr = (__set); \
for(__i = 0; __i < sizeof(fd_set) / sizeof(fd_mask); ++__i) \
__FDS_BITS(__arr)[__i] = 0; \
} while( 0 )
#define FD_SET(__d,__set) (__FDS_BITS(__set)[__FDELT (__d)] |= __FDMASK(__d))
#define FD_CLR(__d,__set) (__FDS_BITS(__set)[__FDELT (__d)] &= ~__FDMASK(__d))
#define FD_ISSET(__d,__set) (__FDS_BITS(__set)[__FDELT (__d)] & __FDMASK(__d))
#define FD_SET(__d,__set) (__FDS_BITS(__set)[__FDELT(__d)] |= __FDMASK(__d))
#define FD_CLR(__d,__set) (__FDS_BITS(__set)[__FDELT(__d)] &= ~__FDMASK(__d))
#define FD_ISSET(__d,__set) (__FDS_BITS(__set)[__FDELT(__d)] & __FDMASK(__d))

#endif /* !_FDSET_DEFINED */
3 changes: 3 additions & 0 deletions bld/hdr/watcom/deps.mif
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ h/sys/stat.h : $(mh_dir)/sys/stat.mh $(sys_stat_deps)
!else ifeq system rdos

h/sys/wait.h : $(mh_dir)/sys/wait.mh $(owhdr) $(cplus) ../wait.sp
h/sys/select.h : $(mh_dir)/sys/select.mh $(sys_select_deps)
h/sys/time.h : $(mh_dir)/sys/time.mh $(sys_time_deps)

!else ifeq system linux

Expand Down Expand Up @@ -417,6 +419,7 @@ h/sys/qnxterm.h : $(qnx_mh_dir)/sys/qnxterm.mh $(packll)
h/sys/qnx_glob.h : $(qnx_mh_dir)/sys/qnx_glob.mh $(packll)
h/sys/sched.h : $(qnx_mh_dir)/sys/sched.mh $(packll)
h/sys/seginfo.h : $(qnx_mh_dir)/sys/seginfo.mh $(packll)
#h/sys/select.h : $(qnx_mh_dir)/sys/select.mh $(packll)
h/sys/sendmx.h : $(qnx_mh_dir)/sys/sendmx.mh $(packll)
h/sys/ser_msg.h : $(qnx_mh_dir)/sys/ser_msg.mh $(packll)
h/sys/sidinfo.h : $(qnx_mh_dir)/sys/sidinfo.mh $(packll)
Expand Down
19 changes: 3 additions & 16 deletions bld/hdr/watcom/sys/select.mh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* sys/select.h POSIX [p]select functions with related defines & macros
* sys/select.h POSIX - select types
*
:include crwatcnt.sp
*/
Expand All @@ -12,32 +12,19 @@

:include cpluspro.sp

:segment LINUX | RDOS
:segment LINUX
:include lnxkpack.sp
:elsesegment
:include pshpackl.sp
:endsegment

:: Posix requires, that this belongs to sys/select.h and sys/time.h
:: OpenWatcom had it previously only in sys/time.h

:: it is shared by sys/select.h and sys/time.h
:include fdset.sp

:elsesegment
:include pshpackl.sp

:endsegment

:segment LINUX
:include time_t.sp
:endsegment

:include timeval.sp

:segment LINUX | RDOS
:: it is shared by sys/select.h and sys/time.h
:include select.sp
:endsegment

:include poppack.sp

Expand Down
7 changes: 5 additions & 2 deletions bld/hdr/watcom/sys/time.mh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ struct timezone {
#define DST_TUR 9 /* Turkey */
#define DST_AUSTALT 10 /* Australian style with shift in 1986 */

:: implemented only for Linux
:segment LINUX
/*
* Structure used by getitimer() and setitimer() system calls.
*/
Expand All @@ -59,13 +61,14 @@ struct itimerval {
#define ITIMER_VIRTUAL 1 /* Timers run only when the process is executing. */
#define ITIMER_PROF 2 /* Process or kernel on its behalf is executing. */

_WCRTLINK extern int getitimer( int __which, struct itimerval *__value );
_WCRTLINK extern int setitimer( int __which, const struct itimerval *__value, struct itimerval *__ovalue );
:endsegment
:segment LINUX | RDOS
:include select.sp
:endsegment
_WCRTLINK extern int gettimeofday( struct timeval *__tv, struct timezone *__tz );
_WCRTLINK extern int settimeofday( const struct timeval *__tv, const struct timezone *__tz );
_WCRTLINK extern int getitimer( int __which, struct itimerval *__value );
_WCRTLINK extern int setitimer( int __which, const struct itimerval *__value, struct itimerval *__ovalue );
::_WCRTLINK extern int adjtime( struct timeval *__itv, struct timeval *__otv );
::_WCRTLINK extern int utimes( char *__path, struct timeval *__tvp );

Expand Down

0 comments on commit b7587ec

Please sign in to comment.