diff options
author | Dan McDonald <danmcd@joyent.com> | 2021-11-03 10:25:18 -0400 |
---|---|---|
committer | Dan McDonald <danmcd@joyent.com> | 2021-11-03 10:25:18 -0400 |
commit | 6aa2048ab726a6fa7d29dc204e77b1d6ee48eb2e (patch) | |
tree | c85ff71e6bf0d418b19243d43604ba9a1f31ff84 /usr/src/lib | |
parent | 1e09a794d96ea9140ef8ebc9ed4e214d4344d83a (diff) | |
parent | 6e2462f93bf3de7b08885a4677464e11be3c807b (diff) | |
download | illumos-joyent-6aa2048ab726a6fa7d29dc204e77b1d6ee48eb2e.tar.gz |
[illumos-gate merge]
commit 6e2462f93bf3de7b08885a4677464e11be3c807b
14196 Want librename
commit 99e6398ed34e1943640f382fec1971ba1ecc2f99
14036 pxeboot: improve and simplify rx handling
Conflicts:
usr/src/lib/Makefile
usr/src/lib/librename/Makefile
usr/src/lib/librename/Makefile.com
usr/src/lib/librename/amd64/Makefile
usr/src/lib/librename/common/librename.c
usr/src/lib/librename/common/librename.h
usr/src/lib/librename/i386/Makefile
Diffstat (limited to 'usr/src/lib')
-rw-r--r-- | usr/src/lib/librename/Makefile | 7 | ||||
-rw-r--r-- | usr/src/lib/librename/Makefile.com | 6 | ||||
-rw-r--r-- | usr/src/lib/librename/amd64/Makefile | 2 | ||||
-rw-r--r-- | usr/src/lib/librename/common/librename.c | 32 | ||||
-rw-r--r-- | usr/src/lib/librename/i386/Makefile | 2 |
5 files changed, 18 insertions, 31 deletions
diff --git a/usr/src/lib/librename/Makefile b/usr/src/lib/librename/Makefile index 1278c6cc9d..6ae7851aa3 100644 --- a/usr/src/lib/librename/Makefile +++ b/usr/src/lib/librename/Makefile @@ -24,15 +24,14 @@ all := TARGET = all clean := TARGET = clean clobber := TARGET = clobber install := TARGET = install -lint := TARGET = lint .KEEP_STATE: -all clean clobber lint: $(SUBDIRS) +all clean clobber: $(SUBDIRS) -install: $(SUBDIRS) install_h +install: $(SUBDIRS) install_h -install_h: $(ROOTHDRS) +install_h: $(ROOTHDRS) check: $(CHECKHDRS) diff --git a/usr/src/lib/librename/Makefile.com b/usr/src/lib/librename/Makefile.com index f0a22f25ac..ab09db7efb 100644 --- a/usr/src/lib/librename/Makefile.com +++ b/usr/src/lib/librename/Makefile.com @@ -15,11 +15,11 @@ LIBRARY = librename.a VERS = .1 -OBJECTS = librename.o \ +OBJECTS = librename.o include ../../Makefile.lib -LIBS = $(DYNLIB) $(LINTLIB) +LIBS = $(DYNLIB) LDLIBS += -lc CPPFLAGS += -I../common @@ -29,6 +29,4 @@ SRCDIR = ../common all: $(LIBS) -lint: lintcheck - include ../../Makefile.targ diff --git a/usr/src/lib/librename/amd64/Makefile b/usr/src/lib/librename/amd64/Makefile index 15d904c616..e03ee6aac6 100644 --- a/usr/src/lib/librename/amd64/Makefile +++ b/usr/src/lib/librename/amd64/Makefile @@ -16,4 +16,4 @@ include ../Makefile.com include ../../Makefile.lib.64 -install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTLINT64) +install: all $(ROOTLIBS64) $(ROOTLINKS64) diff --git a/usr/src/lib/librename/common/librename.c b/usr/src/lib/librename/common/librename.c index 1e198a50a3..1f522dcec3 100644 --- a/usr/src/lib/librename/common/librename.c +++ b/usr/src/lib/librename/common/librename.c @@ -23,6 +23,7 @@ #include <stdlib.h> #include <string.h> #include <stdio.h> +#include <sys/debug.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> @@ -89,12 +90,10 @@ librename_atomic_fdinit(int fd, const char *file, const char *prefix, return (ret); } - lrap->lra_fname = strdup(file); if (lrap->lra_fname == NULL) { ret = errno; - if (close(lrap->lra_dirfd) != 0) - abort(); + VERIFY0(close(lrap->lra_dirfd)); free(lrap); return (ret); } @@ -108,8 +107,7 @@ librename_atomic_fdinit(int fd, const char *file, const char *prefix, if (ret == -1) { ret = errno; free(lrap->lra_fname); - if (close(lrap->lra_dirfd) != 0) - abort(); + VERIFY0(close(lrap->lra_dirfd)); free(lrap); return (errno); } @@ -127,14 +125,12 @@ librename_atomic_fdinit(int fd, const char *file, const char *prefix, ret = errno; free(lrap->lra_altname); free(lrap->lra_fname); - if (close(lrap->lra_dirfd) != 0) - abort(); + VERIFY0(close(lrap->lra_dirfd)); free(lrap); return (ret); } - if (mutex_init(&lrap->lra_lock, USYNC_THREAD, NULL) != 0) - abort(); + VERIFY0(mutex_init(&lrap->lra_lock, USYNC_THREAD, NULL)); lrap->lra_state = LIBRENAME_ATOMIC_INITIAL; *outp = lrap; @@ -151,8 +147,7 @@ librename_atomic_init(const char *dir, const char *file, const char *prefix, return (errno); ret = librename_atomic_fdinit(fd, file, prefix, mode, flags, outp); - if (close(fd) != 0) - abort(); + VERIFY0(close(fd)); return (ret); } @@ -175,8 +170,7 @@ librename_atomic_commit(librename_atomic_t *lrap) { int ret = 0; - if (mutex_lock(&lrap->lra_lock) != 0) - abort(); + VERIFY0(mutex_lock(&lrap->lra_lock)); if (lrap->lra_state == LIBRENAME_ATOMIC_COMPLETED) { ret = EINVAL; goto out; @@ -208,8 +202,7 @@ librename_atomic_commit(librename_atomic_t *lrap) lrap->lra_state = LIBRENAME_ATOMIC_COMPLETED; out: - if (mutex_unlock(&lrap->lra_lock) != 0) - abort(); + VERIFY0(mutex_unlock(&lrap->lra_lock)); return (ret); } @@ -219,11 +212,8 @@ librename_atomic_fini(librename_atomic_t *lrap) free(lrap->lra_altname); free(lrap->lra_fname); - if (close(lrap->lra_tmpfd) != 0) - abort(); - if (close(lrap->lra_dirfd) != 0) - abort(); - if (mutex_destroy(&lrap->lra_lock) != 0) - abort(); + VERIFY0(close(lrap->lra_tmpfd)); + VERIFY0(close(lrap->lra_dirfd)); + VERIFY0(mutex_destroy(&lrap->lra_lock)); free(lrap); } diff --git a/usr/src/lib/librename/i386/Makefile b/usr/src/lib/librename/i386/Makefile index 41e699e8f8..73fc6a2070 100644 --- a/usr/src/lib/librename/i386/Makefile +++ b/usr/src/lib/librename/i386/Makefile @@ -15,4 +15,4 @@ include ../Makefile.com -install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT) +install: all $(ROOTLIBS) $(ROOTLINKS) |