Commit Graph

279 Commits

Author SHA1 Message Date
Michael Kerrisk 2e139a8bd8 For 2.04 release 2005-06-21 14:56:41 +00:00
Michael Kerrisk 19ce063feb Getting ready for 2.04 release 2005-06-21 14:47:55 +00:00
Michael Kerrisk ccca85bec2 Further tcp_stdurg and SIOCATMARK work; minor formatting fixes 2005-06-21 14:46:08 +00:00
Michael Kerrisk 3df839779c Minor formatting fixes 2005-06-21 14:45:03 +00:00
Michael Kerrisk 7747fbdca6 Fixed descriptotion of header file reqmts in prototype, 2005-06-21 14:44:34 +00:00
Michael Kerrisk d04e1109b9 Clarified semantics of relationship between flock() locks
and open file entries and file descriptors.
See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=291121
2005-06-21 14:43:56 +00:00
Michael Kerrisk fb654466a6 Minor changes 2005-06-21 13:50:30 +00:00
Michael Kerrisk f10e41020d Fix description of return value. 2005-06-21 13:47:59 +00:00
Michael Kerrisk 9331995aab Add log1p(3) to SEE ALSO.
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=309578
2005-06-21 13:00:02 +00:00
Michael Kerrisk 961abb97af Fix typo: "_SC_2_DEV" should be "_SC_2_C_DEV" 2005-06-21 11:30:37 +00:00
Michael Kerrisk 3678235c1f When specifying resolved_path as NULL, realpath()
will (still) only allocate up to PATH_MAX bytes.
Plus other minor changes.
See also http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=239424
2005-06-21 11:20:42 +00:00
Michael Kerrisk 1f6ceb400b O_DIRECT needs _GNU_SOURCE.
O_ASYNC works for pipes and FIFOs in Linux 2.6
Vaious minor fixes
2005-06-21 10:04:56 +00:00
Michael Kerrisk 6e657687f9 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=194842
Because RAND_MAX is equal to INT_MAX, the following expression
contained in the manpage for rand(3) is slightly incorrect.
j=1+(int) (10.0*rand()/(RAND_MAX+1.0));

The correct expression should use parentheses to group the division
before the multiplication, thus yielding:
j=1+(int) (10.0*(rand()/(RAND_MAX+1.0)));

