Re: [PATCH 1/2] allow honouring libc provided SIGRTMIN/SIGRTMAX
On 2018-10-31 11:13, Denys Vlasenko wrote: > Applied, thanks! Thanks, but the commit message was mangled somehow, so now it just reads In any case, this is rather unfortunate: 36 34 I.e. the lines beginning with # were stripped, making it rather confusing. You may want to look into setting commit.cleanup=scissors or whitespace to avoid that kind of thing to happen again. Rasmus ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: [PATCH 1/2] allow honouring libc provided SIGRTMIN/SIGRTMAX
Applied, thanks! On Wed, Sep 12, 2018 at 5:39 PM Rasmus Villemoes wrote: > > When an application documents that it responds such and such to > SIGRTMIN+n, that almost always means with respect to the libc-provided > SIGRTMIN. Hence I disagree with the "more correct" in commit > 7b276fc17594. In any case, this is rather unfortunate: > > # kill -l RTMIN+2 > 36 > # busybox kill -l RTMIN+2 > 34 > > (the first shell is bash). We probably can't change default behaviour > after 7 years, but at least we can provide a config option. > > We avoid a little code generation (repeated calls to > __libc_current_sigrtmin) by stashing SIGRTMIN/SIGRTMAX in local > variables, but it does cost ~50 bytes. The next patch serves as penance > for that. > > Signed-off-by: Rasmus Villemoes > --- > libbb/u_signal_names.c | 49 - > 1 file changed, 36 insertions(+), 13 deletions(-) > > diff --git a/libbb/u_signal_names.c b/libbb/u_signal_names.c > index b3038e32d..5ef5c3f28 100644 > --- a/libbb/u_signal_names.c > +++ b/libbb/u_signal_names.c > @@ -12,6 +12,15 @@ > //config: help > //config: Support RTMIN[+n] and RTMAX[-n] signal names > //config: in kill, killall etc. This costs ~250 bytes. > +//config:config FEATURE_RTMINMAX_USE_LIBC_DEFINITIONS > +//config: bool "Use the definitions of SIGRTMIN/SIGRTMAX provided by > libc" > +//config: depends on FEATURE_RTMINMAX > +//config: help > +//config: Some C libraries reserve a few real-time signals for internal > +//config: use, and adjust the values of SIGRTMIN/SIGRTMAX seen by > +//config: applications accordingly. Saying yes here means that a signal > +//config: name RTMIN+n will be interpreted according to the libc > definition > +//config: of SIGRTMIN, and not the raw definition provided by the > kernel. > > #include "libbb.h" > > @@ -123,7 +132,7 @@ static const char signals[][7] ALIGN1 = { > #ifdef SIGSYS > [SIGSYS ] = "SYS", > #endif > -#if ENABLE_FEATURE_RTMINMAX > +#if ENABLE_FEATURE_RTMINMAX && !ENABLE_FEATURE_RTMINMAX_USE_LIBC_DEFINITIONS > # ifdef __SIGRTMIN > [__SIGRTMIN] = "RTMIN", > # endif > @@ -140,6 +149,7 @@ static const char signals[][7] ALIGN1 = { > int FAST_FUNC get_signum(const char *name) > { > unsigned i; > + unsigned sigrtmin, sigrtmax; > > i = bb_strtou(name, NULL, 10); > if (!errno && i < NSIG) /* for shells, we allow 0 too */ > @@ -168,10 +178,13 @@ int FAST_FUNC get_signum(const char *name) > # endif > #endif > > -#if ENABLE_FEATURE_RTMINMAX > -# if defined(SIGRTMIN) && defined(SIGRTMAX) > -/* libc may use some rt sigs for pthreads and therefore "remap" SIGRTMIN/MAX, > - * but we want to use "raw" SIGRTMIN/MAX. Underscored names, if exist, > provide > +#if ENABLE_FEATURE_RTMINMAX && defined(SIGRTMIN) && defined(SIGRTMAX) > +# if ENABLE_FEATURE_RTMINMAX_USE_LIBC_DEFINITIONS > +/* Use the libc provided values. */ > + sigrtmin = SIGRTMIN; > + sigrtmax = SIGRTMAX; > +# else > +/* Use the "raw SIGRTMIN/MAX. Underscored names, if exist, provide > * them. If they don't exist, fall back to non-underscored ones: */ > # if !defined(__SIGRTMIN) > # define __SIGRTMIN SIGRTMIN > @@ -179,25 +192,27 @@ int FAST_FUNC get_signum(const char *name) > # if !defined(__SIGRTMAX) > # define __SIGRTMAX SIGRTMAX > # endif > + sigrtmin = __SIGRTMIN; > + sigrtmax = __SIGRTMAX; > +# endif > if (strncasecmp(name, "RTMIN", 5) == 0) { > if (!name[5]) > - return __SIGRTMIN; > + return sigrtmin; > if (name[5] == '+') { > i = bb_strtou(name + 6, NULL, 10); > - if (!errno && i <= __SIGRTMAX - __SIGRTMIN) > - return __SIGRTMIN + i; > + if (!errno && i <= sigrtmax - sigrtmin) > + return sigrtmin + i; > } > } > else if (strncasecmp(name, "RTMAX", 5) == 0) { > if (!name[5]) > - return __SIGRTMAX; > + return sigrtmax; > if (name[5] == '-') { > i = bb_strtou(name + 6, NULL, 10); > - if (!errno && i <= __SIGRTMAX - __SIGRTMIN) > - return __SIGRTMAX - i; > + if (!errno && i <= sigrtmax - sigrtmin) > + return sigrtmax - i; > } > } > -# endif > #endif > > return -1; > @@ -228,8 +243,16 @@ void FAST_FUNC print_signames(void) > printf("%2u) %s\n", signo, name); > } > #if ENABLE_FEATURE_RTMINMAX > -# ifdef __SIGRTMAX > +# if ENABLE_FEATURE_RTMINMAX_USE_LIBC_DEFINITIONS > +# if defined(SIGRTMIN) && defined(SIGRTMAX) > + printf("%2u) %s\n", SIGRTMIN, "RTMIN"); > + printf("%2u) %s\n",
Re: [PATCH 1/2] allow honouring libc provided SIGRTMIN/SIGRTMAX
On 2018-10-05 09:08, Rasmus Villemoes wrote: > On 2018-09-12 16:06, Rasmus Villemoes wrote: >> When an application documents that it responds such and such to >> SIGRTMIN+n, that almost always means with respect to the libc-provided >> SIGRTMIN. Hence I disagree with the "more correct" in commit >> 7b276fc17594. In any case, this is rather unfortunate: >> >> # kill -l RTMIN+2 >> 36 >> # busybox kill -l RTMIN+2 >> 34 >> >> (the first shell is bash). We probably can't change default behaviour >> after 7 years, but at least we can provide a config option. > > ping ping2 ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: [PATCH 1/2] allow honouring libc provided SIGRTMIN/SIGRTMAX
On Fri, Oct 05, 2018 at 11:42:30AM +, haroon maqsood wrote: > Did not reply to the group, here is the fixed patch. > it was a stupid mistake on my part. > Thanks > Haroon > > From: busybox on behalf of Rasmus Villemoes > > Sent: Friday, October 5, 2018 7:08 AM > To: busybox@busybox.net > Subject: Re: [PATCH 1/2] allow honouring libc provided SIGRTMIN/SIGRTMAX > > On 2018-09-12 16:06, Rasmus Villemoes wrote: > > When an application documents that it responds such and such to > > SIGRTMIN+n, that almost always means with respect to the libc-provided > > SIGRTMIN. Hence I disagree with the "more correct" in commit > > 7b276fc17594. In any case, this is rather unfortunate: > > > > # kill -l RTMIN+2 > > 36 > > # busybox kill -l RTMIN+2 > > 34 > > > > (the first shell is bash). We probably can't change default behaviour > > after 7 years, but at least we can provide a config option. > > ping > ___ > busybox mailing list > busybox@busybox.net > http://lists.busybox.net/mailman/listinfo/busybox > From 421a4bb100751ba33671d2f3f337bb81d2f8206e Mon Sep 17 00:00:00 2001 > From: hm > Date: Fri, 5 Oct 2018 11:05:37 +0100 > Subject: [PATCH] fix format specifier > > --- > include/bb_reiserfs_defs.h | 121 ++ > util-linux/mkfs_reiser.c| 113 +--- > util-linux/volume_id/reiserfs.c | 128 > 3 files changed, 185 insertions(+), 177 deletions(-) > create mode 100644 include/bb_reiserfs_defs.h > > diff --git a/include/bb_reiserfs_defs.h b/include/bb_reiserfs_defs.h > new file mode 100644 > index 0..1d8b2db86 > --- /dev/null > +++ b/include/bb_reiserfs_defs.h > @@ -0,0 +1,121 @@ > +/* > + * bb_reiserfs_defs.h > + * > + * Created on: 3 Oct 2018 > + * Author: nharoon > + */ > + > +#ifndef BB_REISERFS_DEFS_H_ > +#define BB_REISERFS_DEFS_H_ > + > +struct journal_params { > +uint32_t jp_journal_1st_block; /* where does journal start from on its > + device */ > +uint32_t jp_journal_dev; /* journal device st_rdev */ > +uint32_t jp_journal_size; /* size of the journal on FS creation. used to > + make sure they don't overflow it */ > +uint32_t jp_journal_trans_max; /* max number of blocks in a transaction. > */ > +uint32_t jp_journal_magic; /* random value made on fs creation (this > was > + sb_journal_block_count) */ > +uint32_t jp_journal_max_batch; /* max number of blocks to batch into a > trans */ > +uint32_t jp_journal_max_commit_age; /* in seconds, how old can an > async commit be */ > +uint32_t jp_journal_max_trans_age; /* in seconds, how old can a > transaction be */ > +}; > + > +struct reiserfs_journal_header { > + uint32_t jh_last_flush_trans_id;/* id of last fully flushed > transaction */ > + uint32_t jh_first_unflushed_offset; /* offset in the log of where to > start replay after a crash */ > + uint32_t jh_mount_id; > + struct journal_params jh_journal; > + uint32_t jh_last_check_mount_id;/* the mount id of the fs during > the last reiserfsck --check. */ > +}; > + > + > + > +struct reiserfs_super_block_v1 > +{ > +uint32_t sb_block_count; /* 0 number of block on data device OK*/ > +uint32_t sb_free_blocks; /* 4 free blocks count */ > +uint32_t sb_root_block;/* 8 root of the tree */ > + > +struct journal_params sb_journal; /* 12 */ > + > +uint16_t sb_blocksize; /* 44 */ > +uint16_t sb_oid_maxsize; /* 46 max size of object id array, see > + get_objectid() commentary */ > +uint16_t sb_oid_cursize; /* 48 current size of object id array */ > +uint16_t sb_umount_state; /* 50 this is set to 1 when filesystem was > + umounted, to 2 - when not */ > + > +char s_magic[10]; /* 52 reiserfs magic string indicates that > + file system is reiserfs: "ReIsErFs" or > + "ReIsEr2Fs" or "ReIsEr3Fs" */ > +uint16_t sb_fs_state; /* 62 it is set to used by fsck to mark which > phase of > + rebuilding is done (used for fsck debugging) */ > +uint32_t sb_hash_function_code;/* 64 code of fuction which was/is/will be > + used to sort names in a directory. See > + codes in above */ > +uint16_t sb_tree_height; /* 68 height of filesytem tree. Tree > +
Re: [PATCH 1/2] allow honouring libc provided SIGRTMIN/SIGRTMAX
Did not reply to the group, here is the fixed patch. it was a stupid mistake on my part. Thanks Haroon From: busybox on behalf of Rasmus Villemoes Sent: Friday, October 5, 2018 7:08 AM To: busybox@busybox.net Subject: Re: [PATCH 1/2] allow honouring libc provided SIGRTMIN/SIGRTMAX On 2018-09-12 16:06, Rasmus Villemoes wrote: > When an application documents that it responds such and such to > SIGRTMIN+n, that almost always means with respect to the libc-provided > SIGRTMIN. Hence I disagree with the "more correct" in commit > 7b276fc17594. In any case, this is rather unfortunate: > > # kill -l RTMIN+2 > 36 > # busybox kill -l RTMIN+2 > 34 > > (the first shell is bash). We probably can't change default behaviour > after 7 years, but at least we can provide a config option. ping ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox From 421a4bb100751ba33671d2f3f337bb81d2f8206e Mon Sep 17 00:00:00 2001 From: hm Date: Fri, 5 Oct 2018 11:05:37 +0100 Subject: [PATCH] fix format specifier --- include/bb_reiserfs_defs.h | 121 ++ util-linux/mkfs_reiser.c| 113 +--- util-linux/volume_id/reiserfs.c | 128 3 files changed, 185 insertions(+), 177 deletions(-) create mode 100644 include/bb_reiserfs_defs.h diff --git a/include/bb_reiserfs_defs.h b/include/bb_reiserfs_defs.h new file mode 100644 index 0..1d8b2db86 --- /dev/null +++ b/include/bb_reiserfs_defs.h @@ -0,0 +1,121 @@ +/* + * bb_reiserfs_defs.h + * + * Created on: 3 Oct 2018 + * Author: nharoon + */ + +#ifndef BB_REISERFS_DEFS_H_ +#define BB_REISERFS_DEFS_H_ + +struct journal_params { +uint32_t jp_journal_1st_block; /* where does journal start from on its + device */ +uint32_t jp_journal_dev; /* journal device st_rdev */ +uint32_t jp_journal_size; /* size of the journal on FS creation. used to + make sure they don't overflow it */ +uint32_t jp_journal_trans_max; /* max number of blocks in a transaction. */ +uint32_t jp_journal_magic; /* random value made on fs creation (this was + sb_journal_block_count) */ +uint32_t jp_journal_max_batch; /* max number of blocks to batch into a trans */ +uint32_t jp_journal_max_commit_age; /* in seconds, how old can an async commit be */ +uint32_t jp_journal_max_trans_age; /* in seconds, how old can a transaction be */ +}; + +struct reiserfs_journal_header { + uint32_t jh_last_flush_trans_id;/* id of last fully flushed transaction */ + uint32_t jh_first_unflushed_offset; /* offset in the log of where to start replay after a crash */ + uint32_t jh_mount_id; + struct journal_params jh_journal; + uint32_t jh_last_check_mount_id;/* the mount id of the fs during the last reiserfsck --check. */ +}; + + + +struct reiserfs_super_block_v1 +{ +uint32_t sb_block_count; /* 0 number of block on data device OK*/ +uint32_t sb_free_blocks; /* 4 free blocks count */ +uint32_t sb_root_block;/* 8 root of the tree */ + +struct journal_params sb_journal; /* 12 */ + +uint16_t sb_blocksize; /* 44 */ +uint16_t sb_oid_maxsize; /* 46 max size of object id array, see + get_objectid() commentary */ +uint16_t sb_oid_cursize; /* 48 current size of object id array */ +uint16_t sb_umount_state; /* 50 this is set to 1 when filesystem was + umounted, to 2 - when not */ + +char s_magic[10]; /* 52 reiserfs magic string indicates that + file system is reiserfs: "ReIsErFs" or + "ReIsEr2Fs" or "ReIsEr3Fs" */ +uint16_t sb_fs_state; /* 62 it is set to used by fsck to mark which phase of + rebuilding is done (used for fsck debugging) */ +uint32_t sb_hash_function_code;/* 64 code of fuction which was/is/will be + used to sort names in a directory. See + codes in above */ +uint16_t sb_tree_height; /* 68 height of filesytem tree. Tree + consisting of only one root block has 2 + here */ +uint16_t sb_bmap_nr; /* 70 amount of bitmap blocks needed to + address each block of file system */ +uint16_t sb_version; /* 72 this field is only reliable on + filesystem with non-standard journal */ +uint16_t sb_reserved_for_journal; /* 74 size in blocks of journal area on + main device, we need to keep after + non-standard journal relocation */ +}; + +struct reiserfs_super_block +{ +/* 0 */struct reiserfs_super_block_v1 s_v1; +/* 76 */ uint32_t sb_inode_gener
Re: [PATCH 1/2] allow honouring libc provided SIGRTMIN/SIGRTMAX
On 2018-09-12 16:06, Rasmus Villemoes wrote: > When an application documents that it responds such and such to > SIGRTMIN+n, that almost always means with respect to the libc-provided > SIGRTMIN. Hence I disagree with the "more correct" in commit > 7b276fc17594. In any case, this is rather unfortunate: > > # kill -l RTMIN+2 > 36 > # busybox kill -l RTMIN+2 > 34 > > (the first shell is bash). We probably can't change default behaviour > after 7 years, but at least we can provide a config option. ping ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
[PATCH 1/2] allow honouring libc provided SIGRTMIN/SIGRTMAX
When an application documents that it responds such and such to SIGRTMIN+n, that almost always means with respect to the libc-provided SIGRTMIN. Hence I disagree with the "more correct" in commit 7b276fc17594. In any case, this is rather unfortunate: # kill -l RTMIN+2 36 # busybox kill -l RTMIN+2 34 (the first shell is bash). We probably can't change default behaviour after 7 years, but at least we can provide a config option. We avoid a little code generation (repeated calls to __libc_current_sigrtmin) by stashing SIGRTMIN/SIGRTMAX in local variables, but it does cost ~50 bytes. The next patch serves as penance for that. Signed-off-by: Rasmus Villemoes --- libbb/u_signal_names.c | 49 - 1 file changed, 36 insertions(+), 13 deletions(-) diff --git a/libbb/u_signal_names.c b/libbb/u_signal_names.c index b3038e32d..5ef5c3f28 100644 --- a/libbb/u_signal_names.c +++ b/libbb/u_signal_names.c @@ -12,6 +12,15 @@ //config: help //config: Support RTMIN[+n] and RTMAX[-n] signal names //config: in kill, killall etc. This costs ~250 bytes. +//config:config FEATURE_RTMINMAX_USE_LIBC_DEFINITIONS +//config: bool "Use the definitions of SIGRTMIN/SIGRTMAX provided by libc" +//config: depends on FEATURE_RTMINMAX +//config: help +//config: Some C libraries reserve a few real-time signals for internal +//config: use, and adjust the values of SIGRTMIN/SIGRTMAX seen by +//config: applications accordingly. Saying yes here means that a signal +//config: name RTMIN+n will be interpreted according to the libc definition +//config: of SIGRTMIN, and not the raw definition provided by the kernel. #include "libbb.h" @@ -123,7 +132,7 @@ static const char signals[][7] ALIGN1 = { #ifdef SIGSYS [SIGSYS ] = "SYS", #endif -#if ENABLE_FEATURE_RTMINMAX +#if ENABLE_FEATURE_RTMINMAX && !ENABLE_FEATURE_RTMINMAX_USE_LIBC_DEFINITIONS # ifdef __SIGRTMIN [__SIGRTMIN] = "RTMIN", # endif @@ -140,6 +149,7 @@ static const char signals[][7] ALIGN1 = { int FAST_FUNC get_signum(const char *name) { unsigned i; + unsigned sigrtmin, sigrtmax; i = bb_strtou(name, NULL, 10); if (!errno && i < NSIG) /* for shells, we allow 0 too */ @@ -168,10 +178,13 @@ int FAST_FUNC get_signum(const char *name) # endif #endif -#if ENABLE_FEATURE_RTMINMAX -# if defined(SIGRTMIN) && defined(SIGRTMAX) -/* libc may use some rt sigs for pthreads and therefore "remap" SIGRTMIN/MAX, - * but we want to use "raw" SIGRTMIN/MAX. Underscored names, if exist, provide +#if ENABLE_FEATURE_RTMINMAX && defined(SIGRTMIN) && defined(SIGRTMAX) +# if ENABLE_FEATURE_RTMINMAX_USE_LIBC_DEFINITIONS +/* Use the libc provided values. */ + sigrtmin = SIGRTMIN; + sigrtmax = SIGRTMAX; +# else +/* Use the "raw SIGRTMIN/MAX. Underscored names, if exist, provide * them. If they don't exist, fall back to non-underscored ones: */ # if !defined(__SIGRTMIN) # define __SIGRTMIN SIGRTMIN @@ -179,25 +192,27 @@ int FAST_FUNC get_signum(const char *name) # if !defined(__SIGRTMAX) # define __SIGRTMAX SIGRTMAX # endif + sigrtmin = __SIGRTMIN; + sigrtmax = __SIGRTMAX; +# endif if (strncasecmp(name, "RTMIN", 5) == 0) { if (!name[5]) - return __SIGRTMIN; + return sigrtmin; if (name[5] == '+') { i = bb_strtou(name + 6, NULL, 10); - if (!errno && i <= __SIGRTMAX - __SIGRTMIN) - return __SIGRTMIN + i; + if (!errno && i <= sigrtmax - sigrtmin) + return sigrtmin + i; } } else if (strncasecmp(name, "RTMAX", 5) == 0) { if (!name[5]) - return __SIGRTMAX; + return sigrtmax; if (name[5] == '-') { i = bb_strtou(name + 6, NULL, 10); - if (!errno && i <= __SIGRTMAX - __SIGRTMIN) - return __SIGRTMAX - i; + if (!errno && i <= sigrtmax - sigrtmin) + return sigrtmax - i; } } -# endif #endif return -1; @@ -228,8 +243,16 @@ void FAST_FUNC print_signames(void) printf("%2u) %s\n", signo, name); } #if ENABLE_FEATURE_RTMINMAX -# ifdef __SIGRTMAX +# if ENABLE_FEATURE_RTMINMAX_USE_LIBC_DEFINITIONS +# if defined(SIGRTMIN) && defined(SIGRTMAX) + printf("%2u) %s\n", SIGRTMIN, "RTMIN"); + printf("%2u) %s\n", SIGRTMAX, "RTMAX"); +# endif +# else +// __SIGRTMIN is included in signals[] array. +# ifdef __SIGRTMAX printf("%2u) %s\n", __SIGRTMAX, "RTMAX"); +# endif # endif #endif } -- 2.16.4 ___ busybox mailing list busybox@busybox.net