diff options
author | Mike Frysinger <vapier@gentoo.org> | 2007-02-09 22:14:34 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2007-02-09 22:14:34 +0000 |
commit | 87ad91cafbef5c328ed83c7c5bf56df6a15cadcf (patch) | |
tree | 7d41edb274c31a27cf4e908f9480e09d36b69307 | |
parent | 59b10970c522f8cee255a08b4faf93c8e3addd57 (diff) |
run through Lindent
-rw-r--r-- | librt/mq_close.c | 2 | ||||
-rw-r--r-- | librt/mq_getsetattr.c | 10 | ||||
-rw-r--r-- | librt/mq_notify.c | 14 | ||||
-rw-r--r-- | librt/mq_open.c | 34 | ||||
-rw-r--r-- | librt/mq_receive.c | 11 | ||||
-rw-r--r-- | librt/mq_send.c | 14 | ||||
-rw-r--r-- | librt/mq_unlink.c | 37 | ||||
-rw-r--r-- | librt/timer_create.c | 74 | ||||
-rw-r--r-- | librt/timer_delete.c | 18 | ||||
-rw-r--r-- | librt/timer_getoverr.c | 9 | ||||
-rw-r--r-- | librt/timer_gettime.c | 9 | ||||
-rw-r--r-- | librt/timer_settime.c | 10 |
12 files changed, 123 insertions, 119 deletions
diff --git a/librt/mq_close.c b/librt/mq_close.c index 055ad1fec..cf04044cc 100644 --- a/librt/mq_close.c +++ b/librt/mq_close.c @@ -16,7 +16,7 @@ */ int mq_close(mqd_t mqdes) { - return close(mqdes); + return close(mqdes); } #endif diff --git a/librt/mq_getsetattr.c b/librt/mq_getsetattr.c index 7d2594ea1..17c93a0b1 100644 --- a/librt/mq_getsetattr.c +++ b/librt/mq_getsetattr.c @@ -11,26 +11,26 @@ #ifdef __NR_mq_getsetattr librt_hidden_proto(mq_setattr) - #define __NR___syscall_mq_getsetattr __NR_mq_getsetattr static inline _syscall3(int, __syscall_mq_getsetattr, int, mqdes, - const void *, mqstat, void *, omqstat); + const void *, mqstat, void *, omqstat); /* * Set attributes associated with message queue (and possibly also get * its old attributes) */ int mq_setattr(mqd_t mqdes, const struct mq_attr *mqstat, - struct mq_attr *omqstat) + struct mq_attr *omqstat) { - return __syscall_mq_getsetattr(mqdes, mqstat, omqstat); + return __syscall_mq_getsetattr(mqdes, mqstat, omqstat); } + librt_hidden_def(mq_setattr) /* Query status and attributes of message queue */ int mq_getattr(mqd_t mqdes, struct mq_attr *mqstat) { - return mq_setattr(mqdes, NULL, mqstat); + return mq_setattr(mqdes, NULL, mqstat); } #endif diff --git a/librt/mq_notify.c b/librt/mq_notify.c index 4e7953242..3d58e1161 100644 --- a/librt/mq_notify.c +++ b/librt/mq_notify.c @@ -12,17 +12,17 @@ #define __NR___syscall_mq_notify __NR_mq_notify static inline _syscall2(int, __syscall_mq_notify, int, mqdes, - const void *, notification); + const void *, notification); /* Register notification upon message arrival to an empty message queue */ int mq_notify(mqd_t mqdes, const struct sigevent *notification) { - /* We don't support SIGEV_THREAD notification yet */ - if (notification != NULL && notification->sigev_notify == SIGEV_THREAD) { - __set_errno(ENOSYS); - return -1; - } - return __syscall_mq_notify(mqdes, notification); + /* We don't support SIGEV_THREAD notification yet */ + if (notification != NULL && notification->sigev_notify == SIGEV_THREAD) { + __set_errno(ENOSYS); + return -1; + } + return __syscall_mq_notify(mqdes, notification); } #endif diff --git a/librt/mq_open.c b/librt/mq_open.c index 3648b5aa7..e87220eb0 100644 --- a/librt/mq_open.c +++ b/librt/mq_open.c @@ -13,7 +13,7 @@ #define __NR___syscall_mq_open __NR_mq_open static inline _syscall4(int, __syscall_mq_open, const char *, name, - int, oflag, __kernel_mode_t, mode, void *, attr); + int, oflag, __kernel_mode_t, mode, void *, attr); /* * Establish connection between a process and a message queue and * return message queue descriptor or (mqd_t) -1 on error. @@ -25,28 +25,28 @@ static inline _syscall4(int, __syscall_mq_open, const char *, name, */ mqd_t mq_open(const char *name, int oflag, ...) { - mode_t mode; - struct mq_attr *attr; + mode_t mode; + struct mq_attr *attr; - if (name[0] != '/') { - __set_errno(EINVAL); - return -1; - } + if (name[0] != '/') { + __set_errno(EINVAL); + return -1; + } - mode = 0; - attr = NULL; + mode = 0; + attr = NULL; - if (oflag & O_CREAT) { - va_list ap; + if (oflag & O_CREAT) { + va_list ap; - va_start(ap, oflag); - mode = va_arg(ap, mode_t); - attr = va_arg(ap, struct mq_attr *); + va_start(ap, oflag); + mode = va_arg(ap, mode_t); + attr = va_arg(ap, struct mq_attr *); - va_end(ap); - } + va_end(ap); + } - return __syscall_mq_open(name + 1, oflag, mode, attr); + return __syscall_mq_open(name + 1, oflag, mode, attr); } #endif diff --git a/librt/mq_receive.c b/librt/mq_receive.c index c75d9ecb7..fa48426b9 100644 --- a/librt/mq_receive.c +++ b/librt/mq_receive.c @@ -8,12 +8,11 @@ #include <mqueue.h> librt_hidden_proto(mq_timedreceive) - #ifdef __NR_mq_timedreceive #define __NR___syscall_mq_timedreceive __NR_mq_timedreceive static inline _syscall5(int, __syscall_mq_timedreceive, int, mqdes, - char *, msg_ptr, size_t, msg_len, unsigned int *, msg_prio, - const void *, abs_timeout); + char *, msg_ptr, size_t, msg_len, unsigned int *, + msg_prio, const void *, abs_timeout); #endif /* @@ -25,17 +24,19 @@ ssize_t mq_timedreceive(mqd_t mqdes, char *msg_ptr, size_t msg_len, const struct timespec *abs_timeout) { #ifdef __NR_mq_timedreceive - return __syscall_mq_timedreceive(mqdes, msg_ptr, msg_len, msg_prio, abs_timeout); + return __syscall_mq_timedreceive(mqdes, msg_ptr, msg_len, msg_prio, + abs_timeout); #else errno = ENOSYS; return -1; #endif } + librt_hidden_def(mq_timedreceive) /* Receive the oldest from highest priority messages */ ssize_t mq_receive(mqd_t mqdes, char *msg_ptr, size_t msg_len, - unsigned int *msg_prio) + unsigned int *msg_prio) { return mq_timedreceive(mqdes, msg_ptr, msg_len, msg_prio, NULL); } diff --git a/librt/mq_send.c b/librt/mq_send.c index 1dd7db62b..ee2af4454 100644 --- a/librt/mq_send.c +++ b/librt/mq_send.c @@ -8,12 +8,11 @@ #include <mqueue.h> librt_hidden_proto(mq_timedsend) - #ifdef __NR_mq_timedsend #define __NR___syscall_mq_timedsend __NR_mq_timedsend static inline _syscall5(int, __syscall_mq_timedsend, int, mqdes, - const char *, msg_ptr, size_t, msg_len, unsigned int, msg_prio, - const void *, abs_timeout); + const char *, msg_ptr, size_t, msg_len, unsigned int, + msg_prio, const void *, abs_timeout); #endif /* @@ -21,21 +20,22 @@ static inline _syscall5(int, __syscall_mq_timedsend, int, mqdes, * for sufficient room in the queue until abs_timeout expires. */ int mq_timedsend(mqd_t mqdes, const char *msg_ptr, size_t msg_len, - unsigned int msg_prio, - const struct timespec *abs_timeout) + unsigned int msg_prio, const struct timespec *abs_timeout) { #ifdef __NR_mq_timedsend - return __syscall_mq_timedsend(mqdes, msg_ptr, msg_len, msg_prio, abs_timeout); + return __syscall_mq_timedsend(mqdes, msg_ptr, msg_len, msg_prio, + abs_timeout); #else errno = ENOSYS; return -1; #endif } + librt_hidden_def(mq_timedsend) /* Add a message to queue */ int mq_send(mqd_t mqdes, const char *msg_ptr, size_t msg_len, - unsigned int msg_prio) + unsigned int msg_prio) { return mq_timedsend(mqdes, msg_ptr, msg_len, msg_prio, NULL); } diff --git a/librt/mq_unlink.c b/librt/mq_unlink.c index aee3478e7..8e89610a3 100644 --- a/librt/mq_unlink.c +++ b/librt/mq_unlink.c @@ -15,24 +15,25 @@ static inline _syscall1(int, __syscall_mq_unlink, const char *, name); /* Remove message queue */ int mq_unlink(const char *name) { - int ret; - if (name[0] != '/') { - __set_errno(EINVAL); - return -1; - } - - ret = __syscall_mq_unlink(name + 1); - - /* While unlink can return either EPERM or EACCES, mq_unlink should return just EACCES. */ - if (ret < 0) { - ret = errno; - if (ret == EPERM) - ret = EACCES; - __set_errno(ret); - ret = -1; - } - - return ret; + int ret; + + if (name[0] != '/') { + __set_errno(EINVAL); + return -1; + } + + ret = __syscall_mq_unlink(name + 1); + + /* While unlink can return either EPERM or EACCES, mq_unlink should return just EACCES. */ + if (ret < 0) { + ret = errno; + if (ret == EPERM) + ret = EACCES; + __set_errno(ret); + ret = -1; + } + + return ret; } #endif diff --git a/librt/timer_create.c b/librt/timer_create.c index cbd7bb615..7e77c0624 100644 --- a/librt/timer_create.c +++ b/librt/timer_create.c @@ -19,54 +19,54 @@ #define __NR___syscall_timer_create __NR_timer_create static inline _syscall3(int, __syscall_timer_create, clockid_t, clock_id, - struct sigevent *, evp, kernel_timer_t *, ktimerid); + struct sigevent *, evp, kernel_timer_t *, ktimerid); /* Create a per-process timer */ -int timer_create(clockid_t clock_id, struct sigevent *evp, timer_t *timerid) +int timer_create(clockid_t clock_id, struct sigevent *evp, timer_t * timerid) { - int retval; - kernel_timer_t ktimerid; - struct sigevent local_evp; - struct timer *newp; + int retval; + kernel_timer_t ktimerid; + struct sigevent local_evp; + struct timer *newp; - /* Notification via a thread is not supported yet */ - if (__builtin_expect(evp->sigev_notify == SIGEV_THREAD, 1)) - return -1; + /* Notification via a thread is not supported yet */ + if (__builtin_expect(evp->sigev_notify == SIGEV_THREAD, 1)) + return -1; - /* - * We avoid allocating too much memory by basically using - * struct timer as a derived class with the first two elements - * being in the superclass. We only need these two elements here. - */ - newp = (struct timer *) malloc(offsetof(struct timer, thrfunc)); - if (newp == NULL) - return -1; /* No memory */ - - if (evp == NULL) { /* - * The kernel has to pass up the timer ID which is a userlevel object. - * Therefore we cannot leave it up to the kernel to determine it. + * We avoid allocating too much memory by basically using + * struct timer as a derived class with the first two elements + * being in the superclass. We only need these two elements here. */ - local_evp.sigev_notify = SIGEV_SIGNAL; - local_evp.sigev_signo = SIGALRM; - local_evp.sigev_value.sival_ptr = newp; + newp = (struct timer *)malloc(offsetof(struct timer, thrfunc)); + if (newp == NULL) + return -1; /* No memory */ + + if (evp == NULL) { + /* + * The kernel has to pass up the timer ID which is a userlevel object. + * Therefore we cannot leave it up to the kernel to determine it. + */ + local_evp.sigev_notify = SIGEV_SIGNAL; + local_evp.sigev_signo = SIGALRM; + local_evp.sigev_value.sival_ptr = newp; - evp = &local_evp; - } + evp = &local_evp; + } - retval = __syscall_timer_create(clock_id, evp, &ktimerid); - if (retval != -1) { - newp->sigev_notify = (evp != NULL ? evp->sigev_notify : SIGEV_SIGNAL); - newp->ktimerid = ktimerid; + retval = __syscall_timer_create(clock_id, evp, &ktimerid); + if (retval != -1) { + newp->sigev_notify = (evp != NULL ? evp->sigev_notify : SIGEV_SIGNAL); + newp->ktimerid = ktimerid; - *timerid = (timer_t) newp; - } else { - /* Cannot allocate the timer, fail */ - free(newp); - retval = -1; - } + *timerid = (timer_t) newp; + } else { + /* Cannot allocate the timer, fail */ + free(newp); + retval = -1; + } - return retval; + return retval; } #endif diff --git a/librt/timer_delete.c b/librt/timer_delete.c index a85a51d9f..cc749df6b 100644 --- a/librt/timer_delete.c +++ b/librt/timer_delete.c @@ -17,17 +17,17 @@ static inline _syscall1(int, __syscall_timer_delete, kernel_timer_t, ktimerid); /* Delete a per-process timer */ int timer_delete(timer_t timerid) { - int res; - struct timer *kt = (struct timer *) timerid; + int res; + struct timer *kt = (struct timer *)timerid; - /* Delete the kernel timer object */ - res = __syscall_timer_delete(kt->ktimerid); - if (res == 0) { - free(kt); /* Free the memory */ - return 0; - } + /* Delete the kernel timer object */ + res = __syscall_timer_delete(kt->ktimerid); + if (res == 0) { + free(kt); /* Free the memory */ + return 0; + } - return -1; + return -1; } #endif diff --git a/librt/timer_getoverr.c b/librt/timer_getoverr.c index 7bc483d0f..71006eecd 100644 --- a/librt/timer_getoverr.c +++ b/librt/timer_getoverr.c @@ -11,15 +11,16 @@ #ifdef __NR_timer_getoverrun #define __NR___syscall_timer_getoverrun __NR_timer_getoverrun -static inline _syscall1(int, __syscall_timer_getoverrun, kernel_timer_t, ktimerid); +static inline _syscall1(int, __syscall_timer_getoverrun, kernel_timer_t, + ktimerid); /* Get the timer overrun count */ int timer_getoverrun(timer_t timerid) { - struct timer *kt = (struct timer *) timerid; + struct timer *kt = (struct timer *)timerid; - /* Get the information from the kernel */ - return __syscall_timer_getoverrun(kt->ktimerid); + /* Get the information from the kernel */ + return __syscall_timer_getoverrun(kt->ktimerid); } #endif diff --git a/librt/timer_gettime.c b/librt/timer_gettime.c index 32e35eb05..e8d6d2676 100644 --- a/librt/timer_gettime.c +++ b/librt/timer_gettime.c @@ -12,15 +12,16 @@ #ifdef __NR_timer_gettime #define __NR___syscall_timer_gettime __NR_timer_gettime -static inline _syscall2(int, __syscall_timer_gettime, kernel_timer_t, ktimerid, void *, value); +static inline _syscall2(int, __syscall_timer_gettime, kernel_timer_t, ktimerid, + void *, value); /* Get the amount of time left on a timer */ int timer_gettime(timer_t timerid, struct itimerspec *value) { - struct timer *kt = (struct timer *) timerid; + struct timer *kt = (struct timer *)timerid; - /* Get timeout from the kernel */ - return __syscall_timer_gettime(kt->ktimerid, value); + /* Get timeout from the kernel */ + return __syscall_timer_gettime(kt->ktimerid, value); } #endif diff --git a/librt/timer_settime.c b/librt/timer_settime.c index 1a042283c..05c4d1aef 100644 --- a/librt/timer_settime.c +++ b/librt/timer_settime.c @@ -13,16 +13,16 @@ #define __NR___syscall_timer_settime __NR_timer_settime static inline _syscall4(int, __syscall_timer_settime, kernel_timer_t, ktimerid, - int, flags, const void *, value, void *, ovalue); + int, flags, const void *, value, void *, ovalue); /* Set the expiration time for a timer */ int timer_settime(timer_t timerid, int flags, const struct itimerspec *value, - struct itimerspec *ovalue) + struct itimerspec *ovalue) { - struct timer *kt = (struct timer *) timerid; + struct timer *kt = (struct timer *)timerid; - /* Set timeout */ - return __syscall_timer_settime(kt->ktimerid, flags, value, ovalue); + /* Set timeout */ + return __syscall_timer_settime(kt->ktimerid, flags, value, ovalue); } #endif |