This is not an error where 10.0 is a floating point number, however
where 10.0 is replaced with an integer, this will cause the expression
to always evaluate to 1. (The addition of two parentheses would make
this bug a lot more difficult to make.)
2005-06-21 09:22:02 +00:00
Michael Kerrisk 3876c0e522 See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=118752 2005-06-21 08:55:14 +00:00
Michael Kerrisk c9d79ca817 Minor formatting change 2005-06-21 08:32:40 +00:00
Michael Kerrisk b5aed92e0d Minor changes 2005-06-21 08:30:41 +00:00
Michael Kerrisk 6f80235904 More tcp_stdurg and SIOCATMARK work 2005-06-20 14:45:09 +00:00
Michael Kerrisk dd61d68cc4 Since Linux 2.6, the ru_nvcsw and ru_nivcsw fields are used. 2005-06-20 08:58:09 +00:00
Michael Kerrisk 1b05fb00b3 Changed (char *) to (void *) in example.
See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=313607
2005-06-17 13:34:00 +00:00
Michael Kerrisk 475f1bca2c Arg for %p is a pointer to _a pointer to_ void.
As per http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=263109
2005-06-17 13:06:58 +00:00
Michael Kerrisk 019934ed21 BUGS: In kernels < 2.6.9, EPOLL_CTL_DEL required a non-NULL
'event', even though this argument is ignored.
As per http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=306517.
2005-06-17 11:33:07 +00:00
Michael Kerrisk 6a4c2e3618 freopen(3) can change file descriptor associations of stin/stdout/stderr 2005-06-16 16:10:05 +00:00
Michael Kerrisk b99cf1e0e8 strerror_r(3) requires #define _XOPEN_SOURCE 600 2005-06-16 16:09:25 +00:00
Michael Kerrisk 2a01941630 Rewrote description of return value.
As per http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=296183
2005-06-16 15:07:57 +00:00
Michael Kerrisk 4f90a5f34e Removed erroneous description of makecontext() return value.
As per http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=311800
2005-06-16 14:37:57 +00:00
Michael Kerrisk adb036712f removed fixed FIXMEs 2005-06-16 10:35:03 +00:00
Michael Kerrisk 4a3f7c5fbc formatting 2005-06-16 10:32:30 +00:00
Michael Kerrisk 95d29ab2c8 More SIOCATMARK cahnges. 2005-06-16 10:23:59 +00:00
Michael Kerrisk 8729177b44 global edit s/ -1/ \\-1/g 2005-06-15 14:10:23 +00:00
Michael Kerrisk f59a3f1941 Global edit: s/nonzero/non-zero/ 2005-06-15 13:32:34 +00:00
Michael Kerrisk 7ecc26f664 Various wording and foratting fixes 2005-06-15 13:26:36 +00:00
Michael Kerrisk 5c45d5f543 Various wording and formatting fixes.
Incorporated some new /proc/sys/net/ipv4/tcp_* file descriptions
from the 2.6.12 source file Documentation/networking/ip-sysctl.txt.
2005-06-15 12:56:21 +00:00
Michael Kerrisk 81c6dd6c54 Added pointer to ip(7) and proc(7) for /proc/sys/net 2005-06-15 12:07:30 +00:00
Michael Kerrisk 2e0eee5451 RLIMIT_RSS only has affect "in 2.4.x", not "in 2.4 and later". 2005-06-15 11:35:49 +00:00
Michael Kerrisk 096a9c0199 Added FIXME for mqueue files 2005-06-15 08:30:11 +00:00
Michael Kerrisk fd1835be9c Fixes in discussion of SIOCATMARK + general wording and formatting
clean-ups.
2005-06-14 15:24:55 +00:00
Michael Kerrisk 54221c6a41 Various minor changes 2005-06-14 11:25:12 +00:00
Michael Kerrisk 027df6e02d Wording improvements 2005-06-14 11:22:23 +00:00
Michael Kerrisk 5af3e8eeee Wording improvements 2005-06-14 11:22:06 +00:00
Michael Kerrisk 7b57506d6d Various minor changes 2005-06-14 11:20:57 +00:00
Michael Kerrisk fd064f40a4 Small wording fix. 2005-06-13 09:51:27 +00:00
Michael Kerrisk c13fcab060 Salut Olivier (and Nishanth),
Regarding man page documentation of the problem of short sleeps 
for setiteimer(2)...

> > -- pointers to those threads
> 
> http://bugzilla.kernel.org/show_bug.cgi?id=4569
> http://lkml.org/lkml/2005/4/29/163
> 
> > -- indications of which kernel versions show this bahaviour
> 
> AFAIK, all versions as far as x86 is concerned.
> Dunno if it is hardware specific.
> 
> > -- a (short) test program to demonstrate it, if you have one.
> 
> See the bugzilla bug's attachments

Sorry for the long delay in following this up, but I've got to 
it now.  I tweaked your suggestions slightly:

{{
Timers will never expire before the requested time,
-instead expiring some short, constant time afterwards, dependent
-on the system timer resolution (currently 10ms).  
+but may expire some (short) time afterwards, which depends
+on the system timer resolution and on the system load.
+Upon expiration, a signal will be generated and the timer reset.
+If the timer expires while the process is active (always true for

+On certain systems (including x86), the Linux kernel has a bug which will
+produce premature timer expirations of up to one jiffy under some
+circumstances.
}}

Thanks for this bug reporet,

Nishanth: if and when your changes are accepted, and the problem 
is thus fixed, could you please send me a notification of that
fact, and I can then further amend the manual pages.

Cheers,

Michael



/* itimer_short_interval_bug.c 

   June 2005

   In current Linux kernels, an interval timer set using setitimer() 
   can sometimes sleep *less* than the specified interval.
   This program demonstrates the behaviour by looping through all
   itimer values from 1 microsecond upwards, in one microsecond steps.
*/
/* Adapted from a program by Olivier Croquette, June 2005 */

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/wait.h>



typedef unsigned long long int u_time_t; /* in microsecs */

static int handler_flag;

/* return time as a number of microsecs  */

static u_time_t 
gettime(void ) 
{
    struct timeval tv;

    if ( gettimeofday(&tv, NULL) == -1) {
        perror("gettimeofday()");
        return 0;
    }
    return (tv.tv_usec + tv.tv_sec * 1000000LL);
}


static void 
handler (int sig, siginfo_t *siginfo, void *context) 
{
    handler_flag++;
    return ;
}


/* Sleep for 'time' microsecs. */
static int 
isleep(u_time_t time) 
{
    struct itimerval  newtv;
    sigset_t sigset;
    struct sigaction  sigact;

    if (time == 0)
        return 0;

    /* block SIGALRM */
    sigemptyset (&sigset);
    sigaddset (&sigset, SIGALRM);
    sigprocmask (SIG_BLOCK, &sigset, NULL);

    /* set up our handler */
    sigact.sa_sigaction  = handler;
    sigemptyset(&sigact.sa_mask);
    sigact.sa_flags = SA_SIGINFO;
    sigaction (SIGALRM, &sigact, NULL);
 
    newtv.it_interval.tv_sec  = 0;
    newtv.it_interval.tv_usec = 0;
    newtv.it_value.tv_sec     = time / 1000000;
    newtv.it_value.tv_usec    = time % 1000000;
    if (setitimer(ITIMER_REAL,&newtv,NULL) == -1) {
        perror("setitimer(set)");
        return 1;
    }

    sigemptyset (&sigset);
    sigsuspend (&sigset);
    return 0;
}


int 
main(int argc, char *argv[]) {
    u_time_t wait;
    int loop, numLoops;
    u_time_t t1, t2;
    u_time_t actual;
    long long minDiff, maxDiff, totDiff, diff;
    int numFail = 0;

    if (argc != 2) {
	fprintf(stderr, "Usage: %s num-loops\n", argv[0]);
	exit(EXIT_FAILURE);
    } /* if */

    numLoops = atoi(argv[1]);
    setbuf(stdout, NULL);

    for (wait = 1; ; wait++) {
	maxDiff = 0;
	numFail = 0;
	totDiff = 0;
	minDiff = -wait;

        if (wait % 10000 == 0)
	    printf("%llu\n", wait);
        
	for (loop = 0; loop < numLoops; loop++) {
            t1 = gettime();

            handler_flag = 0;
            isleep(wait);
	    
	    if ( handler_flag != 1 ) 
                printf("Problem with the handler flag (%d)!\n", handler_flag);
    
            t2 = gettime();
            actual = t2 - t1;
            if ( actual < wait ) {
	        diff = actual - wait;
		if (diff < maxDiff)
		    maxDiff = diff;
		if (diff > minDiff)
		    minDiff = diff;
		totDiff += diff;
		numFail++;
	    } /* if */

        } /* for */
	if (numFail > 0) 
            printf("%llu: %3d fail (%4lld %4lld; avg=%6.1f)\n", 
		    wait, numFail, minDiff, maxDiff, 
		    (double) totDiff / numFail);
    } /* for */

    return 0;
} /* main */
2005-06-13 09:01:49 +00:00
Michael Kerrisk 561aa928db Remove duplicated CLONE_VFORK text 2005-06-13 06:09:43 +00:00
Michael Kerrisk 6e2d1c54dd Formatting fix 2005-06-09 07:12:30 +00:00
Michael Kerrisk deea4228eb Updates 2005-06-08 13:27:32 +00:00
Michael Kerrisk 23a6e651f3 Fix discussion of alternate signals stack 2005-06-08 13:27:21 +00:00
Michael Kerrisk 3616b7c0cf New pthreads.7 page 2005-06-07 12:35:32 +00:00
Michael Kerrisk 1b88e9c222 Minor fix 2005-06-07 06:51:12 +00:00
Michael Kerrisk ad4fa95926 Formatting fix 2005-06-03 11:14:19 +00:00
Michael Kerrisk 9a7957be33 Initial set-up for 2.04 release 2005-06-02 13:28:50 +00:00